From 9e6b580b1d9e70549afb80b14a527d1b2292f7c2 Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Tue, 27 Feb 2024 03:20:11 +0000 Subject: [PATCH] feat: update via SDK Studio --- account.go | 2 + accountmember_test.go | 10 +- activationcheck.go | 138 - address.go | 2 + addressing.go | 28 - addressingprefix.go | 29 - addressingprefixbgpprefix.go | 599 -- addressingservice.go | 143 - addressprefix.go | 4 +- addressprefixbgp.go | 4 + ...ixbinding.go => addressprefixbgpbinding.go | 346 +- ...test.go => addressprefixbgpbinding_test.go | 24 +- addressprefixbgpprefix.go | 598 ++ ..._test.go => addressprefixbgpprefix_test.go | 20 +- addressprefixbgpstatus_test.go | 4 +- addressservice.go | 143 + ...gservice_test.go => addressservice_test.go | 4 +- api.md | 2816 +++-- brandprotection.go | 439 +- brandprotection_test.go | 75 + brandprotectionsubmit.go | 210 - brandprotectionsubmit_test.go | 43 - brandprotectionurlinfo.go | 280 - brandprotectionurlinfo_test.go | 46 - client.go | 32 +- d1.go | 6 +- d1database.go | 352 + d1database_test.go | 98 +- dns.go | 8 +- dnsanalyticreportbytime.go | 288 - dnsanalytic.go => dnsanalytics.go | 16 +- dnsanalyticreport.go => dnsanalyticsreport.go | 130 +- ...port_test.go => dnsanalyticsreport_test.go | 6 +- dnsanalyticsreportbytime.go | 288 + ...est.go => dnsanalyticsreportbytime_test.go | 8 +- firewallaccessrule_test.go | 10 +- firewalllockdown_test.go | 10 +- firewallrule_test.go | 12 +- firewalluarule_test.go | 10 +- firewallwafoverride_test.go | 10 +- firewallwafpackage_test.go | 4 +- firewallwafpackagegroup_test.go | 6 +- firewallwafpackagerule.go | 668 +- firewallwafpackagerule_test.go | 38 +- image.go | 8 +- imagev1_test.go | 10 +- imagev1blob_test.go | 2 +- imagev1key_test.go | 2 +- imagev1stat_test.go | 2 +- imagev1variant_test.go | 10 +- imagev2_test.go | 2 +- imagev2directupload_test.go | 2 +- internal/shared/union.go | 22 +- kv.go | 26 + kvnamespace.go | 462 + ...kvnamespace_test.go => kvnamespace_test.go | 24 +- kvnamespacebulk.go | 283 + ...acebulk_test.go => kvnamespacebulk_test.go | 14 +- kvnamespacekey.go | 195 + ...spacekey_test.go => kvnamespacekey_test.go | 6 +- kvnamespacemetadata.go | 124 + ...ata_test.go => kvnamespacemetadata_test.go | 6 +- kvnamespacevalue.go | 274 + ...evalue_test.go => kvnamespacevalue_test.go | 18 +- magic.go | 32 - magiccfinterconnect.go | 512 - magicgretunnel.go | 865 -- magicipsectunnel.go | 942 -- magicipsectunnelpskgenerate.go | 161 - magicroute.go | 816 -- magictransit.go | 33 + magictransitcfinterconnect.go | 513 + ...t.go => magictransitcfinterconnect_test.go | 22 +- magictransitgretunnel.go | 865 ++ ...l_test.go => magictransitgretunnel_test.go | 32 +- magictransitipsectunnel.go | 944 ++ ...test.go => magictransitipsectunnel_test.go | 40 +- magictransitipsectunnelpskgenerate.go | 165 + ...magictransitipsectunnelpskgenerate_test.go | 4 +- magictransitroute.go | 817 ++ ...route_test.go => magictransitroute_test.go | 34 +- radar.go | 2 - radaremailsecuritytimeseriesgroup.go | 923 ++ radaremailsecuritytimeseriesgroup_test.go | 193 + requesttracertrace.go | 98 +- rulesetrule.go | 21 +- rulesetrule_test.go | 4 +- setting.go | 9343 ---------------- settingadvancedddos.go | 173 - settingalwaysonline.go | 339 - settingalwaysusehttps.go | 327 - settingautomatichttpsrewrite.go | 319 - settingautomaticplatformoptimization.go | 308 - settingbrotli.go | 321 - settingbrowsercachettl.go | 413 - settingbrowsercheck.go | 339 - settingcachelevel.go | 342 - settingcachelevel_test.go | 71 - settingchallengettl.go | 375 - settingchallengettl_test.go | 71 - settingcipher.go | 295 - settingdevelopmentmode.go | 355 - settingearlyhint.go | 333 - settingemailobfuscation.go | 321 - settingfontsetting.go | 327 - settingh2prioritization.go | 358 - settinghotlinkprotection.go | 351 - settinghttp2.go | 315 - settinghttp3.go | 315 - settingimageresizing.go | 370 - settingipgeolocation.go | 327 - settingipv6.go | 321 - settingminify.go | 439 - settingmintlsversion.go | 329 - settingmintlsversion_test.go | 71 - settingmirage.go | 333 - settingmirage_test.go | 71 - settingmobileredirect.go | 403 - settingnel.go | 365 - settingopportunisticencryption.go | 321 - settingopportunisticencryption_test.go | 71 - settingopportunisticonion.go | 323 - settingorangetoorange.go | 351 - settingorangetoorange_test.go | 74 - settingoriginerrorpagepassthru.go | 331 - settingoriginerrorpagepassthru_test.go | 71 - settingoriginmaxhttpversion.go | 334 - settingoriginmaxhttpversion_test.go | 71 - settingpolish.go | 380 - settingprefetchpreload.go | 321 - settingprefetchpreload_test.go | 71 - settingproxyreadtimeout.go | 319 - settingpseudoipv4.go | 318 - settingresponsebuffering.go | 333 - settingrocketloader_test.go | 74 - settingsecurityheader.go | 411 - settingsecuritylevel.go | 345 - settingserversideexclude_test.go | 71 - settingsortquerystringforcache.go | 331 - settingsortquerystringforcache_test.go | 71 - settingsslrecommender.go | 293 - settingtls13.go | 320 - settingtls13_test.go | 71 - settingtlsclientauth.go | 321 - settingtlsclientauth_test.go | 71 - settingtrueclientipheader.go | 321 - settingtrueclientipheader_test.go | 71 - settingwaf_test.go | 71 - settingwebp.go | 327 - settingwebp_test.go | 71 - settingwebsocket.go | 342 - settingwebsocket_test.go | 71 - settingzerortt.go | 315 - storage.go | 2 - storagekv.go | 26 - storagekvnamespace.go | 465 - storagekvnamespacebulk.go | 283 - storagekvnamespacekey.go | 195 - storagekvnamespacemetadata.go | 124 - storagekvnamespacevalue.go | 274 - teamnetroute.go | 418 + teamnetroute_test.go | 102 +- teamnetrouteip_test.go | 2 +- teamnetroutenetwork_test.go | 6 +- teamnetvirtualnetwork_test.go | 8 +- tunnel.go | 4 +- tunneltoken_test.go | 2 +- user.go | 20 +- userfirewallaccessrule.go | 1353 ++- ..._test.go => userfirewallaccessrule_test.go | 42 +- userfirewallaccessrulerule.go | 1379 --- userloadbalancer.go | 10 +- ...nalytic.go => userloadbalanceranalytics.go | 16 +- ...nt.go => userloadbalanceranalyticsevent.go | 96 +- ... => userloadbalanceranalyticsevent_test.go | 4 +- usertoken.go | 4 +- usertokenvalue_test.go | 2 +- worker.go | 28 +- workerdeploymentsbyscript.go | 249 - workerdeploymentsbyscript_test.go | 79 - workerscript.go | 6 + workerscriptcontent_test.go | 2 +- workerscriptcontentv2_test.go | 2 +- workerscriptsetting_test.go | 4 +- zerotrust.go | 16 +- zerotrustconnectivitysetting.go | 146 +- zerotrustconnectivitysetting_test.go | 8 +- zone.go | 6 + zoneactivationcheck.go | 138 + ...eck_test.go => zoneactivationcheck_test.go | 4 +- zonesetting.go | 9372 +++++++++++++++++ setting_test.go => zonesetting_test.go | 26 +- zonesettingadvancedddos.go | 173 + ...test.go => zonesettingadvancedddos_test.go | 4 +- zonesettingalwaysonline.go | 339 + ...test.go => zonesettingalwaysonline_test.go | 10 +- zonesettingalwaysusehttps.go | 327 + ...st.go => zonesettingalwaysusehttps_test.go | 10 +- zonesettingautomatichttpsrewrite.go | 321 + zonesettingautomatichttpsrewrite_test.go | 71 + zonesettingautomaticplatformoptimization.go | 308 + ...ttingautomaticplatformoptimization_test.go | 10 +- zonesettingbrotli.go | 321 + ...oipv4_test.go => zonesettingbrotli_test.go | 10 +- zonesettingbrowsercachettl.go | 413 + zonesettingbrowsercachettl_test.go | 71 + zonesettingbrowsercheck.go | 339 + ...test.go => zonesettingbrowsercheck_test.go | 10 +- zonesettingcachelevel.go | 342 + ...l_test.go => zonesettingcachelevel_test.go | 10 +- zonesettingchallengettl.go | 375 + ...test.go => zonesettingchallengettl_test.go | 10 +- zonesettingcipher.go | 295 + ...ipher_test.go => zonesettingcipher_test.go | 8 +- zonesettingdevelopmentmode.go | 355 + zonesettingdevelopmentmode_test.go | 71 + zonesettingearlyhint.go | 333 + ...on_test.go => zonesettingearlyhint_test.go | 10 +- zonesettingemailobfuscation.go | 322 + zonesettingemailobfuscation_test.go | 71 + zonesettingfontsetting.go | 327 + ..._test.go => zonesettingfontsetting_test.go | 10 +- zonesettingh2prioritization.go | 359 + zonesettingh2prioritization_test.go | 74 + zonesettinghotlinkprotection.go | 353 + ...go => zonesettinghotlinkprotection_test.go | 10 +- zonesettinghttp2.go | 315 + ...lyhint_test.go => zonesettinghttp2_test.go | 10 +- zonesettinghttp3.go | 315 + ...ghttp2_test.go => zonesettinghttp3_test.go | 10 +- zonesettingimageresizing.go | 370 + ...est.go => zonesettingimageresizing_test.go | 15 +- zonesettingipgeolocation.go | 327 + ...est.go => zonesettingipgeolocation_test.go | 10 +- zonesettingipv6.go | 321 + ...nghttp3_test.go => zonesettingipv6_test.go | 10 +- zonesettingminify.go | 439 + ...izing_test.go => zonesettingminify_test.go | 15 +- zonesettingmintlsversion.go | 329 + zonesettingmintlsversion_test.go | 71 + zonesettingmirage.go | 333 + zonesettingmirage_test.go | 71 + zonesettingmobileredirect.go | 403 + ...st.go => zonesettingmobileredirect_test.go | 12 +- zonesettingnel.go | 366 + settingnel_test.go => zonesettingnel_test.go | 14 +- zonesettingopportunisticencryption.go | 322 + zonesettingopportunisticencryption_test.go | 71 + zonesettingopportunisticonion.go | 326 + zonesettingopportunisticonion_test.go | 71 + zonesettingorangetoorange.go | 351 + zonesettingorangetoorange_test.go | 74 + zonesettingoriginerrorpagepassthru.go | 332 + zonesettingoriginerrorpagepassthru_test.go | 71 + zonesettingoriginmaxhttpversion.go | 337 + ...=> zonesettingoriginmaxhttpversion_test.go | 10 +- zonesettingpolish.go | 380 + ...olish_test.go => zonesettingpolish_test.go | 14 +- zonesettingprefetchpreload.go | 321 + zonesettingprefetchpreload_test.go | 71 + zonesettingproxyreadtimeout.go | 320 + ....go => zonesettingproxyreadtimeout_test.go | 12 +- zonesettingpseudoipv4.go | 318 + ...k_test.go => zonesettingpseudoipv4_test.go | 10 +- zonesettingresponsebuffering.go | 335 + zonesettingresponsebuffering_test.go | 71 + ...ketloader.go => zonesettingrocketloader.go | 230 +- ...test.go => zonesettingrocketloader_test.go | 14 +- zonesettingsecurityheader.go | 411 + ...st.go => zonesettingsecurityheader_test.go | 12 +- zonesettingsecuritylevel.go | 345 + zonesettingsecuritylevel_test.go | 71 + ...lude.go => zonesettingserversideexclude.go | 214 +- zonesettingserversideexclude_test.go | 71 + zonesettingsortquerystringforcache.go | 332 + zonesettingsortquerystringforcache_test.go | 71 + settingssl.go => zonesettingssl.go | 225 +- settingipv6_test.go => zonesettingssl_test.go | 10 +- zonesettingsslrecommender.go | 293 + ...st.go => zonesettingsslrecommender_test.go | 12 +- zonesettingtls13.go | 320 + zonesettingtls13_test.go | 71 + zonesettingtlsclientauth.go | 321 + ...est.go => zonesettingtlsclientauth_test.go | 10 +- zonesettingtrueclientipheader.go | 324 + zonesettingtrueclientipheader_test.go | 71 + settingwaf.go => zonesettingwaf.go | 213 +- ...gzerortt_test.go => zonesettingwaf_test.go | 10 +- zonesettingwebp.go | 327 + ...gbrotli_test.go => zonesettingwebp_test.go | 10 +- zonesettingwebsocket.go | 342 + ...el_test.go => zonesettingwebsocket_test.go | 10 +- zonesettingzerortt.go | 315 + ...ting_test.go => zonesettingzerortt_test.go | 10 +- zoneworker.go | 26 + zoneworkerscript.go | 168 + zoneworkerscript_test.go | 114 + 297 files changed, 39576 insertions(+), 37899 deletions(-) delete mode 100644 activationcheck.go delete mode 100644 addressing.go delete mode 100644 addressingprefix.go delete mode 100644 addressingprefixbgpprefix.go delete mode 100644 addressingservice.go rename addressingprefixbinding.go => addressprefixbgpbinding.go (51%) rename addressingprefixbinding_test.go => addressprefixbgpbinding_test.go (87%) create mode 100644 addressprefixbgpprefix.go rename addressingprefixbgpprefix_test.go => addressprefixbgpprefix_test.go (85%) create mode 100644 addressservice.go rename addressingservice_test.go => addressservice_test.go (89%) create mode 100644 brandprotection_test.go delete mode 100644 brandprotectionsubmit.go delete mode 100644 brandprotectionsubmit_test.go delete mode 100644 brandprotectionurlinfo.go delete mode 100644 brandprotectionurlinfo_test.go delete mode 100644 dnsanalyticreportbytime.go rename dnsanalytic.go => dnsanalytics.go (52%) rename dnsanalyticreport.go => dnsanalyticsreport.go (54%) rename dnsanalyticreport_test.go => dnsanalyticsreport_test.go (90%) create mode 100644 dnsanalyticsreportbytime.go rename dnsanalyticreportbytime_test.go => dnsanalyticsreportbytime_test.go (85%) create mode 100644 kv.go create mode 100644 kvnamespace.go rename storagekvnamespace_test.go => kvnamespace_test.go (84%) create mode 100644 kvnamespacebulk.go rename storagekvnamespacebulk_test.go => kvnamespacebulk_test.go (89%) create mode 100644 kvnamespacekey.go rename storagekvnamespacekey_test.go => kvnamespacekey_test.go (89%) create mode 100644 kvnamespacemetadata.go rename storagekvnamespacemetadata_test.go => kvnamespacemetadata_test.go (88%) create mode 100644 kvnamespacevalue.go rename storagekvnamespacevalue_test.go => kvnamespacevalue_test.go (87%) delete mode 100644 magic.go delete mode 100644 magiccfinterconnect.go delete mode 100644 magicgretunnel.go delete mode 100644 magicipsectunnel.go delete mode 100644 magicipsectunnelpskgenerate.go delete mode 100644 magicroute.go create mode 100644 magictransit.go create mode 100644 magictransitcfinterconnect.go rename magiccfinterconnect_test.go => magictransitcfinterconnect_test.go (80%) create mode 100644 magictransitgretunnel.go rename magicgretunnel_test.go => magictransitgretunnel_test.go (83%) create mode 100644 magictransitipsectunnel.go rename magicipsectunnel_test.go => magictransitipsectunnel_test.go (79%) create mode 100644 magictransitipsectunnelpskgenerate.go rename magicipsectunnelpskgenerate_test.go => magictransitipsectunnelpskgenerate_test.go (90%) create mode 100644 magictransitroute.go rename magicroute_test.go => magictransitroute_test.go (87%) delete mode 100644 setting.go delete mode 100644 settingadvancedddos.go delete mode 100644 settingalwaysonline.go delete mode 100644 settingalwaysusehttps.go delete mode 100644 settingautomatichttpsrewrite.go delete mode 100644 settingautomaticplatformoptimization.go delete mode 100644 settingbrotli.go delete mode 100644 settingbrowsercachettl.go delete mode 100644 settingbrowsercheck.go delete mode 100644 settingcachelevel.go delete mode 100644 settingcachelevel_test.go delete mode 100644 settingchallengettl.go delete mode 100644 settingchallengettl_test.go delete mode 100644 settingcipher.go delete mode 100644 settingdevelopmentmode.go delete mode 100644 settingearlyhint.go delete mode 100644 settingemailobfuscation.go delete mode 100644 settingfontsetting.go delete mode 100644 settingh2prioritization.go delete mode 100644 settinghotlinkprotection.go delete mode 100644 settinghttp2.go delete mode 100644 settinghttp3.go delete mode 100644 settingimageresizing.go delete mode 100644 settingipgeolocation.go delete mode 100644 settingipv6.go delete mode 100644 settingminify.go delete mode 100644 settingmintlsversion.go delete mode 100644 settingmintlsversion_test.go delete mode 100644 settingmirage.go delete mode 100644 settingmirage_test.go delete mode 100644 settingmobileredirect.go delete mode 100644 settingnel.go delete mode 100644 settingopportunisticencryption.go delete mode 100644 settingopportunisticencryption_test.go delete mode 100644 settingopportunisticonion.go delete mode 100644 settingorangetoorange.go delete mode 100644 settingorangetoorange_test.go delete mode 100644 settingoriginerrorpagepassthru.go delete mode 100644 settingoriginerrorpagepassthru_test.go delete mode 100644 settingoriginmaxhttpversion.go delete mode 100644 settingoriginmaxhttpversion_test.go delete mode 100644 settingpolish.go delete mode 100644 settingprefetchpreload.go delete mode 100644 settingprefetchpreload_test.go delete mode 100644 settingproxyreadtimeout.go delete mode 100644 settingpseudoipv4.go delete mode 100644 settingresponsebuffering.go delete mode 100644 settingrocketloader_test.go delete mode 100644 settingsecurityheader.go delete mode 100644 settingsecuritylevel.go delete mode 100644 settingserversideexclude_test.go delete mode 100644 settingsortquerystringforcache.go delete mode 100644 settingsortquerystringforcache_test.go delete mode 100644 settingsslrecommender.go delete mode 100644 settingtls13.go delete mode 100644 settingtls13_test.go delete mode 100644 settingtlsclientauth.go delete mode 100644 settingtlsclientauth_test.go delete mode 100644 settingtrueclientipheader.go delete mode 100644 settingtrueclientipheader_test.go delete mode 100644 settingwaf_test.go delete mode 100644 settingwebp.go delete mode 100644 settingwebp_test.go delete mode 100644 settingwebsocket.go delete mode 100644 settingwebsocket_test.go delete mode 100644 settingzerortt.go delete mode 100644 storagekv.go delete mode 100644 storagekvnamespace.go delete mode 100644 storagekvnamespacebulk.go delete mode 100644 storagekvnamespacekey.go delete mode 100644 storagekvnamespacemetadata.go delete mode 100644 storagekvnamespacevalue.go rename userfirewallaccessrulerule_test.go => userfirewallaccessrule_test.go (70%) delete mode 100644 userfirewallaccessrulerule.go rename userloadbalancinganalytic.go => userloadbalanceranalytics.go (55%) rename userloadbalancinganalyticevent.go => userloadbalanceranalyticsevent.go (61%) rename userloadbalancinganalyticevent_test.go => userloadbalanceranalyticsevent_test.go (88%) delete mode 100644 workerdeploymentsbyscript.go delete mode 100644 workerdeploymentsbyscript_test.go create mode 100644 zoneactivationcheck.go rename activationcheck_test.go => zoneactivationcheck_test.go (88%) create mode 100644 zonesetting.go rename setting_test.go => zonesetting_test.go (63%) create mode 100644 zonesettingadvancedddos.go rename settingadvancedddos_test.go => zonesettingadvancedddos_test.go (88%) create mode 100644 zonesettingalwaysonline.go rename settingemailobfuscation_test.go => zonesettingalwaysonline_test.go (84%) create mode 100644 zonesettingalwaysusehttps.go rename settingopportunisticonion_test.go => zonesettingalwaysusehttps_test.go (84%) create mode 100644 zonesettingautomatichttpsrewrite.go create mode 100644 zonesettingautomatichttpsrewrite_test.go create mode 100644 zonesettingautomaticplatformoptimization.go rename settingautomaticplatformoptimization_test.go => zonesettingautomaticplatformoptimization_test.go (82%) create mode 100644 zonesettingbrotli.go rename settingpseudoipv4_test.go => zonesettingbrotli_test.go (85%) create mode 100644 zonesettingbrowsercachettl.go create mode 100644 zonesettingbrowsercachettl_test.go create mode 100644 zonesettingbrowsercheck.go rename settingalwaysonline_test.go => zonesettingbrowsercheck_test.go (83%) create mode 100644 zonesettingcachelevel.go rename settingbrowsercachettl_test.go => zonesettingcachelevel_test.go (84%) create mode 100644 zonesettingchallengettl.go rename settingalwaysusehttps_test.go => zonesettingchallengettl_test.go (83%) create mode 100644 zonesettingcipher.go rename settingcipher_test.go => zonesettingcipher_test.go (88%) create mode 100644 zonesettingdevelopmentmode.go create mode 100644 zonesettingdevelopmentmode_test.go create mode 100644 zonesettingearlyhint.go rename settingipgeolocation_test.go => zonesettingearlyhint_test.go (84%) create mode 100644 zonesettingemailobfuscation.go create mode 100644 zonesettingemailobfuscation_test.go create mode 100644 zonesettingfontsetting.go rename settingdevelopmentmode_test.go => zonesettingfontsetting_test.go (84%) create mode 100644 zonesettingh2prioritization.go create mode 100644 zonesettingh2prioritization_test.go create mode 100644 zonesettinghotlinkprotection.go rename settingautomatichttpsrewrite_test.go => zonesettinghotlinkprotection_test.go (83%) create mode 100644 zonesettinghttp2.go rename settingearlyhint_test.go => zonesettinghttp2_test.go (85%) create mode 100644 zonesettinghttp3.go rename settinghttp2_test.go => zonesettinghttp3_test.go (85%) create mode 100644 zonesettingimageresizing.go rename settingminify_test.go => zonesettingimageresizing_test.go (77%) create mode 100644 zonesettingipgeolocation.go rename settinghotlinkprotection_test.go => zonesettingipgeolocation_test.go (84%) create mode 100644 zonesettingipv6.go rename settinghttp3_test.go => zonesettingipv6_test.go (85%) create mode 100644 zonesettingminify.go rename settingimageresizing_test.go => zonesettingminify_test.go (78%) create mode 100644 zonesettingmintlsversion.go create mode 100644 zonesettingmintlsversion_test.go create mode 100644 zonesettingmirage.go create mode 100644 zonesettingmirage_test.go create mode 100644 zonesettingmobileredirect.go rename settingmobileredirect_test.go => zonesettingmobileredirect_test.go (80%) create mode 100644 zonesettingnel.go rename settingnel_test.go => zonesettingnel_test.go (81%) create mode 100644 zonesettingopportunisticencryption.go create mode 100644 zonesettingopportunisticencryption_test.go create mode 100644 zonesettingopportunisticonion.go create mode 100644 zonesettingopportunisticonion_test.go create mode 100644 zonesettingorangetoorange.go create mode 100644 zonesettingorangetoorange_test.go create mode 100644 zonesettingoriginerrorpagepassthru.go create mode 100644 zonesettingoriginerrorpagepassthru_test.go create mode 100644 zonesettingoriginmaxhttpversion.go rename settingssl_test.go => zonesettingoriginmaxhttpversion_test.go (82%) create mode 100644 zonesettingpolish.go rename settingpolish_test.go => zonesettingpolish_test.go (79%) create mode 100644 zonesettingprefetchpreload.go create mode 100644 zonesettingprefetchpreload_test.go create mode 100644 zonesettingproxyreadtimeout.go rename settingproxyreadtimeout_test.go => zonesettingproxyreadtimeout_test.go (79%) create mode 100644 zonesettingpseudoipv4.go rename settingbrowsercheck_test.go => zonesettingpseudoipv4_test.go (84%) create mode 100644 zonesettingresponsebuffering.go create mode 100644 zonesettingresponsebuffering_test.go rename settingrocketloader.go => zonesettingrocketloader.go (52%) rename settingh2prioritization_test.go => zonesettingrocketloader_test.go (79%) create mode 100644 zonesettingsecurityheader.go rename settingsecurityheader_test.go => zonesettingsecurityheader_test.go (80%) create mode 100644 zonesettingsecuritylevel.go create mode 100644 zonesettingsecuritylevel_test.go rename settingserversideexclude.go => zonesettingserversideexclude.go (52%) create mode 100644 zonesettingserversideexclude_test.go create mode 100644 zonesettingsortquerystringforcache.go create mode 100644 zonesettingsortquerystringforcache_test.go rename settingssl.go => zonesettingssl.go (60%) rename settingipv6_test.go => zonesettingssl_test.go (86%) create mode 100644 zonesettingsslrecommender.go rename settingsslrecommender_test.go => zonesettingsslrecommender_test.go (80%) create mode 100644 zonesettingtls13.go create mode 100644 zonesettingtls13_test.go create mode 100644 zonesettingtlsclientauth.go rename settingresponsebuffering_test.go => zonesettingtlsclientauth_test.go (84%) create mode 100644 zonesettingtrueclientipheader.go create mode 100644 zonesettingtrueclientipheader_test.go rename settingwaf.go => zonesettingwaf.go (53%) rename settingzerortt_test.go => zonesettingwaf_test.go (86%) create mode 100644 zonesettingwebp.go rename settingbrotli_test.go => zonesettingwebp_test.go (85%) create mode 100644 zonesettingwebsocket.go rename settingsecuritylevel_test.go => zonesettingwebsocket_test.go (85%) create mode 100644 zonesettingzerortt.go rename settingfontsetting_test.go => zonesettingzerortt_test.go (85%) create mode 100644 zoneworker.go create mode 100644 zoneworkerscript.go create mode 100644 zoneworkerscript_test.go diff --git a/account.go b/account.go index 2deaaf554b6..3b0389ccf77 100644 --- a/account.go +++ b/account.go @@ -24,6 +24,7 @@ import ( // service directly, and instead use the [NewAccountService] method instead. type AccountService struct { Options []option.RequestOption + Members *AccountMemberService } // NewAccountService generates a new service that applies the given options to each @@ -32,6 +33,7 @@ type AccountService struct { func NewAccountService(opts ...option.RequestOption) (r *AccountService) { r = &AccountService{} r.Options = opts + r.Members = NewAccountMemberService(opts...) return } diff --git a/accountmember_test.go b/accountmember_test.go index 63a12d1eede..ce165035a79 100644 --- a/accountmember_test.go +++ b/accountmember_test.go @@ -29,7 +29,7 @@ func TestAccountMemberNewWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.AccountMembers.New(context.TODO(), cloudflare.AccountMemberNewParams{ + _, err := client.Accounts.Members.New(context.TODO(), cloudflare.AccountMemberNewParams{ AccountID: cloudflare.F[any](map[string]interface{}{}), Email: cloudflare.F("user@example.com"), Roles: cloudflare.F([]string{"3536bcfad5faccb999b47003c79917fb", "3536bcfad5faccb999b47003c79917fb", "3536bcfad5faccb999b47003c79917fb"}), @@ -60,7 +60,7 @@ func TestAccountMemberUpdate(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.AccountMembers.Update( + _, err := client.Accounts.Members.Update( context.TODO(), "4536bcfad5faccb111b47003c79917fa", cloudflare.AccountMemberUpdateParams{ @@ -99,7 +99,7 @@ func TestAccountMemberListWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.AccountMembers.List(context.TODO(), cloudflare.AccountMemberListParams{ + _, err := client.Accounts.Members.List(context.TODO(), cloudflare.AccountMemberListParams{ AccountID: cloudflare.F[any](map[string]interface{}{}), Direction: cloudflare.F(cloudflare.AccountMemberListParamsDirectionDesc), Order: cloudflare.F(cloudflare.AccountMemberListParamsOrderStatus), @@ -132,7 +132,7 @@ func TestAccountMemberDelete(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.AccountMembers.Delete( + _, err := client.Accounts.Members.Delete( context.TODO(), "4536bcfad5faccb111b47003c79917fa", cloudflare.AccountMemberDeleteParams{ @@ -164,7 +164,7 @@ func TestAccountMemberGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.AccountMembers.Get( + _, err := client.Accounts.Members.Get( context.TODO(), "4536bcfad5faccb111b47003c79917fa", cloudflare.AccountMemberGetParams{ diff --git a/activationcheck.go b/activationcheck.go deleted file mode 100644 index e3955d04f60..00000000000 --- a/activationcheck.go +++ /dev/null @@ -1,138 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// ActivationCheckService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewActivationCheckService] method -// instead. -type ActivationCheckService struct { - Options []option.RequestOption -} - -// NewActivationCheckService generates a new service that applies the given options -// to each request. These options are applied after the parent client's options (if -// there is one), and before any request-specific options. -func NewActivationCheckService(opts ...option.RequestOption) (r *ActivationCheckService) { - r = &ActivationCheckService{} - r.Options = opts - return -} - -// Triggeres a new activation check for a PENDING Zone. This can be triggered every -// 5 min for paygo/ent customers, every hour for FREE Zones. -func (r *ActivationCheckService) Update(ctx context.Context, body ActivationCheckUpdateParams, opts ...option.RequestOption) (res *ActivationCheckUpdateResponse, err error) { - opts = append(r.Options[:], opts...) - var env ActivationCheckUpdateResponseEnvelope - path := fmt.Sprintf("zones/%s/activation_check", body.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -type ActivationCheckUpdateResponse struct { - // Identifier - ID string `json:"id"` - JSON activationCheckUpdateResponseJSON `json:"-"` -} - -// activationCheckUpdateResponseJSON contains the JSON metadata for the struct -// [ActivationCheckUpdateResponse] -type activationCheckUpdateResponseJSON struct { - ID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ActivationCheckUpdateResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type ActivationCheckUpdateParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type ActivationCheckUpdateResponseEnvelope struct { - Errors []ActivationCheckUpdateResponseEnvelopeErrors `json:"errors,required"` - Messages []ActivationCheckUpdateResponseEnvelopeMessages `json:"messages,required"` - Result ActivationCheckUpdateResponse `json:"result,required"` - // Whether the API call was successful - Success ActivationCheckUpdateResponseEnvelopeSuccess `json:"success,required"` - JSON activationCheckUpdateResponseEnvelopeJSON `json:"-"` -} - -// activationCheckUpdateResponseEnvelopeJSON contains the JSON metadata for the -// struct [ActivationCheckUpdateResponseEnvelope] -type activationCheckUpdateResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ActivationCheckUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type ActivationCheckUpdateResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON activationCheckUpdateResponseEnvelopeErrorsJSON `json:"-"` -} - -// activationCheckUpdateResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [ActivationCheckUpdateResponseEnvelopeErrors] -type activationCheckUpdateResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ActivationCheckUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type ActivationCheckUpdateResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON activationCheckUpdateResponseEnvelopeMessagesJSON `json:"-"` -} - -// activationCheckUpdateResponseEnvelopeMessagesJSON contains the JSON metadata for -// the struct [ActivationCheckUpdateResponseEnvelopeMessages] -type activationCheckUpdateResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ActivationCheckUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type ActivationCheckUpdateResponseEnvelopeSuccess bool - -const ( - ActivationCheckUpdateResponseEnvelopeSuccessTrue ActivationCheckUpdateResponseEnvelopeSuccess = true -) diff --git a/address.go b/address.go index 3167a080b78..1099bc628f0 100644 --- a/address.go +++ b/address.go @@ -12,6 +12,7 @@ import ( // service directly, and instead use the [NewAddressService] method instead. type AddressService struct { Options []option.RequestOption + Services *AddressServiceService AddressMaps *AddressAddressMapService LOADocuments *AddressLOADocumentService Prefixes *AddressPrefixService @@ -23,6 +24,7 @@ type AddressService struct { func NewAddressService(opts ...option.RequestOption) (r *AddressService) { r = &AddressService{} r.Options = opts + r.Services = NewAddressServiceService(opts...) r.AddressMaps = NewAddressAddressMapService(opts...) r.LOADocuments = NewAddressLOADocumentService(opts...) r.Prefixes = NewAddressPrefixService(opts...) diff --git a/addressing.go b/addressing.go deleted file mode 100644 index 3153efa7333..00000000000 --- a/addressing.go +++ /dev/null @@ -1,28 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// AddressingService contains methods and other services that help with interacting -// with the cloudflare API. Note, unlike clients, this service does not read -// variables from the environment automatically. You should not instantiate this -// service directly, and instead use the [NewAddressingService] method instead. -type AddressingService struct { - Options []option.RequestOption - Prefixes *AddressingPrefixService - Services *AddressingServiceService -} - -// NewAddressingService generates a new service that applies the given options to -// each request. These options are applied after the parent client's options (if -// there is one), and before any request-specific options. -func NewAddressingService(opts ...option.RequestOption) (r *AddressingService) { - r = &AddressingService{} - r.Options = opts - r.Prefixes = NewAddressingPrefixService(opts...) - r.Services = NewAddressingServiceService(opts...) - return -} diff --git a/addressingprefix.go b/addressingprefix.go deleted file mode 100644 index ca4e84e90e8..00000000000 --- a/addressingprefix.go +++ /dev/null @@ -1,29 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// AddressingPrefixService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewAddressingPrefixService] method -// instead. -type AddressingPrefixService struct { - Options []option.RequestOption - BGPPrefixes *AddressingPrefixBGPPrefixService - Bindings *AddressingPrefixBindingService -} - -// NewAddressingPrefixService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewAddressingPrefixService(opts ...option.RequestOption) (r *AddressingPrefixService) { - r = &AddressingPrefixService{} - r.Options = opts - r.BGPPrefixes = NewAddressingPrefixBGPPrefixService(opts...) - r.Bindings = NewAddressingPrefixBindingService(opts...) - return -} diff --git a/addressingprefixbgpprefix.go b/addressingprefixbgpprefix.go deleted file mode 100644 index 8f156c2d19b..00000000000 --- a/addressingprefixbgpprefix.go +++ /dev/null @@ -1,599 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// AddressingPrefixBGPPrefixService contains methods and other services that help -// with interacting with the cloudflare API. Note, unlike clients, this service -// does not read variables from the environment automatically. You should not -// instantiate this service directly, and instead use the -// [NewAddressingPrefixBGPPrefixService] method instead. -type AddressingPrefixBGPPrefixService struct { - Options []option.RequestOption -} - -// NewAddressingPrefixBGPPrefixService generates a new service that applies the -// given options to each request. These options are applied after the parent -// client's options (if there is one), and before any request-specific options. -func NewAddressingPrefixBGPPrefixService(opts ...option.RequestOption) (r *AddressingPrefixBGPPrefixService) { - r = &AddressingPrefixBGPPrefixService{} - r.Options = opts - return -} - -// List all BGP Prefixes within the specified IP Prefix. BGP Prefixes are used to -// control which specific subnets are advertised to the Internet. It is possible to -// advertise subnets more specific than an IP Prefix by creating more specific BGP -// Prefixes. -func (r *AddressingPrefixBGPPrefixService) List(ctx context.Context, prefixID string, query AddressingPrefixBGPPrefixListParams, opts ...option.RequestOption) (res *[]AddressingPrefixBGPPrefixListResponse, err error) { - opts = append(r.Options[:], opts...) - var env AddressingPrefixBGPPrefixListResponseEnvelope - path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/bgp/prefixes", query.AccountID, prefixID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Update the properties of a BGP Prefix, such as the on demand advertisement -// status (advertised or withdrawn). -func (r *AddressingPrefixBGPPrefixService) Edit(ctx context.Context, prefixID string, bgpPrefixID string, params AddressingPrefixBGPPrefixEditParams, opts ...option.RequestOption) (res *AddressingPrefixBGPPrefixEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env AddressingPrefixBGPPrefixEditResponseEnvelope - path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/bgp/prefixes/%s", params.AccountID, prefixID, bgpPrefixID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Retrieve a single BGP Prefix according to its identifier -func (r *AddressingPrefixBGPPrefixService) Get(ctx context.Context, prefixID string, bgpPrefixID string, query AddressingPrefixBGPPrefixGetParams, opts ...option.RequestOption) (res *AddressingPrefixBGPPrefixGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env AddressingPrefixBGPPrefixGetResponseEnvelope - path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/bgp/prefixes/%s", query.AccountID, prefixID, bgpPrefixID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -type AddressingPrefixBGPPrefixListResponse struct { - // Identifier - ID string `json:"id"` - // Autonomous System Number (ASN) the prefix will be advertised under. - ASN int64 `json:"asn,nullable"` - BGPSignalOpts AddressingPrefixBGPPrefixListResponseBGPSignalOpts `json:"bgp_signal_opts"` - // IP Prefix in Classless Inter-Domain Routing format. - Cidr string `json:"cidr"` - CreatedAt time.Time `json:"created_at" format:"date-time"` - ModifiedAt time.Time `json:"modified_at" format:"date-time"` - OnDemand AddressingPrefixBGPPrefixListResponseOnDemand `json:"on_demand"` - JSON addressingPrefixBGPPrefixListResponseJSON `json:"-"` -} - -// addressingPrefixBGPPrefixListResponseJSON contains the JSON metadata for the -// struct [AddressingPrefixBGPPrefixListResponse] -type addressingPrefixBGPPrefixListResponseJSON struct { - ID apijson.Field - ASN apijson.Field - BGPSignalOpts apijson.Field - Cidr apijson.Field - CreatedAt apijson.Field - ModifiedAt apijson.Field - OnDemand apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AddressingPrefixBGPPrefixListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type AddressingPrefixBGPPrefixListResponseBGPSignalOpts struct { - // Whether control of advertisement of the prefix to the Internet is enabled to be - // performed via BGP signal - Enabled bool `json:"enabled"` - // Last time BGP signaling control was toggled. This field is null if BGP signaling - // has never been enabled. - ModifiedAt time.Time `json:"modified_at,nullable" format:"date-time"` - JSON addressingPrefixBGPPrefixListResponseBGPSignalOptsJSON `json:"-"` -} - -// addressingPrefixBGPPrefixListResponseBGPSignalOptsJSON contains the JSON -// metadata for the struct [AddressingPrefixBGPPrefixListResponseBGPSignalOpts] -type addressingPrefixBGPPrefixListResponseBGPSignalOptsJSON struct { - Enabled apijson.Field - ModifiedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AddressingPrefixBGPPrefixListResponseBGPSignalOpts) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type AddressingPrefixBGPPrefixListResponseOnDemand struct { - // Prefix advertisement status to the Internet. This field is only not 'null' if on - // demand is enabled. - Advertised bool `json:"advertised,nullable"` - // Last time the advertisement status was changed. This field is only not 'null' if - // on demand is enabled. - AdvertisedModifiedAt time.Time `json:"advertised_modified_at,nullable" format:"date-time"` - // Whether advertisement of the prefix to the Internet may be dynamically enabled - // or disabled. - OnDemandEnabled bool `json:"on_demand_enabled"` - // Whether advertisement status of the prefix is locked, meaning it cannot be - // changed. - OnDemandLocked bool `json:"on_demand_locked"` - JSON addressingPrefixBGPPrefixListResponseOnDemandJSON `json:"-"` -} - -// addressingPrefixBGPPrefixListResponseOnDemandJSON contains the JSON metadata for -// the struct [AddressingPrefixBGPPrefixListResponseOnDemand] -type addressingPrefixBGPPrefixListResponseOnDemandJSON struct { - Advertised apijson.Field - AdvertisedModifiedAt apijson.Field - OnDemandEnabled apijson.Field - OnDemandLocked apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AddressingPrefixBGPPrefixListResponseOnDemand) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type AddressingPrefixBGPPrefixEditResponse struct { - // Identifier - ID string `json:"id"` - // Autonomous System Number (ASN) the prefix will be advertised under. - ASN int64 `json:"asn,nullable"` - BGPSignalOpts AddressingPrefixBGPPrefixEditResponseBGPSignalOpts `json:"bgp_signal_opts"` - // IP Prefix in Classless Inter-Domain Routing format. - Cidr string `json:"cidr"` - CreatedAt time.Time `json:"created_at" format:"date-time"` - ModifiedAt time.Time `json:"modified_at" format:"date-time"` - OnDemand AddressingPrefixBGPPrefixEditResponseOnDemand `json:"on_demand"` - JSON addressingPrefixBGPPrefixEditResponseJSON `json:"-"` -} - -// addressingPrefixBGPPrefixEditResponseJSON contains the JSON metadata for the -// struct [AddressingPrefixBGPPrefixEditResponse] -type addressingPrefixBGPPrefixEditResponseJSON struct { - ID apijson.Field - ASN apijson.Field - BGPSignalOpts apijson.Field - Cidr apijson.Field - CreatedAt apijson.Field - ModifiedAt apijson.Field - OnDemand apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AddressingPrefixBGPPrefixEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type AddressingPrefixBGPPrefixEditResponseBGPSignalOpts struct { - // Whether control of advertisement of the prefix to the Internet is enabled to be - // performed via BGP signal - Enabled bool `json:"enabled"` - // Last time BGP signaling control was toggled. This field is null if BGP signaling - // has never been enabled. - ModifiedAt time.Time `json:"modified_at,nullable" format:"date-time"` - JSON addressingPrefixBGPPrefixEditResponseBGPSignalOptsJSON `json:"-"` -} - -// addressingPrefixBGPPrefixEditResponseBGPSignalOptsJSON contains the JSON -// metadata for the struct [AddressingPrefixBGPPrefixEditResponseBGPSignalOpts] -type addressingPrefixBGPPrefixEditResponseBGPSignalOptsJSON struct { - Enabled apijson.Field - ModifiedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AddressingPrefixBGPPrefixEditResponseBGPSignalOpts) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type AddressingPrefixBGPPrefixEditResponseOnDemand struct { - // Prefix advertisement status to the Internet. This field is only not 'null' if on - // demand is enabled. - Advertised bool `json:"advertised,nullable"` - // Last time the advertisement status was changed. This field is only not 'null' if - // on demand is enabled. - AdvertisedModifiedAt time.Time `json:"advertised_modified_at,nullable" format:"date-time"` - // Whether advertisement of the prefix to the Internet may be dynamically enabled - // or disabled. - OnDemandEnabled bool `json:"on_demand_enabled"` - // Whether advertisement status of the prefix is locked, meaning it cannot be - // changed. - OnDemandLocked bool `json:"on_demand_locked"` - JSON addressingPrefixBGPPrefixEditResponseOnDemandJSON `json:"-"` -} - -// addressingPrefixBGPPrefixEditResponseOnDemandJSON contains the JSON metadata for -// the struct [AddressingPrefixBGPPrefixEditResponseOnDemand] -type addressingPrefixBGPPrefixEditResponseOnDemandJSON struct { - Advertised apijson.Field - AdvertisedModifiedAt apijson.Field - OnDemandEnabled apijson.Field - OnDemandLocked apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AddressingPrefixBGPPrefixEditResponseOnDemand) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type AddressingPrefixBGPPrefixGetResponse struct { - // Identifier - ID string `json:"id"` - // Autonomous System Number (ASN) the prefix will be advertised under. - ASN int64 `json:"asn,nullable"` - BGPSignalOpts AddressingPrefixBGPPrefixGetResponseBGPSignalOpts `json:"bgp_signal_opts"` - // IP Prefix in Classless Inter-Domain Routing format. - Cidr string `json:"cidr"` - CreatedAt time.Time `json:"created_at" format:"date-time"` - ModifiedAt time.Time `json:"modified_at" format:"date-time"` - OnDemand AddressingPrefixBGPPrefixGetResponseOnDemand `json:"on_demand"` - JSON addressingPrefixBGPPrefixGetResponseJSON `json:"-"` -} - -// addressingPrefixBGPPrefixGetResponseJSON contains the JSON metadata for the -// struct [AddressingPrefixBGPPrefixGetResponse] -type addressingPrefixBGPPrefixGetResponseJSON struct { - ID apijson.Field - ASN apijson.Field - BGPSignalOpts apijson.Field - Cidr apijson.Field - CreatedAt apijson.Field - ModifiedAt apijson.Field - OnDemand apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AddressingPrefixBGPPrefixGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type AddressingPrefixBGPPrefixGetResponseBGPSignalOpts struct { - // Whether control of advertisement of the prefix to the Internet is enabled to be - // performed via BGP signal - Enabled bool `json:"enabled"` - // Last time BGP signaling control was toggled. This field is null if BGP signaling - // has never been enabled. - ModifiedAt time.Time `json:"modified_at,nullable" format:"date-time"` - JSON addressingPrefixBGPPrefixGetResponseBGPSignalOptsJSON `json:"-"` -} - -// addressingPrefixBGPPrefixGetResponseBGPSignalOptsJSON contains the JSON metadata -// for the struct [AddressingPrefixBGPPrefixGetResponseBGPSignalOpts] -type addressingPrefixBGPPrefixGetResponseBGPSignalOptsJSON struct { - Enabled apijson.Field - ModifiedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AddressingPrefixBGPPrefixGetResponseBGPSignalOpts) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type AddressingPrefixBGPPrefixGetResponseOnDemand struct { - // Prefix advertisement status to the Internet. This field is only not 'null' if on - // demand is enabled. - Advertised bool `json:"advertised,nullable"` - // Last time the advertisement status was changed. This field is only not 'null' if - // on demand is enabled. - AdvertisedModifiedAt time.Time `json:"advertised_modified_at,nullable" format:"date-time"` - // Whether advertisement of the prefix to the Internet may be dynamically enabled - // or disabled. - OnDemandEnabled bool `json:"on_demand_enabled"` - // Whether advertisement status of the prefix is locked, meaning it cannot be - // changed. - OnDemandLocked bool `json:"on_demand_locked"` - JSON addressingPrefixBGPPrefixGetResponseOnDemandJSON `json:"-"` -} - -// addressingPrefixBGPPrefixGetResponseOnDemandJSON contains the JSON metadata for -// the struct [AddressingPrefixBGPPrefixGetResponseOnDemand] -type addressingPrefixBGPPrefixGetResponseOnDemandJSON struct { - Advertised apijson.Field - AdvertisedModifiedAt apijson.Field - OnDemandEnabled apijson.Field - OnDemandLocked apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AddressingPrefixBGPPrefixGetResponseOnDemand) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type AddressingPrefixBGPPrefixListParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` -} - -type AddressingPrefixBGPPrefixListResponseEnvelope struct { - Errors []AddressingPrefixBGPPrefixListResponseEnvelopeErrors `json:"errors,required"` - Messages []AddressingPrefixBGPPrefixListResponseEnvelopeMessages `json:"messages,required"` - Result []AddressingPrefixBGPPrefixListResponse `json:"result,required,nullable"` - // Whether the API call was successful - Success AddressingPrefixBGPPrefixListResponseEnvelopeSuccess `json:"success,required"` - ResultInfo AddressingPrefixBGPPrefixListResponseEnvelopeResultInfo `json:"result_info"` - JSON addressingPrefixBGPPrefixListResponseEnvelopeJSON `json:"-"` -} - -// addressingPrefixBGPPrefixListResponseEnvelopeJSON contains the JSON metadata for -// the struct [AddressingPrefixBGPPrefixListResponseEnvelope] -type addressingPrefixBGPPrefixListResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - ResultInfo apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AddressingPrefixBGPPrefixListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type AddressingPrefixBGPPrefixListResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON addressingPrefixBGPPrefixListResponseEnvelopeErrorsJSON `json:"-"` -} - -// addressingPrefixBGPPrefixListResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [AddressingPrefixBGPPrefixListResponseEnvelopeErrors] -type addressingPrefixBGPPrefixListResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AddressingPrefixBGPPrefixListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type AddressingPrefixBGPPrefixListResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON addressingPrefixBGPPrefixListResponseEnvelopeMessagesJSON `json:"-"` -} - -// addressingPrefixBGPPrefixListResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [AddressingPrefixBGPPrefixListResponseEnvelopeMessages] -type addressingPrefixBGPPrefixListResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AddressingPrefixBGPPrefixListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type AddressingPrefixBGPPrefixListResponseEnvelopeSuccess bool - -const ( - AddressingPrefixBGPPrefixListResponseEnvelopeSuccessTrue AddressingPrefixBGPPrefixListResponseEnvelopeSuccess = true -) - -type AddressingPrefixBGPPrefixListResponseEnvelopeResultInfo struct { - // Total number of results for the requested service - Count float64 `json:"count"` - // Current page within paginated list of results - Page float64 `json:"page"` - // Number of results per page of results - PerPage float64 `json:"per_page"` - // Total results available without any search parameters - TotalCount float64 `json:"total_count"` - JSON addressingPrefixBGPPrefixListResponseEnvelopeResultInfoJSON `json:"-"` -} - -// addressingPrefixBGPPrefixListResponseEnvelopeResultInfoJSON contains the JSON -// metadata for the struct -// [AddressingPrefixBGPPrefixListResponseEnvelopeResultInfo] -type addressingPrefixBGPPrefixListResponseEnvelopeResultInfoJSON struct { - Count apijson.Field - Page apijson.Field - PerPage apijson.Field - TotalCount apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AddressingPrefixBGPPrefixListResponseEnvelopeResultInfo) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type AddressingPrefixBGPPrefixEditParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` - OnDemand param.Field[AddressingPrefixBGPPrefixEditParamsOnDemand] `json:"on_demand"` -} - -func (r AddressingPrefixBGPPrefixEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type AddressingPrefixBGPPrefixEditParamsOnDemand struct { - Advertised param.Field[bool] `json:"advertised"` -} - -func (r AddressingPrefixBGPPrefixEditParamsOnDemand) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type AddressingPrefixBGPPrefixEditResponseEnvelope struct { - Errors []AddressingPrefixBGPPrefixEditResponseEnvelopeErrors `json:"errors,required"` - Messages []AddressingPrefixBGPPrefixEditResponseEnvelopeMessages `json:"messages,required"` - Result AddressingPrefixBGPPrefixEditResponse `json:"result,required"` - // Whether the API call was successful - Success AddressingPrefixBGPPrefixEditResponseEnvelopeSuccess `json:"success,required"` - JSON addressingPrefixBGPPrefixEditResponseEnvelopeJSON `json:"-"` -} - -// addressingPrefixBGPPrefixEditResponseEnvelopeJSON contains the JSON metadata for -// the struct [AddressingPrefixBGPPrefixEditResponseEnvelope] -type addressingPrefixBGPPrefixEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AddressingPrefixBGPPrefixEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type AddressingPrefixBGPPrefixEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON addressingPrefixBGPPrefixEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// addressingPrefixBGPPrefixEditResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [AddressingPrefixBGPPrefixEditResponseEnvelopeErrors] -type addressingPrefixBGPPrefixEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AddressingPrefixBGPPrefixEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type AddressingPrefixBGPPrefixEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON addressingPrefixBGPPrefixEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// addressingPrefixBGPPrefixEditResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [AddressingPrefixBGPPrefixEditResponseEnvelopeMessages] -type addressingPrefixBGPPrefixEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AddressingPrefixBGPPrefixEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type AddressingPrefixBGPPrefixEditResponseEnvelopeSuccess bool - -const ( - AddressingPrefixBGPPrefixEditResponseEnvelopeSuccessTrue AddressingPrefixBGPPrefixEditResponseEnvelopeSuccess = true -) - -type AddressingPrefixBGPPrefixGetParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` -} - -type AddressingPrefixBGPPrefixGetResponseEnvelope struct { - Errors []AddressingPrefixBGPPrefixGetResponseEnvelopeErrors `json:"errors,required"` - Messages []AddressingPrefixBGPPrefixGetResponseEnvelopeMessages `json:"messages,required"` - Result AddressingPrefixBGPPrefixGetResponse `json:"result,required"` - // Whether the API call was successful - Success AddressingPrefixBGPPrefixGetResponseEnvelopeSuccess `json:"success,required"` - JSON addressingPrefixBGPPrefixGetResponseEnvelopeJSON `json:"-"` -} - -// addressingPrefixBGPPrefixGetResponseEnvelopeJSON contains the JSON metadata for -// the struct [AddressingPrefixBGPPrefixGetResponseEnvelope] -type addressingPrefixBGPPrefixGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AddressingPrefixBGPPrefixGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type AddressingPrefixBGPPrefixGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON addressingPrefixBGPPrefixGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// addressingPrefixBGPPrefixGetResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [AddressingPrefixBGPPrefixGetResponseEnvelopeErrors] -type addressingPrefixBGPPrefixGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AddressingPrefixBGPPrefixGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type AddressingPrefixBGPPrefixGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON addressingPrefixBGPPrefixGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// addressingPrefixBGPPrefixGetResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [AddressingPrefixBGPPrefixGetResponseEnvelopeMessages] -type addressingPrefixBGPPrefixGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AddressingPrefixBGPPrefixGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type AddressingPrefixBGPPrefixGetResponseEnvelopeSuccess bool - -const ( - AddressingPrefixBGPPrefixGetResponseEnvelopeSuccessTrue AddressingPrefixBGPPrefixGetResponseEnvelopeSuccess = true -) diff --git a/addressingservice.go b/addressingservice.go deleted file mode 100644 index 0a635ef30cf..00000000000 --- a/addressingservice.go +++ /dev/null @@ -1,143 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// AddressingServiceService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewAddressingServiceService] method -// instead. -type AddressingServiceService struct { - Options []option.RequestOption -} - -// NewAddressingServiceService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewAddressingServiceService(opts ...option.RequestOption) (r *AddressingServiceService) { - r = &AddressingServiceService{} - r.Options = opts - return -} - -// Bring-Your-Own IP (BYOIP) prefixes onboarded to Cloudflare must be bound to a -// service running on the Cloudflare network to enable a Cloudflare product on the -// IP addresses. This endpoint can be used as a reference of available services on -// the Cloudflare network, and their service IDs. -func (r *AddressingServiceService) List(ctx context.Context, query AddressingServiceListParams, opts ...option.RequestOption) (res *[]AddressingServiceListResponse, err error) { - opts = append(r.Options[:], opts...) - var env AddressingServiceListResponseEnvelope - path := fmt.Sprintf("accounts/%s/addressing/services", query.AccountID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -type AddressingServiceListResponse struct { - // Identifier - ID string `json:"id"` - // Name of a service running on the Cloudflare network - Name string `json:"name"` - JSON addressingServiceListResponseJSON `json:"-"` -} - -// addressingServiceListResponseJSON contains the JSON metadata for the struct -// [AddressingServiceListResponse] -type addressingServiceListResponseJSON struct { - ID apijson.Field - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AddressingServiceListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type AddressingServiceListParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` -} - -type AddressingServiceListResponseEnvelope struct { - Errors []AddressingServiceListResponseEnvelopeErrors `json:"errors,required"` - Messages []AddressingServiceListResponseEnvelopeMessages `json:"messages,required"` - Result []AddressingServiceListResponse `json:"result,required"` - // Whether the API call was successful - Success AddressingServiceListResponseEnvelopeSuccess `json:"success,required"` - JSON addressingServiceListResponseEnvelopeJSON `json:"-"` -} - -// addressingServiceListResponseEnvelopeJSON contains the JSON metadata for the -// struct [AddressingServiceListResponseEnvelope] -type addressingServiceListResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AddressingServiceListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type AddressingServiceListResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON addressingServiceListResponseEnvelopeErrorsJSON `json:"-"` -} - -// addressingServiceListResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [AddressingServiceListResponseEnvelopeErrors] -type addressingServiceListResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AddressingServiceListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type AddressingServiceListResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON addressingServiceListResponseEnvelopeMessagesJSON `json:"-"` -} - -// addressingServiceListResponseEnvelopeMessagesJSON contains the JSON metadata for -// the struct [AddressingServiceListResponseEnvelopeMessages] -type addressingServiceListResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *AddressingServiceListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type AddressingServiceListResponseEnvelopeSuccess bool - -const ( - AddressingServiceListResponseEnvelopeSuccessTrue AddressingServiceListResponseEnvelopeSuccess = true -) diff --git a/addressprefix.go b/addressprefix.go index 13ef8214c73..5a4b44c430c 100644 --- a/addressprefix.go +++ b/addressprefix.go @@ -24,7 +24,7 @@ import ( // instead. type AddressPrefixService struct { Options []option.RequestOption - BGPs *AddressPrefixBGPService + BGP *AddressPrefixBGPService Delegations *AddressPrefixDelegationService } @@ -34,7 +34,7 @@ type AddressPrefixService struct { func NewAddressPrefixService(opts ...option.RequestOption) (r *AddressPrefixService) { r = &AddressPrefixService{} r.Options = opts - r.BGPs = NewAddressPrefixBGPService(opts...) + r.BGP = NewAddressPrefixBGPService(opts...) r.Delegations = NewAddressPrefixDelegationService(opts...) return } diff --git a/addressprefixbgp.go b/addressprefixbgp.go index 9fb8dd38544..49852fb69a7 100644 --- a/addressprefixbgp.go +++ b/addressprefixbgp.go @@ -13,6 +13,8 @@ import ( // instead. type AddressPrefixBGPService struct { Options []option.RequestOption + Bindings *AddressPrefixBGPBindingService + Prefixes *AddressPrefixBGPPrefixService Statuses *AddressPrefixBGPStatusService } @@ -22,6 +24,8 @@ type AddressPrefixBGPService struct { func NewAddressPrefixBGPService(opts ...option.RequestOption) (r *AddressPrefixBGPService) { r = &AddressPrefixBGPService{} r.Options = opts + r.Bindings = NewAddressPrefixBGPBindingService(opts...) + r.Prefixes = NewAddressPrefixBGPPrefixService(opts...) r.Statuses = NewAddressPrefixBGPStatusService(opts...) return } diff --git a/addressingprefixbinding.go b/addressprefixbgpbinding.go similarity index 51% rename from addressingprefixbinding.go rename to addressprefixbgpbinding.go index 32c29d095ac..9770486fb42 100644 --- a/addressingprefixbinding.go +++ b/addressprefixbgpbinding.go @@ -16,20 +16,20 @@ import ( "github.com/tidwall/gjson" ) -// AddressingPrefixBindingService contains methods and other services that help +// AddressPrefixBGPBindingService contains methods and other services that help // with interacting with the cloudflare API. Note, unlike clients, this service // does not read variables from the environment automatically. You should not // instantiate this service directly, and instead use the -// [NewAddressingPrefixBindingService] method instead. -type AddressingPrefixBindingService struct { +// [NewAddressPrefixBGPBindingService] method instead. +type AddressPrefixBGPBindingService struct { Options []option.RequestOption } -// NewAddressingPrefixBindingService generates a new service that applies the given +// NewAddressPrefixBGPBindingService generates a new service that applies the given // options to each request. These options are applied after the parent client's // options (if there is one), and before any request-specific options. -func NewAddressingPrefixBindingService(opts ...option.RequestOption) (r *AddressingPrefixBindingService) { - r = &AddressingPrefixBindingService{} +func NewAddressPrefixBGPBindingService(opts ...option.RequestOption) (r *AddressPrefixBGPBindingService) { + r = &AddressPrefixBGPBindingService{} r.Options = opts return } @@ -38,9 +38,9 @@ func NewAddressingPrefixBindingService(opts ...option.RequestOption) (r *Address // service running on Cloudflare's network. **Note:** This API may only be used on // prefixes currently configured with a Magic Transit service binding, and only // allows creating service bindings for the Cloudflare CDN or Cloudflare Spectrum. -func (r *AddressingPrefixBindingService) New(ctx context.Context, prefixID string, params AddressingPrefixBindingNewParams, opts ...option.RequestOption) (res *AddressingPrefixBindingNewResponse, err error) { +func (r *AddressPrefixBGPBindingService) New(ctx context.Context, prefixID string, params AddressPrefixBGPBindingNewParams, opts ...option.RequestOption) (res *AddressPrefixBGPBindingNewResponse, err error) { opts = append(r.Options[:], opts...) - var env AddressingPrefixBindingNewResponseEnvelope + var env AddressPrefixBGPBindingNewResponseEnvelope path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/bindings", params.AccountID, prefixID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { @@ -56,9 +56,9 @@ func (r *AddressingPrefixBindingService) New(ctx context.Context, prefixID strin // `192.0.2.0/24` to Cloudflare Magic Transit and `192.0.2.1/32` to the Cloudflare // CDN would route traffic for `192.0.2.1` to the CDN, and traffic for all other // IPs in the prefix to Cloudflare Magic Transit. -func (r *AddressingPrefixBindingService) List(ctx context.Context, prefixID string, query AddressingPrefixBindingListParams, opts ...option.RequestOption) (res *[]AddressingPrefixBindingListResponse, err error) { +func (r *AddressPrefixBGPBindingService) List(ctx context.Context, prefixID string, query AddressPrefixBGPBindingListParams, opts ...option.RequestOption) (res *[]AddressPrefixBGPBindingListResponse, err error) { opts = append(r.Options[:], opts...) - var env AddressingPrefixBindingListResponseEnvelope + var env AddressPrefixBGPBindingListResponseEnvelope path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/bindings", query.AccountID, prefixID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) if err != nil { @@ -69,9 +69,9 @@ func (r *AddressingPrefixBindingService) List(ctx context.Context, prefixID stri } // Delete a Service Binding -func (r *AddressingPrefixBindingService) Delete(ctx context.Context, prefixID string, bindingID string, body AddressingPrefixBindingDeleteParams, opts ...option.RequestOption) (res *AddressingPrefixBindingDeleteResponse, err error) { +func (r *AddressPrefixBGPBindingService) Delete(ctx context.Context, prefixID string, bindingID string, body AddressPrefixBGPBindingDeleteParams, opts ...option.RequestOption) (res *AddressPrefixBGPBindingDeleteResponse, err error) { opts = append(r.Options[:], opts...) - var env AddressingPrefixBindingDeleteResponseEnvelope + var env AddressPrefixBGPBindingDeleteResponseEnvelope path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/bindings/%s", body.AccountID, prefixID, bindingID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &env, opts...) if err != nil { @@ -82,9 +82,9 @@ func (r *AddressingPrefixBindingService) Delete(ctx context.Context, prefixID st } // Fetch a single Service Binding -func (r *AddressingPrefixBindingService) Get(ctx context.Context, prefixID string, bindingID string, query AddressingPrefixBindingGetParams, opts ...option.RequestOption) (res *AddressingPrefixBindingGetResponse, err error) { +func (r *AddressPrefixBGPBindingService) Get(ctx context.Context, prefixID string, bindingID string, query AddressPrefixBGPBindingGetParams, opts ...option.RequestOption) (res *AddressPrefixBGPBindingGetResponse, err error) { opts = append(r.Options[:], opts...) - var env AddressingPrefixBindingGetResponseEnvelope + var env AddressPrefixBGPBindingGetResponseEnvelope path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/bindings/%s", query.AccountID, prefixID, bindingID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) if err != nil { @@ -94,23 +94,23 @@ func (r *AddressingPrefixBindingService) Get(ctx context.Context, prefixID strin return } -type AddressingPrefixBindingNewResponse struct { +type AddressPrefixBGPBindingNewResponse struct { // Identifier ID string `json:"id"` // IP Prefix in Classless Inter-Domain Routing format. Cidr string `json:"cidr"` // Status of a Service Binding's deployment to the Cloudflare network - Provisioning AddressingPrefixBindingNewResponseProvisioning `json:"provisioning"` + Provisioning AddressPrefixBGPBindingNewResponseProvisioning `json:"provisioning"` // Identifier ServiceID string `json:"service_id"` // Name of a service running on the Cloudflare network ServiceName string `json:"service_name"` - JSON addressingPrefixBindingNewResponseJSON `json:"-"` + JSON addressPrefixBGPBindingNewResponseJSON `json:"-"` } -// addressingPrefixBindingNewResponseJSON contains the JSON metadata for the struct -// [AddressingPrefixBindingNewResponse] -type addressingPrefixBindingNewResponseJSON struct { +// addressPrefixBGPBindingNewResponseJSON contains the JSON metadata for the struct +// [AddressPrefixBGPBindingNewResponse] +type addressPrefixBGPBindingNewResponseJSON struct { ID apijson.Field Cidr apijson.Field Provisioning apijson.Field @@ -120,56 +120,56 @@ type addressingPrefixBindingNewResponseJSON struct { ExtraFields map[string]apijson.Field } -func (r *AddressingPrefixBindingNewResponse) UnmarshalJSON(data []byte) (err error) { +func (r *AddressPrefixBGPBindingNewResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // Status of a Service Binding's deployment to the Cloudflare network -type AddressingPrefixBindingNewResponseProvisioning struct { +type AddressPrefixBGPBindingNewResponseProvisioning struct { // When a binding has been deployed to a majority of Cloudflare datacenters, the // binding will become active and can be used with its associated service. - State AddressingPrefixBindingNewResponseProvisioningState `json:"state"` - JSON addressingPrefixBindingNewResponseProvisioningJSON `json:"-"` + State AddressPrefixBGPBindingNewResponseProvisioningState `json:"state"` + JSON addressPrefixBGPBindingNewResponseProvisioningJSON `json:"-"` } -// addressingPrefixBindingNewResponseProvisioningJSON contains the JSON metadata -// for the struct [AddressingPrefixBindingNewResponseProvisioning] -type addressingPrefixBindingNewResponseProvisioningJSON struct { +// addressPrefixBGPBindingNewResponseProvisioningJSON contains the JSON metadata +// for the struct [AddressPrefixBGPBindingNewResponseProvisioning] +type addressPrefixBGPBindingNewResponseProvisioningJSON struct { State apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *AddressingPrefixBindingNewResponseProvisioning) UnmarshalJSON(data []byte) (err error) { +func (r *AddressPrefixBGPBindingNewResponseProvisioning) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // When a binding has been deployed to a majority of Cloudflare datacenters, the // binding will become active and can be used with its associated service. -type AddressingPrefixBindingNewResponseProvisioningState string +type AddressPrefixBGPBindingNewResponseProvisioningState string const ( - AddressingPrefixBindingNewResponseProvisioningStateProvisioning AddressingPrefixBindingNewResponseProvisioningState = "provisioning" - AddressingPrefixBindingNewResponseProvisioningStateActive AddressingPrefixBindingNewResponseProvisioningState = "active" + AddressPrefixBGPBindingNewResponseProvisioningStateProvisioning AddressPrefixBGPBindingNewResponseProvisioningState = "provisioning" + AddressPrefixBGPBindingNewResponseProvisioningStateActive AddressPrefixBGPBindingNewResponseProvisioningState = "active" ) -type AddressingPrefixBindingListResponse struct { +type AddressPrefixBGPBindingListResponse struct { // Identifier ID string `json:"id"` // IP Prefix in Classless Inter-Domain Routing format. Cidr string `json:"cidr"` // Status of a Service Binding's deployment to the Cloudflare network - Provisioning AddressingPrefixBindingListResponseProvisioning `json:"provisioning"` + Provisioning AddressPrefixBGPBindingListResponseProvisioning `json:"provisioning"` // Identifier ServiceID string `json:"service_id"` // Name of a service running on the Cloudflare network ServiceName string `json:"service_name"` - JSON addressingPrefixBindingListResponseJSON `json:"-"` + JSON addressPrefixBGPBindingListResponseJSON `json:"-"` } -// addressingPrefixBindingListResponseJSON contains the JSON metadata for the -// struct [AddressingPrefixBindingListResponse] -type addressingPrefixBindingListResponseJSON struct { +// addressPrefixBGPBindingListResponseJSON contains the JSON metadata for the +// struct [AddressPrefixBGPBindingListResponse] +type addressPrefixBGPBindingListResponseJSON struct { ID apijson.Field Cidr apijson.Field Provisioning apijson.Field @@ -179,48 +179,48 @@ type addressingPrefixBindingListResponseJSON struct { ExtraFields map[string]apijson.Field } -func (r *AddressingPrefixBindingListResponse) UnmarshalJSON(data []byte) (err error) { +func (r *AddressPrefixBGPBindingListResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // Status of a Service Binding's deployment to the Cloudflare network -type AddressingPrefixBindingListResponseProvisioning struct { +type AddressPrefixBGPBindingListResponseProvisioning struct { // When a binding has been deployed to a majority of Cloudflare datacenters, the // binding will become active and can be used with its associated service. - State AddressingPrefixBindingListResponseProvisioningState `json:"state"` - JSON addressingPrefixBindingListResponseProvisioningJSON `json:"-"` + State AddressPrefixBGPBindingListResponseProvisioningState `json:"state"` + JSON addressPrefixBGPBindingListResponseProvisioningJSON `json:"-"` } -// addressingPrefixBindingListResponseProvisioningJSON contains the JSON metadata -// for the struct [AddressingPrefixBindingListResponseProvisioning] -type addressingPrefixBindingListResponseProvisioningJSON struct { +// addressPrefixBGPBindingListResponseProvisioningJSON contains the JSON metadata +// for the struct [AddressPrefixBGPBindingListResponseProvisioning] +type addressPrefixBGPBindingListResponseProvisioningJSON struct { State apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *AddressingPrefixBindingListResponseProvisioning) UnmarshalJSON(data []byte) (err error) { +func (r *AddressPrefixBGPBindingListResponseProvisioning) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // When a binding has been deployed to a majority of Cloudflare datacenters, the // binding will become active and can be used with its associated service. -type AddressingPrefixBindingListResponseProvisioningState string +type AddressPrefixBGPBindingListResponseProvisioningState string const ( - AddressingPrefixBindingListResponseProvisioningStateProvisioning AddressingPrefixBindingListResponseProvisioningState = "provisioning" - AddressingPrefixBindingListResponseProvisioningStateActive AddressingPrefixBindingListResponseProvisioningState = "active" + AddressPrefixBGPBindingListResponseProvisioningStateProvisioning AddressPrefixBGPBindingListResponseProvisioningState = "provisioning" + AddressPrefixBGPBindingListResponseProvisioningStateActive AddressPrefixBGPBindingListResponseProvisioningState = "active" ) -// Union satisfied by [AddressingPrefixBindingDeleteResponseUnknown], -// [AddressingPrefixBindingDeleteResponseArray] or [shared.UnionString]. -type AddressingPrefixBindingDeleteResponse interface { - ImplementsAddressingPrefixBindingDeleteResponse() +// Union satisfied by [AddressPrefixBGPBindingDeleteResponseUnknown], +// [AddressPrefixBGPBindingDeleteResponseArray] or [shared.UnionString]. +type AddressPrefixBGPBindingDeleteResponse interface { + ImplementsAddressPrefixBGPBindingDeleteResponse() } func init() { apijson.RegisterUnion( - reflect.TypeOf((*AddressingPrefixBindingDeleteResponse)(nil)).Elem(), + reflect.TypeOf((*AddressPrefixBGPBindingDeleteResponse)(nil)).Elem(), "", apijson.UnionVariant{ TypeFilter: gjson.String, @@ -229,28 +229,28 @@ func init() { ) } -type AddressingPrefixBindingDeleteResponseArray []interface{} +type AddressPrefixBGPBindingDeleteResponseArray []interface{} -func (r AddressingPrefixBindingDeleteResponseArray) ImplementsAddressingPrefixBindingDeleteResponse() { +func (r AddressPrefixBGPBindingDeleteResponseArray) ImplementsAddressPrefixBGPBindingDeleteResponse() { } -type AddressingPrefixBindingGetResponse struct { +type AddressPrefixBGPBindingGetResponse struct { // Identifier ID string `json:"id"` // IP Prefix in Classless Inter-Domain Routing format. Cidr string `json:"cidr"` // Status of a Service Binding's deployment to the Cloudflare network - Provisioning AddressingPrefixBindingGetResponseProvisioning `json:"provisioning"` + Provisioning AddressPrefixBGPBindingGetResponseProvisioning `json:"provisioning"` // Identifier ServiceID string `json:"service_id"` // Name of a service running on the Cloudflare network ServiceName string `json:"service_name"` - JSON addressingPrefixBindingGetResponseJSON `json:"-"` + JSON addressPrefixBGPBindingGetResponseJSON `json:"-"` } -// addressingPrefixBindingGetResponseJSON contains the JSON metadata for the struct -// [AddressingPrefixBindingGetResponse] -type addressingPrefixBindingGetResponseJSON struct { +// addressPrefixBGPBindingGetResponseJSON contains the JSON metadata for the struct +// [AddressPrefixBGPBindingGetResponse] +type addressPrefixBGPBindingGetResponseJSON struct { ID apijson.Field Cidr apijson.Field Provisioning apijson.Field @@ -260,40 +260,40 @@ type addressingPrefixBindingGetResponseJSON struct { ExtraFields map[string]apijson.Field } -func (r *AddressingPrefixBindingGetResponse) UnmarshalJSON(data []byte) (err error) { +func (r *AddressPrefixBGPBindingGetResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // Status of a Service Binding's deployment to the Cloudflare network -type AddressingPrefixBindingGetResponseProvisioning struct { +type AddressPrefixBGPBindingGetResponseProvisioning struct { // When a binding has been deployed to a majority of Cloudflare datacenters, the // binding will become active and can be used with its associated service. - State AddressingPrefixBindingGetResponseProvisioningState `json:"state"` - JSON addressingPrefixBindingGetResponseProvisioningJSON `json:"-"` + State AddressPrefixBGPBindingGetResponseProvisioningState `json:"state"` + JSON addressPrefixBGPBindingGetResponseProvisioningJSON `json:"-"` } -// addressingPrefixBindingGetResponseProvisioningJSON contains the JSON metadata -// for the struct [AddressingPrefixBindingGetResponseProvisioning] -type addressingPrefixBindingGetResponseProvisioningJSON struct { +// addressPrefixBGPBindingGetResponseProvisioningJSON contains the JSON metadata +// for the struct [AddressPrefixBGPBindingGetResponseProvisioning] +type addressPrefixBGPBindingGetResponseProvisioningJSON struct { State apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *AddressingPrefixBindingGetResponseProvisioning) UnmarshalJSON(data []byte) (err error) { +func (r *AddressPrefixBGPBindingGetResponseProvisioning) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // When a binding has been deployed to a majority of Cloudflare datacenters, the // binding will become active and can be used with its associated service. -type AddressingPrefixBindingGetResponseProvisioningState string +type AddressPrefixBGPBindingGetResponseProvisioningState string const ( - AddressingPrefixBindingGetResponseProvisioningStateProvisioning AddressingPrefixBindingGetResponseProvisioningState = "provisioning" - AddressingPrefixBindingGetResponseProvisioningStateActive AddressingPrefixBindingGetResponseProvisioningState = "active" + AddressPrefixBGPBindingGetResponseProvisioningStateProvisioning AddressPrefixBGPBindingGetResponseProvisioningState = "provisioning" + AddressPrefixBGPBindingGetResponseProvisioningStateActive AddressPrefixBGPBindingGetResponseProvisioningState = "active" ) -type AddressingPrefixBindingNewParams struct { +type AddressPrefixBGPBindingNewParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` // IP Prefix in Classless Inter-Domain Routing format. @@ -302,22 +302,22 @@ type AddressingPrefixBindingNewParams struct { ServiceID param.Field[string] `json:"service_id"` } -func (r AddressingPrefixBindingNewParams) MarshalJSON() (data []byte, err error) { +func (r AddressPrefixBGPBindingNewParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type AddressingPrefixBindingNewResponseEnvelope struct { - Errors []AddressingPrefixBindingNewResponseEnvelopeErrors `json:"errors,required"` - Messages []AddressingPrefixBindingNewResponseEnvelopeMessages `json:"messages,required"` - Result AddressingPrefixBindingNewResponse `json:"result,required"` +type AddressPrefixBGPBindingNewResponseEnvelope struct { + Errors []AddressPrefixBGPBindingNewResponseEnvelopeErrors `json:"errors,required"` + Messages []AddressPrefixBGPBindingNewResponseEnvelopeMessages `json:"messages,required"` + Result AddressPrefixBGPBindingNewResponse `json:"result,required"` // Whether the API call was successful - Success AddressingPrefixBindingNewResponseEnvelopeSuccess `json:"success,required"` - JSON addressingPrefixBindingNewResponseEnvelopeJSON `json:"-"` + Success AddressPrefixBGPBindingNewResponseEnvelopeSuccess `json:"success,required"` + JSON addressPrefixBGPBindingNewResponseEnvelopeJSON `json:"-"` } -// addressingPrefixBindingNewResponseEnvelopeJSON contains the JSON metadata for -// the struct [AddressingPrefixBindingNewResponseEnvelope] -type addressingPrefixBindingNewResponseEnvelopeJSON struct { +// addressPrefixBGPBindingNewResponseEnvelopeJSON contains the JSON metadata for +// the struct [AddressPrefixBGPBindingNewResponseEnvelope] +type addressPrefixBGPBindingNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field Result apijson.Field @@ -326,72 +326,72 @@ type addressingPrefixBindingNewResponseEnvelopeJSON struct { ExtraFields map[string]apijson.Field } -func (r *AddressingPrefixBindingNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { +func (r *AddressPrefixBGPBindingNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type AddressingPrefixBindingNewResponseEnvelopeErrors struct { +type AddressPrefixBGPBindingNewResponseEnvelopeErrors struct { Code int64 `json:"code,required"` Message string `json:"message,required"` - JSON addressingPrefixBindingNewResponseEnvelopeErrorsJSON `json:"-"` + JSON addressPrefixBGPBindingNewResponseEnvelopeErrorsJSON `json:"-"` } -// addressingPrefixBindingNewResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [AddressingPrefixBindingNewResponseEnvelopeErrors] -type addressingPrefixBindingNewResponseEnvelopeErrorsJSON struct { +// addressPrefixBGPBindingNewResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [AddressPrefixBGPBindingNewResponseEnvelopeErrors] +type addressPrefixBGPBindingNewResponseEnvelopeErrorsJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *AddressingPrefixBindingNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { +func (r *AddressPrefixBGPBindingNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type AddressingPrefixBindingNewResponseEnvelopeMessages struct { +type AddressPrefixBGPBindingNewResponseEnvelopeMessages struct { Code int64 `json:"code,required"` Message string `json:"message,required"` - JSON addressingPrefixBindingNewResponseEnvelopeMessagesJSON `json:"-"` + JSON addressPrefixBGPBindingNewResponseEnvelopeMessagesJSON `json:"-"` } -// addressingPrefixBindingNewResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [AddressingPrefixBindingNewResponseEnvelopeMessages] -type addressingPrefixBindingNewResponseEnvelopeMessagesJSON struct { +// addressPrefixBGPBindingNewResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [AddressPrefixBGPBindingNewResponseEnvelopeMessages] +type addressPrefixBGPBindingNewResponseEnvelopeMessagesJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *AddressingPrefixBindingNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { +func (r *AddressPrefixBGPBindingNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // Whether the API call was successful -type AddressingPrefixBindingNewResponseEnvelopeSuccess bool +type AddressPrefixBGPBindingNewResponseEnvelopeSuccess bool const ( - AddressingPrefixBindingNewResponseEnvelopeSuccessTrue AddressingPrefixBindingNewResponseEnvelopeSuccess = true + AddressPrefixBGPBindingNewResponseEnvelopeSuccessTrue AddressPrefixBGPBindingNewResponseEnvelopeSuccess = true ) -type AddressingPrefixBindingListParams struct { +type AddressPrefixBGPBindingListParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` } -type AddressingPrefixBindingListResponseEnvelope struct { - Errors []AddressingPrefixBindingListResponseEnvelopeErrors `json:"errors,required"` - Messages []AddressingPrefixBindingListResponseEnvelopeMessages `json:"messages,required"` - Result []AddressingPrefixBindingListResponse `json:"result,required"` +type AddressPrefixBGPBindingListResponseEnvelope struct { + Errors []AddressPrefixBGPBindingListResponseEnvelopeErrors `json:"errors,required"` + Messages []AddressPrefixBGPBindingListResponseEnvelopeMessages `json:"messages,required"` + Result []AddressPrefixBGPBindingListResponse `json:"result,required"` // Whether the API call was successful - Success AddressingPrefixBindingListResponseEnvelopeSuccess `json:"success,required"` - JSON addressingPrefixBindingListResponseEnvelopeJSON `json:"-"` + Success AddressPrefixBGPBindingListResponseEnvelopeSuccess `json:"success,required"` + JSON addressPrefixBGPBindingListResponseEnvelopeJSON `json:"-"` } -// addressingPrefixBindingListResponseEnvelopeJSON contains the JSON metadata for -// the struct [AddressingPrefixBindingListResponseEnvelope] -type addressingPrefixBindingListResponseEnvelopeJSON struct { +// addressPrefixBGPBindingListResponseEnvelopeJSON contains the JSON metadata for +// the struct [AddressPrefixBGPBindingListResponseEnvelope] +type addressPrefixBGPBindingListResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field Result apijson.Field @@ -400,72 +400,72 @@ type addressingPrefixBindingListResponseEnvelopeJSON struct { ExtraFields map[string]apijson.Field } -func (r *AddressingPrefixBindingListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { +func (r *AddressPrefixBGPBindingListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type AddressingPrefixBindingListResponseEnvelopeErrors struct { +type AddressPrefixBGPBindingListResponseEnvelopeErrors struct { Code int64 `json:"code,required"` Message string `json:"message,required"` - JSON addressingPrefixBindingListResponseEnvelopeErrorsJSON `json:"-"` + JSON addressPrefixBGPBindingListResponseEnvelopeErrorsJSON `json:"-"` } -// addressingPrefixBindingListResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [AddressingPrefixBindingListResponseEnvelopeErrors] -type addressingPrefixBindingListResponseEnvelopeErrorsJSON struct { +// addressPrefixBGPBindingListResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [AddressPrefixBGPBindingListResponseEnvelopeErrors] +type addressPrefixBGPBindingListResponseEnvelopeErrorsJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *AddressingPrefixBindingListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { +func (r *AddressPrefixBGPBindingListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type AddressingPrefixBindingListResponseEnvelopeMessages struct { +type AddressPrefixBGPBindingListResponseEnvelopeMessages struct { Code int64 `json:"code,required"` Message string `json:"message,required"` - JSON addressingPrefixBindingListResponseEnvelopeMessagesJSON `json:"-"` + JSON addressPrefixBGPBindingListResponseEnvelopeMessagesJSON `json:"-"` } -// addressingPrefixBindingListResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [AddressingPrefixBindingListResponseEnvelopeMessages] -type addressingPrefixBindingListResponseEnvelopeMessagesJSON struct { +// addressPrefixBGPBindingListResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [AddressPrefixBGPBindingListResponseEnvelopeMessages] +type addressPrefixBGPBindingListResponseEnvelopeMessagesJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *AddressingPrefixBindingListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { +func (r *AddressPrefixBGPBindingListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // Whether the API call was successful -type AddressingPrefixBindingListResponseEnvelopeSuccess bool +type AddressPrefixBGPBindingListResponseEnvelopeSuccess bool const ( - AddressingPrefixBindingListResponseEnvelopeSuccessTrue AddressingPrefixBindingListResponseEnvelopeSuccess = true + AddressPrefixBGPBindingListResponseEnvelopeSuccessTrue AddressPrefixBGPBindingListResponseEnvelopeSuccess = true ) -type AddressingPrefixBindingDeleteParams struct { +type AddressPrefixBGPBindingDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` } -type AddressingPrefixBindingDeleteResponseEnvelope struct { - Errors []AddressingPrefixBindingDeleteResponseEnvelopeErrors `json:"errors,required"` - Messages []AddressingPrefixBindingDeleteResponseEnvelopeMessages `json:"messages,required"` - Result AddressingPrefixBindingDeleteResponse `json:"result,required"` +type AddressPrefixBGPBindingDeleteResponseEnvelope struct { + Errors []AddressPrefixBGPBindingDeleteResponseEnvelopeErrors `json:"errors,required"` + Messages []AddressPrefixBGPBindingDeleteResponseEnvelopeMessages `json:"messages,required"` + Result AddressPrefixBGPBindingDeleteResponse `json:"result,required"` // Whether the API call was successful - Success AddressingPrefixBindingDeleteResponseEnvelopeSuccess `json:"success,required"` - JSON addressingPrefixBindingDeleteResponseEnvelopeJSON `json:"-"` + Success AddressPrefixBGPBindingDeleteResponseEnvelopeSuccess `json:"success,required"` + JSON addressPrefixBGPBindingDeleteResponseEnvelopeJSON `json:"-"` } -// addressingPrefixBindingDeleteResponseEnvelopeJSON contains the JSON metadata for -// the struct [AddressingPrefixBindingDeleteResponseEnvelope] -type addressingPrefixBindingDeleteResponseEnvelopeJSON struct { +// addressPrefixBGPBindingDeleteResponseEnvelopeJSON contains the JSON metadata for +// the struct [AddressPrefixBGPBindingDeleteResponseEnvelope] +type addressPrefixBGPBindingDeleteResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field Result apijson.Field @@ -474,72 +474,72 @@ type addressingPrefixBindingDeleteResponseEnvelopeJSON struct { ExtraFields map[string]apijson.Field } -func (r *AddressingPrefixBindingDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { +func (r *AddressPrefixBGPBindingDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type AddressingPrefixBindingDeleteResponseEnvelopeErrors struct { +type AddressPrefixBGPBindingDeleteResponseEnvelopeErrors struct { Code int64 `json:"code,required"` Message string `json:"message,required"` - JSON addressingPrefixBindingDeleteResponseEnvelopeErrorsJSON `json:"-"` + JSON addressPrefixBGPBindingDeleteResponseEnvelopeErrorsJSON `json:"-"` } -// addressingPrefixBindingDeleteResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [AddressingPrefixBindingDeleteResponseEnvelopeErrors] -type addressingPrefixBindingDeleteResponseEnvelopeErrorsJSON struct { +// addressPrefixBGPBindingDeleteResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [AddressPrefixBGPBindingDeleteResponseEnvelopeErrors] +type addressPrefixBGPBindingDeleteResponseEnvelopeErrorsJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *AddressingPrefixBindingDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { +func (r *AddressPrefixBGPBindingDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type AddressingPrefixBindingDeleteResponseEnvelopeMessages struct { +type AddressPrefixBGPBindingDeleteResponseEnvelopeMessages struct { Code int64 `json:"code,required"` Message string `json:"message,required"` - JSON addressingPrefixBindingDeleteResponseEnvelopeMessagesJSON `json:"-"` + JSON addressPrefixBGPBindingDeleteResponseEnvelopeMessagesJSON `json:"-"` } -// addressingPrefixBindingDeleteResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [AddressingPrefixBindingDeleteResponseEnvelopeMessages] -type addressingPrefixBindingDeleteResponseEnvelopeMessagesJSON struct { +// addressPrefixBGPBindingDeleteResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [AddressPrefixBGPBindingDeleteResponseEnvelopeMessages] +type addressPrefixBGPBindingDeleteResponseEnvelopeMessagesJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *AddressingPrefixBindingDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { +func (r *AddressPrefixBGPBindingDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // Whether the API call was successful -type AddressingPrefixBindingDeleteResponseEnvelopeSuccess bool +type AddressPrefixBGPBindingDeleteResponseEnvelopeSuccess bool const ( - AddressingPrefixBindingDeleteResponseEnvelopeSuccessTrue AddressingPrefixBindingDeleteResponseEnvelopeSuccess = true + AddressPrefixBGPBindingDeleteResponseEnvelopeSuccessTrue AddressPrefixBGPBindingDeleteResponseEnvelopeSuccess = true ) -type AddressingPrefixBindingGetParams struct { +type AddressPrefixBGPBindingGetParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` } -type AddressingPrefixBindingGetResponseEnvelope struct { - Errors []AddressingPrefixBindingGetResponseEnvelopeErrors `json:"errors,required"` - Messages []AddressingPrefixBindingGetResponseEnvelopeMessages `json:"messages,required"` - Result AddressingPrefixBindingGetResponse `json:"result,required"` +type AddressPrefixBGPBindingGetResponseEnvelope struct { + Errors []AddressPrefixBGPBindingGetResponseEnvelopeErrors `json:"errors,required"` + Messages []AddressPrefixBGPBindingGetResponseEnvelopeMessages `json:"messages,required"` + Result AddressPrefixBGPBindingGetResponse `json:"result,required"` // Whether the API call was successful - Success AddressingPrefixBindingGetResponseEnvelopeSuccess `json:"success,required"` - JSON addressingPrefixBindingGetResponseEnvelopeJSON `json:"-"` + Success AddressPrefixBGPBindingGetResponseEnvelopeSuccess `json:"success,required"` + JSON addressPrefixBGPBindingGetResponseEnvelopeJSON `json:"-"` } -// addressingPrefixBindingGetResponseEnvelopeJSON contains the JSON metadata for -// the struct [AddressingPrefixBindingGetResponseEnvelope] -type addressingPrefixBindingGetResponseEnvelopeJSON struct { +// addressPrefixBGPBindingGetResponseEnvelopeJSON contains the JSON metadata for +// the struct [AddressPrefixBGPBindingGetResponseEnvelope] +type addressPrefixBGPBindingGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field Result apijson.Field @@ -548,51 +548,51 @@ type addressingPrefixBindingGetResponseEnvelopeJSON struct { ExtraFields map[string]apijson.Field } -func (r *AddressingPrefixBindingGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { +func (r *AddressPrefixBGPBindingGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type AddressingPrefixBindingGetResponseEnvelopeErrors struct { +type AddressPrefixBGPBindingGetResponseEnvelopeErrors struct { Code int64 `json:"code,required"` Message string `json:"message,required"` - JSON addressingPrefixBindingGetResponseEnvelopeErrorsJSON `json:"-"` + JSON addressPrefixBGPBindingGetResponseEnvelopeErrorsJSON `json:"-"` } -// addressingPrefixBindingGetResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [AddressingPrefixBindingGetResponseEnvelopeErrors] -type addressingPrefixBindingGetResponseEnvelopeErrorsJSON struct { +// addressPrefixBGPBindingGetResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [AddressPrefixBGPBindingGetResponseEnvelopeErrors] +type addressPrefixBGPBindingGetResponseEnvelopeErrorsJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *AddressingPrefixBindingGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { +func (r *AddressPrefixBGPBindingGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type AddressingPrefixBindingGetResponseEnvelopeMessages struct { +type AddressPrefixBGPBindingGetResponseEnvelopeMessages struct { Code int64 `json:"code,required"` Message string `json:"message,required"` - JSON addressingPrefixBindingGetResponseEnvelopeMessagesJSON `json:"-"` + JSON addressPrefixBGPBindingGetResponseEnvelopeMessagesJSON `json:"-"` } -// addressingPrefixBindingGetResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [AddressingPrefixBindingGetResponseEnvelopeMessages] -type addressingPrefixBindingGetResponseEnvelopeMessagesJSON struct { +// addressPrefixBGPBindingGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [AddressPrefixBGPBindingGetResponseEnvelopeMessages] +type addressPrefixBGPBindingGetResponseEnvelopeMessagesJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *AddressingPrefixBindingGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { +func (r *AddressPrefixBGPBindingGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // Whether the API call was successful -type AddressingPrefixBindingGetResponseEnvelopeSuccess bool +type AddressPrefixBGPBindingGetResponseEnvelopeSuccess bool const ( - AddressingPrefixBindingGetResponseEnvelopeSuccessTrue AddressingPrefixBindingGetResponseEnvelopeSuccess = true + AddressPrefixBGPBindingGetResponseEnvelopeSuccessTrue AddressPrefixBGPBindingGetResponseEnvelopeSuccess = true ) diff --git a/addressingprefixbinding_test.go b/addressprefixbgpbinding_test.go similarity index 87% rename from addressingprefixbinding_test.go rename to addressprefixbgpbinding_test.go index 3db1f8fd66d..46564e1d8dd 100644 --- a/addressingprefixbinding_test.go +++ b/addressprefixbgpbinding_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestAddressingPrefixBindingNewWithOptionalParams(t *testing.T) { +func TestAddressPrefixBGPBindingNewWithOptionalParams(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 { @@ -29,10 +29,10 @@ func TestAddressingPrefixBindingNewWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Addressing.Prefixes.Bindings.New( + _, err := client.Addresses.Prefixes.BGP.Bindings.New( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.AddressingPrefixBindingNewParams{ + cloudflare.AddressPrefixBGPBindingNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Cidr: cloudflare.F("192.0.2.0/24"), ServiceID: cloudflare.F("2db684ee7ca04e159946fd05b99e1bcd"), @@ -47,7 +47,7 @@ func TestAddressingPrefixBindingNewWithOptionalParams(t *testing.T) { } } -func TestAddressingPrefixBindingList(t *testing.T) { +func TestAddressPrefixBGPBindingList(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 { @@ -63,10 +63,10 @@ func TestAddressingPrefixBindingList(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Addressing.Prefixes.Bindings.List( + _, err := client.Addresses.Prefixes.BGP.Bindings.List( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.AddressingPrefixBindingListParams{ + cloudflare.AddressPrefixBGPBindingListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) @@ -79,7 +79,7 @@ func TestAddressingPrefixBindingList(t *testing.T) { } } -func TestAddressingPrefixBindingDelete(t *testing.T) { +func TestAddressPrefixBGPBindingDelete(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 { @@ -95,11 +95,11 @@ func TestAddressingPrefixBindingDelete(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Addressing.Prefixes.Bindings.Delete( + _, err := client.Addresses.Prefixes.BGP.Bindings.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.AddressingPrefixBindingDeleteParams{ + cloudflare.AddressPrefixBGPBindingDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) @@ -112,7 +112,7 @@ func TestAddressingPrefixBindingDelete(t *testing.T) { } } -func TestAddressingPrefixBindingGet(t *testing.T) { +func TestAddressPrefixBGPBindingGet(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 { @@ -128,11 +128,11 @@ func TestAddressingPrefixBindingGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Addressing.Prefixes.Bindings.Get( + _, err := client.Addresses.Prefixes.BGP.Bindings.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.AddressingPrefixBindingGetParams{ + cloudflare.AddressPrefixBGPBindingGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) diff --git a/addressprefixbgpprefix.go b/addressprefixbgpprefix.go new file mode 100644 index 00000000000..03637f6cb2f --- /dev/null +++ b/addressprefixbgpprefix.go @@ -0,0 +1,598 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AddressPrefixBGPPrefixService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewAddressPrefixBGPPrefixService] +// method instead. +type AddressPrefixBGPPrefixService struct { + Options []option.RequestOption +} + +// NewAddressPrefixBGPPrefixService generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewAddressPrefixBGPPrefixService(opts ...option.RequestOption) (r *AddressPrefixBGPPrefixService) { + r = &AddressPrefixBGPPrefixService{} + r.Options = opts + return +} + +// List all BGP Prefixes within the specified IP Prefix. BGP Prefixes are used to +// control which specific subnets are advertised to the Internet. It is possible to +// advertise subnets more specific than an IP Prefix by creating more specific BGP +// Prefixes. +func (r *AddressPrefixBGPPrefixService) List(ctx context.Context, prefixID string, query AddressPrefixBGPPrefixListParams, opts ...option.RequestOption) (res *[]AddressPrefixBGPPrefixListResponse, err error) { + opts = append(r.Options[:], opts...) + var env AddressPrefixBGPPrefixListResponseEnvelope + path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/bgp/prefixes", query.AccountID, prefixID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Update the properties of a BGP Prefix, such as the on demand advertisement +// status (advertised or withdrawn). +func (r *AddressPrefixBGPPrefixService) Edit(ctx context.Context, prefixID string, bgpPrefixID string, params AddressPrefixBGPPrefixEditParams, opts ...option.RequestOption) (res *AddressPrefixBGPPrefixEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env AddressPrefixBGPPrefixEditResponseEnvelope + path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/bgp/prefixes/%s", params.AccountID, prefixID, bgpPrefixID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Retrieve a single BGP Prefix according to its identifier +func (r *AddressPrefixBGPPrefixService) Get(ctx context.Context, prefixID string, bgpPrefixID string, query AddressPrefixBGPPrefixGetParams, opts ...option.RequestOption) (res *AddressPrefixBGPPrefixGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env AddressPrefixBGPPrefixGetResponseEnvelope + path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/bgp/prefixes/%s", query.AccountID, prefixID, bgpPrefixID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +type AddressPrefixBGPPrefixListResponse struct { + // Identifier + ID string `json:"id"` + // Autonomous System Number (ASN) the prefix will be advertised under. + ASN int64 `json:"asn,nullable"` + BGPSignalOpts AddressPrefixBGPPrefixListResponseBGPSignalOpts `json:"bgp_signal_opts"` + // IP Prefix in Classless Inter-Domain Routing format. + Cidr string `json:"cidr"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + ModifiedAt time.Time `json:"modified_at" format:"date-time"` + OnDemand AddressPrefixBGPPrefixListResponseOnDemand `json:"on_demand"` + JSON addressPrefixBGPPrefixListResponseJSON `json:"-"` +} + +// addressPrefixBGPPrefixListResponseJSON contains the JSON metadata for the struct +// [AddressPrefixBGPPrefixListResponse] +type addressPrefixBGPPrefixListResponseJSON struct { + ID apijson.Field + ASN apijson.Field + BGPSignalOpts apijson.Field + Cidr apijson.Field + CreatedAt apijson.Field + ModifiedAt apijson.Field + OnDemand apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressPrefixBGPPrefixListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressPrefixBGPPrefixListResponseBGPSignalOpts struct { + // Whether control of advertisement of the prefix to the Internet is enabled to be + // performed via BGP signal + Enabled bool `json:"enabled"` + // Last time BGP signaling control was toggled. This field is null if BGP signaling + // has never been enabled. + ModifiedAt time.Time `json:"modified_at,nullable" format:"date-time"` + JSON addressPrefixBGPPrefixListResponseBGPSignalOptsJSON `json:"-"` +} + +// addressPrefixBGPPrefixListResponseBGPSignalOptsJSON contains the JSON metadata +// for the struct [AddressPrefixBGPPrefixListResponseBGPSignalOpts] +type addressPrefixBGPPrefixListResponseBGPSignalOptsJSON struct { + Enabled apijson.Field + ModifiedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressPrefixBGPPrefixListResponseBGPSignalOpts) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressPrefixBGPPrefixListResponseOnDemand struct { + // Prefix advertisement status to the Internet. This field is only not 'null' if on + // demand is enabled. + Advertised bool `json:"advertised,nullable"` + // Last time the advertisement status was changed. This field is only not 'null' if + // on demand is enabled. + AdvertisedModifiedAt time.Time `json:"advertised_modified_at,nullable" format:"date-time"` + // Whether advertisement of the prefix to the Internet may be dynamically enabled + // or disabled. + OnDemandEnabled bool `json:"on_demand_enabled"` + // Whether advertisement status of the prefix is locked, meaning it cannot be + // changed. + OnDemandLocked bool `json:"on_demand_locked"` + JSON addressPrefixBGPPrefixListResponseOnDemandJSON `json:"-"` +} + +// addressPrefixBGPPrefixListResponseOnDemandJSON contains the JSON metadata for +// the struct [AddressPrefixBGPPrefixListResponseOnDemand] +type addressPrefixBGPPrefixListResponseOnDemandJSON struct { + Advertised apijson.Field + AdvertisedModifiedAt apijson.Field + OnDemandEnabled apijson.Field + OnDemandLocked apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressPrefixBGPPrefixListResponseOnDemand) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressPrefixBGPPrefixEditResponse struct { + // Identifier + ID string `json:"id"` + // Autonomous System Number (ASN) the prefix will be advertised under. + ASN int64 `json:"asn,nullable"` + BGPSignalOpts AddressPrefixBGPPrefixEditResponseBGPSignalOpts `json:"bgp_signal_opts"` + // IP Prefix in Classless Inter-Domain Routing format. + Cidr string `json:"cidr"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + ModifiedAt time.Time `json:"modified_at" format:"date-time"` + OnDemand AddressPrefixBGPPrefixEditResponseOnDemand `json:"on_demand"` + JSON addressPrefixBGPPrefixEditResponseJSON `json:"-"` +} + +// addressPrefixBGPPrefixEditResponseJSON contains the JSON metadata for the struct +// [AddressPrefixBGPPrefixEditResponse] +type addressPrefixBGPPrefixEditResponseJSON struct { + ID apijson.Field + ASN apijson.Field + BGPSignalOpts apijson.Field + Cidr apijson.Field + CreatedAt apijson.Field + ModifiedAt apijson.Field + OnDemand apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressPrefixBGPPrefixEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressPrefixBGPPrefixEditResponseBGPSignalOpts struct { + // Whether control of advertisement of the prefix to the Internet is enabled to be + // performed via BGP signal + Enabled bool `json:"enabled"` + // Last time BGP signaling control was toggled. This field is null if BGP signaling + // has never been enabled. + ModifiedAt time.Time `json:"modified_at,nullable" format:"date-time"` + JSON addressPrefixBGPPrefixEditResponseBGPSignalOptsJSON `json:"-"` +} + +// addressPrefixBGPPrefixEditResponseBGPSignalOptsJSON contains the JSON metadata +// for the struct [AddressPrefixBGPPrefixEditResponseBGPSignalOpts] +type addressPrefixBGPPrefixEditResponseBGPSignalOptsJSON struct { + Enabled apijson.Field + ModifiedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressPrefixBGPPrefixEditResponseBGPSignalOpts) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressPrefixBGPPrefixEditResponseOnDemand struct { + // Prefix advertisement status to the Internet. This field is only not 'null' if on + // demand is enabled. + Advertised bool `json:"advertised,nullable"` + // Last time the advertisement status was changed. This field is only not 'null' if + // on demand is enabled. + AdvertisedModifiedAt time.Time `json:"advertised_modified_at,nullable" format:"date-time"` + // Whether advertisement of the prefix to the Internet may be dynamically enabled + // or disabled. + OnDemandEnabled bool `json:"on_demand_enabled"` + // Whether advertisement status of the prefix is locked, meaning it cannot be + // changed. + OnDemandLocked bool `json:"on_demand_locked"` + JSON addressPrefixBGPPrefixEditResponseOnDemandJSON `json:"-"` +} + +// addressPrefixBGPPrefixEditResponseOnDemandJSON contains the JSON metadata for +// the struct [AddressPrefixBGPPrefixEditResponseOnDemand] +type addressPrefixBGPPrefixEditResponseOnDemandJSON struct { + Advertised apijson.Field + AdvertisedModifiedAt apijson.Field + OnDemandEnabled apijson.Field + OnDemandLocked apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressPrefixBGPPrefixEditResponseOnDemand) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressPrefixBGPPrefixGetResponse struct { + // Identifier + ID string `json:"id"` + // Autonomous System Number (ASN) the prefix will be advertised under. + ASN int64 `json:"asn,nullable"` + BGPSignalOpts AddressPrefixBGPPrefixGetResponseBGPSignalOpts `json:"bgp_signal_opts"` + // IP Prefix in Classless Inter-Domain Routing format. + Cidr string `json:"cidr"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + ModifiedAt time.Time `json:"modified_at" format:"date-time"` + OnDemand AddressPrefixBGPPrefixGetResponseOnDemand `json:"on_demand"` + JSON addressPrefixBGPPrefixGetResponseJSON `json:"-"` +} + +// addressPrefixBGPPrefixGetResponseJSON contains the JSON metadata for the struct +// [AddressPrefixBGPPrefixGetResponse] +type addressPrefixBGPPrefixGetResponseJSON struct { + ID apijson.Field + ASN apijson.Field + BGPSignalOpts apijson.Field + Cidr apijson.Field + CreatedAt apijson.Field + ModifiedAt apijson.Field + OnDemand apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressPrefixBGPPrefixGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressPrefixBGPPrefixGetResponseBGPSignalOpts struct { + // Whether control of advertisement of the prefix to the Internet is enabled to be + // performed via BGP signal + Enabled bool `json:"enabled"` + // Last time BGP signaling control was toggled. This field is null if BGP signaling + // has never been enabled. + ModifiedAt time.Time `json:"modified_at,nullable" format:"date-time"` + JSON addressPrefixBGPPrefixGetResponseBGPSignalOptsJSON `json:"-"` +} + +// addressPrefixBGPPrefixGetResponseBGPSignalOptsJSON contains the JSON metadata +// for the struct [AddressPrefixBGPPrefixGetResponseBGPSignalOpts] +type addressPrefixBGPPrefixGetResponseBGPSignalOptsJSON struct { + Enabled apijson.Field + ModifiedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressPrefixBGPPrefixGetResponseBGPSignalOpts) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressPrefixBGPPrefixGetResponseOnDemand struct { + // Prefix advertisement status to the Internet. This field is only not 'null' if on + // demand is enabled. + Advertised bool `json:"advertised,nullable"` + // Last time the advertisement status was changed. This field is only not 'null' if + // on demand is enabled. + AdvertisedModifiedAt time.Time `json:"advertised_modified_at,nullable" format:"date-time"` + // Whether advertisement of the prefix to the Internet may be dynamically enabled + // or disabled. + OnDemandEnabled bool `json:"on_demand_enabled"` + // Whether advertisement status of the prefix is locked, meaning it cannot be + // changed. + OnDemandLocked bool `json:"on_demand_locked"` + JSON addressPrefixBGPPrefixGetResponseOnDemandJSON `json:"-"` +} + +// addressPrefixBGPPrefixGetResponseOnDemandJSON contains the JSON metadata for the +// struct [AddressPrefixBGPPrefixGetResponseOnDemand] +type addressPrefixBGPPrefixGetResponseOnDemandJSON struct { + Advertised apijson.Field + AdvertisedModifiedAt apijson.Field + OnDemandEnabled apijson.Field + OnDemandLocked apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressPrefixBGPPrefixGetResponseOnDemand) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressPrefixBGPPrefixListParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` +} + +type AddressPrefixBGPPrefixListResponseEnvelope struct { + Errors []AddressPrefixBGPPrefixListResponseEnvelopeErrors `json:"errors,required"` + Messages []AddressPrefixBGPPrefixListResponseEnvelopeMessages `json:"messages,required"` + Result []AddressPrefixBGPPrefixListResponse `json:"result,required,nullable"` + // Whether the API call was successful + Success AddressPrefixBGPPrefixListResponseEnvelopeSuccess `json:"success,required"` + ResultInfo AddressPrefixBGPPrefixListResponseEnvelopeResultInfo `json:"result_info"` + JSON addressPrefixBGPPrefixListResponseEnvelopeJSON `json:"-"` +} + +// addressPrefixBGPPrefixListResponseEnvelopeJSON contains the JSON metadata for +// the struct [AddressPrefixBGPPrefixListResponseEnvelope] +type addressPrefixBGPPrefixListResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + ResultInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressPrefixBGPPrefixListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressPrefixBGPPrefixListResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON addressPrefixBGPPrefixListResponseEnvelopeErrorsJSON `json:"-"` +} + +// addressPrefixBGPPrefixListResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [AddressPrefixBGPPrefixListResponseEnvelopeErrors] +type addressPrefixBGPPrefixListResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressPrefixBGPPrefixListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressPrefixBGPPrefixListResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON addressPrefixBGPPrefixListResponseEnvelopeMessagesJSON `json:"-"` +} + +// addressPrefixBGPPrefixListResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [AddressPrefixBGPPrefixListResponseEnvelopeMessages] +type addressPrefixBGPPrefixListResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressPrefixBGPPrefixListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AddressPrefixBGPPrefixListResponseEnvelopeSuccess bool + +const ( + AddressPrefixBGPPrefixListResponseEnvelopeSuccessTrue AddressPrefixBGPPrefixListResponseEnvelopeSuccess = true +) + +type AddressPrefixBGPPrefixListResponseEnvelopeResultInfo struct { + // Total number of results for the requested service + Count float64 `json:"count"` + // Current page within paginated list of results + Page float64 `json:"page"` + // Number of results per page of results + PerPage float64 `json:"per_page"` + // Total results available without any search parameters + TotalCount float64 `json:"total_count"` + JSON addressPrefixBGPPrefixListResponseEnvelopeResultInfoJSON `json:"-"` +} + +// addressPrefixBGPPrefixListResponseEnvelopeResultInfoJSON contains the JSON +// metadata for the struct [AddressPrefixBGPPrefixListResponseEnvelopeResultInfo] +type addressPrefixBGPPrefixListResponseEnvelopeResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressPrefixBGPPrefixListResponseEnvelopeResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressPrefixBGPPrefixEditParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` + OnDemand param.Field[AddressPrefixBGPPrefixEditParamsOnDemand] `json:"on_demand"` +} + +func (r AddressPrefixBGPPrefixEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AddressPrefixBGPPrefixEditParamsOnDemand struct { + Advertised param.Field[bool] `json:"advertised"` +} + +func (r AddressPrefixBGPPrefixEditParamsOnDemand) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AddressPrefixBGPPrefixEditResponseEnvelope struct { + Errors []AddressPrefixBGPPrefixEditResponseEnvelopeErrors `json:"errors,required"` + Messages []AddressPrefixBGPPrefixEditResponseEnvelopeMessages `json:"messages,required"` + Result AddressPrefixBGPPrefixEditResponse `json:"result,required"` + // Whether the API call was successful + Success AddressPrefixBGPPrefixEditResponseEnvelopeSuccess `json:"success,required"` + JSON addressPrefixBGPPrefixEditResponseEnvelopeJSON `json:"-"` +} + +// addressPrefixBGPPrefixEditResponseEnvelopeJSON contains the JSON metadata for +// the struct [AddressPrefixBGPPrefixEditResponseEnvelope] +type addressPrefixBGPPrefixEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressPrefixBGPPrefixEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressPrefixBGPPrefixEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON addressPrefixBGPPrefixEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// addressPrefixBGPPrefixEditResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [AddressPrefixBGPPrefixEditResponseEnvelopeErrors] +type addressPrefixBGPPrefixEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressPrefixBGPPrefixEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressPrefixBGPPrefixEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON addressPrefixBGPPrefixEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// addressPrefixBGPPrefixEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [AddressPrefixBGPPrefixEditResponseEnvelopeMessages] +type addressPrefixBGPPrefixEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressPrefixBGPPrefixEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AddressPrefixBGPPrefixEditResponseEnvelopeSuccess bool + +const ( + AddressPrefixBGPPrefixEditResponseEnvelopeSuccessTrue AddressPrefixBGPPrefixEditResponseEnvelopeSuccess = true +) + +type AddressPrefixBGPPrefixGetParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` +} + +type AddressPrefixBGPPrefixGetResponseEnvelope struct { + Errors []AddressPrefixBGPPrefixGetResponseEnvelopeErrors `json:"errors,required"` + Messages []AddressPrefixBGPPrefixGetResponseEnvelopeMessages `json:"messages,required"` + Result AddressPrefixBGPPrefixGetResponse `json:"result,required"` + // Whether the API call was successful + Success AddressPrefixBGPPrefixGetResponseEnvelopeSuccess `json:"success,required"` + JSON addressPrefixBGPPrefixGetResponseEnvelopeJSON `json:"-"` +} + +// addressPrefixBGPPrefixGetResponseEnvelopeJSON contains the JSON metadata for the +// struct [AddressPrefixBGPPrefixGetResponseEnvelope] +type addressPrefixBGPPrefixGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressPrefixBGPPrefixGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressPrefixBGPPrefixGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON addressPrefixBGPPrefixGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// addressPrefixBGPPrefixGetResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [AddressPrefixBGPPrefixGetResponseEnvelopeErrors] +type addressPrefixBGPPrefixGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressPrefixBGPPrefixGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressPrefixBGPPrefixGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON addressPrefixBGPPrefixGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// addressPrefixBGPPrefixGetResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [AddressPrefixBGPPrefixGetResponseEnvelopeMessages] +type addressPrefixBGPPrefixGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressPrefixBGPPrefixGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AddressPrefixBGPPrefixGetResponseEnvelopeSuccess bool + +const ( + AddressPrefixBGPPrefixGetResponseEnvelopeSuccessTrue AddressPrefixBGPPrefixGetResponseEnvelopeSuccess = true +) diff --git a/addressingprefixbgpprefix_test.go b/addressprefixbgpprefix_test.go similarity index 85% rename from addressingprefixbgpprefix_test.go rename to addressprefixbgpprefix_test.go index 6e1f73043b0..9274ce476ee 100644 --- a/addressingprefixbgpprefix_test.go +++ b/addressprefixbgpprefix_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestAddressingPrefixBGPPrefixList(t *testing.T) { +func TestAddressPrefixBGPPrefixList(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 { @@ -29,10 +29,10 @@ func TestAddressingPrefixBGPPrefixList(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Addressing.Prefixes.BGPPrefixes.List( + _, err := client.Addresses.Prefixes.BGP.Prefixes.List( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.AddressingPrefixBGPPrefixListParams{ + cloudflare.AddressPrefixBGPPrefixListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) @@ -45,7 +45,7 @@ func TestAddressingPrefixBGPPrefixList(t *testing.T) { } } -func TestAddressingPrefixBGPPrefixEditWithOptionalParams(t *testing.T) { +func TestAddressPrefixBGPPrefixEditWithOptionalParams(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 { @@ -61,13 +61,13 @@ func TestAddressingPrefixBGPPrefixEditWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Addressing.Prefixes.BGPPrefixes.Edit( + _, err := client.Addresses.Prefixes.BGP.Prefixes.Edit( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.AddressingPrefixBGPPrefixEditParams{ + cloudflare.AddressPrefixBGPPrefixEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - OnDemand: cloudflare.F(cloudflare.AddressingPrefixBGPPrefixEditParamsOnDemand{ + OnDemand: cloudflare.F(cloudflare.AddressPrefixBGPPrefixEditParamsOnDemand{ Advertised: cloudflare.F(true), }), }, @@ -81,7 +81,7 @@ func TestAddressingPrefixBGPPrefixEditWithOptionalParams(t *testing.T) { } } -func TestAddressingPrefixBGPPrefixGet(t *testing.T) { +func TestAddressPrefixBGPPrefixGet(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 { @@ -97,11 +97,11 @@ func TestAddressingPrefixBGPPrefixGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Addressing.Prefixes.BGPPrefixes.Get( + _, err := client.Addresses.Prefixes.BGP.Prefixes.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.AddressingPrefixBGPPrefixGetParams{ + cloudflare.AddressPrefixBGPPrefixGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) diff --git a/addressprefixbgpstatus_test.go b/addressprefixbgpstatus_test.go index bccd335d754..c864100493c 100644 --- a/addressprefixbgpstatus_test.go +++ b/addressprefixbgpstatus_test.go @@ -29,7 +29,7 @@ func TestAddressPrefixBGPStatusEdit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Addresses.Prefixes.BGPs.Statuses.Edit( + _, err := client.Addresses.Prefixes.BGP.Statuses.Edit( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", cloudflare.AddressPrefixBGPStatusEditParams{ @@ -62,7 +62,7 @@ func TestAddressPrefixBGPStatusGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Addresses.Prefixes.BGPs.Statuses.Get( + _, err := client.Addresses.Prefixes.BGP.Statuses.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", cloudflare.AddressPrefixBGPStatusGetParams{ diff --git a/addressservice.go b/addressservice.go new file mode 100644 index 00000000000..f56d38d5666 --- /dev/null +++ b/addressservice.go @@ -0,0 +1,143 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// AddressServiceService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewAddressServiceService] method +// instead. +type AddressServiceService struct { + Options []option.RequestOption +} + +// NewAddressServiceService generates a new service that applies the given options +// to each request. These options are applied after the parent client's options (if +// there is one), and before any request-specific options. +func NewAddressServiceService(opts ...option.RequestOption) (r *AddressServiceService) { + r = &AddressServiceService{} + r.Options = opts + return +} + +// Bring-Your-Own IP (BYOIP) prefixes onboarded to Cloudflare must be bound to a +// service running on the Cloudflare network to enable a Cloudflare product on the +// IP addresses. This endpoint can be used as a reference of available services on +// the Cloudflare network, and their service IDs. +func (r *AddressServiceService) List(ctx context.Context, query AddressServiceListParams, opts ...option.RequestOption) (res *[]AddressServiceListResponse, err error) { + opts = append(r.Options[:], opts...) + var env AddressServiceListResponseEnvelope + path := fmt.Sprintf("accounts/%s/addressing/services", query.AccountID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +type AddressServiceListResponse struct { + // Identifier + ID string `json:"id"` + // Name of a service running on the Cloudflare network + Name string `json:"name"` + JSON addressServiceListResponseJSON `json:"-"` +} + +// addressServiceListResponseJSON contains the JSON metadata for the struct +// [AddressServiceListResponse] +type addressServiceListResponseJSON struct { + ID apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressServiceListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressServiceListParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` +} + +type AddressServiceListResponseEnvelope struct { + Errors []AddressServiceListResponseEnvelopeErrors `json:"errors,required"` + Messages []AddressServiceListResponseEnvelopeMessages `json:"messages,required"` + Result []AddressServiceListResponse `json:"result,required"` + // Whether the API call was successful + Success AddressServiceListResponseEnvelopeSuccess `json:"success,required"` + JSON addressServiceListResponseEnvelopeJSON `json:"-"` +} + +// addressServiceListResponseEnvelopeJSON contains the JSON metadata for the struct +// [AddressServiceListResponseEnvelope] +type addressServiceListResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressServiceListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressServiceListResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON addressServiceListResponseEnvelopeErrorsJSON `json:"-"` +} + +// addressServiceListResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [AddressServiceListResponseEnvelopeErrors] +type addressServiceListResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressServiceListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type AddressServiceListResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON addressServiceListResponseEnvelopeMessagesJSON `json:"-"` +} + +// addressServiceListResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [AddressServiceListResponseEnvelopeMessages] +type addressServiceListResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AddressServiceListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type AddressServiceListResponseEnvelopeSuccess bool + +const ( + AddressServiceListResponseEnvelopeSuccessTrue AddressServiceListResponseEnvelopeSuccess = true +) diff --git a/addressingservice_test.go b/addressservice_test.go similarity index 89% rename from addressingservice_test.go rename to addressservice_test.go index 3c3b7cc2950..ea7a9749536 100644 --- a/addressingservice_test.go +++ b/addressservice_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestAddressingServiceList(t *testing.T) { +func TestAddressServiceList(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 { @@ -29,7 +29,7 @@ func TestAddressingServiceList(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Addressing.Services.List(context.TODO(), cloudflare.AddressingServiceListParams{ + _, err := client.Addresses.Services.List(context.TODO(), cloudflare.AddressServiceListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/api.md b/api.md index 23148915d8c..83ed7fc663b 100644 --- a/api.md +++ b/api.md @@ -12,6 +12,24 @@ Methods: - client.Accounts.List(ctx context.Context, query cloudflare.AccountListParams) (shared.V4PagePaginationArray[cloudflare.AccountListResponse], error) - client.Accounts.Get(ctx context.Context, query cloudflare.AccountGetParams) (cloudflare.AccountGetResponse, error) +## Members + +Response Types: + +- cloudflare.AccountMemberNewResponse +- cloudflare.AccountMemberUpdateResponse +- cloudflare.AccountMemberListResponse +- cloudflare.AccountMemberDeleteResponse +- cloudflare.AccountMemberGetResponse + +Methods: + +- client.Accounts.Members.New(ctx context.Context, params cloudflare.AccountMemberNewParams) (cloudflare.AccountMemberNewResponse, error) +- client.Accounts.Members.Update(ctx context.Context, memberID string, params cloudflare.AccountMemberUpdateParams) (cloudflare.AccountMemberUpdateResponse, error) +- client.Accounts.Members.List(ctx context.Context, params cloudflare.AccountMemberListParams) (shared.V4PagePaginationArray[cloudflare.AccountMemberListResponse], error) +- client.Accounts.Members.Delete(ctx context.Context, memberID string, body cloudflare.AccountMemberDeleteParams) (cloudflare.AccountMemberDeleteResponse, error) +- client.Accounts.Members.Get(ctx context.Context, memberID string, query cloudflare.AccountMemberGetParams) (cloudflare.AccountMemberGetResponse, error) + # Certificates Response Types: @@ -102,21 +120,19 @@ Methods: ### AccessRules -#### Rules - Response Types: -- cloudflare.UserFirewallAccessRuleRuleNewResponse -- cloudflare.UserFirewallAccessRuleRuleListResponse -- cloudflare.UserFirewallAccessRuleRuleDeleteResponse -- cloudflare.UserFirewallAccessRuleRuleEditResponse +- cloudflare.UserFirewallAccessRuleNewResponse +- cloudflare.UserFirewallAccessRuleListResponse +- cloudflare.UserFirewallAccessRuleDeleteResponse +- cloudflare.UserFirewallAccessRuleEditResponse Methods: -- client.User.Firewall.AccessRules.Rules.New(ctx context.Context, body cloudflare.UserFirewallAccessRuleRuleNewParams) (cloudflare.UserFirewallAccessRuleRuleNewResponse, error) -- client.User.Firewall.AccessRules.Rules.List(ctx context.Context, query cloudflare.UserFirewallAccessRuleRuleListParams) (shared.V4PagePaginationArray[cloudflare.UserFirewallAccessRuleRuleListResponse], error) -- client.User.Firewall.AccessRules.Rules.Delete(ctx context.Context, identifier string) (cloudflare.UserFirewallAccessRuleRuleDeleteResponse, error) -- client.User.Firewall.AccessRules.Rules.Edit(ctx context.Context, identifier string, body cloudflare.UserFirewallAccessRuleRuleEditParams) (cloudflare.UserFirewallAccessRuleRuleEditResponse, error) +- client.User.Firewall.AccessRules.New(ctx context.Context, body cloudflare.UserFirewallAccessRuleNewParams) (cloudflare.UserFirewallAccessRuleNewResponse, error) +- client.User.Firewall.AccessRules.List(ctx context.Context, query cloudflare.UserFirewallAccessRuleListParams) (shared.V4PagePaginationArray[cloudflare.UserFirewallAccessRuleListResponse], error) +- client.User.Firewall.AccessRules.Delete(ctx context.Context, identifier string) (cloudflare.UserFirewallAccessRuleDeleteResponse, error) +- client.User.Firewall.AccessRules.Edit(ctx context.Context, identifier string, body cloudflare.UserFirewallAccessRuleEditParams) (cloudflare.UserFirewallAccessRuleEditResponse, error) ## Invites @@ -194,17 +210,17 @@ Methods: - client.User.LoadBalancers.Preview.Get(ctx context.Context, previewID interface{}) (cloudflare.UserLoadBalancerPreviewGetResponse, error) -## LoadBalancingAnalytics +### Analytics -### Events +#### Events Response Types: -- cloudflare.UserLoadBalancingAnalyticEventListResponse +- cloudflare.UserLoadBalancerAnalyticsEventListResponse Methods: -- client.User.LoadBalancingAnalytics.Events.List(ctx context.Context, query cloudflare.UserLoadBalancingAnalyticEventListParams) ([]cloudflare.UserLoadBalancingAnalyticEventListResponse, error) +- client.User.LoadBalancers.Analytics.Events.List(ctx context.Context, query cloudflare.UserLoadBalancerAnalyticsEventListParams) ([]cloudflare.UserLoadBalancerAnalyticsEventListResponse, error) ## Organizations @@ -266,11 +282,11 @@ Methods: - client.User.Tokens.PermissionGroups.List(ctx context.Context) ([]cloudflare.UserTokenPermissionGroupListResponse, error) -### Values +### Value Methods: -- client.User.Tokens.Values.Update(ctx context.Context, tokenID interface{}, body cloudflare.UserTokenValueUpdateParams) (string, error) +- client.User.Tokens.Value.Update(ctx context.Context, tokenID interface{}, body cloudflare.UserTokenValueUpdateParams) (string, error) # Zones @@ -290,2172 +306,2196 @@ Methods: - client.Zones.Edit(ctx context.Context, params cloudflare.ZoneEditParams) (cloudflare.ZoneEditResponse, error) - client.Zones.Get(ctx context.Context, query cloudflare.ZoneGetParams) (cloudflare.ZoneGetResponse, error) -## CustomNameservers +## ActivationCheck Response Types: -- cloudflare.ZoneCustomNameserverUpdateResponse -- cloudflare.ZoneCustomNameserverGetResponse +- cloudflare.ZoneActivationCheckTriggerResponse Methods: -- client.Zones.CustomNameservers.Update(ctx context.Context, params cloudflare.ZoneCustomNameserverUpdateParams) (cloudflare.ZoneCustomNameserverUpdateResponse, error) -- client.Zones.CustomNameservers.Get(ctx context.Context, query cloudflare.ZoneCustomNameserverGetParams) (cloudflare.ZoneCustomNameserverGetResponse, error) +- client.Zones.ActivationCheck.Trigger(ctx context.Context, body cloudflare.ZoneActivationCheckTriggerParams) (cloudflare.ZoneActivationCheckTriggerResponse, error) -## Holds +## Settings Response Types: -- cloudflare.ZoneHoldNewResponse -- cloudflare.ZoneHoldDeleteResponse -- cloudflare.ZoneHoldGetResponse +- cloudflare.ZoneSettingListResponse +- cloudflare.ZoneSettingEditResponse Methods: -- client.Zones.Holds.New(ctx context.Context, params cloudflare.ZoneHoldNewParams) (cloudflare.ZoneHoldNewResponse, error) -- client.Zones.Holds.Delete(ctx context.Context, params cloudflare.ZoneHoldDeleteParams) (cloudflare.ZoneHoldDeleteResponse, error) -- client.Zones.Holds.Get(ctx context.Context, query cloudflare.ZoneHoldGetParams) (cloudflare.ZoneHoldGetResponse, error) +- client.Zones.Settings.List(ctx context.Context, query cloudflare.ZoneSettingListParams) ([]cloudflare.ZoneSettingListResponse, error) +- client.Zones.Settings.Edit(ctx context.Context, params cloudflare.ZoneSettingEditParams) ([]cloudflare.ZoneSettingEditResponse, error) -# LoadBalancers +### ZeroRTT Response Types: -- cloudflare.LoadBalancerNewResponse -- cloudflare.LoadBalancerUpdateResponse -- cloudflare.LoadBalancerListResponse -- cloudflare.LoadBalancerDeleteResponse -- cloudflare.LoadBalancerEditResponse -- cloudflare.LoadBalancerGetResponse +- cloudflare.ZoneSettingZeroRTTEditResponse +- cloudflare.ZoneSettingZeroRTTGetResponse Methods: -- client.LoadBalancers.New(ctx context.Context, params cloudflare.LoadBalancerNewParams) (cloudflare.LoadBalancerNewResponse, error) -- client.LoadBalancers.Update(ctx context.Context, loadBalancerID string, params cloudflare.LoadBalancerUpdateParams) (cloudflare.LoadBalancerUpdateResponse, error) -- client.LoadBalancers.List(ctx context.Context, query cloudflare.LoadBalancerListParams) ([]cloudflare.LoadBalancerListResponse, error) -- client.LoadBalancers.Delete(ctx context.Context, loadBalancerID string, body cloudflare.LoadBalancerDeleteParams) (cloudflare.LoadBalancerDeleteResponse, error) -- client.LoadBalancers.Edit(ctx context.Context, loadBalancerID string, params cloudflare.LoadBalancerEditParams) (cloudflare.LoadBalancerEditResponse, error) -- client.LoadBalancers.Get(ctx context.Context, loadBalancerID string, query cloudflare.LoadBalancerGetParams) (cloudflare.LoadBalancerGetResponse, error) +- client.Zones.Settings.ZeroRTT.Edit(ctx context.Context, params cloudflare.ZoneSettingZeroRTTEditParams) (cloudflare.ZoneSettingZeroRTTEditResponse, error) +- client.Zones.Settings.ZeroRTT.Get(ctx context.Context, query cloudflare.ZoneSettingZeroRTTGetParams) (cloudflare.ZoneSettingZeroRTTGetResponse, error) -## Monitors +### AdvancedDDOS Response Types: -- cloudflare.LoadBalancerMonitorNewResponse -- cloudflare.LoadBalancerMonitorUpdateResponse -- cloudflare.LoadBalancerMonitorListResponse -- cloudflare.LoadBalancerMonitorDeleteResponse -- cloudflare.LoadBalancerMonitorEditResponse -- cloudflare.LoadBalancerMonitorGetResponse +- cloudflare.ZoneSettingAdvancedDDOSGetResponse Methods: -- client.LoadBalancers.Monitors.New(ctx context.Context, params cloudflare.LoadBalancerMonitorNewParams) (cloudflare.LoadBalancerMonitorNewResponse, error) -- client.LoadBalancers.Monitors.Update(ctx context.Context, monitorID string, params cloudflare.LoadBalancerMonitorUpdateParams) (cloudflare.LoadBalancerMonitorUpdateResponse, error) -- client.LoadBalancers.Monitors.List(ctx context.Context, query cloudflare.LoadBalancerMonitorListParams) ([]cloudflare.LoadBalancerMonitorListResponse, error) -- client.LoadBalancers.Monitors.Delete(ctx context.Context, monitorID string, body cloudflare.LoadBalancerMonitorDeleteParams) (cloudflare.LoadBalancerMonitorDeleteResponse, error) -- client.LoadBalancers.Monitors.Edit(ctx context.Context, monitorID string, params cloudflare.LoadBalancerMonitorEditParams) (cloudflare.LoadBalancerMonitorEditResponse, error) -- client.LoadBalancers.Monitors.Get(ctx context.Context, monitorID string, query cloudflare.LoadBalancerMonitorGetParams) (cloudflare.LoadBalancerMonitorGetResponse, error) +- client.Zones.Settings.AdvancedDDOS.Get(ctx context.Context, query cloudflare.ZoneSettingAdvancedDDOSGetParams) (cloudflare.ZoneSettingAdvancedDDOSGetResponse, error) -### Previews +### AlwaysOnline Response Types: -- cloudflare.LoadBalancerMonitorPreviewNewResponse +- cloudflare.ZoneSettingAlwaysOnlineEditResponse +- cloudflare.ZoneSettingAlwaysOnlineGetResponse Methods: -- client.LoadBalancers.Monitors.Previews.New(ctx context.Context, monitorID string, params cloudflare.LoadBalancerMonitorPreviewNewParams) (cloudflare.LoadBalancerMonitorPreviewNewResponse, error) +- client.Zones.Settings.AlwaysOnline.Edit(ctx context.Context, params cloudflare.ZoneSettingAlwaysOnlineEditParams) (cloudflare.ZoneSettingAlwaysOnlineEditResponse, error) +- client.Zones.Settings.AlwaysOnline.Get(ctx context.Context, query cloudflare.ZoneSettingAlwaysOnlineGetParams) (cloudflare.ZoneSettingAlwaysOnlineGetResponse, error) -### References +### AlwaysUseHTTPS Response Types: -- cloudflare.LoadBalancerMonitorReferenceListResponse +- cloudflare.ZoneSettingAlwaysUseHTTPSEditResponse +- cloudflare.ZoneSettingAlwaysUseHTTPSGetResponse Methods: -- client.LoadBalancers.Monitors.References.List(ctx context.Context, monitorID string, query cloudflare.LoadBalancerMonitorReferenceListParams) ([]cloudflare.LoadBalancerMonitorReferenceListResponse, error) +- client.Zones.Settings.AlwaysUseHTTPS.Edit(ctx context.Context, params cloudflare.ZoneSettingAlwaysUseHTTPSEditParams) (cloudflare.ZoneSettingAlwaysUseHTTPSEditResponse, error) +- client.Zones.Settings.AlwaysUseHTTPS.Get(ctx context.Context, query cloudflare.ZoneSettingAlwaysUseHTTPSGetParams) (cloudflare.ZoneSettingAlwaysUseHTTPSGetResponse, error) -## Pools +### AutomaticHTTPSRewrites Response Types: -- cloudflare.LoadBalancerPoolNewResponse -- cloudflare.LoadBalancerPoolUpdateResponse -- cloudflare.LoadBalancerPoolListResponse -- cloudflare.LoadBalancerPoolDeleteResponse -- cloudflare.LoadBalancerPoolEditResponse -- cloudflare.LoadBalancerPoolGetResponse +- cloudflare.ZoneSettingAutomaticHTTPSRewriteEditResponse +- cloudflare.ZoneSettingAutomaticHTTPSRewriteGetResponse Methods: -- client.LoadBalancers.Pools.New(ctx context.Context, params cloudflare.LoadBalancerPoolNewParams) (cloudflare.LoadBalancerPoolNewResponse, error) -- client.LoadBalancers.Pools.Update(ctx context.Context, poolID string, params cloudflare.LoadBalancerPoolUpdateParams) (cloudflare.LoadBalancerPoolUpdateResponse, error) -- client.LoadBalancers.Pools.List(ctx context.Context, params cloudflare.LoadBalancerPoolListParams) ([]cloudflare.LoadBalancerPoolListResponse, error) -- client.LoadBalancers.Pools.Delete(ctx context.Context, poolID string, body cloudflare.LoadBalancerPoolDeleteParams) (cloudflare.LoadBalancerPoolDeleteResponse, error) -- client.LoadBalancers.Pools.Edit(ctx context.Context, poolID string, params cloudflare.LoadBalancerPoolEditParams) (cloudflare.LoadBalancerPoolEditResponse, error) -- client.LoadBalancers.Pools.Get(ctx context.Context, poolID string, query cloudflare.LoadBalancerPoolGetParams) (cloudflare.LoadBalancerPoolGetResponse, error) +- client.Zones.Settings.AutomaticHTTPSRewrites.Edit(ctx context.Context, params cloudflare.ZoneSettingAutomaticHTTPSRewriteEditParams) (cloudflare.ZoneSettingAutomaticHTTPSRewriteEditResponse, error) +- client.Zones.Settings.AutomaticHTTPSRewrites.Get(ctx context.Context, query cloudflare.ZoneSettingAutomaticHTTPSRewriteGetParams) (cloudflare.ZoneSettingAutomaticHTTPSRewriteGetResponse, error) -### Health +### AutomaticPlatformOptimization Response Types: -- cloudflare.LoadBalancerPoolHealthNewResponse -- cloudflare.LoadBalancerPoolHealthGetResponse +- cloudflare.ZoneSettingAutomaticPlatformOptimizationEditResponse +- cloudflare.ZoneSettingAutomaticPlatformOptimizationGetResponse Methods: -- client.LoadBalancers.Pools.Health.New(ctx context.Context, poolID string, params cloudflare.LoadBalancerPoolHealthNewParams) (cloudflare.LoadBalancerPoolHealthNewResponse, error) -- client.LoadBalancers.Pools.Health.Get(ctx context.Context, poolID string, query cloudflare.LoadBalancerPoolHealthGetParams) (cloudflare.LoadBalancerPoolHealthGetResponse, error) +- client.Zones.Settings.AutomaticPlatformOptimization.Edit(ctx context.Context, params cloudflare.ZoneSettingAutomaticPlatformOptimizationEditParams) (cloudflare.ZoneSettingAutomaticPlatformOptimizationEditResponse, error) +- client.Zones.Settings.AutomaticPlatformOptimization.Get(ctx context.Context, query cloudflare.ZoneSettingAutomaticPlatformOptimizationGetParams) (cloudflare.ZoneSettingAutomaticPlatformOptimizationGetResponse, error) -### References +### Brotli Response Types: -- cloudflare.LoadBalancerPoolReferenceListResponse +- cloudflare.ZoneSettingBrotliEditResponse +- cloudflare.ZoneSettingBrotliGetResponse Methods: -- client.LoadBalancers.Pools.References.List(ctx context.Context, poolID string, query cloudflare.LoadBalancerPoolReferenceListParams) ([]cloudflare.LoadBalancerPoolReferenceListResponse, error) +- client.Zones.Settings.Brotli.Edit(ctx context.Context, params cloudflare.ZoneSettingBrotliEditParams) (cloudflare.ZoneSettingBrotliEditResponse, error) +- client.Zones.Settings.Brotli.Get(ctx context.Context, query cloudflare.ZoneSettingBrotliGetParams) (cloudflare.ZoneSettingBrotliGetResponse, error) -## Previews +### BrowserCacheTTL Response Types: -- cloudflare.LoadBalancerPreviewGetResponse +- cloudflare.ZoneSettingBrowserCacheTTLEditResponse +- cloudflare.ZoneSettingBrowserCacheTTLGetResponse Methods: -- client.LoadBalancers.Previews.Get(ctx context.Context, previewID interface{}, query cloudflare.LoadBalancerPreviewGetParams) (cloudflare.LoadBalancerPreviewGetResponse, error) +- client.Zones.Settings.BrowserCacheTTL.Edit(ctx context.Context, params cloudflare.ZoneSettingBrowserCacheTTLEditParams) (cloudflare.ZoneSettingBrowserCacheTTLEditResponse, error) +- client.Zones.Settings.BrowserCacheTTL.Get(ctx context.Context, query cloudflare.ZoneSettingBrowserCacheTTLGetParams) (cloudflare.ZoneSettingBrowserCacheTTLGetResponse, error) -## Regions +### BrowserCheck Response Types: -- cloudflare.LoadBalancerRegionListResponse -- cloudflare.LoadBalancerRegionGetResponse +- cloudflare.ZoneSettingBrowserCheckEditResponse +- cloudflare.ZoneSettingBrowserCheckGetResponse Methods: -- client.LoadBalancers.Regions.List(ctx context.Context, params cloudflare.LoadBalancerRegionListParams) (cloudflare.LoadBalancerRegionListResponse, error) -- client.LoadBalancers.Regions.Get(ctx context.Context, regionID cloudflare.LoadBalancerRegionGetParamsRegionID, query cloudflare.LoadBalancerRegionGetParams) (cloudflare.LoadBalancerRegionGetResponse, error) +- client.Zones.Settings.BrowserCheck.Edit(ctx context.Context, params cloudflare.ZoneSettingBrowserCheckEditParams) (cloudflare.ZoneSettingBrowserCheckEditResponse, error) +- client.Zones.Settings.BrowserCheck.Get(ctx context.Context, query cloudflare.ZoneSettingBrowserCheckGetParams) (cloudflare.ZoneSettingBrowserCheckGetResponse, error) -## Searches +### CacheLevel Response Types: -- cloudflare.LoadBalancerSearchListResponse +- cloudflare.ZoneSettingCacheLevelEditResponse +- cloudflare.ZoneSettingCacheLevelGetResponse Methods: -- client.LoadBalancers.Searches.List(ctx context.Context, params cloudflare.LoadBalancerSearchListParams) ([]cloudflare.LoadBalancerSearchListResponse, error) - -# Access +- client.Zones.Settings.CacheLevel.Edit(ctx context.Context, params cloudflare.ZoneSettingCacheLevelEditParams) (cloudflare.ZoneSettingCacheLevelEditResponse, error) +- client.Zones.Settings.CacheLevel.Get(ctx context.Context, query cloudflare.ZoneSettingCacheLevelGetParams) (cloudflare.ZoneSettingCacheLevelGetResponse, error) -## Applications +### ChallengeTTL Response Types: -- cloudflare.AccessApplicationNewResponse -- cloudflare.AccessApplicationUpdateResponse -- cloudflare.AccessApplicationListResponse -- cloudflare.AccessApplicationDeleteResponse -- cloudflare.AccessApplicationGetResponse -- cloudflare.AccessApplicationRevokeTokensResponse +- cloudflare.ZoneSettingChallengeTTLEditResponse +- cloudflare.ZoneSettingChallengeTTLGetResponse Methods: -- client.Access.Applications.New(ctx context.Context, params cloudflare.AccessApplicationNewParams) (cloudflare.AccessApplicationNewResponse, error) -- client.Access.Applications.Update(ctx context.Context, appID cloudflare.AccessApplicationUpdateParamsAppID, params cloudflare.AccessApplicationUpdateParams) (cloudflare.AccessApplicationUpdateResponse, error) -- client.Access.Applications.List(ctx context.Context, query cloudflare.AccessApplicationListParams) ([]cloudflare.AccessApplicationListResponse, error) -- client.Access.Applications.Delete(ctx context.Context, appID cloudflare.AccessApplicationDeleteParamsAppID, body cloudflare.AccessApplicationDeleteParams) (cloudflare.AccessApplicationDeleteResponse, error) -- client.Access.Applications.Get(ctx context.Context, appID cloudflare.AccessApplicationGetParamsAppID, query cloudflare.AccessApplicationGetParams) (cloudflare.AccessApplicationGetResponse, error) -- client.Access.Applications.RevokeTokens(ctx context.Context, appID cloudflare.AccessApplicationRevokeTokensParamsAppID, body cloudflare.AccessApplicationRevokeTokensParams) (cloudflare.AccessApplicationRevokeTokensResponse, error) +- client.Zones.Settings.ChallengeTTL.Edit(ctx context.Context, params cloudflare.ZoneSettingChallengeTTLEditParams) (cloudflare.ZoneSettingChallengeTTLEditResponse, error) +- client.Zones.Settings.ChallengeTTL.Get(ctx context.Context, query cloudflare.ZoneSettingChallengeTTLGetParams) (cloudflare.ZoneSettingChallengeTTLGetResponse, error) -### CAs +### Ciphers Response Types: -- cloudflare.AccessApplicationCANewResponse -- cloudflare.AccessApplicationCAListResponse -- cloudflare.AccessApplicationCADeleteResponse -- cloudflare.AccessApplicationCAGetResponse +- cloudflare.ZoneSettingCipherEditResponse +- cloudflare.ZoneSettingCipherGetResponse Methods: -- client.Access.Applications.CAs.New(ctx context.Context, uuid string, body cloudflare.AccessApplicationCANewParams) (cloudflare.AccessApplicationCANewResponse, error) -- client.Access.Applications.CAs.List(ctx context.Context, query cloudflare.AccessApplicationCAListParams) ([]cloudflare.AccessApplicationCAListResponse, error) -- client.Access.Applications.CAs.Delete(ctx context.Context, uuid string, body cloudflare.AccessApplicationCADeleteParams) (cloudflare.AccessApplicationCADeleteResponse, error) -- client.Access.Applications.CAs.Get(ctx context.Context, uuid string, query cloudflare.AccessApplicationCAGetParams) (cloudflare.AccessApplicationCAGetResponse, error) +- client.Zones.Settings.Ciphers.Edit(ctx context.Context, params cloudflare.ZoneSettingCipherEditParams) (cloudflare.ZoneSettingCipherEditResponse, error) +- client.Zones.Settings.Ciphers.Get(ctx context.Context, query cloudflare.ZoneSettingCipherGetParams) (cloudflare.ZoneSettingCipherGetResponse, error) -### UserPolicyChecks +### DevelopmentMode Response Types: -- cloudflare.AccessApplicationUserPolicyCheckListResponse +- cloudflare.ZoneSettingDevelopmentModeEditResponse +- cloudflare.ZoneSettingDevelopmentModeGetResponse Methods: -- client.Access.Applications.UserPolicyChecks.List(ctx context.Context, appID cloudflare.AccessApplicationUserPolicyCheckListParamsAppID, query cloudflare.AccessApplicationUserPolicyCheckListParams) (cloudflare.AccessApplicationUserPolicyCheckListResponse, error) +- client.Zones.Settings.DevelopmentMode.Edit(ctx context.Context, params cloudflare.ZoneSettingDevelopmentModeEditParams) (cloudflare.ZoneSettingDevelopmentModeEditResponse, error) +- client.Zones.Settings.DevelopmentMode.Get(ctx context.Context, query cloudflare.ZoneSettingDevelopmentModeGetParams) (cloudflare.ZoneSettingDevelopmentModeGetResponse, error) -### Policies +### EarlyHints Response Types: -- cloudflare.AccessApplicationPolicyNewResponse -- cloudflare.AccessApplicationPolicyUpdateResponse -- cloudflare.AccessApplicationPolicyListResponse -- cloudflare.AccessApplicationPolicyDeleteResponse -- cloudflare.AccessApplicationPolicyGetResponse +- cloudflare.ZoneSettingEarlyHintEditResponse +- cloudflare.ZoneSettingEarlyHintGetResponse Methods: -- client.Access.Applications.Policies.New(ctx context.Context, uuid string, params cloudflare.AccessApplicationPolicyNewParams) (cloudflare.AccessApplicationPolicyNewResponse, error) -- client.Access.Applications.Policies.Update(ctx context.Context, uuid1 string, uuid string, params cloudflare.AccessApplicationPolicyUpdateParams) (cloudflare.AccessApplicationPolicyUpdateResponse, error) -- client.Access.Applications.Policies.List(ctx context.Context, uuid string, query cloudflare.AccessApplicationPolicyListParams) ([]cloudflare.AccessApplicationPolicyListResponse, error) -- client.Access.Applications.Policies.Delete(ctx context.Context, uuid1 string, uuid string, body cloudflare.AccessApplicationPolicyDeleteParams) (cloudflare.AccessApplicationPolicyDeleteResponse, error) -- client.Access.Applications.Policies.Get(ctx context.Context, uuid1 string, uuid string, query cloudflare.AccessApplicationPolicyGetParams) (cloudflare.AccessApplicationPolicyGetResponse, error) +- client.Zones.Settings.EarlyHints.Edit(ctx context.Context, params cloudflare.ZoneSettingEarlyHintEditParams) (cloudflare.ZoneSettingEarlyHintEditResponse, error) +- client.Zones.Settings.EarlyHints.Get(ctx context.Context, query cloudflare.ZoneSettingEarlyHintGetParams) (cloudflare.ZoneSettingEarlyHintGetResponse, error) -## Certificates +### EmailObfuscation Response Types: -- cloudflare.AccessCertificateNewResponse -- cloudflare.AccessCertificateUpdateResponse -- cloudflare.AccessCertificateListResponse -- cloudflare.AccessCertificateDeleteResponse -- cloudflare.AccessCertificateGetResponse +- cloudflare.ZoneSettingEmailObfuscationEditResponse +- cloudflare.ZoneSettingEmailObfuscationGetResponse Methods: -- client.Access.Certificates.New(ctx context.Context, params cloudflare.AccessCertificateNewParams) (cloudflare.AccessCertificateNewResponse, error) -- client.Access.Certificates.Update(ctx context.Context, uuid string, params cloudflare.AccessCertificateUpdateParams) (cloudflare.AccessCertificateUpdateResponse, error) -- client.Access.Certificates.List(ctx context.Context, query cloudflare.AccessCertificateListParams) ([]cloudflare.AccessCertificateListResponse, error) -- client.Access.Certificates.Delete(ctx context.Context, uuid string, body cloudflare.AccessCertificateDeleteParams) (cloudflare.AccessCertificateDeleteResponse, error) -- client.Access.Certificates.Get(ctx context.Context, uuid string, query cloudflare.AccessCertificateGetParams) (cloudflare.AccessCertificateGetResponse, error) +- client.Zones.Settings.EmailObfuscation.Edit(ctx context.Context, params cloudflare.ZoneSettingEmailObfuscationEditParams) (cloudflare.ZoneSettingEmailObfuscationEditResponse, error) +- client.Zones.Settings.EmailObfuscation.Get(ctx context.Context, query cloudflare.ZoneSettingEmailObfuscationGetParams) (cloudflare.ZoneSettingEmailObfuscationGetResponse, error) -### Settings +### H2Prioritization Response Types: -- cloudflare.AccessCertificateSettingUpdateResponse -- cloudflare.AccessCertificateSettingListResponse +- cloudflare.ZoneSettingH2PrioritizationEditResponse +- cloudflare.ZoneSettingH2PrioritizationGetResponse Methods: -- client.Access.Certificates.Settings.Update(ctx context.Context, params cloudflare.AccessCertificateSettingUpdateParams) ([]cloudflare.AccessCertificateSettingUpdateResponse, error) -- client.Access.Certificates.Settings.List(ctx context.Context, query cloudflare.AccessCertificateSettingListParams) ([]cloudflare.AccessCertificateSettingListResponse, error) +- client.Zones.Settings.H2Prioritization.Edit(ctx context.Context, params cloudflare.ZoneSettingH2PrioritizationEditParams) (cloudflare.ZoneSettingH2PrioritizationEditResponse, error) +- client.Zones.Settings.H2Prioritization.Get(ctx context.Context, query cloudflare.ZoneSettingH2PrioritizationGetParams) (cloudflare.ZoneSettingH2PrioritizationGetResponse, error) -## Groups +### HotlinkProtection Response Types: -- cloudflare.AccessGroupNewResponse -- cloudflare.AccessGroupUpdateResponse -- cloudflare.AccessGroupListResponse -- cloudflare.AccessGroupDeleteResponse -- cloudflare.AccessGroupGetResponse +- cloudflare.ZoneSettingHotlinkProtectionEditResponse +- cloudflare.ZoneSettingHotlinkProtectionGetResponse Methods: -- client.Access.Groups.New(ctx context.Context, params cloudflare.AccessGroupNewParams) (cloudflare.AccessGroupNewResponse, error) -- client.Access.Groups.Update(ctx context.Context, uuid string, params cloudflare.AccessGroupUpdateParams) (cloudflare.AccessGroupUpdateResponse, error) -- client.Access.Groups.List(ctx context.Context, query cloudflare.AccessGroupListParams) ([]cloudflare.AccessGroupListResponse, error) -- client.Access.Groups.Delete(ctx context.Context, uuid string, body cloudflare.AccessGroupDeleteParams) (cloudflare.AccessGroupDeleteResponse, error) -- client.Access.Groups.Get(ctx context.Context, uuid string, query cloudflare.AccessGroupGetParams) (cloudflare.AccessGroupGetResponse, error) +- client.Zones.Settings.HotlinkProtection.Edit(ctx context.Context, params cloudflare.ZoneSettingHotlinkProtectionEditParams) (cloudflare.ZoneSettingHotlinkProtectionEditResponse, error) +- client.Zones.Settings.HotlinkProtection.Get(ctx context.Context, query cloudflare.ZoneSettingHotlinkProtectionGetParams) (cloudflare.ZoneSettingHotlinkProtectionGetResponse, error) -## IdentityProviders +### HTTP2 Response Types: -- cloudflare.AccessIdentityProviderNewResponse -- cloudflare.AccessIdentityProviderUpdateResponse -- cloudflare.AccessIdentityProviderListResponse -- cloudflare.AccessIdentityProviderDeleteResponse -- cloudflare.AccessIdentityProviderGetResponse +- cloudflare.ZoneSettingHTTP2EditResponse +- cloudflare.ZoneSettingHTTP2GetResponse Methods: -- client.Access.IdentityProviders.New(ctx context.Context, params cloudflare.AccessIdentityProviderNewParams) (cloudflare.AccessIdentityProviderNewResponse, error) -- client.Access.IdentityProviders.Update(ctx context.Context, uuid string, params cloudflare.AccessIdentityProviderUpdateParams) (cloudflare.AccessIdentityProviderUpdateResponse, error) -- client.Access.IdentityProviders.List(ctx context.Context, query cloudflare.AccessIdentityProviderListParams) ([]cloudflare.AccessIdentityProviderListResponse, error) -- client.Access.IdentityProviders.Delete(ctx context.Context, uuid string, body cloudflare.AccessIdentityProviderDeleteParams) (cloudflare.AccessIdentityProviderDeleteResponse, error) -- client.Access.IdentityProviders.Get(ctx context.Context, uuid string, query cloudflare.AccessIdentityProviderGetParams) (cloudflare.AccessIdentityProviderGetResponse, error) +- client.Zones.Settings.HTTP2.Edit(ctx context.Context, params cloudflare.ZoneSettingHTTP2EditParams) (cloudflare.ZoneSettingHTTP2EditResponse, error) +- client.Zones.Settings.HTTP2.Get(ctx context.Context, query cloudflare.ZoneSettingHTTP2GetParams) (cloudflare.ZoneSettingHTTP2GetResponse, error) -## Organizations +### HTTP3 Response Types: -- cloudflare.AccessOrganizationNewResponse -- cloudflare.AccessOrganizationUpdateResponse -- cloudflare.AccessOrganizationListResponse -- cloudflare.AccessOrganizationRevokeUsersResponse +- cloudflare.ZoneSettingHTTP3EditResponse +- cloudflare.ZoneSettingHTTP3GetResponse Methods: -- client.Access.Organizations.New(ctx context.Context, params cloudflare.AccessOrganizationNewParams) (cloudflare.AccessOrganizationNewResponse, error) -- client.Access.Organizations.Update(ctx context.Context, params cloudflare.AccessOrganizationUpdateParams) (cloudflare.AccessOrganizationUpdateResponse, error) -- client.Access.Organizations.List(ctx context.Context, query cloudflare.AccessOrganizationListParams) (cloudflare.AccessOrganizationListResponse, error) -- client.Access.Organizations.RevokeUsers(ctx context.Context, params cloudflare.AccessOrganizationRevokeUsersParams) (cloudflare.AccessOrganizationRevokeUsersResponse, error) +- client.Zones.Settings.HTTP3.Edit(ctx context.Context, params cloudflare.ZoneSettingHTTP3EditParams) (cloudflare.ZoneSettingHTTP3EditResponse, error) +- client.Zones.Settings.HTTP3.Get(ctx context.Context, query cloudflare.ZoneSettingHTTP3GetParams) (cloudflare.ZoneSettingHTTP3GetResponse, error) -## ServiceTokens +### ImageResizing Response Types: -- cloudflare.AccessServiceTokenNewResponse -- cloudflare.AccessServiceTokenUpdateResponse -- cloudflare.AccessServiceTokenListResponse -- cloudflare.AccessServiceTokenDeleteResponse -- cloudflare.AccessServiceTokenRefreshResponse -- cloudflare.AccessServiceTokenRotateResponse +- cloudflare.ZoneSettingImageResizingEditResponse +- cloudflare.ZoneSettingImageResizingGetResponse Methods: -- client.Access.ServiceTokens.New(ctx context.Context, params cloudflare.AccessServiceTokenNewParams) (cloudflare.AccessServiceTokenNewResponse, error) -- client.Access.ServiceTokens.Update(ctx context.Context, uuid string, params cloudflare.AccessServiceTokenUpdateParams) (cloudflare.AccessServiceTokenUpdateResponse, error) -- client.Access.ServiceTokens.List(ctx context.Context, query cloudflare.AccessServiceTokenListParams) ([]cloudflare.AccessServiceTokenListResponse, error) -- client.Access.ServiceTokens.Delete(ctx context.Context, uuid string, body cloudflare.AccessServiceTokenDeleteParams) (cloudflare.AccessServiceTokenDeleteResponse, error) -- client.Access.ServiceTokens.Refresh(ctx context.Context, identifier string, uuid string) (cloudflare.AccessServiceTokenRefreshResponse, error) -- client.Access.ServiceTokens.Rotate(ctx context.Context, identifier string, uuid string) (cloudflare.AccessServiceTokenRotateResponse, error) +- client.Zones.Settings.ImageResizing.Edit(ctx context.Context, params cloudflare.ZoneSettingImageResizingEditParams) (cloudflare.ZoneSettingImageResizingEditResponse, error) +- client.Zones.Settings.ImageResizing.Get(ctx context.Context, query cloudflare.ZoneSettingImageResizingGetParams) (cloudflare.ZoneSettingImageResizingGetResponse, error) -## Bookmarks +### IPGeolocation Response Types: -- cloudflare.AccessBookmarkNewResponse -- cloudflare.AccessBookmarkUpdateResponse -- cloudflare.AccessBookmarkListResponse -- cloudflare.AccessBookmarkDeleteResponse -- cloudflare.AccessBookmarkGetResponse +- cloudflare.ZoneSettingIPGeolocationEditResponse +- cloudflare.ZoneSettingIPGeolocationGetResponse Methods: -- client.Access.Bookmarks.New(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccessBookmarkNewResponse, error) -- client.Access.Bookmarks.Update(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccessBookmarkUpdateResponse, error) -- client.Access.Bookmarks.List(ctx context.Context, identifier interface{}) ([]cloudflare.AccessBookmarkListResponse, error) -- client.Access.Bookmarks.Delete(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccessBookmarkDeleteResponse, error) -- client.Access.Bookmarks.Get(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccessBookmarkGetResponse, error) +- client.Zones.Settings.IPGeolocation.Edit(ctx context.Context, params cloudflare.ZoneSettingIPGeolocationEditParams) (cloudflare.ZoneSettingIPGeolocationEditResponse, error) +- client.Zones.Settings.IPGeolocation.Get(ctx context.Context, query cloudflare.ZoneSettingIPGeolocationGetParams) (cloudflare.ZoneSettingIPGeolocationGetResponse, error) -## Keys +### IPV6 Response Types: -- cloudflare.AccessKeyUpdateResponse -- cloudflare.AccessKeyListResponse -- cloudflare.AccessKeyRotateResponse +- cloudflare.ZoneSettingIPV6EditResponse +- cloudflare.ZoneSettingIPV6GetResponse Methods: -- client.Access.Keys.Update(ctx context.Context, identifier string, body cloudflare.AccessKeyUpdateParams) (cloudflare.AccessKeyUpdateResponse, error) -- client.Access.Keys.List(ctx context.Context, identifier string) (cloudflare.AccessKeyListResponse, error) -- client.Access.Keys.Rotate(ctx context.Context, identifier string) (cloudflare.AccessKeyRotateResponse, error) - -## Logs +- client.Zones.Settings.IPV6.Edit(ctx context.Context, params cloudflare.ZoneSettingIPV6EditParams) (cloudflare.ZoneSettingIPV6EditResponse, error) +- client.Zones.Settings.IPV6.Get(ctx context.Context, query cloudflare.ZoneSettingIPV6GetParams) (cloudflare.ZoneSettingIPV6GetResponse, error) -### AccessRequests +### MinTLSVersion Response Types: -- cloudflare.AccessLogAccessRequestListResponse +- cloudflare.ZoneSettingMinTLSVersionEditResponse +- cloudflare.ZoneSettingMinTLSVersionGetResponse Methods: -- client.Access.Logs.AccessRequests.List(ctx context.Context, identifier string) ([]cloudflare.AccessLogAccessRequestListResponse, error) +- client.Zones.Settings.MinTLSVersion.Edit(ctx context.Context, params cloudflare.ZoneSettingMinTLSVersionEditParams) (cloudflare.ZoneSettingMinTLSVersionEditResponse, error) +- client.Zones.Settings.MinTLSVersion.Get(ctx context.Context, query cloudflare.ZoneSettingMinTLSVersionGetParams) (cloudflare.ZoneSettingMinTLSVersionGetResponse, error) -## Seats +### Minify Response Types: -- cloudflare.AccessSeatEditResponse +- cloudflare.ZoneSettingMinifyEditResponse +- cloudflare.ZoneSettingMinifyGetResponse Methods: -- client.Access.Seats.Edit(ctx context.Context, identifier string, body cloudflare.AccessSeatEditParams) ([]cloudflare.AccessSeatEditResponse, error) +- client.Zones.Settings.Minify.Edit(ctx context.Context, params cloudflare.ZoneSettingMinifyEditParams) (cloudflare.ZoneSettingMinifyEditResponse, error) +- client.Zones.Settings.Minify.Get(ctx context.Context, query cloudflare.ZoneSettingMinifyGetParams) (cloudflare.ZoneSettingMinifyGetResponse, error) -## Users +### Mirage Response Types: -- cloudflare.AccessUserListResponse +- cloudflare.ZoneSettingMirageEditResponse +- cloudflare.ZoneSettingMirageGetResponse Methods: -- client.Access.Users.List(ctx context.Context, identifier string) ([]cloudflare.AccessUserListResponse, error) +- client.Zones.Settings.Mirage.Edit(ctx context.Context, params cloudflare.ZoneSettingMirageEditParams) (cloudflare.ZoneSettingMirageEditResponse, error) +- client.Zones.Settings.Mirage.Get(ctx context.Context, query cloudflare.ZoneSettingMirageGetParams) (cloudflare.ZoneSettingMirageGetResponse, error) -### ActiveSessions +### MobileRedirect Response Types: -- cloudflare.AccessUserActiveSessionListResponse -- cloudflare.AccessUserActiveSessionGetResponse +- cloudflare.ZoneSettingMobileRedirectEditResponse +- cloudflare.ZoneSettingMobileRedirectGetResponse Methods: -- client.Access.Users.ActiveSessions.List(ctx context.Context, identifier string, id string) ([]cloudflare.AccessUserActiveSessionListResponse, error) -- client.Access.Users.ActiveSessions.Get(ctx context.Context, identifier string, id string, nonce string) (cloudflare.AccessUserActiveSessionGetResponse, error) +- client.Zones.Settings.MobileRedirect.Edit(ctx context.Context, params cloudflare.ZoneSettingMobileRedirectEditParams) (cloudflare.ZoneSettingMobileRedirectEditResponse, error) +- client.Zones.Settings.MobileRedirect.Get(ctx context.Context, query cloudflare.ZoneSettingMobileRedirectGetParams) (cloudflare.ZoneSettingMobileRedirectGetResponse, error) -### LastSeenIdentity +### NEL Response Types: -- cloudflare.AccessUserLastSeenIdentityListResponse +- cloudflare.ZoneSettingNELEditResponse +- cloudflare.ZoneSettingNELGetResponse Methods: -- client.Access.Users.LastSeenIdentity.List(ctx context.Context, identifier string, id string) (cloudflare.AccessUserLastSeenIdentityListResponse, error) +- client.Zones.Settings.NEL.Edit(ctx context.Context, params cloudflare.ZoneSettingNELEditParams) (cloudflare.ZoneSettingNELEditResponse, error) +- client.Zones.Settings.NEL.Get(ctx context.Context, query cloudflare.ZoneSettingNELGetParams) (cloudflare.ZoneSettingNELGetResponse, error) -### FailedLogins +### OpportunisticEncryption Response Types: -- cloudflare.AccessUserFailedLoginListResponse +- cloudflare.ZoneSettingOpportunisticEncryptionEditResponse +- cloudflare.ZoneSettingOpportunisticEncryptionGetResponse Methods: -- client.Access.Users.FailedLogins.List(ctx context.Context, identifier string, id string) ([]cloudflare.AccessUserFailedLoginListResponse, error) +- client.Zones.Settings.OpportunisticEncryption.Edit(ctx context.Context, params cloudflare.ZoneSettingOpportunisticEncryptionEditParams) (cloudflare.ZoneSettingOpportunisticEncryptionEditResponse, error) +- client.Zones.Settings.OpportunisticEncryption.Get(ctx context.Context, query cloudflare.ZoneSettingOpportunisticEncryptionGetParams) (cloudflare.ZoneSettingOpportunisticEncryptionGetResponse, error) -## CustomPages +### OpportunisticOnion Response Types: -- cloudflare.AccessCustomPageNewResponse -- cloudflare.AccessCustomPageUpdateResponse -- cloudflare.AccessCustomPageListResponse -- cloudflare.AccessCustomPageDeleteResponse -- cloudflare.AccessCustomPageGetResponse +- cloudflare.ZoneSettingOpportunisticOnionEditResponse +- cloudflare.ZoneSettingOpportunisticOnionGetResponse Methods: -- client.Access.CustomPages.New(ctx context.Context, identifier string, body cloudflare.AccessCustomPageNewParams) (cloudflare.AccessCustomPageNewResponse, error) -- client.Access.CustomPages.Update(ctx context.Context, identifier string, uuid string, body cloudflare.AccessCustomPageUpdateParams) (cloudflare.AccessCustomPageUpdateResponse, error) -- client.Access.CustomPages.List(ctx context.Context, identifier string) ([]cloudflare.AccessCustomPageListResponse, error) -- client.Access.CustomPages.Delete(ctx context.Context, identifier string, uuid string) (cloudflare.AccessCustomPageDeleteResponse, error) -- client.Access.CustomPages.Get(ctx context.Context, identifier string, uuid string) (cloudflare.AccessCustomPageGetResponse, error) +- client.Zones.Settings.OpportunisticOnion.Edit(ctx context.Context, params cloudflare.ZoneSettingOpportunisticOnionEditParams) (cloudflare.ZoneSettingOpportunisticOnionEditResponse, error) +- client.Zones.Settings.OpportunisticOnion.Get(ctx context.Context, query cloudflare.ZoneSettingOpportunisticOnionGetParams) (cloudflare.ZoneSettingOpportunisticOnionGetResponse, error) -## Tags +### OrangeToOrange Response Types: -- cloudflare.AccessTagNewResponse -- cloudflare.AccessTagUpdateResponse -- cloudflare.AccessTagListResponse -- cloudflare.AccessTagDeleteResponse -- cloudflare.AccessTagGetResponse +- cloudflare.ZoneSettingOrangeToOrangeEditResponse +- cloudflare.ZoneSettingOrangeToOrangeGetResponse Methods: -- client.Access.Tags.New(ctx context.Context, identifier string, body cloudflare.AccessTagNewParams) (cloudflare.AccessTagNewResponse, error) -- client.Access.Tags.Update(ctx context.Context, identifier string, tagName string, body cloudflare.AccessTagUpdateParams) (cloudflare.AccessTagUpdateResponse, error) -- client.Access.Tags.List(ctx context.Context, identifier string) ([]cloudflare.AccessTagListResponse, error) -- client.Access.Tags.Delete(ctx context.Context, identifier string, name string) (cloudflare.AccessTagDeleteResponse, error) -- client.Access.Tags.Get(ctx context.Context, identifier string, name string) (cloudflare.AccessTagGetResponse, error) - -# DNSAnalytics +- client.Zones.Settings.OrangeToOrange.Edit(ctx context.Context, params cloudflare.ZoneSettingOrangeToOrangeEditParams) (cloudflare.ZoneSettingOrangeToOrangeEditResponse, error) +- client.Zones.Settings.OrangeToOrange.Get(ctx context.Context, query cloudflare.ZoneSettingOrangeToOrangeGetParams) (cloudflare.ZoneSettingOrangeToOrangeGetResponse, error) -## Reports +### OriginErrorPagePassThru Response Types: -- cloudflare.DNSAnalyticReportListResponse +- cloudflare.ZoneSettingOriginErrorPagePassThruEditResponse +- cloudflare.ZoneSettingOriginErrorPagePassThruGetResponse Methods: -- client.DNSAnalytics.Reports.List(ctx context.Context, identifier string, query cloudflare.DNSAnalyticReportListParams) (cloudflare.DNSAnalyticReportListResponse, error) +- client.Zones.Settings.OriginErrorPagePassThru.Edit(ctx context.Context, params cloudflare.ZoneSettingOriginErrorPagePassThruEditParams) (cloudflare.ZoneSettingOriginErrorPagePassThruEditResponse, error) +- client.Zones.Settings.OriginErrorPagePassThru.Get(ctx context.Context, query cloudflare.ZoneSettingOriginErrorPagePassThruGetParams) (cloudflare.ZoneSettingOriginErrorPagePassThruGetResponse, error) -### Bytimes +### OriginMaxHTTPVersion Response Types: -- cloudflare.DNSAnalyticReportBytimeListResponse +- cloudflare.ZoneSettingOriginMaxHTTPVersionEditResponse +- cloudflare.ZoneSettingOriginMaxHTTPVersionGetResponse Methods: -- client.DNSAnalytics.Reports.Bytimes.List(ctx context.Context, identifier string, query cloudflare.DNSAnalyticReportBytimeListParams) (cloudflare.DNSAnalyticReportBytimeListResponse, error) +- client.Zones.Settings.OriginMaxHTTPVersion.Edit(ctx context.Context, params cloudflare.ZoneSettingOriginMaxHTTPVersionEditParams) (cloudflare.ZoneSettingOriginMaxHTTPVersionEditResponse, error) +- client.Zones.Settings.OriginMaxHTTPVersion.Get(ctx context.Context, query cloudflare.ZoneSettingOriginMaxHTTPVersionGetParams) (cloudflare.ZoneSettingOriginMaxHTTPVersionGetResponse, error) -# Cache +### Polish Response Types: -- cloudflare.CachePurgeResponse +- cloudflare.ZoneSettingPolishEditResponse +- cloudflare.ZoneSettingPolishGetResponse Methods: -- client.Cache.Purge(ctx context.Context, params cloudflare.CachePurgeParams) (cloudflare.CachePurgeResponse, error) +- client.Zones.Settings.Polish.Edit(ctx context.Context, params cloudflare.ZoneSettingPolishEditParams) (cloudflare.ZoneSettingPolishEditResponse, error) +- client.Zones.Settings.Polish.Get(ctx context.Context, query cloudflare.ZoneSettingPolishGetParams) (cloudflare.ZoneSettingPolishGetResponse, error) -## CacheReserve +### PrefetchPreload Response Types: -- cloudflare.CacheCacheReserveListResponse -- cloudflare.CacheCacheReserveClearResponse -- cloudflare.CacheCacheReserveEditResponse -- cloudflare.CacheCacheReserveStatusResponse +- cloudflare.ZoneSettingPrefetchPreloadEditResponse +- cloudflare.ZoneSettingPrefetchPreloadGetResponse Methods: -- client.Cache.CacheReserve.List(ctx context.Context, query cloudflare.CacheCacheReserveListParams) (cloudflare.CacheCacheReserveListResponse, error) -- client.Cache.CacheReserve.Clear(ctx context.Context, body cloudflare.CacheCacheReserveClearParams) (cloudflare.CacheCacheReserveClearResponse, error) -- client.Cache.CacheReserve.Edit(ctx context.Context, params cloudflare.CacheCacheReserveEditParams) (cloudflare.CacheCacheReserveEditResponse, error) -- client.Cache.CacheReserve.Status(ctx context.Context, query cloudflare.CacheCacheReserveStatusParams) (cloudflare.CacheCacheReserveStatusResponse, error) +- client.Zones.Settings.PrefetchPreload.Edit(ctx context.Context, params cloudflare.ZoneSettingPrefetchPreloadEditParams) (cloudflare.ZoneSettingPrefetchPreloadEditResponse, error) +- client.Zones.Settings.PrefetchPreload.Get(ctx context.Context, query cloudflare.ZoneSettingPrefetchPreloadGetParams) (cloudflare.ZoneSettingPrefetchPreloadGetResponse, error) -## TieredCacheSmartTopology +### ProxyReadTimeout Response Types: -- cloudflare.CacheTieredCacheSmartTopologyDeleteResponse -- cloudflare.CacheTieredCacheSmartTopologyEditResponse -- cloudflare.CacheTieredCacheSmartTopologyGetResponse +- cloudflare.ZoneSettingProxyReadTimeoutEditResponse +- cloudflare.ZoneSettingProxyReadTimeoutGetResponse Methods: -- client.Cache.TieredCacheSmartTopology.Delete(ctx context.Context, body cloudflare.CacheTieredCacheSmartTopologyDeleteParams) (cloudflare.CacheTieredCacheSmartTopologyDeleteResponse, error) -- client.Cache.TieredCacheSmartTopology.Edit(ctx context.Context, params cloudflare.CacheTieredCacheSmartTopologyEditParams) (cloudflare.CacheTieredCacheSmartTopologyEditResponse, error) -- client.Cache.TieredCacheSmartTopology.Get(ctx context.Context, query cloudflare.CacheTieredCacheSmartTopologyGetParams) (cloudflare.CacheTieredCacheSmartTopologyGetResponse, error) +- client.Zones.Settings.ProxyReadTimeout.Edit(ctx context.Context, params cloudflare.ZoneSettingProxyReadTimeoutEditParams) (cloudflare.ZoneSettingProxyReadTimeoutEditResponse, error) +- client.Zones.Settings.ProxyReadTimeout.Get(ctx context.Context, query cloudflare.ZoneSettingProxyReadTimeoutGetParams) (cloudflare.ZoneSettingProxyReadTimeoutGetResponse, error) -## Variants +### PseudoIPV4 Response Types: -- cloudflare.CacheVariantListResponse -- cloudflare.CacheVariantDeleteResponse -- cloudflare.CacheVariantEditResponse +- cloudflare.ZoneSettingPseudoIPV4EditResponse +- cloudflare.ZoneSettingPseudoIPV4GetResponse Methods: -- client.Cache.Variants.List(ctx context.Context, query cloudflare.CacheVariantListParams) (cloudflare.CacheVariantListResponse, error) -- client.Cache.Variants.Delete(ctx context.Context, body cloudflare.CacheVariantDeleteParams) (cloudflare.CacheVariantDeleteResponse, error) -- client.Cache.Variants.Edit(ctx context.Context, params cloudflare.CacheVariantEditParams) (cloudflare.CacheVariantEditResponse, error) +- client.Zones.Settings.PseudoIPV4.Edit(ctx context.Context, params cloudflare.ZoneSettingPseudoIPV4EditParams) (cloudflare.ZoneSettingPseudoIPV4EditResponse, error) +- client.Zones.Settings.PseudoIPV4.Get(ctx context.Context, query cloudflare.ZoneSettingPseudoIPV4GetParams) (cloudflare.ZoneSettingPseudoIPV4GetResponse, error) -## RegionalTieredCache +### ResponseBuffering Response Types: -- cloudflare.CacheRegionalTieredCacheEditResponse -- cloudflare.CacheRegionalTieredCacheGetResponse +- cloudflare.ZoneSettingResponseBufferingEditResponse +- cloudflare.ZoneSettingResponseBufferingGetResponse Methods: -- client.Cache.RegionalTieredCache.Edit(ctx context.Context, params cloudflare.CacheRegionalTieredCacheEditParams) (cloudflare.CacheRegionalTieredCacheEditResponse, error) -- client.Cache.RegionalTieredCache.Get(ctx context.Context, query cloudflare.CacheRegionalTieredCacheGetParams) (cloudflare.CacheRegionalTieredCacheGetResponse, error) - -# SSL +- client.Zones.Settings.ResponseBuffering.Edit(ctx context.Context, params cloudflare.ZoneSettingResponseBufferingEditParams) (cloudflare.ZoneSettingResponseBufferingEditResponse, error) +- client.Zones.Settings.ResponseBuffering.Get(ctx context.Context, query cloudflare.ZoneSettingResponseBufferingGetParams) (cloudflare.ZoneSettingResponseBufferingGetResponse, error) -## Analyze +### RocketLoader Response Types: -- cloudflare.SSLAnalyzeNewResponse +- cloudflare.ZoneSettingRocketLoaderEditResponse +- cloudflare.ZoneSettingRocketLoaderGetResponse Methods: -- client.SSL.Analyze.New(ctx context.Context, params cloudflare.SSLAnalyzeNewParams) (cloudflare.SSLAnalyzeNewResponse, error) +- client.Zones.Settings.RocketLoader.Edit(ctx context.Context, params cloudflare.ZoneSettingRocketLoaderEditParams) (cloudflare.ZoneSettingRocketLoaderEditResponse, error) +- client.Zones.Settings.RocketLoader.Get(ctx context.Context, query cloudflare.ZoneSettingRocketLoaderGetParams) (cloudflare.ZoneSettingRocketLoaderGetResponse, error) -## CertificatePacks +### SecurityHeaders Response Types: -- cloudflare.SSLCertificatePackListResponse -- cloudflare.SSLCertificatePackDeleteResponse -- cloudflare.SSLCertificatePackEditResponse -- cloudflare.SSLCertificatePackGetResponse +- cloudflare.ZoneSettingSecurityHeaderEditResponse +- cloudflare.ZoneSettingSecurityHeaderGetResponse Methods: -- client.SSL.CertificatePacks.List(ctx context.Context, params cloudflare.SSLCertificatePackListParams) ([]cloudflare.SSLCertificatePackListResponse, error) -- client.SSL.CertificatePacks.Delete(ctx context.Context, certificatePackID string, body cloudflare.SSLCertificatePackDeleteParams) (cloudflare.SSLCertificatePackDeleteResponse, error) -- client.SSL.CertificatePacks.Edit(ctx context.Context, certificatePackID string, body cloudflare.SSLCertificatePackEditParams) (cloudflare.SSLCertificatePackEditResponse, error) -- client.SSL.CertificatePacks.Get(ctx context.Context, certificatePackID string, query cloudflare.SSLCertificatePackGetParams) (cloudflare.SSLCertificatePackGetResponse, error) +- client.Zones.Settings.SecurityHeaders.Edit(ctx context.Context, params cloudflare.ZoneSettingSecurityHeaderEditParams) (cloudflare.ZoneSettingSecurityHeaderEditResponse, error) +- client.Zones.Settings.SecurityHeaders.Get(ctx context.Context, query cloudflare.ZoneSettingSecurityHeaderGetParams) (cloudflare.ZoneSettingSecurityHeaderGetResponse, error) -### Order +### SecurityLevel Response Types: -- cloudflare.SSLCertificatePackOrderNewResponse +- cloudflare.ZoneSettingSecurityLevelEditResponse +- cloudflare.ZoneSettingSecurityLevelGetResponse Methods: -- client.SSL.CertificatePacks.Order.New(ctx context.Context, params cloudflare.SSLCertificatePackOrderNewParams) (cloudflare.SSLCertificatePackOrderNewResponse, error) +- client.Zones.Settings.SecurityLevel.Edit(ctx context.Context, params cloudflare.ZoneSettingSecurityLevelEditParams) (cloudflare.ZoneSettingSecurityLevelEditResponse, error) +- client.Zones.Settings.SecurityLevel.Get(ctx context.Context, query cloudflare.ZoneSettingSecurityLevelGetParams) (cloudflare.ZoneSettingSecurityLevelGetResponse, error) -### Quota +### ServerSideExcludes Response Types: -- cloudflare.SSLCertificatePackQuotaListResponse +- cloudflare.ZoneSettingServerSideExcludeEditResponse +- cloudflare.ZoneSettingServerSideExcludeGetResponse Methods: -- client.SSL.CertificatePacks.Quota.List(ctx context.Context, query cloudflare.SSLCertificatePackQuotaListParams) (cloudflare.SSLCertificatePackQuotaListResponse, error) +- client.Zones.Settings.ServerSideExcludes.Edit(ctx context.Context, params cloudflare.ZoneSettingServerSideExcludeEditParams) (cloudflare.ZoneSettingServerSideExcludeEditResponse, error) +- client.Zones.Settings.ServerSideExcludes.Get(ctx context.Context, query cloudflare.ZoneSettingServerSideExcludeGetParams) (cloudflare.ZoneSettingServerSideExcludeGetResponse, error) -## Recommendations +### SortQueryStringForCache Response Types: -- cloudflare.SSLRecommendationListResponse +- cloudflare.ZoneSettingSortQueryStringForCacheEditResponse +- cloudflare.ZoneSettingSortQueryStringForCacheGetResponse Methods: -- client.SSL.Recommendations.List(ctx context.Context, zoneIdentifier string) (cloudflare.SSLRecommendationListResponse, error) - -## Universal +- client.Zones.Settings.SortQueryStringForCache.Edit(ctx context.Context, params cloudflare.ZoneSettingSortQueryStringForCacheEditParams) (cloudflare.ZoneSettingSortQueryStringForCacheEditResponse, error) +- client.Zones.Settings.SortQueryStringForCache.Get(ctx context.Context, query cloudflare.ZoneSettingSortQueryStringForCacheGetParams) (cloudflare.ZoneSettingSortQueryStringForCacheGetResponse, error) -### Settings +### SSL Response Types: -- cloudflare.SSLUniversalSettingEditResponse -- cloudflare.SSLUniversalSettingGetResponse +- cloudflare.ZoneSettingSSLEditResponse +- cloudflare.ZoneSettingSSLGetResponse Methods: -- client.SSL.Universal.Settings.Edit(ctx context.Context, params cloudflare.SSLUniversalSettingEditParams) (cloudflare.SSLUniversalSettingEditResponse, error) -- client.SSL.Universal.Settings.Get(ctx context.Context, query cloudflare.SSLUniversalSettingGetParams) (cloudflare.SSLUniversalSettingGetResponse, error) +- client.Zones.Settings.SSL.Edit(ctx context.Context, params cloudflare.ZoneSettingSSLEditParams) (cloudflare.ZoneSettingSSLEditResponse, error) +- client.Zones.Settings.SSL.Get(ctx context.Context, query cloudflare.ZoneSettingSSLGetParams) (cloudflare.ZoneSettingSSLGetResponse, error) -## Verification +### SSLRecommender Response Types: -- cloudflare.SSLVerificationListResponse -- cloudflare.SSLVerificationEditResponse +- cloudflare.ZoneSettingSSLRecommenderEditResponse +- cloudflare.ZoneSettingSSLRecommenderGetResponse Methods: -- client.SSL.Verification.List(ctx context.Context, params cloudflare.SSLVerificationListParams) ([]cloudflare.SSLVerificationListResponse, error) -- client.SSL.Verification.Edit(ctx context.Context, certificatePackID string, params cloudflare.SSLVerificationEditParams) (cloudflare.SSLVerificationEditResponse, error) +- client.Zones.Settings.SSLRecommender.Edit(ctx context.Context, params cloudflare.ZoneSettingSSLRecommenderEditParams) (cloudflare.ZoneSettingSSLRecommenderEditResponse, error) +- client.Zones.Settings.SSLRecommender.Get(ctx context.Context, query cloudflare.ZoneSettingSSLRecommenderGetParams) (cloudflare.ZoneSettingSSLRecommenderGetResponse, error) -# Subscriptions +### TLS1_3 Response Types: -- cloudflare.SubscriptionNewResponse -- cloudflare.SubscriptionUpdateResponse -- cloudflare.SubscriptionListResponse -- cloudflare.SubscriptionDeleteResponse -- cloudflare.SubscriptionGetResponse +- cloudflare.ZoneSettingTls1_3EditResponse +- cloudflare.ZoneSettingTls1_3GetResponse Methods: -- client.Subscriptions.New(ctx context.Context, identifier string, body cloudflare.SubscriptionNewParams) (cloudflare.SubscriptionNewResponse, error) -- client.Subscriptions.Update(ctx context.Context, accountIdentifier string, subscriptionIdentifier string, body cloudflare.SubscriptionUpdateParams) (cloudflare.SubscriptionUpdateResponse, error) -- client.Subscriptions.List(ctx context.Context, accountIdentifier string) ([]cloudflare.SubscriptionListResponse, error) -- client.Subscriptions.Delete(ctx context.Context, accountIdentifier string, subscriptionIdentifier string) (cloudflare.SubscriptionDeleteResponse, error) -- client.Subscriptions.Get(ctx context.Context, identifier string) (cloudflare.SubscriptionGetResponse, error) - -# ACM +- client.Zones.Settings.TLS1_3.Edit(ctx context.Context, params cloudflare.ZoneSettingTLS1_3EditParams) (cloudflare.ZoneSettingTls1_3EditResponse, error) +- client.Zones.Settings.TLS1_3.Get(ctx context.Context, query cloudflare.ZoneSettingTLS1_3GetParams) (cloudflare.ZoneSettingTls1_3GetResponse, error) -## TotalTLS +### TLSClientAuth Response Types: -- cloudflare.ACMTotalTLSNewResponse -- cloudflare.ACMTotalTLSGetResponse +- cloudflare.ZoneSettingTLSClientAuthEditResponse +- cloudflare.ZoneSettingTLSClientAuthGetResponse Methods: -- client.ACM.TotalTLS.New(ctx context.Context, params cloudflare.ACMTotalTLSNewParams) (cloudflare.ACMTotalTLSNewResponse, error) -- client.ACM.TotalTLS.Get(ctx context.Context, query cloudflare.ACMTotalTLSGetParams) (cloudflare.ACMTotalTLSGetResponse, error) - -# Argo +- client.Zones.Settings.TLSClientAuth.Edit(ctx context.Context, params cloudflare.ZoneSettingTLSClientAuthEditParams) (cloudflare.ZoneSettingTLSClientAuthEditResponse, error) +- client.Zones.Settings.TLSClientAuth.Get(ctx context.Context, query cloudflare.ZoneSettingTLSClientAuthGetParams) (cloudflare.ZoneSettingTLSClientAuthGetResponse, error) -## SmartRouting +### TrueClientIPHeader Response Types: -- cloudflare.ArgoSmartRoutingEditResponse -- cloudflare.ArgoSmartRoutingGetResponse +- cloudflare.ZoneSettingTrueClientIPHeaderEditResponse +- cloudflare.ZoneSettingTrueClientIPHeaderGetResponse Methods: -- client.Argo.SmartRouting.Edit(ctx context.Context, params cloudflare.ArgoSmartRoutingEditParams) (cloudflare.ArgoSmartRoutingEditResponse, error) -- client.Argo.SmartRouting.Get(ctx context.Context, query cloudflare.ArgoSmartRoutingGetParams) (cloudflare.ArgoSmartRoutingGetResponse, error) +- client.Zones.Settings.TrueClientIPHeader.Edit(ctx context.Context, params cloudflare.ZoneSettingTrueClientIPHeaderEditParams) (cloudflare.ZoneSettingTrueClientIPHeaderEditResponse, error) +- client.Zones.Settings.TrueClientIPHeader.Get(ctx context.Context, query cloudflare.ZoneSettingTrueClientIPHeaderGetParams) (cloudflare.ZoneSettingTrueClientIPHeaderGetResponse, error) -## TieredCaching +### WAF Response Types: -- cloudflare.ArgoTieredCachingEditResponse -- cloudflare.ArgoTieredCachingGetResponse +- cloudflare.ZoneSettingWAFEditResponse +- cloudflare.ZoneSettingWAFGetResponse Methods: -- client.Argo.TieredCaching.Edit(ctx context.Context, params cloudflare.ArgoTieredCachingEditParams) (cloudflare.ArgoTieredCachingEditResponse, error) -- client.Argo.TieredCaching.Get(ctx context.Context, query cloudflare.ArgoTieredCachingGetParams) (cloudflare.ArgoTieredCachingGetResponse, error) +- client.Zones.Settings.WAF.Edit(ctx context.Context, params cloudflare.ZoneSettingWAFEditParams) (cloudflare.ZoneSettingWAFEditResponse, error) +- client.Zones.Settings.WAF.Get(ctx context.Context, query cloudflare.ZoneSettingWAFGetParams) (cloudflare.ZoneSettingWAFGetResponse, error) -# AvailablePlans +### Webp Response Types: -- cloudflare.AvailablePlanListResponse -- cloudflare.AvailablePlanGetResponse +- cloudflare.ZoneSettingWebpEditResponse +- cloudflare.ZoneSettingWebpGetResponse Methods: -- client.AvailablePlans.List(ctx context.Context, zoneIdentifier string) ([]cloudflare.AvailablePlanListResponse, error) -- client.AvailablePlans.Get(ctx context.Context, zoneIdentifier string, planIdentifier string) (cloudflare.AvailablePlanGetResponse, error) +- client.Zones.Settings.Webp.Edit(ctx context.Context, params cloudflare.ZoneSettingWebpEditParams) (cloudflare.ZoneSettingWebpEditResponse, error) +- client.Zones.Settings.Webp.Get(ctx context.Context, query cloudflare.ZoneSettingWebpGetParams) (cloudflare.ZoneSettingWebpGetResponse, error) -# AvailableRatePlans +### Websocket Response Types: -- cloudflare.AvailableRatePlanListResponse +- cloudflare.ZoneSettingWebsocketEditResponse +- cloudflare.ZoneSettingWebsocketGetResponse Methods: -- client.AvailableRatePlans.List(ctx context.Context, zoneIdentifier string) ([]cloudflare.AvailableRatePlanListResponse, error) - -# CertificateAuthorities +- client.Zones.Settings.Websocket.Edit(ctx context.Context, params cloudflare.ZoneSettingWebsocketEditParams) (cloudflare.ZoneSettingWebsocketEditResponse, error) +- client.Zones.Settings.Websocket.Get(ctx context.Context, query cloudflare.ZoneSettingWebsocketGetParams) (cloudflare.ZoneSettingWebsocketGetResponse, error) -## HostnameAssociations +### FontSettings Response Types: -- cloudflare.CertificateAuthorityHostnameAssociationUpdateResponse -- cloudflare.CertificateAuthorityHostnameAssociationListResponse +- cloudflare.ZoneSettingFontSettingEditResponse +- cloudflare.ZoneSettingFontSettingGetResponse Methods: -- client.CertificateAuthorities.HostnameAssociations.Update(ctx context.Context, params cloudflare.CertificateAuthorityHostnameAssociationUpdateParams) (cloudflare.CertificateAuthorityHostnameAssociationUpdateResponse, error) -- client.CertificateAuthorities.HostnameAssociations.List(ctx context.Context, params cloudflare.CertificateAuthorityHostnameAssociationListParams) (cloudflare.CertificateAuthorityHostnameAssociationListResponse, error) +- client.Zones.Settings.FontSettings.Edit(ctx context.Context, params cloudflare.ZoneSettingFontSettingEditParams) (cloudflare.ZoneSettingFontSettingEditResponse, error) +- client.Zones.Settings.FontSettings.Get(ctx context.Context, query cloudflare.ZoneSettingFontSettingGetParams) (cloudflare.ZoneSettingFontSettingGetResponse, error) -# ClientCertificates +## CustomNameservers Response Types: -- cloudflare.ClientCertificateNewResponse -- cloudflare.ClientCertificateListResponse -- cloudflare.ClientCertificateDeleteResponse -- cloudflare.ClientCertificateEditResponse -- cloudflare.ClientCertificateGetResponse +- cloudflare.ZoneCustomNameserverUpdateResponse +- cloudflare.ZoneCustomNameserverGetResponse Methods: -- client.ClientCertificates.New(ctx context.Context, params cloudflare.ClientCertificateNewParams) (cloudflare.ClientCertificateNewResponse, error) -- client.ClientCertificates.List(ctx context.Context, params cloudflare.ClientCertificateListParams) (shared.V4PagePaginationArray[cloudflare.ClientCertificateListResponse], error) -- client.ClientCertificates.Delete(ctx context.Context, clientCertificateID string, body cloudflare.ClientCertificateDeleteParams) (cloudflare.ClientCertificateDeleteResponse, error) -- client.ClientCertificates.Edit(ctx context.Context, clientCertificateID string, body cloudflare.ClientCertificateEditParams) (cloudflare.ClientCertificateEditResponse, error) -- client.ClientCertificates.Get(ctx context.Context, clientCertificateID string, query cloudflare.ClientCertificateGetParams) (cloudflare.ClientCertificateGetResponse, error) +- client.Zones.CustomNameservers.Update(ctx context.Context, params cloudflare.ZoneCustomNameserverUpdateParams) (cloudflare.ZoneCustomNameserverUpdateResponse, error) +- client.Zones.CustomNameservers.Get(ctx context.Context, query cloudflare.ZoneCustomNameserverGetParams) (cloudflare.ZoneCustomNameserverGetResponse, error) -# CustomCertificates +## Holds Response Types: -- cloudflare.CustomCertificateNewResponse -- cloudflare.CustomCertificateListResponse -- cloudflare.CustomCertificateDeleteResponse -- cloudflare.CustomCertificateEditResponse -- cloudflare.CustomCertificateGetResponse +- cloudflare.ZoneHoldNewResponse +- cloudflare.ZoneHoldDeleteResponse +- cloudflare.ZoneHoldGetResponse Methods: -- client.CustomCertificates.New(ctx context.Context, params cloudflare.CustomCertificateNewParams) (cloudflare.CustomCertificateNewResponse, error) -- client.CustomCertificates.List(ctx context.Context, params cloudflare.CustomCertificateListParams) (shared.V4PagePaginationArray[cloudflare.CustomCertificateListResponse], error) -- client.CustomCertificates.Delete(ctx context.Context, customCertificateID string, body cloudflare.CustomCertificateDeleteParams) (cloudflare.CustomCertificateDeleteResponse, error) -- client.CustomCertificates.Edit(ctx context.Context, customCertificateID string, params cloudflare.CustomCertificateEditParams) (cloudflare.CustomCertificateEditResponse, error) -- client.CustomCertificates.Get(ctx context.Context, customCertificateID string, query cloudflare.CustomCertificateGetParams) (cloudflare.CustomCertificateGetResponse, error) +- client.Zones.Holds.New(ctx context.Context, params cloudflare.ZoneHoldNewParams) (cloudflare.ZoneHoldNewResponse, error) +- client.Zones.Holds.Delete(ctx context.Context, params cloudflare.ZoneHoldDeleteParams) (cloudflare.ZoneHoldDeleteResponse, error) +- client.Zones.Holds.Get(ctx context.Context, query cloudflare.ZoneHoldGetParams) (cloudflare.ZoneHoldGetResponse, error) -## Prioritize +## Workers + +### Script Response Types: -- cloudflare.CustomCertificatePrioritizeUpdateResponse +- cloudflare.ZoneWorkerScriptUpdateResponse Methods: -- client.CustomCertificates.Prioritize.Update(ctx context.Context, params cloudflare.CustomCertificatePrioritizeUpdateParams) ([]cloudflare.CustomCertificatePrioritizeUpdateResponse, error) +- client.Zones.Workers.Script.Update(ctx context.Context, body cloudflare.ZoneWorkerScriptUpdateParams) (cloudflare.ZoneWorkerScriptUpdateResponse, error) +- client.Zones.Workers.Script.Delete(ctx context.Context, body cloudflare.ZoneWorkerScriptDeleteParams) error +- client.Zones.Workers.Script.Get(ctx context.Context, query cloudflare.ZoneWorkerScriptGetParams) (http.Response, error) -# CustomHostnames +# LoadBalancers Response Types: -- cloudflare.CustomHostnameNewResponse -- cloudflare.CustomHostnameListResponse -- cloudflare.CustomHostnameDeleteResponse -- cloudflare.CustomHostnameEditResponse -- cloudflare.CustomHostnameGetResponse +- cloudflare.LoadBalancerNewResponse +- cloudflare.LoadBalancerUpdateResponse +- cloudflare.LoadBalancerListResponse +- cloudflare.LoadBalancerDeleteResponse +- cloudflare.LoadBalancerEditResponse +- cloudflare.LoadBalancerGetResponse Methods: -- client.CustomHostnames.New(ctx context.Context, params cloudflare.CustomHostnameNewParams) (cloudflare.CustomHostnameNewResponse, error) -- client.CustomHostnames.List(ctx context.Context, params cloudflare.CustomHostnameListParams) (shared.V4PagePaginationArray[cloudflare.CustomHostnameListResponse], error) -- client.CustomHostnames.Delete(ctx context.Context, customHostnameID string, body cloudflare.CustomHostnameDeleteParams) (cloudflare.CustomHostnameDeleteResponse, error) -- client.CustomHostnames.Edit(ctx context.Context, customHostnameID string, params cloudflare.CustomHostnameEditParams) (cloudflare.CustomHostnameEditResponse, error) -- client.CustomHostnames.Get(ctx context.Context, customHostnameID string, query cloudflare.CustomHostnameGetParams) (cloudflare.CustomHostnameGetResponse, error) +- client.LoadBalancers.New(ctx context.Context, params cloudflare.LoadBalancerNewParams) (cloudflare.LoadBalancerNewResponse, error) +- client.LoadBalancers.Update(ctx context.Context, loadBalancerID string, params cloudflare.LoadBalancerUpdateParams) (cloudflare.LoadBalancerUpdateResponse, error) +- client.LoadBalancers.List(ctx context.Context, query cloudflare.LoadBalancerListParams) ([]cloudflare.LoadBalancerListResponse, error) +- client.LoadBalancers.Delete(ctx context.Context, loadBalancerID string, body cloudflare.LoadBalancerDeleteParams) (cloudflare.LoadBalancerDeleteResponse, error) +- client.LoadBalancers.Edit(ctx context.Context, loadBalancerID string, params cloudflare.LoadBalancerEditParams) (cloudflare.LoadBalancerEditResponse, error) +- client.LoadBalancers.Get(ctx context.Context, loadBalancerID string, query cloudflare.LoadBalancerGetParams) (cloudflare.LoadBalancerGetResponse, error) -## FallbackOrigin +## Monitors Response Types: -- cloudflare.CustomHostnameFallbackOriginUpdateResponse -- cloudflare.CustomHostnameFallbackOriginDeleteResponse -- cloudflare.CustomHostnameFallbackOriginGetResponse +- cloudflare.LoadBalancerMonitorNewResponse +- cloudflare.LoadBalancerMonitorUpdateResponse +- cloudflare.LoadBalancerMonitorListResponse +- cloudflare.LoadBalancerMonitorDeleteResponse +- cloudflare.LoadBalancerMonitorEditResponse +- cloudflare.LoadBalancerMonitorGetResponse Methods: -- client.CustomHostnames.FallbackOrigin.Update(ctx context.Context, params cloudflare.CustomHostnameFallbackOriginUpdateParams) (cloudflare.CustomHostnameFallbackOriginUpdateResponse, error) -- client.CustomHostnames.FallbackOrigin.Delete(ctx context.Context, body cloudflare.CustomHostnameFallbackOriginDeleteParams) (cloudflare.CustomHostnameFallbackOriginDeleteResponse, error) -- client.CustomHostnames.FallbackOrigin.Get(ctx context.Context, query cloudflare.CustomHostnameFallbackOriginGetParams) (cloudflare.CustomHostnameFallbackOriginGetResponse, error) +- client.LoadBalancers.Monitors.New(ctx context.Context, params cloudflare.LoadBalancerMonitorNewParams) (cloudflare.LoadBalancerMonitorNewResponse, error) +- client.LoadBalancers.Monitors.Update(ctx context.Context, monitorID string, params cloudflare.LoadBalancerMonitorUpdateParams) (cloudflare.LoadBalancerMonitorUpdateResponse, error) +- client.LoadBalancers.Monitors.List(ctx context.Context, query cloudflare.LoadBalancerMonitorListParams) ([]cloudflare.LoadBalancerMonitorListResponse, error) +- client.LoadBalancers.Monitors.Delete(ctx context.Context, monitorID string, body cloudflare.LoadBalancerMonitorDeleteParams) (cloudflare.LoadBalancerMonitorDeleteResponse, error) +- client.LoadBalancers.Monitors.Edit(ctx context.Context, monitorID string, params cloudflare.LoadBalancerMonitorEditParams) (cloudflare.LoadBalancerMonitorEditResponse, error) +- client.LoadBalancers.Monitors.Get(ctx context.Context, monitorID string, query cloudflare.LoadBalancerMonitorGetParams) (cloudflare.LoadBalancerMonitorGetResponse, error) -# CustomNameservers +### Previews Response Types: -- cloudflare.CustomNameserverNewResponse -- cloudflare.CustomNameserverListResponse -- cloudflare.CustomNameserverDeleteResponse -- cloudflare.CustomNameserverVerifyResponse +- cloudflare.LoadBalancerMonitorPreviewNewResponse Methods: -- client.CustomNameservers.New(ctx context.Context, params cloudflare.CustomNameserverNewParams) (cloudflare.CustomNameserverNewResponse, error) -- client.CustomNameservers.List(ctx context.Context, query cloudflare.CustomNameserverListParams) ([]cloudflare.CustomNameserverListResponse, error) -- client.CustomNameservers.Delete(ctx context.Context, customNsID string, body cloudflare.CustomNameserverDeleteParams) (cloudflare.CustomNameserverDeleteResponse, error) -- client.CustomNameservers.Availabilty(ctx context.Context, query cloudflare.CustomNameserverAvailabiltyParams) ([]string, error) -- client.CustomNameservers.Verify(ctx context.Context, body cloudflare.CustomNameserverVerifyParams) ([]cloudflare.CustomNameserverVerifyResponse, error) - -# DNS +- client.LoadBalancers.Monitors.Previews.New(ctx context.Context, monitorID string, params cloudflare.LoadBalancerMonitorPreviewNewParams) (cloudflare.LoadBalancerMonitorPreviewNewResponse, error) -## Records +### References Response Types: -- cloudflare.DNSRecordNewResponse -- cloudflare.DNSRecordUpdateResponse -- cloudflare.DNSRecordListResponse -- cloudflare.DNSRecordDeleteResponse -- cloudflare.DNSRecordEditResponse -- cloudflare.DNSRecordGetResponse -- cloudflare.DNSRecordImportResponse -- cloudflare.DNSRecordScanResponse +- cloudflare.LoadBalancerMonitorReferenceListResponse Methods: -- client.DNS.Records.New(ctx context.Context, params cloudflare.DNSRecordNewParams) (cloudflare.DNSRecordNewResponse, error) -- client.DNS.Records.Update(ctx context.Context, dnsRecordID string, params cloudflare.DNSRecordUpdateParams) (cloudflare.DNSRecordUpdateResponse, error) -- client.DNS.Records.List(ctx context.Context, params cloudflare.DNSRecordListParams) (shared.V4PagePaginationArray[cloudflare.DNSRecordListResponse], error) -- client.DNS.Records.Delete(ctx context.Context, dnsRecordID string, body cloudflare.DNSRecordDeleteParams) (cloudflare.DNSRecordDeleteResponse, error) -- client.DNS.Records.Edit(ctx context.Context, dnsRecordID string, params cloudflare.DNSRecordEditParams) (cloudflare.DNSRecordEditResponse, error) -- client.DNS.Records.Export(ctx context.Context, query cloudflare.DNSRecordExportParams) (string, error) -- client.DNS.Records.Get(ctx context.Context, dnsRecordID string, query cloudflare.DNSRecordGetParams) (cloudflare.DNSRecordGetResponse, error) -- client.DNS.Records.Import(ctx context.Context, params cloudflare.DNSRecordImportParams) (cloudflare.DNSRecordImportResponse, error) -- client.DNS.Records.Scan(ctx context.Context, body cloudflare.DNSRecordScanParams) (cloudflare.DNSRecordScanResponse, error) +- client.LoadBalancers.Monitors.References.List(ctx context.Context, monitorID string, query cloudflare.LoadBalancerMonitorReferenceListParams) ([]cloudflare.LoadBalancerMonitorReferenceListResponse, error) -## Firewall +## Pools Response Types: -- cloudflare.DNSFirewallNewResponse -- cloudflare.DNSFirewallListResponse -- cloudflare.DNSFirewallDeleteResponse -- cloudflare.DNSFirewallEditResponse -- cloudflare.DNSFirewallGetResponse +- cloudflare.LoadBalancerPoolNewResponse +- cloudflare.LoadBalancerPoolUpdateResponse +- cloudflare.LoadBalancerPoolListResponse +- cloudflare.LoadBalancerPoolDeleteResponse +- cloudflare.LoadBalancerPoolEditResponse +- cloudflare.LoadBalancerPoolGetResponse Methods: -- client.DNS.Firewall.New(ctx context.Context, params cloudflare.DNSFirewallNewParams) (cloudflare.DNSFirewallNewResponse, error) -- client.DNS.Firewall.List(ctx context.Context, params cloudflare.DNSFirewallListParams) (shared.V4PagePaginationArray[cloudflare.DNSFirewallListResponse], error) -- client.DNS.Firewall.Delete(ctx context.Context, dnsFirewallID string, body cloudflare.DNSFirewallDeleteParams) (cloudflare.DNSFirewallDeleteResponse, error) -- client.DNS.Firewall.Edit(ctx context.Context, dnsFirewallID string, params cloudflare.DNSFirewallEditParams) (cloudflare.DNSFirewallEditResponse, error) -- client.DNS.Firewall.Get(ctx context.Context, dnsFirewallID string, query cloudflare.DNSFirewallGetParams) (cloudflare.DNSFirewallGetResponse, error) - -### Analytics +- client.LoadBalancers.Pools.New(ctx context.Context, params cloudflare.LoadBalancerPoolNewParams) (cloudflare.LoadBalancerPoolNewResponse, error) +- client.LoadBalancers.Pools.Update(ctx context.Context, poolID string, params cloudflare.LoadBalancerPoolUpdateParams) (cloudflare.LoadBalancerPoolUpdateResponse, error) +- client.LoadBalancers.Pools.List(ctx context.Context, params cloudflare.LoadBalancerPoolListParams) ([]cloudflare.LoadBalancerPoolListResponse, error) +- client.LoadBalancers.Pools.Delete(ctx context.Context, poolID string, body cloudflare.LoadBalancerPoolDeleteParams) (cloudflare.LoadBalancerPoolDeleteResponse, error) +- client.LoadBalancers.Pools.Edit(ctx context.Context, poolID string, params cloudflare.LoadBalancerPoolEditParams) (cloudflare.LoadBalancerPoolEditResponse, error) +- client.LoadBalancers.Pools.Get(ctx context.Context, poolID string, query cloudflare.LoadBalancerPoolGetParams) (cloudflare.LoadBalancerPoolGetResponse, error) -#### Reports +### Health Response Types: -- cloudflare.DNSFirewallAnalyticsReportListResponse +- cloudflare.LoadBalancerPoolHealthNewResponse +- cloudflare.LoadBalancerPoolHealthGetResponse Methods: -- client.DNS.Firewall.Analytics.Reports.List(ctx context.Context, accountIdentifier string, identifier string, query cloudflare.DNSFirewallAnalyticsReportListParams) (cloudflare.DNSFirewallAnalyticsReportListResponse, error) +- client.LoadBalancers.Pools.Health.New(ctx context.Context, poolID string, params cloudflare.LoadBalancerPoolHealthNewParams) (cloudflare.LoadBalancerPoolHealthNewResponse, error) +- client.LoadBalancers.Pools.Health.Get(ctx context.Context, poolID string, query cloudflare.LoadBalancerPoolHealthGetParams) (cloudflare.LoadBalancerPoolHealthGetResponse, error) -##### Bytimes +### References Response Types: -- cloudflare.DNSFirewallAnalyticsReportBytimeListResponse +- cloudflare.LoadBalancerPoolReferenceListResponse Methods: -- client.DNS.Firewall.Analytics.Reports.Bytimes.List(ctx context.Context, accountIdentifier string, identifier string, query cloudflare.DNSFirewallAnalyticsReportBytimeListParams) (cloudflare.DNSFirewallAnalyticsReportBytimeListResponse, error) +- client.LoadBalancers.Pools.References.List(ctx context.Context, poolID string, query cloudflare.LoadBalancerPoolReferenceListParams) ([]cloudflare.LoadBalancerPoolReferenceListResponse, error) -# DNSSEC +## Previews Response Types: -- cloudflare.DNSSECDeleteResponse -- cloudflare.DNSSECEditResponse -- cloudflare.DNSSECGetResponse +- cloudflare.LoadBalancerPreviewGetResponse Methods: -- client.DNSSEC.Delete(ctx context.Context, body cloudflare.DNSSECDeleteParams) (cloudflare.DNSSECDeleteResponse, error) -- client.DNSSEC.Edit(ctx context.Context, params cloudflare.DNSSECEditParams) (cloudflare.DNSSECEditResponse, error) -- client.DNSSEC.Get(ctx context.Context, query cloudflare.DNSSECGetParams) (cloudflare.DNSSECGetResponse, error) - -# Emails +- client.LoadBalancers.Previews.Get(ctx context.Context, previewID interface{}, query cloudflare.LoadBalancerPreviewGetParams) (cloudflare.LoadBalancerPreviewGetResponse, error) -## Routing +## Regions Response Types: -- cloudflare.EmailRoutingGetResponse +- cloudflare.LoadBalancerRegionListResponse +- cloudflare.LoadBalancerRegionGetResponse Methods: -- client.Emails.Routing.Get(ctx context.Context, zoneIdentifier string) (cloudflare.EmailRoutingGetResponse, error) +- client.LoadBalancers.Regions.List(ctx context.Context, params cloudflare.LoadBalancerRegionListParams) (cloudflare.LoadBalancerRegionListResponse, error) +- client.LoadBalancers.Regions.Get(ctx context.Context, regionID cloudflare.LoadBalancerRegionGetParamsRegionID, query cloudflare.LoadBalancerRegionGetParams) (cloudflare.LoadBalancerRegionGetResponse, error) -### Disables +## Searches Response Types: -- cloudflare.EmailRoutingDisableNewResponse +- cloudflare.LoadBalancerSearchListResponse Methods: -- client.Emails.Routing.Disables.New(ctx context.Context, zoneIdentifier string) (cloudflare.EmailRoutingDisableNewResponse, error) +- client.LoadBalancers.Searches.List(ctx context.Context, params cloudflare.LoadBalancerSearchListParams) ([]cloudflare.LoadBalancerSearchListResponse, error) -### DNS +# Access + +## Applications Response Types: -- cloudflare.EmailRoutingDNSGetResponse +- cloudflare.AccessApplicationNewResponse +- cloudflare.AccessApplicationUpdateResponse +- cloudflare.AccessApplicationListResponse +- cloudflare.AccessApplicationDeleteResponse +- cloudflare.AccessApplicationGetResponse +- cloudflare.AccessApplicationRevokeTokensResponse Methods: -- client.Emails.Routing.DNS.Get(ctx context.Context, zoneIdentifier string) ([]cloudflare.EmailRoutingDNSGetResponse, error) +- client.Access.Applications.New(ctx context.Context, params cloudflare.AccessApplicationNewParams) (cloudflare.AccessApplicationNewResponse, error) +- client.Access.Applications.Update(ctx context.Context, appID cloudflare.AccessApplicationUpdateParamsAppID, params cloudflare.AccessApplicationUpdateParams) (cloudflare.AccessApplicationUpdateResponse, error) +- client.Access.Applications.List(ctx context.Context, query cloudflare.AccessApplicationListParams) ([]cloudflare.AccessApplicationListResponse, error) +- client.Access.Applications.Delete(ctx context.Context, appID cloudflare.AccessApplicationDeleteParamsAppID, body cloudflare.AccessApplicationDeleteParams) (cloudflare.AccessApplicationDeleteResponse, error) +- client.Access.Applications.Get(ctx context.Context, appID cloudflare.AccessApplicationGetParamsAppID, query cloudflare.AccessApplicationGetParams) (cloudflare.AccessApplicationGetResponse, error) +- client.Access.Applications.RevokeTokens(ctx context.Context, appID cloudflare.AccessApplicationRevokeTokensParamsAppID, body cloudflare.AccessApplicationRevokeTokensParams) (cloudflare.AccessApplicationRevokeTokensResponse, error) -### Enables +### CAs Response Types: -- cloudflare.EmailRoutingEnableNewResponse +- cloudflare.AccessApplicationCANewResponse +- cloudflare.AccessApplicationCAListResponse +- cloudflare.AccessApplicationCADeleteResponse +- cloudflare.AccessApplicationCAGetResponse Methods: -- client.Emails.Routing.Enables.New(ctx context.Context, zoneIdentifier string) (cloudflare.EmailRoutingEnableNewResponse, error) +- client.Access.Applications.CAs.New(ctx context.Context, uuid string, body cloudflare.AccessApplicationCANewParams) (cloudflare.AccessApplicationCANewResponse, error) +- client.Access.Applications.CAs.List(ctx context.Context, query cloudflare.AccessApplicationCAListParams) ([]cloudflare.AccessApplicationCAListResponse, error) +- client.Access.Applications.CAs.Delete(ctx context.Context, uuid string, body cloudflare.AccessApplicationCADeleteParams) (cloudflare.AccessApplicationCADeleteResponse, error) +- client.Access.Applications.CAs.Get(ctx context.Context, uuid string, query cloudflare.AccessApplicationCAGetParams) (cloudflare.AccessApplicationCAGetResponse, error) -### Rules +### UserPolicyChecks Response Types: -- cloudflare.EmailRoutingRuleNewResponse -- cloudflare.EmailRoutingRuleUpdateResponse -- cloudflare.EmailRoutingRuleListResponse -- cloudflare.EmailRoutingRuleDeleteResponse -- cloudflare.EmailRoutingRuleGetResponse +- cloudflare.AccessApplicationUserPolicyCheckListResponse Methods: -- client.Emails.Routing.Rules.New(ctx context.Context, zoneIdentifier string, body cloudflare.EmailRoutingRuleNewParams) (cloudflare.EmailRoutingRuleNewResponse, error) -- client.Emails.Routing.Rules.Update(ctx context.Context, zoneIdentifier string, ruleIdentifier string, body cloudflare.EmailRoutingRuleUpdateParams) (cloudflare.EmailRoutingRuleUpdateResponse, error) -- client.Emails.Routing.Rules.List(ctx context.Context, zoneIdentifier string, query cloudflare.EmailRoutingRuleListParams) (shared.V4PagePaginationArray[cloudflare.EmailRoutingRuleListResponse], error) -- client.Emails.Routing.Rules.Delete(ctx context.Context, zoneIdentifier string, ruleIdentifier string) (cloudflare.EmailRoutingRuleDeleteResponse, error) -- client.Emails.Routing.Rules.Get(ctx context.Context, zoneIdentifier string, ruleIdentifier string) (cloudflare.EmailRoutingRuleGetResponse, error) +- client.Access.Applications.UserPolicyChecks.List(ctx context.Context, appID cloudflare.AccessApplicationUserPolicyCheckListParamsAppID, query cloudflare.AccessApplicationUserPolicyCheckListParams) (cloudflare.AccessApplicationUserPolicyCheckListResponse, error) -#### CatchAlls +### Policies Response Types: -- cloudflare.EmailRoutingRuleCatchAllUpdateResponse -- cloudflare.EmailRoutingRuleCatchAllGetResponse +- cloudflare.AccessApplicationPolicyNewResponse +- cloudflare.AccessApplicationPolicyUpdateResponse +- cloudflare.AccessApplicationPolicyListResponse +- cloudflare.AccessApplicationPolicyDeleteResponse +- cloudflare.AccessApplicationPolicyGetResponse Methods: -- client.Emails.Routing.Rules.CatchAlls.Update(ctx context.Context, zoneIdentifier string, body cloudflare.EmailRoutingRuleCatchAllUpdateParams) (cloudflare.EmailRoutingRuleCatchAllUpdateResponse, error) -- client.Emails.Routing.Rules.CatchAlls.Get(ctx context.Context, zoneIdentifier string) (cloudflare.EmailRoutingRuleCatchAllGetResponse, error) +- client.Access.Applications.Policies.New(ctx context.Context, uuid string, params cloudflare.AccessApplicationPolicyNewParams) (cloudflare.AccessApplicationPolicyNewResponse, error) +- client.Access.Applications.Policies.Update(ctx context.Context, uuid1 string, uuid string, params cloudflare.AccessApplicationPolicyUpdateParams) (cloudflare.AccessApplicationPolicyUpdateResponse, error) +- client.Access.Applications.Policies.List(ctx context.Context, uuid string, query cloudflare.AccessApplicationPolicyListParams) ([]cloudflare.AccessApplicationPolicyListResponse, error) +- client.Access.Applications.Policies.Delete(ctx context.Context, uuid1 string, uuid string, body cloudflare.AccessApplicationPolicyDeleteParams) (cloudflare.AccessApplicationPolicyDeleteResponse, error) +- client.Access.Applications.Policies.Get(ctx context.Context, uuid1 string, uuid string, query cloudflare.AccessApplicationPolicyGetParams) (cloudflare.AccessApplicationPolicyGetResponse, error) -### Addresses +## Certificates Response Types: -- cloudflare.EmailRoutingAddressNewResponse -- cloudflare.EmailRoutingAddressDeleteResponse -- cloudflare.EmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesResponse -- cloudflare.EmailRoutingAddressGetResponse +- cloudflare.AccessCertificateNewResponse +- cloudflare.AccessCertificateUpdateResponse +- cloudflare.AccessCertificateListResponse +- cloudflare.AccessCertificateDeleteResponse +- cloudflare.AccessCertificateGetResponse Methods: -- client.Emails.Routing.Addresses.New(ctx context.Context, accountIdentifier string, body cloudflare.EmailRoutingAddressNewParams) (cloudflare.EmailRoutingAddressNewResponse, error) -- client.Emails.Routing.Addresses.Delete(ctx context.Context, accountIdentifier string, destinationAddressIdentifier string) (cloudflare.EmailRoutingAddressDeleteResponse, error) -- client.Emails.Routing.Addresses.EmailRoutingDestinationAddressesListDestinationAddresses(ctx context.Context, accountIdentifier string, query cloudflare.EmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesParams) ([]cloudflare.EmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesResponse, error) -- client.Emails.Routing.Addresses.Get(ctx context.Context, accountIdentifier string, destinationAddressIdentifier string) (cloudflare.EmailRoutingAddressGetResponse, error) +- client.Access.Certificates.New(ctx context.Context, params cloudflare.AccessCertificateNewParams) (cloudflare.AccessCertificateNewResponse, error) +- client.Access.Certificates.Update(ctx context.Context, uuid string, params cloudflare.AccessCertificateUpdateParams) (cloudflare.AccessCertificateUpdateResponse, error) +- client.Access.Certificates.List(ctx context.Context, query cloudflare.AccessCertificateListParams) ([]cloudflare.AccessCertificateListResponse, error) +- client.Access.Certificates.Delete(ctx context.Context, uuid string, body cloudflare.AccessCertificateDeleteParams) (cloudflare.AccessCertificateDeleteResponse, error) +- client.Access.Certificates.Get(ctx context.Context, uuid string, query cloudflare.AccessCertificateGetParams) (cloudflare.AccessCertificateGetResponse, error) -# Filters +### Settings Response Types: -- cloudflare.FilterNewResponse -- cloudflare.FilterUpdateResponse -- cloudflare.FilterListResponse -- cloudflare.FilterDeleteResponse -- cloudflare.FilterGetResponse +- cloudflare.AccessCertificateSettingUpdateResponse +- cloudflare.AccessCertificateSettingListResponse Methods: -- client.Filters.New(ctx context.Context, zoneIdentifier string, body cloudflare.FilterNewParams) ([]cloudflare.FilterNewResponse, error) -- client.Filters.Update(ctx context.Context, zoneIdentifier string, id string, body cloudflare.FilterUpdateParams) (cloudflare.FilterUpdateResponse, error) -- client.Filters.List(ctx context.Context, zoneIdentifier string, query cloudflare.FilterListParams) (shared.V4PagePaginationArray[cloudflare.FilterListResponse], error) -- client.Filters.Delete(ctx context.Context, zoneIdentifier string, id string) (cloudflare.FilterDeleteResponse, error) -- client.Filters.Get(ctx context.Context, zoneIdentifier string, id string) (cloudflare.FilterGetResponse, error) - -# Firewalls +- client.Access.Certificates.Settings.Update(ctx context.Context, params cloudflare.AccessCertificateSettingUpdateParams) ([]cloudflare.AccessCertificateSettingUpdateResponse, error) +- client.Access.Certificates.Settings.List(ctx context.Context, query cloudflare.AccessCertificateSettingListParams) ([]cloudflare.AccessCertificateSettingListResponse, error) -## Lockdowns +## Groups Response Types: -- cloudflare.FirewallLockdownNewResponse -- cloudflare.FirewallLockdownUpdateResponse -- cloudflare.FirewallLockdownListResponse -- cloudflare.FirewallLockdownDeleteResponse -- cloudflare.FirewallLockdownGetResponse +- cloudflare.AccessGroupNewResponse +- cloudflare.AccessGroupUpdateResponse +- cloudflare.AccessGroupListResponse +- cloudflare.AccessGroupDeleteResponse +- cloudflare.AccessGroupGetResponse Methods: -- client.Firewalls.Lockdowns.New(ctx context.Context, zoneIdentifier string, body cloudflare.FirewallLockdownNewParams) (cloudflare.FirewallLockdownNewResponse, error) -- client.Firewalls.Lockdowns.Update(ctx context.Context, zoneIdentifier string, id string, body cloudflare.FirewallLockdownUpdateParams) (cloudflare.FirewallLockdownUpdateResponse, error) -- client.Firewalls.Lockdowns.List(ctx context.Context, zoneIdentifier string, query cloudflare.FirewallLockdownListParams) (shared.V4PagePaginationArray[cloudflare.FirewallLockdownListResponse], error) -- client.Firewalls.Lockdowns.Delete(ctx context.Context, zoneIdentifier string, id string) (cloudflare.FirewallLockdownDeleteResponse, error) -- client.Firewalls.Lockdowns.Get(ctx context.Context, zoneIdentifier string, id string) (cloudflare.FirewallLockdownGetResponse, error) +- client.Access.Groups.New(ctx context.Context, params cloudflare.AccessGroupNewParams) (cloudflare.AccessGroupNewResponse, error) +- client.Access.Groups.Update(ctx context.Context, uuid string, params cloudflare.AccessGroupUpdateParams) (cloudflare.AccessGroupUpdateResponse, error) +- client.Access.Groups.List(ctx context.Context, query cloudflare.AccessGroupListParams) ([]cloudflare.AccessGroupListResponse, error) +- client.Access.Groups.Delete(ctx context.Context, uuid string, body cloudflare.AccessGroupDeleteParams) (cloudflare.AccessGroupDeleteResponse, error) +- client.Access.Groups.Get(ctx context.Context, uuid string, query cloudflare.AccessGroupGetParams) (cloudflare.AccessGroupGetResponse, error) -## Rules +## IdentityProviders Response Types: -- cloudflare.FirewallRuleNewResponse -- cloudflare.FirewallRuleUpdateResponse -- cloudflare.FirewallRuleListResponse -- cloudflare.FirewallRuleDeleteResponse -- cloudflare.FirewallRuleEditResponse -- cloudflare.FirewallRuleGetResponse +- cloudflare.AccessIdentityProviderNewResponse +- cloudflare.AccessIdentityProviderUpdateResponse +- cloudflare.AccessIdentityProviderListResponse +- cloudflare.AccessIdentityProviderDeleteResponse +- cloudflare.AccessIdentityProviderGetResponse Methods: -- client.Firewalls.Rules.New(ctx context.Context, zoneIdentifier string, body cloudflare.FirewallRuleNewParams) ([]cloudflare.FirewallRuleNewResponse, error) -- client.Firewalls.Rules.Update(ctx context.Context, zoneIdentifier string, id string, body cloudflare.FirewallRuleUpdateParams) (cloudflare.FirewallRuleUpdateResponse, error) -- client.Firewalls.Rules.List(ctx context.Context, zoneIdentifier string, query cloudflare.FirewallRuleListParams) (shared.V4PagePaginationArray[cloudflare.FirewallRuleListResponse], error) -- client.Firewalls.Rules.Delete(ctx context.Context, zoneIdentifier string, id string, body cloudflare.FirewallRuleDeleteParams) (cloudflare.FirewallRuleDeleteResponse, error) -- client.Firewalls.Rules.Edit(ctx context.Context, zoneIdentifier string, id string, body cloudflare.FirewallRuleEditParams) ([]cloudflare.FirewallRuleEditResponse, error) -- client.Firewalls.Rules.Get(ctx context.Context, zoneIdentifier string, id string, query cloudflare.FirewallRuleGetParams) (cloudflare.FirewallRuleGetResponse, error) +- client.Access.IdentityProviders.New(ctx context.Context, params cloudflare.AccessIdentityProviderNewParams) (cloudflare.AccessIdentityProviderNewResponse, error) +- client.Access.IdentityProviders.Update(ctx context.Context, uuid string, params cloudflare.AccessIdentityProviderUpdateParams) (cloudflare.AccessIdentityProviderUpdateResponse, error) +- client.Access.IdentityProviders.List(ctx context.Context, query cloudflare.AccessIdentityProviderListParams) ([]cloudflare.AccessIdentityProviderListResponse, error) +- client.Access.IdentityProviders.Delete(ctx context.Context, uuid string, body cloudflare.AccessIdentityProviderDeleteParams) (cloudflare.AccessIdentityProviderDeleteResponse, error) +- client.Access.IdentityProviders.Get(ctx context.Context, uuid string, query cloudflare.AccessIdentityProviderGetParams) (cloudflare.AccessIdentityProviderGetResponse, error) -## AccessRules +## Organizations Response Types: -- cloudflare.FirewallAccessRuleNewResponse -- cloudflare.FirewallAccessRuleListResponse -- cloudflare.FirewallAccessRuleDeleteResponse -- cloudflare.FirewallAccessRuleEditResponse -- cloudflare.FirewallAccessRuleGetResponse +- cloudflare.AccessOrganizationNewResponse +- cloudflare.AccessOrganizationUpdateResponse +- cloudflare.AccessOrganizationListResponse +- cloudflare.AccessOrganizationRevokeUsersResponse Methods: -- client.Firewalls.AccessRules.New(ctx context.Context, params cloudflare.FirewallAccessRuleNewParams) (cloudflare.FirewallAccessRuleNewResponse, error) -- client.Firewalls.AccessRules.List(ctx context.Context, params cloudflare.FirewallAccessRuleListParams) (shared.V4PagePaginationArray[cloudflare.FirewallAccessRuleListResponse], error) -- client.Firewalls.AccessRules.Delete(ctx context.Context, identifier interface{}, body cloudflare.FirewallAccessRuleDeleteParams) (cloudflare.FirewallAccessRuleDeleteResponse, error) -- client.Firewalls.AccessRules.Edit(ctx context.Context, identifier interface{}, params cloudflare.FirewallAccessRuleEditParams) (cloudflare.FirewallAccessRuleEditResponse, error) -- client.Firewalls.AccessRules.Get(ctx context.Context, identifier interface{}, query cloudflare.FirewallAccessRuleGetParams) (cloudflare.FirewallAccessRuleGetResponse, error) +- client.Access.Organizations.New(ctx context.Context, params cloudflare.AccessOrganizationNewParams) (cloudflare.AccessOrganizationNewResponse, error) +- client.Access.Organizations.Update(ctx context.Context, params cloudflare.AccessOrganizationUpdateParams) (cloudflare.AccessOrganizationUpdateResponse, error) +- client.Access.Organizations.List(ctx context.Context, query cloudflare.AccessOrganizationListParams) (cloudflare.AccessOrganizationListResponse, error) +- client.Access.Organizations.RevokeUsers(ctx context.Context, params cloudflare.AccessOrganizationRevokeUsersParams) (cloudflare.AccessOrganizationRevokeUsersResponse, error) -## UARules +## ServiceTokens Response Types: -- cloudflare.FirewallUARuleNewResponse -- cloudflare.FirewallUARuleUpdateResponse -- cloudflare.FirewallUARuleListResponse -- cloudflare.FirewallUARuleDeleteResponse -- cloudflare.FirewallUARuleGetResponse +- cloudflare.AccessServiceTokenNewResponse +- cloudflare.AccessServiceTokenUpdateResponse +- cloudflare.AccessServiceTokenListResponse +- cloudflare.AccessServiceTokenDeleteResponse +- cloudflare.AccessServiceTokenRefreshResponse +- cloudflare.AccessServiceTokenRotateResponse Methods: -- client.Firewalls.UARules.New(ctx context.Context, zoneIdentifier string, body cloudflare.FirewallUARuleNewParams) (cloudflare.FirewallUARuleNewResponse, error) -- client.Firewalls.UARules.Update(ctx context.Context, zoneIdentifier string, id string, body cloudflare.FirewallUARuleUpdateParams) (cloudflare.FirewallUARuleUpdateResponse, error) -- client.Firewalls.UARules.List(ctx context.Context, zoneIdentifier string, query cloudflare.FirewallUARuleListParams) (shared.V4PagePaginationArray[cloudflare.FirewallUARuleListResponse], error) -- client.Firewalls.UARules.Delete(ctx context.Context, zoneIdentifier string, id string) (cloudflare.FirewallUARuleDeleteResponse, error) -- client.Firewalls.UARules.Get(ctx context.Context, zoneIdentifier string, id string) (cloudflare.FirewallUARuleGetResponse, error) - -## WAF +- client.Access.ServiceTokens.New(ctx context.Context, params cloudflare.AccessServiceTokenNewParams) (cloudflare.AccessServiceTokenNewResponse, error) +- client.Access.ServiceTokens.Update(ctx context.Context, uuid string, params cloudflare.AccessServiceTokenUpdateParams) (cloudflare.AccessServiceTokenUpdateResponse, error) +- client.Access.ServiceTokens.List(ctx context.Context, query cloudflare.AccessServiceTokenListParams) ([]cloudflare.AccessServiceTokenListResponse, error) +- client.Access.ServiceTokens.Delete(ctx context.Context, uuid string, body cloudflare.AccessServiceTokenDeleteParams) (cloudflare.AccessServiceTokenDeleteResponse, error) +- client.Access.ServiceTokens.Refresh(ctx context.Context, identifier string, uuid string) (cloudflare.AccessServiceTokenRefreshResponse, error) +- client.Access.ServiceTokens.Rotate(ctx context.Context, identifier string, uuid string) (cloudflare.AccessServiceTokenRotateResponse, error) -### Overrides +## Bookmarks Response Types: -- cloudflare.FirewallWAFOverrideNewResponse -- cloudflare.FirewallWAFOverrideUpdateResponse -- cloudflare.FirewallWAFOverrideListResponse -- cloudflare.FirewallWAFOverrideDeleteResponse -- cloudflare.FirewallWAFOverrideGetResponse +- cloudflare.AccessBookmarkNewResponse +- cloudflare.AccessBookmarkUpdateResponse +- cloudflare.AccessBookmarkListResponse +- cloudflare.AccessBookmarkDeleteResponse +- cloudflare.AccessBookmarkGetResponse Methods: -- client.Firewalls.WAF.Overrides.New(ctx context.Context, zoneIdentifier string, body cloudflare.FirewallWAFOverrideNewParams) (cloudflare.FirewallWAFOverrideNewResponse, error) -- client.Firewalls.WAF.Overrides.Update(ctx context.Context, zoneIdentifier string, id string, body cloudflare.FirewallWAFOverrideUpdateParams) (cloudflare.FirewallWAFOverrideUpdateResponse, error) -- client.Firewalls.WAF.Overrides.List(ctx context.Context, zoneIdentifier string, query cloudflare.FirewallWAFOverrideListParams) (shared.V4PagePaginationArray[cloudflare.FirewallWAFOverrideListResponse], error) -- client.Firewalls.WAF.Overrides.Delete(ctx context.Context, zoneIdentifier string, id string) (cloudflare.FirewallWAFOverrideDeleteResponse, error) -- client.Firewalls.WAF.Overrides.Get(ctx context.Context, zoneIdentifier string, id string) (cloudflare.FirewallWAFOverrideGetResponse, error) +- client.Access.Bookmarks.New(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccessBookmarkNewResponse, error) +- client.Access.Bookmarks.Update(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccessBookmarkUpdateResponse, error) +- client.Access.Bookmarks.List(ctx context.Context, identifier interface{}) ([]cloudflare.AccessBookmarkListResponse, error) +- client.Access.Bookmarks.Delete(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccessBookmarkDeleteResponse, error) +- client.Access.Bookmarks.Get(ctx context.Context, identifier interface{}, uuid string) (cloudflare.AccessBookmarkGetResponse, error) -### Packages +## Keys Response Types: -- cloudflare.FirewallWAFPackageListResponse -- cloudflare.FirewallWAFPackageGetResponse +- cloudflare.AccessKeyUpdateResponse +- cloudflare.AccessKeyListResponse +- cloudflare.AccessKeyRotateResponse Methods: -- client.Firewalls.WAF.Packages.List(ctx context.Context, zoneIdentifier string, query cloudflare.FirewallWAFPackageListParams) (shared.V4PagePaginationArray[cloudflare.FirewallWAFPackageListResponse], error) -- client.Firewalls.WAF.Packages.Get(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.FirewallWAFPackageGetResponse, error) +- client.Access.Keys.Update(ctx context.Context, identifier string, body cloudflare.AccessKeyUpdateParams) (cloudflare.AccessKeyUpdateResponse, error) +- client.Access.Keys.List(ctx context.Context, identifier string) (cloudflare.AccessKeyListResponse, error) +- client.Access.Keys.Rotate(ctx context.Context, identifier string) (cloudflare.AccessKeyRotateResponse, error) + +## Logs -#### Groups +### AccessRequests Response Types: -- cloudflare.FirewallWAFPackageGroupListResponse -- cloudflare.FirewallWAFPackageGroupEditResponse -- cloudflare.FirewallWAFPackageGroupGetResponse +- cloudflare.AccessLogAccessRequestListResponse Methods: -- client.Firewalls.WAF.Packages.Groups.List(ctx context.Context, packageID string, params cloudflare.FirewallWAFPackageGroupListParams) (shared.V4PagePaginationArray[cloudflare.FirewallWAFPackageGroupListResponse], error) -- client.Firewalls.WAF.Packages.Groups.Edit(ctx context.Context, packageID string, groupID string, params cloudflare.FirewallWAFPackageGroupEditParams) (cloudflare.FirewallWAFPackageGroupEditResponse, error) -- client.Firewalls.WAF.Packages.Groups.Get(ctx context.Context, packageID string, groupID string, query cloudflare.FirewallWAFPackageGroupGetParams) (cloudflare.FirewallWAFPackageGroupGetResponse, error) +- client.Access.Logs.AccessRequests.List(ctx context.Context, identifier string) ([]cloudflare.AccessLogAccessRequestListResponse, error) -#### Rules +## Seats Response Types: -- cloudflare.FirewallWAFPackageRuleEditResponse -- cloudflare.FirewallWAFPackageRuleGetResponse -- cloudflare.FirewallWAFPackageRuleWAFRulesListWAFRulesResponse +- cloudflare.AccessSeatEditResponse Methods: -- client.Firewalls.WAF.Packages.Rules.Edit(ctx context.Context, packageID string, ruleID string, params cloudflare.FirewallWAFPackageRuleEditParams) (cloudflare.FirewallWAFPackageRuleEditResponse, error) -- client.Firewalls.WAF.Packages.Rules.Get(ctx context.Context, packageID string, ruleID string, query cloudflare.FirewallWAFPackageRuleGetParams) (cloudflare.FirewallWAFPackageRuleGetResponse, error) -- client.Firewalls.WAF.Packages.Rules.WAFRulesListWAFRules(ctx context.Context, packageID string, params cloudflare.FirewallWAFPackageRuleWAFRulesListWAFRulesParams) ([]cloudflare.FirewallWAFPackageRuleWAFRulesListWAFRulesResponse, error) +- client.Access.Seats.Edit(ctx context.Context, identifier string, body cloudflare.AccessSeatEditParams) ([]cloudflare.AccessSeatEditResponse, error) -# Healthchecks +## Users Response Types: -- cloudflare.HealthcheckNewResponse -- cloudflare.HealthcheckUpdateResponse -- cloudflare.HealthcheckListResponse -- cloudflare.HealthcheckDeleteResponse -- cloudflare.HealthcheckEditResponse -- cloudflare.HealthcheckGetResponse +- cloudflare.AccessUserListResponse Methods: -- client.Healthchecks.New(ctx context.Context, zoneIdentifier string, body cloudflare.HealthcheckNewParams) (cloudflare.HealthcheckNewResponse, error) -- client.Healthchecks.Update(ctx context.Context, zoneIdentifier string, identifier string, body cloudflare.HealthcheckUpdateParams) (cloudflare.HealthcheckUpdateResponse, error) -- client.Healthchecks.List(ctx context.Context, zoneIdentifier string) ([]cloudflare.HealthcheckListResponse, error) -- client.Healthchecks.Delete(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.HealthcheckDeleteResponse, error) -- client.Healthchecks.Edit(ctx context.Context, zoneIdentifier string, identifier string, body cloudflare.HealthcheckEditParams) (cloudflare.HealthcheckEditResponse, error) -- client.Healthchecks.Get(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.HealthcheckGetResponse, error) +- client.Access.Users.List(ctx context.Context, identifier string) ([]cloudflare.AccessUserListResponse, error) -## Previews +### ActiveSessions Response Types: -- cloudflare.HealthcheckPreviewNewResponse -- cloudflare.HealthcheckPreviewDeleteResponse -- cloudflare.HealthcheckPreviewGetResponse +- cloudflare.AccessUserActiveSessionListResponse +- cloudflare.AccessUserActiveSessionGetResponse Methods: -- client.Healthchecks.Previews.New(ctx context.Context, zoneIdentifier string, body cloudflare.HealthcheckPreviewNewParams) (cloudflare.HealthcheckPreviewNewResponse, error) -- client.Healthchecks.Previews.Delete(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.HealthcheckPreviewDeleteResponse, error) -- client.Healthchecks.Previews.Get(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.HealthcheckPreviewGetResponse, error) +- client.Access.Users.ActiveSessions.List(ctx context.Context, identifier string, id string) ([]cloudflare.AccessUserActiveSessionListResponse, error) +- client.Access.Users.ActiveSessions.Get(ctx context.Context, identifier string, id string, nonce string) (cloudflare.AccessUserActiveSessionGetResponse, error) -# KeylessCertificates +### LastSeenIdentity Response Types: -- cloudflare.KeylessCertificateNewResponse -- cloudflare.KeylessCertificateListResponse -- cloudflare.KeylessCertificateDeleteResponse -- cloudflare.KeylessCertificateEditResponse -- cloudflare.KeylessCertificateGetResponse +- cloudflare.AccessUserLastSeenIdentityListResponse Methods: -- client.KeylessCertificates.New(ctx context.Context, params cloudflare.KeylessCertificateNewParams) (cloudflare.KeylessCertificateNewResponse, error) -- client.KeylessCertificates.List(ctx context.Context, query cloudflare.KeylessCertificateListParams) ([]cloudflare.KeylessCertificateListResponse, error) -- client.KeylessCertificates.Delete(ctx context.Context, keylessCertificateID string, body cloudflare.KeylessCertificateDeleteParams) (cloudflare.KeylessCertificateDeleteResponse, error) -- client.KeylessCertificates.Edit(ctx context.Context, keylessCertificateID string, params cloudflare.KeylessCertificateEditParams) (cloudflare.KeylessCertificateEditResponse, error) -- client.KeylessCertificates.Get(ctx context.Context, keylessCertificateID string, query cloudflare.KeylessCertificateGetParams) (cloudflare.KeylessCertificateGetResponse, error) +- client.Access.Users.LastSeenIdentity.List(ctx context.Context, identifier string, id string) (cloudflare.AccessUserLastSeenIdentityListResponse, error) -# Logpush +### FailedLogins -## Datasets +Response Types: -### Fields +- cloudflare.AccessUserFailedLoginListResponse + +Methods: + +- client.Access.Users.FailedLogins.List(ctx context.Context, identifier string, id string) ([]cloudflare.AccessUserFailedLoginListResponse, error) + +## CustomPages Response Types: -- cloudflare.LogpushDatasetFieldListResponse +- cloudflare.AccessCustomPageNewResponse +- cloudflare.AccessCustomPageUpdateResponse +- cloudflare.AccessCustomPageListResponse +- cloudflare.AccessCustomPageDeleteResponse +- cloudflare.AccessCustomPageGetResponse Methods: -- client.Logpush.Datasets.Fields.List(ctx context.Context, datasetID string, query cloudflare.LogpushDatasetFieldListParams) (cloudflare.LogpushDatasetFieldListResponse, error) +- client.Access.CustomPages.New(ctx context.Context, identifier string, body cloudflare.AccessCustomPageNewParams) (cloudflare.AccessCustomPageNewResponse, error) +- client.Access.CustomPages.Update(ctx context.Context, identifier string, uuid string, body cloudflare.AccessCustomPageUpdateParams) (cloudflare.AccessCustomPageUpdateResponse, error) +- client.Access.CustomPages.List(ctx context.Context, identifier string) ([]cloudflare.AccessCustomPageListResponse, error) +- client.Access.CustomPages.Delete(ctx context.Context, identifier string, uuid string) (cloudflare.AccessCustomPageDeleteResponse, error) +- client.Access.CustomPages.Get(ctx context.Context, identifier string, uuid string) (cloudflare.AccessCustomPageGetResponse, error) -### Jobs +## Tags Response Types: -- cloudflare.LogpushDatasetJobListResponse +- cloudflare.AccessTagNewResponse +- cloudflare.AccessTagUpdateResponse +- cloudflare.AccessTagListResponse +- cloudflare.AccessTagDeleteResponse +- cloudflare.AccessTagGetResponse Methods: -- client.Logpush.Datasets.Jobs.List(ctx context.Context, datasetID string, query cloudflare.LogpushDatasetJobListParams) ([]cloudflare.LogpushDatasetJobListResponse, error) +- client.Access.Tags.New(ctx context.Context, identifier string, body cloudflare.AccessTagNewParams) (cloudflare.AccessTagNewResponse, error) +- client.Access.Tags.Update(ctx context.Context, identifier string, tagName string, body cloudflare.AccessTagUpdateParams) (cloudflare.AccessTagUpdateResponse, error) +- client.Access.Tags.List(ctx context.Context, identifier string) ([]cloudflare.AccessTagListResponse, error) +- client.Access.Tags.Delete(ctx context.Context, identifier string, name string) (cloudflare.AccessTagDeleteResponse, error) +- client.Access.Tags.Get(ctx context.Context, identifier string, name string) (cloudflare.AccessTagGetResponse, error) -## Edge +# Cache Response Types: -- cloudflare.LogpushEdgeNewResponse -- cloudflare.LogpushEdgeGetResponse +- cloudflare.CachePurgeResponse Methods: -- client.Logpush.Edge.New(ctx context.Context, params cloudflare.LogpushEdgeNewParams) (cloudflare.LogpushEdgeNewResponse, error) -- client.Logpush.Edge.Get(ctx context.Context, query cloudflare.LogpushEdgeGetParams) ([]cloudflare.LogpushEdgeGetResponse, error) +- client.Cache.Purge(ctx context.Context, params cloudflare.CachePurgeParams) (cloudflare.CachePurgeResponse, error) -## Jobs +## CacheReserve Response Types: -- cloudflare.LogpushJobNewResponse -- cloudflare.LogpushJobUpdateResponse -- cloudflare.LogpushJobListResponse -- cloudflare.LogpushJobDeleteResponse -- cloudflare.LogpushJobGetResponse +- cloudflare.CacheCacheReserveListResponse +- cloudflare.CacheCacheReserveClearResponse +- cloudflare.CacheCacheReserveEditResponse +- cloudflare.CacheCacheReserveStatusResponse Methods: -- client.Logpush.Jobs.New(ctx context.Context, params cloudflare.LogpushJobNewParams) (cloudflare.LogpushJobNewResponse, error) -- client.Logpush.Jobs.Update(ctx context.Context, jobID int64, params cloudflare.LogpushJobUpdateParams) (cloudflare.LogpushJobUpdateResponse, error) -- client.Logpush.Jobs.List(ctx context.Context, query cloudflare.LogpushJobListParams) ([]cloudflare.LogpushJobListResponse, error) -- client.Logpush.Jobs.Delete(ctx context.Context, jobID int64, body cloudflare.LogpushJobDeleteParams) (cloudflare.LogpushJobDeleteResponse, error) -- client.Logpush.Jobs.Get(ctx context.Context, jobID int64, query cloudflare.LogpushJobGetParams) (cloudflare.LogpushJobGetResponse, error) +- client.Cache.CacheReserve.List(ctx context.Context, query cloudflare.CacheCacheReserveListParams) (cloudflare.CacheCacheReserveListResponse, error) +- client.Cache.CacheReserve.Clear(ctx context.Context, body cloudflare.CacheCacheReserveClearParams) (cloudflare.CacheCacheReserveClearResponse, error) +- client.Cache.CacheReserve.Edit(ctx context.Context, params cloudflare.CacheCacheReserveEditParams) (cloudflare.CacheCacheReserveEditResponse, error) +- client.Cache.CacheReserve.Status(ctx context.Context, query cloudflare.CacheCacheReserveStatusParams) (cloudflare.CacheCacheReserveStatusResponse, error) -## Ownership +## TieredCacheSmartTopology Response Types: -- cloudflare.LogpushOwnershipNewResponse -- cloudflare.LogpushOwnershipValidateResponse +- cloudflare.CacheTieredCacheSmartTopologyDeleteResponse +- cloudflare.CacheTieredCacheSmartTopologyEditResponse +- cloudflare.CacheTieredCacheSmartTopologyGetResponse Methods: -- client.Logpush.Ownership.New(ctx context.Context, params cloudflare.LogpushOwnershipNewParams) (cloudflare.LogpushOwnershipNewResponse, error) -- client.Logpush.Ownership.Validate(ctx context.Context, params cloudflare.LogpushOwnershipValidateParams) (cloudflare.LogpushOwnershipValidateResponse, error) +- client.Cache.TieredCacheSmartTopology.Delete(ctx context.Context, body cloudflare.CacheTieredCacheSmartTopologyDeleteParams) (cloudflare.CacheTieredCacheSmartTopologyDeleteResponse, error) +- client.Cache.TieredCacheSmartTopology.Edit(ctx context.Context, params cloudflare.CacheTieredCacheSmartTopologyEditParams) (cloudflare.CacheTieredCacheSmartTopologyEditResponse, error) +- client.Cache.TieredCacheSmartTopology.Get(ctx context.Context, query cloudflare.CacheTieredCacheSmartTopologyGetParams) (cloudflare.CacheTieredCacheSmartTopologyGetResponse, error) -## Validate +## Variants Response Types: -- cloudflare.LogpushValidateDestinationResponse -- cloudflare.LogpushValidateOriginResponse +- cloudflare.CacheVariantListResponse +- cloudflare.CacheVariantDeleteResponse +- cloudflare.CacheVariantEditResponse Methods: -- client.Logpush.Validate.Destination(ctx context.Context, params cloudflare.LogpushValidateDestinationParams) (cloudflare.LogpushValidateDestinationResponse, error) -- client.Logpush.Validate.Origin(ctx context.Context, params cloudflare.LogpushValidateOriginParams) (cloudflare.LogpushValidateOriginResponse, error) +- client.Cache.Variants.List(ctx context.Context, query cloudflare.CacheVariantListParams) (cloudflare.CacheVariantListResponse, error) +- client.Cache.Variants.Delete(ctx context.Context, body cloudflare.CacheVariantDeleteParams) (cloudflare.CacheVariantDeleteResponse, error) +- client.Cache.Variants.Edit(ctx context.Context, params cloudflare.CacheVariantEditParams) (cloudflare.CacheVariantEditResponse, error) -# Logs +## RegionalTieredCache -## Controls +Response Types: -### Retentions +- cloudflare.CacheRegionalTieredCacheEditResponse +- cloudflare.CacheRegionalTieredCacheGetResponse -#### Flags +Methods: + +- client.Cache.RegionalTieredCache.Edit(ctx context.Context, params cloudflare.CacheRegionalTieredCacheEditParams) (cloudflare.CacheRegionalTieredCacheEditResponse, error) +- client.Cache.RegionalTieredCache.Get(ctx context.Context, query cloudflare.CacheRegionalTieredCacheGetParams) (cloudflare.CacheRegionalTieredCacheGetResponse, error) + +# SSL + +## Analyze Response Types: -- cloudflare.LogControlRetentionFlagNewResponse -- cloudflare.LogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponse +- cloudflare.SSLAnalyzeNewResponse Methods: -- client.Logs.Controls.Retentions.Flags.New(ctx context.Context, zoneIdentifier string, body cloudflare.LogControlRetentionFlagNewParams) (cloudflare.LogControlRetentionFlagNewResponse, error) -- client.Logs.Controls.Retentions.Flags.LogsReceivedGetLogRetentionFlag(ctx context.Context, zoneIdentifier string) (cloudflare.LogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponse, error) +- client.SSL.Analyze.New(ctx context.Context, params cloudflare.SSLAnalyzeNewParams) (cloudflare.SSLAnalyzeNewResponse, error) -### Cmb +## CertificatePacks -#### Config +Response Types: + +- cloudflare.SSLCertificatePackListResponse +- cloudflare.SSLCertificatePackDeleteResponse +- cloudflare.SSLCertificatePackEditResponse +- cloudflare.SSLCertificatePackGetResponse + +Methods: + +- client.SSL.CertificatePacks.List(ctx context.Context, params cloudflare.SSLCertificatePackListParams) ([]cloudflare.SSLCertificatePackListResponse, error) +- client.SSL.CertificatePacks.Delete(ctx context.Context, certificatePackID string, body cloudflare.SSLCertificatePackDeleteParams) (cloudflare.SSLCertificatePackDeleteResponse, error) +- client.SSL.CertificatePacks.Edit(ctx context.Context, certificatePackID string, body cloudflare.SSLCertificatePackEditParams) (cloudflare.SSLCertificatePackEditResponse, error) +- client.SSL.CertificatePacks.Get(ctx context.Context, certificatePackID string, query cloudflare.SSLCertificatePackGetParams) (cloudflare.SSLCertificatePackGetResponse, error) + +### Order Response Types: -- cloudflare.LogControlCmbConfigNewResponse -- cloudflare.LogControlCmbConfigDeleteResponse -- cloudflare.LogControlCmbConfigGetResponse +- cloudflare.SSLCertificatePackOrderNewResponse Methods: -- client.Logs.Controls.Cmb.Config.New(ctx context.Context, params cloudflare.LogControlCmbConfigNewParams) (cloudflare.LogControlCmbConfigNewResponse, error) -- client.Logs.Controls.Cmb.Config.Delete(ctx context.Context, body cloudflare.LogControlCmbConfigDeleteParams) (cloudflare.LogControlCmbConfigDeleteResponse, error) -- client.Logs.Controls.Cmb.Config.Get(ctx context.Context, query cloudflare.LogControlCmbConfigGetParams) (cloudflare.LogControlCmbConfigGetResponse, error) +- client.SSL.CertificatePacks.Order.New(ctx context.Context, params cloudflare.SSLCertificatePackOrderNewParams) (cloudflare.SSLCertificatePackOrderNewResponse, error) -## Rayids +### Quota Response Types: -- cloudflare.LogRayidGetResponse +- cloudflare.SSLCertificatePackQuotaListResponse Methods: -- client.Logs.Rayids.Get(ctx context.Context, zoneIdentifier string, rayIdentifier string, query cloudflare.LogRayidGetParams) (cloudflare.LogRayidGetResponse, error) +- client.SSL.CertificatePacks.Quota.List(ctx context.Context, query cloudflare.SSLCertificatePackQuotaListParams) (cloudflare.SSLCertificatePackQuotaListResponse, error) -## Received +## Recommendations Response Types: -- cloudflare.LogReceivedGetResponse +- cloudflare.SSLRecommendationListResponse Methods: -- client.Logs.Received.Get(ctx context.Context, zoneIdentifier string, query cloudflare.LogReceivedGetParams) (cloudflare.LogReceivedGetResponse, error) +- client.SSL.Recommendations.List(ctx context.Context, zoneIdentifier string) (cloudflare.SSLRecommendationListResponse, error) -### Fields +## Universal + +### Settings Response Types: -- cloudflare.LogReceivedFieldListResponse +- cloudflare.SSLUniversalSettingEditResponse +- cloudflare.SSLUniversalSettingGetResponse Methods: -- client.Logs.Received.Fields.List(ctx context.Context, zoneIdentifier string) (cloudflare.LogReceivedFieldListResponse, error) +- client.SSL.Universal.Settings.Edit(ctx context.Context, params cloudflare.SSLUniversalSettingEditParams) (cloudflare.SSLUniversalSettingEditResponse, error) +- client.SSL.Universal.Settings.Get(ctx context.Context, query cloudflare.SSLUniversalSettingGetParams) (cloudflare.SSLUniversalSettingGetResponse, error) -# OriginTLSClientAuth +## Verification Response Types: -- cloudflare.OriginTLSClientAuthNewResponse -- cloudflare.OriginTLSClientAuthListResponse -- cloudflare.OriginTLSClientAuthDeleteResponse -- cloudflare.OriginTLSClientAuthGetResponse +- cloudflare.SSLVerificationListResponse +- cloudflare.SSLVerificationEditResponse Methods: -- client.OriginTLSClientAuth.New(ctx context.Context, params cloudflare.OriginTLSClientAuthNewParams) (cloudflare.OriginTLSClientAuthNewResponse, error) -- client.OriginTLSClientAuth.List(ctx context.Context, query cloudflare.OriginTLSClientAuthListParams) ([]cloudflare.OriginTLSClientAuthListResponse, error) -- client.OriginTLSClientAuth.Delete(ctx context.Context, certificateID string, body cloudflare.OriginTLSClientAuthDeleteParams) (cloudflare.OriginTLSClientAuthDeleteResponse, error) -- client.OriginTLSClientAuth.Get(ctx context.Context, certificateID string, query cloudflare.OriginTLSClientAuthGetParams) (cloudflare.OriginTLSClientAuthGetResponse, error) +- client.SSL.Verification.List(ctx context.Context, params cloudflare.SSLVerificationListParams) ([]cloudflare.SSLVerificationListResponse, error) +- client.SSL.Verification.Edit(ctx context.Context, certificatePackID string, params cloudflare.SSLVerificationEditParams) (cloudflare.SSLVerificationEditResponse, error) -## Hostnames +# Subscriptions Response Types: -- cloudflare.OriginTLSClientAuthHostnameUpdateResponse -- cloudflare.OriginTLSClientAuthHostnameGetResponse +- cloudflare.SubscriptionNewResponse +- cloudflare.SubscriptionUpdateResponse +- cloudflare.SubscriptionListResponse +- cloudflare.SubscriptionDeleteResponse +- cloudflare.SubscriptionGetResponse Methods: -- client.OriginTLSClientAuth.Hostnames.Update(ctx context.Context, params cloudflare.OriginTLSClientAuthHostnameUpdateParams) ([]cloudflare.OriginTLSClientAuthHostnameUpdateResponse, error) -- client.OriginTLSClientAuth.Hostnames.Get(ctx context.Context, hostname string, query cloudflare.OriginTLSClientAuthHostnameGetParams) (cloudflare.OriginTLSClientAuthHostnameGetResponse, error) +- client.Subscriptions.New(ctx context.Context, identifier string, body cloudflare.SubscriptionNewParams) (cloudflare.SubscriptionNewResponse, error) +- client.Subscriptions.Update(ctx context.Context, accountIdentifier string, subscriptionIdentifier string, body cloudflare.SubscriptionUpdateParams) (cloudflare.SubscriptionUpdateResponse, error) +- client.Subscriptions.List(ctx context.Context, accountIdentifier string) ([]cloudflare.SubscriptionListResponse, error) +- client.Subscriptions.Delete(ctx context.Context, accountIdentifier string, subscriptionIdentifier string) (cloudflare.SubscriptionDeleteResponse, error) +- client.Subscriptions.Get(ctx context.Context, identifier string) (cloudflare.SubscriptionGetResponse, error) -### Certificates +# ACM + +## TotalTLS Response Types: -- cloudflare.OriginTLSClientAuthHostnameCertificateNewResponse -- cloudflare.OriginTLSClientAuthHostnameCertificateListResponse -- cloudflare.OriginTLSClientAuthHostnameCertificateDeleteResponse -- cloudflare.OriginTLSClientAuthHostnameCertificateGetResponse +- cloudflare.ACMTotalTLSNewResponse +- cloudflare.ACMTotalTLSGetResponse Methods: -- client.OriginTLSClientAuth.Hostnames.Certificates.New(ctx context.Context, params cloudflare.OriginTLSClientAuthHostnameCertificateNewParams) (cloudflare.OriginTLSClientAuthHostnameCertificateNewResponse, error) -- client.OriginTLSClientAuth.Hostnames.Certificates.List(ctx context.Context, query cloudflare.OriginTLSClientAuthHostnameCertificateListParams) ([]cloudflare.OriginTLSClientAuthHostnameCertificateListResponse, error) -- client.OriginTLSClientAuth.Hostnames.Certificates.Delete(ctx context.Context, certificateID string, body cloudflare.OriginTLSClientAuthHostnameCertificateDeleteParams) (cloudflare.OriginTLSClientAuthHostnameCertificateDeleteResponse, error) -- client.OriginTLSClientAuth.Hostnames.Certificates.Get(ctx context.Context, certificateID string, query cloudflare.OriginTLSClientAuthHostnameCertificateGetParams) (cloudflare.OriginTLSClientAuthHostnameCertificateGetResponse, error) +- client.ACM.TotalTLS.New(ctx context.Context, params cloudflare.ACMTotalTLSNewParams) (cloudflare.ACMTotalTLSNewResponse, error) +- client.ACM.TotalTLS.Get(ctx context.Context, query cloudflare.ACMTotalTLSGetParams) (cloudflare.ACMTotalTLSGetResponse, error) -## Settings +# Argo + +## SmartRouting Response Types: -- cloudflare.OriginTLSClientAuthSettingUpdateResponse -- cloudflare.OriginTLSClientAuthSettingGetResponse +- cloudflare.ArgoSmartRoutingEditResponse +- cloudflare.ArgoSmartRoutingGetResponse Methods: -- client.OriginTLSClientAuth.Settings.Update(ctx context.Context, params cloudflare.OriginTLSClientAuthSettingUpdateParams) (cloudflare.OriginTLSClientAuthSettingUpdateResponse, error) -- client.OriginTLSClientAuth.Settings.Get(ctx context.Context, query cloudflare.OriginTLSClientAuthSettingGetParams) (cloudflare.OriginTLSClientAuthSettingGetResponse, error) +- client.Argo.SmartRouting.Edit(ctx context.Context, params cloudflare.ArgoSmartRoutingEditParams) (cloudflare.ArgoSmartRoutingEditResponse, error) +- client.Argo.SmartRouting.Get(ctx context.Context, query cloudflare.ArgoSmartRoutingGetParams) (cloudflare.ArgoSmartRoutingGetResponse, error) -# Pagerules +## TieredCaching Response Types: -- cloudflare.PageruleNewResponse -- cloudflare.PageruleUpdateResponse -- cloudflare.PageruleListResponse -- cloudflare.PageruleDeleteResponse -- cloudflare.PageruleEditResponse -- cloudflare.PageruleGetResponse +- cloudflare.ArgoTieredCachingEditResponse +- cloudflare.ArgoTieredCachingGetResponse Methods: -- client.Pagerules.New(ctx context.Context, params cloudflare.PageruleNewParams) (cloudflare.PageruleNewResponse, error) -- client.Pagerules.Update(ctx context.Context, pageruleID string, params cloudflare.PageruleUpdateParams) (cloudflare.PageruleUpdateResponse, error) -- client.Pagerules.List(ctx context.Context, params cloudflare.PageruleListParams) ([]cloudflare.PageruleListResponse, error) -- client.Pagerules.Delete(ctx context.Context, pageruleID string, body cloudflare.PageruleDeleteParams) (cloudflare.PageruleDeleteResponse, error) -- client.Pagerules.Edit(ctx context.Context, pageruleID string, params cloudflare.PageruleEditParams) (cloudflare.PageruleEditResponse, error) -- client.Pagerules.Get(ctx context.Context, pageruleID string, query cloudflare.PageruleGetParams) (cloudflare.PageruleGetResponse, error) +- client.Argo.TieredCaching.Edit(ctx context.Context, params cloudflare.ArgoTieredCachingEditParams) (cloudflare.ArgoTieredCachingEditResponse, error) +- client.Argo.TieredCaching.Get(ctx context.Context, query cloudflare.ArgoTieredCachingGetParams) (cloudflare.ArgoTieredCachingGetResponse, error) -## Settings +# AvailablePlans Response Types: -- cloudflare.PageruleSettingListResponse +- cloudflare.AvailablePlanListResponse +- cloudflare.AvailablePlanGetResponse Methods: -- client.Pagerules.Settings.List(ctx context.Context, query cloudflare.PageruleSettingListParams) ([]cloudflare.PageruleSettingListResponse, error) +- client.AvailablePlans.List(ctx context.Context, zoneIdentifier string) ([]cloudflare.AvailablePlanListResponse, error) +- client.AvailablePlans.Get(ctx context.Context, zoneIdentifier string, planIdentifier string) (cloudflare.AvailablePlanGetResponse, error) -# RateLimits +# AvailableRatePlans Response Types: -- cloudflare.RateLimitNewResponse -- cloudflare.RateLimitListResponse -- cloudflare.RateLimitDeleteResponse -- cloudflare.RateLimitEditResponse -- cloudflare.RateLimitGetResponse +- cloudflare.AvailableRatePlanListResponse Methods: -- client.RateLimits.New(ctx context.Context, zoneIdentifier string, body cloudflare.RateLimitNewParams) (cloudflare.RateLimitNewResponse, error) -- client.RateLimits.List(ctx context.Context, zoneIdentifier string, query cloudflare.RateLimitListParams) (shared.V4PagePaginationArray[cloudflare.RateLimitListResponse], error) -- client.RateLimits.Delete(ctx context.Context, zoneIdentifier string, id string) (cloudflare.RateLimitDeleteResponse, error) -- client.RateLimits.Edit(ctx context.Context, zoneIdentifier string, id string, body cloudflare.RateLimitEditParams) (cloudflare.RateLimitEditResponse, error) -- client.RateLimits.Get(ctx context.Context, zoneIdentifier string, id string) (cloudflare.RateLimitGetResponse, error) +- client.AvailableRatePlans.List(ctx context.Context, zoneIdentifier string) ([]cloudflare.AvailableRatePlanListResponse, error) -# SecondaryDNS +# CertificateAuthorities -## ForceAxfrs +## HostnameAssociations + +Response Types: + +- cloudflare.CertificateAuthorityHostnameAssociationUpdateResponse +- cloudflare.CertificateAuthorityHostnameAssociationListResponse Methods: -- client.SecondaryDNS.ForceAxfrs.New(ctx context.Context, body cloudflare.SecondaryDNSForceAxfrNewParams) (string, error) +- client.CertificateAuthorities.HostnameAssociations.Update(ctx context.Context, params cloudflare.CertificateAuthorityHostnameAssociationUpdateParams) (cloudflare.CertificateAuthorityHostnameAssociationUpdateResponse, error) +- client.CertificateAuthorities.HostnameAssociations.List(ctx context.Context, params cloudflare.CertificateAuthorityHostnameAssociationListParams) (cloudflare.CertificateAuthorityHostnameAssociationListResponse, error) -## Incoming +# ClientCertificates Response Types: -- cloudflare.SecondaryDNSIncomingNewResponse -- cloudflare.SecondaryDNSIncomingUpdateResponse -- cloudflare.SecondaryDNSIncomingDeleteResponse -- cloudflare.SecondaryDNSIncomingGetResponse +- cloudflare.ClientCertificateNewResponse +- cloudflare.ClientCertificateListResponse +- cloudflare.ClientCertificateDeleteResponse +- cloudflare.ClientCertificateEditResponse +- cloudflare.ClientCertificateGetResponse Methods: -- client.SecondaryDNS.Incoming.New(ctx context.Context, params cloudflare.SecondaryDNSIncomingNewParams) (cloudflare.SecondaryDNSIncomingNewResponse, error) -- client.SecondaryDNS.Incoming.Update(ctx context.Context, params cloudflare.SecondaryDNSIncomingUpdateParams) (cloudflare.SecondaryDNSIncomingUpdateResponse, error) -- client.SecondaryDNS.Incoming.Delete(ctx context.Context, body cloudflare.SecondaryDNSIncomingDeleteParams) (cloudflare.SecondaryDNSIncomingDeleteResponse, error) -- client.SecondaryDNS.Incoming.Get(ctx context.Context, query cloudflare.SecondaryDNSIncomingGetParams) (cloudflare.SecondaryDNSIncomingGetResponse, error) +- client.ClientCertificates.New(ctx context.Context, params cloudflare.ClientCertificateNewParams) (cloudflare.ClientCertificateNewResponse, error) +- client.ClientCertificates.List(ctx context.Context, params cloudflare.ClientCertificateListParams) (shared.V4PagePaginationArray[cloudflare.ClientCertificateListResponse], error) +- client.ClientCertificates.Delete(ctx context.Context, clientCertificateID string, body cloudflare.ClientCertificateDeleteParams) (cloudflare.ClientCertificateDeleteResponse, error) +- client.ClientCertificates.Edit(ctx context.Context, clientCertificateID string, body cloudflare.ClientCertificateEditParams) (cloudflare.ClientCertificateEditResponse, error) +- client.ClientCertificates.Get(ctx context.Context, clientCertificateID string, query cloudflare.ClientCertificateGetParams) (cloudflare.ClientCertificateGetResponse, error) -## Outgoing +# CustomCertificates Response Types: -- cloudflare.SecondaryDNSOutgoingNewResponse -- cloudflare.SecondaryDNSOutgoingUpdateResponse -- cloudflare.SecondaryDNSOutgoingDeleteResponse -- cloudflare.SecondaryDNSOutgoingGetResponse +- cloudflare.CustomCertificateNewResponse +- cloudflare.CustomCertificateListResponse +- cloudflare.CustomCertificateDeleteResponse +- cloudflare.CustomCertificateEditResponse +- cloudflare.CustomCertificateGetResponse Methods: -- client.SecondaryDNS.Outgoing.New(ctx context.Context, params cloudflare.SecondaryDNSOutgoingNewParams) (cloudflare.SecondaryDNSOutgoingNewResponse, error) -- client.SecondaryDNS.Outgoing.Update(ctx context.Context, params cloudflare.SecondaryDNSOutgoingUpdateParams) (cloudflare.SecondaryDNSOutgoingUpdateResponse, error) -- client.SecondaryDNS.Outgoing.Delete(ctx context.Context, body cloudflare.SecondaryDNSOutgoingDeleteParams) (cloudflare.SecondaryDNSOutgoingDeleteResponse, error) -- client.SecondaryDNS.Outgoing.Disable(ctx context.Context, body cloudflare.SecondaryDNSOutgoingDisableParams) (string, error) -- client.SecondaryDNS.Outgoing.Enable(ctx context.Context, body cloudflare.SecondaryDNSOutgoingEnableParams) (string, error) -- client.SecondaryDNS.Outgoing.ForceNotify(ctx context.Context, body cloudflare.SecondaryDNSOutgoingForceNotifyParams) (string, error) -- client.SecondaryDNS.Outgoing.Get(ctx context.Context, query cloudflare.SecondaryDNSOutgoingGetParams) (cloudflare.SecondaryDNSOutgoingGetResponse, error) +- client.CustomCertificates.New(ctx context.Context, params cloudflare.CustomCertificateNewParams) (cloudflare.CustomCertificateNewResponse, error) +- client.CustomCertificates.List(ctx context.Context, params cloudflare.CustomCertificateListParams) (shared.V4PagePaginationArray[cloudflare.CustomCertificateListResponse], error) +- client.CustomCertificates.Delete(ctx context.Context, customCertificateID string, body cloudflare.CustomCertificateDeleteParams) (cloudflare.CustomCertificateDeleteResponse, error) +- client.CustomCertificates.Edit(ctx context.Context, customCertificateID string, params cloudflare.CustomCertificateEditParams) (cloudflare.CustomCertificateEditResponse, error) +- client.CustomCertificates.Get(ctx context.Context, customCertificateID string, query cloudflare.CustomCertificateGetParams) (cloudflare.CustomCertificateGetResponse, error) -### Status +## Prioritize + +Response Types: + +- cloudflare.CustomCertificatePrioritizeUpdateResponse Methods: -- client.SecondaryDNS.Outgoing.Status.Get(ctx context.Context, query cloudflare.SecondaryDNSOutgoingStatusGetParams) (string, error) +- client.CustomCertificates.Prioritize.Update(ctx context.Context, params cloudflare.CustomCertificatePrioritizeUpdateParams) ([]cloudflare.CustomCertificatePrioritizeUpdateResponse, error) -## ACLs +# CustomHostnames Response Types: -- cloudflare.SecondaryDnsaclNewResponse -- cloudflare.SecondaryDnsaclUpdateResponse -- cloudflare.SecondaryDnsaclListResponse -- cloudflare.SecondaryDnsaclDeleteResponse -- cloudflare.SecondaryDnsaclGetResponse +- cloudflare.CustomHostnameNewResponse +- cloudflare.CustomHostnameListResponse +- cloudflare.CustomHostnameDeleteResponse +- cloudflare.CustomHostnameEditResponse +- cloudflare.CustomHostnameGetResponse Methods: -- client.SecondaryDNS.ACLs.New(ctx context.Context, params cloudflare.SecondaryDNSACLNewParams) (cloudflare.SecondaryDnsaclNewResponse, error) -- client.SecondaryDNS.ACLs.Update(ctx context.Context, aclID interface{}, params cloudflare.SecondaryDNSACLUpdateParams) (cloudflare.SecondaryDnsaclUpdateResponse, error) -- client.SecondaryDNS.ACLs.List(ctx context.Context, query cloudflare.SecondaryDNSACLListParams) ([]cloudflare.SecondaryDnsaclListResponse, error) -- client.SecondaryDNS.ACLs.Delete(ctx context.Context, aclID interface{}, body cloudflare.SecondaryDNSACLDeleteParams) (cloudflare.SecondaryDnsaclDeleteResponse, error) -- client.SecondaryDNS.ACLs.Get(ctx context.Context, aclID interface{}, query cloudflare.SecondaryDNSACLGetParams) (cloudflare.SecondaryDnsaclGetResponse, error) +- client.CustomHostnames.New(ctx context.Context, params cloudflare.CustomHostnameNewParams) (cloudflare.CustomHostnameNewResponse, error) +- client.CustomHostnames.List(ctx context.Context, params cloudflare.CustomHostnameListParams) (shared.V4PagePaginationArray[cloudflare.CustomHostnameListResponse], error) +- client.CustomHostnames.Delete(ctx context.Context, customHostnameID string, body cloudflare.CustomHostnameDeleteParams) (cloudflare.CustomHostnameDeleteResponse, error) +- client.CustomHostnames.Edit(ctx context.Context, customHostnameID string, params cloudflare.CustomHostnameEditParams) (cloudflare.CustomHostnameEditResponse, error) +- client.CustomHostnames.Get(ctx context.Context, customHostnameID string, query cloudflare.CustomHostnameGetParams) (cloudflare.CustomHostnameGetResponse, error) -## Peers +## FallbackOrigin Response Types: -- cloudflare.SecondaryDNSPeerNewResponse -- cloudflare.SecondaryDNSPeerUpdateResponse -- cloudflare.SecondaryDNSPeerListResponse -- cloudflare.SecondaryDNSPeerDeleteResponse -- cloudflare.SecondaryDNSPeerGetResponse +- cloudflare.CustomHostnameFallbackOriginUpdateResponse +- cloudflare.CustomHostnameFallbackOriginDeleteResponse +- cloudflare.CustomHostnameFallbackOriginGetResponse Methods: -- client.SecondaryDNS.Peers.New(ctx context.Context, params cloudflare.SecondaryDNSPeerNewParams) (cloudflare.SecondaryDNSPeerNewResponse, error) -- client.SecondaryDNS.Peers.Update(ctx context.Context, peerID interface{}, params cloudflare.SecondaryDNSPeerUpdateParams) (cloudflare.SecondaryDNSPeerUpdateResponse, error) -- client.SecondaryDNS.Peers.List(ctx context.Context, query cloudflare.SecondaryDNSPeerListParams) ([]cloudflare.SecondaryDNSPeerListResponse, error) -- client.SecondaryDNS.Peers.Delete(ctx context.Context, peerID interface{}, body cloudflare.SecondaryDNSPeerDeleteParams) (cloudflare.SecondaryDNSPeerDeleteResponse, error) -- client.SecondaryDNS.Peers.Get(ctx context.Context, peerID interface{}, query cloudflare.SecondaryDNSPeerGetParams) (cloudflare.SecondaryDNSPeerGetResponse, error) +- client.CustomHostnames.FallbackOrigin.Update(ctx context.Context, params cloudflare.CustomHostnameFallbackOriginUpdateParams) (cloudflare.CustomHostnameFallbackOriginUpdateResponse, error) +- client.CustomHostnames.FallbackOrigin.Delete(ctx context.Context, body cloudflare.CustomHostnameFallbackOriginDeleteParams) (cloudflare.CustomHostnameFallbackOriginDeleteResponse, error) +- client.CustomHostnames.FallbackOrigin.Get(ctx context.Context, query cloudflare.CustomHostnameFallbackOriginGetParams) (cloudflare.CustomHostnameFallbackOriginGetResponse, error) -## TSIGs +# CustomNameservers Response Types: -- cloudflare.SecondaryDnstsigNewResponse -- cloudflare.SecondaryDnstsigUpdateResponse -- cloudflare.SecondaryDnstsigListResponse -- cloudflare.SecondaryDnstsigDeleteResponse -- cloudflare.SecondaryDnstsigGetResponse +- cloudflare.CustomNameserverNewResponse +- cloudflare.CustomNameserverListResponse +- cloudflare.CustomNameserverDeleteResponse +- cloudflare.CustomNameserverVerifyResponse Methods: -- client.SecondaryDNS.TSIGs.New(ctx context.Context, params cloudflare.SecondaryDNSTSIGNewParams) (cloudflare.SecondaryDnstsigNewResponse, error) -- client.SecondaryDNS.TSIGs.Update(ctx context.Context, tsigID interface{}, params cloudflare.SecondaryDNSTSIGUpdateParams) (cloudflare.SecondaryDnstsigUpdateResponse, error) -- client.SecondaryDNS.TSIGs.List(ctx context.Context, query cloudflare.SecondaryDNSTSIGListParams) ([]cloudflare.SecondaryDnstsigListResponse, error) -- client.SecondaryDNS.TSIGs.Delete(ctx context.Context, tsigID interface{}, body cloudflare.SecondaryDNSTSIGDeleteParams) (cloudflare.SecondaryDnstsigDeleteResponse, error) -- client.SecondaryDNS.TSIGs.Get(ctx context.Context, tsigID interface{}, query cloudflare.SecondaryDNSTSIGGetParams) (cloudflare.SecondaryDnstsigGetResponse, error) +- client.CustomNameservers.New(ctx context.Context, params cloudflare.CustomNameserverNewParams) (cloudflare.CustomNameserverNewResponse, error) +- client.CustomNameservers.List(ctx context.Context, query cloudflare.CustomNameserverListParams) ([]cloudflare.CustomNameserverListResponse, error) +- client.CustomNameservers.Delete(ctx context.Context, customNsID string, body cloudflare.CustomNameserverDeleteParams) (cloudflare.CustomNameserverDeleteResponse, error) +- client.CustomNameservers.Availabilty(ctx context.Context, query cloudflare.CustomNameserverAvailabiltyParams) ([]string, error) +- client.CustomNameservers.Verify(ctx context.Context, body cloudflare.CustomNameserverVerifyParams) ([]cloudflare.CustomNameserverVerifyResponse, error) -# Settings +# DNS + +## Records Response Types: -- cloudflare.SettingListResponse -- cloudflare.SettingEditResponse +- cloudflare.DNSRecordNewResponse +- cloudflare.DNSRecordUpdateResponse +- cloudflare.DNSRecordListResponse +- cloudflare.DNSRecordDeleteResponse +- cloudflare.DNSRecordEditResponse +- cloudflare.DNSRecordGetResponse +- cloudflare.DNSRecordImportResponse +- cloudflare.DNSRecordScanResponse Methods: -- client.Settings.List(ctx context.Context, query cloudflare.SettingListParams) ([]cloudflare.SettingListResponse, error) -- client.Settings.Edit(ctx context.Context, params cloudflare.SettingEditParams) ([]cloudflare.SettingEditResponse, error) +- client.DNS.Records.New(ctx context.Context, params cloudflare.DNSRecordNewParams) (cloudflare.DNSRecordNewResponse, error) +- client.DNS.Records.Update(ctx context.Context, dnsRecordID string, params cloudflare.DNSRecordUpdateParams) (cloudflare.DNSRecordUpdateResponse, error) +- client.DNS.Records.List(ctx context.Context, params cloudflare.DNSRecordListParams) (shared.V4PagePaginationArray[cloudflare.DNSRecordListResponse], error) +- client.DNS.Records.Delete(ctx context.Context, dnsRecordID string, body cloudflare.DNSRecordDeleteParams) (cloudflare.DNSRecordDeleteResponse, error) +- client.DNS.Records.Edit(ctx context.Context, dnsRecordID string, params cloudflare.DNSRecordEditParams) (cloudflare.DNSRecordEditResponse, error) +- client.DNS.Records.Export(ctx context.Context, query cloudflare.DNSRecordExportParams) (string, error) +- client.DNS.Records.Get(ctx context.Context, dnsRecordID string, query cloudflare.DNSRecordGetParams) (cloudflare.DNSRecordGetResponse, error) +- client.DNS.Records.Import(ctx context.Context, params cloudflare.DNSRecordImportParams) (cloudflare.DNSRecordImportResponse, error) +- client.DNS.Records.Scan(ctx context.Context, body cloudflare.DNSRecordScanParams) (cloudflare.DNSRecordScanResponse, error) + +## Analytics -## ZeroRTT +### Reports Response Types: -- cloudflare.SettingZeroRTTEditResponse -- cloudflare.SettingZeroRTTGetResponse +- cloudflare.DNSAnalyticsReportListResponse Methods: -- client.Settings.ZeroRTT.Edit(ctx context.Context, params cloudflare.SettingZeroRTTEditParams) (cloudflare.SettingZeroRTTEditResponse, error) -- client.Settings.ZeroRTT.Get(ctx context.Context, query cloudflare.SettingZeroRTTGetParams) (cloudflare.SettingZeroRTTGetResponse, error) +- client.DNS.Analytics.Reports.List(ctx context.Context, identifier string, query cloudflare.DNSAnalyticsReportListParams) (cloudflare.DNSAnalyticsReportListResponse, error) -## AdvancedDDOS +#### Bytimes Response Types: -- cloudflare.SettingAdvancedDDOSGetResponse +- cloudflare.DNSAnalyticsReportBytimeListResponse Methods: -- client.Settings.AdvancedDDOS.Get(ctx context.Context, query cloudflare.SettingAdvancedDDOSGetParams) (cloudflare.SettingAdvancedDDOSGetResponse, error) +- client.DNS.Analytics.Reports.Bytimes.List(ctx context.Context, identifier string, query cloudflare.DNSAnalyticsReportBytimeListParams) (cloudflare.DNSAnalyticsReportBytimeListResponse, error) -## AlwaysOnline +## Firewall Response Types: -- cloudflare.SettingAlwaysOnlineEditResponse -- cloudflare.SettingAlwaysOnlineGetResponse +- cloudflare.DNSFirewallNewResponse +- cloudflare.DNSFirewallListResponse +- cloudflare.DNSFirewallDeleteResponse +- cloudflare.DNSFirewallEditResponse +- cloudflare.DNSFirewallGetResponse Methods: -- client.Settings.AlwaysOnline.Edit(ctx context.Context, params cloudflare.SettingAlwaysOnlineEditParams) (cloudflare.SettingAlwaysOnlineEditResponse, error) -- client.Settings.AlwaysOnline.Get(ctx context.Context, query cloudflare.SettingAlwaysOnlineGetParams) (cloudflare.SettingAlwaysOnlineGetResponse, error) +- client.DNS.Firewall.New(ctx context.Context, params cloudflare.DNSFirewallNewParams) (cloudflare.DNSFirewallNewResponse, error) +- client.DNS.Firewall.List(ctx context.Context, params cloudflare.DNSFirewallListParams) (shared.V4PagePaginationArray[cloudflare.DNSFirewallListResponse], error) +- client.DNS.Firewall.Delete(ctx context.Context, dnsFirewallID string, body cloudflare.DNSFirewallDeleteParams) (cloudflare.DNSFirewallDeleteResponse, error) +- client.DNS.Firewall.Edit(ctx context.Context, dnsFirewallID string, params cloudflare.DNSFirewallEditParams) (cloudflare.DNSFirewallEditResponse, error) +- client.DNS.Firewall.Get(ctx context.Context, dnsFirewallID string, query cloudflare.DNSFirewallGetParams) (cloudflare.DNSFirewallGetResponse, error) + +### Analytics -## AlwaysUseHTTPS +#### Reports Response Types: -- cloudflare.SettingAlwaysUseHTTPSEditResponse -- cloudflare.SettingAlwaysUseHTTPSGetResponse +- cloudflare.DNSFirewallAnalyticsReportListResponse Methods: -- client.Settings.AlwaysUseHTTPS.Edit(ctx context.Context, params cloudflare.SettingAlwaysUseHTTPSEditParams) (cloudflare.SettingAlwaysUseHTTPSEditResponse, error) -- client.Settings.AlwaysUseHTTPS.Get(ctx context.Context, query cloudflare.SettingAlwaysUseHTTPSGetParams) (cloudflare.SettingAlwaysUseHTTPSGetResponse, error) +- client.DNS.Firewall.Analytics.Reports.List(ctx context.Context, accountIdentifier string, identifier string, query cloudflare.DNSFirewallAnalyticsReportListParams) (cloudflare.DNSFirewallAnalyticsReportListResponse, error) -## AutomaticHTTPSRewrites +##### Bytimes Response Types: -- cloudflare.SettingAutomaticHTTPSRewriteEditResponse -- cloudflare.SettingAutomaticHTTPSRewriteGetResponse +- cloudflare.DNSFirewallAnalyticsReportBytimeListResponse Methods: -- client.Settings.AutomaticHTTPSRewrites.Edit(ctx context.Context, params cloudflare.SettingAutomaticHTTPSRewriteEditParams) (cloudflare.SettingAutomaticHTTPSRewriteEditResponse, error) -- client.Settings.AutomaticHTTPSRewrites.Get(ctx context.Context, query cloudflare.SettingAutomaticHTTPSRewriteGetParams) (cloudflare.SettingAutomaticHTTPSRewriteGetResponse, error) +- client.DNS.Firewall.Analytics.Reports.Bytimes.List(ctx context.Context, accountIdentifier string, identifier string, query cloudflare.DNSFirewallAnalyticsReportBytimeListParams) (cloudflare.DNSFirewallAnalyticsReportBytimeListResponse, error) -## AutomaticPlatformOptimization +# DNSSEC Response Types: -- cloudflare.SettingAutomaticPlatformOptimizationEditResponse -- cloudflare.SettingAutomaticPlatformOptimizationGetResponse +- cloudflare.DNSSECDeleteResponse +- cloudflare.DNSSECEditResponse +- cloudflare.DNSSECGetResponse Methods: -- client.Settings.AutomaticPlatformOptimization.Edit(ctx context.Context, params cloudflare.SettingAutomaticPlatformOptimizationEditParams) (cloudflare.SettingAutomaticPlatformOptimizationEditResponse, error) -- client.Settings.AutomaticPlatformOptimization.Get(ctx context.Context, query cloudflare.SettingAutomaticPlatformOptimizationGetParams) (cloudflare.SettingAutomaticPlatformOptimizationGetResponse, error) +- client.DNSSEC.Delete(ctx context.Context, body cloudflare.DNSSECDeleteParams) (cloudflare.DNSSECDeleteResponse, error) +- client.DNSSEC.Edit(ctx context.Context, params cloudflare.DNSSECEditParams) (cloudflare.DNSSECEditResponse, error) +- client.DNSSEC.Get(ctx context.Context, query cloudflare.DNSSECGetParams) (cloudflare.DNSSECGetResponse, error) + +# Emails -## Brotli +## Routing Response Types: -- cloudflare.SettingBrotliEditResponse -- cloudflare.SettingBrotliGetResponse +- cloudflare.EmailRoutingGetResponse Methods: -- client.Settings.Brotli.Edit(ctx context.Context, params cloudflare.SettingBrotliEditParams) (cloudflare.SettingBrotliEditResponse, error) -- client.Settings.Brotli.Get(ctx context.Context, query cloudflare.SettingBrotliGetParams) (cloudflare.SettingBrotliGetResponse, error) +- client.Emails.Routing.Get(ctx context.Context, zoneIdentifier string) (cloudflare.EmailRoutingGetResponse, error) -## BrowserCacheTTL +### Disables Response Types: -- cloudflare.SettingBrowserCacheTTLEditResponse -- cloudflare.SettingBrowserCacheTTLGetResponse +- cloudflare.EmailRoutingDisableNewResponse Methods: -- client.Settings.BrowserCacheTTL.Edit(ctx context.Context, params cloudflare.SettingBrowserCacheTTLEditParams) (cloudflare.SettingBrowserCacheTTLEditResponse, error) -- client.Settings.BrowserCacheTTL.Get(ctx context.Context, query cloudflare.SettingBrowserCacheTTLGetParams) (cloudflare.SettingBrowserCacheTTLGetResponse, error) +- client.Emails.Routing.Disables.New(ctx context.Context, zoneIdentifier string) (cloudflare.EmailRoutingDisableNewResponse, error) -## BrowserCheck +### DNS Response Types: -- cloudflare.SettingBrowserCheckEditResponse -- cloudflare.SettingBrowserCheckGetResponse +- cloudflare.EmailRoutingDNSGetResponse Methods: -- client.Settings.BrowserCheck.Edit(ctx context.Context, params cloudflare.SettingBrowserCheckEditParams) (cloudflare.SettingBrowserCheckEditResponse, error) -- client.Settings.BrowserCheck.Get(ctx context.Context, query cloudflare.SettingBrowserCheckGetParams) (cloudflare.SettingBrowserCheckGetResponse, error) +- client.Emails.Routing.DNS.Get(ctx context.Context, zoneIdentifier string) ([]cloudflare.EmailRoutingDNSGetResponse, error) -## CacheLevel +### Enables Response Types: -- cloudflare.SettingCacheLevelEditResponse -- cloudflare.SettingCacheLevelGetResponse +- cloudflare.EmailRoutingEnableNewResponse Methods: -- client.Settings.CacheLevel.Edit(ctx context.Context, params cloudflare.SettingCacheLevelEditParams) (cloudflare.SettingCacheLevelEditResponse, error) -- client.Settings.CacheLevel.Get(ctx context.Context, query cloudflare.SettingCacheLevelGetParams) (cloudflare.SettingCacheLevelGetResponse, error) +- client.Emails.Routing.Enables.New(ctx context.Context, zoneIdentifier string) (cloudflare.EmailRoutingEnableNewResponse, error) -## ChallengeTTL +### Rules Response Types: -- cloudflare.SettingChallengeTTLEditResponse -- cloudflare.SettingChallengeTTLGetResponse +- cloudflare.EmailRoutingRuleNewResponse +- cloudflare.EmailRoutingRuleUpdateResponse +- cloudflare.EmailRoutingRuleListResponse +- cloudflare.EmailRoutingRuleDeleteResponse +- cloudflare.EmailRoutingRuleGetResponse Methods: -- client.Settings.ChallengeTTL.Edit(ctx context.Context, params cloudflare.SettingChallengeTTLEditParams) (cloudflare.SettingChallengeTTLEditResponse, error) -- client.Settings.ChallengeTTL.Get(ctx context.Context, query cloudflare.SettingChallengeTTLGetParams) (cloudflare.SettingChallengeTTLGetResponse, error) +- client.Emails.Routing.Rules.New(ctx context.Context, zoneIdentifier string, body cloudflare.EmailRoutingRuleNewParams) (cloudflare.EmailRoutingRuleNewResponse, error) +- client.Emails.Routing.Rules.Update(ctx context.Context, zoneIdentifier string, ruleIdentifier string, body cloudflare.EmailRoutingRuleUpdateParams) (cloudflare.EmailRoutingRuleUpdateResponse, error) +- client.Emails.Routing.Rules.List(ctx context.Context, zoneIdentifier string, query cloudflare.EmailRoutingRuleListParams) (shared.V4PagePaginationArray[cloudflare.EmailRoutingRuleListResponse], error) +- client.Emails.Routing.Rules.Delete(ctx context.Context, zoneIdentifier string, ruleIdentifier string) (cloudflare.EmailRoutingRuleDeleteResponse, error) +- client.Emails.Routing.Rules.Get(ctx context.Context, zoneIdentifier string, ruleIdentifier string) (cloudflare.EmailRoutingRuleGetResponse, error) -## Ciphers +#### CatchAlls Response Types: -- cloudflare.SettingCipherEditResponse -- cloudflare.SettingCipherGetResponse +- cloudflare.EmailRoutingRuleCatchAllUpdateResponse +- cloudflare.EmailRoutingRuleCatchAllGetResponse Methods: -- client.Settings.Ciphers.Edit(ctx context.Context, params cloudflare.SettingCipherEditParams) (cloudflare.SettingCipherEditResponse, error) -- client.Settings.Ciphers.Get(ctx context.Context, query cloudflare.SettingCipherGetParams) (cloudflare.SettingCipherGetResponse, error) +- client.Emails.Routing.Rules.CatchAlls.Update(ctx context.Context, zoneIdentifier string, body cloudflare.EmailRoutingRuleCatchAllUpdateParams) (cloudflare.EmailRoutingRuleCatchAllUpdateResponse, error) +- client.Emails.Routing.Rules.CatchAlls.Get(ctx context.Context, zoneIdentifier string) (cloudflare.EmailRoutingRuleCatchAllGetResponse, error) -## DevelopmentMode +### Addresses Response Types: -- cloudflare.SettingDevelopmentModeEditResponse -- cloudflare.SettingDevelopmentModeGetResponse +- cloudflare.EmailRoutingAddressNewResponse +- cloudflare.EmailRoutingAddressDeleteResponse +- cloudflare.EmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesResponse +- cloudflare.EmailRoutingAddressGetResponse Methods: -- client.Settings.DevelopmentMode.Edit(ctx context.Context, params cloudflare.SettingDevelopmentModeEditParams) (cloudflare.SettingDevelopmentModeEditResponse, error) -- client.Settings.DevelopmentMode.Get(ctx context.Context, query cloudflare.SettingDevelopmentModeGetParams) (cloudflare.SettingDevelopmentModeGetResponse, error) +- client.Emails.Routing.Addresses.New(ctx context.Context, accountIdentifier string, body cloudflare.EmailRoutingAddressNewParams) (cloudflare.EmailRoutingAddressNewResponse, error) +- client.Emails.Routing.Addresses.Delete(ctx context.Context, accountIdentifier string, destinationAddressIdentifier string) (cloudflare.EmailRoutingAddressDeleteResponse, error) +- client.Emails.Routing.Addresses.EmailRoutingDestinationAddressesListDestinationAddresses(ctx context.Context, accountIdentifier string, query cloudflare.EmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesParams) ([]cloudflare.EmailRoutingAddressEmailRoutingDestinationAddressesListDestinationAddressesResponse, error) +- client.Emails.Routing.Addresses.Get(ctx context.Context, accountIdentifier string, destinationAddressIdentifier string) (cloudflare.EmailRoutingAddressGetResponse, error) -## EarlyHints +# Filters Response Types: -- cloudflare.SettingEarlyHintEditResponse -- cloudflare.SettingEarlyHintGetResponse +- cloudflare.FilterNewResponse +- cloudflare.FilterUpdateResponse +- cloudflare.FilterListResponse +- cloudflare.FilterDeleteResponse +- cloudflare.FilterGetResponse Methods: -- client.Settings.EarlyHints.Edit(ctx context.Context, params cloudflare.SettingEarlyHintEditParams) (cloudflare.SettingEarlyHintEditResponse, error) -- client.Settings.EarlyHints.Get(ctx context.Context, query cloudflare.SettingEarlyHintGetParams) (cloudflare.SettingEarlyHintGetResponse, error) +- client.Filters.New(ctx context.Context, zoneIdentifier string, body cloudflare.FilterNewParams) ([]cloudflare.FilterNewResponse, error) +- client.Filters.Update(ctx context.Context, zoneIdentifier string, id string, body cloudflare.FilterUpdateParams) (cloudflare.FilterUpdateResponse, error) +- client.Filters.List(ctx context.Context, zoneIdentifier string, query cloudflare.FilterListParams) (shared.V4PagePaginationArray[cloudflare.FilterListResponse], error) +- client.Filters.Delete(ctx context.Context, zoneIdentifier string, id string) (cloudflare.FilterDeleteResponse, error) +- client.Filters.Get(ctx context.Context, zoneIdentifier string, id string) (cloudflare.FilterGetResponse, error) + +# Firewall -## EmailObfuscation +## Lockdowns Response Types: -- cloudflare.SettingEmailObfuscationEditResponse -- cloudflare.SettingEmailObfuscationGetResponse +- cloudflare.FirewallLockdownNewResponse +- cloudflare.FirewallLockdownUpdateResponse +- cloudflare.FirewallLockdownListResponse +- cloudflare.FirewallLockdownDeleteResponse +- cloudflare.FirewallLockdownGetResponse Methods: -- client.Settings.EmailObfuscation.Edit(ctx context.Context, params cloudflare.SettingEmailObfuscationEditParams) (cloudflare.SettingEmailObfuscationEditResponse, error) -- client.Settings.EmailObfuscation.Get(ctx context.Context, query cloudflare.SettingEmailObfuscationGetParams) (cloudflare.SettingEmailObfuscationGetResponse, error) +- client.Firewall.Lockdowns.New(ctx context.Context, zoneIdentifier string, body cloudflare.FirewallLockdownNewParams) (cloudflare.FirewallLockdownNewResponse, error) +- client.Firewall.Lockdowns.Update(ctx context.Context, zoneIdentifier string, id string, body cloudflare.FirewallLockdownUpdateParams) (cloudflare.FirewallLockdownUpdateResponse, error) +- client.Firewall.Lockdowns.List(ctx context.Context, zoneIdentifier string, query cloudflare.FirewallLockdownListParams) (shared.V4PagePaginationArray[cloudflare.FirewallLockdownListResponse], error) +- client.Firewall.Lockdowns.Delete(ctx context.Context, zoneIdentifier string, id string) (cloudflare.FirewallLockdownDeleteResponse, error) +- client.Firewall.Lockdowns.Get(ctx context.Context, zoneIdentifier string, id string) (cloudflare.FirewallLockdownGetResponse, error) -## H2Prioritization +## Rules Response Types: -- cloudflare.SettingH2PrioritizationEditResponse -- cloudflare.SettingH2PrioritizationGetResponse +- cloudflare.FirewallRuleNewResponse +- cloudflare.FirewallRuleUpdateResponse +- cloudflare.FirewallRuleListResponse +- cloudflare.FirewallRuleDeleteResponse +- cloudflare.FirewallRuleEditResponse +- cloudflare.FirewallRuleGetResponse Methods: -- client.Settings.H2Prioritization.Edit(ctx context.Context, params cloudflare.SettingH2PrioritizationEditParams) (cloudflare.SettingH2PrioritizationEditResponse, error) -- client.Settings.H2Prioritization.Get(ctx context.Context, query cloudflare.SettingH2PrioritizationGetParams) (cloudflare.SettingH2PrioritizationGetResponse, error) +- client.Firewall.Rules.New(ctx context.Context, zoneIdentifier string, body cloudflare.FirewallRuleNewParams) ([]cloudflare.FirewallRuleNewResponse, error) +- client.Firewall.Rules.Update(ctx context.Context, zoneIdentifier string, id string, body cloudflare.FirewallRuleUpdateParams) (cloudflare.FirewallRuleUpdateResponse, error) +- client.Firewall.Rules.List(ctx context.Context, zoneIdentifier string, query cloudflare.FirewallRuleListParams) (shared.V4PagePaginationArray[cloudflare.FirewallRuleListResponse], error) +- client.Firewall.Rules.Delete(ctx context.Context, zoneIdentifier string, id string, body cloudflare.FirewallRuleDeleteParams) (cloudflare.FirewallRuleDeleteResponse, error) +- client.Firewall.Rules.Edit(ctx context.Context, zoneIdentifier string, id string, body cloudflare.FirewallRuleEditParams) ([]cloudflare.FirewallRuleEditResponse, error) +- client.Firewall.Rules.Get(ctx context.Context, zoneIdentifier string, id string, query cloudflare.FirewallRuleGetParams) (cloudflare.FirewallRuleGetResponse, error) -## HotlinkProtection +## AccessRules Response Types: -- cloudflare.SettingHotlinkProtectionEditResponse -- cloudflare.SettingHotlinkProtectionGetResponse +- cloudflare.FirewallAccessRuleNewResponse +- cloudflare.FirewallAccessRuleListResponse +- cloudflare.FirewallAccessRuleDeleteResponse +- cloudflare.FirewallAccessRuleEditResponse +- cloudflare.FirewallAccessRuleGetResponse Methods: -- client.Settings.HotlinkProtection.Edit(ctx context.Context, params cloudflare.SettingHotlinkProtectionEditParams) (cloudflare.SettingHotlinkProtectionEditResponse, error) -- client.Settings.HotlinkProtection.Get(ctx context.Context, query cloudflare.SettingHotlinkProtectionGetParams) (cloudflare.SettingHotlinkProtectionGetResponse, error) +- client.Firewall.AccessRules.New(ctx context.Context, params cloudflare.FirewallAccessRuleNewParams) (cloudflare.FirewallAccessRuleNewResponse, error) +- client.Firewall.AccessRules.List(ctx context.Context, params cloudflare.FirewallAccessRuleListParams) (shared.V4PagePaginationArray[cloudflare.FirewallAccessRuleListResponse], error) +- client.Firewall.AccessRules.Delete(ctx context.Context, identifier interface{}, body cloudflare.FirewallAccessRuleDeleteParams) (cloudflare.FirewallAccessRuleDeleteResponse, error) +- client.Firewall.AccessRules.Edit(ctx context.Context, identifier interface{}, params cloudflare.FirewallAccessRuleEditParams) (cloudflare.FirewallAccessRuleEditResponse, error) +- client.Firewall.AccessRules.Get(ctx context.Context, identifier interface{}, query cloudflare.FirewallAccessRuleGetParams) (cloudflare.FirewallAccessRuleGetResponse, error) -## HTTP2 +## UARules Response Types: -- cloudflare.SettingHTTP2EditResponse -- cloudflare.SettingHTTP2GetResponse +- cloudflare.FirewallUARuleNewResponse +- cloudflare.FirewallUARuleUpdateResponse +- cloudflare.FirewallUARuleListResponse +- cloudflare.FirewallUARuleDeleteResponse +- cloudflare.FirewallUARuleGetResponse Methods: -- client.Settings.HTTP2.Edit(ctx context.Context, params cloudflare.SettingHTTP2EditParams) (cloudflare.SettingHTTP2EditResponse, error) -- client.Settings.HTTP2.Get(ctx context.Context, query cloudflare.SettingHTTP2GetParams) (cloudflare.SettingHTTP2GetResponse, error) +- client.Firewall.UARules.New(ctx context.Context, zoneIdentifier string, body cloudflare.FirewallUARuleNewParams) (cloudflare.FirewallUARuleNewResponse, error) +- client.Firewall.UARules.Update(ctx context.Context, zoneIdentifier string, id string, body cloudflare.FirewallUARuleUpdateParams) (cloudflare.FirewallUARuleUpdateResponse, error) +- client.Firewall.UARules.List(ctx context.Context, zoneIdentifier string, query cloudflare.FirewallUARuleListParams) (shared.V4PagePaginationArray[cloudflare.FirewallUARuleListResponse], error) +- client.Firewall.UARules.Delete(ctx context.Context, zoneIdentifier string, id string) (cloudflare.FirewallUARuleDeleteResponse, error) +- client.Firewall.UARules.Get(ctx context.Context, zoneIdentifier string, id string) (cloudflare.FirewallUARuleGetResponse, error) + +## WAF -## HTTP3 +### Overrides Response Types: -- cloudflare.SettingHTTP3EditResponse -- cloudflare.SettingHTTP3GetResponse +- cloudflare.FirewallWAFOverrideNewResponse +- cloudflare.FirewallWAFOverrideUpdateResponse +- cloudflare.FirewallWAFOverrideListResponse +- cloudflare.FirewallWAFOverrideDeleteResponse +- cloudflare.FirewallWAFOverrideGetResponse Methods: -- client.Settings.HTTP3.Edit(ctx context.Context, params cloudflare.SettingHTTP3EditParams) (cloudflare.SettingHTTP3EditResponse, error) -- client.Settings.HTTP3.Get(ctx context.Context, query cloudflare.SettingHTTP3GetParams) (cloudflare.SettingHTTP3GetResponse, error) +- client.Firewall.WAF.Overrides.New(ctx context.Context, zoneIdentifier string, body cloudflare.FirewallWAFOverrideNewParams) (cloudflare.FirewallWAFOverrideNewResponse, error) +- client.Firewall.WAF.Overrides.Update(ctx context.Context, zoneIdentifier string, id string, body cloudflare.FirewallWAFOverrideUpdateParams) (cloudflare.FirewallWAFOverrideUpdateResponse, error) +- client.Firewall.WAF.Overrides.List(ctx context.Context, zoneIdentifier string, query cloudflare.FirewallWAFOverrideListParams) (shared.V4PagePaginationArray[cloudflare.FirewallWAFOverrideListResponse], error) +- client.Firewall.WAF.Overrides.Delete(ctx context.Context, zoneIdentifier string, id string) (cloudflare.FirewallWAFOverrideDeleteResponse, error) +- client.Firewall.WAF.Overrides.Get(ctx context.Context, zoneIdentifier string, id string) (cloudflare.FirewallWAFOverrideGetResponse, error) -## ImageResizing +### Packages Response Types: -- cloudflare.SettingImageResizingEditResponse -- cloudflare.SettingImageResizingGetResponse +- cloudflare.FirewallWAFPackageListResponse +- cloudflare.FirewallWAFPackageGetResponse Methods: -- client.Settings.ImageResizing.Edit(ctx context.Context, params cloudflare.SettingImageResizingEditParams) (cloudflare.SettingImageResizingEditResponse, error) -- client.Settings.ImageResizing.Get(ctx context.Context, query cloudflare.SettingImageResizingGetParams) (cloudflare.SettingImageResizingGetResponse, error) +- client.Firewall.WAF.Packages.List(ctx context.Context, zoneIdentifier string, query cloudflare.FirewallWAFPackageListParams) (shared.V4PagePaginationArray[cloudflare.FirewallWAFPackageListResponse], error) +- client.Firewall.WAF.Packages.Get(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.FirewallWAFPackageGetResponse, error) -## IPGeolocation +#### Groups Response Types: -- cloudflare.SettingIPGeolocationEditResponse -- cloudflare.SettingIPGeolocationGetResponse +- cloudflare.FirewallWAFPackageGroupListResponse +- cloudflare.FirewallWAFPackageGroupEditResponse +- cloudflare.FirewallWAFPackageGroupGetResponse Methods: -- client.Settings.IPGeolocation.Edit(ctx context.Context, params cloudflare.SettingIPGeolocationEditParams) (cloudflare.SettingIPGeolocationEditResponse, error) -- client.Settings.IPGeolocation.Get(ctx context.Context, query cloudflare.SettingIPGeolocationGetParams) (cloudflare.SettingIPGeolocationGetResponse, error) +- client.Firewall.WAF.Packages.Groups.List(ctx context.Context, packageID string, params cloudflare.FirewallWAFPackageGroupListParams) (shared.V4PagePaginationArray[cloudflare.FirewallWAFPackageGroupListResponse], error) +- client.Firewall.WAF.Packages.Groups.Edit(ctx context.Context, packageID string, groupID string, params cloudflare.FirewallWAFPackageGroupEditParams) (cloudflare.FirewallWAFPackageGroupEditResponse, error) +- client.Firewall.WAF.Packages.Groups.Get(ctx context.Context, packageID string, groupID string, query cloudflare.FirewallWAFPackageGroupGetParams) (cloudflare.FirewallWAFPackageGroupGetResponse, error) -## IPV6 +#### Rules Response Types: -- cloudflare.SettingIPV6EditResponse -- cloudflare.SettingIPV6GetResponse +- cloudflare.FirewallWAFPackageRuleListResponse +- cloudflare.FirewallWAFPackageRuleEditResponse +- cloudflare.FirewallWAFPackageRuleGetResponse Methods: -- client.Settings.IPV6.Edit(ctx context.Context, params cloudflare.SettingIPV6EditParams) (cloudflare.SettingIPV6EditResponse, error) -- client.Settings.IPV6.Get(ctx context.Context, query cloudflare.SettingIPV6GetParams) (cloudflare.SettingIPV6GetResponse, error) +- client.Firewall.WAF.Packages.Rules.List(ctx context.Context, packageID string, params cloudflare.FirewallWAFPackageRuleListParams) (shared.V4PagePaginationArray[cloudflare.FirewallWAFPackageRuleListResponse], error) +- client.Firewall.WAF.Packages.Rules.Edit(ctx context.Context, packageID string, ruleID string, params cloudflare.FirewallWAFPackageRuleEditParams) (cloudflare.FirewallWAFPackageRuleEditResponse, error) +- client.Firewall.WAF.Packages.Rules.Get(ctx context.Context, packageID string, ruleID string, query cloudflare.FirewallWAFPackageRuleGetParams) (cloudflare.FirewallWAFPackageRuleGetResponse, error) -## MinTLSVersion +# Healthchecks Response Types: -- cloudflare.SettingMinTLSVersionEditResponse -- cloudflare.SettingMinTLSVersionGetResponse +- cloudflare.HealthcheckNewResponse +- cloudflare.HealthcheckUpdateResponse +- cloudflare.HealthcheckListResponse +- cloudflare.HealthcheckDeleteResponse +- cloudflare.HealthcheckEditResponse +- cloudflare.HealthcheckGetResponse Methods: -- client.Settings.MinTLSVersion.Edit(ctx context.Context, params cloudflare.SettingMinTLSVersionEditParams) (cloudflare.SettingMinTLSVersionEditResponse, error) -- client.Settings.MinTLSVersion.Get(ctx context.Context, query cloudflare.SettingMinTLSVersionGetParams) (cloudflare.SettingMinTLSVersionGetResponse, error) +- client.Healthchecks.New(ctx context.Context, zoneIdentifier string, body cloudflare.HealthcheckNewParams) (cloudflare.HealthcheckNewResponse, error) +- client.Healthchecks.Update(ctx context.Context, zoneIdentifier string, identifier string, body cloudflare.HealthcheckUpdateParams) (cloudflare.HealthcheckUpdateResponse, error) +- client.Healthchecks.List(ctx context.Context, zoneIdentifier string) ([]cloudflare.HealthcheckListResponse, error) +- client.Healthchecks.Delete(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.HealthcheckDeleteResponse, error) +- client.Healthchecks.Edit(ctx context.Context, zoneIdentifier string, identifier string, body cloudflare.HealthcheckEditParams) (cloudflare.HealthcheckEditResponse, error) +- client.Healthchecks.Get(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.HealthcheckGetResponse, error) -## Minify +## Previews Response Types: -- cloudflare.SettingMinifyEditResponse -- cloudflare.SettingMinifyGetResponse +- cloudflare.HealthcheckPreviewNewResponse +- cloudflare.HealthcheckPreviewDeleteResponse +- cloudflare.HealthcheckPreviewGetResponse Methods: -- client.Settings.Minify.Edit(ctx context.Context, params cloudflare.SettingMinifyEditParams) (cloudflare.SettingMinifyEditResponse, error) -- client.Settings.Minify.Get(ctx context.Context, query cloudflare.SettingMinifyGetParams) (cloudflare.SettingMinifyGetResponse, error) +- client.Healthchecks.Previews.New(ctx context.Context, zoneIdentifier string, body cloudflare.HealthcheckPreviewNewParams) (cloudflare.HealthcheckPreviewNewResponse, error) +- client.Healthchecks.Previews.Delete(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.HealthcheckPreviewDeleteResponse, error) +- client.Healthchecks.Previews.Get(ctx context.Context, zoneIdentifier string, identifier string) (cloudflare.HealthcheckPreviewGetResponse, error) -## Mirage +# KeylessCertificates Response Types: -- cloudflare.SettingMirageEditResponse -- cloudflare.SettingMirageGetResponse +- cloudflare.KeylessCertificateNewResponse +- cloudflare.KeylessCertificateListResponse +- cloudflare.KeylessCertificateDeleteResponse +- cloudflare.KeylessCertificateEditResponse +- cloudflare.KeylessCertificateGetResponse Methods: -- client.Settings.Mirage.Edit(ctx context.Context, params cloudflare.SettingMirageEditParams) (cloudflare.SettingMirageEditResponse, error) -- client.Settings.Mirage.Get(ctx context.Context, query cloudflare.SettingMirageGetParams) (cloudflare.SettingMirageGetResponse, error) +- client.KeylessCertificates.New(ctx context.Context, params cloudflare.KeylessCertificateNewParams) (cloudflare.KeylessCertificateNewResponse, error) +- client.KeylessCertificates.List(ctx context.Context, query cloudflare.KeylessCertificateListParams) ([]cloudflare.KeylessCertificateListResponse, error) +- client.KeylessCertificates.Delete(ctx context.Context, keylessCertificateID string, body cloudflare.KeylessCertificateDeleteParams) (cloudflare.KeylessCertificateDeleteResponse, error) +- client.KeylessCertificates.Edit(ctx context.Context, keylessCertificateID string, params cloudflare.KeylessCertificateEditParams) (cloudflare.KeylessCertificateEditResponse, error) +- client.KeylessCertificates.Get(ctx context.Context, keylessCertificateID string, query cloudflare.KeylessCertificateGetParams) (cloudflare.KeylessCertificateGetResponse, error) + +# Logpush + +## Datasets -## MobileRedirect +### Fields Response Types: -- cloudflare.SettingMobileRedirectEditResponse -- cloudflare.SettingMobileRedirectGetResponse +- cloudflare.LogpushDatasetFieldListResponse Methods: -- client.Settings.MobileRedirect.Edit(ctx context.Context, params cloudflare.SettingMobileRedirectEditParams) (cloudflare.SettingMobileRedirectEditResponse, error) -- client.Settings.MobileRedirect.Get(ctx context.Context, query cloudflare.SettingMobileRedirectGetParams) (cloudflare.SettingMobileRedirectGetResponse, error) +- client.Logpush.Datasets.Fields.List(ctx context.Context, datasetID string, query cloudflare.LogpushDatasetFieldListParams) (cloudflare.LogpushDatasetFieldListResponse, error) -## NEL +### Jobs Response Types: -- cloudflare.SettingNELEditResponse -- cloudflare.SettingNELGetResponse +- cloudflare.LogpushDatasetJobListResponse Methods: -- client.Settings.NEL.Edit(ctx context.Context, params cloudflare.SettingNELEditParams) (cloudflare.SettingNELEditResponse, error) -- client.Settings.NEL.Get(ctx context.Context, query cloudflare.SettingNELGetParams) (cloudflare.SettingNELGetResponse, error) +- client.Logpush.Datasets.Jobs.List(ctx context.Context, datasetID string, query cloudflare.LogpushDatasetJobListParams) ([]cloudflare.LogpushDatasetJobListResponse, error) -## OpportunisticEncryption +## Edge Response Types: -- cloudflare.SettingOpportunisticEncryptionEditResponse -- cloudflare.SettingOpportunisticEncryptionGetResponse +- cloudflare.LogpushEdgeNewResponse +- cloudflare.LogpushEdgeGetResponse Methods: -- client.Settings.OpportunisticEncryption.Edit(ctx context.Context, params cloudflare.SettingOpportunisticEncryptionEditParams) (cloudflare.SettingOpportunisticEncryptionEditResponse, error) -- client.Settings.OpportunisticEncryption.Get(ctx context.Context, query cloudflare.SettingOpportunisticEncryptionGetParams) (cloudflare.SettingOpportunisticEncryptionGetResponse, error) +- client.Logpush.Edge.New(ctx context.Context, params cloudflare.LogpushEdgeNewParams) (cloudflare.LogpushEdgeNewResponse, error) +- client.Logpush.Edge.Get(ctx context.Context, query cloudflare.LogpushEdgeGetParams) ([]cloudflare.LogpushEdgeGetResponse, error) -## OpportunisticOnion +## Jobs Response Types: -- cloudflare.SettingOpportunisticOnionEditResponse -- cloudflare.SettingOpportunisticOnionGetResponse +- cloudflare.LogpushJobNewResponse +- cloudflare.LogpushJobUpdateResponse +- cloudflare.LogpushJobListResponse +- cloudflare.LogpushJobDeleteResponse +- cloudflare.LogpushJobGetResponse Methods: -- client.Settings.OpportunisticOnion.Edit(ctx context.Context, params cloudflare.SettingOpportunisticOnionEditParams) (cloudflare.SettingOpportunisticOnionEditResponse, error) -- client.Settings.OpportunisticOnion.Get(ctx context.Context, query cloudflare.SettingOpportunisticOnionGetParams) (cloudflare.SettingOpportunisticOnionGetResponse, error) +- client.Logpush.Jobs.New(ctx context.Context, params cloudflare.LogpushJobNewParams) (cloudflare.LogpushJobNewResponse, error) +- client.Logpush.Jobs.Update(ctx context.Context, jobID int64, params cloudflare.LogpushJobUpdateParams) (cloudflare.LogpushJobUpdateResponse, error) +- client.Logpush.Jobs.List(ctx context.Context, query cloudflare.LogpushJobListParams) ([]cloudflare.LogpushJobListResponse, error) +- client.Logpush.Jobs.Delete(ctx context.Context, jobID int64, body cloudflare.LogpushJobDeleteParams) (cloudflare.LogpushJobDeleteResponse, error) +- client.Logpush.Jobs.Get(ctx context.Context, jobID int64, query cloudflare.LogpushJobGetParams) (cloudflare.LogpushJobGetResponse, error) -## OrangeToOrange +## Ownership Response Types: -- cloudflare.SettingOrangeToOrangeEditResponse -- cloudflare.SettingOrangeToOrangeGetResponse +- cloudflare.LogpushOwnershipNewResponse +- cloudflare.LogpushOwnershipValidateResponse Methods: -- client.Settings.OrangeToOrange.Edit(ctx context.Context, params cloudflare.SettingOrangeToOrangeEditParams) (cloudflare.SettingOrangeToOrangeEditResponse, error) -- client.Settings.OrangeToOrange.Get(ctx context.Context, query cloudflare.SettingOrangeToOrangeGetParams) (cloudflare.SettingOrangeToOrangeGetResponse, error) +- client.Logpush.Ownership.New(ctx context.Context, params cloudflare.LogpushOwnershipNewParams) (cloudflare.LogpushOwnershipNewResponse, error) +- client.Logpush.Ownership.Validate(ctx context.Context, params cloudflare.LogpushOwnershipValidateParams) (cloudflare.LogpushOwnershipValidateResponse, error) -## OriginErrorPagePassThru +## Validate Response Types: -- cloudflare.SettingOriginErrorPagePassThruEditResponse -- cloudflare.SettingOriginErrorPagePassThruGetResponse +- cloudflare.LogpushValidateDestinationResponse +- cloudflare.LogpushValidateOriginResponse Methods: -- client.Settings.OriginErrorPagePassThru.Edit(ctx context.Context, params cloudflare.SettingOriginErrorPagePassThruEditParams) (cloudflare.SettingOriginErrorPagePassThruEditResponse, error) -- client.Settings.OriginErrorPagePassThru.Get(ctx context.Context, query cloudflare.SettingOriginErrorPagePassThruGetParams) (cloudflare.SettingOriginErrorPagePassThruGetResponse, error) - -## OriginMaxHTTPVersion - -Response Types: +- client.Logpush.Validate.Destination(ctx context.Context, params cloudflare.LogpushValidateDestinationParams) (cloudflare.LogpushValidateDestinationResponse, error) +- client.Logpush.Validate.Origin(ctx context.Context, params cloudflare.LogpushValidateOriginParams) (cloudflare.LogpushValidateOriginResponse, error) -- cloudflare.SettingOriginMaxHTTPVersionEditResponse -- cloudflare.SettingOriginMaxHTTPVersionGetResponse +# Logs -Methods: +## Controls -- client.Settings.OriginMaxHTTPVersion.Edit(ctx context.Context, params cloudflare.SettingOriginMaxHTTPVersionEditParams) (cloudflare.SettingOriginMaxHTTPVersionEditResponse, error) -- client.Settings.OriginMaxHTTPVersion.Get(ctx context.Context, query cloudflare.SettingOriginMaxHTTPVersionGetParams) (cloudflare.SettingOriginMaxHTTPVersionGetResponse, error) +### Retentions -## Polish +#### Flags Response Types: -- cloudflare.SettingPolishEditResponse -- cloudflare.SettingPolishGetResponse +- cloudflare.LogControlRetentionFlagNewResponse +- cloudflare.LogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponse Methods: -- client.Settings.Polish.Edit(ctx context.Context, params cloudflare.SettingPolishEditParams) (cloudflare.SettingPolishEditResponse, error) -- client.Settings.Polish.Get(ctx context.Context, query cloudflare.SettingPolishGetParams) (cloudflare.SettingPolishGetResponse, error) +- client.Logs.Controls.Retentions.Flags.New(ctx context.Context, zoneIdentifier string, body cloudflare.LogControlRetentionFlagNewParams) (cloudflare.LogControlRetentionFlagNewResponse, error) +- client.Logs.Controls.Retentions.Flags.LogsReceivedGetLogRetentionFlag(ctx context.Context, zoneIdentifier string) (cloudflare.LogControlRetentionFlagLogsReceivedGetLogRetentionFlagResponse, error) + +### Cmb -## PrefetchPreload +#### Config Response Types: -- cloudflare.SettingPrefetchPreloadEditResponse -- cloudflare.SettingPrefetchPreloadGetResponse +- cloudflare.LogControlCmbConfigNewResponse +- cloudflare.LogControlCmbConfigDeleteResponse +- cloudflare.LogControlCmbConfigGetResponse Methods: -- client.Settings.PrefetchPreload.Edit(ctx context.Context, params cloudflare.SettingPrefetchPreloadEditParams) (cloudflare.SettingPrefetchPreloadEditResponse, error) -- client.Settings.PrefetchPreload.Get(ctx context.Context, query cloudflare.SettingPrefetchPreloadGetParams) (cloudflare.SettingPrefetchPreloadGetResponse, error) +- client.Logs.Controls.Cmb.Config.New(ctx context.Context, params cloudflare.LogControlCmbConfigNewParams) (cloudflare.LogControlCmbConfigNewResponse, error) +- client.Logs.Controls.Cmb.Config.Delete(ctx context.Context, body cloudflare.LogControlCmbConfigDeleteParams) (cloudflare.LogControlCmbConfigDeleteResponse, error) +- client.Logs.Controls.Cmb.Config.Get(ctx context.Context, query cloudflare.LogControlCmbConfigGetParams) (cloudflare.LogControlCmbConfigGetResponse, error) -## ProxyReadTimeout +## Rayids Response Types: -- cloudflare.SettingProxyReadTimeoutEditResponse -- cloudflare.SettingProxyReadTimeoutGetResponse +- cloudflare.LogRayidGetResponse Methods: -- client.Settings.ProxyReadTimeout.Edit(ctx context.Context, params cloudflare.SettingProxyReadTimeoutEditParams) (cloudflare.SettingProxyReadTimeoutEditResponse, error) -- client.Settings.ProxyReadTimeout.Get(ctx context.Context, query cloudflare.SettingProxyReadTimeoutGetParams) (cloudflare.SettingProxyReadTimeoutGetResponse, error) +- client.Logs.Rayids.Get(ctx context.Context, zoneIdentifier string, rayIdentifier string, query cloudflare.LogRayidGetParams) (cloudflare.LogRayidGetResponse, error) -## PseudoIPV4 +## Received Response Types: -- cloudflare.SettingPseudoIPV4EditResponse -- cloudflare.SettingPseudoIPV4GetResponse +- cloudflare.LogReceivedGetResponse Methods: -- client.Settings.PseudoIPV4.Edit(ctx context.Context, params cloudflare.SettingPseudoIPV4EditParams) (cloudflare.SettingPseudoIPV4EditResponse, error) -- client.Settings.PseudoIPV4.Get(ctx context.Context, query cloudflare.SettingPseudoIPV4GetParams) (cloudflare.SettingPseudoIPV4GetResponse, error) +- client.Logs.Received.Get(ctx context.Context, zoneIdentifier string, query cloudflare.LogReceivedGetParams) (cloudflare.LogReceivedGetResponse, error) -## ResponseBuffering +### Fields Response Types: -- cloudflare.SettingResponseBufferingEditResponse -- cloudflare.SettingResponseBufferingGetResponse +- cloudflare.LogReceivedFieldListResponse Methods: -- client.Settings.ResponseBuffering.Edit(ctx context.Context, params cloudflare.SettingResponseBufferingEditParams) (cloudflare.SettingResponseBufferingEditResponse, error) -- client.Settings.ResponseBuffering.Get(ctx context.Context, query cloudflare.SettingResponseBufferingGetParams) (cloudflare.SettingResponseBufferingGetResponse, error) +- client.Logs.Received.Fields.List(ctx context.Context, zoneIdentifier string) (cloudflare.LogReceivedFieldListResponse, error) -## RocketLoader +# OriginTLSClientAuth Response Types: -- cloudflare.SettingRocketLoaderEditResponse -- cloudflare.SettingRocketLoaderGetResponse +- cloudflare.OriginTLSClientAuthNewResponse +- cloudflare.OriginTLSClientAuthListResponse +- cloudflare.OriginTLSClientAuthDeleteResponse +- cloudflare.OriginTLSClientAuthGetResponse Methods: -- client.Settings.RocketLoader.Edit(ctx context.Context, params cloudflare.SettingRocketLoaderEditParams) (cloudflare.SettingRocketLoaderEditResponse, error) -- client.Settings.RocketLoader.Get(ctx context.Context, query cloudflare.SettingRocketLoaderGetParams) (cloudflare.SettingRocketLoaderGetResponse, error) +- client.OriginTLSClientAuth.New(ctx context.Context, params cloudflare.OriginTLSClientAuthNewParams) (cloudflare.OriginTLSClientAuthNewResponse, error) +- client.OriginTLSClientAuth.List(ctx context.Context, query cloudflare.OriginTLSClientAuthListParams) ([]cloudflare.OriginTLSClientAuthListResponse, error) +- client.OriginTLSClientAuth.Delete(ctx context.Context, certificateID string, body cloudflare.OriginTLSClientAuthDeleteParams) (cloudflare.OriginTLSClientAuthDeleteResponse, error) +- client.OriginTLSClientAuth.Get(ctx context.Context, certificateID string, query cloudflare.OriginTLSClientAuthGetParams) (cloudflare.OriginTLSClientAuthGetResponse, error) -## SecurityHeaders +## Hostnames Response Types: -- cloudflare.SettingSecurityHeaderEditResponse -- cloudflare.SettingSecurityHeaderGetResponse +- cloudflare.OriginTLSClientAuthHostnameUpdateResponse +- cloudflare.OriginTLSClientAuthHostnameGetResponse Methods: -- client.Settings.SecurityHeaders.Edit(ctx context.Context, params cloudflare.SettingSecurityHeaderEditParams) (cloudflare.SettingSecurityHeaderEditResponse, error) -- client.Settings.SecurityHeaders.Get(ctx context.Context, query cloudflare.SettingSecurityHeaderGetParams) (cloudflare.SettingSecurityHeaderGetResponse, error) +- client.OriginTLSClientAuth.Hostnames.Update(ctx context.Context, params cloudflare.OriginTLSClientAuthHostnameUpdateParams) ([]cloudflare.OriginTLSClientAuthHostnameUpdateResponse, error) +- client.OriginTLSClientAuth.Hostnames.Get(ctx context.Context, hostname string, query cloudflare.OriginTLSClientAuthHostnameGetParams) (cloudflare.OriginTLSClientAuthHostnameGetResponse, error) -## SecurityLevel +### Certificates Response Types: -- cloudflare.SettingSecurityLevelEditResponse -- cloudflare.SettingSecurityLevelGetResponse +- cloudflare.OriginTLSClientAuthHostnameCertificateNewResponse +- cloudflare.OriginTLSClientAuthHostnameCertificateListResponse +- cloudflare.OriginTLSClientAuthHostnameCertificateDeleteResponse +- cloudflare.OriginTLSClientAuthHostnameCertificateGetResponse Methods: -- client.Settings.SecurityLevel.Edit(ctx context.Context, params cloudflare.SettingSecurityLevelEditParams) (cloudflare.SettingSecurityLevelEditResponse, error) -- client.Settings.SecurityLevel.Get(ctx context.Context, query cloudflare.SettingSecurityLevelGetParams) (cloudflare.SettingSecurityLevelGetResponse, error) +- client.OriginTLSClientAuth.Hostnames.Certificates.New(ctx context.Context, params cloudflare.OriginTLSClientAuthHostnameCertificateNewParams) (cloudflare.OriginTLSClientAuthHostnameCertificateNewResponse, error) +- client.OriginTLSClientAuth.Hostnames.Certificates.List(ctx context.Context, query cloudflare.OriginTLSClientAuthHostnameCertificateListParams) ([]cloudflare.OriginTLSClientAuthHostnameCertificateListResponse, error) +- client.OriginTLSClientAuth.Hostnames.Certificates.Delete(ctx context.Context, certificateID string, body cloudflare.OriginTLSClientAuthHostnameCertificateDeleteParams) (cloudflare.OriginTLSClientAuthHostnameCertificateDeleteResponse, error) +- client.OriginTLSClientAuth.Hostnames.Certificates.Get(ctx context.Context, certificateID string, query cloudflare.OriginTLSClientAuthHostnameCertificateGetParams) (cloudflare.OriginTLSClientAuthHostnameCertificateGetResponse, error) -## ServerSideExcludes +## Settings Response Types: -- cloudflare.SettingServerSideExcludeEditResponse -- cloudflare.SettingServerSideExcludeGetResponse +- cloudflare.OriginTLSClientAuthSettingUpdateResponse +- cloudflare.OriginTLSClientAuthSettingGetResponse Methods: -- client.Settings.ServerSideExcludes.Edit(ctx context.Context, params cloudflare.SettingServerSideExcludeEditParams) (cloudflare.SettingServerSideExcludeEditResponse, error) -- client.Settings.ServerSideExcludes.Get(ctx context.Context, query cloudflare.SettingServerSideExcludeGetParams) (cloudflare.SettingServerSideExcludeGetResponse, error) +- client.OriginTLSClientAuth.Settings.Update(ctx context.Context, params cloudflare.OriginTLSClientAuthSettingUpdateParams) (cloudflare.OriginTLSClientAuthSettingUpdateResponse, error) +- client.OriginTLSClientAuth.Settings.Get(ctx context.Context, query cloudflare.OriginTLSClientAuthSettingGetParams) (cloudflare.OriginTLSClientAuthSettingGetResponse, error) -## SortQueryStringForCache +# Pagerules Response Types: -- cloudflare.SettingSortQueryStringForCacheEditResponse -- cloudflare.SettingSortQueryStringForCacheGetResponse +- cloudflare.PageruleNewResponse +- cloudflare.PageruleUpdateResponse +- cloudflare.PageruleListResponse +- cloudflare.PageruleDeleteResponse +- cloudflare.PageruleEditResponse +- cloudflare.PageruleGetResponse Methods: -- client.Settings.SortQueryStringForCache.Edit(ctx context.Context, params cloudflare.SettingSortQueryStringForCacheEditParams) (cloudflare.SettingSortQueryStringForCacheEditResponse, error) -- client.Settings.SortQueryStringForCache.Get(ctx context.Context, query cloudflare.SettingSortQueryStringForCacheGetParams) (cloudflare.SettingSortQueryStringForCacheGetResponse, error) +- client.Pagerules.New(ctx context.Context, params cloudflare.PageruleNewParams) (cloudflare.PageruleNewResponse, error) +- client.Pagerules.Update(ctx context.Context, pageruleID string, params cloudflare.PageruleUpdateParams) (cloudflare.PageruleUpdateResponse, error) +- client.Pagerules.List(ctx context.Context, params cloudflare.PageruleListParams) ([]cloudflare.PageruleListResponse, error) +- client.Pagerules.Delete(ctx context.Context, pageruleID string, body cloudflare.PageruleDeleteParams) (cloudflare.PageruleDeleteResponse, error) +- client.Pagerules.Edit(ctx context.Context, pageruleID string, params cloudflare.PageruleEditParams) (cloudflare.PageruleEditResponse, error) +- client.Pagerules.Get(ctx context.Context, pageruleID string, query cloudflare.PageruleGetParams) (cloudflare.PageruleGetResponse, error) -## SSL +## Settings Response Types: -- cloudflare.SettingSSLEditResponse -- cloudflare.SettingSSLGetResponse +- cloudflare.PageruleSettingListResponse Methods: -- client.Settings.SSL.Edit(ctx context.Context, params cloudflare.SettingSSLEditParams) (cloudflare.SettingSSLEditResponse, error) -- client.Settings.SSL.Get(ctx context.Context, query cloudflare.SettingSSLGetParams) (cloudflare.SettingSSLGetResponse, error) +- client.Pagerules.Settings.List(ctx context.Context, query cloudflare.PageruleSettingListParams) ([]cloudflare.PageruleSettingListResponse, error) -## SSLRecommender +# RateLimits Response Types: -- cloudflare.SettingSSLRecommenderEditResponse -- cloudflare.SettingSSLRecommenderGetResponse +- cloudflare.RateLimitNewResponse +- cloudflare.RateLimitListResponse +- cloudflare.RateLimitDeleteResponse +- cloudflare.RateLimitEditResponse +- cloudflare.RateLimitGetResponse Methods: -- client.Settings.SSLRecommender.Edit(ctx context.Context, params cloudflare.SettingSSLRecommenderEditParams) (cloudflare.SettingSSLRecommenderEditResponse, error) -- client.Settings.SSLRecommender.Get(ctx context.Context, query cloudflare.SettingSSLRecommenderGetParams) (cloudflare.SettingSSLRecommenderGetResponse, error) - -## TLS1_3 +- client.RateLimits.New(ctx context.Context, zoneIdentifier string, body cloudflare.RateLimitNewParams) (cloudflare.RateLimitNewResponse, error) +- client.RateLimits.List(ctx context.Context, zoneIdentifier string, query cloudflare.RateLimitListParams) (shared.V4PagePaginationArray[cloudflare.RateLimitListResponse], error) +- client.RateLimits.Delete(ctx context.Context, zoneIdentifier string, id string) (cloudflare.RateLimitDeleteResponse, error) +- client.RateLimits.Edit(ctx context.Context, zoneIdentifier string, id string, body cloudflare.RateLimitEditParams) (cloudflare.RateLimitEditResponse, error) +- client.RateLimits.Get(ctx context.Context, zoneIdentifier string, id string) (cloudflare.RateLimitGetResponse, error) -Response Types: +# SecondaryDNS -- cloudflare.SettingTls1_3EditResponse -- cloudflare.SettingTls1_3GetResponse +## ForceAxfrs Methods: -- client.Settings.TLS1_3.Edit(ctx context.Context, params cloudflare.SettingTLS1_3EditParams) (cloudflare.SettingTls1_3EditResponse, error) -- client.Settings.TLS1_3.Get(ctx context.Context, query cloudflare.SettingTLS1_3GetParams) (cloudflare.SettingTls1_3GetResponse, error) +- client.SecondaryDNS.ForceAxfrs.New(ctx context.Context, body cloudflare.SecondaryDNSForceAxfrNewParams) (string, error) -## TLSClientAuth +## Incoming Response Types: -- cloudflare.SettingTLSClientAuthEditResponse -- cloudflare.SettingTLSClientAuthGetResponse +- cloudflare.SecondaryDNSIncomingNewResponse +- cloudflare.SecondaryDNSIncomingUpdateResponse +- cloudflare.SecondaryDNSIncomingDeleteResponse +- cloudflare.SecondaryDNSIncomingGetResponse Methods: -- client.Settings.TLSClientAuth.Edit(ctx context.Context, params cloudflare.SettingTLSClientAuthEditParams) (cloudflare.SettingTLSClientAuthEditResponse, error) -- client.Settings.TLSClientAuth.Get(ctx context.Context, query cloudflare.SettingTLSClientAuthGetParams) (cloudflare.SettingTLSClientAuthGetResponse, error) +- client.SecondaryDNS.Incoming.New(ctx context.Context, params cloudflare.SecondaryDNSIncomingNewParams) (cloudflare.SecondaryDNSIncomingNewResponse, error) +- client.SecondaryDNS.Incoming.Update(ctx context.Context, params cloudflare.SecondaryDNSIncomingUpdateParams) (cloudflare.SecondaryDNSIncomingUpdateResponse, error) +- client.SecondaryDNS.Incoming.Delete(ctx context.Context, body cloudflare.SecondaryDNSIncomingDeleteParams) (cloudflare.SecondaryDNSIncomingDeleteResponse, error) +- client.SecondaryDNS.Incoming.Get(ctx context.Context, query cloudflare.SecondaryDNSIncomingGetParams) (cloudflare.SecondaryDNSIncomingGetResponse, error) -## TrueClientIPHeader +## Outgoing Response Types: -- cloudflare.SettingTrueClientIPHeaderEditResponse -- cloudflare.SettingTrueClientIPHeaderGetResponse +- cloudflare.SecondaryDNSOutgoingNewResponse +- cloudflare.SecondaryDNSOutgoingUpdateResponse +- cloudflare.SecondaryDNSOutgoingDeleteResponse +- cloudflare.SecondaryDNSOutgoingGetResponse Methods: -- client.Settings.TrueClientIPHeader.Edit(ctx context.Context, params cloudflare.SettingTrueClientIPHeaderEditParams) (cloudflare.SettingTrueClientIPHeaderEditResponse, error) -- client.Settings.TrueClientIPHeader.Get(ctx context.Context, query cloudflare.SettingTrueClientIPHeaderGetParams) (cloudflare.SettingTrueClientIPHeaderGetResponse, error) - -## WAF - -Response Types: +- client.SecondaryDNS.Outgoing.New(ctx context.Context, params cloudflare.SecondaryDNSOutgoingNewParams) (cloudflare.SecondaryDNSOutgoingNewResponse, error) +- client.SecondaryDNS.Outgoing.Update(ctx context.Context, params cloudflare.SecondaryDNSOutgoingUpdateParams) (cloudflare.SecondaryDNSOutgoingUpdateResponse, error) +- client.SecondaryDNS.Outgoing.Delete(ctx context.Context, body cloudflare.SecondaryDNSOutgoingDeleteParams) (cloudflare.SecondaryDNSOutgoingDeleteResponse, error) +- client.SecondaryDNS.Outgoing.Disable(ctx context.Context, body cloudflare.SecondaryDNSOutgoingDisableParams) (string, error) +- client.SecondaryDNS.Outgoing.Enable(ctx context.Context, body cloudflare.SecondaryDNSOutgoingEnableParams) (string, error) +- client.SecondaryDNS.Outgoing.ForceNotify(ctx context.Context, body cloudflare.SecondaryDNSOutgoingForceNotifyParams) (string, error) +- client.SecondaryDNS.Outgoing.Get(ctx context.Context, query cloudflare.SecondaryDNSOutgoingGetParams) (cloudflare.SecondaryDNSOutgoingGetResponse, error) -- cloudflare.SettingWAFEditResponse -- cloudflare.SettingWAFGetResponse +### Status Methods: -- client.Settings.WAF.Edit(ctx context.Context, params cloudflare.SettingWAFEditParams) (cloudflare.SettingWAFEditResponse, error) -- client.Settings.WAF.Get(ctx context.Context, query cloudflare.SettingWAFGetParams) (cloudflare.SettingWAFGetResponse, error) +- client.SecondaryDNS.Outgoing.Status.Get(ctx context.Context, query cloudflare.SecondaryDNSOutgoingStatusGetParams) (string, error) -## Webp +## ACLs Response Types: -- cloudflare.SettingWebpEditResponse -- cloudflare.SettingWebpGetResponse +- cloudflare.SecondaryDnsaclNewResponse +- cloudflare.SecondaryDnsaclUpdateResponse +- cloudflare.SecondaryDnsaclListResponse +- cloudflare.SecondaryDnsaclDeleteResponse +- cloudflare.SecondaryDnsaclGetResponse Methods: -- client.Settings.Webp.Edit(ctx context.Context, params cloudflare.SettingWebpEditParams) (cloudflare.SettingWebpEditResponse, error) -- client.Settings.Webp.Get(ctx context.Context, query cloudflare.SettingWebpGetParams) (cloudflare.SettingWebpGetResponse, error) +- client.SecondaryDNS.ACLs.New(ctx context.Context, params cloudflare.SecondaryDNSACLNewParams) (cloudflare.SecondaryDnsaclNewResponse, error) +- client.SecondaryDNS.ACLs.Update(ctx context.Context, aclID interface{}, params cloudflare.SecondaryDNSACLUpdateParams) (cloudflare.SecondaryDnsaclUpdateResponse, error) +- client.SecondaryDNS.ACLs.List(ctx context.Context, query cloudflare.SecondaryDNSACLListParams) ([]cloudflare.SecondaryDnsaclListResponse, error) +- client.SecondaryDNS.ACLs.Delete(ctx context.Context, aclID interface{}, body cloudflare.SecondaryDNSACLDeleteParams) (cloudflare.SecondaryDnsaclDeleteResponse, error) +- client.SecondaryDNS.ACLs.Get(ctx context.Context, aclID interface{}, query cloudflare.SecondaryDNSACLGetParams) (cloudflare.SecondaryDnsaclGetResponse, error) -## Websocket +## Peers Response Types: -- cloudflare.SettingWebsocketEditResponse -- cloudflare.SettingWebsocketGetResponse +- cloudflare.SecondaryDNSPeerNewResponse +- cloudflare.SecondaryDNSPeerUpdateResponse +- cloudflare.SecondaryDNSPeerListResponse +- cloudflare.SecondaryDNSPeerDeleteResponse +- cloudflare.SecondaryDNSPeerGetResponse Methods: -- client.Settings.Websocket.Edit(ctx context.Context, params cloudflare.SettingWebsocketEditParams) (cloudflare.SettingWebsocketEditResponse, error) -- client.Settings.Websocket.Get(ctx context.Context, query cloudflare.SettingWebsocketGetParams) (cloudflare.SettingWebsocketGetResponse, error) +- client.SecondaryDNS.Peers.New(ctx context.Context, params cloudflare.SecondaryDNSPeerNewParams) (cloudflare.SecondaryDNSPeerNewResponse, error) +- client.SecondaryDNS.Peers.Update(ctx context.Context, peerID interface{}, params cloudflare.SecondaryDNSPeerUpdateParams) (cloudflare.SecondaryDNSPeerUpdateResponse, error) +- client.SecondaryDNS.Peers.List(ctx context.Context, query cloudflare.SecondaryDNSPeerListParams) ([]cloudflare.SecondaryDNSPeerListResponse, error) +- client.SecondaryDNS.Peers.Delete(ctx context.Context, peerID interface{}, body cloudflare.SecondaryDNSPeerDeleteParams) (cloudflare.SecondaryDNSPeerDeleteResponse, error) +- client.SecondaryDNS.Peers.Get(ctx context.Context, peerID interface{}, query cloudflare.SecondaryDNSPeerGetParams) (cloudflare.SecondaryDNSPeerGetResponse, error) -## FontSettings +## TSIGs Response Types: -- cloudflare.SettingFontSettingEditResponse -- cloudflare.SettingFontSettingGetResponse +- cloudflare.SecondaryDnstsigNewResponse +- cloudflare.SecondaryDnstsigUpdateResponse +- cloudflare.SecondaryDnstsigListResponse +- cloudflare.SecondaryDnstsigDeleteResponse +- cloudflare.SecondaryDnstsigGetResponse Methods: -- client.Settings.FontSettings.Edit(ctx context.Context, params cloudflare.SettingFontSettingEditParams) (cloudflare.SettingFontSettingEditResponse, error) -- client.Settings.FontSettings.Get(ctx context.Context, query cloudflare.SettingFontSettingGetParams) (cloudflare.SettingFontSettingGetResponse, error) +- client.SecondaryDNS.TSIGs.New(ctx context.Context, params cloudflare.SecondaryDNSTSIGNewParams) (cloudflare.SecondaryDnstsigNewResponse, error) +- client.SecondaryDNS.TSIGs.Update(ctx context.Context, tsigID interface{}, params cloudflare.SecondaryDNSTSIGUpdateParams) (cloudflare.SecondaryDnstsigUpdateResponse, error) +- client.SecondaryDNS.TSIGs.List(ctx context.Context, query cloudflare.SecondaryDNSTSIGListParams) ([]cloudflare.SecondaryDnstsigListResponse, error) +- client.SecondaryDNS.TSIGs.Delete(ctx context.Context, tsigID interface{}, body cloudflare.SecondaryDNSTSIGDeleteParams) (cloudflare.SecondaryDnstsigDeleteResponse, error) +- client.SecondaryDNS.TSIGs.Get(ctx context.Context, tsigID interface{}, query cloudflare.SecondaryDNSTSIGGetParams) (cloudflare.SecondaryDnstsigGetResponse, error) # WaitingRooms @@ -2677,6 +2717,34 @@ Methods: - client.Workers.Scripts.UsageModel.Update(ctx context.Context, scriptName string, params cloudflare.WorkerScriptUsageModelUpdateParams) (cloudflare.WorkerScriptUsageModelUpdateResponse, error) - client.Workers.Scripts.UsageModel.Get(ctx context.Context, scriptName string, query cloudflare.WorkerScriptUsageModelGetParams) (cloudflare.WorkerScriptUsageModelGetResponse, error) +### Content + +Response Types: + +- cloudflare.WorkerScriptContentUpdateResponse + +Methods: + +- client.Workers.Scripts.Content.Update(ctx context.Context, scriptName string, params cloudflare.WorkerScriptContentUpdateParams) (cloudflare.WorkerScriptContentUpdateResponse, error) + +### ContentV2 + +Methods: + +- client.Workers.Scripts.ContentV2.Get(ctx context.Context, scriptName string, query cloudflare.WorkerScriptContentV2GetParams) (http.Response, error) + +### Settings + +Response Types: + +- cloudflare.WorkerScriptSettingEditResponse +- cloudflare.WorkerScriptSettingGetResponse + +Methods: + +- client.Workers.Scripts.Settings.Edit(ctx context.Context, scriptName string, params cloudflare.WorkerScriptSettingEditParams) (cloudflare.WorkerScriptSettingEditResponse, error) +- client.Workers.Scripts.Settings.Get(ctx context.Context, scriptName string, query cloudflare.WorkerScriptSettingGetParams) (cloudflare.WorkerScriptSettingGetResponse, error) + ## Filters Response Types: @@ -2820,18 +2888,6 @@ Methods: - client.Workers.Subdomains.Update(ctx context.Context, params cloudflare.WorkerSubdomainUpdateParams) (cloudflare.WorkerSubdomainUpdateResponse, error) - client.Workers.Subdomains.Get(ctx context.Context, query cloudflare.WorkerSubdomainGetParams) (cloudflare.WorkerSubdomainGetResponse, error) -## DeploymentsByScript - -Response Types: - -- cloudflare.WorkerDeploymentsByScriptListResponse -- cloudflare.WorkerDeploymentsByScriptDetailResponse - -Methods: - -- client.Workers.DeploymentsByScript.List(ctx context.Context, scriptID string, query cloudflare.WorkerDeploymentsByScriptListParams) (cloudflare.WorkerDeploymentsByScriptListResponse, error) -- client.Workers.DeploymentsByScript.Detail(ctx context.Context, scriptID string, deploymentID string, query cloudflare.WorkerDeploymentsByScriptDetailParams) (cloudflare.WorkerDeploymentsByScriptDetailResponse, error) - ## Services ### Environments @@ -2859,27 +2915,68 @@ Methods: - client.Workers.Services.Environments.Settings.Edit(ctx context.Context, serviceName string, environmentName string, params cloudflare.WorkerServiceEnvironmentSettingEditParams) (cloudflare.WorkerServiceEnvironmentSettingEditResponse, error) - client.Workers.Services.Environments.Settings.Get(ctx context.Context, serviceName string, environmentName string, query cloudflare.WorkerServiceEnvironmentSettingGetParams) (cloudflare.WorkerServiceEnvironmentSettingGetResponse, error) -## Script +# KV + +## Namespaces Response Types: -- cloudflare.WorkerScriptUpdateResponse +- cloudflare.KVNamespaceNewResponse +- cloudflare.KVNamespaceUpdateResponse +- cloudflare.KVNamespaceListResponse +- cloudflare.KVNamespaceDeleteResponse + +Methods: + +- client.KV.Namespaces.New(ctx context.Context, params cloudflare.KVNamespaceNewParams) (cloudflare.KVNamespaceNewResponse, error) +- client.KV.Namespaces.Update(ctx context.Context, namespaceID string, params cloudflare.KVNamespaceUpdateParams) (cloudflare.KVNamespaceUpdateResponse, error) +- client.KV.Namespaces.List(ctx context.Context, params cloudflare.KVNamespaceListParams) (shared.V4PagePaginationArray[cloudflare.KVNamespaceListResponse], error) +- client.KV.Namespaces.Delete(ctx context.Context, namespaceID string, body cloudflare.KVNamespaceDeleteParams) (cloudflare.KVNamespaceDeleteResponse, error) + +### Bulk + +Response Types: + +- cloudflare.KVNamespaceBulkUpdateResponse +- cloudflare.KVNamespaceBulkDeleteResponse + +Methods: + +- client.KV.Namespaces.Bulk.Update(ctx context.Context, namespaceID string, params cloudflare.KVNamespaceBulkUpdateParams) (cloudflare.KVNamespaceBulkUpdateResponse, error) +- client.KV.Namespaces.Bulk.Delete(ctx context.Context, namespaceID string, params cloudflare.KVNamespaceBulkDeleteParams) (cloudflare.KVNamespaceBulkDeleteResponse, error) + +### Keys + +Response Types: + +- cloudflare.KVNamespaceKeyListResponse + +Methods: + +- client.KV.Namespaces.Keys.List(ctx context.Context, namespaceID string, params cloudflare.KVNamespaceKeyListParams) ([]cloudflare.KVNamespaceKeyListResponse, error) + +### Metadata + +Response Types: + +- cloudflare.KVNamespaceMetadataGetResponse Methods: -- client.Workers.Script.Update(ctx context.Context, body cloudflare.WorkerScriptUpdateParams) (cloudflare.WorkerScriptUpdateResponse, error) -- client.Workers.Script.Delete(ctx context.Context, body cloudflare.WorkerScriptDeleteParams) error -- client.Workers.Script.Get(ctx context.Context, query cloudflare.WorkerScriptGetParams) (http.Response, error) +- client.KV.Namespaces.Metadata.Get(ctx context.Context, namespaceID string, keyName string, query cloudflare.KVNamespaceMetadataGetParams) (cloudflare.KVNamespaceMetadataGetResponse, error) -# ActivationChecks +### Values Response Types: -- cloudflare.ActivationCheckUpdateResponse +- cloudflare.KVNamespaceValueUpdateResponse +- cloudflare.KVNamespaceValueDeleteResponse Methods: -- client.ActivationChecks.Update(ctx context.Context, body cloudflare.ActivationCheckUpdateParams) (cloudflare.ActivationCheckUpdateResponse, error) +- client.KV.Namespaces.Values.Update(ctx context.Context, namespaceID string, keyName string, params cloudflare.KVNamespaceValueUpdateParams) (cloudflare.KVNamespaceValueUpdateResponse, error) +- client.KV.Namespaces.Values.Delete(ctx context.Context, namespaceID string, keyName string, body cloudflare.KVNamespaceValueDeleteParams) (cloudflare.KVNamespaceValueDeleteResponse, error) +- client.KV.Namespaces.Values.Get(ctx context.Context, namespaceID string, keyName string, query cloudflare.KVNamespaceValueGetParams) (string, error) # ManagedHeaders @@ -3094,6 +3191,16 @@ Methods: # Addresses +## Services + +Response Types: + +- cloudflare.AddressServiceListResponse + +Methods: + +- client.Addresses.Services.List(ctx context.Context, query cloudflare.AddressServiceListParams) ([]cloudflare.AddressServiceListResponse, error) + ## AddressMaps Response Types: @@ -3186,7 +3293,37 @@ Methods: - client.Addresses.Prefixes.Edit(ctx context.Context, prefixID string, params cloudflare.AddressPrefixEditParams) (cloudflare.AddressPrefixEditResponse, error) - client.Addresses.Prefixes.Get(ctx context.Context, prefixID string, query cloudflare.AddressPrefixGetParams) (cloudflare.AddressPrefixGetResponse, error) -### BGPs +### BGP + +#### Bindings + +Response Types: + +- cloudflare.AddressPrefixBGPBindingNewResponse +- cloudflare.AddressPrefixBGPBindingListResponse +- cloudflare.AddressPrefixBGPBindingDeleteResponse +- cloudflare.AddressPrefixBGPBindingGetResponse + +Methods: + +- client.Addresses.Prefixes.BGP.Bindings.New(ctx context.Context, prefixID string, params cloudflare.AddressPrefixBGPBindingNewParams) (cloudflare.AddressPrefixBGPBindingNewResponse, error) +- client.Addresses.Prefixes.BGP.Bindings.List(ctx context.Context, prefixID string, query cloudflare.AddressPrefixBGPBindingListParams) ([]cloudflare.AddressPrefixBGPBindingListResponse, error) +- client.Addresses.Prefixes.BGP.Bindings.Delete(ctx context.Context, prefixID string, bindingID string, body cloudflare.AddressPrefixBGPBindingDeleteParams) (cloudflare.AddressPrefixBGPBindingDeleteResponse, error) +- client.Addresses.Prefixes.BGP.Bindings.Get(ctx context.Context, prefixID string, bindingID string, query cloudflare.AddressPrefixBGPBindingGetParams) (cloudflare.AddressPrefixBGPBindingGetResponse, error) + +#### Prefixes + +Response Types: + +- cloudflare.AddressPrefixBGPPrefixListResponse +- cloudflare.AddressPrefixBGPPrefixEditResponse +- cloudflare.AddressPrefixBGPPrefixGetResponse + +Methods: + +- client.Addresses.Prefixes.BGP.Prefixes.List(ctx context.Context, prefixID string, query cloudflare.AddressPrefixBGPPrefixListParams) ([]cloudflare.AddressPrefixBGPPrefixListResponse, error) +- client.Addresses.Prefixes.BGP.Prefixes.Edit(ctx context.Context, prefixID string, bgpPrefixID string, params cloudflare.AddressPrefixBGPPrefixEditParams) (cloudflare.AddressPrefixBGPPrefixEditResponse, error) +- client.Addresses.Prefixes.BGP.Prefixes.Get(ctx context.Context, prefixID string, bgpPrefixID string, query cloudflare.AddressPrefixBGPPrefixGetParams) (cloudflare.AddressPrefixBGPPrefixGetResponse, error) #### Statuses @@ -3197,8 +3334,8 @@ Response Types: Methods: -- client.Addresses.Prefixes.BGPs.Statuses.Edit(ctx context.Context, prefixID string, params cloudflare.AddressPrefixBGPStatusEditParams) (cloudflare.AddressPrefixBGPStatusEditResponse, error) -- client.Addresses.Prefixes.BGPs.Statuses.Get(ctx context.Context, prefixID string, query cloudflare.AddressPrefixBGPStatusGetParams) (cloudflare.AddressPrefixBGPStatusGetResponse, error) +- client.Addresses.Prefixes.BGP.Statuses.Edit(ctx context.Context, prefixID string, params cloudflare.AddressPrefixBGPStatusEditParams) (cloudflare.AddressPrefixBGPStatusEditResponse, error) +- client.Addresses.Prefixes.BGP.Statuses.Get(ctx context.Context, prefixID string, query cloudflare.AddressPrefixBGPStatusGetParams) (cloudflare.AddressPrefixBGPStatusGetResponse, error) ### Delegations @@ -3238,25 +3375,15 @@ Methods: # BrandProtection -## Submits - -Response Types: - -- cloudflare.BrandProtectionSubmitNewResponse - -Methods: - -- client.BrandProtection.Submits.New(ctx context.Context, params cloudflare.BrandProtectionSubmitNewParams) (cloudflare.BrandProtectionSubmitNewResponse, error) - -## URLInfos - Response Types: -- cloudflare.BrandProtectionURLInfoGetResponse +- cloudflare.BrandProtectionSubmitResponse +- cloudflare.BrandProtectionURLInfoResponse Methods: -- client.BrandProtection.URLInfos.Get(ctx context.Context, params cloudflare.BrandProtectionURLInfoGetParams) (cloudflare.BrandProtectionURLInfoGetResponse, error) +- client.BrandProtection.Submit(ctx context.Context, params cloudflare.BrandProtectionSubmitParams) (cloudflare.BrandProtectionSubmitResponse, error) +- client.BrandProtection.URLInfo(ctx context.Context, params cloudflare.BrandProtectionURLInfoParams) (cloudflare.BrandProtectionURLInfoResponse, error) # Tunnels @@ -3300,7 +3427,7 @@ Methods: - client.Tunnels.Connections.List(ctx context.Context, tunnelID string, query cloudflare.TunnelConnectionListParams) ([]cloudflare.TunnelConnectionListResponse, error) - client.Tunnels.Connections.Delete(ctx context.Context, tunnelID string, params cloudflare.TunnelConnectionDeleteParams) (cloudflare.TunnelConnectionDeleteResponse, error) -## Tokens +## Token Response Types: @@ -3308,7 +3435,7 @@ Response Types: Methods: -- client.Tunnels.Tokens.Get(ctx context.Context, tunnelID string, query cloudflare.TunnelTokenGetParams) (cloudflare.TunnelTokenGetResponse, error) +- client.Tunnels.Token.Get(ctx context.Context, tunnelID string, query cloudflare.TunnelTokenGetParams) (cloudflare.TunnelTokenGetResponse, error) ## Connectors @@ -3437,7 +3564,7 @@ Methods: # Images -## V1s +## V1 Response Types: @@ -3449,11 +3576,11 @@ Response Types: Methods: -- client.Images.V1s.New(ctx context.Context, params cloudflare.ImageV1NewParams) (cloudflare.ImageV1NewResponse, error) -- client.Images.V1s.List(ctx context.Context, params cloudflare.ImageV1ListParams) (shared.V4PagePagination[cloudflare.ImageV1ListResponse], error) -- client.Images.V1s.Delete(ctx context.Context, imageID string, body cloudflare.ImageV1DeleteParams) (cloudflare.ImageV1DeleteResponse, error) -- client.Images.V1s.Edit(ctx context.Context, imageID string, params cloudflare.ImageV1EditParams) (cloudflare.ImageV1EditResponse, error) -- client.Images.V1s.Get(ctx context.Context, imageID string, query cloudflare.ImageV1GetParams) (cloudflare.ImageV1GetResponse, error) +- client.Images.V1.New(ctx context.Context, params cloudflare.ImageV1NewParams) (cloudflare.ImageV1NewResponse, error) +- client.Images.V1.List(ctx context.Context, params cloudflare.ImageV1ListParams) (shared.V4PagePagination[cloudflare.ImageV1ListResponse], error) +- client.Images.V1.Delete(ctx context.Context, imageID string, body cloudflare.ImageV1DeleteParams) (cloudflare.ImageV1DeleteResponse, error) +- client.Images.V1.Edit(ctx context.Context, imageID string, params cloudflare.ImageV1EditParams) (cloudflare.ImageV1EditResponse, error) +- client.Images.V1.Get(ctx context.Context, imageID string, query cloudflare.ImageV1GetParams) (cloudflare.ImageV1GetResponse, error) ### Keys @@ -3463,7 +3590,7 @@ Response Types: Methods: -- client.Images.V1s.Keys.List(ctx context.Context, query cloudflare.ImageV1KeyListParams) (cloudflare.ImageV1KeyListResponse, error) +- client.Images.V1.Keys.List(ctx context.Context, query cloudflare.ImageV1KeyListParams) (cloudflare.ImageV1KeyListResponse, error) ### Stats @@ -3473,7 +3600,7 @@ Response Types: Methods: -- client.Images.V1s.Stats.Get(ctx context.Context, query cloudflare.ImageV1StatGetParams) (cloudflare.ImageV1StatGetResponse, error) +- client.Images.V1.Stats.Get(ctx context.Context, query cloudflare.ImageV1StatGetParams) (cloudflare.ImageV1StatGetResponse, error) ### Variants @@ -3487,19 +3614,19 @@ Response Types: Methods: -- client.Images.V1s.Variants.New(ctx context.Context, params cloudflare.ImageV1VariantNewParams) (cloudflare.ImageV1VariantNewResponse, error) -- client.Images.V1s.Variants.List(ctx context.Context, query cloudflare.ImageV1VariantListParams) (cloudflare.ImageV1VariantListResponse, error) -- client.Images.V1s.Variants.Delete(ctx context.Context, variantID interface{}, body cloudflare.ImageV1VariantDeleteParams) (cloudflare.ImageV1VariantDeleteResponse, error) -- client.Images.V1s.Variants.Edit(ctx context.Context, variantID interface{}, params cloudflare.ImageV1VariantEditParams) (cloudflare.ImageV1VariantEditResponse, error) -- client.Images.V1s.Variants.Get(ctx context.Context, variantID interface{}, query cloudflare.ImageV1VariantGetParams) (cloudflare.ImageV1VariantGetResponse, error) +- client.Images.V1.Variants.New(ctx context.Context, params cloudflare.ImageV1VariantNewParams) (cloudflare.ImageV1VariantNewResponse, error) +- client.Images.V1.Variants.List(ctx context.Context, query cloudflare.ImageV1VariantListParams) (cloudflare.ImageV1VariantListResponse, error) +- client.Images.V1.Variants.Delete(ctx context.Context, variantID interface{}, body cloudflare.ImageV1VariantDeleteParams) (cloudflare.ImageV1VariantDeleteResponse, error) +- client.Images.V1.Variants.Edit(ctx context.Context, variantID interface{}, params cloudflare.ImageV1VariantEditParams) (cloudflare.ImageV1VariantEditResponse, error) +- client.Images.V1.Variants.Get(ctx context.Context, variantID interface{}, query cloudflare.ImageV1VariantGetParams) (cloudflare.ImageV1VariantGetResponse, error) ### Blobs Methods: -- client.Images.V1s.Blobs.Get(ctx context.Context, imageID string, query cloudflare.ImageV1BlobGetParams) (http.Response, error) +- client.Images.V1.Blobs.Get(ctx context.Context, imageID string, query cloudflare.ImageV1BlobGetParams) (http.Response, error) -## V2s +## V2 Response Types: @@ -3507,7 +3634,7 @@ Response Types: Methods: -- client.Images.V2s.List(ctx context.Context, params cloudflare.ImageV2ListParams) (cloudflare.ImageV2ListResponse, error) +- client.Images.V2.List(ctx context.Context, params cloudflare.ImageV2ListParams) (cloudflare.ImageV2ListResponse, error) ### DirectUploads @@ -3517,7 +3644,7 @@ Response Types: Methods: -- client.Images.V2s.DirectUploads.New(ctx context.Context, params cloudflare.ImageV2DirectUploadNewParams) (cloudflare.ImageV2DirectUploadNewResponse, error) +- client.Images.V2.DirectUploads.New(ctx context.Context, params cloudflare.ImageV2DirectUploadNewParams) (cloudflare.ImageV2DirectUploadNewResponse, error) # Intel @@ -3658,105 +3785,87 @@ Methods: - client.Intel.Sinkholes.List(ctx context.Context, query cloudflare.IntelSinkholeListParams) ([]cloudflare.IntelSinkholeListResponse, error) -# Magics +# MagicTransit ## CfInterconnects Response Types: -- cloudflare.MagicCfInterconnectUpdateResponse -- cloudflare.MagicCfInterconnectListResponse -- cloudflare.MagicCfInterconnectGetResponse +- cloudflare.MagicTransitCfInterconnectUpdateResponse +- cloudflare.MagicTransitCfInterconnectListResponse +- cloudflare.MagicTransitCfInterconnectGetResponse Methods: -- client.Magics.CfInterconnects.Update(ctx context.Context, accountIdentifier string, tunnelIdentifier string, body cloudflare.MagicCfInterconnectUpdateParams) (cloudflare.MagicCfInterconnectUpdateResponse, error) -- client.Magics.CfInterconnects.List(ctx context.Context, accountIdentifier string) (cloudflare.MagicCfInterconnectListResponse, error) -- client.Magics.CfInterconnects.Get(ctx context.Context, accountIdentifier string, tunnelIdentifier string) (cloudflare.MagicCfInterconnectGetResponse, error) +- client.MagicTransit.CfInterconnects.Update(ctx context.Context, accountIdentifier string, tunnelIdentifier string, body cloudflare.MagicTransitCfInterconnectUpdateParams) (cloudflare.MagicTransitCfInterconnectUpdateResponse, error) +- client.MagicTransit.CfInterconnects.List(ctx context.Context, accountIdentifier string) (cloudflare.MagicTransitCfInterconnectListResponse, error) +- client.MagicTransit.CfInterconnects.Get(ctx context.Context, accountIdentifier string, tunnelIdentifier string) (cloudflare.MagicTransitCfInterconnectGetResponse, error) ## GRETunnels Response Types: -- cloudflare.MagicGRETunnelNewResponse -- cloudflare.MagicGRETunnelUpdateResponse -- cloudflare.MagicGRETunnelListResponse -- cloudflare.MagicGRETunnelDeleteResponse -- cloudflare.MagicGRETunnelGetResponse +- cloudflare.MagicTransitGRETunnelNewResponse +- cloudflare.MagicTransitGRETunnelUpdateResponse +- cloudflare.MagicTransitGRETunnelListResponse +- cloudflare.MagicTransitGRETunnelDeleteResponse +- cloudflare.MagicTransitGRETunnelGetResponse Methods: -- client.Magics.GRETunnels.New(ctx context.Context, accountIdentifier string, body cloudflare.MagicGRETunnelNewParams) (cloudflare.MagicGRETunnelNewResponse, error) -- client.Magics.GRETunnels.Update(ctx context.Context, accountIdentifier string, tunnelIdentifier string, body cloudflare.MagicGRETunnelUpdateParams) (cloudflare.MagicGRETunnelUpdateResponse, error) -- client.Magics.GRETunnels.List(ctx context.Context, accountIdentifier string) (cloudflare.MagicGRETunnelListResponse, error) -- client.Magics.GRETunnels.Delete(ctx context.Context, accountIdentifier string, tunnelIdentifier string) (cloudflare.MagicGRETunnelDeleteResponse, error) -- client.Magics.GRETunnels.Get(ctx context.Context, accountIdentifier string, tunnelIdentifier string) (cloudflare.MagicGRETunnelGetResponse, error) +- client.MagicTransit.GRETunnels.New(ctx context.Context, accountIdentifier string, body cloudflare.MagicTransitGRETunnelNewParams) (cloudflare.MagicTransitGRETunnelNewResponse, error) +- client.MagicTransit.GRETunnels.Update(ctx context.Context, accountIdentifier string, tunnelIdentifier string, body cloudflare.MagicTransitGRETunnelUpdateParams) (cloudflare.MagicTransitGRETunnelUpdateResponse, error) +- client.MagicTransit.GRETunnels.List(ctx context.Context, accountIdentifier string) (cloudflare.MagicTransitGRETunnelListResponse, error) +- client.MagicTransit.GRETunnels.Delete(ctx context.Context, accountIdentifier string, tunnelIdentifier string) (cloudflare.MagicTransitGRETunnelDeleteResponse, error) +- client.MagicTransit.GRETunnels.Get(ctx context.Context, accountIdentifier string, tunnelIdentifier string) (cloudflare.MagicTransitGRETunnelGetResponse, error) ## IPSECTunnels Response Types: -- cloudflare.MagicIPSECTunnelNewResponse -- cloudflare.MagicIPSECTunnelUpdateResponse -- cloudflare.MagicIPSECTunnelListResponse -- cloudflare.MagicIPSECTunnelDeleteResponse -- cloudflare.MagicIPSECTunnelGetResponse +- cloudflare.MagicTransitIPSECTunnelNewResponse +- cloudflare.MagicTransitIPSECTunnelUpdateResponse +- cloudflare.MagicTransitIPSECTunnelListResponse +- cloudflare.MagicTransitIPSECTunnelDeleteResponse +- cloudflare.MagicTransitIPSECTunnelGetResponse Methods: -- client.Magics.IPSECTunnels.New(ctx context.Context, accountIdentifier string, body cloudflare.MagicIPSECTunnelNewParams) (cloudflare.MagicIPSECTunnelNewResponse, error) -- client.Magics.IPSECTunnels.Update(ctx context.Context, accountIdentifier string, tunnelIdentifier string, body cloudflare.MagicIPSECTunnelUpdateParams) (cloudflare.MagicIPSECTunnelUpdateResponse, error) -- client.Magics.IPSECTunnels.List(ctx context.Context, accountIdentifier string) (cloudflare.MagicIPSECTunnelListResponse, error) -- client.Magics.IPSECTunnels.Delete(ctx context.Context, accountIdentifier string, tunnelIdentifier string) (cloudflare.MagicIPSECTunnelDeleteResponse, error) -- client.Magics.IPSECTunnels.Get(ctx context.Context, accountIdentifier string, tunnelIdentifier string) (cloudflare.MagicIPSECTunnelGetResponse, error) +- client.MagicTransit.IPSECTunnels.New(ctx context.Context, accountIdentifier string, body cloudflare.MagicTransitIPSECTunnelNewParams) (cloudflare.MagicTransitIPSECTunnelNewResponse, error) +- client.MagicTransit.IPSECTunnels.Update(ctx context.Context, accountIdentifier string, tunnelIdentifier string, body cloudflare.MagicTransitIPSECTunnelUpdateParams) (cloudflare.MagicTransitIPSECTunnelUpdateResponse, error) +- client.MagicTransit.IPSECTunnels.List(ctx context.Context, accountIdentifier string) (cloudflare.MagicTransitIPSECTunnelListResponse, error) +- client.MagicTransit.IPSECTunnels.Delete(ctx context.Context, accountIdentifier string, tunnelIdentifier string) (cloudflare.MagicTransitIPSECTunnelDeleteResponse, error) +- client.MagicTransit.IPSECTunnels.Get(ctx context.Context, accountIdentifier string, tunnelIdentifier string) (cloudflare.MagicTransitIPSECTunnelGetResponse, error) ### PSKGenerates Response Types: -- cloudflare.MagicIPSECTunnelPSKGenerateNewResponse +- cloudflare.MagicTransitIPSECTunnelPSKGenerateNewResponse Methods: -- client.Magics.IPSECTunnels.PSKGenerates.New(ctx context.Context, accountIdentifier string, tunnelIdentifier string) (cloudflare.MagicIPSECTunnelPSKGenerateNewResponse, error) +- client.MagicTransit.IPSECTunnels.PSKGenerates.New(ctx context.Context, accountIdentifier string, tunnelIdentifier string) (cloudflare.MagicTransitIPSECTunnelPSKGenerateNewResponse, error) ## Routes Response Types: -- cloudflare.MagicRouteNewResponse -- cloudflare.MagicRouteUpdateResponse -- cloudflare.MagicRouteListResponse -- cloudflare.MagicRouteDeleteResponse -- cloudflare.MagicRouteEmptyResponse -- cloudflare.MagicRouteGetResponse - -Methods: - -- client.Magics.Routes.New(ctx context.Context, accountIdentifier string, body cloudflare.MagicRouteNewParams) (cloudflare.MagicRouteNewResponse, error) -- client.Magics.Routes.Update(ctx context.Context, accountIdentifier string, routeIdentifier string, body cloudflare.MagicRouteUpdateParams) (cloudflare.MagicRouteUpdateResponse, error) -- client.Magics.Routes.List(ctx context.Context, accountIdentifier string) (cloudflare.MagicRouteListResponse, error) -- client.Magics.Routes.Delete(ctx context.Context, accountIdentifier string, routeIdentifier string) (cloudflare.MagicRouteDeleteResponse, error) -- client.Magics.Routes.Empty(ctx context.Context, accountIdentifier string, body cloudflare.MagicRouteEmptyParams) (cloudflare.MagicRouteEmptyResponse, error) -- client.Magics.Routes.Get(ctx context.Context, accountIdentifier string, routeIdentifier string) (cloudflare.MagicRouteGetResponse, error) - -# AccountMembers - -Response Types: - -- cloudflare.AccountMemberNewResponse -- cloudflare.AccountMemberUpdateResponse -- cloudflare.AccountMemberListResponse -- cloudflare.AccountMemberDeleteResponse -- cloudflare.AccountMemberGetResponse +- cloudflare.MagicTransitRouteNewResponse +- cloudflare.MagicTransitRouteUpdateResponse +- cloudflare.MagicTransitRouteListResponse +- cloudflare.MagicTransitRouteDeleteResponse +- cloudflare.MagicTransitRouteEmptyResponse +- cloudflare.MagicTransitRouteGetResponse Methods: -- client.AccountMembers.New(ctx context.Context, params cloudflare.AccountMemberNewParams) (cloudflare.AccountMemberNewResponse, error) -- client.AccountMembers.Update(ctx context.Context, memberID string, params cloudflare.AccountMemberUpdateParams) (cloudflare.AccountMemberUpdateResponse, error) -- client.AccountMembers.List(ctx context.Context, params cloudflare.AccountMemberListParams) (shared.V4PagePaginationArray[cloudflare.AccountMemberListResponse], error) -- client.AccountMembers.Delete(ctx context.Context, memberID string, body cloudflare.AccountMemberDeleteParams) (cloudflare.AccountMemberDeleteResponse, error) -- client.AccountMembers.Get(ctx context.Context, memberID string, query cloudflare.AccountMemberGetParams) (cloudflare.AccountMemberGetResponse, error) +- client.MagicTransit.Routes.New(ctx context.Context, accountIdentifier string, body cloudflare.MagicTransitRouteNewParams) (cloudflare.MagicTransitRouteNewResponse, error) +- client.MagicTransit.Routes.Update(ctx context.Context, accountIdentifier string, routeIdentifier string, body cloudflare.MagicTransitRouteUpdateParams) (cloudflare.MagicTransitRouteUpdateResponse, error) +- client.MagicTransit.Routes.List(ctx context.Context, accountIdentifier string) (cloudflare.MagicTransitRouteListResponse, error) +- client.MagicTransit.Routes.Delete(ctx context.Context, accountIdentifier string, routeIdentifier string) (cloudflare.MagicTransitRouteDeleteResponse, error) +- client.MagicTransit.Routes.Empty(ctx context.Context, accountIdentifier string, body cloudflare.MagicTransitRouteEmptyParams) (cloudflare.MagicTransitRouteEmptyResponse, error) +- client.MagicTransit.Routes.Get(ctx context.Context, accountIdentifier string, routeIdentifier string) (cloudflare.MagicTransitRouteGetResponse, error) # MNMs @@ -3973,6 +4082,7 @@ Methods: Response Types: +- cloudflare.JjJoFrd1Trace - cloudflare.RequestTracerTraceNewResponse Methods: @@ -4053,69 +4163,6 @@ Methods: - client.Storage.Analytics.List(ctx context.Context, params cloudflare.StorageAnalyticsListParams) (cloudflare.StorageAnalyticsListResponse, error) - client.Storage.Analytics.Stored(ctx context.Context, params cloudflare.StorageAnalyticsStoredParams) (cloudflare.StorageAnalyticsStoredResponse, error) -## KV - -### Namespaces - -Response Types: - -- cloudflare.StorageKVNamespaceNewResponse -- cloudflare.StorageKVNamespaceUpdateResponse -- cloudflare.StorageKVNamespaceListResponse -- cloudflare.StorageKVNamespaceDeleteResponse - -Methods: - -- client.Storage.KV.Namespaces.New(ctx context.Context, params cloudflare.StorageKVNamespaceNewParams) (cloudflare.StorageKVNamespaceNewResponse, error) -- client.Storage.KV.Namespaces.Update(ctx context.Context, namespaceID string, params cloudflare.StorageKVNamespaceUpdateParams) (cloudflare.StorageKVNamespaceUpdateResponse, error) -- client.Storage.KV.Namespaces.List(ctx context.Context, params cloudflare.StorageKVNamespaceListParams) (shared.V4PagePaginationArray[cloudflare.StorageKVNamespaceListResponse], error) -- client.Storage.KV.Namespaces.Delete(ctx context.Context, namespaceID string, body cloudflare.StorageKVNamespaceDeleteParams) (cloudflare.StorageKVNamespaceDeleteResponse, error) - -#### Bulk - -Response Types: - -- cloudflare.StorageKVNamespaceBulkUpdateResponse -- cloudflare.StorageKVNamespaceBulkDeleteResponse - -Methods: - -- client.Storage.KV.Namespaces.Bulk.Update(ctx context.Context, namespaceID string, params cloudflare.StorageKVNamespaceBulkUpdateParams) (cloudflare.StorageKVNamespaceBulkUpdateResponse, error) -- client.Storage.KV.Namespaces.Bulk.Delete(ctx context.Context, namespaceID string, params cloudflare.StorageKVNamespaceBulkDeleteParams) (cloudflare.StorageKVNamespaceBulkDeleteResponse, error) - -#### Keys - -Response Types: - -- cloudflare.StorageKVNamespaceKeyListResponse - -Methods: - -- client.Storage.KV.Namespaces.Keys.List(ctx context.Context, namespaceID string, params cloudflare.StorageKVNamespaceKeyListParams) ([]cloudflare.StorageKVNamespaceKeyListResponse, error) - -#### Metadata - -Response Types: - -- cloudflare.StorageKVNamespaceMetadataGetResponse - -Methods: - -- client.Storage.KV.Namespaces.Metadata.Get(ctx context.Context, namespaceID string, keyName string, query cloudflare.StorageKVNamespaceMetadataGetParams) (cloudflare.StorageKVNamespaceMetadataGetResponse, error) - -#### Values - -Response Types: - -- cloudflare.StorageKVNamespaceValueUpdateResponse -- cloudflare.StorageKVNamespaceValueDeleteResponse - -Methods: - -- client.Storage.KV.Namespaces.Values.Update(ctx context.Context, namespaceID string, keyName string, params cloudflare.StorageKVNamespaceValueUpdateParams) (cloudflare.StorageKVNamespaceValueUpdateResponse, error) -- client.Storage.KV.Namespaces.Values.Delete(ctx context.Context, namespaceID string, keyName string, body cloudflare.StorageKVNamespaceValueDeleteParams) (cloudflare.StorageKVNamespaceValueDeleteResponse, error) -- client.Storage.KV.Namespaces.Values.Get(ctx context.Context, namespaceID string, keyName string, query cloudflare.StorageKVNamespaceValueGetParams) (string, error) - # Stream Response Types: @@ -4310,58 +4357,6 @@ Methods: - client.Stream.Tokens.New(ctx context.Context, identifier string, params cloudflare.StreamTokenNewParams) (cloudflare.StreamTokenNewResponse, error) -# Teamnets - -## Routes - -Response Types: - -- cloudflare.TeamnetRouteListResponse - -Methods: - -- client.Teamnets.Routes.List(ctx context.Context, params cloudflare.TeamnetRouteListParams) (shared.V4PagePaginationArray[cloudflare.TeamnetRouteListResponse], error) - -### IPs - -Response Types: - -- cloudflare.TeamnetRouteIPGetResponse - -Methods: - -- client.Teamnets.Routes.IPs.Get(ctx context.Context, ip string, params cloudflare.TeamnetRouteIPGetParams) (cloudflare.TeamnetRouteIPGetResponse, error) - -### Networks - -Response Types: - -- cloudflare.TeamnetRouteNetworkNewResponse -- cloudflare.TeamnetRouteNetworkDeleteResponse -- cloudflare.TeamnetRouteNetworkEditResponse - -Methods: - -- client.Teamnets.Routes.Networks.New(ctx context.Context, ipNetworkEncoded string, params cloudflare.TeamnetRouteNetworkNewParams) (cloudflare.TeamnetRouteNetworkNewResponse, error) -- client.Teamnets.Routes.Networks.Delete(ctx context.Context, ipNetworkEncoded string, params cloudflare.TeamnetRouteNetworkDeleteParams) (cloudflare.TeamnetRouteNetworkDeleteResponse, error) -- client.Teamnets.Routes.Networks.Edit(ctx context.Context, ipNetworkEncoded string, body cloudflare.TeamnetRouteNetworkEditParams) (cloudflare.TeamnetRouteNetworkEditResponse, error) - -## VirtualNetworks - -Response Types: - -- cloudflare.TeamnetVirtualNetworkNewResponse -- cloudflare.TeamnetVirtualNetworkListResponse -- cloudflare.TeamnetVirtualNetworkDeleteResponse -- cloudflare.TeamnetVirtualNetworkEditResponse - -Methods: - -- client.Teamnets.VirtualNetworks.New(ctx context.Context, params cloudflare.TeamnetVirtualNetworkNewParams) (cloudflare.TeamnetVirtualNetworkNewResponse, error) -- client.Teamnets.VirtualNetworks.List(ctx context.Context, params cloudflare.TeamnetVirtualNetworkListParams) ([]cloudflare.TeamnetVirtualNetworkListResponse, error) -- client.Teamnets.VirtualNetworks.Delete(ctx context.Context, virtualNetworkID string, body cloudflare.TeamnetVirtualNetworkDeleteParams) (cloudflare.TeamnetVirtualNetworkDeleteResponse, error) -- client.Teamnets.VirtualNetworks.Edit(ctx context.Context, virtualNetworkID string, params cloudflare.TeamnetVirtualNetworkEditParams) (cloudflare.TeamnetVirtualNetworkEditResponse, error) - # Gateways Response Types: @@ -4800,31 +4795,23 @@ Methods: # D1 -## Databases - -Response Types: - -- cloudflare.D1DatabaseNewResponse -- cloudflare.D1DatabaseListResponse - -Methods: - -- client.D1.Databases.New(ctx context.Context, params cloudflare.D1DatabaseNewParams) (cloudflare.D1DatabaseNewResponse, error) -- client.D1.Databases.List(ctx context.Context, params cloudflare.D1DatabaseListParams) (shared.V4PagePaginationArray[cloudflare.D1DatabaseListResponse], error) - ## Database Response Types: - cloudflare.D1DatabaseNewResponse +- cloudflare.D1DatabaseListResponse - cloudflare.D1DatabaseDeleteResponse - cloudflare.D1DatabaseGetResponse +- cloudflare.D1DatabaseQueryResponse Methods: -- client.D1.Database.New(ctx context.Context, accountIdentifier string, databaseIdentifier string, body cloudflare.D1DatabaseNewParams) ([]cloudflare.D1DatabaseNewResponse, error) +- client.D1.Database.New(ctx context.Context, params cloudflare.D1DatabaseNewParams) (cloudflare.D1DatabaseNewResponse, error) +- client.D1.Database.List(ctx context.Context, params cloudflare.D1DatabaseListParams) (shared.V4PagePaginationArray[cloudflare.D1DatabaseListResponse], error) - client.D1.Database.Delete(ctx context.Context, accountIdentifier string, databaseIdentifier string) (cloudflare.D1DatabaseDeleteResponse, error) - client.D1.Database.Get(ctx context.Context, accountIdentifier string, databaseIdentifier string) (cloudflare.D1DatabaseGetResponse, error) +- client.D1.Database.Query(ctx context.Context, accountIdentifier string, databaseIdentifier string, body cloudflare.D1DatabaseQueryParams) ([]cloudflare.D1DatabaseQueryResponse, error) # DEX @@ -4971,15 +4958,57 @@ Methods: Response Types: - cloudflare.TeamnetRouteNewResponse +- cloudflare.TeamnetRouteListResponse - cloudflare.TeamnetRouteDeleteResponse - cloudflare.TeamnetRouteEditResponse Methods: - client.Teamnet.Routes.New(ctx context.Context, params cloudflare.TeamnetRouteNewParams) (cloudflare.TeamnetRouteNewResponse, error) +- client.Teamnet.Routes.List(ctx context.Context, params cloudflare.TeamnetRouteListParams) (shared.V4PagePaginationArray[cloudflare.TeamnetRouteListResponse], error) - client.Teamnet.Routes.Delete(ctx context.Context, routeID string, body cloudflare.TeamnetRouteDeleteParams) (cloudflare.TeamnetRouteDeleteResponse, error) - client.Teamnet.Routes.Edit(ctx context.Context, routeID string, params cloudflare.TeamnetRouteEditParams) (cloudflare.TeamnetRouteEditResponse, error) +### IPs + +Response Types: + +- cloudflare.TeamnetRouteIPGetResponse + +Methods: + +- client.Teamnet.Routes.IPs.Get(ctx context.Context, ip string, params cloudflare.TeamnetRouteIPGetParams) (cloudflare.TeamnetRouteIPGetResponse, error) + +### Networks + +Response Types: + +- cloudflare.TeamnetRouteNetworkNewResponse +- cloudflare.TeamnetRouteNetworkDeleteResponse +- cloudflare.TeamnetRouteNetworkEditResponse + +Methods: + +- client.Teamnet.Routes.Networks.New(ctx context.Context, ipNetworkEncoded string, params cloudflare.TeamnetRouteNetworkNewParams) (cloudflare.TeamnetRouteNetworkNewResponse, error) +- client.Teamnet.Routes.Networks.Delete(ctx context.Context, ipNetworkEncoded string, params cloudflare.TeamnetRouteNetworkDeleteParams) (cloudflare.TeamnetRouteNetworkDeleteResponse, error) +- client.Teamnet.Routes.Networks.Edit(ctx context.Context, ipNetworkEncoded string, body cloudflare.TeamnetRouteNetworkEditParams) (cloudflare.TeamnetRouteNetworkEditResponse, error) + +## VirtualNetworks + +Response Types: + +- cloudflare.TeamnetVirtualNetworkNewResponse +- cloudflare.TeamnetVirtualNetworkListResponse +- cloudflare.TeamnetVirtualNetworkDeleteResponse +- cloudflare.TeamnetVirtualNetworkEditResponse + +Methods: + +- client.Teamnet.VirtualNetworks.New(ctx context.Context, params cloudflare.TeamnetVirtualNetworkNewParams) (cloudflare.TeamnetVirtualNetworkNewResponse, error) +- client.Teamnet.VirtualNetworks.List(ctx context.Context, params cloudflare.TeamnetVirtualNetworkListParams) ([]cloudflare.TeamnetVirtualNetworkListResponse, error) +- client.Teamnet.VirtualNetworks.Delete(ctx context.Context, virtualNetworkID string, body cloudflare.TeamnetVirtualNetworkDeleteParams) (cloudflare.TeamnetVirtualNetworkDeleteResponse, error) +- client.Teamnet.VirtualNetworks.Edit(ctx context.Context, virtualNetworkID string, params cloudflare.TeamnetVirtualNetworkEditParams) (cloudflare.TeamnetVirtualNetworkEditResponse, error) + # WARPConnector Response Types: @@ -5046,104 +5075,19 @@ Methods: - client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Settings.Edit(ctx context.Context, dispatchNamespace string, scriptName string, params cloudflare.WorkersForPlatformDispatchNamespaceScriptSettingEditParams) (cloudflare.WorkersForPlatformDispatchNamespaceScriptSettingEditResponse, error) - client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Settings.Get(ctx context.Context, dispatchNamespace string, scriptName string, query cloudflare.WorkersForPlatformDispatchNamespaceScriptSettingGetParams) (cloudflare.WorkersForPlatformDispatchNamespaceScriptSettingGetResponse, error) -# WorkerDomains - -Response Types: - -- cloudflare.WorkerDomainGetResponse - -Methods: - -- client.WorkerDomains.Delete(ctx context.Context, domainID interface{}, body cloudflare.WorkerDomainDeleteParams) error -- client.WorkerDomains.Get(ctx context.Context, domainID interface{}, query cloudflare.WorkerDomainGetParams) (cloudflare.WorkerDomainGetResponse, error) - -# WorkerScripts - -## Content - -Response Types: - -- cloudflare.WorkerScriptContentUpdateResponse - -Methods: - -- client.WorkerScripts.Content.Update(ctx context.Context, scriptName string, params cloudflare.WorkerScriptContentUpdateParams) (cloudflare.WorkerScriptContentUpdateResponse, error) - -## ContentV2 - -Methods: - -- client.WorkerScripts.ContentV2.Get(ctx context.Context, scriptName string, query cloudflare.WorkerScriptContentV2GetParams) (http.Response, error) - -## Settings - -Response Types: - -- cloudflare.WorkerScriptSettingEditResponse -- cloudflare.WorkerScriptSettingGetResponse - -Methods: - -- client.WorkerScripts.Settings.Edit(ctx context.Context, scriptName string, params cloudflare.WorkerScriptSettingEditParams) (cloudflare.WorkerScriptSettingEditResponse, error) -- client.WorkerScripts.Settings.Get(ctx context.Context, scriptName string, query cloudflare.WorkerScriptSettingGetParams) (cloudflare.WorkerScriptSettingGetResponse, error) - -# Zerotrust +# ZeroTrust ## ConnectivitySettings Response Types: -- cloudflare.ZerotrustConnectivitySettingEditResponse -- cloudflare.ZerotrustConnectivitySettingGetResponse - -Methods: - -- client.Zerotrust.ConnectivitySettings.Edit(ctx context.Context, params cloudflare.ZerotrustConnectivitySettingEditParams) (cloudflare.ZerotrustConnectivitySettingEditResponse, error) -- client.Zerotrust.ConnectivitySettings.Get(ctx context.Context, query cloudflare.ZerotrustConnectivitySettingGetParams) (cloudflare.ZerotrustConnectivitySettingGetResponse, error) - -# Addressing - -## Prefixes - -### BGPPrefixes - -Response Types: - -- cloudflare.AddressingPrefixBGPPrefixListResponse -- cloudflare.AddressingPrefixBGPPrefixEditResponse -- cloudflare.AddressingPrefixBGPPrefixGetResponse - -Methods: - -- client.Addressing.Prefixes.BGPPrefixes.List(ctx context.Context, prefixID string, query cloudflare.AddressingPrefixBGPPrefixListParams) ([]cloudflare.AddressingPrefixBGPPrefixListResponse, error) -- client.Addressing.Prefixes.BGPPrefixes.Edit(ctx context.Context, prefixID string, bgpPrefixID string, params cloudflare.AddressingPrefixBGPPrefixEditParams) (cloudflare.AddressingPrefixBGPPrefixEditResponse, error) -- client.Addressing.Prefixes.BGPPrefixes.Get(ctx context.Context, prefixID string, bgpPrefixID string, query cloudflare.AddressingPrefixBGPPrefixGetParams) (cloudflare.AddressingPrefixBGPPrefixGetResponse, error) - -### Bindings - -Response Types: - -- cloudflare.AddressingPrefixBindingNewResponse -- cloudflare.AddressingPrefixBindingListResponse -- cloudflare.AddressingPrefixBindingDeleteResponse -- cloudflare.AddressingPrefixBindingGetResponse - -Methods: - -- client.Addressing.Prefixes.Bindings.New(ctx context.Context, prefixID string, params cloudflare.AddressingPrefixBindingNewParams) (cloudflare.AddressingPrefixBindingNewResponse, error) -- client.Addressing.Prefixes.Bindings.List(ctx context.Context, prefixID string, query cloudflare.AddressingPrefixBindingListParams) ([]cloudflare.AddressingPrefixBindingListResponse, error) -- client.Addressing.Prefixes.Bindings.Delete(ctx context.Context, prefixID string, bindingID string, body cloudflare.AddressingPrefixBindingDeleteParams) (cloudflare.AddressingPrefixBindingDeleteResponse, error) -- client.Addressing.Prefixes.Bindings.Get(ctx context.Context, prefixID string, bindingID string, query cloudflare.AddressingPrefixBindingGetParams) (cloudflare.AddressingPrefixBindingGetResponse, error) - -## Services - -Response Types: - -- cloudflare.AddressingServiceListResponse +- cloudflare.ZeroTrustConnectivitySettingEditResponse +- cloudflare.ZeroTrustConnectivitySettingGetResponse Methods: -- client.Addressing.Services.List(ctx context.Context, query cloudflare.AddressingServiceListParams) ([]cloudflare.AddressingServiceListResponse, error) +- client.ZeroTrust.ConnectivitySettings.Edit(ctx context.Context, params cloudflare.ZeroTrustConnectivitySettingEditParams) (cloudflare.ZeroTrustConnectivitySettingEditResponse, error) +- client.ZeroTrust.ConnectivitySettings.Get(ctx context.Context, query cloudflare.ZeroTrustConnectivitySettingGetParams) (cloudflare.ZeroTrustConnectivitySettingGetResponse, error) # Challenges @@ -5687,11 +5631,21 @@ Response Types: - cloudflare.RadarEmailSecurityTimeseriesGroupARCResponse - cloudflare.RadarEmailSecurityTimeseriesGroupDKIMResponse +- cloudflare.RadarEmailSecurityTimeseriesGroupDMARCResponse +- cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousResponse +- cloudflare.RadarEmailSecurityTimeseriesGroupSpamResponse +- cloudflare.RadarEmailSecurityTimeseriesGroupSPFResponse +- cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryResponse Methods: - client.Radar.Email.Security.TimeseriesGroups.ARC(ctx context.Context, query cloudflare.RadarEmailSecurityTimeseriesGroupARCParams) (cloudflare.RadarEmailSecurityTimeseriesGroupARCResponse, error) - client.Radar.Email.Security.TimeseriesGroups.DKIM(ctx context.Context, query cloudflare.RadarEmailSecurityTimeseriesGroupDKIMParams) (cloudflare.RadarEmailSecurityTimeseriesGroupDKIMResponse, error) +- client.Radar.Email.Security.TimeseriesGroups.DMARC(ctx context.Context, query cloudflare.RadarEmailSecurityTimeseriesGroupDMARCParams) (cloudflare.RadarEmailSecurityTimeseriesGroupDMARCResponse, error) +- client.Radar.Email.Security.TimeseriesGroups.Malicious(ctx context.Context, query cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParams) (cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousResponse, error) +- client.Radar.Email.Security.TimeseriesGroups.Spam(ctx context.Context, query cloudflare.RadarEmailSecurityTimeseriesGroupSpamParams) (cloudflare.RadarEmailSecurityTimeseriesGroupSpamResponse, error) +- client.Radar.Email.Security.TimeseriesGroups.SPF(ctx context.Context, query cloudflare.RadarEmailSecurityTimeseriesGroupSPFParams) (cloudflare.RadarEmailSecurityTimeseriesGroupSPFResponse, error) +- client.Radar.Email.Security.TimeseriesGroups.ThreatCategory(ctx context.Context, query cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParams) (cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryResponse, error) ## Attacks @@ -5865,28 +5819,6 @@ Methods: - client.Radar.Attacks.Layer7.Top.Ases.Origin(ctx context.Context, query cloudflare.RadarAttackLayer7TopAseOriginParams) (cloudflare.RadarAttackLayer7TopAseOriginResponse, error) -## Emails - -### Security - -#### TimeseriesGroups - -Response Types: - -- cloudflare.RadarEmailSecurityTimeseriesGroupDMARCResponse -- cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousResponse -- cloudflare.RadarEmailSecurityTimeseriesGroupSpamResponse -- cloudflare.RadarEmailSecurityTimeseriesGroupSPFResponse -- cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryResponse - -Methods: - -- client.Radar.Emails.Security.TimeseriesGroups.DMARC(ctx context.Context, query cloudflare.RadarEmailSecurityTimeseriesGroupDMARCParams) (cloudflare.RadarEmailSecurityTimeseriesGroupDMARCResponse, error) -- client.Radar.Emails.Security.TimeseriesGroups.Malicious(ctx context.Context, query cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParams) (cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousResponse, error) -- client.Radar.Emails.Security.TimeseriesGroups.Spam(ctx context.Context, query cloudflare.RadarEmailSecurityTimeseriesGroupSpamParams) (cloudflare.RadarEmailSecurityTimeseriesGroupSpamResponse, error) -- client.Radar.Emails.Security.TimeseriesGroups.SPF(ctx context.Context, query cloudflare.RadarEmailSecurityTimeseriesGroupSPFParams) (cloudflare.RadarEmailSecurityTimeseriesGroupSPFResponse, error) -- client.Radar.Emails.Security.TimeseriesGroups.ThreatCategory(ctx context.Context, query cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParams) (cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryResponse, error) - ## Entities Response Types: @@ -6251,38 +6183,6 @@ Methods: - client.OriginPostQuantumEncryption.Update(ctx context.Context, params cloudflare.OriginPostQuantumEncryptionUpdateParams) (cloudflare.OriginPostQuantumEncryptionUpdateResponse, error) - client.OriginPostQuantumEncryption.Get(ctx context.Context, query cloudflare.OriginPostQuantumEncryptionGetParams) (cloudflare.OriginPostQuantumEncryptionGetResponse, error) -# Firewall - -## WAF - -### Packages - -#### Groups - -Response Types: - -- cloudflare.FirewallWAFPackageGroupListResponse -- cloudflare.FirewallWAFPackageGroupEditResponse -- cloudflare.FirewallWAFPackageGroupGetResponse - -Methods: - -- client.Firewall.WAF.Packages.Groups.List(ctx context.Context, packageID string, params cloudflare.FirewallWAFPackageGroupListParams) (shared.V4PagePaginationArray[cloudflare.FirewallWAFPackageGroupListResponse], error) -- client.Firewall.WAF.Packages.Groups.Edit(ctx context.Context, packageID string, groupID string, params cloudflare.FirewallWAFPackageGroupEditParams) (cloudflare.FirewallWAFPackageGroupEditResponse, error) -- client.Firewall.WAF.Packages.Groups.Get(ctx context.Context, packageID string, groupID string, query cloudflare.FirewallWAFPackageGroupGetParams) (cloudflare.FirewallWAFPackageGroupGetResponse, error) - -#### Rules - -Response Types: - -- cloudflare.FirewallWAFPackageRuleEditResponse -- cloudflare.FirewallWAFPackageRuleGetResponse - -Methods: - -- client.Firewall.WAF.Packages.Rules.Edit(ctx context.Context, packageID string, ruleID string, params cloudflare.FirewallWAFPackageRuleEditParams) (cloudflare.FirewallWAFPackageRuleEditResponse, error) -- client.Firewall.WAF.Packages.Rules.Get(ctx context.Context, packageID string, ruleID string, query cloudflare.FirewallWAFPackageRuleGetParams) (cloudflare.FirewallWAFPackageRuleGetResponse, error) - # Speed Response Types: diff --git a/brandprotection.go b/brandprotection.go index 78ef9c14bca..1e0c2cc136a 100644 --- a/brandprotection.go +++ b/brandprotection.go @@ -3,6 +3,15 @@ package cloudflare import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" "github.com/cloudflare/cloudflare-sdk-go/option" ) @@ -12,9 +21,7 @@ import ( // this service directly, and instead use the [NewBrandProtectionService] method // instead. type BrandProtectionService struct { - Options []option.RequestOption - Submits *BrandProtectionSubmitService - URLInfos *BrandProtectionURLInfoService + Options []option.RequestOption } // NewBrandProtectionService generates a new service that applies the given options @@ -23,7 +30,429 @@ type BrandProtectionService struct { func NewBrandProtectionService(opts ...option.RequestOption) (r *BrandProtectionService) { r = &BrandProtectionService{} r.Options = opts - r.Submits = NewBrandProtectionSubmitService(opts...) - r.URLInfos = NewBrandProtectionURLInfoService(opts...) return } + +// Submit suspicious URL for scanning +func (r *BrandProtectionService) Submit(ctx context.Context, params BrandProtectionSubmitParams, opts ...option.RequestOption) (res *BrandProtectionSubmitResponse, err error) { + opts = append(r.Options[:], opts...) + var env BrandProtectionSubmitResponseEnvelope + path := fmt.Sprintf("accounts/%s/brand-protection/submit", params.AccountID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Get results for a URL scan +func (r *BrandProtectionService) URLInfo(ctx context.Context, params BrandProtectionURLInfoParams, opts ...option.RequestOption) (res *BrandProtectionURLInfoResponse, err error) { + opts = append(r.Options[:], opts...) + var env BrandProtectionURLInfoResponseEnvelope + path := fmt.Sprintf("accounts/%s/brand-protection/url-info", params.AccountID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +type BrandProtectionSubmitResponse struct { + // URLs that were excluded from scanning because their domain is in our no-scan + // list. + ExcludedURLs []BrandProtectionSubmitResponseExcludedURL `json:"excluded_urls"` + // URLs that were skipped because the same URL is currently being scanned + SkippedURLs []BrandProtectionSubmitResponseSkippedURL `json:"skipped_urls"` + // URLs that were successfully submitted for scanning. + SubmittedURLs []BrandProtectionSubmitResponseSubmittedURL `json:"submitted_urls"` + JSON brandProtectionSubmitResponseJSON `json:"-"` +} + +// brandProtectionSubmitResponseJSON contains the JSON metadata for the struct +// [BrandProtectionSubmitResponse] +type brandProtectionSubmitResponseJSON struct { + ExcludedURLs apijson.Field + SkippedURLs apijson.Field + SubmittedURLs apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *BrandProtectionSubmitResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type BrandProtectionSubmitResponseExcludedURL struct { + // URL that was excluded. + URL string `json:"url"` + JSON brandProtectionSubmitResponseExcludedURLJSON `json:"-"` +} + +// brandProtectionSubmitResponseExcludedURLJSON contains the JSON metadata for the +// struct [BrandProtectionSubmitResponseExcludedURL] +type brandProtectionSubmitResponseExcludedURLJSON struct { + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *BrandProtectionSubmitResponseExcludedURL) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type BrandProtectionSubmitResponseSkippedURL struct { + // URL that was skipped. + URL string `json:"url"` + // ID of the submission of that URL that is currently scanning. + URLID int64 `json:"url_id"` + JSON brandProtectionSubmitResponseSkippedURLJSON `json:"-"` +} + +// brandProtectionSubmitResponseSkippedURLJSON contains the JSON metadata for the +// struct [BrandProtectionSubmitResponseSkippedURL] +type brandProtectionSubmitResponseSkippedURLJSON struct { + URL apijson.Field + URLID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *BrandProtectionSubmitResponseSkippedURL) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type BrandProtectionSubmitResponseSubmittedURL struct { + // URL that was submitted. + URL string `json:"url"` + // ID assigned to this URL submission. Used to retrieve scanning results. + URLID int64 `json:"url_id"` + JSON brandProtectionSubmitResponseSubmittedURLJSON `json:"-"` +} + +// brandProtectionSubmitResponseSubmittedURLJSON contains the JSON metadata for the +// struct [BrandProtectionSubmitResponseSubmittedURL] +type brandProtectionSubmitResponseSubmittedURLJSON struct { + URL apijson.Field + URLID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *BrandProtectionSubmitResponseSubmittedURL) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type BrandProtectionURLInfoResponse struct { + // List of categorizations applied to this submission. + Categorizations []BrandProtectionURLInfoResponseCategorization `json:"categorizations"` + // List of model results for completed scans. + ModelResults []BrandProtectionURLInfoResponseModelResult `json:"model_results"` + // List of signatures that matched against site content found when crawling the + // URL. + RuleMatches []BrandProtectionURLInfoResponseRuleMatch `json:"rule_matches"` + // Status of the most recent scan found. + ScanStatus BrandProtectionURLInfoResponseScanStatus `json:"scan_status"` + // For internal use. + ScreenshotDownloadSignature string `json:"screenshot_download_signature"` + // For internal use. + ScreenshotPath string `json:"screenshot_path"` + // URL that was submitted. + URL string `json:"url"` + JSON brandProtectionURLInfoResponseJSON `json:"-"` +} + +// brandProtectionURLInfoResponseJSON contains the JSON metadata for the struct +// [BrandProtectionURLInfoResponse] +type brandProtectionURLInfoResponseJSON struct { + Categorizations apijson.Field + ModelResults apijson.Field + RuleMatches apijson.Field + ScanStatus apijson.Field + ScreenshotDownloadSignature apijson.Field + ScreenshotPath apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *BrandProtectionURLInfoResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type BrandProtectionURLInfoResponseCategorization struct { + // Name of the category applied. + Category string `json:"category"` + // Result of human review for this categorization. + VerificationStatus string `json:"verification_status"` + JSON brandProtectionURLInfoResponseCategorizationJSON `json:"-"` +} + +// brandProtectionURLInfoResponseCategorizationJSON contains the JSON metadata for +// the struct [BrandProtectionURLInfoResponseCategorization] +type brandProtectionURLInfoResponseCategorizationJSON struct { + Category apijson.Field + VerificationStatus apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *BrandProtectionURLInfoResponseCategorization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type BrandProtectionURLInfoResponseModelResult struct { + // Name of the model. + ModelName string `json:"model_name"` + // Score output by the model for this submission. + ModelScore float64 `json:"model_score"` + JSON brandProtectionURLInfoResponseModelResultJSON `json:"-"` +} + +// brandProtectionURLInfoResponseModelResultJSON contains the JSON metadata for the +// struct [BrandProtectionURLInfoResponseModelResult] +type brandProtectionURLInfoResponseModelResultJSON struct { + ModelName apijson.Field + ModelScore apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *BrandProtectionURLInfoResponseModelResult) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type BrandProtectionURLInfoResponseRuleMatch struct { + // For internal use. + Banning bool `json:"banning"` + // For internal use. + Blocking bool `json:"blocking"` + // Description of the signature that matched. + Description string `json:"description"` + // Name of the signature that matched. + Name string `json:"name"` + JSON brandProtectionURLInfoResponseRuleMatchJSON `json:"-"` +} + +// brandProtectionURLInfoResponseRuleMatchJSON contains the JSON metadata for the +// struct [BrandProtectionURLInfoResponseRuleMatch] +type brandProtectionURLInfoResponseRuleMatchJSON struct { + Banning apijson.Field + Blocking apijson.Field + Description apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *BrandProtectionURLInfoResponseRuleMatch) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Status of the most recent scan found. +type BrandProtectionURLInfoResponseScanStatus struct { + // Timestamp of when the submission was processed. + LastProcessed string `json:"last_processed"` + // For internal use. + ScanComplete bool `json:"scan_complete"` + // Status code that the crawler received when loading the submitted URL. + StatusCode int64 `json:"status_code"` + // ID of the most recent submission. + SubmissionID int64 `json:"submission_id"` + JSON brandProtectionURLInfoResponseScanStatusJSON `json:"-"` +} + +// brandProtectionURLInfoResponseScanStatusJSON contains the JSON metadata for the +// struct [BrandProtectionURLInfoResponseScanStatus] +type brandProtectionURLInfoResponseScanStatusJSON struct { + LastProcessed apijson.Field + ScanComplete apijson.Field + StatusCode apijson.Field + SubmissionID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *BrandProtectionURLInfoResponseScanStatus) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type BrandProtectionSubmitParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` + // URL(s) to filter submissions results by + URL param.Field[string] `json:"url" format:"uri"` +} + +func (r BrandProtectionSubmitParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type BrandProtectionSubmitResponseEnvelope struct { + Errors []BrandProtectionSubmitResponseEnvelopeErrors `json:"errors,required"` + Messages []BrandProtectionSubmitResponseEnvelopeMessages `json:"messages,required"` + Result BrandProtectionSubmitResponse `json:"result,required"` + // Whether the API call was successful + Success BrandProtectionSubmitResponseEnvelopeSuccess `json:"success,required"` + JSON brandProtectionSubmitResponseEnvelopeJSON `json:"-"` +} + +// brandProtectionSubmitResponseEnvelopeJSON contains the JSON metadata for the +// struct [BrandProtectionSubmitResponseEnvelope] +type brandProtectionSubmitResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *BrandProtectionSubmitResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type BrandProtectionSubmitResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON brandProtectionSubmitResponseEnvelopeErrorsJSON `json:"-"` +} + +// brandProtectionSubmitResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [BrandProtectionSubmitResponseEnvelopeErrors] +type brandProtectionSubmitResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *BrandProtectionSubmitResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type BrandProtectionSubmitResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON brandProtectionSubmitResponseEnvelopeMessagesJSON `json:"-"` +} + +// brandProtectionSubmitResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [BrandProtectionSubmitResponseEnvelopeMessages] +type brandProtectionSubmitResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *BrandProtectionSubmitResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type BrandProtectionSubmitResponseEnvelopeSuccess bool + +const ( + BrandProtectionSubmitResponseEnvelopeSuccessTrue BrandProtectionSubmitResponseEnvelopeSuccess = true +) + +type BrandProtectionURLInfoParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` + URL param.Field[string] `query:"url"` + URLIDParam param.Field[BrandProtectionURLInfoParamsURLIDParam] `query:"url_id_param"` +} + +// URLQuery serializes [BrandProtectionURLInfoParams]'s query parameters as +// `url.Values`. +func (r BrandProtectionURLInfoParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type BrandProtectionURLInfoParamsURLIDParam struct { + // Submission ID(s) to filter submission results by. + URLID param.Field[int64] `query:"url_id"` +} + +// URLQuery serializes [BrandProtectionURLInfoParamsURLIDParam]'s query parameters +// as `url.Values`. +func (r BrandProtectionURLInfoParamsURLIDParam) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type BrandProtectionURLInfoResponseEnvelope struct { + Errors []BrandProtectionURLInfoResponseEnvelopeErrors `json:"errors,required"` + Messages []BrandProtectionURLInfoResponseEnvelopeMessages `json:"messages,required"` + Result BrandProtectionURLInfoResponse `json:"result,required"` + // Whether the API call was successful + Success BrandProtectionURLInfoResponseEnvelopeSuccess `json:"success,required"` + JSON brandProtectionURLInfoResponseEnvelopeJSON `json:"-"` +} + +// brandProtectionURLInfoResponseEnvelopeJSON contains the JSON metadata for the +// struct [BrandProtectionURLInfoResponseEnvelope] +type brandProtectionURLInfoResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *BrandProtectionURLInfoResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type BrandProtectionURLInfoResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON brandProtectionURLInfoResponseEnvelopeErrorsJSON `json:"-"` +} + +// brandProtectionURLInfoResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [BrandProtectionURLInfoResponseEnvelopeErrors] +type brandProtectionURLInfoResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *BrandProtectionURLInfoResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type BrandProtectionURLInfoResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON brandProtectionURLInfoResponseEnvelopeMessagesJSON `json:"-"` +} + +// brandProtectionURLInfoResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [BrandProtectionURLInfoResponseEnvelopeMessages] +type brandProtectionURLInfoResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *BrandProtectionURLInfoResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type BrandProtectionURLInfoResponseEnvelopeSuccess bool + +const ( + BrandProtectionURLInfoResponseEnvelopeSuccessTrue BrandProtectionURLInfoResponseEnvelopeSuccess = true +) diff --git a/brandprotection_test.go b/brandprotection_test.go new file mode 100644 index 00000000000..c79aca1cfef --- /dev/null +++ b/brandprotection_test.go @@ -0,0 +1,75 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestBrandProtectionSubmitWithOptionalParams(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.BrandProtection.Submit(context.TODO(), cloudflare.BrandProtectionSubmitParams{ + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + URL: cloudflare.F("https://www.cloudflare.com"), + }) + 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 TestBrandProtectionURLInfoWithOptionalParams(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.BrandProtection.URLInfo(context.TODO(), cloudflare.BrandProtectionURLInfoParams{ + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + URL: cloudflare.F("string"), + URLIDParam: cloudflare.F(cloudflare.BrandProtectionURLInfoParamsURLIDParam{ + URLID: cloudflare.F(int64(0)), + }), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/brandprotectionsubmit.go b/brandprotectionsubmit.go deleted file mode 100644 index 6365a6d674a..00000000000 --- a/brandprotectionsubmit.go +++ /dev/null @@ -1,210 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// BrandProtectionSubmitService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewBrandProtectionSubmitService] -// method instead. -type BrandProtectionSubmitService struct { - Options []option.RequestOption -} - -// NewBrandProtectionSubmitService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewBrandProtectionSubmitService(opts ...option.RequestOption) (r *BrandProtectionSubmitService) { - r = &BrandProtectionSubmitService{} - r.Options = opts - return -} - -// Submit suspicious URL for scanning -func (r *BrandProtectionSubmitService) New(ctx context.Context, params BrandProtectionSubmitNewParams, opts ...option.RequestOption) (res *BrandProtectionSubmitNewResponse, err error) { - opts = append(r.Options[:], opts...) - var env BrandProtectionSubmitNewResponseEnvelope - path := fmt.Sprintf("accounts/%s/brand-protection/submit", params.AccountID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -type BrandProtectionSubmitNewResponse struct { - // URLs that were excluded from scanning because their domain is in our no-scan - // list. - ExcludedURLs []BrandProtectionSubmitNewResponseExcludedURL `json:"excluded_urls"` - // URLs that were skipped because the same URL is currently being scanned - SkippedURLs []BrandProtectionSubmitNewResponseSkippedURL `json:"skipped_urls"` - // URLs that were successfully submitted for scanning. - SubmittedURLs []BrandProtectionSubmitNewResponseSubmittedURL `json:"submitted_urls"` - JSON brandProtectionSubmitNewResponseJSON `json:"-"` -} - -// brandProtectionSubmitNewResponseJSON contains the JSON metadata for the struct -// [BrandProtectionSubmitNewResponse] -type brandProtectionSubmitNewResponseJSON struct { - ExcludedURLs apijson.Field - SkippedURLs apijson.Field - SubmittedURLs apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *BrandProtectionSubmitNewResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type BrandProtectionSubmitNewResponseExcludedURL struct { - // URL that was excluded. - URL string `json:"url"` - JSON brandProtectionSubmitNewResponseExcludedURLJSON `json:"-"` -} - -// brandProtectionSubmitNewResponseExcludedURLJSON contains the JSON metadata for -// the struct [BrandProtectionSubmitNewResponseExcludedURL] -type brandProtectionSubmitNewResponseExcludedURLJSON struct { - URL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *BrandProtectionSubmitNewResponseExcludedURL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type BrandProtectionSubmitNewResponseSkippedURL struct { - // URL that was skipped. - URL string `json:"url"` - // ID of the submission of that URL that is currently scanning. - URLID int64 `json:"url_id"` - JSON brandProtectionSubmitNewResponseSkippedURLJSON `json:"-"` -} - -// brandProtectionSubmitNewResponseSkippedURLJSON contains the JSON metadata for -// the struct [BrandProtectionSubmitNewResponseSkippedURL] -type brandProtectionSubmitNewResponseSkippedURLJSON struct { - URL apijson.Field - URLID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *BrandProtectionSubmitNewResponseSkippedURL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type BrandProtectionSubmitNewResponseSubmittedURL struct { - // URL that was submitted. - URL string `json:"url"` - // ID assigned to this URL submission. Used to retrieve scanning results. - URLID int64 `json:"url_id"` - JSON brandProtectionSubmitNewResponseSubmittedURLJSON `json:"-"` -} - -// brandProtectionSubmitNewResponseSubmittedURLJSON contains the JSON metadata for -// the struct [BrandProtectionSubmitNewResponseSubmittedURL] -type brandProtectionSubmitNewResponseSubmittedURLJSON struct { - URL apijson.Field - URLID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *BrandProtectionSubmitNewResponseSubmittedURL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type BrandProtectionSubmitNewParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` - // URL(s) to filter submissions results by - URL param.Field[string] `json:"url" format:"uri"` -} - -func (r BrandProtectionSubmitNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type BrandProtectionSubmitNewResponseEnvelope struct { - Errors []BrandProtectionSubmitNewResponseEnvelopeErrors `json:"errors,required"` - Messages []BrandProtectionSubmitNewResponseEnvelopeMessages `json:"messages,required"` - Result BrandProtectionSubmitNewResponse `json:"result,required"` - // Whether the API call was successful - Success BrandProtectionSubmitNewResponseEnvelopeSuccess `json:"success,required"` - JSON brandProtectionSubmitNewResponseEnvelopeJSON `json:"-"` -} - -// brandProtectionSubmitNewResponseEnvelopeJSON contains the JSON metadata for the -// struct [BrandProtectionSubmitNewResponseEnvelope] -type brandProtectionSubmitNewResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *BrandProtectionSubmitNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type BrandProtectionSubmitNewResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON brandProtectionSubmitNewResponseEnvelopeErrorsJSON `json:"-"` -} - -// brandProtectionSubmitNewResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [BrandProtectionSubmitNewResponseEnvelopeErrors] -type brandProtectionSubmitNewResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *BrandProtectionSubmitNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type BrandProtectionSubmitNewResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON brandProtectionSubmitNewResponseEnvelopeMessagesJSON `json:"-"` -} - -// brandProtectionSubmitNewResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [BrandProtectionSubmitNewResponseEnvelopeMessages] -type brandProtectionSubmitNewResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *BrandProtectionSubmitNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type BrandProtectionSubmitNewResponseEnvelopeSuccess bool - -const ( - BrandProtectionSubmitNewResponseEnvelopeSuccessTrue BrandProtectionSubmitNewResponseEnvelopeSuccess = true -) diff --git a/brandprotectionsubmit_test.go b/brandprotectionsubmit_test.go deleted file mode 100644 index d4eaf81bf83..00000000000 --- a/brandprotectionsubmit_test.go +++ /dev/null @@ -1,43 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-sdk-go" - "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -func TestBrandProtectionSubmitNewWithOptionalParams(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.BrandProtection.Submits.New(context.TODO(), cloudflare.BrandProtectionSubmitNewParams{ - AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - URL: cloudflare.F("https://www.cloudflare.com"), - }) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/brandprotectionurlinfo.go b/brandprotectionurlinfo.go deleted file mode 100644 index 45f23be859f..00000000000 --- a/brandprotectionurlinfo.go +++ /dev/null @@ -1,280 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// BrandProtectionURLInfoService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewBrandProtectionURLInfoService] -// method instead. -type BrandProtectionURLInfoService struct { - Options []option.RequestOption -} - -// NewBrandProtectionURLInfoService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewBrandProtectionURLInfoService(opts ...option.RequestOption) (r *BrandProtectionURLInfoService) { - r = &BrandProtectionURLInfoService{} - r.Options = opts - return -} - -// Get results for a URL scan -func (r *BrandProtectionURLInfoService) Get(ctx context.Context, params BrandProtectionURLInfoGetParams, opts ...option.RequestOption) (res *BrandProtectionURLInfoGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env BrandProtectionURLInfoGetResponseEnvelope - path := fmt.Sprintf("accounts/%s/brand-protection/url-info", params.AccountID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -type BrandProtectionURLInfoGetResponse struct { - // List of categorizations applied to this submission. - Categorizations []BrandProtectionURLInfoGetResponseCategorization `json:"categorizations"` - // List of model results for completed scans. - ModelResults []BrandProtectionURLInfoGetResponseModelResult `json:"model_results"` - // List of signatures that matched against site content found when crawling the - // URL. - RuleMatches []BrandProtectionURLInfoGetResponseRuleMatch `json:"rule_matches"` - // Status of the most recent scan found. - ScanStatus BrandProtectionURLInfoGetResponseScanStatus `json:"scan_status"` - // For internal use. - ScreenshotDownloadSignature string `json:"screenshot_download_signature"` - // For internal use. - ScreenshotPath string `json:"screenshot_path"` - // URL that was submitted. - URL string `json:"url"` - JSON brandProtectionURLInfoGetResponseJSON `json:"-"` -} - -// brandProtectionURLInfoGetResponseJSON contains the JSON metadata for the struct -// [BrandProtectionURLInfoGetResponse] -type brandProtectionURLInfoGetResponseJSON struct { - Categorizations apijson.Field - ModelResults apijson.Field - RuleMatches apijson.Field - ScanStatus apijson.Field - ScreenshotDownloadSignature apijson.Field - ScreenshotPath apijson.Field - URL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *BrandProtectionURLInfoGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type BrandProtectionURLInfoGetResponseCategorization struct { - // Name of the category applied. - Category string `json:"category"` - // Result of human review for this categorization. - VerificationStatus string `json:"verification_status"` - JSON brandProtectionURLInfoGetResponseCategorizationJSON `json:"-"` -} - -// brandProtectionURLInfoGetResponseCategorizationJSON contains the JSON metadata -// for the struct [BrandProtectionURLInfoGetResponseCategorization] -type brandProtectionURLInfoGetResponseCategorizationJSON struct { - Category apijson.Field - VerificationStatus apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *BrandProtectionURLInfoGetResponseCategorization) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type BrandProtectionURLInfoGetResponseModelResult struct { - // Name of the model. - ModelName string `json:"model_name"` - // Score output by the model for this submission. - ModelScore float64 `json:"model_score"` - JSON brandProtectionURLInfoGetResponseModelResultJSON `json:"-"` -} - -// brandProtectionURLInfoGetResponseModelResultJSON contains the JSON metadata for -// the struct [BrandProtectionURLInfoGetResponseModelResult] -type brandProtectionURLInfoGetResponseModelResultJSON struct { - ModelName apijson.Field - ModelScore apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *BrandProtectionURLInfoGetResponseModelResult) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type BrandProtectionURLInfoGetResponseRuleMatch struct { - // For internal use. - Banning bool `json:"banning"` - // For internal use. - Blocking bool `json:"blocking"` - // Description of the signature that matched. - Description string `json:"description"` - // Name of the signature that matched. - Name string `json:"name"` - JSON brandProtectionURLInfoGetResponseRuleMatchJSON `json:"-"` -} - -// brandProtectionURLInfoGetResponseRuleMatchJSON contains the JSON metadata for -// the struct [BrandProtectionURLInfoGetResponseRuleMatch] -type brandProtectionURLInfoGetResponseRuleMatchJSON struct { - Banning apijson.Field - Blocking apijson.Field - Description apijson.Field - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *BrandProtectionURLInfoGetResponseRuleMatch) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Status of the most recent scan found. -type BrandProtectionURLInfoGetResponseScanStatus struct { - // Timestamp of when the submission was processed. - LastProcessed string `json:"last_processed"` - // For internal use. - ScanComplete bool `json:"scan_complete"` - // Status code that the crawler received when loading the submitted URL. - StatusCode int64 `json:"status_code"` - // ID of the most recent submission. - SubmissionID int64 `json:"submission_id"` - JSON brandProtectionURLInfoGetResponseScanStatusJSON `json:"-"` -} - -// brandProtectionURLInfoGetResponseScanStatusJSON contains the JSON metadata for -// the struct [BrandProtectionURLInfoGetResponseScanStatus] -type brandProtectionURLInfoGetResponseScanStatusJSON struct { - LastProcessed apijson.Field - ScanComplete apijson.Field - StatusCode apijson.Field - SubmissionID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *BrandProtectionURLInfoGetResponseScanStatus) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type BrandProtectionURLInfoGetParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` - URL param.Field[string] `query:"url"` - URLIDParam param.Field[BrandProtectionURLInfoGetParamsURLIDParam] `query:"url_id_param"` -} - -// URLQuery serializes [BrandProtectionURLInfoGetParams]'s query parameters as -// `url.Values`. -func (r BrandProtectionURLInfoGetParams) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatComma, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} - -type BrandProtectionURLInfoGetParamsURLIDParam struct { - // Submission ID(s) to filter submission results by. - URLID param.Field[int64] `query:"url_id"` -} - -// URLQuery serializes [BrandProtectionURLInfoGetParamsURLIDParam]'s query -// parameters as `url.Values`. -func (r BrandProtectionURLInfoGetParamsURLIDParam) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatComma, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} - -type BrandProtectionURLInfoGetResponseEnvelope struct { - Errors []BrandProtectionURLInfoGetResponseEnvelopeErrors `json:"errors,required"` - Messages []BrandProtectionURLInfoGetResponseEnvelopeMessages `json:"messages,required"` - Result BrandProtectionURLInfoGetResponse `json:"result,required"` - // Whether the API call was successful - Success BrandProtectionURLInfoGetResponseEnvelopeSuccess `json:"success,required"` - JSON brandProtectionURLInfoGetResponseEnvelopeJSON `json:"-"` -} - -// brandProtectionURLInfoGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [BrandProtectionURLInfoGetResponseEnvelope] -type brandProtectionURLInfoGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *BrandProtectionURLInfoGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type BrandProtectionURLInfoGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON brandProtectionURLInfoGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// brandProtectionURLInfoGetResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [BrandProtectionURLInfoGetResponseEnvelopeErrors] -type brandProtectionURLInfoGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *BrandProtectionURLInfoGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type BrandProtectionURLInfoGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON brandProtectionURLInfoGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// brandProtectionURLInfoGetResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [BrandProtectionURLInfoGetResponseEnvelopeMessages] -type brandProtectionURLInfoGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *BrandProtectionURLInfoGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type BrandProtectionURLInfoGetResponseEnvelopeSuccess bool - -const ( - BrandProtectionURLInfoGetResponseEnvelopeSuccessTrue BrandProtectionURLInfoGetResponseEnvelopeSuccess = true -) diff --git a/brandprotectionurlinfo_test.go b/brandprotectionurlinfo_test.go deleted file mode 100644 index cce9d7cf1b6..00000000000 --- a/brandprotectionurlinfo_test.go +++ /dev/null @@ -1,46 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-sdk-go" - "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -func TestBrandProtectionURLInfoGetWithOptionalParams(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.BrandProtection.URLInfos.Get(context.TODO(), cloudflare.BrandProtectionURLInfoGetParams{ - AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - URL: cloudflare.F("string"), - URLIDParam: cloudflare.F(cloudflare.BrandProtectionURLInfoGetParamsURLIDParam{ - URLID: cloudflare.F(int64(0)), - }), - }) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/client.go b/client.go index b8ec80b4741..6279c1ae794 100644 --- a/client.go +++ b/client.go @@ -21,7 +21,6 @@ type Client struct { Zones *ZoneService LoadBalancers *LoadBalancerService Access *AccessService - DNSAnalytics *DNSAnalyticService Cache *CacheService SSL *SSLService Subscriptions *SubscriptionService @@ -38,7 +37,7 @@ type Client struct { DNSSEC *DNSSECService Emails *EmailService Filters *FilterService - Firewalls *FirewallService + Firewall *FirewallService Healthchecks *HealthcheckService KeylessCertificates *KeylessCertificateService Logpush *LogpushService @@ -47,11 +46,10 @@ type Client struct { Pagerules *PageruleService RateLimits *RateLimitService SecondaryDNS *SecondaryDNSService - Settings *SettingService WaitingRooms *WaitingRoomService Web3 *Web3Service Workers *WorkerService - ActivationChecks *ActivationCheckService + KV *KVService ManagedHeaders *ManagedHeaderService PageShield *PageShieldService Rulesets *RulesetService @@ -66,8 +64,7 @@ type Client struct { DLP *DLPService Images *ImageService Intel *IntelService - Magics *MagicService - AccountMembers *AccountMemberService + MagicTransit *MagicTransitService MNMs *MNMService MTLSCertificates *MTLSCertificateService Pages *PageService @@ -78,7 +75,6 @@ type Client struct { Rules *RuleService Storage *StorageService Stream *StreamService - Teamnets *TeamnetService Gateways *GatewayService Alerting *AlertingService Devices *DeviceService @@ -89,10 +85,7 @@ type Client struct { WARPConnector *WARPConnectorService Dispatchers *DispatcherService WorkersForPlatforms *WorkersForPlatformService - WorkerDomains *WorkerDomainService - WorkerScripts *WorkerScriptService - Zerotrust *ZerotrustService - Addressing *AddressingService + ZeroTrust *ZeroTrustService Challenges *ChallengeService Hyperdrive *HyperdriveService RUM *RUMService @@ -101,7 +94,6 @@ type Client struct { Radar *RadarService BotManagement *BotManagementService OriginPostQuantumEncryption *OriginPostQuantumEncryptionService - Firewall *FirewallService Speed *SpeedService DcvDelegation *DcvDelegationService Hostnames *HostnameService @@ -141,7 +133,6 @@ func NewClient(opts ...option.RequestOption) (r *Client) { r.Zones = NewZoneService(opts...) r.LoadBalancers = NewLoadBalancerService(opts...) r.Access = NewAccessService(opts...) - r.DNSAnalytics = NewDNSAnalyticService(opts...) r.Cache = NewCacheService(opts...) r.SSL = NewSSLService(opts...) r.Subscriptions = NewSubscriptionService(opts...) @@ -158,7 +149,7 @@ func NewClient(opts ...option.RequestOption) (r *Client) { r.DNSSEC = NewDNSSECService(opts...) r.Emails = NewEmailService(opts...) r.Filters = NewFilterService(opts...) - r.Firewalls = NewFirewallService(opts...) + r.Firewall = NewFirewallService(opts...) r.Healthchecks = NewHealthcheckService(opts...) r.KeylessCertificates = NewKeylessCertificateService(opts...) r.Logpush = NewLogpushService(opts...) @@ -167,11 +158,10 @@ func NewClient(opts ...option.RequestOption) (r *Client) { r.Pagerules = NewPageruleService(opts...) r.RateLimits = NewRateLimitService(opts...) r.SecondaryDNS = NewSecondaryDNSService(opts...) - r.Settings = NewSettingService(opts...) r.WaitingRooms = NewWaitingRoomService(opts...) r.Web3 = NewWeb3Service(opts...) r.Workers = NewWorkerService(opts...) - r.ActivationChecks = NewActivationCheckService(opts...) + r.KV = NewKVService(opts...) r.ManagedHeaders = NewManagedHeaderService(opts...) r.PageShield = NewPageShieldService(opts...) r.Rulesets = NewRulesetService(opts...) @@ -186,8 +176,7 @@ func NewClient(opts ...option.RequestOption) (r *Client) { r.DLP = NewDLPService(opts...) r.Images = NewImageService(opts...) r.Intel = NewIntelService(opts...) - r.Magics = NewMagicService(opts...) - r.AccountMembers = NewAccountMemberService(opts...) + r.MagicTransit = NewMagicTransitService(opts...) r.MNMs = NewMNMService(opts...) r.MTLSCertificates = NewMTLSCertificateService(opts...) r.Pages = NewPageService(opts...) @@ -198,7 +187,6 @@ func NewClient(opts ...option.RequestOption) (r *Client) { r.Rules = NewRuleService(opts...) r.Storage = NewStorageService(opts...) r.Stream = NewStreamService(opts...) - r.Teamnets = NewTeamnetService(opts...) r.Gateways = NewGatewayService(opts...) r.Alerting = NewAlertingService(opts...) r.Devices = NewDeviceService(opts...) @@ -209,10 +197,7 @@ func NewClient(opts ...option.RequestOption) (r *Client) { r.WARPConnector = NewWARPConnectorService(opts...) r.Dispatchers = NewDispatcherService(opts...) r.WorkersForPlatforms = NewWorkersForPlatformService(opts...) - r.WorkerDomains = NewWorkerDomainService(opts...) - r.WorkerScripts = NewWorkerScriptService(opts...) - r.Zerotrust = NewZerotrustService(opts...) - r.Addressing = NewAddressingService(opts...) + r.ZeroTrust = NewZeroTrustService(opts...) r.Challenges = NewChallengeService(opts...) r.Hyperdrive = NewHyperdriveService(opts...) r.RUM = NewRUMService(opts...) @@ -221,7 +206,6 @@ func NewClient(opts ...option.RequestOption) (r *Client) { r.Radar = NewRadarService(opts...) r.BotManagement = NewBotManagementService(opts...) r.OriginPostQuantumEncryption = NewOriginPostQuantumEncryptionService(opts...) - r.Firewall = NewFirewallService(opts...) r.Speed = NewSpeedService(opts...) r.DcvDelegation = NewDcvDelegationService(opts...) r.Hostnames = NewHostnameService(opts...) diff --git a/d1.go b/d1.go index 1d2eaf1c679..70ef7332b95 100644 --- a/d1.go +++ b/d1.go @@ -11,9 +11,8 @@ import ( // from the environment automatically. You should not instantiate this service // directly, and instead use the [NewD1Service] method instead. type D1Service struct { - Options []option.RequestOption - Databases *D1DatabaseService - Database *D1DatabaseService + Options []option.RequestOption + Database *D1DatabaseService } // NewD1Service generates a new service that applies the given options to each @@ -22,7 +21,6 @@ type D1Service struct { func NewD1Service(opts ...option.RequestOption) (r *D1Service) { r = &D1Service{} r.Options = opts - r.Databases = NewD1DatabaseService(opts...) r.Database = NewD1DatabaseService(opts...) return } diff --git a/d1database.go b/d1database.go index d7e1aca770d..aeb246a90d5 100644 --- a/d1database.go +++ b/d1database.go @@ -7,6 +7,7 @@ import ( "fmt" "net/http" "net/url" + "reflect" "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" @@ -14,6 +15,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" "github.com/cloudflare/cloudflare-sdk-go/internal/shared" "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" ) // D1DatabaseService contains methods and other services that help with interacting @@ -69,6 +71,45 @@ func (r *D1DatabaseService) ListAutoPaging(ctx context.Context, params D1Databas return shared.NewV4PagePaginationArrayAutoPager(r.List(ctx, params, opts...)) } +// Deletes the specified D1 database. +func (r *D1DatabaseService) Delete(ctx context.Context, accountIdentifier string, databaseIdentifier string, opts ...option.RequestOption) (res *D1DatabaseDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + var env D1DatabaseDeleteResponseEnvelope + path := fmt.Sprintf("accounts/%s/d1/database/%s", accountIdentifier, databaseIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Returns the specified D1 database. +func (r *D1DatabaseService) Get(ctx context.Context, accountIdentifier string, databaseIdentifier string, opts ...option.RequestOption) (res *D1DatabaseGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env D1DatabaseGetResponseEnvelope + path := fmt.Sprintf("accounts/%s/d1/database/%s", accountIdentifier, databaseIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Returns the query result. +func (r *D1DatabaseService) Query(ctx context.Context, accountIdentifier string, databaseIdentifier string, body D1DatabaseQueryParams, opts ...option.RequestOption) (res *[]D1DatabaseQueryResponse, err error) { + opts = append(r.Options[:], opts...) + var env D1DatabaseQueryResponseEnvelope + path := fmt.Sprintf("accounts/%s/d1/database/%s/query", accountIdentifier, databaseIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + type D1DatabaseNewResponse struct { // Specifies the timestamp the resource was created as an ISO8601 string. CreatedAt interface{} `json:"created_at"` @@ -117,6 +158,101 @@ func (r *D1DatabaseListResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } +// Union satisfied by [D1DatabaseDeleteResponseUnknown] or [shared.UnionString]. +type D1DatabaseDeleteResponse interface { + ImplementsD1DatabaseDeleteResponse() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*D1DatabaseDeleteResponse)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type D1DatabaseGetResponse struct { + // Specifies the timestamp the resource was created as an ISO8601 string. + CreatedAt interface{} `json:"created_at"` + // The D1 database's size, in bytes. + FileSize float64 `json:"file_size"` + Name string `json:"name"` + NumTables float64 `json:"num_tables"` + UUID string `json:"uuid"` + Version string `json:"version"` + JSON d1DatabaseGetResponseJSON `json:"-"` +} + +// d1DatabaseGetResponseJSON contains the JSON metadata for the struct +// [D1DatabaseGetResponse] +type d1DatabaseGetResponseJSON struct { + CreatedAt apijson.Field + FileSize apijson.Field + Name apijson.Field + NumTables apijson.Field + UUID apijson.Field + Version apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *D1DatabaseGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type D1DatabaseQueryResponse struct { + Meta D1DatabaseQueryResponseMeta `json:"meta"` + Results []interface{} `json:"results"` + Success bool `json:"success"` + JSON d1DatabaseQueryResponseJSON `json:"-"` +} + +// d1DatabaseQueryResponseJSON contains the JSON metadata for the struct +// [D1DatabaseQueryResponse] +type d1DatabaseQueryResponseJSON struct { + Meta apijson.Field + Results apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *D1DatabaseQueryResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type D1DatabaseQueryResponseMeta struct { + ChangedDB bool `json:"changed_db"` + Changes float64 `json:"changes"` + Duration float64 `json:"duration"` + LastRowID float64 `json:"last_row_id"` + RowsRead float64 `json:"rows_read"` + RowsWritten float64 `json:"rows_written"` + SizeAfter float64 `json:"size_after"` + JSON d1DatabaseQueryResponseMetaJSON `json:"-"` +} + +// d1DatabaseQueryResponseMetaJSON contains the JSON metadata for the struct +// [D1DatabaseQueryResponseMeta] +type d1DatabaseQueryResponseMetaJSON struct { + ChangedDB apijson.Field + Changes apijson.Field + Duration apijson.Field + LastRowID apijson.Field + RowsRead apijson.Field + RowsWritten apijson.Field + SizeAfter apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *D1DatabaseQueryResponseMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + type D1DatabaseNewParams struct { // Account identifier tag. AccountID param.Field[string] `path:"account_id,required"` @@ -214,3 +350,219 @@ func (r D1DatabaseListParams) URLQuery() (v url.Values) { NestedFormat: apiquery.NestedQueryFormatBrackets, }) } + +type D1DatabaseDeleteResponseEnvelope struct { + Errors []D1DatabaseDeleteResponseEnvelopeErrors `json:"errors,required"` + Messages []D1DatabaseDeleteResponseEnvelopeMessages `json:"messages,required"` + Result D1DatabaseDeleteResponse `json:"result,required,nullable"` + // Whether the API call was successful + Success D1DatabaseDeleteResponseEnvelopeSuccess `json:"success,required"` + JSON d1DatabaseDeleteResponseEnvelopeJSON `json:"-"` +} + +// d1DatabaseDeleteResponseEnvelopeJSON contains the JSON metadata for the struct +// [D1DatabaseDeleteResponseEnvelope] +type d1DatabaseDeleteResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *D1DatabaseDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type D1DatabaseDeleteResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON d1DatabaseDeleteResponseEnvelopeErrorsJSON `json:"-"` +} + +// d1DatabaseDeleteResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [D1DatabaseDeleteResponseEnvelopeErrors] +type d1DatabaseDeleteResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *D1DatabaseDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type D1DatabaseDeleteResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON d1DatabaseDeleteResponseEnvelopeMessagesJSON `json:"-"` +} + +// d1DatabaseDeleteResponseEnvelopeMessagesJSON contains the JSON metadata for the +// struct [D1DatabaseDeleteResponseEnvelopeMessages] +type d1DatabaseDeleteResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *D1DatabaseDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type D1DatabaseDeleteResponseEnvelopeSuccess bool + +const ( + D1DatabaseDeleteResponseEnvelopeSuccessTrue D1DatabaseDeleteResponseEnvelopeSuccess = true +) + +type D1DatabaseGetResponseEnvelope struct { + Errors []D1DatabaseGetResponseEnvelopeErrors `json:"errors,required"` + Messages []D1DatabaseGetResponseEnvelopeMessages `json:"messages,required"` + Result D1DatabaseGetResponse `json:"result,required"` + // Whether the API call was successful + Success D1DatabaseGetResponseEnvelopeSuccess `json:"success,required"` + JSON d1DatabaseGetResponseEnvelopeJSON `json:"-"` +} + +// d1DatabaseGetResponseEnvelopeJSON contains the JSON metadata for the struct +// [D1DatabaseGetResponseEnvelope] +type d1DatabaseGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *D1DatabaseGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type D1DatabaseGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON d1DatabaseGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// d1DatabaseGetResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [D1DatabaseGetResponseEnvelopeErrors] +type d1DatabaseGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *D1DatabaseGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type D1DatabaseGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON d1DatabaseGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// d1DatabaseGetResponseEnvelopeMessagesJSON contains the JSON metadata for the +// struct [D1DatabaseGetResponseEnvelopeMessages] +type d1DatabaseGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *D1DatabaseGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type D1DatabaseGetResponseEnvelopeSuccess bool + +const ( + D1DatabaseGetResponseEnvelopeSuccessTrue D1DatabaseGetResponseEnvelopeSuccess = true +) + +type D1DatabaseQueryParams struct { + Sql param.Field[string] `json:"sql,required"` + Params param.Field[[]string] `json:"params"` +} + +func (r D1DatabaseQueryParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type D1DatabaseQueryResponseEnvelope struct { + Errors []D1DatabaseQueryResponseEnvelopeErrors `json:"errors,required"` + Messages []D1DatabaseQueryResponseEnvelopeMessages `json:"messages,required"` + Result []D1DatabaseQueryResponse `json:"result,required"` + // Whether the API call was successful + Success D1DatabaseQueryResponseEnvelopeSuccess `json:"success,required"` + JSON d1DatabaseQueryResponseEnvelopeJSON `json:"-"` +} + +// d1DatabaseQueryResponseEnvelopeJSON contains the JSON metadata for the struct +// [D1DatabaseQueryResponseEnvelope] +type d1DatabaseQueryResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *D1DatabaseQueryResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type D1DatabaseQueryResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON d1DatabaseQueryResponseEnvelopeErrorsJSON `json:"-"` +} + +// d1DatabaseQueryResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [D1DatabaseQueryResponseEnvelopeErrors] +type d1DatabaseQueryResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *D1DatabaseQueryResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type D1DatabaseQueryResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON d1DatabaseQueryResponseEnvelopeMessagesJSON `json:"-"` +} + +// d1DatabaseQueryResponseEnvelopeMessagesJSON contains the JSON metadata for the +// struct [D1DatabaseQueryResponseEnvelopeMessages] +type d1DatabaseQueryResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *D1DatabaseQueryResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type D1DatabaseQueryResponseEnvelopeSuccess bool + +const ( + D1DatabaseQueryResponseEnvelopeSuccessTrue D1DatabaseQueryResponseEnvelopeSuccess = true +) diff --git a/d1database_test.go b/d1database_test.go index 16c69c87da4..6b1e461275f 100644 --- a/d1database_test.go +++ b/d1database_test.go @@ -29,7 +29,7 @@ func TestD1DatabaseNew(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.D1.Databases.New(context.TODO(), cloudflare.D1DatabaseNewParams{ + _, err := client.D1.Database.New(context.TODO(), cloudflare.D1DatabaseNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Name: cloudflare.F("my-database"), }) @@ -58,7 +58,7 @@ func TestD1DatabaseListWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.D1.Databases.List(context.TODO(), cloudflare.D1DatabaseListParams{ + _, err := client.D1.Database.List(context.TODO(), cloudflare.D1DatabaseListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Name: cloudflare.F("string"), Page: cloudflare.F(1.000000), @@ -72,3 +72,97 @@ func TestD1DatabaseListWithOptionalParams(t *testing.T) { t.Fatalf("err should be nil: %s", err.Error()) } } + +func TestD1DatabaseDelete(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.D1.Database.Delete( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + ) + 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 TestD1DatabaseGet(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.D1.Database.Get( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + ) + 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 TestD1DatabaseQueryWithOptionalParams(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.D1.Database.Query( + context.TODO(), + "023e105f4ecef8ad9ca31a8372d0c353", + "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + cloudflare.D1DatabaseQueryParams{ + Sql: cloudflare.F("SELECT * FROM myTable WHERE field = ? OR field = ?;"), + Params: cloudflare.F([]string{"firstParam", "secondParam"}), + }, + ) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/dns.go b/dns.go index d3ce9e2391b..0721315edb9 100644 --- a/dns.go +++ b/dns.go @@ -11,9 +11,10 @@ import ( // from the environment automatically. You should not instantiate this service // directly, and instead use the [NewDNSService] method instead. type DNSService struct { - Options []option.RequestOption - Records *DNSRecordService - Firewall *DNSFirewallService + Options []option.RequestOption + Records *DNSRecordService + Analytics *DNSAnalyticsService + Firewall *DNSFirewallService } // NewDNSService generates a new service that applies the given options to each @@ -23,6 +24,7 @@ func NewDNSService(opts ...option.RequestOption) (r *DNSService) { r = &DNSService{} r.Options = opts r.Records = NewDNSRecordService(opts...) + r.Analytics = NewDNSAnalyticsService(opts...) r.Firewall = NewDNSFirewallService(opts...) return } diff --git a/dnsanalyticreportbytime.go b/dnsanalyticreportbytime.go deleted file mode 100644 index de2adb42cfc..00000000000 --- a/dnsanalyticreportbytime.go +++ /dev/null @@ -1,288 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "net/url" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// DNSAnalyticReportBytimeService contains methods and other services that help -// with interacting with the cloudflare API. Note, unlike clients, this service -// does not read variables from the environment automatically. You should not -// instantiate this service directly, and instead use the -// [NewDNSAnalyticReportBytimeService] method instead. -type DNSAnalyticReportBytimeService struct { - Options []option.RequestOption -} - -// NewDNSAnalyticReportBytimeService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewDNSAnalyticReportBytimeService(opts ...option.RequestOption) (r *DNSAnalyticReportBytimeService) { - r = &DNSAnalyticReportBytimeService{} - r.Options = opts - return -} - -// Retrieves a list of aggregate metrics grouped by time interval. -// -// See -// [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) -// for detailed information about the available query parameters. -func (r *DNSAnalyticReportBytimeService) List(ctx context.Context, identifier string, query DNSAnalyticReportBytimeListParams, opts ...option.RequestOption) (res *DNSAnalyticReportBytimeListResponse, err error) { - opts = append(r.Options[:], opts...) - var env DNSAnalyticReportBytimeListResponseEnvelope - path := fmt.Sprintf("zones/%s/dns_analytics/report/bytime", identifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -type DNSAnalyticReportBytimeListResponse struct { - // Array with one row per combination of dimension values. - Data []DNSAnalyticReportBytimeListResponseData `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"` - // Maximum results for each metric (object mapping metric names to values). - // Currently always an empty object. - 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 DNSAnalyticReportBytimeListResponseQuery `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 - // array containing two values: the start time, and the end time. - TimeIntervals [][]time.Time `json:"time_intervals,required" format:"date-time"` - // Total results for metrics across all data (object mapping metric names to - // values). - Totals interface{} `json:"totals,required"` - JSON dnsAnalyticReportBytimeListResponseJSON `json:"-"` -} - -// dnsAnalyticReportBytimeListResponseJSON contains the JSON metadata for the -// struct [DNSAnalyticReportBytimeListResponse] -type dnsAnalyticReportBytimeListResponseJSON struct { - Data apijson.Field - DataLag apijson.Field - Max apijson.Field - Min apijson.Field - Query apijson.Field - Rows apijson.Field - TimeIntervals apijson.Field - Totals apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *DNSAnalyticReportBytimeListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type DNSAnalyticReportBytimeListResponseData 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 an array of values, - // broken down by time interval. - Metrics [][]interface{} `json:"metrics,required"` - JSON dnsAnalyticReportBytimeListResponseDataJSON `json:"-"` -} - -// dnsAnalyticReportBytimeListResponseDataJSON contains the JSON metadata for the -// struct [DNSAnalyticReportBytimeListResponseData] -type dnsAnalyticReportBytimeListResponseDataJSON struct { - Dimensions apijson.Field - Metrics apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *DNSAnalyticReportBytimeListResponseData) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type DNSAnalyticReportBytimeListResponseQuery struct { - // Array of dimension names. - Dimensions []string `json:"dimensions,required"` - // Limit number of returned metrics. - Limit int64 `json:"limit,required"` - // Array of metric names. - Metrics []string `json:"metrics,required"` - // 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 DNSAnalyticReportBytimeListResponseQueryTimeDelta `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 dnsAnalyticReportBytimeListResponseQueryJSON `json:"-"` -} - -// dnsAnalyticReportBytimeListResponseQueryJSON contains the JSON metadata for the -// struct [DNSAnalyticReportBytimeListResponseQuery] -type dnsAnalyticReportBytimeListResponseQueryJSON struct { - Dimensions apijson.Field - Limit apijson.Field - Metrics apijson.Field - Since apijson.Field - TimeDelta apijson.Field - Until apijson.Field - Filters apijson.Field - Sort apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *DNSAnalyticReportBytimeListResponseQuery) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Unit of time to group data by. -type DNSAnalyticReportBytimeListResponseQueryTimeDelta string - -const ( - DNSAnalyticReportBytimeListResponseQueryTimeDeltaAll DNSAnalyticReportBytimeListResponseQueryTimeDelta = "all" - DNSAnalyticReportBytimeListResponseQueryTimeDeltaAuto DNSAnalyticReportBytimeListResponseQueryTimeDelta = "auto" - DNSAnalyticReportBytimeListResponseQueryTimeDeltaYear DNSAnalyticReportBytimeListResponseQueryTimeDelta = "year" - DNSAnalyticReportBytimeListResponseQueryTimeDeltaQuarter DNSAnalyticReportBytimeListResponseQueryTimeDelta = "quarter" - DNSAnalyticReportBytimeListResponseQueryTimeDeltaMonth DNSAnalyticReportBytimeListResponseQueryTimeDelta = "month" - DNSAnalyticReportBytimeListResponseQueryTimeDeltaWeek DNSAnalyticReportBytimeListResponseQueryTimeDelta = "week" - DNSAnalyticReportBytimeListResponseQueryTimeDeltaDay DNSAnalyticReportBytimeListResponseQueryTimeDelta = "day" - DNSAnalyticReportBytimeListResponseQueryTimeDeltaHour DNSAnalyticReportBytimeListResponseQueryTimeDelta = "hour" - DNSAnalyticReportBytimeListResponseQueryTimeDeltaDekaminute DNSAnalyticReportBytimeListResponseQueryTimeDelta = "dekaminute" - DNSAnalyticReportBytimeListResponseQueryTimeDeltaMinute DNSAnalyticReportBytimeListResponseQueryTimeDelta = "minute" -) - -type DNSAnalyticReportBytimeListParams struct { - // A comma-separated list of dimensions to group results by. - Dimensions param.Field[string] `query:"dimensions"` - // Segmentation filter in 'attribute operator value' format. - Filters param.Field[string] `query:"filters"` - // Limit number of returned metrics. - Limit param.Field[int64] `query:"limit"` - // A comma-separated list of metrics to query. - Metrics param.Field[string] `query:"metrics"` - // Start date and time of requesting data period in ISO 8601 format. - Since param.Field[time.Time] `query:"since" format:"date-time"` - // A comma-separated list of dimensions to sort by, where each dimension may be - // prefixed by - (descending) or + (ascending). - Sort param.Field[string] `query:"sort"` - // Unit of time to group data by. - TimeDelta param.Field[DNSAnalyticReportBytimeListParamsTimeDelta] `query:"time_delta"` - // End date and time of requesting data period in ISO 8601 format. - Until param.Field[time.Time] `query:"until" format:"date-time"` -} - -// URLQuery serializes [DNSAnalyticReportBytimeListParams]'s query parameters as -// `url.Values`. -func (r DNSAnalyticReportBytimeListParams) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatComma, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} - -// Unit of time to group data by. -type DNSAnalyticReportBytimeListParamsTimeDelta string - -const ( - DNSAnalyticReportBytimeListParamsTimeDeltaAll DNSAnalyticReportBytimeListParamsTimeDelta = "all" - DNSAnalyticReportBytimeListParamsTimeDeltaAuto DNSAnalyticReportBytimeListParamsTimeDelta = "auto" - DNSAnalyticReportBytimeListParamsTimeDeltaYear DNSAnalyticReportBytimeListParamsTimeDelta = "year" - DNSAnalyticReportBytimeListParamsTimeDeltaQuarter DNSAnalyticReportBytimeListParamsTimeDelta = "quarter" - DNSAnalyticReportBytimeListParamsTimeDeltaMonth DNSAnalyticReportBytimeListParamsTimeDelta = "month" - DNSAnalyticReportBytimeListParamsTimeDeltaWeek DNSAnalyticReportBytimeListParamsTimeDelta = "week" - DNSAnalyticReportBytimeListParamsTimeDeltaDay DNSAnalyticReportBytimeListParamsTimeDelta = "day" - DNSAnalyticReportBytimeListParamsTimeDeltaHour DNSAnalyticReportBytimeListParamsTimeDelta = "hour" - DNSAnalyticReportBytimeListParamsTimeDeltaDekaminute DNSAnalyticReportBytimeListParamsTimeDelta = "dekaminute" - DNSAnalyticReportBytimeListParamsTimeDeltaMinute DNSAnalyticReportBytimeListParamsTimeDelta = "minute" -) - -type DNSAnalyticReportBytimeListResponseEnvelope struct { - Errors []DNSAnalyticReportBytimeListResponseEnvelopeErrors `json:"errors,required"` - Messages []DNSAnalyticReportBytimeListResponseEnvelopeMessages `json:"messages,required"` - Result DNSAnalyticReportBytimeListResponse `json:"result,required"` - // Whether the API call was successful - Success DNSAnalyticReportBytimeListResponseEnvelopeSuccess `json:"success,required"` - JSON dnsAnalyticReportBytimeListResponseEnvelopeJSON `json:"-"` -} - -// dnsAnalyticReportBytimeListResponseEnvelopeJSON contains the JSON metadata for -// the struct [DNSAnalyticReportBytimeListResponseEnvelope] -type dnsAnalyticReportBytimeListResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *DNSAnalyticReportBytimeListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type DNSAnalyticReportBytimeListResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON dnsAnalyticReportBytimeListResponseEnvelopeErrorsJSON `json:"-"` -} - -// dnsAnalyticReportBytimeListResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [DNSAnalyticReportBytimeListResponseEnvelopeErrors] -type dnsAnalyticReportBytimeListResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *DNSAnalyticReportBytimeListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type DNSAnalyticReportBytimeListResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON dnsAnalyticReportBytimeListResponseEnvelopeMessagesJSON `json:"-"` -} - -// dnsAnalyticReportBytimeListResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [DNSAnalyticReportBytimeListResponseEnvelopeMessages] -type dnsAnalyticReportBytimeListResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *DNSAnalyticReportBytimeListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type DNSAnalyticReportBytimeListResponseEnvelopeSuccess bool - -const ( - DNSAnalyticReportBytimeListResponseEnvelopeSuccessTrue DNSAnalyticReportBytimeListResponseEnvelopeSuccess = true -) diff --git a/dnsanalytic.go b/dnsanalytics.go similarity index 52% rename from dnsanalytic.go rename to dnsanalytics.go index fbe1d67bac0..fc0f2093940 100644 --- a/dnsanalytic.go +++ b/dnsanalytics.go @@ -6,22 +6,22 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -// DNSAnalyticService contains methods and other services that help with +// DNSAnalyticsService contains methods and other services that help with // interacting with the cloudflare API. Note, unlike clients, this service does not // read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewDNSAnalyticService] method +// this service directly, and instead use the [NewDNSAnalyticsService] method // instead. -type DNSAnalyticService struct { +type DNSAnalyticsService struct { Options []option.RequestOption - Reports *DNSAnalyticReportService + Reports *DNSAnalyticsReportService } -// NewDNSAnalyticService generates a new service that applies the given options to +// NewDNSAnalyticsService generates a new service that applies the given options to // each request. These options are applied after the parent client's options (if // there is one), and before any request-specific options. -func NewDNSAnalyticService(opts ...option.RequestOption) (r *DNSAnalyticService) { - r = &DNSAnalyticService{} +func NewDNSAnalyticsService(opts ...option.RequestOption) (r *DNSAnalyticsService) { + r = &DNSAnalyticsService{} r.Options = opts - r.Reports = NewDNSAnalyticReportService(opts...) + r.Reports = NewDNSAnalyticsReportService(opts...) return } diff --git a/dnsanalyticreport.go b/dnsanalyticsreport.go similarity index 54% rename from dnsanalyticreport.go rename to dnsanalyticsreport.go index 1b569e63494..a992c0cdf82 100644 --- a/dnsanalyticreport.go +++ b/dnsanalyticsreport.go @@ -16,23 +16,23 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -// DNSAnalyticReportService contains methods and other services that help with +// DNSAnalyticsReportService contains methods and other services that help with // interacting with the cloudflare API. Note, unlike clients, this service does not // read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewDNSAnalyticReportService] method +// this service directly, and instead use the [NewDNSAnalyticsReportService] method // instead. -type DNSAnalyticReportService struct { +type DNSAnalyticsReportService struct { Options []option.RequestOption - Bytimes *DNSAnalyticReportBytimeService + Bytimes *DNSAnalyticsReportBytimeService } -// NewDNSAnalyticReportService generates a new service that applies the given +// NewDNSAnalyticsReportService generates a new service that applies the given // options to each request. These options are applied after the parent client's // options (if there is one), and before any request-specific options. -func NewDNSAnalyticReportService(opts ...option.RequestOption) (r *DNSAnalyticReportService) { - r = &DNSAnalyticReportService{} +func NewDNSAnalyticsReportService(opts ...option.RequestOption) (r *DNSAnalyticsReportService) { + r = &DNSAnalyticsReportService{} r.Options = opts - r.Bytimes = NewDNSAnalyticReportBytimeService(opts...) + r.Bytimes = NewDNSAnalyticsReportBytimeService(opts...) return } @@ -41,9 +41,9 @@ func NewDNSAnalyticReportService(opts ...option.RequestOption) (r *DNSAnalyticRe // See // [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) // for detailed information about the available query parameters. -func (r *DNSAnalyticReportService) List(ctx context.Context, identifier string, query DNSAnalyticReportListParams, opts ...option.RequestOption) (res *DNSAnalyticReportListResponse, err error) { +func (r *DNSAnalyticsReportService) List(ctx context.Context, identifier string, query DNSAnalyticsReportListParams, opts ...option.RequestOption) (res *DNSAnalyticsReportListResponse, err error) { opts = append(r.Options[:], opts...) - var env DNSAnalyticReportListResponseEnvelope + var env DNSAnalyticsReportListResponseEnvelope path := fmt.Sprintf("zones/%s/dns_analytics/report", identifier) err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) if err != nil { @@ -53,9 +53,9 @@ func (r *DNSAnalyticReportService) List(ctx context.Context, identifier string, return } -type DNSAnalyticReportListResponse struct { +type DNSAnalyticsReportListResponse struct { // Array with one row per combination of dimension values. - Data []DNSAnalyticReportListResponseData `json:"data,required"` + Data []DNSAnalyticsReportListResponseData `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"` @@ -64,19 +64,19 @@ type DNSAnalyticReportListResponse 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 DNSAnalyticReportListResponseQuery `json:"query,required"` + Min interface{} `json:"min,required"` + Query DNSAnalyticsReportListResponseQuery `json:"query,required"` // Total number of rows in the result. Rows float64 `json:"rows,required"` // Total results for metrics across all data (object mapping metric names to // values). - Totals interface{} `json:"totals,required"` - JSON dnsAnalyticReportListResponseJSON `json:"-"` + Totals interface{} `json:"totals,required"` + JSON dnsAnalyticsReportListResponseJSON `json:"-"` } -// dnsAnalyticReportListResponseJSON contains the JSON metadata for the struct -// [DNSAnalyticReportListResponse] -type dnsAnalyticReportListResponseJSON struct { +// dnsAnalyticsReportListResponseJSON contains the JSON metadata for the struct +// [DNSAnalyticsReportListResponse] +type dnsAnalyticsReportListResponseJSON struct { Data apijson.Field DataLag apijson.Field Max apijson.Field @@ -88,33 +88,33 @@ type dnsAnalyticReportListResponseJSON struct { ExtraFields map[string]apijson.Field } -func (r *DNSAnalyticReportListResponse) UnmarshalJSON(data []byte) (err error) { +func (r *DNSAnalyticsReportListResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type DNSAnalyticReportListResponseData struct { +type DNSAnalyticsReportListResponseData 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 dnsAnalyticReportListResponseDataJSON `json:"-"` + Metrics []float64 `json:"metrics,required"` + JSON dnsAnalyticsReportListResponseDataJSON `json:"-"` } -// dnsAnalyticReportListResponseDataJSON contains the JSON metadata for the struct -// [DNSAnalyticReportListResponseData] -type dnsAnalyticReportListResponseDataJSON struct { +// dnsAnalyticsReportListResponseDataJSON contains the JSON metadata for the struct +// [DNSAnalyticsReportListResponseData] +type dnsAnalyticsReportListResponseDataJSON struct { Dimensions apijson.Field Metrics apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *DNSAnalyticReportListResponseData) UnmarshalJSON(data []byte) (err error) { +func (r *DNSAnalyticsReportListResponseData) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type DNSAnalyticReportListResponseQuery struct { +type DNSAnalyticsReportListResponseQuery struct { // Array of dimension names. Dimensions []string `json:"dimensions,required"` // Limit number of returned metrics. @@ -129,13 +129,13 @@ type DNSAnalyticReportListResponseQuery struct { 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 dnsAnalyticReportListResponseQueryJSON `json:"-"` + Sort []string `json:"sort"` + JSON dnsAnalyticsReportListResponseQueryJSON `json:"-"` } -// dnsAnalyticReportListResponseQueryJSON contains the JSON metadata for the struct -// [DNSAnalyticReportListResponseQuery] -type dnsAnalyticReportListResponseQueryJSON struct { +// dnsAnalyticsReportListResponseQueryJSON contains the JSON metadata for the +// struct [DNSAnalyticsReportListResponseQuery] +type dnsAnalyticsReportListResponseQueryJSON struct { Dimensions apijson.Field Limit apijson.Field Metrics apijson.Field @@ -147,11 +147,11 @@ type dnsAnalyticReportListResponseQueryJSON struct { ExtraFields map[string]apijson.Field } -func (r *DNSAnalyticReportListResponseQuery) UnmarshalJSON(data []byte) (err error) { +func (r *DNSAnalyticsReportListResponseQuery) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type DNSAnalyticReportListParams struct { +type DNSAnalyticsReportListParams struct { // A comma-separated list of dimensions to group results by. Dimensions param.Field[string] `query:"dimensions"` // Segmentation filter in 'attribute operator value' format. @@ -169,27 +169,27 @@ type DNSAnalyticReportListParams struct { Until param.Field[time.Time] `query:"until" format:"date-time"` } -// URLQuery serializes [DNSAnalyticReportListParams]'s query parameters as +// URLQuery serializes [DNSAnalyticsReportListParams]'s query parameters as // `url.Values`. -func (r DNSAnalyticReportListParams) URLQuery() (v url.Values) { +func (r DNSAnalyticsReportListParams) URLQuery() (v url.Values) { return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ ArrayFormat: apiquery.ArrayQueryFormatComma, NestedFormat: apiquery.NestedQueryFormatBrackets, }) } -type DNSAnalyticReportListResponseEnvelope struct { - Errors []DNSAnalyticReportListResponseEnvelopeErrors `json:"errors,required"` - Messages []DNSAnalyticReportListResponseEnvelopeMessages `json:"messages,required"` - Result DNSAnalyticReportListResponse `json:"result,required"` +type DNSAnalyticsReportListResponseEnvelope struct { + Errors []DNSAnalyticsReportListResponseEnvelopeErrors `json:"errors,required"` + Messages []DNSAnalyticsReportListResponseEnvelopeMessages `json:"messages,required"` + Result DNSAnalyticsReportListResponse `json:"result,required"` // Whether the API call was successful - Success DNSAnalyticReportListResponseEnvelopeSuccess `json:"success,required"` - JSON dnsAnalyticReportListResponseEnvelopeJSON `json:"-"` + Success DNSAnalyticsReportListResponseEnvelopeSuccess `json:"success,required"` + JSON dnsAnalyticsReportListResponseEnvelopeJSON `json:"-"` } -// dnsAnalyticReportListResponseEnvelopeJSON contains the JSON metadata for the -// struct [DNSAnalyticReportListResponseEnvelope] -type dnsAnalyticReportListResponseEnvelopeJSON struct { +// dnsAnalyticsReportListResponseEnvelopeJSON contains the JSON metadata for the +// struct [DNSAnalyticsReportListResponseEnvelope] +type dnsAnalyticsReportListResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field Result apijson.Field @@ -198,51 +198,51 @@ type dnsAnalyticReportListResponseEnvelopeJSON struct { ExtraFields map[string]apijson.Field } -func (r *DNSAnalyticReportListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { +func (r *DNSAnalyticsReportListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type DNSAnalyticReportListResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON dnsAnalyticReportListResponseEnvelopeErrorsJSON `json:"-"` +type DNSAnalyticsReportListResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON dnsAnalyticsReportListResponseEnvelopeErrorsJSON `json:"-"` } -// dnsAnalyticReportListResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [DNSAnalyticReportListResponseEnvelopeErrors] -type dnsAnalyticReportListResponseEnvelopeErrorsJSON struct { +// dnsAnalyticsReportListResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [DNSAnalyticsReportListResponseEnvelopeErrors] +type dnsAnalyticsReportListResponseEnvelopeErrorsJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *DNSAnalyticReportListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { +func (r *DNSAnalyticsReportListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type DNSAnalyticReportListResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON dnsAnalyticReportListResponseEnvelopeMessagesJSON `json:"-"` +type DNSAnalyticsReportListResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON dnsAnalyticsReportListResponseEnvelopeMessagesJSON `json:"-"` } -// dnsAnalyticReportListResponseEnvelopeMessagesJSON contains the JSON metadata for -// the struct [DNSAnalyticReportListResponseEnvelopeMessages] -type dnsAnalyticReportListResponseEnvelopeMessagesJSON struct { +// dnsAnalyticsReportListResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [DNSAnalyticsReportListResponseEnvelopeMessages] +type dnsAnalyticsReportListResponseEnvelopeMessagesJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *DNSAnalyticReportListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { +func (r *DNSAnalyticsReportListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // Whether the API call was successful -type DNSAnalyticReportListResponseEnvelopeSuccess bool +type DNSAnalyticsReportListResponseEnvelopeSuccess bool const ( - DNSAnalyticReportListResponseEnvelopeSuccessTrue DNSAnalyticReportListResponseEnvelopeSuccess = true + DNSAnalyticsReportListResponseEnvelopeSuccessTrue DNSAnalyticsReportListResponseEnvelopeSuccess = true ) diff --git a/dnsanalyticreport_test.go b/dnsanalyticsreport_test.go similarity index 90% rename from dnsanalyticreport_test.go rename to dnsanalyticsreport_test.go index fc0c9b2d514..4446c04bc31 100644 --- a/dnsanalyticreport_test.go +++ b/dnsanalyticsreport_test.go @@ -14,7 +14,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestDNSAnalyticReportListWithOptionalParams(t *testing.T) { +func TestDNSAnalyticsReportListWithOptionalParams(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 { @@ -30,10 +30,10 @@ func TestDNSAnalyticReportListWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.DNSAnalytics.Reports.List( + _, err := client.DNS.Analytics.Reports.List( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.DNSAnalyticReportListParams{ + cloudflare.DNSAnalyticsReportListParams{ Dimensions: cloudflare.F("queryType"), Filters: cloudflare.F("responseCode==NOERROR,queryType==A"), Limit: cloudflare.F(int64(100)), diff --git a/dnsanalyticsreportbytime.go b/dnsanalyticsreportbytime.go new file mode 100644 index 00000000000..0e15129679e --- /dev/null +++ b/dnsanalyticsreportbytime.go @@ -0,0 +1,288 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// DNSAnalyticsReportBytimeService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewDNSAnalyticsReportBytimeService] method instead. +type DNSAnalyticsReportBytimeService struct { + Options []option.RequestOption +} + +// NewDNSAnalyticsReportBytimeService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewDNSAnalyticsReportBytimeService(opts ...option.RequestOption) (r *DNSAnalyticsReportBytimeService) { + r = &DNSAnalyticsReportBytimeService{} + r.Options = opts + return +} + +// Retrieves a list of aggregate metrics grouped by time interval. +// +// See +// [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) +// for detailed information about the available query parameters. +func (r *DNSAnalyticsReportBytimeService) List(ctx context.Context, identifier string, query DNSAnalyticsReportBytimeListParams, opts ...option.RequestOption) (res *DNSAnalyticsReportBytimeListResponse, err error) { + opts = append(r.Options[:], opts...) + var env DNSAnalyticsReportBytimeListResponseEnvelope + path := fmt.Sprintf("zones/%s/dns_analytics/report/bytime", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +type DNSAnalyticsReportBytimeListResponse struct { + // Array with one row per combination of dimension values. + Data []DNSAnalyticsReportBytimeListResponseData `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"` + // Maximum results for each metric (object mapping metric names to values). + // Currently always an empty object. + 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 DNSAnalyticsReportBytimeListResponseQuery `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 + // array containing two values: the start time, and the end time. + TimeIntervals [][]time.Time `json:"time_intervals,required" format:"date-time"` + // Total results for metrics across all data (object mapping metric names to + // values). + Totals interface{} `json:"totals,required"` + JSON dnsAnalyticsReportBytimeListResponseJSON `json:"-"` +} + +// dnsAnalyticsReportBytimeListResponseJSON contains the JSON metadata for the +// struct [DNSAnalyticsReportBytimeListResponse] +type dnsAnalyticsReportBytimeListResponseJSON struct { + Data apijson.Field + DataLag apijson.Field + Max apijson.Field + Min apijson.Field + Query apijson.Field + Rows apijson.Field + TimeIntervals apijson.Field + Totals apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSAnalyticsReportBytimeListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DNSAnalyticsReportBytimeListResponseData 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 an array of values, + // broken down by time interval. + Metrics [][]interface{} `json:"metrics,required"` + JSON dnsAnalyticsReportBytimeListResponseDataJSON `json:"-"` +} + +// dnsAnalyticsReportBytimeListResponseDataJSON contains the JSON metadata for the +// struct [DNSAnalyticsReportBytimeListResponseData] +type dnsAnalyticsReportBytimeListResponseDataJSON struct { + Dimensions apijson.Field + Metrics apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSAnalyticsReportBytimeListResponseData) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DNSAnalyticsReportBytimeListResponseQuery struct { + // Array of dimension names. + Dimensions []string `json:"dimensions,required"` + // Limit number of returned metrics. + Limit int64 `json:"limit,required"` + // Array of metric names. + Metrics []string `json:"metrics,required"` + // 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 DNSAnalyticsReportBytimeListResponseQueryTimeDelta `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 dnsAnalyticsReportBytimeListResponseQueryJSON `json:"-"` +} + +// dnsAnalyticsReportBytimeListResponseQueryJSON contains the JSON metadata for the +// struct [DNSAnalyticsReportBytimeListResponseQuery] +type dnsAnalyticsReportBytimeListResponseQueryJSON struct { + Dimensions apijson.Field + Limit apijson.Field + Metrics apijson.Field + Since apijson.Field + TimeDelta apijson.Field + Until apijson.Field + Filters apijson.Field + Sort apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSAnalyticsReportBytimeListResponseQuery) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Unit of time to group data by. +type DNSAnalyticsReportBytimeListResponseQueryTimeDelta string + +const ( + DNSAnalyticsReportBytimeListResponseQueryTimeDeltaAll DNSAnalyticsReportBytimeListResponseQueryTimeDelta = "all" + DNSAnalyticsReportBytimeListResponseQueryTimeDeltaAuto DNSAnalyticsReportBytimeListResponseQueryTimeDelta = "auto" + DNSAnalyticsReportBytimeListResponseQueryTimeDeltaYear DNSAnalyticsReportBytimeListResponseQueryTimeDelta = "year" + DNSAnalyticsReportBytimeListResponseQueryTimeDeltaQuarter DNSAnalyticsReportBytimeListResponseQueryTimeDelta = "quarter" + DNSAnalyticsReportBytimeListResponseQueryTimeDeltaMonth DNSAnalyticsReportBytimeListResponseQueryTimeDelta = "month" + DNSAnalyticsReportBytimeListResponseQueryTimeDeltaWeek DNSAnalyticsReportBytimeListResponseQueryTimeDelta = "week" + DNSAnalyticsReportBytimeListResponseQueryTimeDeltaDay DNSAnalyticsReportBytimeListResponseQueryTimeDelta = "day" + DNSAnalyticsReportBytimeListResponseQueryTimeDeltaHour DNSAnalyticsReportBytimeListResponseQueryTimeDelta = "hour" + DNSAnalyticsReportBytimeListResponseQueryTimeDeltaDekaminute DNSAnalyticsReportBytimeListResponseQueryTimeDelta = "dekaminute" + DNSAnalyticsReportBytimeListResponseQueryTimeDeltaMinute DNSAnalyticsReportBytimeListResponseQueryTimeDelta = "minute" +) + +type DNSAnalyticsReportBytimeListParams struct { + // A comma-separated list of dimensions to group results by. + Dimensions param.Field[string] `query:"dimensions"` + // Segmentation filter in 'attribute operator value' format. + Filters param.Field[string] `query:"filters"` + // Limit number of returned metrics. + Limit param.Field[int64] `query:"limit"` + // A comma-separated list of metrics to query. + Metrics param.Field[string] `query:"metrics"` + // Start date and time of requesting data period in ISO 8601 format. + Since param.Field[time.Time] `query:"since" format:"date-time"` + // A comma-separated list of dimensions to sort by, where each dimension may be + // prefixed by - (descending) or + (ascending). + Sort param.Field[string] `query:"sort"` + // Unit of time to group data by. + TimeDelta param.Field[DNSAnalyticsReportBytimeListParamsTimeDelta] `query:"time_delta"` + // End date and time of requesting data period in ISO 8601 format. + Until param.Field[time.Time] `query:"until" format:"date-time"` +} + +// URLQuery serializes [DNSAnalyticsReportBytimeListParams]'s query parameters as +// `url.Values`. +func (r DNSAnalyticsReportBytimeListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Unit of time to group data by. +type DNSAnalyticsReportBytimeListParamsTimeDelta string + +const ( + DNSAnalyticsReportBytimeListParamsTimeDeltaAll DNSAnalyticsReportBytimeListParamsTimeDelta = "all" + DNSAnalyticsReportBytimeListParamsTimeDeltaAuto DNSAnalyticsReportBytimeListParamsTimeDelta = "auto" + DNSAnalyticsReportBytimeListParamsTimeDeltaYear DNSAnalyticsReportBytimeListParamsTimeDelta = "year" + DNSAnalyticsReportBytimeListParamsTimeDeltaQuarter DNSAnalyticsReportBytimeListParamsTimeDelta = "quarter" + DNSAnalyticsReportBytimeListParamsTimeDeltaMonth DNSAnalyticsReportBytimeListParamsTimeDelta = "month" + DNSAnalyticsReportBytimeListParamsTimeDeltaWeek DNSAnalyticsReportBytimeListParamsTimeDelta = "week" + DNSAnalyticsReportBytimeListParamsTimeDeltaDay DNSAnalyticsReportBytimeListParamsTimeDelta = "day" + DNSAnalyticsReportBytimeListParamsTimeDeltaHour DNSAnalyticsReportBytimeListParamsTimeDelta = "hour" + DNSAnalyticsReportBytimeListParamsTimeDeltaDekaminute DNSAnalyticsReportBytimeListParamsTimeDelta = "dekaminute" + DNSAnalyticsReportBytimeListParamsTimeDeltaMinute DNSAnalyticsReportBytimeListParamsTimeDelta = "minute" +) + +type DNSAnalyticsReportBytimeListResponseEnvelope struct { + Errors []DNSAnalyticsReportBytimeListResponseEnvelopeErrors `json:"errors,required"` + Messages []DNSAnalyticsReportBytimeListResponseEnvelopeMessages `json:"messages,required"` + Result DNSAnalyticsReportBytimeListResponse `json:"result,required"` + // Whether the API call was successful + Success DNSAnalyticsReportBytimeListResponseEnvelopeSuccess `json:"success,required"` + JSON dnsAnalyticsReportBytimeListResponseEnvelopeJSON `json:"-"` +} + +// dnsAnalyticsReportBytimeListResponseEnvelopeJSON contains the JSON metadata for +// the struct [DNSAnalyticsReportBytimeListResponseEnvelope] +type dnsAnalyticsReportBytimeListResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSAnalyticsReportBytimeListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DNSAnalyticsReportBytimeListResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON dnsAnalyticsReportBytimeListResponseEnvelopeErrorsJSON `json:"-"` +} + +// dnsAnalyticsReportBytimeListResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [DNSAnalyticsReportBytimeListResponseEnvelopeErrors] +type dnsAnalyticsReportBytimeListResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSAnalyticsReportBytimeListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type DNSAnalyticsReportBytimeListResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON dnsAnalyticsReportBytimeListResponseEnvelopeMessagesJSON `json:"-"` +} + +// dnsAnalyticsReportBytimeListResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [DNSAnalyticsReportBytimeListResponseEnvelopeMessages] +type dnsAnalyticsReportBytimeListResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *DNSAnalyticsReportBytimeListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type DNSAnalyticsReportBytimeListResponseEnvelopeSuccess bool + +const ( + DNSAnalyticsReportBytimeListResponseEnvelopeSuccessTrue DNSAnalyticsReportBytimeListResponseEnvelopeSuccess = true +) diff --git a/dnsanalyticreportbytime_test.go b/dnsanalyticsreportbytime_test.go similarity index 85% rename from dnsanalyticreportbytime_test.go rename to dnsanalyticsreportbytime_test.go index 1a3c4a872ae..285d0cfba03 100644 --- a/dnsanalyticreportbytime_test.go +++ b/dnsanalyticsreportbytime_test.go @@ -14,7 +14,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestDNSAnalyticReportBytimeListWithOptionalParams(t *testing.T) { +func TestDNSAnalyticsReportBytimeListWithOptionalParams(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 { @@ -30,17 +30,17 @@ func TestDNSAnalyticReportBytimeListWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.DNSAnalytics.Reports.Bytimes.List( + _, err := client.DNS.Analytics.Reports.Bytimes.List( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.DNSAnalyticReportBytimeListParams{ + cloudflare.DNSAnalyticsReportBytimeListParams{ Dimensions: cloudflare.F("queryType"), Filters: cloudflare.F("responseCode==NOERROR,queryType==A"), Limit: cloudflare.F(int64(100)), Metrics: cloudflare.F("queryCount,uncachedCount"), Since: cloudflare.F(time.Now()), Sort: cloudflare.F("+responseCode,-queryName"), - TimeDelta: cloudflare.F(cloudflare.DNSAnalyticReportBytimeListParamsTimeDeltaHour), + TimeDelta: cloudflare.F(cloudflare.DNSAnalyticsReportBytimeListParamsTimeDeltaHour), Until: cloudflare.F(time.Now()), }, ) diff --git a/firewallaccessrule_test.go b/firewallaccessrule_test.go index 90617bce316..fd5cd3f89cf 100644 --- a/firewallaccessrule_test.go +++ b/firewallaccessrule_test.go @@ -29,7 +29,7 @@ func TestFirewallAccessRuleNewWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.AccessRules.New(context.TODO(), cloudflare.FirewallAccessRuleNewParams{ + _, err := client.Firewall.AccessRules.New(context.TODO(), cloudflare.FirewallAccessRuleNewParams{ AccountID: cloudflare.F("string"), ZoneID: cloudflare.F("string"), Configuration: cloudflare.F[cloudflare.FirewallAccessRuleNewParamsConfiguration](cloudflare.FirewallAccessRuleNewParamsConfigurationLegacyJhsIPConfiguration(cloudflare.FirewallAccessRuleNewParamsConfigurationLegacyJhsIPConfiguration{ @@ -64,7 +64,7 @@ func TestFirewallAccessRuleListWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.AccessRules.List(context.TODO(), cloudflare.FirewallAccessRuleListParams{ + _, err := client.Firewall.AccessRules.List(context.TODO(), cloudflare.FirewallAccessRuleListParams{ AccountID: cloudflare.F("string"), ZoneID: cloudflare.F("string"), Direction: cloudflare.F(cloudflare.FirewallAccessRuleListParamsDirectionDesc), @@ -110,7 +110,7 @@ func TestFirewallAccessRuleDelete(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.AccessRules.Delete( + _, err := client.Firewall.AccessRules.Delete( context.TODO(), map[string]interface{}{}, cloudflare.FirewallAccessRuleDeleteParams{ @@ -143,7 +143,7 @@ func TestFirewallAccessRuleEditWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.AccessRules.Edit( + _, err := client.Firewall.AccessRules.Edit( context.TODO(), map[string]interface{}{}, cloudflare.FirewallAccessRuleEditParams{ @@ -181,7 +181,7 @@ func TestFirewallAccessRuleGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.AccessRules.Get( + _, err := client.Firewall.AccessRules.Get( context.TODO(), map[string]interface{}{}, cloudflare.FirewallAccessRuleGetParams{ diff --git a/firewalllockdown_test.go b/firewalllockdown_test.go index c0e0d5b3972..26cfecce498 100644 --- a/firewalllockdown_test.go +++ b/firewalllockdown_test.go @@ -29,7 +29,7 @@ func TestFirewallLockdownNew(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.Lockdowns.New( + _, err := client.Firewall.Lockdowns.New( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", cloudflare.FirewallLockdownNewParams{ @@ -61,7 +61,7 @@ func TestFirewallLockdownUpdate(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.Lockdowns.Update( + _, err := client.Firewall.Lockdowns.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b59", @@ -94,7 +94,7 @@ func TestFirewallLockdownListWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.Lockdowns.List( + _, err := client.Firewall.Lockdowns.List( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", cloudflare.FirewallLockdownListParams{ @@ -134,7 +134,7 @@ func TestFirewallLockdownDelete(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.Lockdowns.Delete( + _, err := client.Firewall.Lockdowns.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b59", @@ -164,7 +164,7 @@ func TestFirewallLockdownGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.Lockdowns.Get( + _, err := client.Firewall.Lockdowns.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b59", diff --git a/firewallrule_test.go b/firewallrule_test.go index d196b12c870..0f7c92e14de 100644 --- a/firewallrule_test.go +++ b/firewallrule_test.go @@ -29,7 +29,7 @@ func TestFirewallRuleNew(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.Rules.New( + _, err := client.Firewall.Rules.New( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", cloudflare.FirewallRuleNewParams{ @@ -61,7 +61,7 @@ func TestFirewallRuleUpdate(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.Rules.Update( + _, err := client.Firewall.Rules.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b60", @@ -94,7 +94,7 @@ func TestFirewallRuleListWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.Rules.List( + _, err := client.Firewall.Rules.List( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", cloudflare.FirewallRuleListParams{ @@ -130,7 +130,7 @@ func TestFirewallRuleDeleteWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.Rules.Delete( + _, err := client.Firewall.Rules.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b60", @@ -163,7 +163,7 @@ func TestFirewallRuleEdit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.Rules.Edit( + _, err := client.Firewall.Rules.Edit( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b60", @@ -196,7 +196,7 @@ func TestFirewallRuleGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.Rules.Get( + _, err := client.Firewall.Rules.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b60", diff --git a/firewalluarule_test.go b/firewalluarule_test.go index 50db02c0339..07bf5d82d84 100644 --- a/firewalluarule_test.go +++ b/firewalluarule_test.go @@ -29,7 +29,7 @@ func TestFirewallUARuleNew(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.UARules.New( + _, err := client.Firewall.UARules.New( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", cloudflare.FirewallUARuleNewParams{ @@ -61,7 +61,7 @@ func TestFirewallUARuleUpdate(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.UARules.Update( + _, err := client.Firewall.UARules.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b59", @@ -94,7 +94,7 @@ func TestFirewallUARuleListWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.UARules.List( + _, err := client.Firewall.UARules.List( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", cloudflare.FirewallUARuleListParams{ @@ -130,7 +130,7 @@ func TestFirewallUARuleDelete(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.UARules.Delete( + _, err := client.Firewall.UARules.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b59", @@ -160,7 +160,7 @@ func TestFirewallUARuleGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.UARules.Get( + _, err := client.Firewall.UARules.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b59", diff --git a/firewallwafoverride_test.go b/firewallwafoverride_test.go index c4a0a3d899a..76d33b18de6 100644 --- a/firewallwafoverride_test.go +++ b/firewallwafoverride_test.go @@ -29,7 +29,7 @@ func TestFirewallWAFOverrideNew(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.WAF.Overrides.New( + _, err := client.Firewall.WAF.Overrides.New( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", cloudflare.FirewallWAFOverrideNewParams{ @@ -61,7 +61,7 @@ func TestFirewallWAFOverrideUpdate(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.WAF.Overrides.Update( + _, err := client.Firewall.WAF.Overrides.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "de677e5818985db1285d0e80225f06e5", @@ -94,7 +94,7 @@ func TestFirewallWAFOverrideListWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.WAF.Overrides.List( + _, err := client.Firewall.WAF.Overrides.List( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", cloudflare.FirewallWAFOverrideListParams{ @@ -127,7 +127,7 @@ func TestFirewallWAFOverrideDelete(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.WAF.Overrides.Delete( + _, err := client.Firewall.WAF.Overrides.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "de677e5818985db1285d0e80225f06e5", @@ -157,7 +157,7 @@ func TestFirewallWAFOverrideGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.WAF.Overrides.Get( + _, err := client.Firewall.WAF.Overrides.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "de677e5818985db1285d0e80225f06e5", diff --git a/firewallwafpackage_test.go b/firewallwafpackage_test.go index b226d9a2680..cca709c41ac 100644 --- a/firewallwafpackage_test.go +++ b/firewallwafpackage_test.go @@ -29,7 +29,7 @@ func TestFirewallWAFPackageListWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.WAF.Packages.List( + _, err := client.Firewall.WAF.Packages.List( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", cloudflare.FirewallWAFPackageListParams{ @@ -65,7 +65,7 @@ func TestFirewallWAFPackageGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.WAF.Packages.Get( + _, err := client.Firewall.WAF.Packages.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "a25a9a7e9c00afc1fb2e0245519d725b", diff --git a/firewallwafpackagegroup_test.go b/firewallwafpackagegroup_test.go index e223028bec0..33fb5dd675b 100644 --- a/firewallwafpackagegroup_test.go +++ b/firewallwafpackagegroup_test.go @@ -29,7 +29,7 @@ func TestFirewallWAFPackageGroupListWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.WAF.Packages.Groups.List( + _, err := client.Firewall.WAF.Packages.Groups.List( context.TODO(), "a25a9a7e9c00afc1fb2e0245519d725b", cloudflare.FirewallWAFPackageGroupListParams{ @@ -67,7 +67,7 @@ func TestFirewallWAFPackageGroupEditWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.WAF.Packages.Groups.Edit( + _, err := client.Firewall.WAF.Packages.Groups.Edit( context.TODO(), "a25a9a7e9c00afc1fb2e0245519d725b", "a25a9a7e9c00afc1fb2e0245519d725b", @@ -101,7 +101,7 @@ func TestFirewallWAFPackageGroupGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.WAF.Packages.Groups.Get( + _, err := client.Firewall.WAF.Packages.Groups.Get( context.TODO(), "a25a9a7e9c00afc1fb2e0245519d725b", "a25a9a7e9c00afc1fb2e0245519d725b", diff --git a/firewallwafpackagerule.go b/firewallwafpackagerule.go index 7df21d2bfa0..5d6133edf70 100644 --- a/firewallwafpackagerule.go +++ b/firewallwafpackagerule.go @@ -36,6 +36,35 @@ func NewFirewallWAFPackageRuleService(opts ...option.RequestOption) (r *Firewall return } +// Fetches WAF rules in a WAF package. +// +// **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 *FirewallWAFPackageRuleService) List(ctx context.Context, packageID string, params FirewallWAFPackageRuleListParams, opts ...option.RequestOption) (res *shared.V4PagePaginationArray[FirewallWAFPackageRuleListResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("zones/%s/firewall/waf/packages/%s/rules", params.ZoneID, packageID) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, params, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +// Fetches WAF rules in a WAF package. +// +// **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 *FirewallWAFPackageRuleService) ListAutoPaging(ctx context.Context, packageID string, params FirewallWAFPackageRuleListParams, opts ...option.RequestOption) *shared.V4PagePaginationArrayAutoPager[FirewallWAFPackageRuleListResponse] { + return shared.NewV4PagePaginationArrayAutoPager(r.List(ctx, packageID, params, opts...)) +} + // Updates a WAF rule. You can only update the mode/action of the rule. // // **Note:** Applies only to the @@ -68,67 +97,51 @@ func (r *FirewallWAFPackageRuleService) Get(ctx context.Context, packageID strin return } -// Fetches WAF rules in a WAF package. -// -// **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 *FirewallWAFPackageRuleService) WAFRulesListWAFRules(ctx context.Context, packageID string, params FirewallWAFPackageRuleWAFRulesListWAFRulesParams, opts ...option.RequestOption) (res *[]FirewallWAFPackageRuleWAFRulesListWAFRulesResponse, err error) { - opts = append(r.Options[:], opts...) - var env FirewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelope - path := fmt.Sprintf("zones/%s/firewall/waf/packages/%s/rules", params.ZoneID, packageID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - // When triggered, anomaly detection WAF rules contribute to an overall threat // score that will determine if a request is considered malicious. You can // configure the total scoring threshold through the 'sensitivity' property of the // WAF package. // // Union satisfied by -// [FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRule], -// [FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRule] or -// [FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRule]. -type FirewallWAFPackageRuleEditResponse interface { - implementsFirewallWAFPackageRuleEditResponse() +// [FirewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRule], +// [FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRule] or +// [FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRule]. +type FirewallWAFPackageRuleListResponse interface { + implementsFirewallWAFPackageRuleListResponse() } func init() { - apijson.RegisterUnion(reflect.TypeOf((*FirewallWAFPackageRuleEditResponse)(nil)).Elem(), "") + apijson.RegisterUnion(reflect.TypeOf((*FirewallWAFPackageRuleListResponse)(nil)).Elem(), "") } // When triggered, anomaly detection WAF rules contribute to an overall threat // score that will determine if a request is considered malicious. You can // configure the total scoring threshold through the 'sensitivity' property of the // WAF package. -type FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRule struct { +type FirewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRule struct { // The unique identifier of the WAF rule. ID string `json:"id,required"` // Defines the available modes for the current WAF rule. Applies to anomaly // detection WAF rules. - AllowedModes []FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleAllowedMode `json:"allowed_modes,required"` + AllowedModes []FirewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRuleAllowedMode `json:"allowed_modes,required"` // The public description of the WAF rule. Description string `json:"description,required"` // The rule group to which the current WAF rule belongs. - Group FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleGroup `json:"group,required"` + Group FirewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRuleGroup `json:"group,required"` // When set to `on`, the current WAF rule will be used when evaluating the request. // Applies to anomaly detection WAF rules. - Mode FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleMode `json:"mode,required"` + Mode FirewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRuleMode `json:"mode,required"` // The unique identifier of a WAF package. PackageID string `json:"package_id,required"` // The order in which the individual WAF rule is executed within its rule group. Priority string `json:"priority,required"` - JSON firewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleJSON `json:"-"` + JSON firewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRuleJSON `json:"-"` } -// firewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleJSON contains the +// firewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRuleJSON contains the // JSON metadata for the struct -// [FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRule] -type firewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleJSON struct { +// [FirewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRule] +type firewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRuleJSON struct { ID apijson.Field AllowedModes apijson.Field Description apijson.Field @@ -140,83 +153,83 @@ type firewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleJSON struct { ExtraFields map[string]apijson.Field } -func (r *FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRule) UnmarshalJSON(data []byte) (err error) { +func (r *FirewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRule) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRule) implementsFirewallWAFPackageRuleEditResponse() { +func (r FirewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRule) implementsFirewallWAFPackageRuleListResponse() { } // When set to `on`, the current WAF rule will be used when evaluating the request. // Applies to anomaly detection WAF rules. -type FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleAllowedMode string +type FirewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRuleAllowedMode string const ( - FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleAllowedModeOn FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleAllowedMode = "on" - FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleAllowedModeOff FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleAllowedMode = "off" + FirewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRuleAllowedModeOn FirewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRuleAllowedMode = "on" + FirewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRuleAllowedModeOff FirewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRuleAllowedMode = "off" ) // The rule group to which the current WAF rule belongs. -type FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleGroup struct { +type FirewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRuleGroup struct { // The unique identifier of the rule group. ID string `json:"id"` // The name of the rule group. Name string `json:"name"` - JSON firewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleGroupJSON `json:"-"` + JSON firewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRuleGroupJSON `json:"-"` } -// firewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleGroupJSON contains +// firewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRuleGroupJSON contains // the JSON metadata for the struct -// [FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleGroup] -type firewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleGroupJSON struct { +// [FirewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRuleGroup] +type firewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRuleGroupJSON struct { ID apijson.Field Name apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleGroup) UnmarshalJSON(data []byte) (err error) { +func (r *FirewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRuleGroup) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // When set to `on`, the current WAF rule will be used when evaluating the request. // Applies to anomaly detection WAF rules. -type FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleMode string +type FirewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRuleMode string const ( - FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleModeOn FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleMode = "on" - FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleModeOff FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleMode = "off" + FirewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRuleModeOn FirewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRuleMode = "on" + FirewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRuleModeOff FirewallWAFPackageRuleListResponseWAFManagedRulesAnomalyRuleMode = "off" ) // When triggered, traditional WAF rules cause the firewall to immediately act upon // the request based on the configuration of the rule. A 'deny' rule will // immediately respond to the request based on the configured rule action/mode (for // example, 'block') and no other rules will be processed. -type FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRule struct { +type FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRule struct { // The unique identifier of the WAF rule. ID string `json:"id,required"` // The list of possible actions of the WAF rule when it is triggered. - AllowedModes []FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedMode `json:"allowed_modes,required"` + AllowedModes []FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleAllowedMode `json:"allowed_modes,required"` // The default action/mode of a rule. - DefaultMode FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleDefaultMode `json:"default_mode,required"` + DefaultMode FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleDefaultMode `json:"default_mode,required"` // The public description of the WAF rule. Description string `json:"description,required"` // The rule group to which the current WAF rule belongs. - Group FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleGroup `json:"group,required"` + Group FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleGroup `json:"group,required"` // The action that the current WAF rule will perform when triggered. Applies to // traditional (deny) WAF rules. - Mode FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleMode `json:"mode,required"` + Mode FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleMode `json:"mode,required"` // The unique identifier of a WAF package. PackageID string `json:"package_id,required"` // The order in which the individual WAF rule is executed within its rule group. Priority string `json:"priority,required"` - JSON firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleJSON `json:"-"` + JSON firewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleJSON `json:"-"` } -// firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleJSON +// firewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleJSON // contains the JSON metadata for the struct -// [FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRule] -type firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleJSON struct { +// [FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRule] +type firewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleJSON struct { ID apijson.Field AllowedModes apijson.Field DefaultMode apijson.Field @@ -229,96 +242,96 @@ type firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleJSON st ExtraFields map[string]apijson.Field } -func (r *FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRule) UnmarshalJSON(data []byte) (err error) { +func (r *FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRule) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRule) implementsFirewallWAFPackageRuleEditResponse() { +func (r FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRule) implementsFirewallWAFPackageRuleListResponse() { } // The action that the current WAF rule will perform when triggered. Applies to // traditional (deny) WAF rules. -type FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedMode string +type FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleAllowedMode string const ( - FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedModeDefault FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedMode = "default" - FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedModeDisable FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedMode = "disable" - FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedModeSimulate FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedMode = "simulate" - FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedModeBlock FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedMode = "block" - FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedModeChallenge FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedMode = "challenge" + FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleAllowedModeDefault FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleAllowedMode = "default" + FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleAllowedModeDisable FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleAllowedMode = "disable" + FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleAllowedModeSimulate FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleAllowedMode = "simulate" + FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleAllowedModeBlock FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleAllowedMode = "block" + FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleAllowedModeChallenge FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleAllowedMode = "challenge" ) // The default action/mode of a rule. -type FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleDefaultMode string +type FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleDefaultMode string const ( - FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleDefaultModeDisable FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleDefaultMode = "disable" - FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleDefaultModeSimulate FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleDefaultMode = "simulate" - FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleDefaultModeBlock FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleDefaultMode = "block" - FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleDefaultModeChallenge FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleDefaultMode = "challenge" + FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleDefaultModeDisable FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleDefaultMode = "disable" + FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleDefaultModeSimulate FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleDefaultMode = "simulate" + FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleDefaultModeBlock FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleDefaultMode = "block" + FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleDefaultModeChallenge FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleDefaultMode = "challenge" ) // The rule group to which the current WAF rule belongs. -type FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleGroup struct { +type FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleGroup struct { // The unique identifier of the rule group. ID string `json:"id"` // The name of the rule group. Name string `json:"name"` - JSON firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleGroupJSON `json:"-"` + JSON firewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleGroupJSON `json:"-"` } -// firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleGroupJSON +// firewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleGroupJSON // contains the JSON metadata for the struct -// [FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleGroup] -type firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleGroupJSON struct { +// [FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleGroup] +type firewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleGroupJSON struct { ID apijson.Field Name apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleGroup) UnmarshalJSON(data []byte) (err error) { +func (r *FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleGroup) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // The action that the current WAF rule will perform when triggered. Applies to // traditional (deny) WAF rules. -type FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleMode string +type FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleMode string const ( - FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleModeDefault FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleMode = "default" - FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleModeDisable FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleMode = "disable" - FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleModeSimulate FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleMode = "simulate" - FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleModeBlock FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleMode = "block" - FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleModeChallenge FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleMode = "challenge" + FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleModeDefault FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleMode = "default" + FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleModeDisable FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleMode = "disable" + FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleModeSimulate FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleMode = "simulate" + FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleModeBlock FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleMode = "block" + FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleModeChallenge FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalDenyRuleMode = "challenge" ) // When triggered, traditional WAF rules cause the firewall to immediately act on // the request based on the rule configuration. An 'allow' rule will immediately // allow the request and no other rules will be processed. -type FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRule struct { +type FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRule struct { // The unique identifier of the WAF rule. ID string `json:"id,required"` // Defines the available modes for the current WAF rule. - AllowedModes []FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleAllowedMode `json:"allowed_modes,required"` + AllowedModes []FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleAllowedMode `json:"allowed_modes,required"` // The public description of the WAF rule. Description string `json:"description,required"` // The rule group to which the current WAF rule belongs. - Group FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleGroup `json:"group,required"` + Group FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleGroup `json:"group,required"` // When set to `on`, the current rule will be used when evaluating the request. // Applies to traditional (allow) WAF rules. - Mode FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleMode `json:"mode,required"` + Mode FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleMode `json:"mode,required"` // The unique identifier of a WAF package. PackageID string `json:"package_id,required"` // The order in which the individual WAF rule is executed within its rule group. Priority string `json:"priority,required"` - JSON firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleJSON `json:"-"` + JSON firewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleJSON `json:"-"` } -// firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleJSON +// firewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleJSON // contains the JSON metadata for the struct -// [FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRule] -type firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleJSON struct { +// [FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRule] +type firewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleJSON struct { ID apijson.Field AllowedModes apijson.Field Description apijson.Field @@ -330,121 +343,99 @@ type firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleJSON s ExtraFields map[string]apijson.Field } -func (r *FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRule) UnmarshalJSON(data []byte) (err error) { +func (r *FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRule) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRule) implementsFirewallWAFPackageRuleEditResponse() { +func (r FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRule) implementsFirewallWAFPackageRuleListResponse() { } // When set to `on`, the current rule will be used when evaluating the request. // Applies to traditional (allow) WAF rules. -type FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleAllowedMode string +type FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleAllowedMode string const ( - FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleAllowedModeOn FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleAllowedMode = "on" - FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleAllowedModeOff FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleAllowedMode = "off" + FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleAllowedModeOn FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleAllowedMode = "on" + FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleAllowedModeOff FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleAllowedMode = "off" ) // The rule group to which the current WAF rule belongs. -type FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleGroup struct { +type FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleGroup struct { // The unique identifier of the rule group. ID string `json:"id"` // The name of the rule group. Name string `json:"name"` - JSON firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleGroupJSON `json:"-"` + JSON firewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleGroupJSON `json:"-"` } -// firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleGroupJSON +// firewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleGroupJSON // contains the JSON metadata for the struct -// [FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleGroup] -type firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleGroupJSON struct { +// [FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleGroup] +type firewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleGroupJSON struct { ID apijson.Field Name apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleGroup) UnmarshalJSON(data []byte) (err error) { +func (r *FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleGroup) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // When set to `on`, the current rule will be used when evaluating the request. // Applies to traditional (allow) WAF rules. -type FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleMode string +type FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleMode string const ( - FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleModeOn FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleMode = "on" - FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleModeOff FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleMode = "off" + FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleModeOn FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleMode = "on" + FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleModeOff FirewallWAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleMode = "off" ) -// Union satisfied by [FirewallWAFPackageRuleGetResponseUnknown], -// [FirewallWAFPackageRuleGetResponseArray] or [shared.UnionString]. -type FirewallWAFPackageRuleGetResponse interface { - ImplementsFirewallWAFPackageRuleGetResponse() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*FirewallWAFPackageRuleGetResponse)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.String, - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) -} - -type FirewallWAFPackageRuleGetResponseArray []interface{} - -func (r FirewallWAFPackageRuleGetResponseArray) ImplementsFirewallWAFPackageRuleGetResponse() {} - // When triggered, anomaly detection WAF rules contribute to an overall threat // score that will determine if a request is considered malicious. You can // configure the total scoring threshold through the 'sensitivity' property of the // WAF package. // // Union satisfied by -// [FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRule], -// [FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRule] -// or -// [FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRule]. -type FirewallWAFPackageRuleWAFRulesListWAFRulesResponse interface { - implementsFirewallWAFPackageRuleWAFRulesListWAFRulesResponse() +// [FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRule], +// [FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRule] or +// [FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRule]. +type FirewallWAFPackageRuleEditResponse interface { + implementsFirewallWAFPackageRuleEditResponse() } func init() { - apijson.RegisterUnion(reflect.TypeOf((*FirewallWAFPackageRuleWAFRulesListWAFRulesResponse)(nil)).Elem(), "") + apijson.RegisterUnion(reflect.TypeOf((*FirewallWAFPackageRuleEditResponse)(nil)).Elem(), "") } // When triggered, anomaly detection WAF rules contribute to an overall threat // score that will determine if a request is considered malicious. You can // configure the total scoring threshold through the 'sensitivity' property of the // WAF package. -type FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRule struct { +type FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRule struct { // The unique identifier of the WAF rule. ID string `json:"id,required"` // Defines the available modes for the current WAF rule. Applies to anomaly // detection WAF rules. - AllowedModes []FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRuleAllowedMode `json:"allowed_modes,required"` + AllowedModes []FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleAllowedMode `json:"allowed_modes,required"` // The public description of the WAF rule. Description string `json:"description,required"` // The rule group to which the current WAF rule belongs. - Group FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRuleGroup `json:"group,required"` + Group FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleGroup `json:"group,required"` // When set to `on`, the current WAF rule will be used when evaluating the request. // Applies to anomaly detection WAF rules. - Mode FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRuleMode `json:"mode,required"` + Mode FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleMode `json:"mode,required"` // The unique identifier of a WAF package. PackageID string `json:"package_id,required"` // The order in which the individual WAF rule is executed within its rule group. - Priority string `json:"priority,required"` - JSON firewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRuleJSON `json:"-"` + Priority string `json:"priority,required"` + JSON firewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleJSON `json:"-"` } -// firewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRuleJSON -// contains the JSON metadata for the struct -// [FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRule] -type firewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRuleJSON struct { +// firewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleJSON contains the +// JSON metadata for the struct +// [FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRule] +type firewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleJSON struct { ID apijson.Field AllowedModes apijson.Field Description apijson.Field @@ -456,83 +447,83 @@ type firewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRul ExtraFields map[string]apijson.Field } -func (r *FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRule) UnmarshalJSON(data []byte) (err error) { +func (r *FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRule) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRule) implementsFirewallWAFPackageRuleWAFRulesListWAFRulesResponse() { +func (r FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRule) implementsFirewallWAFPackageRuleEditResponse() { } // When set to `on`, the current WAF rule will be used when evaluating the request. // Applies to anomaly detection WAF rules. -type FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRuleAllowedMode string +type FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleAllowedMode string const ( - FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRuleAllowedModeOn FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRuleAllowedMode = "on" - FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRuleAllowedModeOff FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRuleAllowedMode = "off" + FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleAllowedModeOn FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleAllowedMode = "on" + FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleAllowedModeOff FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleAllowedMode = "off" ) // The rule group to which the current WAF rule belongs. -type FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRuleGroup struct { +type FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleGroup struct { // The unique identifier of the rule group. ID string `json:"id"` // The name of the rule group. - Name string `json:"name"` - JSON firewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRuleGroupJSON `json:"-"` + Name string `json:"name"` + JSON firewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleGroupJSON `json:"-"` } -// firewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRuleGroupJSON -// contains the JSON metadata for the struct -// [FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRuleGroup] -type firewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRuleGroupJSON struct { +// firewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleGroupJSON contains +// the JSON metadata for the struct +// [FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleGroup] +type firewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleGroupJSON struct { ID apijson.Field Name apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRuleGroup) UnmarshalJSON(data []byte) (err error) { +func (r *FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleGroup) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // When set to `on`, the current WAF rule will be used when evaluating the request. // Applies to anomaly detection WAF rules. -type FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRuleMode string +type FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleMode string const ( - FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRuleModeOn FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRuleMode = "on" - FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRuleModeOff FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesAnomalyRuleMode = "off" + FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleModeOn FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleMode = "on" + FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleModeOff FirewallWAFPackageRuleEditResponseWAFManagedRulesAnomalyRuleMode = "off" ) // When triggered, traditional WAF rules cause the firewall to immediately act upon // the request based on the configuration of the rule. A 'deny' rule will // immediately respond to the request based on the configured rule action/mode (for // example, 'block') and no other rules will be processed. -type FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRule struct { +type FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRule struct { // The unique identifier of the WAF rule. ID string `json:"id,required"` // The list of possible actions of the WAF rule when it is triggered. - AllowedModes []FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleAllowedMode `json:"allowed_modes,required"` + AllowedModes []FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedMode `json:"allowed_modes,required"` // The default action/mode of a rule. - DefaultMode FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleDefaultMode `json:"default_mode,required"` + DefaultMode FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleDefaultMode `json:"default_mode,required"` // The public description of the WAF rule. Description string `json:"description,required"` // The rule group to which the current WAF rule belongs. - Group FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleGroup `json:"group,required"` + Group FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleGroup `json:"group,required"` // The action that the current WAF rule will perform when triggered. Applies to // traditional (deny) WAF rules. - Mode FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleMode `json:"mode,required"` + Mode FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleMode `json:"mode,required"` // The unique identifier of a WAF package. PackageID string `json:"package_id,required"` // The order in which the individual WAF rule is executed within its rule group. - Priority string `json:"priority,required"` - JSON firewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleJSON `json:"-"` + Priority string `json:"priority,required"` + JSON firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleJSON `json:"-"` } -// firewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleJSON +// firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleJSON // contains the JSON metadata for the struct -// [FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRule] -type firewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleJSON struct { +// [FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRule] +type firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleJSON struct { ID apijson.Field AllowedModes apijson.Field DefaultMode apijson.Field @@ -545,96 +536,96 @@ type firewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditiona ExtraFields map[string]apijson.Field } -func (r *FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRule) UnmarshalJSON(data []byte) (err error) { +func (r *FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRule) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRule) implementsFirewallWAFPackageRuleWAFRulesListWAFRulesResponse() { +func (r FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRule) implementsFirewallWAFPackageRuleEditResponse() { } // The action that the current WAF rule will perform when triggered. Applies to // traditional (deny) WAF rules. -type FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleAllowedMode string +type FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedMode string const ( - FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleAllowedModeDefault FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleAllowedMode = "default" - FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleAllowedModeDisable FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleAllowedMode = "disable" - FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleAllowedModeSimulate FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleAllowedMode = "simulate" - FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleAllowedModeBlock FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleAllowedMode = "block" - FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleAllowedModeChallenge FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleAllowedMode = "challenge" + FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedModeDefault FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedMode = "default" + FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedModeDisable FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedMode = "disable" + FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedModeSimulate FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedMode = "simulate" + FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedModeBlock FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedMode = "block" + FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedModeChallenge FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleAllowedMode = "challenge" ) // The default action/mode of a rule. -type FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleDefaultMode string +type FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleDefaultMode string const ( - FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleDefaultModeDisable FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleDefaultMode = "disable" - FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleDefaultModeSimulate FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleDefaultMode = "simulate" - FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleDefaultModeBlock FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleDefaultMode = "block" - FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleDefaultModeChallenge FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleDefaultMode = "challenge" + FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleDefaultModeDisable FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleDefaultMode = "disable" + FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleDefaultModeSimulate FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleDefaultMode = "simulate" + FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleDefaultModeBlock FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleDefaultMode = "block" + FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleDefaultModeChallenge FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleDefaultMode = "challenge" ) // The rule group to which the current WAF rule belongs. -type FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleGroup struct { +type FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleGroup struct { // The unique identifier of the rule group. ID string `json:"id"` // The name of the rule group. - Name string `json:"name"` - JSON firewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleGroupJSON `json:"-"` + Name string `json:"name"` + JSON firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleGroupJSON `json:"-"` } -// firewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleGroupJSON +// firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleGroupJSON // contains the JSON metadata for the struct -// [FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleGroup] -type firewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleGroupJSON struct { +// [FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleGroup] +type firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleGroupJSON struct { ID apijson.Field Name apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleGroup) UnmarshalJSON(data []byte) (err error) { +func (r *FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleGroup) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // The action that the current WAF rule will perform when triggered. Applies to // traditional (deny) WAF rules. -type FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleMode string +type FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleMode string const ( - FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleModeDefault FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleMode = "default" - FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleModeDisable FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleMode = "disable" - FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleModeSimulate FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleMode = "simulate" - FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleModeBlock FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleMode = "block" - FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleModeChallenge FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalDenyRuleMode = "challenge" + FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleModeDefault FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleMode = "default" + FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleModeDisable FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleMode = "disable" + FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleModeSimulate FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleMode = "simulate" + FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleModeBlock FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleMode = "block" + FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleModeChallenge FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalDenyRuleMode = "challenge" ) // When triggered, traditional WAF rules cause the firewall to immediately act on // the request based on the rule configuration. An 'allow' rule will immediately // allow the request and no other rules will be processed. -type FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRule struct { +type FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRule struct { // The unique identifier of the WAF rule. ID string `json:"id,required"` // Defines the available modes for the current WAF rule. - AllowedModes []FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRuleAllowedMode `json:"allowed_modes,required"` + AllowedModes []FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleAllowedMode `json:"allowed_modes,required"` // The public description of the WAF rule. Description string `json:"description,required"` // The rule group to which the current WAF rule belongs. - Group FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRuleGroup `json:"group,required"` + Group FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleGroup `json:"group,required"` // When set to `on`, the current rule will be used when evaluating the request. // Applies to traditional (allow) WAF rules. - Mode FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRuleMode `json:"mode,required"` + Mode FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleMode `json:"mode,required"` // The unique identifier of a WAF package. PackageID string `json:"package_id,required"` // The order in which the individual WAF rule is executed within its rule group. - Priority string `json:"priority,required"` - JSON firewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRuleJSON `json:"-"` + Priority string `json:"priority,required"` + JSON firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleJSON `json:"-"` } -// firewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRuleJSON +// firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleJSON // contains the JSON metadata for the struct -// [FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRule] -type firewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRuleJSON struct { +// [FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRule] +type firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleJSON struct { ID apijson.Field AllowedModes apijson.Field Description apijson.Field @@ -646,52 +637,136 @@ type firewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditiona ExtraFields map[string]apijson.Field } -func (r *FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRule) UnmarshalJSON(data []byte) (err error) { +func (r *FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRule) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRule) implementsFirewallWAFPackageRuleWAFRulesListWAFRulesResponse() { +func (r FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRule) implementsFirewallWAFPackageRuleEditResponse() { } // When set to `on`, the current rule will be used when evaluating the request. // Applies to traditional (allow) WAF rules. -type FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRuleAllowedMode string +type FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleAllowedMode string const ( - FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRuleAllowedModeOn FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRuleAllowedMode = "on" - FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRuleAllowedModeOff FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRuleAllowedMode = "off" + FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleAllowedModeOn FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleAllowedMode = "on" + FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleAllowedModeOff FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleAllowedMode = "off" ) // The rule group to which the current WAF rule belongs. -type FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRuleGroup struct { +type FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleGroup struct { // The unique identifier of the rule group. ID string `json:"id"` // The name of the rule group. - Name string `json:"name"` - JSON firewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRuleGroupJSON `json:"-"` + Name string `json:"name"` + JSON firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleGroupJSON `json:"-"` } -// firewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRuleGroupJSON +// firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleGroupJSON // contains the JSON metadata for the struct -// [FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRuleGroup] -type firewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRuleGroupJSON struct { +// [FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleGroup] +type firewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleGroupJSON struct { ID apijson.Field Name apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRuleGroup) UnmarshalJSON(data []byte) (err error) { +func (r *FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleGroup) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // When set to `on`, the current rule will be used when evaluating the request. // Applies to traditional (allow) WAF rules. -type FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRuleMode string +type FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleMode string + +const ( + FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleModeOn FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleMode = "on" + FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleModeOff FirewallWAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleMode = "off" +) + +// Union satisfied by [FirewallWAFPackageRuleGetResponseUnknown], +// [FirewallWAFPackageRuleGetResponseArray] or [shared.UnionString]. +type FirewallWAFPackageRuleGetResponse interface { + ImplementsFirewallWAFPackageRuleGetResponse() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*FirewallWAFPackageRuleGetResponse)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type FirewallWAFPackageRuleGetResponseArray []interface{} + +func (r FirewallWAFPackageRuleGetResponseArray) ImplementsFirewallWAFPackageRuleGetResponse() {} + +type FirewallWAFPackageRuleListParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // The direction used to sort returned rules. + Direction param.Field[FirewallWAFPackageRuleListParamsDirection] `query:"direction"` + // When set to `all`, all the search requirements must match. When set to `any`, + // only one of the search requirements has to match. + Match param.Field[FirewallWAFPackageRuleListParamsMatch] `query:"match"` + // The action/mode a rule has been overridden to perform. + Mode param.Field[FirewallWAFPackageRuleListParamsMode] `query:"mode"` + // The field used to sort returned rules. + Order param.Field[FirewallWAFPackageRuleListParamsOrder] `query:"order"` + // The page number of paginated results. + Page param.Field[float64] `query:"page"` + // The number of rules per page. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes [FirewallWAFPackageRuleListParams]'s query parameters as +// `url.Values`. +func (r FirewallWAFPackageRuleListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// The direction used to sort returned rules. +type FirewallWAFPackageRuleListParamsDirection string + +const ( + FirewallWAFPackageRuleListParamsDirectionAsc FirewallWAFPackageRuleListParamsDirection = "asc" + FirewallWAFPackageRuleListParamsDirectionDesc FirewallWAFPackageRuleListParamsDirection = "desc" +) + +// When set to `all`, all the search requirements must match. When set to `any`, +// only one of the search requirements has to match. +type FirewallWAFPackageRuleListParamsMatch string + +const ( + FirewallWAFPackageRuleListParamsMatchAny FirewallWAFPackageRuleListParamsMatch = "any" + FirewallWAFPackageRuleListParamsMatchAll FirewallWAFPackageRuleListParamsMatch = "all" +) + +// The action/mode a rule has been overridden to perform. +type FirewallWAFPackageRuleListParamsMode string const ( - FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRuleModeOn FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRuleMode = "on" - FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRuleModeOff FirewallWAFPackageRuleWAFRulesListWAFRulesResponseWAFManagedRulesTraditionalAllowRuleMode = "off" + FirewallWAFPackageRuleListParamsModeDis FirewallWAFPackageRuleListParamsMode = "DIS" + FirewallWAFPackageRuleListParamsModeChl FirewallWAFPackageRuleListParamsMode = "CHL" + FirewallWAFPackageRuleListParamsModeBlk FirewallWAFPackageRuleListParamsMode = "BLK" + FirewallWAFPackageRuleListParamsModeSim FirewallWAFPackageRuleListParamsMode = "SIM" +) + +// The field used to sort returned rules. +type FirewallWAFPackageRuleListParamsOrder string + +const ( + FirewallWAFPackageRuleListParamsOrderPriority FirewallWAFPackageRuleListParamsOrder = "priority" + FirewallWAFPackageRuleListParamsOrderGroupID FirewallWAFPackageRuleListParamsOrder = "group_id" + FirewallWAFPackageRuleListParamsOrderDescription FirewallWAFPackageRuleListParamsOrder = "description" ) type FirewallWAFPackageRuleEditParams struct { @@ -866,168 +941,3 @@ type FirewallWAFPackageRuleGetResponseEnvelopeSuccess bool const ( FirewallWAFPackageRuleGetResponseEnvelopeSuccessTrue FirewallWAFPackageRuleGetResponseEnvelopeSuccess = true ) - -type FirewallWAFPackageRuleWAFRulesListWAFRulesParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // The direction used to sort returned rules. - Direction param.Field[FirewallWAFPackageRuleWAFRulesListWAFRulesParamsDirection] `query:"direction"` - // When set to `all`, all the search requirements must match. When set to `any`, - // only one of the search requirements has to match. - Match param.Field[FirewallWAFPackageRuleWAFRulesListWAFRulesParamsMatch] `query:"match"` - // The action/mode a rule has been overridden to perform. - Mode param.Field[FirewallWAFPackageRuleWAFRulesListWAFRulesParamsMode] `query:"mode"` - // The field used to sort returned rules. - Order param.Field[FirewallWAFPackageRuleWAFRulesListWAFRulesParamsOrder] `query:"order"` - // The page number of paginated results. - Page param.Field[float64] `query:"page"` - // The number of rules per page. - PerPage param.Field[float64] `query:"per_page"` -} - -// URLQuery serializes [FirewallWAFPackageRuleWAFRulesListWAFRulesParams]'s query -// parameters as `url.Values`. -func (r FirewallWAFPackageRuleWAFRulesListWAFRulesParams) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatComma, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} - -// The direction used to sort returned rules. -type FirewallWAFPackageRuleWAFRulesListWAFRulesParamsDirection string - -const ( - FirewallWAFPackageRuleWAFRulesListWAFRulesParamsDirectionAsc FirewallWAFPackageRuleWAFRulesListWAFRulesParamsDirection = "asc" - FirewallWAFPackageRuleWAFRulesListWAFRulesParamsDirectionDesc FirewallWAFPackageRuleWAFRulesListWAFRulesParamsDirection = "desc" -) - -// When set to `all`, all the search requirements must match. When set to `any`, -// only one of the search requirements has to match. -type FirewallWAFPackageRuleWAFRulesListWAFRulesParamsMatch string - -const ( - FirewallWAFPackageRuleWAFRulesListWAFRulesParamsMatchAny FirewallWAFPackageRuleWAFRulesListWAFRulesParamsMatch = "any" - FirewallWAFPackageRuleWAFRulesListWAFRulesParamsMatchAll FirewallWAFPackageRuleWAFRulesListWAFRulesParamsMatch = "all" -) - -// The action/mode a rule has been overridden to perform. -type FirewallWAFPackageRuleWAFRulesListWAFRulesParamsMode string - -const ( - FirewallWAFPackageRuleWAFRulesListWAFRulesParamsModeDis FirewallWAFPackageRuleWAFRulesListWAFRulesParamsMode = "DIS" - FirewallWAFPackageRuleWAFRulesListWAFRulesParamsModeChl FirewallWAFPackageRuleWAFRulesListWAFRulesParamsMode = "CHL" - FirewallWAFPackageRuleWAFRulesListWAFRulesParamsModeBlk FirewallWAFPackageRuleWAFRulesListWAFRulesParamsMode = "BLK" - FirewallWAFPackageRuleWAFRulesListWAFRulesParamsModeSim FirewallWAFPackageRuleWAFRulesListWAFRulesParamsMode = "SIM" -) - -// The field used to sort returned rules. -type FirewallWAFPackageRuleWAFRulesListWAFRulesParamsOrder string - -const ( - FirewallWAFPackageRuleWAFRulesListWAFRulesParamsOrderPriority FirewallWAFPackageRuleWAFRulesListWAFRulesParamsOrder = "priority" - FirewallWAFPackageRuleWAFRulesListWAFRulesParamsOrderGroupID FirewallWAFPackageRuleWAFRulesListWAFRulesParamsOrder = "group_id" - FirewallWAFPackageRuleWAFRulesListWAFRulesParamsOrderDescription FirewallWAFPackageRuleWAFRulesListWAFRulesParamsOrder = "description" -) - -type FirewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelope struct { - Errors []FirewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeErrors `json:"errors,required"` - Messages []FirewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeMessages `json:"messages,required"` - Result []FirewallWAFPackageRuleWAFRulesListWAFRulesResponse `json:"result,required,nullable"` - // Whether the API call was successful - Success FirewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeSuccess `json:"success,required"` - ResultInfo FirewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeResultInfo `json:"result_info"` - JSON firewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeJSON `json:"-"` -} - -// firewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeJSON contains the JSON -// metadata for the struct -// [FirewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelope] -type firewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - ResultInfo apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *FirewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type FirewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON firewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeErrorsJSON `json:"-"` -} - -// firewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeErrorsJSON contains -// the JSON metadata for the struct -// [FirewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeErrors] -type firewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *FirewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type FirewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON firewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeMessagesJSON `json:"-"` -} - -// firewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeMessagesJSON contains -// the JSON metadata for the struct -// [FirewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeMessages] -type firewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *FirewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type FirewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeSuccess bool - -const ( - FirewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeSuccessTrue FirewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeSuccess = true -) - -type FirewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeResultInfo struct { - // Total number of results for the requested service - Count float64 `json:"count"` - // Current page within paginated list of results - Page float64 `json:"page"` - // Number of results per page of results - PerPage float64 `json:"per_page"` - // Total results available without any search parameters - TotalCount float64 `json:"total_count"` - JSON firewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeResultInfoJSON `json:"-"` -} - -// firewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeResultInfoJSON -// contains the JSON metadata for the struct -// [FirewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeResultInfo] -type firewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeResultInfoJSON struct { - Count apijson.Field - Page apijson.Field - PerPage apijson.Field - TotalCount apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *FirewallWAFPackageRuleWAFRulesListWAFRulesResponseEnvelopeResultInfo) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/firewallwafpackagerule_test.go b/firewallwafpackagerule_test.go index fc06165958f..b46c8221aef 100644 --- a/firewallwafpackagerule_test.go +++ b/firewallwafpackagerule_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestFirewallWAFPackageRuleEditWithOptionalParams(t *testing.T) { +func TestFirewallWAFPackageRuleListWithOptionalParams(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 { @@ -29,13 +29,17 @@ func TestFirewallWAFPackageRuleEditWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.WAF.Packages.Rules.Edit( + _, err := client.Firewall.WAF.Packages.Rules.List( context.TODO(), "a25a9a7e9c00afc1fb2e0245519d725b", - "a25a9a7e9c00afc1fb2e0245519d725b", - cloudflare.FirewallWAFPackageRuleEditParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Mode: cloudflare.F(cloudflare.FirewallWAFPackageRuleEditParamsModeOn), + cloudflare.FirewallWAFPackageRuleListParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Direction: cloudflare.F(cloudflare.FirewallWAFPackageRuleListParamsDirectionDesc), + Match: cloudflare.F(cloudflare.FirewallWAFPackageRuleListParamsMatchAny), + Mode: cloudflare.F(cloudflare.FirewallWAFPackageRuleListParamsModeChl), + Order: cloudflare.F(cloudflare.FirewallWAFPackageRuleListParamsOrderPriority), + Page: cloudflare.F(1.000000), + PerPage: cloudflare.F(5.000000), }, ) if err != nil { @@ -47,7 +51,7 @@ func TestFirewallWAFPackageRuleEditWithOptionalParams(t *testing.T) { } } -func TestFirewallWAFPackageRuleGet(t *testing.T) { +func TestFirewallWAFPackageRuleEditWithOptionalParams(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 { @@ -63,12 +67,13 @@ func TestFirewallWAFPackageRuleGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.WAF.Packages.Rules.Get( + _, err := client.Firewall.WAF.Packages.Rules.Edit( context.TODO(), "a25a9a7e9c00afc1fb2e0245519d725b", "a25a9a7e9c00afc1fb2e0245519d725b", - cloudflare.FirewallWAFPackageRuleGetParams{ + cloudflare.FirewallWAFPackageRuleEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Mode: cloudflare.F(cloudflare.FirewallWAFPackageRuleEditParamsModeOn), }, ) if err != nil { @@ -80,7 +85,7 @@ func TestFirewallWAFPackageRuleGet(t *testing.T) { } } -func TestFirewallWAFPackageRuleWAFRulesListWAFRulesWithOptionalParams(t *testing.T) { +func TestFirewallWAFPackageRuleGet(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 { @@ -96,17 +101,12 @@ func TestFirewallWAFPackageRuleWAFRulesListWAFRulesWithOptionalParams(t *testing option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Firewalls.WAF.Packages.Rules.WAFRulesListWAFRules( + _, err := client.Firewall.WAF.Packages.Rules.Get( context.TODO(), "a25a9a7e9c00afc1fb2e0245519d725b", - cloudflare.FirewallWAFPackageRuleWAFRulesListWAFRulesParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Direction: cloudflare.F(cloudflare.FirewallWAFPackageRuleWAFRulesListWAFRulesParamsDirectionDesc), - Match: cloudflare.F(cloudflare.FirewallWAFPackageRuleWAFRulesListWAFRulesParamsMatchAny), - Mode: cloudflare.F(cloudflare.FirewallWAFPackageRuleWAFRulesListWAFRulesParamsModeChl), - Order: cloudflare.F(cloudflare.FirewallWAFPackageRuleWAFRulesListWAFRulesParamsOrderPriority), - Page: cloudflare.F(1.000000), - PerPage: cloudflare.F(5.000000), + "a25a9a7e9c00afc1fb2e0245519d725b", + cloudflare.FirewallWAFPackageRuleGetParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { diff --git a/image.go b/image.go index 45d2ee45045..55046d3f860 100644 --- a/image.go +++ b/image.go @@ -12,8 +12,8 @@ import ( // directly, and instead use the [NewImageService] method instead. type ImageService struct { Options []option.RequestOption - V1s *ImageV1Service - V2s *ImageV2Service + V1 *ImageV1Service + V2 *ImageV2Service } // NewImageService generates a new service that applies the given options to each @@ -22,7 +22,7 @@ type ImageService struct { func NewImageService(opts ...option.RequestOption) (r *ImageService) { r = &ImageService{} r.Options = opts - r.V1s = NewImageV1Service(opts...) - r.V2s = NewImageV2Service(opts...) + r.V1 = NewImageV1Service(opts...) + r.V2 = NewImageV2Service(opts...) return } diff --git a/imagev1_test.go b/imagev1_test.go index 70af58f5b3d..529516a21a7 100644 --- a/imagev1_test.go +++ b/imagev1_test.go @@ -29,7 +29,7 @@ func TestImageV1NewWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Images.V1s.New(context.TODO(), cloudflare.ImageV1NewParams{ + _, err := client.Images.V1.New(context.TODO(), cloudflare.ImageV1NewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Metadata: cloudflare.F[any](map[string]interface{}{}), RequireSignedURLs: cloudflare.F(true), @@ -59,7 +59,7 @@ func TestImageV1ListWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Images.V1s.List(context.TODO(), cloudflare.ImageV1ListParams{ + _, err := client.Images.V1.List(context.TODO(), cloudflare.ImageV1ListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Page: cloudflare.F(1.000000), PerPage: cloudflare.F(10.000000), @@ -89,7 +89,7 @@ func TestImageV1Delete(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Images.V1s.Delete( + _, err := client.Images.V1.Delete( context.TODO(), "string", cloudflare.ImageV1DeleteParams{ @@ -121,7 +121,7 @@ func TestImageV1EditWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Images.V1s.Edit( + _, err := client.Images.V1.Edit( context.TODO(), "string", cloudflare.ImageV1EditParams{ @@ -155,7 +155,7 @@ func TestImageV1Get(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Images.V1s.Get( + _, err := client.Images.V1.Get( context.TODO(), "string", cloudflare.ImageV1GetParams{ diff --git a/imagev1blob_test.go b/imagev1blob_test.go index 2c2c38a7146..843743adb9a 100644 --- a/imagev1blob_test.go +++ b/imagev1blob_test.go @@ -30,7 +30,7 @@ func TestImageV1BlobGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - resp, err := client.Images.V1s.Blobs.Get( + resp, err := client.Images.V1.Blobs.Get( context.TODO(), "string", cloudflare.ImageV1BlobGetParams{ diff --git a/imagev1key_test.go b/imagev1key_test.go index 78f4e0b6d7a..047071adb7e 100644 --- a/imagev1key_test.go +++ b/imagev1key_test.go @@ -29,7 +29,7 @@ func TestImageV1KeyList(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Images.V1s.Keys.List(context.TODO(), cloudflare.ImageV1KeyListParams{ + _, err := client.Images.V1.Keys.List(context.TODO(), cloudflare.ImageV1KeyListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/imagev1stat_test.go b/imagev1stat_test.go index b441081c7b5..cf12f9cef33 100644 --- a/imagev1stat_test.go +++ b/imagev1stat_test.go @@ -29,7 +29,7 @@ func TestImageV1StatGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Images.V1s.Stats.Get(context.TODO(), cloudflare.ImageV1StatGetParams{ + _, err := client.Images.V1.Stats.Get(context.TODO(), cloudflare.ImageV1StatGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/imagev1variant_test.go b/imagev1variant_test.go index d76e70bddcb..aafe6eefa79 100644 --- a/imagev1variant_test.go +++ b/imagev1variant_test.go @@ -29,7 +29,7 @@ func TestImageV1VariantNewWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Images.V1s.Variants.New(context.TODO(), cloudflare.ImageV1VariantNewParams{ + _, err := client.Images.V1.Variants.New(context.TODO(), cloudflare.ImageV1VariantNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), ID: cloudflare.F[any]("hero"), Options: cloudflare.F(cloudflare.ImageV1VariantNewParamsOptions{ @@ -65,7 +65,7 @@ func TestImageV1VariantList(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Images.V1s.Variants.List(context.TODO(), cloudflare.ImageV1VariantListParams{ + _, err := client.Images.V1.Variants.List(context.TODO(), cloudflare.ImageV1VariantListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { @@ -93,7 +93,7 @@ func TestImageV1VariantDelete(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Images.V1s.Variants.Delete( + _, err := client.Images.V1.Variants.Delete( context.TODO(), "hero", cloudflare.ImageV1VariantDeleteParams{ @@ -125,7 +125,7 @@ func TestImageV1VariantEditWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Images.V1s.Variants.Edit( + _, err := client.Images.V1.Variants.Edit( context.TODO(), "hero", cloudflare.ImageV1VariantEditParams{ @@ -164,7 +164,7 @@ func TestImageV1VariantGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Images.V1s.Variants.Get( + _, err := client.Images.V1.Variants.Get( context.TODO(), "hero", cloudflare.ImageV1VariantGetParams{ diff --git a/imagev2_test.go b/imagev2_test.go index 5e121c097bd..a0e35f4dcae 100644 --- a/imagev2_test.go +++ b/imagev2_test.go @@ -29,7 +29,7 @@ func TestImageV2ListWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Images.V2s.List(context.TODO(), cloudflare.ImageV2ListParams{ + _, err := client.Images.V2.List(context.TODO(), cloudflare.ImageV2ListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), ContinuationToken: cloudflare.F("string"), PerPage: cloudflare.F(10.000000), diff --git a/imagev2directupload_test.go b/imagev2directupload_test.go index c9b59ed245b..d83f7ed75fc 100644 --- a/imagev2directupload_test.go +++ b/imagev2directupload_test.go @@ -30,7 +30,7 @@ func TestImageV2DirectUploadNewWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Images.V2s.DirectUploads.New(context.TODO(), cloudflare.ImageV2DirectUploadNewParams{ + _, err := client.Images.V2.DirectUploads.New(context.TODO(), cloudflare.ImageV2DirectUploadNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Expiry: cloudflare.F(time.Now()), Metadata: cloudflare.F[any](map[string]interface{}{}), diff --git a/internal/shared/union.go b/internal/shared/union.go index 9177decd836..7424a4fd41a 100644 --- a/internal/shared/union.go +++ b/internal/shared/union.go @@ -24,6 +24,7 @@ func (UnionString) ImplementsUserTokenUpdateResponse() func (UnionString) ImplementsUserTokenGetResponse() {} func (UnionString) ImplementsZoneCustomNameserverUpdateResponse() {} func (UnionString) ImplementsZoneCustomNameserverGetResponse() {} +func (UnionString) ImplementsZoneWorkerScriptUpdateResponse() {} func (UnionString) ImplementsLoadBalancerPoolHealthGetResponse() {} func (UnionString) ImplementsLoadBalancerRegionListResponse() {} func (UnionString) ImplementsLoadBalancerRegionGetResponse() {} @@ -101,7 +102,12 @@ func (UnionString) ImplementsWorkerRouteNewResponse() func (UnionString) ImplementsWorkerRouteDeleteResponse() {} func (UnionString) ImplementsWorkerQueueDeleteResponse() {} func (UnionString) ImplementsWorkerQueueConsumerDeleteResponse() {} -func (UnionString) ImplementsWorkerScriptUpdateResponse() {} +func (UnionString) ImplementsKVNamespaceUpdateResponse() {} +func (UnionString) ImplementsKVNamespaceDeleteResponse() {} +func (UnionString) ImplementsKVNamespaceBulkUpdateResponse() {} +func (UnionString) ImplementsKVNamespaceBulkDeleteResponse() {} +func (UnionString) ImplementsKVNamespaceValueUpdateResponse() {} +func (UnionString) ImplementsKVNamespaceValueDeleteResponse() {} func (UnionString) ImplementsSpectrumAnalyticsEventBytimeGetResponse() {} func (UnionString) ImplementsSpectrumAnalyticsEventSummaryGetResponse() {} func (UnionString) ImplementsSpectrumAppNewResponseOriginPort() {} @@ -117,6 +123,7 @@ func (UnionString) ImplementsAddressAddressMapIPDeleteResponse() func (UnionString) ImplementsAddressAddressMapZoneUpdateResponse() {} func (UnionString) ImplementsAddressAddressMapZoneDeleteResponse() {} func (UnionString) ImplementsAddressPrefixDeleteResponse() {} +func (UnionString) ImplementsAddressPrefixBGPBindingDeleteResponse() {} func (UnionString) ImplementsAuditLogListResponse() {} func (UnionString) ImplementsBillingProfileGetResponse() {} func (UnionString) ImplementsTunnelConfigurationUpdateResponse() {} @@ -144,12 +151,6 @@ func (UnionString) ImplementsRegistrarDomainUpdateResponse() func (UnionString) ImplementsRegistrarDomainGetResponse() {} func (UnionString) ImplementsRoleGetResponse() {} func (UnionString) ImplementsRuleListItemGetResponse() {} -func (UnionString) ImplementsStorageKVNamespaceUpdateResponse() {} -func (UnionString) ImplementsStorageKVNamespaceDeleteResponse() {} -func (UnionString) ImplementsStorageKVNamespaceBulkUpdateResponse() {} -func (UnionString) ImplementsStorageKVNamespaceBulkDeleteResponse() {} -func (UnionString) ImplementsStorageKVNamespaceValueUpdateResponse() {} -func (UnionString) ImplementsStorageKVNamespaceValueDeleteResponse() {} func (UnionString) ImplementsStreamAudioTrackDeleteResponse() {} func (UnionString) ImplementsStreamKeyDeleteResponse() {} func (UnionString) ImplementsStreamWatermarkNewResponse() {} @@ -163,9 +164,6 @@ func (UnionString) ImplementsStreamCaptionDeleteResponse() func (UnionString) ImplementsStreamDownloadNewResponse() {} func (UnionString) ImplementsStreamDownloadListResponse() {} func (UnionString) ImplementsStreamDownloadDeleteResponse() {} -func (UnionString) ImplementsTeamnetVirtualNetworkNewResponse() {} -func (UnionString) ImplementsTeamnetVirtualNetworkDeleteResponse() {} -func (UnionString) ImplementsTeamnetVirtualNetworkEditResponse() {} func (UnionString) ImplementsGatewayListDeleteResponse() {} func (UnionString) ImplementsGatewayLocationDeleteResponse() {} func (UnionString) ImplementsGatewayProxyEndpointDeleteResponse() {} @@ -184,8 +182,10 @@ func (UnionString) ImplementsDevicePostureIntegrationDeleteResponse() func (UnionString) ImplementsDeviceRevokeNewResponse() {} func (UnionString) ImplementsDeviceUnrevokeNewResponse() {} func (UnionString) ImplementsD1DatabaseDeleteResponse() {} +func (UnionString) ImplementsTeamnetVirtualNetworkNewResponse() {} +func (UnionString) ImplementsTeamnetVirtualNetworkDeleteResponse() {} +func (UnionString) ImplementsTeamnetVirtualNetworkEditResponse() {} func (UnionString) ImplementsWARPConnectorTokenResponse() {} -func (UnionString) ImplementsAddressingPrefixBindingDeleteResponse() {} func (UnionString) ImplementsHyperdriveConfigDeleteResponse() {} func (UnionString) ImplementsVectorizeIndexDeleteResponse() {} func (UnionString) ImplementsRadarRankingTimeseriesGroupsResponseSerie0() {} diff --git a/kv.go b/kv.go new file mode 100644 index 00000000000..a5933a219b2 --- /dev/null +++ b/kv.go @@ -0,0 +1,26 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// KVService contains methods and other services that help with interacting with +// the cloudflare API. Note, unlike clients, this service does not read variables +// from the environment automatically. You should not instantiate this service +// directly, and instead use the [NewKVService] method instead. +type KVService struct { + Options []option.RequestOption + Namespaces *KVNamespaceService +} + +// NewKVService generates a new service that applies the given options to each +// request. These options are applied after the parent client's options (if there +// is one), and before any request-specific options. +func NewKVService(opts ...option.RequestOption) (r *KVService) { + r = &KVService{} + r.Options = opts + r.Namespaces = NewKVNamespaceService(opts...) + return +} diff --git a/kvnamespace.go b/kvnamespace.go new file mode 100644 index 00000000000..53396ea553e --- /dev/null +++ b/kvnamespace.go @@ -0,0 +1,462 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// KVNamespaceService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewKVNamespaceService] method +// instead. +type KVNamespaceService struct { + Options []option.RequestOption + Bulk *KVNamespaceBulkService + Keys *KVNamespaceKeyService + Metadata *KVNamespaceMetadataService + Values *KVNamespaceValueService +} + +// NewKVNamespaceService generates a new service that applies the given options to +// each request. These options are applied after the parent client's options (if +// there is one), and before any request-specific options. +func NewKVNamespaceService(opts ...option.RequestOption) (r *KVNamespaceService) { + r = &KVNamespaceService{} + r.Options = opts + r.Bulk = NewKVNamespaceBulkService(opts...) + r.Keys = NewKVNamespaceKeyService(opts...) + r.Metadata = NewKVNamespaceMetadataService(opts...) + r.Values = NewKVNamespaceValueService(opts...) + return +} + +// Creates a namespace under the given title. A `400` is returned if the account +// already owns a namespace with this title. A namespace must be explicitly deleted +// to be replaced. +func (r *KVNamespaceService) New(ctx context.Context, params KVNamespaceNewParams, opts ...option.RequestOption) (res *KVNamespaceNewResponse, err error) { + opts = append(r.Options[:], opts...) + var env KVNamespaceNewResponseEnvelope + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces", params.AccountID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Modifies a namespace's title. +func (r *KVNamespaceService) Update(ctx context.Context, namespaceID string, params KVNamespaceUpdateParams, opts ...option.RequestOption) (res *KVNamespaceUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + var env KVNamespaceUpdateResponseEnvelope + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s", params.AccountID, namespaceID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Returns the namespaces owned by an account. +func (r *KVNamespaceService) List(ctx context.Context, params KVNamespaceListParams, opts ...option.RequestOption) (res *shared.V4PagePaginationArray[KVNamespaceListResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces", params.AccountID) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, params, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +// Returns the namespaces owned by an account. +func (r *KVNamespaceService) ListAutoPaging(ctx context.Context, params KVNamespaceListParams, opts ...option.RequestOption) *shared.V4PagePaginationArrayAutoPager[KVNamespaceListResponse] { + return shared.NewV4PagePaginationArrayAutoPager(r.List(ctx, params, opts...)) +} + +// Deletes the namespace corresponding to the given ID. +func (r *KVNamespaceService) Delete(ctx context.Context, namespaceID string, body KVNamespaceDeleteParams, opts ...option.RequestOption) (res *KVNamespaceDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + var env KVNamespaceDeleteResponseEnvelope + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s", body.AccountID, namespaceID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +type KVNamespaceNewResponse struct { + // Namespace identifier tag. + ID string `json:"id,required"` + // A human-readable string name for a Namespace. + Title string `json:"title,required"` + // True if keys written on the URL will be URL-decoded before storing. For example, + // if set to "true", a key written on the URL as "%3F" will be stored as "?". + SupportsURLEncoding bool `json:"supports_url_encoding"` + JSON kvNamespaceNewResponseJSON `json:"-"` +} + +// kvNamespaceNewResponseJSON contains the JSON metadata for the struct +// [KVNamespaceNewResponse] +type kvNamespaceNewResponseJSON struct { + ID apijson.Field + Title apijson.Field + SupportsURLEncoding apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by [KVNamespaceUpdateResponseUnknown] or [shared.UnionString]. +type KVNamespaceUpdateResponse interface { + ImplementsKVNamespaceUpdateResponse() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*KVNamespaceUpdateResponse)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type KVNamespaceListResponse struct { + // Namespace identifier tag. + ID string `json:"id,required"` + // A human-readable string name for a Namespace. + Title string `json:"title,required"` + // True if keys written on the URL will be URL-decoded before storing. For example, + // if set to "true", a key written on the URL as "%3F" will be stored as "?". + SupportsURLEncoding bool `json:"supports_url_encoding"` + JSON kvNamespaceListResponseJSON `json:"-"` +} + +// kvNamespaceListResponseJSON contains the JSON metadata for the struct +// [KVNamespaceListResponse] +type kvNamespaceListResponseJSON struct { + ID apijson.Field + Title apijson.Field + SupportsURLEncoding apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Union satisfied by [KVNamespaceDeleteResponseUnknown] or [shared.UnionString]. +type KVNamespaceDeleteResponse interface { + ImplementsKVNamespaceDeleteResponse() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*KVNamespaceDeleteResponse)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type KVNamespaceNewParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` + // A human-readable string name for a Namespace. + Title param.Field[string] `json:"title,required"` +} + +func (r KVNamespaceNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type KVNamespaceNewResponseEnvelope struct { + Errors []KVNamespaceNewResponseEnvelopeErrors `json:"errors,required"` + Messages []KVNamespaceNewResponseEnvelopeMessages `json:"messages,required"` + Result KVNamespaceNewResponse `json:"result,required"` + // Whether the API call was successful + Success KVNamespaceNewResponseEnvelopeSuccess `json:"success,required"` + JSON kvNamespaceNewResponseEnvelopeJSON `json:"-"` +} + +// kvNamespaceNewResponseEnvelopeJSON contains the JSON metadata for the struct +// [KVNamespaceNewResponseEnvelope] +type kvNamespaceNewResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type KVNamespaceNewResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON kvNamespaceNewResponseEnvelopeErrorsJSON `json:"-"` +} + +// kvNamespaceNewResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [KVNamespaceNewResponseEnvelopeErrors] +type kvNamespaceNewResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type KVNamespaceNewResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON kvNamespaceNewResponseEnvelopeMessagesJSON `json:"-"` +} + +// kvNamespaceNewResponseEnvelopeMessagesJSON contains the JSON metadata for the +// struct [KVNamespaceNewResponseEnvelopeMessages] +type kvNamespaceNewResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type KVNamespaceNewResponseEnvelopeSuccess bool + +const ( + KVNamespaceNewResponseEnvelopeSuccessTrue KVNamespaceNewResponseEnvelopeSuccess = true +) + +type KVNamespaceUpdateParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` + // A human-readable string name for a Namespace. + Title param.Field[string] `json:"title,required"` +} + +func (r KVNamespaceUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type KVNamespaceUpdateResponseEnvelope struct { + Errors []KVNamespaceUpdateResponseEnvelopeErrors `json:"errors,required"` + Messages []KVNamespaceUpdateResponseEnvelopeMessages `json:"messages,required"` + Result KVNamespaceUpdateResponse `json:"result,required"` + // Whether the API call was successful + Success KVNamespaceUpdateResponseEnvelopeSuccess `json:"success,required"` + JSON kvNamespaceUpdateResponseEnvelopeJSON `json:"-"` +} + +// kvNamespaceUpdateResponseEnvelopeJSON contains the JSON metadata for the struct +// [KVNamespaceUpdateResponseEnvelope] +type kvNamespaceUpdateResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type KVNamespaceUpdateResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON kvNamespaceUpdateResponseEnvelopeErrorsJSON `json:"-"` +} + +// kvNamespaceUpdateResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [KVNamespaceUpdateResponseEnvelopeErrors] +type kvNamespaceUpdateResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type KVNamespaceUpdateResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON kvNamespaceUpdateResponseEnvelopeMessagesJSON `json:"-"` +} + +// kvNamespaceUpdateResponseEnvelopeMessagesJSON contains the JSON metadata for the +// struct [KVNamespaceUpdateResponseEnvelopeMessages] +type kvNamespaceUpdateResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type KVNamespaceUpdateResponseEnvelopeSuccess bool + +const ( + KVNamespaceUpdateResponseEnvelopeSuccessTrue KVNamespaceUpdateResponseEnvelopeSuccess = true +) + +type KVNamespaceListParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` + // Direction to order namespaces. + Direction param.Field[KVNamespaceListParamsDirection] `query:"direction"` + // Field to order results by. + Order param.Field[KVNamespaceListParamsOrder] `query:"order"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Maximum number of results per page. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes [KVNamespaceListParams]'s query parameters as `url.Values`. +func (r KVNamespaceListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Direction to order namespaces. +type KVNamespaceListParamsDirection string + +const ( + KVNamespaceListParamsDirectionAsc KVNamespaceListParamsDirection = "asc" + KVNamespaceListParamsDirectionDesc KVNamespaceListParamsDirection = "desc" +) + +// Field to order results by. +type KVNamespaceListParamsOrder string + +const ( + KVNamespaceListParamsOrderID KVNamespaceListParamsOrder = "id" + KVNamespaceListParamsOrderTitle KVNamespaceListParamsOrder = "title" +) + +type KVNamespaceDeleteParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` +} + +type KVNamespaceDeleteResponseEnvelope struct { + Errors []KVNamespaceDeleteResponseEnvelopeErrors `json:"errors,required"` + Messages []KVNamespaceDeleteResponseEnvelopeMessages `json:"messages,required"` + Result KVNamespaceDeleteResponse `json:"result,required"` + // Whether the API call was successful + Success KVNamespaceDeleteResponseEnvelopeSuccess `json:"success,required"` + JSON kvNamespaceDeleteResponseEnvelopeJSON `json:"-"` +} + +// kvNamespaceDeleteResponseEnvelopeJSON contains the JSON metadata for the struct +// [KVNamespaceDeleteResponseEnvelope] +type kvNamespaceDeleteResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type KVNamespaceDeleteResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON kvNamespaceDeleteResponseEnvelopeErrorsJSON `json:"-"` +} + +// kvNamespaceDeleteResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [KVNamespaceDeleteResponseEnvelopeErrors] +type kvNamespaceDeleteResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type KVNamespaceDeleteResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON kvNamespaceDeleteResponseEnvelopeMessagesJSON `json:"-"` +} + +// kvNamespaceDeleteResponseEnvelopeMessagesJSON contains the JSON metadata for the +// struct [KVNamespaceDeleteResponseEnvelopeMessages] +type kvNamespaceDeleteResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type KVNamespaceDeleteResponseEnvelopeSuccess bool + +const ( + KVNamespaceDeleteResponseEnvelopeSuccessTrue KVNamespaceDeleteResponseEnvelopeSuccess = true +) diff --git a/storagekvnamespace_test.go b/kvnamespace_test.go similarity index 84% rename from storagekvnamespace_test.go rename to kvnamespace_test.go index b76fd146615..24da856eda0 100644 --- a/storagekvnamespace_test.go +++ b/kvnamespace_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestStorageKVNamespaceNew(t *testing.T) { +func TestKVNamespaceNew(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 { @@ -29,7 +29,7 @@ func TestStorageKVNamespaceNew(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Storage.KV.Namespaces.New(context.TODO(), cloudflare.StorageKVNamespaceNewParams{ + _, err := client.KV.Namespaces.New(context.TODO(), cloudflare.KVNamespaceNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Title: cloudflare.F("My Own Namespace"), }) @@ -42,7 +42,7 @@ func TestStorageKVNamespaceNew(t *testing.T) { } } -func TestStorageKVNamespaceUpdate(t *testing.T) { +func TestKVNamespaceUpdate(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 { @@ -58,10 +58,10 @@ func TestStorageKVNamespaceUpdate(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Storage.KV.Namespaces.Update( + _, err := client.KV.Namespaces.Update( context.TODO(), "0f2ac74b498b48028cb68387c421e279", - cloudflare.StorageKVNamespaceUpdateParams{ + cloudflare.KVNamespaceUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Title: cloudflare.F("My Own Namespace"), }, @@ -75,7 +75,7 @@ func TestStorageKVNamespaceUpdate(t *testing.T) { } } -func TestStorageKVNamespaceListWithOptionalParams(t *testing.T) { +func TestKVNamespaceListWithOptionalParams(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 { @@ -91,10 +91,10 @@ func TestStorageKVNamespaceListWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Storage.KV.Namespaces.List(context.TODO(), cloudflare.StorageKVNamespaceListParams{ + _, err := client.KV.Namespaces.List(context.TODO(), cloudflare.KVNamespaceListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Direction: cloudflare.F(cloudflare.StorageKVNamespaceListParamsDirectionAsc), - Order: cloudflare.F(cloudflare.StorageKVNamespaceListParamsOrderID), + Direction: cloudflare.F(cloudflare.KVNamespaceListParamsDirectionAsc), + Order: cloudflare.F(cloudflare.KVNamespaceListParamsOrderID), Page: cloudflare.F(1.000000), PerPage: cloudflare.F(5.000000), }) @@ -107,7 +107,7 @@ func TestStorageKVNamespaceListWithOptionalParams(t *testing.T) { } } -func TestStorageKVNamespaceDelete(t *testing.T) { +func TestKVNamespaceDelete(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 { @@ -123,10 +123,10 @@ func TestStorageKVNamespaceDelete(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Storage.KV.Namespaces.Delete( + _, err := client.KV.Namespaces.Delete( context.TODO(), "0f2ac74b498b48028cb68387c421e279", - cloudflare.StorageKVNamespaceDeleteParams{ + cloudflare.KVNamespaceDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) diff --git a/kvnamespacebulk.go b/kvnamespacebulk.go new file mode 100644 index 00000000000..fd4fc8e9dc7 --- /dev/null +++ b/kvnamespacebulk.go @@ -0,0 +1,283 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// KVNamespaceBulkService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewKVNamespaceBulkService] method +// instead. +type KVNamespaceBulkService struct { + Options []option.RequestOption +} + +// NewKVNamespaceBulkService generates a new service that applies the given options +// to each request. These options are applied after the parent client's options (if +// there is one), and before any request-specific options. +func NewKVNamespaceBulkService(opts ...option.RequestOption) (r *KVNamespaceBulkService) { + r = &KVNamespaceBulkService{} + r.Options = opts + return +} + +// Write multiple keys and values at once. Body should be an array of up to 10,000 +// key-value pairs to be stored, along with optional expiration information. +// Existing values and expirations will be overwritten. If neither `expiration` nor +// `expiration_ttl` is specified, the key-value pair will never expire. If both are +// set, `expiration_ttl` is used and `expiration` is ignored. The entire request +// size must be 100 megabytes or less. +func (r *KVNamespaceBulkService) Update(ctx context.Context, namespaceID string, params KVNamespaceBulkUpdateParams, opts ...option.RequestOption) (res *KVNamespaceBulkUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + var env KVNamespaceBulkUpdateResponseEnvelope + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/bulk", params.AccountID, namespaceID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Remove multiple KV pairs from the namespace. Body should be an array of up to +// 10,000 keys to be removed. +func (r *KVNamespaceBulkService) Delete(ctx context.Context, namespaceID string, params KVNamespaceBulkDeleteParams, opts ...option.RequestOption) (res *KVNamespaceBulkDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + var env KVNamespaceBulkDeleteResponseEnvelope + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/bulk", params.AccountID, namespaceID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Union satisfied by [KVNamespaceBulkUpdateResponseUnknown] or +// [shared.UnionString]. +type KVNamespaceBulkUpdateResponse interface { + ImplementsKVNamespaceBulkUpdateResponse() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*KVNamespaceBulkUpdateResponse)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Union satisfied by [KVNamespaceBulkDeleteResponseUnknown] or +// [shared.UnionString]. +type KVNamespaceBulkDeleteResponse interface { + ImplementsKVNamespaceBulkDeleteResponse() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*KVNamespaceBulkDeleteResponse)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type KVNamespaceBulkUpdateParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` + Body param.Field[[]KVNamespaceBulkUpdateParamsBody] `json:"body,required"` +} + +func (r KVNamespaceBulkUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type KVNamespaceBulkUpdateParamsBody struct { + // Whether or not the server should base64 decode the value before storing it. + // Useful for writing values that wouldn't otherwise be valid JSON strings, such as + // images. + Base64 param.Field[bool] `json:"base64"` + // The time, measured in number of seconds since the UNIX epoch, at which the key + // should expire. + Expiration param.Field[float64] `json:"expiration"` + // The number of seconds for which the key should be visible before it expires. At + // least 60. + ExpirationTTL param.Field[float64] `json:"expiration_ttl"` + // A key's name. The name may be at most 512 bytes. All printable, non-whitespace + // characters are valid. + Key param.Field[string] `json:"key"` + // Arbitrary JSON that is associated with a key. + Metadata param.Field[interface{}] `json:"metadata"` + // A UTF-8 encoded string to be stored, up to 25 MiB in length. + Value param.Field[string] `json:"value"` +} + +func (r KVNamespaceBulkUpdateParamsBody) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type KVNamespaceBulkUpdateResponseEnvelope struct { + Errors []KVNamespaceBulkUpdateResponseEnvelopeErrors `json:"errors,required"` + Messages []KVNamespaceBulkUpdateResponseEnvelopeMessages `json:"messages,required"` + Result KVNamespaceBulkUpdateResponse `json:"result,required"` + // Whether the API call was successful + Success KVNamespaceBulkUpdateResponseEnvelopeSuccess `json:"success,required"` + JSON kvNamespaceBulkUpdateResponseEnvelopeJSON `json:"-"` +} + +// kvNamespaceBulkUpdateResponseEnvelopeJSON contains the JSON metadata for the +// struct [KVNamespaceBulkUpdateResponseEnvelope] +type kvNamespaceBulkUpdateResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceBulkUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type KVNamespaceBulkUpdateResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON kvNamespaceBulkUpdateResponseEnvelopeErrorsJSON `json:"-"` +} + +// kvNamespaceBulkUpdateResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [KVNamespaceBulkUpdateResponseEnvelopeErrors] +type kvNamespaceBulkUpdateResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceBulkUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type KVNamespaceBulkUpdateResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON kvNamespaceBulkUpdateResponseEnvelopeMessagesJSON `json:"-"` +} + +// kvNamespaceBulkUpdateResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [KVNamespaceBulkUpdateResponseEnvelopeMessages] +type kvNamespaceBulkUpdateResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceBulkUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type KVNamespaceBulkUpdateResponseEnvelopeSuccess bool + +const ( + KVNamespaceBulkUpdateResponseEnvelopeSuccessTrue KVNamespaceBulkUpdateResponseEnvelopeSuccess = true +) + +type KVNamespaceBulkDeleteParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` + Body param.Field[[]string] `json:"body,required"` +} + +func (r KVNamespaceBulkDeleteParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type KVNamespaceBulkDeleteResponseEnvelope struct { + Errors []KVNamespaceBulkDeleteResponseEnvelopeErrors `json:"errors,required"` + Messages []KVNamespaceBulkDeleteResponseEnvelopeMessages `json:"messages,required"` + Result KVNamespaceBulkDeleteResponse `json:"result,required"` + // Whether the API call was successful + Success KVNamespaceBulkDeleteResponseEnvelopeSuccess `json:"success,required"` + JSON kvNamespaceBulkDeleteResponseEnvelopeJSON `json:"-"` +} + +// kvNamespaceBulkDeleteResponseEnvelopeJSON contains the JSON metadata for the +// struct [KVNamespaceBulkDeleteResponseEnvelope] +type kvNamespaceBulkDeleteResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceBulkDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type KVNamespaceBulkDeleteResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON kvNamespaceBulkDeleteResponseEnvelopeErrorsJSON `json:"-"` +} + +// kvNamespaceBulkDeleteResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [KVNamespaceBulkDeleteResponseEnvelopeErrors] +type kvNamespaceBulkDeleteResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceBulkDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type KVNamespaceBulkDeleteResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON kvNamespaceBulkDeleteResponseEnvelopeMessagesJSON `json:"-"` +} + +// kvNamespaceBulkDeleteResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [KVNamespaceBulkDeleteResponseEnvelopeMessages] +type kvNamespaceBulkDeleteResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceBulkDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type KVNamespaceBulkDeleteResponseEnvelopeSuccess bool + +const ( + KVNamespaceBulkDeleteResponseEnvelopeSuccessTrue KVNamespaceBulkDeleteResponseEnvelopeSuccess = true +) diff --git a/storagekvnamespacebulk_test.go b/kvnamespacebulk_test.go similarity index 89% rename from storagekvnamespacebulk_test.go rename to kvnamespacebulk_test.go index 6e573b8f765..1c5811aefcf 100644 --- a/storagekvnamespacebulk_test.go +++ b/kvnamespacebulk_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestStorageKVNamespaceBulkUpdate(t *testing.T) { +func TestKVNamespaceBulkUpdate(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 { @@ -29,12 +29,12 @@ func TestStorageKVNamespaceBulkUpdate(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Storage.KV.Namespaces.Bulk.Update( + _, err := client.KV.Namespaces.Bulk.Update( context.TODO(), "0f2ac74b498b48028cb68387c421e279", - cloudflare.StorageKVNamespaceBulkUpdateParams{ + cloudflare.KVNamespaceBulkUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: cloudflare.F([]cloudflare.StorageKVNamespaceBulkUpdateParamsBody{{ + Body: cloudflare.F([]cloudflare.KVNamespaceBulkUpdateParamsBody{{ Base64: cloudflare.F(true), Expiration: cloudflare.F(1578435000.000000), ExpirationTTL: cloudflare.F(300.000000), @@ -73,7 +73,7 @@ func TestStorageKVNamespaceBulkUpdate(t *testing.T) { } } -func TestStorageKVNamespaceBulkDelete(t *testing.T) { +func TestKVNamespaceBulkDelete(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 { @@ -89,10 +89,10 @@ func TestStorageKVNamespaceBulkDelete(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Storage.KV.Namespaces.Bulk.Delete( + _, err := client.KV.Namespaces.Bulk.Delete( context.TODO(), "0f2ac74b498b48028cb68387c421e279", - cloudflare.StorageKVNamespaceBulkDeleteParams{ + cloudflare.KVNamespaceBulkDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Body: cloudflare.F([]string{"My-Key", "My-Key", "My-Key"}), }, diff --git a/kvnamespacekey.go b/kvnamespacekey.go new file mode 100644 index 00000000000..d37c66201eb --- /dev/null +++ b/kvnamespacekey.go @@ -0,0 +1,195 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// KVNamespaceKeyService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewKVNamespaceKeyService] method +// instead. +type KVNamespaceKeyService struct { + Options []option.RequestOption +} + +// NewKVNamespaceKeyService generates a new service that applies the given options +// to each request. These options are applied after the parent client's options (if +// there is one), and before any request-specific options. +func NewKVNamespaceKeyService(opts ...option.RequestOption) (r *KVNamespaceKeyService) { + r = &KVNamespaceKeyService{} + r.Options = opts + return +} + +// Lists a namespace's keys. +func (r *KVNamespaceKeyService) List(ctx context.Context, namespaceID string, params KVNamespaceKeyListParams, opts ...option.RequestOption) (res *[]KVNamespaceKeyListResponse, err error) { + opts = append(r.Options[:], opts...) + var env KVNamespaceKeyListResponseEnvelope + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/keys", params.AccountID, namespaceID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// A name for a value. A value stored under a given key may be retrieved via the +// same key. +type KVNamespaceKeyListResponse struct { + // A key's name. The name may be at most 512 bytes. All printable, non-whitespace + // characters are valid. Use percent-encoding to define key names as part of a URL. + Name string `json:"name,required"` + // The time, measured in number of seconds since the UNIX epoch, at which the key + // will expire. This property is omitted for keys that will not expire. + Expiration float64 `json:"expiration"` + // Arbitrary JSON that is associated with a key. + Metadata interface{} `json:"metadata"` + JSON kvNamespaceKeyListResponseJSON `json:"-"` +} + +// kvNamespaceKeyListResponseJSON contains the JSON metadata for the struct +// [KVNamespaceKeyListResponse] +type kvNamespaceKeyListResponseJSON struct { + Name apijson.Field + Expiration apijson.Field + Metadata apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceKeyListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type KVNamespaceKeyListParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` + // Opaque token indicating the position from which to continue when requesting the + // next set of records if the amount of list results was limited by the limit + // parameter. A valid value for the cursor can be obtained from the `cursors` + // object in the `result_info` structure. + Cursor param.Field[string] `query:"cursor"` + // The number of keys to return. The cursor attribute may be used to iterate over + // the next batch of keys if there are more than the limit. + Limit param.Field[float64] `query:"limit"` + // A string prefix used to filter down which keys will be returned. Exact matches + // and any key names that begin with the prefix will be returned. + Prefix param.Field[string] `query:"prefix"` +} + +// URLQuery serializes [KVNamespaceKeyListParams]'s query parameters as +// `url.Values`. +func (r KVNamespaceKeyListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type KVNamespaceKeyListResponseEnvelope struct { + Errors []KVNamespaceKeyListResponseEnvelopeErrors `json:"errors,required"` + Messages []KVNamespaceKeyListResponseEnvelopeMessages `json:"messages,required"` + Result []KVNamespaceKeyListResponse `json:"result,required"` + // Whether the API call was successful + Success KVNamespaceKeyListResponseEnvelopeSuccess `json:"success,required"` + ResultInfo KVNamespaceKeyListResponseEnvelopeResultInfo `json:"result_info"` + JSON kvNamespaceKeyListResponseEnvelopeJSON `json:"-"` +} + +// kvNamespaceKeyListResponseEnvelopeJSON contains the JSON metadata for the struct +// [KVNamespaceKeyListResponseEnvelope] +type kvNamespaceKeyListResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + ResultInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceKeyListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type KVNamespaceKeyListResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON kvNamespaceKeyListResponseEnvelopeErrorsJSON `json:"-"` +} + +// kvNamespaceKeyListResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [KVNamespaceKeyListResponseEnvelopeErrors] +type kvNamespaceKeyListResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceKeyListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type KVNamespaceKeyListResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON kvNamespaceKeyListResponseEnvelopeMessagesJSON `json:"-"` +} + +// kvNamespaceKeyListResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [KVNamespaceKeyListResponseEnvelopeMessages] +type kvNamespaceKeyListResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceKeyListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type KVNamespaceKeyListResponseEnvelopeSuccess bool + +const ( + KVNamespaceKeyListResponseEnvelopeSuccessTrue KVNamespaceKeyListResponseEnvelopeSuccess = true +) + +type KVNamespaceKeyListResponseEnvelopeResultInfo struct { + // Total results returned based on your list parameters. + Count float64 `json:"count"` + // Opaque token indicating the position from which to continue when requesting the + // next set of records if the amount of list results was limited by the limit + // parameter. A valid value for the cursor can be obtained from the cursors object + // in the result_info structure. + Cursor string `json:"cursor"` + JSON kvNamespaceKeyListResponseEnvelopeResultInfoJSON `json:"-"` +} + +// kvNamespaceKeyListResponseEnvelopeResultInfoJSON contains the JSON metadata for +// the struct [KVNamespaceKeyListResponseEnvelopeResultInfo] +type kvNamespaceKeyListResponseEnvelopeResultInfoJSON struct { + Count apijson.Field + Cursor apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceKeyListResponseEnvelopeResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/storagekvnamespacekey_test.go b/kvnamespacekey_test.go similarity index 89% rename from storagekvnamespacekey_test.go rename to kvnamespacekey_test.go index f805c564ac1..a512472f686 100644 --- a/storagekvnamespacekey_test.go +++ b/kvnamespacekey_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestStorageKVNamespaceKeyListWithOptionalParams(t *testing.T) { +func TestKVNamespaceKeyListWithOptionalParams(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 { @@ -29,10 +29,10 @@ func TestStorageKVNamespaceKeyListWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Storage.KV.Namespaces.Keys.List( + _, err := client.KV.Namespaces.Keys.List( context.TODO(), "0f2ac74b498b48028cb68387c421e279", - cloudflare.StorageKVNamespaceKeyListParams{ + cloudflare.KVNamespaceKeyListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Cursor: cloudflare.F("6Ck1la0VxJ0djhidm1MdX2FyDGxLKVeeHZZmORS_8XeSuhz9SjIJRaSa2lnsF01tQOHrfTGAP3R5X1Kv5iVUuMbNKhWNAXHOl6ePB0TUL8nw"), Limit: cloudflare.F(10.000000), diff --git a/kvnamespacemetadata.go b/kvnamespacemetadata.go new file mode 100644 index 00000000000..fcae2e82c98 --- /dev/null +++ b/kvnamespacemetadata.go @@ -0,0 +1,124 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// KVNamespaceMetadataService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewKVNamespaceMetadataService] +// method instead. +type KVNamespaceMetadataService struct { + Options []option.RequestOption +} + +// NewKVNamespaceMetadataService generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewKVNamespaceMetadataService(opts ...option.RequestOption) (r *KVNamespaceMetadataService) { + r = &KVNamespaceMetadataService{} + r.Options = opts + return +} + +// Returns the metadata associated with the given key in the given namespace. Use +// URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key +// name. +func (r *KVNamespaceMetadataService) Get(ctx context.Context, namespaceID string, keyName string, query KVNamespaceMetadataGetParams, opts ...option.RequestOption) (res *KVNamespaceMetadataGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env KVNamespaceMetadataGetResponseEnvelope + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/metadata/%s", query.AccountID, namespaceID, keyName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +type KVNamespaceMetadataGetResponse = interface{} + +type KVNamespaceMetadataGetParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` +} + +type KVNamespaceMetadataGetResponseEnvelope struct { + Errors []KVNamespaceMetadataGetResponseEnvelopeErrors `json:"errors,required"` + Messages []KVNamespaceMetadataGetResponseEnvelopeMessages `json:"messages,required"` + // Arbitrary JSON that is associated with a key. + Result KVNamespaceMetadataGetResponse `json:"result,required"` + // Whether the API call was successful + Success KVNamespaceMetadataGetResponseEnvelopeSuccess `json:"success,required"` + JSON kvNamespaceMetadataGetResponseEnvelopeJSON `json:"-"` +} + +// kvNamespaceMetadataGetResponseEnvelopeJSON contains the JSON metadata for the +// struct [KVNamespaceMetadataGetResponseEnvelope] +type kvNamespaceMetadataGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceMetadataGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type KVNamespaceMetadataGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON kvNamespaceMetadataGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// kvNamespaceMetadataGetResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [KVNamespaceMetadataGetResponseEnvelopeErrors] +type kvNamespaceMetadataGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceMetadataGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type KVNamespaceMetadataGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON kvNamespaceMetadataGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// kvNamespaceMetadataGetResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [KVNamespaceMetadataGetResponseEnvelopeMessages] +type kvNamespaceMetadataGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceMetadataGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type KVNamespaceMetadataGetResponseEnvelopeSuccess bool + +const ( + KVNamespaceMetadataGetResponseEnvelopeSuccessTrue KVNamespaceMetadataGetResponseEnvelopeSuccess = true +) diff --git a/storagekvnamespacemetadata_test.go b/kvnamespacemetadata_test.go similarity index 88% rename from storagekvnamespacemetadata_test.go rename to kvnamespacemetadata_test.go index eb8215bfe3f..cb9a7f508f3 100644 --- a/storagekvnamespacemetadata_test.go +++ b/kvnamespacemetadata_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestStorageKVNamespaceMetadataGet(t *testing.T) { +func TestKVNamespaceMetadataGet(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 { @@ -29,11 +29,11 @@ func TestStorageKVNamespaceMetadataGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Storage.KV.Namespaces.Metadata.Get( + _, err := client.KV.Namespaces.Metadata.Get( context.TODO(), "0f2ac74b498b48028cb68387c421e279", "My-Key", - cloudflare.StorageKVNamespaceMetadataGetParams{ + cloudflare.KVNamespaceMetadataGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) diff --git a/kvnamespacevalue.go b/kvnamespacevalue.go new file mode 100644 index 00000000000..83c2de90105 --- /dev/null +++ b/kvnamespacevalue.go @@ -0,0 +1,274 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// KVNamespaceValueService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewKVNamespaceValueService] method +// instead. +type KVNamespaceValueService struct { + Options []option.RequestOption +} + +// NewKVNamespaceValueService generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewKVNamespaceValueService(opts ...option.RequestOption) (r *KVNamespaceValueService) { + r = &KVNamespaceValueService{} + r.Options = opts + return +} + +// Write a value identified by a key. Use URL-encoding to use special characters +// (for example, `:`, `!`, `%`) in the key name. Body should be the value to be +// stored along with JSON metadata to be associated with the key/value pair. +// Existing values, expirations, and metadata will be overwritten. If neither +// `expiration` nor `expiration_ttl` is specified, the key-value pair will never +// expire. If both are set, `expiration_ttl` is used and `expiration` is ignored. +func (r *KVNamespaceValueService) Update(ctx context.Context, namespaceID string, keyName string, params KVNamespaceValueUpdateParams, opts ...option.RequestOption) (res *KVNamespaceValueUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + var env KVNamespaceValueUpdateResponseEnvelope + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/values/%s", params.AccountID, namespaceID, keyName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Remove a KV pair from the namespace. Use URL-encoding to use special characters +// (for example, `:`, `!`, `%`) in the key name. +func (r *KVNamespaceValueService) Delete(ctx context.Context, namespaceID string, keyName string, body KVNamespaceValueDeleteParams, opts ...option.RequestOption) (res *KVNamespaceValueDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + var env KVNamespaceValueDeleteResponseEnvelope + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/values/%s", body.AccountID, namespaceID, keyName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Returns the value associated with the given key in the given namespace. Use +// URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key +// name. If the KV-pair is set to expire at some point, the expiration time as +// measured in seconds since the UNIX epoch will be returned in the `expiration` +// response header. +func (r *KVNamespaceValueService) Get(ctx context.Context, namespaceID string, keyName string, query KVNamespaceValueGetParams, opts ...option.RequestOption) (res *string, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/values/%s", query.AccountID, namespaceID, keyName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Union satisfied by [KVNamespaceValueUpdateResponseUnknown] or +// [shared.UnionString]. +type KVNamespaceValueUpdateResponse interface { + ImplementsKVNamespaceValueUpdateResponse() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*KVNamespaceValueUpdateResponse)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +// Union satisfied by [KVNamespaceValueDeleteResponseUnknown] or +// [shared.UnionString]. +type KVNamespaceValueDeleteResponse interface { + ImplementsKVNamespaceValueDeleteResponse() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*KVNamespaceValueDeleteResponse)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type KVNamespaceValueUpdateParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` + // Arbitrary JSON to be associated with a key/value pair. + Metadata param.Field[string] `json:"metadata,required"` + // A byte sequence to be stored, up to 25 MiB in length. + Value param.Field[string] `json:"value,required"` +} + +func (r KVNamespaceValueUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type KVNamespaceValueUpdateResponseEnvelope struct { + Errors []KVNamespaceValueUpdateResponseEnvelopeErrors `json:"errors,required"` + Messages []KVNamespaceValueUpdateResponseEnvelopeMessages `json:"messages,required"` + Result KVNamespaceValueUpdateResponse `json:"result,required"` + // Whether the API call was successful + Success KVNamespaceValueUpdateResponseEnvelopeSuccess `json:"success,required"` + JSON kvNamespaceValueUpdateResponseEnvelopeJSON `json:"-"` +} + +// kvNamespaceValueUpdateResponseEnvelopeJSON contains the JSON metadata for the +// struct [KVNamespaceValueUpdateResponseEnvelope] +type kvNamespaceValueUpdateResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceValueUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type KVNamespaceValueUpdateResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON kvNamespaceValueUpdateResponseEnvelopeErrorsJSON `json:"-"` +} + +// kvNamespaceValueUpdateResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [KVNamespaceValueUpdateResponseEnvelopeErrors] +type kvNamespaceValueUpdateResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceValueUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type KVNamespaceValueUpdateResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON kvNamespaceValueUpdateResponseEnvelopeMessagesJSON `json:"-"` +} + +// kvNamespaceValueUpdateResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [KVNamespaceValueUpdateResponseEnvelopeMessages] +type kvNamespaceValueUpdateResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceValueUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type KVNamespaceValueUpdateResponseEnvelopeSuccess bool + +const ( + KVNamespaceValueUpdateResponseEnvelopeSuccessTrue KVNamespaceValueUpdateResponseEnvelopeSuccess = true +) + +type KVNamespaceValueDeleteParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` +} + +type KVNamespaceValueDeleteResponseEnvelope struct { + Errors []KVNamespaceValueDeleteResponseEnvelopeErrors `json:"errors,required"` + Messages []KVNamespaceValueDeleteResponseEnvelopeMessages `json:"messages,required"` + Result KVNamespaceValueDeleteResponse `json:"result,required"` + // Whether the API call was successful + Success KVNamespaceValueDeleteResponseEnvelopeSuccess `json:"success,required"` + JSON kvNamespaceValueDeleteResponseEnvelopeJSON `json:"-"` +} + +// kvNamespaceValueDeleteResponseEnvelopeJSON contains the JSON metadata for the +// struct [KVNamespaceValueDeleteResponseEnvelope] +type kvNamespaceValueDeleteResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceValueDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type KVNamespaceValueDeleteResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON kvNamespaceValueDeleteResponseEnvelopeErrorsJSON `json:"-"` +} + +// kvNamespaceValueDeleteResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [KVNamespaceValueDeleteResponseEnvelopeErrors] +type kvNamespaceValueDeleteResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceValueDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type KVNamespaceValueDeleteResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON kvNamespaceValueDeleteResponseEnvelopeMessagesJSON `json:"-"` +} + +// kvNamespaceValueDeleteResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [KVNamespaceValueDeleteResponseEnvelopeMessages] +type kvNamespaceValueDeleteResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *KVNamespaceValueDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type KVNamespaceValueDeleteResponseEnvelopeSuccess bool + +const ( + KVNamespaceValueDeleteResponseEnvelopeSuccessTrue KVNamespaceValueDeleteResponseEnvelopeSuccess = true +) + +type KVNamespaceValueGetParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` +} diff --git a/storagekvnamespacevalue_test.go b/kvnamespacevalue_test.go similarity index 87% rename from storagekvnamespacevalue_test.go rename to kvnamespacevalue_test.go index d488280af52..b43ff1cfd64 100644 --- a/storagekvnamespacevalue_test.go +++ b/kvnamespacevalue_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestStorageKVNamespaceValueUpdate(t *testing.T) { +func TestKVNamespaceValueUpdate(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 { @@ -29,11 +29,11 @@ func TestStorageKVNamespaceValueUpdate(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Storage.KV.Namespaces.Values.Update( + _, err := client.KV.Namespaces.Values.Update( context.TODO(), "0f2ac74b498b48028cb68387c421e279", "My-Key", - cloudflare.StorageKVNamespaceValueUpdateParams{ + cloudflare.KVNamespaceValueUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Metadata: cloudflare.F("{\"someMetadataKey\": \"someMetadataValue\"}"), Value: cloudflare.F("Some Value"), @@ -48,7 +48,7 @@ func TestStorageKVNamespaceValueUpdate(t *testing.T) { } } -func TestStorageKVNamespaceValueDelete(t *testing.T) { +func TestKVNamespaceValueDelete(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 { @@ -64,11 +64,11 @@ func TestStorageKVNamespaceValueDelete(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Storage.KV.Namespaces.Values.Delete( + _, err := client.KV.Namespaces.Values.Delete( context.TODO(), "0f2ac74b498b48028cb68387c421e279", "My-Key", - cloudflare.StorageKVNamespaceValueDeleteParams{ + cloudflare.KVNamespaceValueDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) @@ -81,7 +81,7 @@ func TestStorageKVNamespaceValueDelete(t *testing.T) { } } -func TestStorageKVNamespaceValueGet(t *testing.T) { +func TestKVNamespaceValueGet(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 { @@ -97,11 +97,11 @@ func TestStorageKVNamespaceValueGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Storage.KV.Namespaces.Values.Get( + _, err := client.KV.Namespaces.Values.Get( context.TODO(), "0f2ac74b498b48028cb68387c421e279", "My-Key", - cloudflare.StorageKVNamespaceValueGetParams{ + cloudflare.KVNamespaceValueGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) diff --git a/magic.go b/magic.go deleted file mode 100644 index ff23d5070cf..00000000000 --- a/magic.go +++ /dev/null @@ -1,32 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// MagicService contains methods and other services that help with interacting with -// the cloudflare API. Note, unlike clients, this service does not read variables -// from the environment automatically. You should not instantiate this service -// directly, and instead use the [NewMagicService] method instead. -type MagicService struct { - Options []option.RequestOption - CfInterconnects *MagicCfInterconnectService - GRETunnels *MagicGRETunnelService - IPSECTunnels *MagicIPSECTunnelService - Routes *MagicRouteService -} - -// NewMagicService generates a new service that applies the given options to each -// request. These options are applied after the parent client's options (if there -// is one), and before any request-specific options. -func NewMagicService(opts ...option.RequestOption) (r *MagicService) { - r = &MagicService{} - r.Options = opts - r.CfInterconnects = NewMagicCfInterconnectService(opts...) - r.GRETunnels = NewMagicGRETunnelService(opts...) - r.IPSECTunnels = NewMagicIPSECTunnelService(opts...) - r.Routes = NewMagicRouteService(opts...) - return -} diff --git a/magiccfinterconnect.go b/magiccfinterconnect.go deleted file mode 100644 index ff7064ebd78..00000000000 --- a/magiccfinterconnect.go +++ /dev/null @@ -1,512 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// MagicCfInterconnectService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewMagicCfInterconnectService] -// method instead. -type MagicCfInterconnectService struct { - Options []option.RequestOption -} - -// NewMagicCfInterconnectService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewMagicCfInterconnectService(opts ...option.RequestOption) (r *MagicCfInterconnectService) { - r = &MagicCfInterconnectService{} - r.Options = opts - return -} - -// Updates a specific interconnect associated with an account. Use -// `?validate_only=true` as an optional query parameter to only run validation -// without persisting changes. -func (r *MagicCfInterconnectService) Update(ctx context.Context, accountIdentifier string, tunnelIdentifier string, body MagicCfInterconnectUpdateParams, opts ...option.RequestOption) (res *MagicCfInterconnectUpdateResponse, err error) { - opts = append(r.Options[:], opts...) - var env MagicCfInterconnectUpdateResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/cf_interconnects/%s", accountIdentifier, tunnelIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Lists interconnects associated with an account. -func (r *MagicCfInterconnectService) List(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *MagicCfInterconnectListResponse, err error) { - opts = append(r.Options[:], opts...) - var env MagicCfInterconnectListResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/cf_interconnects", accountIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Lists details for a specific interconnect. -func (r *MagicCfInterconnectService) Get(ctx context.Context, accountIdentifier string, tunnelIdentifier string, opts ...option.RequestOption) (res *MagicCfInterconnectGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env MagicCfInterconnectGetResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/cf_interconnects/%s", accountIdentifier, tunnelIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -type MagicCfInterconnectUpdateResponse struct { - Modified bool `json:"modified"` - ModifiedInterconnect interface{} `json:"modified_interconnect"` - JSON magicCfInterconnectUpdateResponseJSON `json:"-"` -} - -// magicCfInterconnectUpdateResponseJSON contains the JSON metadata for the struct -// [MagicCfInterconnectUpdateResponse] -type magicCfInterconnectUpdateResponseJSON struct { - Modified apijson.Field - ModifiedInterconnect apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicCfInterconnectUpdateResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicCfInterconnectListResponse struct { - Interconnects []MagicCfInterconnectListResponseInterconnect `json:"interconnects"` - JSON magicCfInterconnectListResponseJSON `json:"-"` -} - -// magicCfInterconnectListResponseJSON contains the JSON metadata for the struct -// [MagicCfInterconnectListResponse] -type magicCfInterconnectListResponseJSON struct { - Interconnects apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicCfInterconnectListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicCfInterconnectListResponseInterconnect struct { - // Tunnel identifier tag. - ID string `json:"id"` - // The name of the interconnect. The name cannot share a name with other tunnels. - ColoName string `json:"colo_name"` - // The date and time the tunnel was created. - CreatedOn time.Time `json:"created_on" format:"date-time"` - // An optional description of the interconnect. - Description string `json:"description"` - // The configuration specific to GRE interconnects. - GRE MagicCfInterconnectListResponseInterconnectsGRE `json:"gre"` - HealthCheck MagicCfInterconnectListResponseInterconnectsHealthCheck `json:"health_check"` - // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side - // of the tunnel. Select the subnet from the following private IP space: - // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - InterfaceAddress string `json:"interface_address"` - // The date and time the tunnel was last modified. - ModifiedOn time.Time `json:"modified_on" format:"date-time"` - // The Maximum Transmission Unit (MTU) in bytes for the interconnect. The minimum - // value is 576. - Mtu int64 `json:"mtu"` - // The name of the interconnect. The name cannot share a name with other tunnels. - Name string `json:"name"` - JSON magicCfInterconnectListResponseInterconnectJSON `json:"-"` -} - -// magicCfInterconnectListResponseInterconnectJSON contains the JSON metadata for -// the struct [MagicCfInterconnectListResponseInterconnect] -type magicCfInterconnectListResponseInterconnectJSON struct { - ID apijson.Field - ColoName apijson.Field - CreatedOn apijson.Field - Description apijson.Field - GRE apijson.Field - HealthCheck apijson.Field - InterfaceAddress apijson.Field - ModifiedOn apijson.Field - Mtu apijson.Field - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicCfInterconnectListResponseInterconnect) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// The configuration specific to GRE interconnects. -type MagicCfInterconnectListResponseInterconnectsGRE struct { - // The IP address assigned to the Cloudflare side of the GRE tunnel created as part - // of the Interconnect. - CloudflareEndpoint string `json:"cloudflare_endpoint"` - JSON magicCfInterconnectListResponseInterconnectsGREJSON `json:"-"` -} - -// magicCfInterconnectListResponseInterconnectsGREJSON contains the JSON metadata -// for the struct [MagicCfInterconnectListResponseInterconnectsGRE] -type magicCfInterconnectListResponseInterconnectsGREJSON struct { - CloudflareEndpoint apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicCfInterconnectListResponseInterconnectsGRE) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicCfInterconnectListResponseInterconnectsHealthCheck struct { - // Determines whether to run healthchecks for a tunnel. - Enabled bool `json:"enabled"` - // How frequent the health check is run. The default value is `mid`. - Rate MagicCfInterconnectListResponseInterconnectsHealthCheckRate `json:"rate"` - // The destination address in a request type health check. After the healthcheck is - // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded - // to this address. This field defaults to `customer_gre_endpoint address`. - Target string `json:"target"` - // The type of healthcheck to run, reply or request. The default value is `reply`. - Type MagicCfInterconnectListResponseInterconnectsHealthCheckType `json:"type"` - JSON magicCfInterconnectListResponseInterconnectsHealthCheckJSON `json:"-"` -} - -// magicCfInterconnectListResponseInterconnectsHealthCheckJSON contains the JSON -// metadata for the struct -// [MagicCfInterconnectListResponseInterconnectsHealthCheck] -type magicCfInterconnectListResponseInterconnectsHealthCheckJSON struct { - Enabled apijson.Field - Rate apijson.Field - Target apijson.Field - Type apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicCfInterconnectListResponseInterconnectsHealthCheck) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// How frequent the health check is run. The default value is `mid`. -type MagicCfInterconnectListResponseInterconnectsHealthCheckRate string - -const ( - MagicCfInterconnectListResponseInterconnectsHealthCheckRateLow MagicCfInterconnectListResponseInterconnectsHealthCheckRate = "low" - MagicCfInterconnectListResponseInterconnectsHealthCheckRateMid MagicCfInterconnectListResponseInterconnectsHealthCheckRate = "mid" - MagicCfInterconnectListResponseInterconnectsHealthCheckRateHigh MagicCfInterconnectListResponseInterconnectsHealthCheckRate = "high" -) - -// The type of healthcheck to run, reply or request. The default value is `reply`. -type MagicCfInterconnectListResponseInterconnectsHealthCheckType string - -const ( - MagicCfInterconnectListResponseInterconnectsHealthCheckTypeReply MagicCfInterconnectListResponseInterconnectsHealthCheckType = "reply" - MagicCfInterconnectListResponseInterconnectsHealthCheckTypeRequest MagicCfInterconnectListResponseInterconnectsHealthCheckType = "request" -) - -type MagicCfInterconnectGetResponse struct { - Interconnect interface{} `json:"interconnect"` - JSON magicCfInterconnectGetResponseJSON `json:"-"` -} - -// magicCfInterconnectGetResponseJSON contains the JSON metadata for the struct -// [MagicCfInterconnectGetResponse] -type magicCfInterconnectGetResponseJSON struct { - Interconnect apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicCfInterconnectGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicCfInterconnectUpdateParams struct { - // An optional description of the interconnect. - Description param.Field[string] `json:"description"` - // The configuration specific to GRE interconnects. - GRE param.Field[MagicCfInterconnectUpdateParamsGRE] `json:"gre"` - HealthCheck param.Field[MagicCfInterconnectUpdateParamsHealthCheck] `json:"health_check"` - // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side - // of the tunnel. Select the subnet from the following private IP space: - // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - InterfaceAddress param.Field[string] `json:"interface_address"` - // The Maximum Transmission Unit (MTU) in bytes for the interconnect. The minimum - // value is 576. - Mtu param.Field[int64] `json:"mtu"` -} - -func (r MagicCfInterconnectUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The configuration specific to GRE interconnects. -type MagicCfInterconnectUpdateParamsGRE struct { - // The IP address assigned to the Cloudflare side of the GRE tunnel created as part - // of the Interconnect. - CloudflareEndpoint param.Field[string] `json:"cloudflare_endpoint"` -} - -func (r MagicCfInterconnectUpdateParamsGRE) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type MagicCfInterconnectUpdateParamsHealthCheck struct { - // Determines whether to run healthchecks for a tunnel. - Enabled param.Field[bool] `json:"enabled"` - // How frequent the health check is run. The default value is `mid`. - Rate param.Field[MagicCfInterconnectUpdateParamsHealthCheckRate] `json:"rate"` - // The destination address in a request type health check. After the healthcheck is - // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded - // to this address. This field defaults to `customer_gre_endpoint address`. - Target param.Field[string] `json:"target"` - // The type of healthcheck to run, reply or request. The default value is `reply`. - Type param.Field[MagicCfInterconnectUpdateParamsHealthCheckType] `json:"type"` -} - -func (r MagicCfInterconnectUpdateParamsHealthCheck) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// How frequent the health check is run. The default value is `mid`. -type MagicCfInterconnectUpdateParamsHealthCheckRate string - -const ( - MagicCfInterconnectUpdateParamsHealthCheckRateLow MagicCfInterconnectUpdateParamsHealthCheckRate = "low" - MagicCfInterconnectUpdateParamsHealthCheckRateMid MagicCfInterconnectUpdateParamsHealthCheckRate = "mid" - MagicCfInterconnectUpdateParamsHealthCheckRateHigh MagicCfInterconnectUpdateParamsHealthCheckRate = "high" -) - -// The type of healthcheck to run, reply or request. The default value is `reply`. -type MagicCfInterconnectUpdateParamsHealthCheckType string - -const ( - MagicCfInterconnectUpdateParamsHealthCheckTypeReply MagicCfInterconnectUpdateParamsHealthCheckType = "reply" - MagicCfInterconnectUpdateParamsHealthCheckTypeRequest MagicCfInterconnectUpdateParamsHealthCheckType = "request" -) - -type MagicCfInterconnectUpdateResponseEnvelope struct { - Errors []MagicCfInterconnectUpdateResponseEnvelopeErrors `json:"errors,required"` - Messages []MagicCfInterconnectUpdateResponseEnvelopeMessages `json:"messages,required"` - Result MagicCfInterconnectUpdateResponse `json:"result,required"` - // Whether the API call was successful - Success MagicCfInterconnectUpdateResponseEnvelopeSuccess `json:"success,required"` - JSON magicCfInterconnectUpdateResponseEnvelopeJSON `json:"-"` -} - -// magicCfInterconnectUpdateResponseEnvelopeJSON contains the JSON metadata for the -// struct [MagicCfInterconnectUpdateResponseEnvelope] -type magicCfInterconnectUpdateResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicCfInterconnectUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicCfInterconnectUpdateResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicCfInterconnectUpdateResponseEnvelopeErrorsJSON `json:"-"` -} - -// magicCfInterconnectUpdateResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [MagicCfInterconnectUpdateResponseEnvelopeErrors] -type magicCfInterconnectUpdateResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicCfInterconnectUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicCfInterconnectUpdateResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicCfInterconnectUpdateResponseEnvelopeMessagesJSON `json:"-"` -} - -// magicCfInterconnectUpdateResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [MagicCfInterconnectUpdateResponseEnvelopeMessages] -type magicCfInterconnectUpdateResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicCfInterconnectUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type MagicCfInterconnectUpdateResponseEnvelopeSuccess bool - -const ( - MagicCfInterconnectUpdateResponseEnvelopeSuccessTrue MagicCfInterconnectUpdateResponseEnvelopeSuccess = true -) - -type MagicCfInterconnectListResponseEnvelope struct { - Errors []MagicCfInterconnectListResponseEnvelopeErrors `json:"errors,required"` - Messages []MagicCfInterconnectListResponseEnvelopeMessages `json:"messages,required"` - Result MagicCfInterconnectListResponse `json:"result,required"` - // Whether the API call was successful - Success MagicCfInterconnectListResponseEnvelopeSuccess `json:"success,required"` - JSON magicCfInterconnectListResponseEnvelopeJSON `json:"-"` -} - -// magicCfInterconnectListResponseEnvelopeJSON contains the JSON metadata for the -// struct [MagicCfInterconnectListResponseEnvelope] -type magicCfInterconnectListResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicCfInterconnectListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicCfInterconnectListResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicCfInterconnectListResponseEnvelopeErrorsJSON `json:"-"` -} - -// magicCfInterconnectListResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [MagicCfInterconnectListResponseEnvelopeErrors] -type magicCfInterconnectListResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicCfInterconnectListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicCfInterconnectListResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicCfInterconnectListResponseEnvelopeMessagesJSON `json:"-"` -} - -// magicCfInterconnectListResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [MagicCfInterconnectListResponseEnvelopeMessages] -type magicCfInterconnectListResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicCfInterconnectListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type MagicCfInterconnectListResponseEnvelopeSuccess bool - -const ( - MagicCfInterconnectListResponseEnvelopeSuccessTrue MagicCfInterconnectListResponseEnvelopeSuccess = true -) - -type MagicCfInterconnectGetResponseEnvelope struct { - Errors []MagicCfInterconnectGetResponseEnvelopeErrors `json:"errors,required"` - Messages []MagicCfInterconnectGetResponseEnvelopeMessages `json:"messages,required"` - Result MagicCfInterconnectGetResponse `json:"result,required"` - // Whether the API call was successful - Success MagicCfInterconnectGetResponseEnvelopeSuccess `json:"success,required"` - JSON magicCfInterconnectGetResponseEnvelopeJSON `json:"-"` -} - -// magicCfInterconnectGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [MagicCfInterconnectGetResponseEnvelope] -type magicCfInterconnectGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicCfInterconnectGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicCfInterconnectGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicCfInterconnectGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// magicCfInterconnectGetResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [MagicCfInterconnectGetResponseEnvelopeErrors] -type magicCfInterconnectGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicCfInterconnectGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicCfInterconnectGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicCfInterconnectGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// magicCfInterconnectGetResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [MagicCfInterconnectGetResponseEnvelopeMessages] -type magicCfInterconnectGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicCfInterconnectGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type MagicCfInterconnectGetResponseEnvelopeSuccess bool - -const ( - MagicCfInterconnectGetResponseEnvelopeSuccessTrue MagicCfInterconnectGetResponseEnvelopeSuccess = true -) diff --git a/magicgretunnel.go b/magicgretunnel.go deleted file mode 100644 index 894f051fe02..00000000000 --- a/magicgretunnel.go +++ /dev/null @@ -1,865 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// MagicGRETunnelService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewMagicGRETunnelService] method -// instead. -type MagicGRETunnelService struct { - Options []option.RequestOption -} - -// NewMagicGRETunnelService generates a new service that applies the given options -// to each request. These options are applied after the parent client's options (if -// there is one), and before any request-specific options. -func NewMagicGRETunnelService(opts ...option.RequestOption) (r *MagicGRETunnelService) { - r = &MagicGRETunnelService{} - r.Options = opts - return -} - -// Creates new GRE tunnels. Use `?validate_only=true` as an optional query -// parameter to only run validation without persisting changes. -func (r *MagicGRETunnelService) New(ctx context.Context, accountIdentifier string, body MagicGRETunnelNewParams, opts ...option.RequestOption) (res *MagicGRETunnelNewResponse, err error) { - opts = append(r.Options[:], opts...) - var env MagicGRETunnelNewResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/gre_tunnels", accountIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Updates a specific GRE tunnel. Use `?validate_only=true` as an optional query -// parameter to only run validation without persisting changes. -func (r *MagicGRETunnelService) Update(ctx context.Context, accountIdentifier string, tunnelIdentifier string, body MagicGRETunnelUpdateParams, opts ...option.RequestOption) (res *MagicGRETunnelUpdateResponse, err error) { - opts = append(r.Options[:], opts...) - var env MagicGRETunnelUpdateResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/gre_tunnels/%s", accountIdentifier, tunnelIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Lists GRE tunnels associated with an account. -func (r *MagicGRETunnelService) List(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *MagicGRETunnelListResponse, err error) { - opts = append(r.Options[:], opts...) - var env MagicGRETunnelListResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/gre_tunnels", accountIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Disables and removes a specific static GRE tunnel. Use `?validate_only=true` as -// an optional query parameter to only run validation without persisting changes. -func (r *MagicGRETunnelService) Delete(ctx context.Context, accountIdentifier string, tunnelIdentifier string, opts ...option.RequestOption) (res *MagicGRETunnelDeleteResponse, err error) { - opts = append(r.Options[:], opts...) - var env MagicGRETunnelDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/gre_tunnels/%s", accountIdentifier, tunnelIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Lists informtion for a specific GRE tunnel. -func (r *MagicGRETunnelService) Get(ctx context.Context, accountIdentifier string, tunnelIdentifier string, opts ...option.RequestOption) (res *MagicGRETunnelGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env MagicGRETunnelGetResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/gre_tunnels/%s", accountIdentifier, tunnelIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -type MagicGRETunnelNewResponse struct { - GRETunnels []MagicGRETunnelNewResponseGRETunnel `json:"gre_tunnels"` - JSON magicGRETunnelNewResponseJSON `json:"-"` -} - -// magicGRETunnelNewResponseJSON contains the JSON metadata for the struct -// [MagicGRETunnelNewResponse] -type magicGRETunnelNewResponseJSON struct { - GRETunnels apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelNewResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicGRETunnelNewResponseGRETunnel struct { - // The IP address assigned to the Cloudflare side of the GRE tunnel. - CloudflareGREEndpoint string `json:"cloudflare_gre_endpoint,required"` - // The IP address assigned to the customer side of the GRE tunnel. - CustomerGREEndpoint string `json:"customer_gre_endpoint,required"` - // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side - // of the tunnel. Select the subnet from the following private IP space: - // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - InterfaceAddress string `json:"interface_address,required"` - // The name of the tunnel. The name cannot contain spaces or special characters, - // must be 15 characters or less, and cannot share a name with another GRE tunnel. - Name string `json:"name,required"` - // Tunnel identifier tag. - ID string `json:"id"` - // The date and time the tunnel was created. - CreatedOn time.Time `json:"created_on" format:"date-time"` - // An optional description of the GRE tunnel. - Description string `json:"description"` - HealthCheck MagicGRETunnelNewResponseGRETunnelsHealthCheck `json:"health_check"` - // The date and time the tunnel was last modified. - ModifiedOn time.Time `json:"modified_on" format:"date-time"` - // Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value - // is 576. - Mtu int64 `json:"mtu"` - // Time To Live (TTL) in number of hops of the GRE tunnel. - TTL int64 `json:"ttl"` - JSON magicGRETunnelNewResponseGRETunnelJSON `json:"-"` -} - -// magicGRETunnelNewResponseGRETunnelJSON contains the JSON metadata for the struct -// [MagicGRETunnelNewResponseGRETunnel] -type magicGRETunnelNewResponseGRETunnelJSON struct { - CloudflareGREEndpoint apijson.Field - CustomerGREEndpoint apijson.Field - InterfaceAddress apijson.Field - Name apijson.Field - ID apijson.Field - CreatedOn apijson.Field - Description apijson.Field - HealthCheck apijson.Field - ModifiedOn apijson.Field - Mtu apijson.Field - TTL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelNewResponseGRETunnel) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicGRETunnelNewResponseGRETunnelsHealthCheck struct { - // The direction of the flow of the healthcheck. Either unidirectional, where the - // probe comes to you via the tunnel and the result comes back to Cloudflare via - // the open Internet, or bidirectional where both the probe and result come and go - // via the tunnel. Note in the case of bidirecitonal healthchecks, the target field - // in health_check is ignored as the interface_address is used to send traffic into - // the tunnel. - Direction MagicGRETunnelNewResponseGRETunnelsHealthCheckDirection `json:"direction"` - // Determines whether to run healthchecks for a tunnel. - Enabled bool `json:"enabled"` - // How frequent the health check is run. The default value is `mid`. - Rate MagicGRETunnelNewResponseGRETunnelsHealthCheckRate `json:"rate"` - // The destination address in a request type health check. After the healthcheck is - // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded - // to this address. This field defaults to `customer_gre_endpoint address`. This - // field is ignored for bidirectional healthchecks as the interface_address (not - // assigned to the Cloudflare side of the tunnel) is used as the target. - Target string `json:"target"` - // The type of healthcheck to run, reply or request. The default value is `reply`. - Type MagicGRETunnelNewResponseGRETunnelsHealthCheckType `json:"type"` - JSON magicGRETunnelNewResponseGRETunnelsHealthCheckJSON `json:"-"` -} - -// magicGRETunnelNewResponseGRETunnelsHealthCheckJSON contains the JSON metadata -// for the struct [MagicGRETunnelNewResponseGRETunnelsHealthCheck] -type magicGRETunnelNewResponseGRETunnelsHealthCheckJSON struct { - Direction apijson.Field - Enabled apijson.Field - Rate apijson.Field - Target apijson.Field - Type apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelNewResponseGRETunnelsHealthCheck) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// The direction of the flow of the healthcheck. Either unidirectional, where the -// probe comes to you via the tunnel and the result comes back to Cloudflare via -// the open Internet, or bidirectional where both the probe and result come and go -// via the tunnel. Note in the case of bidirecitonal healthchecks, the target field -// in health_check is ignored as the interface_address is used to send traffic into -// the tunnel. -type MagicGRETunnelNewResponseGRETunnelsHealthCheckDirection string - -const ( - MagicGRETunnelNewResponseGRETunnelsHealthCheckDirectionUnidirectional MagicGRETunnelNewResponseGRETunnelsHealthCheckDirection = "unidirectional" - MagicGRETunnelNewResponseGRETunnelsHealthCheckDirectionBidirectional MagicGRETunnelNewResponseGRETunnelsHealthCheckDirection = "bidirectional" -) - -// How frequent the health check is run. The default value is `mid`. -type MagicGRETunnelNewResponseGRETunnelsHealthCheckRate string - -const ( - MagicGRETunnelNewResponseGRETunnelsHealthCheckRateLow MagicGRETunnelNewResponseGRETunnelsHealthCheckRate = "low" - MagicGRETunnelNewResponseGRETunnelsHealthCheckRateMid MagicGRETunnelNewResponseGRETunnelsHealthCheckRate = "mid" - MagicGRETunnelNewResponseGRETunnelsHealthCheckRateHigh MagicGRETunnelNewResponseGRETunnelsHealthCheckRate = "high" -) - -// The type of healthcheck to run, reply or request. The default value is `reply`. -type MagicGRETunnelNewResponseGRETunnelsHealthCheckType string - -const ( - MagicGRETunnelNewResponseGRETunnelsHealthCheckTypeReply MagicGRETunnelNewResponseGRETunnelsHealthCheckType = "reply" - MagicGRETunnelNewResponseGRETunnelsHealthCheckTypeRequest MagicGRETunnelNewResponseGRETunnelsHealthCheckType = "request" -) - -type MagicGRETunnelUpdateResponse struct { - Modified bool `json:"modified"` - ModifiedGRETunnel interface{} `json:"modified_gre_tunnel"` - JSON magicGRETunnelUpdateResponseJSON `json:"-"` -} - -// magicGRETunnelUpdateResponseJSON contains the JSON metadata for the struct -// [MagicGRETunnelUpdateResponse] -type magicGRETunnelUpdateResponseJSON struct { - Modified apijson.Field - ModifiedGRETunnel apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelUpdateResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicGRETunnelListResponse struct { - GRETunnels []MagicGRETunnelListResponseGRETunnel `json:"gre_tunnels"` - JSON magicGRETunnelListResponseJSON `json:"-"` -} - -// magicGRETunnelListResponseJSON contains the JSON metadata for the struct -// [MagicGRETunnelListResponse] -type magicGRETunnelListResponseJSON struct { - GRETunnels apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicGRETunnelListResponseGRETunnel struct { - // The IP address assigned to the Cloudflare side of the GRE tunnel. - CloudflareGREEndpoint string `json:"cloudflare_gre_endpoint,required"` - // The IP address assigned to the customer side of the GRE tunnel. - CustomerGREEndpoint string `json:"customer_gre_endpoint,required"` - // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side - // of the tunnel. Select the subnet from the following private IP space: - // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - InterfaceAddress string `json:"interface_address,required"` - // The name of the tunnel. The name cannot contain spaces or special characters, - // must be 15 characters or less, and cannot share a name with another GRE tunnel. - Name string `json:"name,required"` - // Tunnel identifier tag. - ID string `json:"id"` - // The date and time the tunnel was created. - CreatedOn time.Time `json:"created_on" format:"date-time"` - // An optional description of the GRE tunnel. - Description string `json:"description"` - HealthCheck MagicGRETunnelListResponseGRETunnelsHealthCheck `json:"health_check"` - // The date and time the tunnel was last modified. - ModifiedOn time.Time `json:"modified_on" format:"date-time"` - // Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value - // is 576. - Mtu int64 `json:"mtu"` - // Time To Live (TTL) in number of hops of the GRE tunnel. - TTL int64 `json:"ttl"` - JSON magicGRETunnelListResponseGRETunnelJSON `json:"-"` -} - -// magicGRETunnelListResponseGRETunnelJSON contains the JSON metadata for the -// struct [MagicGRETunnelListResponseGRETunnel] -type magicGRETunnelListResponseGRETunnelJSON struct { - CloudflareGREEndpoint apijson.Field - CustomerGREEndpoint apijson.Field - InterfaceAddress apijson.Field - Name apijson.Field - ID apijson.Field - CreatedOn apijson.Field - Description apijson.Field - HealthCheck apijson.Field - ModifiedOn apijson.Field - Mtu apijson.Field - TTL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelListResponseGRETunnel) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicGRETunnelListResponseGRETunnelsHealthCheck struct { - // The direction of the flow of the healthcheck. Either unidirectional, where the - // probe comes to you via the tunnel and the result comes back to Cloudflare via - // the open Internet, or bidirectional where both the probe and result come and go - // via the tunnel. Note in the case of bidirecitonal healthchecks, the target field - // in health_check is ignored as the interface_address is used to send traffic into - // the tunnel. - Direction MagicGRETunnelListResponseGRETunnelsHealthCheckDirection `json:"direction"` - // Determines whether to run healthchecks for a tunnel. - Enabled bool `json:"enabled"` - // How frequent the health check is run. The default value is `mid`. - Rate MagicGRETunnelListResponseGRETunnelsHealthCheckRate `json:"rate"` - // The destination address in a request type health check. After the healthcheck is - // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded - // to this address. This field defaults to `customer_gre_endpoint address`. This - // field is ignored for bidirectional healthchecks as the interface_address (not - // assigned to the Cloudflare side of the tunnel) is used as the target. - Target string `json:"target"` - // The type of healthcheck to run, reply or request. The default value is `reply`. - Type MagicGRETunnelListResponseGRETunnelsHealthCheckType `json:"type"` - JSON magicGRETunnelListResponseGRETunnelsHealthCheckJSON `json:"-"` -} - -// magicGRETunnelListResponseGRETunnelsHealthCheckJSON contains the JSON metadata -// for the struct [MagicGRETunnelListResponseGRETunnelsHealthCheck] -type magicGRETunnelListResponseGRETunnelsHealthCheckJSON struct { - Direction apijson.Field - Enabled apijson.Field - Rate apijson.Field - Target apijson.Field - Type apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelListResponseGRETunnelsHealthCheck) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// The direction of the flow of the healthcheck. Either unidirectional, where the -// probe comes to you via the tunnel and the result comes back to Cloudflare via -// the open Internet, or bidirectional where both the probe and result come and go -// via the tunnel. Note in the case of bidirecitonal healthchecks, the target field -// in health_check is ignored as the interface_address is used to send traffic into -// the tunnel. -type MagicGRETunnelListResponseGRETunnelsHealthCheckDirection string - -const ( - MagicGRETunnelListResponseGRETunnelsHealthCheckDirectionUnidirectional MagicGRETunnelListResponseGRETunnelsHealthCheckDirection = "unidirectional" - MagicGRETunnelListResponseGRETunnelsHealthCheckDirectionBidirectional MagicGRETunnelListResponseGRETunnelsHealthCheckDirection = "bidirectional" -) - -// How frequent the health check is run. The default value is `mid`. -type MagicGRETunnelListResponseGRETunnelsHealthCheckRate string - -const ( - MagicGRETunnelListResponseGRETunnelsHealthCheckRateLow MagicGRETunnelListResponseGRETunnelsHealthCheckRate = "low" - MagicGRETunnelListResponseGRETunnelsHealthCheckRateMid MagicGRETunnelListResponseGRETunnelsHealthCheckRate = "mid" - MagicGRETunnelListResponseGRETunnelsHealthCheckRateHigh MagicGRETunnelListResponseGRETunnelsHealthCheckRate = "high" -) - -// The type of healthcheck to run, reply or request. The default value is `reply`. -type MagicGRETunnelListResponseGRETunnelsHealthCheckType string - -const ( - MagicGRETunnelListResponseGRETunnelsHealthCheckTypeReply MagicGRETunnelListResponseGRETunnelsHealthCheckType = "reply" - MagicGRETunnelListResponseGRETunnelsHealthCheckTypeRequest MagicGRETunnelListResponseGRETunnelsHealthCheckType = "request" -) - -type MagicGRETunnelDeleteResponse struct { - Deleted bool `json:"deleted"` - DeletedGRETunnel interface{} `json:"deleted_gre_tunnel"` - JSON magicGRETunnelDeleteResponseJSON `json:"-"` -} - -// magicGRETunnelDeleteResponseJSON contains the JSON metadata for the struct -// [MagicGRETunnelDeleteResponse] -type magicGRETunnelDeleteResponseJSON struct { - Deleted apijson.Field - DeletedGRETunnel apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelDeleteResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicGRETunnelGetResponse struct { - GRETunnel interface{} `json:"gre_tunnel"` - JSON magicGRETunnelGetResponseJSON `json:"-"` -} - -// magicGRETunnelGetResponseJSON contains the JSON metadata for the struct -// [MagicGRETunnelGetResponse] -type magicGRETunnelGetResponseJSON struct { - GRETunnel apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicGRETunnelNewParams struct { - Body param.Field[interface{}] `json:"body,required"` -} - -func (r MagicGRETunnelNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - -type MagicGRETunnelNewResponseEnvelope struct { - Errors []MagicGRETunnelNewResponseEnvelopeErrors `json:"errors,required"` - Messages []MagicGRETunnelNewResponseEnvelopeMessages `json:"messages,required"` - Result MagicGRETunnelNewResponse `json:"result,required"` - // Whether the API call was successful - Success MagicGRETunnelNewResponseEnvelopeSuccess `json:"success,required"` - JSON magicGRETunnelNewResponseEnvelopeJSON `json:"-"` -} - -// magicGRETunnelNewResponseEnvelopeJSON contains the JSON metadata for the struct -// [MagicGRETunnelNewResponseEnvelope] -type magicGRETunnelNewResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicGRETunnelNewResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicGRETunnelNewResponseEnvelopeErrorsJSON `json:"-"` -} - -// magicGRETunnelNewResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [MagicGRETunnelNewResponseEnvelopeErrors] -type magicGRETunnelNewResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicGRETunnelNewResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicGRETunnelNewResponseEnvelopeMessagesJSON `json:"-"` -} - -// magicGRETunnelNewResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [MagicGRETunnelNewResponseEnvelopeMessages] -type magicGRETunnelNewResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type MagicGRETunnelNewResponseEnvelopeSuccess bool - -const ( - MagicGRETunnelNewResponseEnvelopeSuccessTrue MagicGRETunnelNewResponseEnvelopeSuccess = true -) - -type MagicGRETunnelUpdateParams struct { - // The IP address assigned to the Cloudflare side of the GRE tunnel. - CloudflareGREEndpoint param.Field[string] `json:"cloudflare_gre_endpoint,required"` - // The IP address assigned to the customer side of the GRE tunnel. - CustomerGREEndpoint param.Field[string] `json:"customer_gre_endpoint,required"` - // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side - // of the tunnel. Select the subnet from the following private IP space: - // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - InterfaceAddress param.Field[string] `json:"interface_address,required"` - // The name of the tunnel. The name cannot contain spaces or special characters, - // must be 15 characters or less, and cannot share a name with another GRE tunnel. - Name param.Field[string] `json:"name,required"` - // An optional description of the GRE tunnel. - Description param.Field[string] `json:"description"` - HealthCheck param.Field[MagicGRETunnelUpdateParamsHealthCheck] `json:"health_check"` - // Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value - // is 576. - Mtu param.Field[int64] `json:"mtu"` - // Time To Live (TTL) in number of hops of the GRE tunnel. - TTL param.Field[int64] `json:"ttl"` -} - -func (r MagicGRETunnelUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type MagicGRETunnelUpdateParamsHealthCheck struct { - // The direction of the flow of the healthcheck. Either unidirectional, where the - // probe comes to you via the tunnel and the result comes back to Cloudflare via - // the open Internet, or bidirectional where both the probe and result come and go - // via the tunnel. Note in the case of bidirecitonal healthchecks, the target field - // in health_check is ignored as the interface_address is used to send traffic into - // the tunnel. - Direction param.Field[MagicGRETunnelUpdateParamsHealthCheckDirection] `json:"direction"` - // Determines whether to run healthchecks for a tunnel. - Enabled param.Field[bool] `json:"enabled"` - // How frequent the health check is run. The default value is `mid`. - Rate param.Field[MagicGRETunnelUpdateParamsHealthCheckRate] `json:"rate"` - // The destination address in a request type health check. After the healthcheck is - // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded - // to this address. This field defaults to `customer_gre_endpoint address`. This - // field is ignored for bidirectional healthchecks as the interface_address (not - // assigned to the Cloudflare side of the tunnel) is used as the target. - Target param.Field[string] `json:"target"` - // The type of healthcheck to run, reply or request. The default value is `reply`. - Type param.Field[MagicGRETunnelUpdateParamsHealthCheckType] `json:"type"` -} - -func (r MagicGRETunnelUpdateParamsHealthCheck) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The direction of the flow of the healthcheck. Either unidirectional, where the -// probe comes to you via the tunnel and the result comes back to Cloudflare via -// the open Internet, or bidirectional where both the probe and result come and go -// via the tunnel. Note in the case of bidirecitonal healthchecks, the target field -// in health_check is ignored as the interface_address is used to send traffic into -// the tunnel. -type MagicGRETunnelUpdateParamsHealthCheckDirection string - -const ( - MagicGRETunnelUpdateParamsHealthCheckDirectionUnidirectional MagicGRETunnelUpdateParamsHealthCheckDirection = "unidirectional" - MagicGRETunnelUpdateParamsHealthCheckDirectionBidirectional MagicGRETunnelUpdateParamsHealthCheckDirection = "bidirectional" -) - -// How frequent the health check is run. The default value is `mid`. -type MagicGRETunnelUpdateParamsHealthCheckRate string - -const ( - MagicGRETunnelUpdateParamsHealthCheckRateLow MagicGRETunnelUpdateParamsHealthCheckRate = "low" - MagicGRETunnelUpdateParamsHealthCheckRateMid MagicGRETunnelUpdateParamsHealthCheckRate = "mid" - MagicGRETunnelUpdateParamsHealthCheckRateHigh MagicGRETunnelUpdateParamsHealthCheckRate = "high" -) - -// The type of healthcheck to run, reply or request. The default value is `reply`. -type MagicGRETunnelUpdateParamsHealthCheckType string - -const ( - MagicGRETunnelUpdateParamsHealthCheckTypeReply MagicGRETunnelUpdateParamsHealthCheckType = "reply" - MagicGRETunnelUpdateParamsHealthCheckTypeRequest MagicGRETunnelUpdateParamsHealthCheckType = "request" -) - -type MagicGRETunnelUpdateResponseEnvelope struct { - Errors []MagicGRETunnelUpdateResponseEnvelopeErrors `json:"errors,required"` - Messages []MagicGRETunnelUpdateResponseEnvelopeMessages `json:"messages,required"` - Result MagicGRETunnelUpdateResponse `json:"result,required"` - // Whether the API call was successful - Success MagicGRETunnelUpdateResponseEnvelopeSuccess `json:"success,required"` - JSON magicGRETunnelUpdateResponseEnvelopeJSON `json:"-"` -} - -// magicGRETunnelUpdateResponseEnvelopeJSON contains the JSON metadata for the -// struct [MagicGRETunnelUpdateResponseEnvelope] -type magicGRETunnelUpdateResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicGRETunnelUpdateResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicGRETunnelUpdateResponseEnvelopeErrorsJSON `json:"-"` -} - -// magicGRETunnelUpdateResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [MagicGRETunnelUpdateResponseEnvelopeErrors] -type magicGRETunnelUpdateResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicGRETunnelUpdateResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicGRETunnelUpdateResponseEnvelopeMessagesJSON `json:"-"` -} - -// magicGRETunnelUpdateResponseEnvelopeMessagesJSON contains the JSON metadata for -// the struct [MagicGRETunnelUpdateResponseEnvelopeMessages] -type magicGRETunnelUpdateResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type MagicGRETunnelUpdateResponseEnvelopeSuccess bool - -const ( - MagicGRETunnelUpdateResponseEnvelopeSuccessTrue MagicGRETunnelUpdateResponseEnvelopeSuccess = true -) - -type MagicGRETunnelListResponseEnvelope struct { - Errors []MagicGRETunnelListResponseEnvelopeErrors `json:"errors,required"` - Messages []MagicGRETunnelListResponseEnvelopeMessages `json:"messages,required"` - Result MagicGRETunnelListResponse `json:"result,required"` - // Whether the API call was successful - Success MagicGRETunnelListResponseEnvelopeSuccess `json:"success,required"` - JSON magicGRETunnelListResponseEnvelopeJSON `json:"-"` -} - -// magicGRETunnelListResponseEnvelopeJSON contains the JSON metadata for the struct -// [MagicGRETunnelListResponseEnvelope] -type magicGRETunnelListResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicGRETunnelListResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicGRETunnelListResponseEnvelopeErrorsJSON `json:"-"` -} - -// magicGRETunnelListResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [MagicGRETunnelListResponseEnvelopeErrors] -type magicGRETunnelListResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicGRETunnelListResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicGRETunnelListResponseEnvelopeMessagesJSON `json:"-"` -} - -// magicGRETunnelListResponseEnvelopeMessagesJSON contains the JSON metadata for -// the struct [MagicGRETunnelListResponseEnvelopeMessages] -type magicGRETunnelListResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type MagicGRETunnelListResponseEnvelopeSuccess bool - -const ( - MagicGRETunnelListResponseEnvelopeSuccessTrue MagicGRETunnelListResponseEnvelopeSuccess = true -) - -type MagicGRETunnelDeleteResponseEnvelope struct { - Errors []MagicGRETunnelDeleteResponseEnvelopeErrors `json:"errors,required"` - Messages []MagicGRETunnelDeleteResponseEnvelopeMessages `json:"messages,required"` - Result MagicGRETunnelDeleteResponse `json:"result,required"` - // Whether the API call was successful - Success MagicGRETunnelDeleteResponseEnvelopeSuccess `json:"success,required"` - JSON magicGRETunnelDeleteResponseEnvelopeJSON `json:"-"` -} - -// magicGRETunnelDeleteResponseEnvelopeJSON contains the JSON metadata for the -// struct [MagicGRETunnelDeleteResponseEnvelope] -type magicGRETunnelDeleteResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicGRETunnelDeleteResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicGRETunnelDeleteResponseEnvelopeErrorsJSON `json:"-"` -} - -// magicGRETunnelDeleteResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [MagicGRETunnelDeleteResponseEnvelopeErrors] -type magicGRETunnelDeleteResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicGRETunnelDeleteResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicGRETunnelDeleteResponseEnvelopeMessagesJSON `json:"-"` -} - -// magicGRETunnelDeleteResponseEnvelopeMessagesJSON contains the JSON metadata for -// the struct [MagicGRETunnelDeleteResponseEnvelopeMessages] -type magicGRETunnelDeleteResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type MagicGRETunnelDeleteResponseEnvelopeSuccess bool - -const ( - MagicGRETunnelDeleteResponseEnvelopeSuccessTrue MagicGRETunnelDeleteResponseEnvelopeSuccess = true -) - -type MagicGRETunnelGetResponseEnvelope struct { - Errors []MagicGRETunnelGetResponseEnvelopeErrors `json:"errors,required"` - Messages []MagicGRETunnelGetResponseEnvelopeMessages `json:"messages,required"` - Result MagicGRETunnelGetResponse `json:"result,required"` - // Whether the API call was successful - Success MagicGRETunnelGetResponseEnvelopeSuccess `json:"success,required"` - JSON magicGRETunnelGetResponseEnvelopeJSON `json:"-"` -} - -// magicGRETunnelGetResponseEnvelopeJSON contains the JSON metadata for the struct -// [MagicGRETunnelGetResponseEnvelope] -type magicGRETunnelGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicGRETunnelGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicGRETunnelGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// magicGRETunnelGetResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [MagicGRETunnelGetResponseEnvelopeErrors] -type magicGRETunnelGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicGRETunnelGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicGRETunnelGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// magicGRETunnelGetResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [MagicGRETunnelGetResponseEnvelopeMessages] -type magicGRETunnelGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicGRETunnelGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type MagicGRETunnelGetResponseEnvelopeSuccess bool - -const ( - MagicGRETunnelGetResponseEnvelopeSuccessTrue MagicGRETunnelGetResponseEnvelopeSuccess = true -) diff --git a/magicipsectunnel.go b/magicipsectunnel.go deleted file mode 100644 index f858fa6f7c4..00000000000 --- a/magicipsectunnel.go +++ /dev/null @@ -1,942 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// MagicIPSECTunnelService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewMagicIPSECTunnelService] method -// instead. -type MagicIPSECTunnelService struct { - Options []option.RequestOption - PSKGenerates *MagicIPSECTunnelPSKGenerateService -} - -// NewMagicIPSECTunnelService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewMagicIPSECTunnelService(opts ...option.RequestOption) (r *MagicIPSECTunnelService) { - r = &MagicIPSECTunnelService{} - r.Options = opts - r.PSKGenerates = NewMagicIPSECTunnelPSKGenerateService(opts...) - return -} - -// Creates new IPsec tunnels associated with an account. Use `?validate_only=true` -// as an optional query parameter to only run validation without persisting -// changes. -func (r *MagicIPSECTunnelService) New(ctx context.Context, accountIdentifier string, body MagicIPSECTunnelNewParams, opts ...option.RequestOption) (res *MagicIPSECTunnelNewResponse, err error) { - opts = append(r.Options[:], opts...) - var env MagicIPSECTunnelNewResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/ipsec_tunnels", accountIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Updates a specific IPsec tunnel associated with an account. Use -// `?validate_only=true` as an optional query parameter to only run validation -// without persisting changes. -func (r *MagicIPSECTunnelService) Update(ctx context.Context, accountIdentifier string, tunnelIdentifier string, body MagicIPSECTunnelUpdateParams, opts ...option.RequestOption) (res *MagicIPSECTunnelUpdateResponse, err error) { - opts = append(r.Options[:], opts...) - var env MagicIPSECTunnelUpdateResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/ipsec_tunnels/%s", accountIdentifier, tunnelIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Lists IPsec tunnels associated with an account. -func (r *MagicIPSECTunnelService) List(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *MagicIPSECTunnelListResponse, err error) { - opts = append(r.Options[:], opts...) - var env MagicIPSECTunnelListResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/ipsec_tunnels", accountIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Disables and removes a specific static IPsec Tunnel associated with an account. -// Use `?validate_only=true` as an optional query parameter to only run validation -// without persisting changes. -func (r *MagicIPSECTunnelService) Delete(ctx context.Context, accountIdentifier string, tunnelIdentifier string, opts ...option.RequestOption) (res *MagicIPSECTunnelDeleteResponse, err error) { - opts = append(r.Options[:], opts...) - var env MagicIPSECTunnelDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/ipsec_tunnels/%s", accountIdentifier, tunnelIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Lists details for a specific IPsec tunnel. -func (r *MagicIPSECTunnelService) Get(ctx context.Context, accountIdentifier string, tunnelIdentifier string, opts ...option.RequestOption) (res *MagicIPSECTunnelGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env MagicIPSECTunnelGetResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/ipsec_tunnels/%s", accountIdentifier, tunnelIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -type MagicIPSECTunnelNewResponse struct { - IPSECTunnels []MagicIPSECTunnelNewResponseIPSECTunnel `json:"ipsec_tunnels"` - JSON magicIPSECTunnelNewResponseJSON `json:"-"` -} - -// magicIPSECTunnelNewResponseJSON contains the JSON metadata for the struct -// [MagicIPSECTunnelNewResponse] -type magicIPSECTunnelNewResponseJSON struct { - IPSECTunnels apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelNewResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicIPSECTunnelNewResponseIPSECTunnel struct { - // The IP address assigned to the Cloudflare side of the IPsec tunnel. - CloudflareEndpoint string `json:"cloudflare_endpoint,required"` - // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side - // of the tunnel. Select the subnet from the following private IP space: - // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - InterfaceAddress string `json:"interface_address,required"` - // The name of the IPsec tunnel. The name cannot share a name with other tunnels. - Name string `json:"name,required"` - // Tunnel identifier tag. - ID string `json:"id"` - // When `true`, the tunnel can use a null-cipher (`ENCR_NULL`) in the ESP tunnel - // (Phase 2). - AllowNullCipher bool `json:"allow_null_cipher"` - // The date and time the tunnel was created. - CreatedOn time.Time `json:"created_on" format:"date-time"` - // The IP address assigned to the customer side of the IPsec tunnel. - CustomerEndpoint string `json:"customer_endpoint"` - // An optional description forthe IPsec tunnel. - Description string `json:"description"` - // The date and time the tunnel was last modified. - ModifiedOn time.Time `json:"modified_on" format:"date-time"` - // The PSK metadata that includes when the PSK was generated. - PSKMetadata MagicIPSECTunnelNewResponseIPSECTunnelsPSKMetadata `json:"psk_metadata"` - // If `true`, then IPsec replay protection will be supported in the - // Cloudflare-to-customer direction. - ReplayProtection bool `json:"replay_protection"` - TunnelHealthCheck MagicIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheck `json:"tunnel_health_check"` - JSON magicIPSECTunnelNewResponseIPSECTunnelJSON `json:"-"` -} - -// magicIPSECTunnelNewResponseIPSECTunnelJSON contains the JSON metadata for the -// struct [MagicIPSECTunnelNewResponseIPSECTunnel] -type magicIPSECTunnelNewResponseIPSECTunnelJSON struct { - CloudflareEndpoint apijson.Field - InterfaceAddress apijson.Field - Name apijson.Field - ID apijson.Field - AllowNullCipher apijson.Field - CreatedOn apijson.Field - CustomerEndpoint apijson.Field - Description apijson.Field - ModifiedOn apijson.Field - PSKMetadata apijson.Field - ReplayProtection apijson.Field - TunnelHealthCheck apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelNewResponseIPSECTunnel) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// The PSK metadata that includes when the PSK was generated. -type MagicIPSECTunnelNewResponseIPSECTunnelsPSKMetadata struct { - // The date and time the tunnel was last modified. - LastGeneratedOn time.Time `json:"last_generated_on" format:"date-time"` - JSON magicIPSECTunnelNewResponseIPSECTunnelsPSKMetadataJSON `json:"-"` -} - -// magicIPSECTunnelNewResponseIPSECTunnelsPSKMetadataJSON contains the JSON -// metadata for the struct [MagicIPSECTunnelNewResponseIPSECTunnelsPSKMetadata] -type magicIPSECTunnelNewResponseIPSECTunnelsPSKMetadataJSON struct { - LastGeneratedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelNewResponseIPSECTunnelsPSKMetadata) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheck struct { - // Determines whether to run healthchecks for a tunnel. - Enabled bool `json:"enabled"` - // How frequent the health check is run. The default value is `mid`. - Rate MagicIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckRate `json:"rate"` - // The destination address in a request type health check. After the healthcheck is - // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded - // to this address. This field defaults to `customer_gre_endpoint address`. - Target string `json:"target"` - // The type of healthcheck to run, reply or request. The default value is `reply`. - Type MagicIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckType `json:"type"` - JSON magicIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckJSON `json:"-"` -} - -// magicIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckJSON contains the JSON -// metadata for the struct -// [MagicIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheck] -type magicIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckJSON struct { - Enabled apijson.Field - Rate apijson.Field - Target apijson.Field - Type apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheck) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// How frequent the health check is run. The default value is `mid`. -type MagicIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckRate string - -const ( - MagicIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckRateLow MagicIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckRate = "low" - MagicIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckRateMid MagicIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckRate = "mid" - MagicIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckRateHigh MagicIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckRate = "high" -) - -// The type of healthcheck to run, reply or request. The default value is `reply`. -type MagicIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckType string - -const ( - MagicIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckTypeReply MagicIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckType = "reply" - MagicIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckTypeRequest MagicIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckType = "request" -) - -type MagicIPSECTunnelUpdateResponse struct { - Modified bool `json:"modified"` - ModifiedIPSECTunnel interface{} `json:"modified_ipsec_tunnel"` - JSON magicIPSECTunnelUpdateResponseJSON `json:"-"` -} - -// magicIPSECTunnelUpdateResponseJSON contains the JSON metadata for the struct -// [MagicIPSECTunnelUpdateResponse] -type magicIPSECTunnelUpdateResponseJSON struct { - Modified apijson.Field - ModifiedIPSECTunnel apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelUpdateResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicIPSECTunnelListResponse struct { - IPSECTunnels []MagicIPSECTunnelListResponseIPSECTunnel `json:"ipsec_tunnels"` - JSON magicIPSECTunnelListResponseJSON `json:"-"` -} - -// magicIPSECTunnelListResponseJSON contains the JSON metadata for the struct -// [MagicIPSECTunnelListResponse] -type magicIPSECTunnelListResponseJSON struct { - IPSECTunnels apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicIPSECTunnelListResponseIPSECTunnel struct { - // The IP address assigned to the Cloudflare side of the IPsec tunnel. - CloudflareEndpoint string `json:"cloudflare_endpoint,required"` - // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side - // of the tunnel. Select the subnet from the following private IP space: - // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - InterfaceAddress string `json:"interface_address,required"` - // The name of the IPsec tunnel. The name cannot share a name with other tunnels. - Name string `json:"name,required"` - // Tunnel identifier tag. - ID string `json:"id"` - // When `true`, the tunnel can use a null-cipher (`ENCR_NULL`) in the ESP tunnel - // (Phase 2). - AllowNullCipher bool `json:"allow_null_cipher"` - // The date and time the tunnel was created. - CreatedOn time.Time `json:"created_on" format:"date-time"` - // The IP address assigned to the customer side of the IPsec tunnel. - CustomerEndpoint string `json:"customer_endpoint"` - // An optional description forthe IPsec tunnel. - Description string `json:"description"` - // The date and time the tunnel was last modified. - ModifiedOn time.Time `json:"modified_on" format:"date-time"` - // The PSK metadata that includes when the PSK was generated. - PSKMetadata MagicIPSECTunnelListResponseIPSECTunnelsPSKMetadata `json:"psk_metadata"` - // If `true`, then IPsec replay protection will be supported in the - // Cloudflare-to-customer direction. - ReplayProtection bool `json:"replay_protection"` - TunnelHealthCheck MagicIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheck `json:"tunnel_health_check"` - JSON magicIPSECTunnelListResponseIPSECTunnelJSON `json:"-"` -} - -// magicIPSECTunnelListResponseIPSECTunnelJSON contains the JSON metadata for the -// struct [MagicIPSECTunnelListResponseIPSECTunnel] -type magicIPSECTunnelListResponseIPSECTunnelJSON struct { - CloudflareEndpoint apijson.Field - InterfaceAddress apijson.Field - Name apijson.Field - ID apijson.Field - AllowNullCipher apijson.Field - CreatedOn apijson.Field - CustomerEndpoint apijson.Field - Description apijson.Field - ModifiedOn apijson.Field - PSKMetadata apijson.Field - ReplayProtection apijson.Field - TunnelHealthCheck apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelListResponseIPSECTunnel) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// The PSK metadata that includes when the PSK was generated. -type MagicIPSECTunnelListResponseIPSECTunnelsPSKMetadata struct { - // The date and time the tunnel was last modified. - LastGeneratedOn time.Time `json:"last_generated_on" format:"date-time"` - JSON magicIPSECTunnelListResponseIPSECTunnelsPSKMetadataJSON `json:"-"` -} - -// magicIPSECTunnelListResponseIPSECTunnelsPSKMetadataJSON contains the JSON -// metadata for the struct [MagicIPSECTunnelListResponseIPSECTunnelsPSKMetadata] -type magicIPSECTunnelListResponseIPSECTunnelsPSKMetadataJSON struct { - LastGeneratedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelListResponseIPSECTunnelsPSKMetadata) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheck struct { - // Determines whether to run healthchecks for a tunnel. - Enabled bool `json:"enabled"` - // How frequent the health check is run. The default value is `mid`. - Rate MagicIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckRate `json:"rate"` - // The destination address in a request type health check. After the healthcheck is - // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded - // to this address. This field defaults to `customer_gre_endpoint address`. - Target string `json:"target"` - // The type of healthcheck to run, reply or request. The default value is `reply`. - Type MagicIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckType `json:"type"` - JSON magicIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckJSON `json:"-"` -} - -// magicIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckJSON contains the JSON -// metadata for the struct -// [MagicIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheck] -type magicIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckJSON struct { - Enabled apijson.Field - Rate apijson.Field - Target apijson.Field - Type apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheck) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// How frequent the health check is run. The default value is `mid`. -type MagicIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckRate string - -const ( - MagicIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckRateLow MagicIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckRate = "low" - MagicIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckRateMid MagicIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckRate = "mid" - MagicIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckRateHigh MagicIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckRate = "high" -) - -// The type of healthcheck to run, reply or request. The default value is `reply`. -type MagicIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckType string - -const ( - MagicIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckTypeReply MagicIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckType = "reply" - MagicIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckTypeRequest MagicIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckType = "request" -) - -type MagicIPSECTunnelDeleteResponse struct { - Deleted bool `json:"deleted"` - DeletedIPSECTunnel interface{} `json:"deleted_ipsec_tunnel"` - JSON magicIPSECTunnelDeleteResponseJSON `json:"-"` -} - -// magicIPSECTunnelDeleteResponseJSON contains the JSON metadata for the struct -// [MagicIPSECTunnelDeleteResponse] -type magicIPSECTunnelDeleteResponseJSON struct { - Deleted apijson.Field - DeletedIPSECTunnel apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelDeleteResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicIPSECTunnelGetResponse struct { - IPSECTunnel interface{} `json:"ipsec_tunnel"` - JSON magicIPSECTunnelGetResponseJSON `json:"-"` -} - -// magicIPSECTunnelGetResponseJSON contains the JSON metadata for the struct -// [MagicIPSECTunnelGetResponse] -type magicIPSECTunnelGetResponseJSON struct { - IPSECTunnel apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicIPSECTunnelNewParams struct { - // The IP address assigned to the Cloudflare side of the IPsec tunnel. - CloudflareEndpoint param.Field[string] `json:"cloudflare_endpoint,required"` - // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side - // of the tunnel. Select the subnet from the following private IP space: - // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - InterfaceAddress param.Field[string] `json:"interface_address,required"` - // The name of the IPsec tunnel. The name cannot share a name with other tunnels. - Name param.Field[string] `json:"name,required"` - // The IP address assigned to the customer side of the IPsec tunnel. - CustomerEndpoint param.Field[string] `json:"customer_endpoint"` - // An optional description forthe IPsec tunnel. - Description param.Field[string] `json:"description"` - HealthCheck param.Field[MagicIPSECTunnelNewParamsHealthCheck] `json:"health_check"` - // A randomly generated or provided string for use in the IPsec tunnel. - PSK param.Field[string] `json:"psk"` - // If `true`, then IPsec replay protection will be supported in the - // Cloudflare-to-customer direction. - ReplayProtection param.Field[bool] `json:"replay_protection"` -} - -func (r MagicIPSECTunnelNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type MagicIPSECTunnelNewParamsHealthCheck struct { - // The direction of the flow of the healthcheck. Either unidirectional, where the - // probe comes to you via the tunnel and the result comes back to Cloudflare via - // the open Internet, or bidirectional where both the probe and result come and go - // via the tunnel. Note in the case of bidirecitonal healthchecks, the target field - // in health_check is ignored as the interface_address is used to send traffic into - // the tunnel. - Direction param.Field[MagicIPSECTunnelNewParamsHealthCheckDirection] `json:"direction"` - // Determines whether to run healthchecks for a tunnel. - Enabled param.Field[bool] `json:"enabled"` - // How frequent the health check is run. The default value is `mid`. - Rate param.Field[MagicIPSECTunnelNewParamsHealthCheckRate] `json:"rate"` - // The destination address in a request type health check. After the healthcheck is - // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded - // to this address. This field defaults to `customer_gre_endpoint address`. This - // field is ignored for bidirectional healthchecks as the interface_address (not - // assigned to the Cloudflare side of the tunnel) is used as the target. - Target param.Field[string] `json:"target"` - // The type of healthcheck to run, reply or request. The default value is `reply`. - Type param.Field[MagicIPSECTunnelNewParamsHealthCheckType] `json:"type"` -} - -func (r MagicIPSECTunnelNewParamsHealthCheck) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The direction of the flow of the healthcheck. Either unidirectional, where the -// probe comes to you via the tunnel and the result comes back to Cloudflare via -// the open Internet, or bidirectional where both the probe and result come and go -// via the tunnel. Note in the case of bidirecitonal healthchecks, the target field -// in health_check is ignored as the interface_address is used to send traffic into -// the tunnel. -type MagicIPSECTunnelNewParamsHealthCheckDirection string - -const ( - MagicIPSECTunnelNewParamsHealthCheckDirectionUnidirectional MagicIPSECTunnelNewParamsHealthCheckDirection = "unidirectional" - MagicIPSECTunnelNewParamsHealthCheckDirectionBidirectional MagicIPSECTunnelNewParamsHealthCheckDirection = "bidirectional" -) - -// How frequent the health check is run. The default value is `mid`. -type MagicIPSECTunnelNewParamsHealthCheckRate string - -const ( - MagicIPSECTunnelNewParamsHealthCheckRateLow MagicIPSECTunnelNewParamsHealthCheckRate = "low" - MagicIPSECTunnelNewParamsHealthCheckRateMid MagicIPSECTunnelNewParamsHealthCheckRate = "mid" - MagicIPSECTunnelNewParamsHealthCheckRateHigh MagicIPSECTunnelNewParamsHealthCheckRate = "high" -) - -// The type of healthcheck to run, reply or request. The default value is `reply`. -type MagicIPSECTunnelNewParamsHealthCheckType string - -const ( - MagicIPSECTunnelNewParamsHealthCheckTypeReply MagicIPSECTunnelNewParamsHealthCheckType = "reply" - MagicIPSECTunnelNewParamsHealthCheckTypeRequest MagicIPSECTunnelNewParamsHealthCheckType = "request" -) - -type MagicIPSECTunnelNewResponseEnvelope struct { - Errors []MagicIPSECTunnelNewResponseEnvelopeErrors `json:"errors,required"` - Messages []MagicIPSECTunnelNewResponseEnvelopeMessages `json:"messages,required"` - Result MagicIPSECTunnelNewResponse `json:"result,required"` - // Whether the API call was successful - Success MagicIPSECTunnelNewResponseEnvelopeSuccess `json:"success,required"` - JSON magicIPSECTunnelNewResponseEnvelopeJSON `json:"-"` -} - -// magicIPSECTunnelNewResponseEnvelopeJSON contains the JSON metadata for the -// struct [MagicIPSECTunnelNewResponseEnvelope] -type magicIPSECTunnelNewResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicIPSECTunnelNewResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicIPSECTunnelNewResponseEnvelopeErrorsJSON `json:"-"` -} - -// magicIPSECTunnelNewResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [MagicIPSECTunnelNewResponseEnvelopeErrors] -type magicIPSECTunnelNewResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicIPSECTunnelNewResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicIPSECTunnelNewResponseEnvelopeMessagesJSON `json:"-"` -} - -// magicIPSECTunnelNewResponseEnvelopeMessagesJSON contains the JSON metadata for -// the struct [MagicIPSECTunnelNewResponseEnvelopeMessages] -type magicIPSECTunnelNewResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type MagicIPSECTunnelNewResponseEnvelopeSuccess bool - -const ( - MagicIPSECTunnelNewResponseEnvelopeSuccessTrue MagicIPSECTunnelNewResponseEnvelopeSuccess = true -) - -type MagicIPSECTunnelUpdateParams struct { - // The IP address assigned to the Cloudflare side of the IPsec tunnel. - CloudflareEndpoint param.Field[string] `json:"cloudflare_endpoint,required"` - // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side - // of the tunnel. Select the subnet from the following private IP space: - // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. - InterfaceAddress param.Field[string] `json:"interface_address,required"` - // The name of the IPsec tunnel. The name cannot share a name with other tunnels. - Name param.Field[string] `json:"name,required"` - // The IP address assigned to the customer side of the IPsec tunnel. - CustomerEndpoint param.Field[string] `json:"customer_endpoint"` - // An optional description forthe IPsec tunnel. - Description param.Field[string] `json:"description"` - HealthCheck param.Field[MagicIPSECTunnelUpdateParamsHealthCheck] `json:"health_check"` - // A randomly generated or provided string for use in the IPsec tunnel. - PSK param.Field[string] `json:"psk"` - // If `true`, then IPsec replay protection will be supported in the - // Cloudflare-to-customer direction. - ReplayProtection param.Field[bool] `json:"replay_protection"` -} - -func (r MagicIPSECTunnelUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type MagicIPSECTunnelUpdateParamsHealthCheck struct { - // The direction of the flow of the healthcheck. Either unidirectional, where the - // probe comes to you via the tunnel and the result comes back to Cloudflare via - // the open Internet, or bidirectional where both the probe and result come and go - // via the tunnel. Note in the case of bidirecitonal healthchecks, the target field - // in health_check is ignored as the interface_address is used to send traffic into - // the tunnel. - Direction param.Field[MagicIPSECTunnelUpdateParamsHealthCheckDirection] `json:"direction"` - // Determines whether to run healthchecks for a tunnel. - Enabled param.Field[bool] `json:"enabled"` - // How frequent the health check is run. The default value is `mid`. - Rate param.Field[MagicIPSECTunnelUpdateParamsHealthCheckRate] `json:"rate"` - // The destination address in a request type health check. After the healthcheck is - // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded - // to this address. This field defaults to `customer_gre_endpoint address`. This - // field is ignored for bidirectional healthchecks as the interface_address (not - // assigned to the Cloudflare side of the tunnel) is used as the target. - Target param.Field[string] `json:"target"` - // The type of healthcheck to run, reply or request. The default value is `reply`. - Type param.Field[MagicIPSECTunnelUpdateParamsHealthCheckType] `json:"type"` -} - -func (r MagicIPSECTunnelUpdateParamsHealthCheck) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The direction of the flow of the healthcheck. Either unidirectional, where the -// probe comes to you via the tunnel and the result comes back to Cloudflare via -// the open Internet, or bidirectional where both the probe and result come and go -// via the tunnel. Note in the case of bidirecitonal healthchecks, the target field -// in health_check is ignored as the interface_address is used to send traffic into -// the tunnel. -type MagicIPSECTunnelUpdateParamsHealthCheckDirection string - -const ( - MagicIPSECTunnelUpdateParamsHealthCheckDirectionUnidirectional MagicIPSECTunnelUpdateParamsHealthCheckDirection = "unidirectional" - MagicIPSECTunnelUpdateParamsHealthCheckDirectionBidirectional MagicIPSECTunnelUpdateParamsHealthCheckDirection = "bidirectional" -) - -// How frequent the health check is run. The default value is `mid`. -type MagicIPSECTunnelUpdateParamsHealthCheckRate string - -const ( - MagicIPSECTunnelUpdateParamsHealthCheckRateLow MagicIPSECTunnelUpdateParamsHealthCheckRate = "low" - MagicIPSECTunnelUpdateParamsHealthCheckRateMid MagicIPSECTunnelUpdateParamsHealthCheckRate = "mid" - MagicIPSECTunnelUpdateParamsHealthCheckRateHigh MagicIPSECTunnelUpdateParamsHealthCheckRate = "high" -) - -// The type of healthcheck to run, reply or request. The default value is `reply`. -type MagicIPSECTunnelUpdateParamsHealthCheckType string - -const ( - MagicIPSECTunnelUpdateParamsHealthCheckTypeReply MagicIPSECTunnelUpdateParamsHealthCheckType = "reply" - MagicIPSECTunnelUpdateParamsHealthCheckTypeRequest MagicIPSECTunnelUpdateParamsHealthCheckType = "request" -) - -type MagicIPSECTunnelUpdateResponseEnvelope struct { - Errors []MagicIPSECTunnelUpdateResponseEnvelopeErrors `json:"errors,required"` - Messages []MagicIPSECTunnelUpdateResponseEnvelopeMessages `json:"messages,required"` - Result MagicIPSECTunnelUpdateResponse `json:"result,required"` - // Whether the API call was successful - Success MagicIPSECTunnelUpdateResponseEnvelopeSuccess `json:"success,required"` - JSON magicIPSECTunnelUpdateResponseEnvelopeJSON `json:"-"` -} - -// magicIPSECTunnelUpdateResponseEnvelopeJSON contains the JSON metadata for the -// struct [MagicIPSECTunnelUpdateResponseEnvelope] -type magicIPSECTunnelUpdateResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicIPSECTunnelUpdateResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicIPSECTunnelUpdateResponseEnvelopeErrorsJSON `json:"-"` -} - -// magicIPSECTunnelUpdateResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [MagicIPSECTunnelUpdateResponseEnvelopeErrors] -type magicIPSECTunnelUpdateResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicIPSECTunnelUpdateResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicIPSECTunnelUpdateResponseEnvelopeMessagesJSON `json:"-"` -} - -// magicIPSECTunnelUpdateResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [MagicIPSECTunnelUpdateResponseEnvelopeMessages] -type magicIPSECTunnelUpdateResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type MagicIPSECTunnelUpdateResponseEnvelopeSuccess bool - -const ( - MagicIPSECTunnelUpdateResponseEnvelopeSuccessTrue MagicIPSECTunnelUpdateResponseEnvelopeSuccess = true -) - -type MagicIPSECTunnelListResponseEnvelope struct { - Errors []MagicIPSECTunnelListResponseEnvelopeErrors `json:"errors,required"` - Messages []MagicIPSECTunnelListResponseEnvelopeMessages `json:"messages,required"` - Result MagicIPSECTunnelListResponse `json:"result,required"` - // Whether the API call was successful - Success MagicIPSECTunnelListResponseEnvelopeSuccess `json:"success,required"` - JSON magicIPSECTunnelListResponseEnvelopeJSON `json:"-"` -} - -// magicIPSECTunnelListResponseEnvelopeJSON contains the JSON metadata for the -// struct [MagicIPSECTunnelListResponseEnvelope] -type magicIPSECTunnelListResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicIPSECTunnelListResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicIPSECTunnelListResponseEnvelopeErrorsJSON `json:"-"` -} - -// magicIPSECTunnelListResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [MagicIPSECTunnelListResponseEnvelopeErrors] -type magicIPSECTunnelListResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicIPSECTunnelListResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicIPSECTunnelListResponseEnvelopeMessagesJSON `json:"-"` -} - -// magicIPSECTunnelListResponseEnvelopeMessagesJSON contains the JSON metadata for -// the struct [MagicIPSECTunnelListResponseEnvelopeMessages] -type magicIPSECTunnelListResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type MagicIPSECTunnelListResponseEnvelopeSuccess bool - -const ( - MagicIPSECTunnelListResponseEnvelopeSuccessTrue MagicIPSECTunnelListResponseEnvelopeSuccess = true -) - -type MagicIPSECTunnelDeleteResponseEnvelope struct { - Errors []MagicIPSECTunnelDeleteResponseEnvelopeErrors `json:"errors,required"` - Messages []MagicIPSECTunnelDeleteResponseEnvelopeMessages `json:"messages,required"` - Result MagicIPSECTunnelDeleteResponse `json:"result,required"` - // Whether the API call was successful - Success MagicIPSECTunnelDeleteResponseEnvelopeSuccess `json:"success,required"` - JSON magicIPSECTunnelDeleteResponseEnvelopeJSON `json:"-"` -} - -// magicIPSECTunnelDeleteResponseEnvelopeJSON contains the JSON metadata for the -// struct [MagicIPSECTunnelDeleteResponseEnvelope] -type magicIPSECTunnelDeleteResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicIPSECTunnelDeleteResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicIPSECTunnelDeleteResponseEnvelopeErrorsJSON `json:"-"` -} - -// magicIPSECTunnelDeleteResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [MagicIPSECTunnelDeleteResponseEnvelopeErrors] -type magicIPSECTunnelDeleteResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicIPSECTunnelDeleteResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicIPSECTunnelDeleteResponseEnvelopeMessagesJSON `json:"-"` -} - -// magicIPSECTunnelDeleteResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [MagicIPSECTunnelDeleteResponseEnvelopeMessages] -type magicIPSECTunnelDeleteResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type MagicIPSECTunnelDeleteResponseEnvelopeSuccess bool - -const ( - MagicIPSECTunnelDeleteResponseEnvelopeSuccessTrue MagicIPSECTunnelDeleteResponseEnvelopeSuccess = true -) - -type MagicIPSECTunnelGetResponseEnvelope struct { - Errors []MagicIPSECTunnelGetResponseEnvelopeErrors `json:"errors,required"` - Messages []MagicIPSECTunnelGetResponseEnvelopeMessages `json:"messages,required"` - Result MagicIPSECTunnelGetResponse `json:"result,required"` - // Whether the API call was successful - Success MagicIPSECTunnelGetResponseEnvelopeSuccess `json:"success,required"` - JSON magicIPSECTunnelGetResponseEnvelopeJSON `json:"-"` -} - -// magicIPSECTunnelGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [MagicIPSECTunnelGetResponseEnvelope] -type magicIPSECTunnelGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicIPSECTunnelGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicIPSECTunnelGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// magicIPSECTunnelGetResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [MagicIPSECTunnelGetResponseEnvelopeErrors] -type magicIPSECTunnelGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicIPSECTunnelGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicIPSECTunnelGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// magicIPSECTunnelGetResponseEnvelopeMessagesJSON contains the JSON metadata for -// the struct [MagicIPSECTunnelGetResponseEnvelopeMessages] -type magicIPSECTunnelGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type MagicIPSECTunnelGetResponseEnvelopeSuccess bool - -const ( - MagicIPSECTunnelGetResponseEnvelopeSuccessTrue MagicIPSECTunnelGetResponseEnvelopeSuccess = true -) diff --git a/magicipsectunnelpskgenerate.go b/magicipsectunnelpskgenerate.go deleted file mode 100644 index 8c75c2739b0..00000000000 --- a/magicipsectunnelpskgenerate.go +++ /dev/null @@ -1,161 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// MagicIPSECTunnelPSKGenerateService contains methods and other services that help -// with interacting with the cloudflare API. Note, unlike clients, this service -// does not read variables from the environment automatically. You should not -// instantiate this service directly, and instead use the -// [NewMagicIPSECTunnelPSKGenerateService] method instead. -type MagicIPSECTunnelPSKGenerateService struct { - Options []option.RequestOption -} - -// NewMagicIPSECTunnelPSKGenerateService generates a new service that applies the -// given options to each request. These options are applied after the parent -// client's options (if there is one), and before any request-specific options. -func NewMagicIPSECTunnelPSKGenerateService(opts ...option.RequestOption) (r *MagicIPSECTunnelPSKGenerateService) { - r = &MagicIPSECTunnelPSKGenerateService{} - r.Options = opts - return -} - -// Generates a Pre Shared Key for a specific IPsec tunnel used in the IKE session. -// Use `?validate_only=true` as an optional query parameter to only run validation -// without persisting changes. After a PSK is generated, the PSK is immediately -// persisted to Cloudflare's edge and cannot be retrieved later. Note the PSK in a -// safe place. -func (r *MagicIPSECTunnelPSKGenerateService) New(ctx context.Context, accountIdentifier string, tunnelIdentifier string, opts ...option.RequestOption) (res *MagicIPSECTunnelPSKGenerateNewResponse, err error) { - opts = append(r.Options[:], opts...) - var env MagicIPSECTunnelPSKGenerateNewResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/ipsec_tunnels/%s/psk_generate", accountIdentifier, tunnelIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -type MagicIPSECTunnelPSKGenerateNewResponse struct { - // Identifier - IPSECTunnelID string `json:"ipsec_tunnel_id"` - // A randomly generated or provided string for use in the IPsec tunnel. - PSK string `json:"psk"` - // The PSK metadata that includes when the PSK was generated. - PSKMetadata MagicIPSECTunnelPSKGenerateNewResponsePSKMetadata `json:"psk_metadata"` - JSON magicIPSECTunnelPSKGenerateNewResponseJSON `json:"-"` -} - -// magicIPSECTunnelPSKGenerateNewResponseJSON contains the JSON metadata for the -// struct [MagicIPSECTunnelPSKGenerateNewResponse] -type magicIPSECTunnelPSKGenerateNewResponseJSON struct { - IPSECTunnelID apijson.Field - PSK apijson.Field - PSKMetadata apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelPSKGenerateNewResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// The PSK metadata that includes when the PSK was generated. -type MagicIPSECTunnelPSKGenerateNewResponsePSKMetadata struct { - // The date and time the tunnel was last modified. - LastGeneratedOn time.Time `json:"last_generated_on" format:"date-time"` - JSON magicIPSECTunnelPSKGenerateNewResponsePSKMetadataJSON `json:"-"` -} - -// magicIPSECTunnelPSKGenerateNewResponsePSKMetadataJSON contains the JSON metadata -// for the struct [MagicIPSECTunnelPSKGenerateNewResponsePSKMetadata] -type magicIPSECTunnelPSKGenerateNewResponsePSKMetadataJSON struct { - LastGeneratedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelPSKGenerateNewResponsePSKMetadata) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicIPSECTunnelPSKGenerateNewResponseEnvelope struct { - Errors []MagicIPSECTunnelPSKGenerateNewResponseEnvelopeErrors `json:"errors,required"` - Messages []MagicIPSECTunnelPSKGenerateNewResponseEnvelopeMessages `json:"messages,required"` - Result MagicIPSECTunnelPSKGenerateNewResponse `json:"result,required"` - // Whether the API call was successful - Success MagicIPSECTunnelPSKGenerateNewResponseEnvelopeSuccess `json:"success,required"` - JSON magicIPSECTunnelPSKGenerateNewResponseEnvelopeJSON `json:"-"` -} - -// magicIPSECTunnelPSKGenerateNewResponseEnvelopeJSON contains the JSON metadata -// for the struct [MagicIPSECTunnelPSKGenerateNewResponseEnvelope] -type magicIPSECTunnelPSKGenerateNewResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelPSKGenerateNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicIPSECTunnelPSKGenerateNewResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicIPSECTunnelPSKGenerateNewResponseEnvelopeErrorsJSON `json:"-"` -} - -// magicIPSECTunnelPSKGenerateNewResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [MagicIPSECTunnelPSKGenerateNewResponseEnvelopeErrors] -type magicIPSECTunnelPSKGenerateNewResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelPSKGenerateNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicIPSECTunnelPSKGenerateNewResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicIPSECTunnelPSKGenerateNewResponseEnvelopeMessagesJSON `json:"-"` -} - -// magicIPSECTunnelPSKGenerateNewResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [MagicIPSECTunnelPSKGenerateNewResponseEnvelopeMessages] -type magicIPSECTunnelPSKGenerateNewResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicIPSECTunnelPSKGenerateNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type MagicIPSECTunnelPSKGenerateNewResponseEnvelopeSuccess bool - -const ( - MagicIPSECTunnelPSKGenerateNewResponseEnvelopeSuccessTrue MagicIPSECTunnelPSKGenerateNewResponseEnvelopeSuccess = true -) diff --git a/magicroute.go b/magicroute.go deleted file mode 100644 index 90706641f59..00000000000 --- a/magicroute.go +++ /dev/null @@ -1,816 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// MagicRouteService contains methods and other services that help with interacting -// with the cloudflare API. Note, unlike clients, this service does not read -// variables from the environment automatically. You should not instantiate this -// service directly, and instead use the [NewMagicRouteService] method instead. -type MagicRouteService struct { - Options []option.RequestOption -} - -// NewMagicRouteService generates a new service that applies the given options to -// each request. These options are applied after the parent client's options (if -// there is one), and before any request-specific options. -func NewMagicRouteService(opts ...option.RequestOption) (r *MagicRouteService) { - r = &MagicRouteService{} - r.Options = opts - return -} - -// Creates a new Magic static route. Use `?validate_only=true` as an optional query -// parameter to run validation only without persisting changes. -func (r *MagicRouteService) New(ctx context.Context, accountIdentifier string, body MagicRouteNewParams, opts ...option.RequestOption) (res *MagicRouteNewResponse, err error) { - opts = append(r.Options[:], opts...) - var env MagicRouteNewResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/routes", accountIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Update a specific Magic static route. Use `?validate_only=true` as an optional -// query parameter to run validation only without persisting changes. -func (r *MagicRouteService) Update(ctx context.Context, accountIdentifier string, routeIdentifier string, body MagicRouteUpdateParams, opts ...option.RequestOption) (res *MagicRouteUpdateResponse, err error) { - opts = append(r.Options[:], opts...) - var env MagicRouteUpdateResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/routes/%s", accountIdentifier, routeIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// List all Magic static routes. -func (r *MagicRouteService) List(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *MagicRouteListResponse, err error) { - opts = append(r.Options[:], opts...) - var env MagicRouteListResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/routes", accountIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Disable and remove a specific Magic static route. -func (r *MagicRouteService) Delete(ctx context.Context, accountIdentifier string, routeIdentifier string, opts ...option.RequestOption) (res *MagicRouteDeleteResponse, err error) { - opts = append(r.Options[:], opts...) - var env MagicRouteDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/routes/%s", accountIdentifier, routeIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Delete multiple Magic static routes. -func (r *MagicRouteService) Empty(ctx context.Context, accountIdentifier string, body MagicRouteEmptyParams, opts ...option.RequestOption) (res *MagicRouteEmptyResponse, err error) { - opts = append(r.Options[:], opts...) - var env MagicRouteEmptyResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/routes", accountIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Get a specific Magic static route. -func (r *MagicRouteService) Get(ctx context.Context, accountIdentifier string, routeIdentifier string, opts ...option.RequestOption) (res *MagicRouteGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env MagicRouteGetResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/routes/%s", accountIdentifier, routeIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -type MagicRouteNewResponse struct { - Routes []MagicRouteNewResponseRoute `json:"routes"` - JSON magicRouteNewResponseJSON `json:"-"` -} - -// magicRouteNewResponseJSON contains the JSON metadata for the struct -// [MagicRouteNewResponse] -type magicRouteNewResponseJSON struct { - Routes apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteNewResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicRouteNewResponseRoute struct { - // The next-hop IP Address for the static route. - Nexthop string `json:"nexthop,required"` - // IP Prefix in Classless Inter-Domain Routing format. - Prefix string `json:"prefix,required"` - // Priority of the static route. - Priority int64 `json:"priority,required"` - // Identifier - ID string `json:"id"` - // When the route was created. - CreatedOn time.Time `json:"created_on" format:"date-time"` - // An optional human provided description of the static route. - Description string `json:"description"` - // When the route was last modified. - ModifiedOn time.Time `json:"modified_on" format:"date-time"` - // Used only for ECMP routes. - Scope MagicRouteNewResponseRoutesScope `json:"scope"` - // Optional weight of the ECMP scope - if provided. - Weight int64 `json:"weight"` - JSON magicRouteNewResponseRouteJSON `json:"-"` -} - -// magicRouteNewResponseRouteJSON contains the JSON metadata for the struct -// [MagicRouteNewResponseRoute] -type magicRouteNewResponseRouteJSON struct { - Nexthop apijson.Field - Prefix apijson.Field - Priority apijson.Field - ID apijson.Field - CreatedOn apijson.Field - Description apijson.Field - ModifiedOn apijson.Field - Scope apijson.Field - Weight apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteNewResponseRoute) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Used only for ECMP routes. -type MagicRouteNewResponseRoutesScope struct { - // List of colo names for the ECMP scope. - ColoNames []string `json:"colo_names"` - // List of colo regions for the ECMP scope. - ColoRegions []string `json:"colo_regions"` - JSON magicRouteNewResponseRoutesScopeJSON `json:"-"` -} - -// magicRouteNewResponseRoutesScopeJSON contains the JSON metadata for the struct -// [MagicRouteNewResponseRoutesScope] -type magicRouteNewResponseRoutesScopeJSON struct { - ColoNames apijson.Field - ColoRegions apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteNewResponseRoutesScope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicRouteUpdateResponse struct { - Modified bool `json:"modified"` - ModifiedRoute interface{} `json:"modified_route"` - JSON magicRouteUpdateResponseJSON `json:"-"` -} - -// magicRouteUpdateResponseJSON contains the JSON metadata for the struct -// [MagicRouteUpdateResponse] -type magicRouteUpdateResponseJSON struct { - Modified apijson.Field - ModifiedRoute apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteUpdateResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicRouteListResponse struct { - Routes []MagicRouteListResponseRoute `json:"routes"` - JSON magicRouteListResponseJSON `json:"-"` -} - -// magicRouteListResponseJSON contains the JSON metadata for the struct -// [MagicRouteListResponse] -type magicRouteListResponseJSON struct { - Routes apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicRouteListResponseRoute struct { - // The next-hop IP Address for the static route. - Nexthop string `json:"nexthop,required"` - // IP Prefix in Classless Inter-Domain Routing format. - Prefix string `json:"prefix,required"` - // Priority of the static route. - Priority int64 `json:"priority,required"` - // Identifier - ID string `json:"id"` - // When the route was created. - CreatedOn time.Time `json:"created_on" format:"date-time"` - // An optional human provided description of the static route. - Description string `json:"description"` - // When the route was last modified. - ModifiedOn time.Time `json:"modified_on" format:"date-time"` - // Used only for ECMP routes. - Scope MagicRouteListResponseRoutesScope `json:"scope"` - // Optional weight of the ECMP scope - if provided. - Weight int64 `json:"weight"` - JSON magicRouteListResponseRouteJSON `json:"-"` -} - -// magicRouteListResponseRouteJSON contains the JSON metadata for the struct -// [MagicRouteListResponseRoute] -type magicRouteListResponseRouteJSON struct { - Nexthop apijson.Field - Prefix apijson.Field - Priority apijson.Field - ID apijson.Field - CreatedOn apijson.Field - Description apijson.Field - ModifiedOn apijson.Field - Scope apijson.Field - Weight apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteListResponseRoute) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Used only for ECMP routes. -type MagicRouteListResponseRoutesScope struct { - // List of colo names for the ECMP scope. - ColoNames []string `json:"colo_names"` - // List of colo regions for the ECMP scope. - ColoRegions []string `json:"colo_regions"` - JSON magicRouteListResponseRoutesScopeJSON `json:"-"` -} - -// magicRouteListResponseRoutesScopeJSON contains the JSON metadata for the struct -// [MagicRouteListResponseRoutesScope] -type magicRouteListResponseRoutesScopeJSON struct { - ColoNames apijson.Field - ColoRegions apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteListResponseRoutesScope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicRouteDeleteResponse struct { - Deleted bool `json:"deleted"` - DeletedRoute interface{} `json:"deleted_route"` - JSON magicRouteDeleteResponseJSON `json:"-"` -} - -// magicRouteDeleteResponseJSON contains the JSON metadata for the struct -// [MagicRouteDeleteResponse] -type magicRouteDeleteResponseJSON struct { - Deleted apijson.Field - DeletedRoute apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteDeleteResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicRouteEmptyResponse struct { - Deleted bool `json:"deleted"` - DeletedRoutes interface{} `json:"deleted_routes"` - JSON magicRouteEmptyResponseJSON `json:"-"` -} - -// magicRouteEmptyResponseJSON contains the JSON metadata for the struct -// [MagicRouteEmptyResponse] -type magicRouteEmptyResponseJSON struct { - Deleted apijson.Field - DeletedRoutes apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteEmptyResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicRouteGetResponse struct { - Route interface{} `json:"route"` - JSON magicRouteGetResponseJSON `json:"-"` -} - -// magicRouteGetResponseJSON contains the JSON metadata for the struct -// [MagicRouteGetResponse] -type magicRouteGetResponseJSON struct { - Route apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicRouteNewParams struct { - Body param.Field[interface{}] `json:"body,required"` -} - -func (r MagicRouteNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - -type MagicRouteNewResponseEnvelope struct { - Errors []MagicRouteNewResponseEnvelopeErrors `json:"errors,required"` - Messages []MagicRouteNewResponseEnvelopeMessages `json:"messages,required"` - Result MagicRouteNewResponse `json:"result,required"` - // Whether the API call was successful - Success MagicRouteNewResponseEnvelopeSuccess `json:"success,required"` - JSON magicRouteNewResponseEnvelopeJSON `json:"-"` -} - -// magicRouteNewResponseEnvelopeJSON contains the JSON metadata for the struct -// [MagicRouteNewResponseEnvelope] -type magicRouteNewResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicRouteNewResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicRouteNewResponseEnvelopeErrorsJSON `json:"-"` -} - -// magicRouteNewResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [MagicRouteNewResponseEnvelopeErrors] -type magicRouteNewResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicRouteNewResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicRouteNewResponseEnvelopeMessagesJSON `json:"-"` -} - -// magicRouteNewResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [MagicRouteNewResponseEnvelopeMessages] -type magicRouteNewResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type MagicRouteNewResponseEnvelopeSuccess bool - -const ( - MagicRouteNewResponseEnvelopeSuccessTrue MagicRouteNewResponseEnvelopeSuccess = true -) - -type MagicRouteUpdateParams struct { - // The next-hop IP Address for the static route. - Nexthop param.Field[string] `json:"nexthop,required"` - // IP Prefix in Classless Inter-Domain Routing format. - Prefix param.Field[string] `json:"prefix,required"` - // Priority of the static route. - Priority param.Field[int64] `json:"priority,required"` - // An optional human provided description of the static route. - Description param.Field[string] `json:"description"` - // Used only for ECMP routes. - Scope param.Field[MagicRouteUpdateParamsScope] `json:"scope"` - // Optional weight of the ECMP scope - if provided. - Weight param.Field[int64] `json:"weight"` -} - -func (r MagicRouteUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Used only for ECMP routes. -type MagicRouteUpdateParamsScope struct { - // List of colo names for the ECMP scope. - ColoNames param.Field[[]string] `json:"colo_names"` - // List of colo regions for the ECMP scope. - ColoRegions param.Field[[]string] `json:"colo_regions"` -} - -func (r MagicRouteUpdateParamsScope) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type MagicRouteUpdateResponseEnvelope struct { - Errors []MagicRouteUpdateResponseEnvelopeErrors `json:"errors,required"` - Messages []MagicRouteUpdateResponseEnvelopeMessages `json:"messages,required"` - Result MagicRouteUpdateResponse `json:"result,required"` - // Whether the API call was successful - Success MagicRouteUpdateResponseEnvelopeSuccess `json:"success,required"` - JSON magicRouteUpdateResponseEnvelopeJSON `json:"-"` -} - -// magicRouteUpdateResponseEnvelopeJSON contains the JSON metadata for the struct -// [MagicRouteUpdateResponseEnvelope] -type magicRouteUpdateResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicRouteUpdateResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicRouteUpdateResponseEnvelopeErrorsJSON `json:"-"` -} - -// magicRouteUpdateResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [MagicRouteUpdateResponseEnvelopeErrors] -type magicRouteUpdateResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicRouteUpdateResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicRouteUpdateResponseEnvelopeMessagesJSON `json:"-"` -} - -// magicRouteUpdateResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [MagicRouteUpdateResponseEnvelopeMessages] -type magicRouteUpdateResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type MagicRouteUpdateResponseEnvelopeSuccess bool - -const ( - MagicRouteUpdateResponseEnvelopeSuccessTrue MagicRouteUpdateResponseEnvelopeSuccess = true -) - -type MagicRouteListResponseEnvelope struct { - Errors []MagicRouteListResponseEnvelopeErrors `json:"errors,required"` - Messages []MagicRouteListResponseEnvelopeMessages `json:"messages,required"` - Result MagicRouteListResponse `json:"result,required"` - // Whether the API call was successful - Success MagicRouteListResponseEnvelopeSuccess `json:"success,required"` - JSON magicRouteListResponseEnvelopeJSON `json:"-"` -} - -// magicRouteListResponseEnvelopeJSON contains the JSON metadata for the struct -// [MagicRouteListResponseEnvelope] -type magicRouteListResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicRouteListResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicRouteListResponseEnvelopeErrorsJSON `json:"-"` -} - -// magicRouteListResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [MagicRouteListResponseEnvelopeErrors] -type magicRouteListResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicRouteListResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicRouteListResponseEnvelopeMessagesJSON `json:"-"` -} - -// magicRouteListResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [MagicRouteListResponseEnvelopeMessages] -type magicRouteListResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type MagicRouteListResponseEnvelopeSuccess bool - -const ( - MagicRouteListResponseEnvelopeSuccessTrue MagicRouteListResponseEnvelopeSuccess = true -) - -type MagicRouteDeleteResponseEnvelope struct { - Errors []MagicRouteDeleteResponseEnvelopeErrors `json:"errors,required"` - Messages []MagicRouteDeleteResponseEnvelopeMessages `json:"messages,required"` - Result MagicRouteDeleteResponse `json:"result,required"` - // Whether the API call was successful - Success MagicRouteDeleteResponseEnvelopeSuccess `json:"success,required"` - JSON magicRouteDeleteResponseEnvelopeJSON `json:"-"` -} - -// magicRouteDeleteResponseEnvelopeJSON contains the JSON metadata for the struct -// [MagicRouteDeleteResponseEnvelope] -type magicRouteDeleteResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicRouteDeleteResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicRouteDeleteResponseEnvelopeErrorsJSON `json:"-"` -} - -// magicRouteDeleteResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [MagicRouteDeleteResponseEnvelopeErrors] -type magicRouteDeleteResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicRouteDeleteResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicRouteDeleteResponseEnvelopeMessagesJSON `json:"-"` -} - -// magicRouteDeleteResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [MagicRouteDeleteResponseEnvelopeMessages] -type magicRouteDeleteResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type MagicRouteDeleteResponseEnvelopeSuccess bool - -const ( - MagicRouteDeleteResponseEnvelopeSuccessTrue MagicRouteDeleteResponseEnvelopeSuccess = true -) - -type MagicRouteEmptyParams struct { - Routes param.Field[[]MagicRouteEmptyParamsRoute] `json:"routes,required"` -} - -func (r MagicRouteEmptyParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type MagicRouteEmptyParamsRoute struct { -} - -func (r MagicRouteEmptyParamsRoute) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type MagicRouteEmptyResponseEnvelope struct { - Errors []MagicRouteEmptyResponseEnvelopeErrors `json:"errors,required"` - Messages []MagicRouteEmptyResponseEnvelopeMessages `json:"messages,required"` - Result MagicRouteEmptyResponse `json:"result,required"` - // Whether the API call was successful - Success MagicRouteEmptyResponseEnvelopeSuccess `json:"success,required"` - JSON magicRouteEmptyResponseEnvelopeJSON `json:"-"` -} - -// magicRouteEmptyResponseEnvelopeJSON contains the JSON metadata for the struct -// [MagicRouteEmptyResponseEnvelope] -type magicRouteEmptyResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteEmptyResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicRouteEmptyResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicRouteEmptyResponseEnvelopeErrorsJSON `json:"-"` -} - -// magicRouteEmptyResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [MagicRouteEmptyResponseEnvelopeErrors] -type magicRouteEmptyResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteEmptyResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicRouteEmptyResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicRouteEmptyResponseEnvelopeMessagesJSON `json:"-"` -} - -// magicRouteEmptyResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [MagicRouteEmptyResponseEnvelopeMessages] -type magicRouteEmptyResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteEmptyResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type MagicRouteEmptyResponseEnvelopeSuccess bool - -const ( - MagicRouteEmptyResponseEnvelopeSuccessTrue MagicRouteEmptyResponseEnvelopeSuccess = true -) - -type MagicRouteGetResponseEnvelope struct { - Errors []MagicRouteGetResponseEnvelopeErrors `json:"errors,required"` - Messages []MagicRouteGetResponseEnvelopeMessages `json:"messages,required"` - Result MagicRouteGetResponse `json:"result,required"` - // Whether the API call was successful - Success MagicRouteGetResponseEnvelopeSuccess `json:"success,required"` - JSON magicRouteGetResponseEnvelopeJSON `json:"-"` -} - -// magicRouteGetResponseEnvelopeJSON contains the JSON metadata for the struct -// [MagicRouteGetResponseEnvelope] -type magicRouteGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicRouteGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicRouteGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// magicRouteGetResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [MagicRouteGetResponseEnvelopeErrors] -type magicRouteGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type MagicRouteGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON magicRouteGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// magicRouteGetResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [MagicRouteGetResponseEnvelopeMessages] -type magicRouteGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *MagicRouteGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type MagicRouteGetResponseEnvelopeSuccess bool - -const ( - MagicRouteGetResponseEnvelopeSuccessTrue MagicRouteGetResponseEnvelopeSuccess = true -) diff --git a/magictransit.go b/magictransit.go new file mode 100644 index 00000000000..d1fedce0394 --- /dev/null +++ b/magictransit.go @@ -0,0 +1,33 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// MagicTransitService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewMagicTransitService] method +// instead. +type MagicTransitService struct { + Options []option.RequestOption + CfInterconnects *MagicTransitCfInterconnectService + GRETunnels *MagicTransitGRETunnelService + IPSECTunnels *MagicTransitIPSECTunnelService + Routes *MagicTransitRouteService +} + +// NewMagicTransitService generates a new service that applies the given options to +// each request. These options are applied after the parent client's options (if +// there is one), and before any request-specific options. +func NewMagicTransitService(opts ...option.RequestOption) (r *MagicTransitService) { + r = &MagicTransitService{} + r.Options = opts + r.CfInterconnects = NewMagicTransitCfInterconnectService(opts...) + r.GRETunnels = NewMagicTransitGRETunnelService(opts...) + r.IPSECTunnels = NewMagicTransitIPSECTunnelService(opts...) + r.Routes = NewMagicTransitRouteService(opts...) + return +} diff --git a/magictransitcfinterconnect.go b/magictransitcfinterconnect.go new file mode 100644 index 00000000000..0f259eb8e71 --- /dev/null +++ b/magictransitcfinterconnect.go @@ -0,0 +1,513 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// MagicTransitCfInterconnectService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewMagicTransitCfInterconnectService] method instead. +type MagicTransitCfInterconnectService struct { + Options []option.RequestOption +} + +// NewMagicTransitCfInterconnectService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewMagicTransitCfInterconnectService(opts ...option.RequestOption) (r *MagicTransitCfInterconnectService) { + r = &MagicTransitCfInterconnectService{} + r.Options = opts + return +} + +// Updates a specific interconnect associated with an account. Use +// `?validate_only=true` as an optional query parameter to only run validation +// without persisting changes. +func (r *MagicTransitCfInterconnectService) Update(ctx context.Context, accountIdentifier string, tunnelIdentifier string, body MagicTransitCfInterconnectUpdateParams, opts ...option.RequestOption) (res *MagicTransitCfInterconnectUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + var env MagicTransitCfInterconnectUpdateResponseEnvelope + path := fmt.Sprintf("accounts/%s/magic/cf_interconnects/%s", accountIdentifier, tunnelIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Lists interconnects associated with an account. +func (r *MagicTransitCfInterconnectService) List(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *MagicTransitCfInterconnectListResponse, err error) { + opts = append(r.Options[:], opts...) + var env MagicTransitCfInterconnectListResponseEnvelope + path := fmt.Sprintf("accounts/%s/magic/cf_interconnects", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Lists details for a specific interconnect. +func (r *MagicTransitCfInterconnectService) Get(ctx context.Context, accountIdentifier string, tunnelIdentifier string, opts ...option.RequestOption) (res *MagicTransitCfInterconnectGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env MagicTransitCfInterconnectGetResponseEnvelope + path := fmt.Sprintf("accounts/%s/magic/cf_interconnects/%s", accountIdentifier, tunnelIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +type MagicTransitCfInterconnectUpdateResponse struct { + Modified bool `json:"modified"` + ModifiedInterconnect interface{} `json:"modified_interconnect"` + JSON magicTransitCfInterconnectUpdateResponseJSON `json:"-"` +} + +// magicTransitCfInterconnectUpdateResponseJSON contains the JSON metadata for the +// struct [MagicTransitCfInterconnectUpdateResponse] +type magicTransitCfInterconnectUpdateResponseJSON struct { + Modified apijson.Field + ModifiedInterconnect apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitCfInterconnectUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitCfInterconnectListResponse struct { + Interconnects []MagicTransitCfInterconnectListResponseInterconnect `json:"interconnects"` + JSON magicTransitCfInterconnectListResponseJSON `json:"-"` +} + +// magicTransitCfInterconnectListResponseJSON contains the JSON metadata for the +// struct [MagicTransitCfInterconnectListResponse] +type magicTransitCfInterconnectListResponseJSON struct { + Interconnects apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitCfInterconnectListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitCfInterconnectListResponseInterconnect struct { + // Tunnel identifier tag. + ID string `json:"id"` + // The name of the interconnect. The name cannot share a name with other tunnels. + ColoName string `json:"colo_name"` + // The date and time the tunnel was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // An optional description of the interconnect. + Description string `json:"description"` + // The configuration specific to GRE interconnects. + GRE MagicTransitCfInterconnectListResponseInterconnectsGRE `json:"gre"` + HealthCheck MagicTransitCfInterconnectListResponseInterconnectsHealthCheck `json:"health_check"` + // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + // of the tunnel. Select the subnet from the following private IP space: + // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + InterfaceAddress string `json:"interface_address"` + // The date and time the tunnel was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The Maximum Transmission Unit (MTU) in bytes for the interconnect. The minimum + // value is 576. + Mtu int64 `json:"mtu"` + // The name of the interconnect. The name cannot share a name with other tunnels. + Name string `json:"name"` + JSON magicTransitCfInterconnectListResponseInterconnectJSON `json:"-"` +} + +// magicTransitCfInterconnectListResponseInterconnectJSON contains the JSON +// metadata for the struct [MagicTransitCfInterconnectListResponseInterconnect] +type magicTransitCfInterconnectListResponseInterconnectJSON struct { + ID apijson.Field + ColoName apijson.Field + CreatedOn apijson.Field + Description apijson.Field + GRE apijson.Field + HealthCheck apijson.Field + InterfaceAddress apijson.Field + ModifiedOn apijson.Field + Mtu apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitCfInterconnectListResponseInterconnect) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The configuration specific to GRE interconnects. +type MagicTransitCfInterconnectListResponseInterconnectsGRE struct { + // The IP address assigned to the Cloudflare side of the GRE tunnel created as part + // of the Interconnect. + CloudflareEndpoint string `json:"cloudflare_endpoint"` + JSON magicTransitCfInterconnectListResponseInterconnectsGREJSON `json:"-"` +} + +// magicTransitCfInterconnectListResponseInterconnectsGREJSON contains the JSON +// metadata for the struct [MagicTransitCfInterconnectListResponseInterconnectsGRE] +type magicTransitCfInterconnectListResponseInterconnectsGREJSON struct { + CloudflareEndpoint apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitCfInterconnectListResponseInterconnectsGRE) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitCfInterconnectListResponseInterconnectsHealthCheck struct { + // Determines whether to run healthchecks for a tunnel. + Enabled bool `json:"enabled"` + // How frequent the health check is run. The default value is `mid`. + Rate MagicTransitCfInterconnectListResponseInterconnectsHealthCheckRate `json:"rate"` + // The destination address in a request type health check. After the healthcheck is + // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + // to this address. This field defaults to `customer_gre_endpoint address`. + Target string `json:"target"` + // The type of healthcheck to run, reply or request. The default value is `reply`. + Type MagicTransitCfInterconnectListResponseInterconnectsHealthCheckType `json:"type"` + JSON magicTransitCfInterconnectListResponseInterconnectsHealthCheckJSON `json:"-"` +} + +// magicTransitCfInterconnectListResponseInterconnectsHealthCheckJSON contains the +// JSON metadata for the struct +// [MagicTransitCfInterconnectListResponseInterconnectsHealthCheck] +type magicTransitCfInterconnectListResponseInterconnectsHealthCheckJSON struct { + Enabled apijson.Field + Rate apijson.Field + Target apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitCfInterconnectListResponseInterconnectsHealthCheck) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// How frequent the health check is run. The default value is `mid`. +type MagicTransitCfInterconnectListResponseInterconnectsHealthCheckRate string + +const ( + MagicTransitCfInterconnectListResponseInterconnectsHealthCheckRateLow MagicTransitCfInterconnectListResponseInterconnectsHealthCheckRate = "low" + MagicTransitCfInterconnectListResponseInterconnectsHealthCheckRateMid MagicTransitCfInterconnectListResponseInterconnectsHealthCheckRate = "mid" + MagicTransitCfInterconnectListResponseInterconnectsHealthCheckRateHigh MagicTransitCfInterconnectListResponseInterconnectsHealthCheckRate = "high" +) + +// The type of healthcheck to run, reply or request. The default value is `reply`. +type MagicTransitCfInterconnectListResponseInterconnectsHealthCheckType string + +const ( + MagicTransitCfInterconnectListResponseInterconnectsHealthCheckTypeReply MagicTransitCfInterconnectListResponseInterconnectsHealthCheckType = "reply" + MagicTransitCfInterconnectListResponseInterconnectsHealthCheckTypeRequest MagicTransitCfInterconnectListResponseInterconnectsHealthCheckType = "request" +) + +type MagicTransitCfInterconnectGetResponse struct { + Interconnect interface{} `json:"interconnect"` + JSON magicTransitCfInterconnectGetResponseJSON `json:"-"` +} + +// magicTransitCfInterconnectGetResponseJSON contains the JSON metadata for the +// struct [MagicTransitCfInterconnectGetResponse] +type magicTransitCfInterconnectGetResponseJSON struct { + Interconnect apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitCfInterconnectGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitCfInterconnectUpdateParams struct { + // An optional description of the interconnect. + Description param.Field[string] `json:"description"` + // The configuration specific to GRE interconnects. + GRE param.Field[MagicTransitCfInterconnectUpdateParamsGRE] `json:"gre"` + HealthCheck param.Field[MagicTransitCfInterconnectUpdateParamsHealthCheck] `json:"health_check"` + // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + // of the tunnel. Select the subnet from the following private IP space: + // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + InterfaceAddress param.Field[string] `json:"interface_address"` + // The Maximum Transmission Unit (MTU) in bytes for the interconnect. The minimum + // value is 576. + Mtu param.Field[int64] `json:"mtu"` +} + +func (r MagicTransitCfInterconnectUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The configuration specific to GRE interconnects. +type MagicTransitCfInterconnectUpdateParamsGRE struct { + // The IP address assigned to the Cloudflare side of the GRE tunnel created as part + // of the Interconnect. + CloudflareEndpoint param.Field[string] `json:"cloudflare_endpoint"` +} + +func (r MagicTransitCfInterconnectUpdateParamsGRE) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type MagicTransitCfInterconnectUpdateParamsHealthCheck struct { + // Determines whether to run healthchecks for a tunnel. + Enabled param.Field[bool] `json:"enabled"` + // How frequent the health check is run. The default value is `mid`. + Rate param.Field[MagicTransitCfInterconnectUpdateParamsHealthCheckRate] `json:"rate"` + // The destination address in a request type health check. After the healthcheck is + // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + // to this address. This field defaults to `customer_gre_endpoint address`. + Target param.Field[string] `json:"target"` + // The type of healthcheck to run, reply or request. The default value is `reply`. + Type param.Field[MagicTransitCfInterconnectUpdateParamsHealthCheckType] `json:"type"` +} + +func (r MagicTransitCfInterconnectUpdateParamsHealthCheck) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// How frequent the health check is run. The default value is `mid`. +type MagicTransitCfInterconnectUpdateParamsHealthCheckRate string + +const ( + MagicTransitCfInterconnectUpdateParamsHealthCheckRateLow MagicTransitCfInterconnectUpdateParamsHealthCheckRate = "low" + MagicTransitCfInterconnectUpdateParamsHealthCheckRateMid MagicTransitCfInterconnectUpdateParamsHealthCheckRate = "mid" + MagicTransitCfInterconnectUpdateParamsHealthCheckRateHigh MagicTransitCfInterconnectUpdateParamsHealthCheckRate = "high" +) + +// The type of healthcheck to run, reply or request. The default value is `reply`. +type MagicTransitCfInterconnectUpdateParamsHealthCheckType string + +const ( + MagicTransitCfInterconnectUpdateParamsHealthCheckTypeReply MagicTransitCfInterconnectUpdateParamsHealthCheckType = "reply" + MagicTransitCfInterconnectUpdateParamsHealthCheckTypeRequest MagicTransitCfInterconnectUpdateParamsHealthCheckType = "request" +) + +type MagicTransitCfInterconnectUpdateResponseEnvelope struct { + Errors []MagicTransitCfInterconnectUpdateResponseEnvelopeErrors `json:"errors,required"` + Messages []MagicTransitCfInterconnectUpdateResponseEnvelopeMessages `json:"messages,required"` + Result MagicTransitCfInterconnectUpdateResponse `json:"result,required"` + // Whether the API call was successful + Success MagicTransitCfInterconnectUpdateResponseEnvelopeSuccess `json:"success,required"` + JSON magicTransitCfInterconnectUpdateResponseEnvelopeJSON `json:"-"` +} + +// magicTransitCfInterconnectUpdateResponseEnvelopeJSON contains the JSON metadata +// for the struct [MagicTransitCfInterconnectUpdateResponseEnvelope] +type magicTransitCfInterconnectUpdateResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitCfInterconnectUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitCfInterconnectUpdateResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitCfInterconnectUpdateResponseEnvelopeErrorsJSON `json:"-"` +} + +// magicTransitCfInterconnectUpdateResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [MagicTransitCfInterconnectUpdateResponseEnvelopeErrors] +type magicTransitCfInterconnectUpdateResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitCfInterconnectUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitCfInterconnectUpdateResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitCfInterconnectUpdateResponseEnvelopeMessagesJSON `json:"-"` +} + +// magicTransitCfInterconnectUpdateResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct +// [MagicTransitCfInterconnectUpdateResponseEnvelopeMessages] +type magicTransitCfInterconnectUpdateResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitCfInterconnectUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type MagicTransitCfInterconnectUpdateResponseEnvelopeSuccess bool + +const ( + MagicTransitCfInterconnectUpdateResponseEnvelopeSuccessTrue MagicTransitCfInterconnectUpdateResponseEnvelopeSuccess = true +) + +type MagicTransitCfInterconnectListResponseEnvelope struct { + Errors []MagicTransitCfInterconnectListResponseEnvelopeErrors `json:"errors,required"` + Messages []MagicTransitCfInterconnectListResponseEnvelopeMessages `json:"messages,required"` + Result MagicTransitCfInterconnectListResponse `json:"result,required"` + // Whether the API call was successful + Success MagicTransitCfInterconnectListResponseEnvelopeSuccess `json:"success,required"` + JSON magicTransitCfInterconnectListResponseEnvelopeJSON `json:"-"` +} + +// magicTransitCfInterconnectListResponseEnvelopeJSON contains the JSON metadata +// for the struct [MagicTransitCfInterconnectListResponseEnvelope] +type magicTransitCfInterconnectListResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitCfInterconnectListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitCfInterconnectListResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitCfInterconnectListResponseEnvelopeErrorsJSON `json:"-"` +} + +// magicTransitCfInterconnectListResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [MagicTransitCfInterconnectListResponseEnvelopeErrors] +type magicTransitCfInterconnectListResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitCfInterconnectListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitCfInterconnectListResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitCfInterconnectListResponseEnvelopeMessagesJSON `json:"-"` +} + +// magicTransitCfInterconnectListResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [MagicTransitCfInterconnectListResponseEnvelopeMessages] +type magicTransitCfInterconnectListResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitCfInterconnectListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type MagicTransitCfInterconnectListResponseEnvelopeSuccess bool + +const ( + MagicTransitCfInterconnectListResponseEnvelopeSuccessTrue MagicTransitCfInterconnectListResponseEnvelopeSuccess = true +) + +type MagicTransitCfInterconnectGetResponseEnvelope struct { + Errors []MagicTransitCfInterconnectGetResponseEnvelopeErrors `json:"errors,required"` + Messages []MagicTransitCfInterconnectGetResponseEnvelopeMessages `json:"messages,required"` + Result MagicTransitCfInterconnectGetResponse `json:"result,required"` + // Whether the API call was successful + Success MagicTransitCfInterconnectGetResponseEnvelopeSuccess `json:"success,required"` + JSON magicTransitCfInterconnectGetResponseEnvelopeJSON `json:"-"` +} + +// magicTransitCfInterconnectGetResponseEnvelopeJSON contains the JSON metadata for +// the struct [MagicTransitCfInterconnectGetResponseEnvelope] +type magicTransitCfInterconnectGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitCfInterconnectGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitCfInterconnectGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitCfInterconnectGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// magicTransitCfInterconnectGetResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [MagicTransitCfInterconnectGetResponseEnvelopeErrors] +type magicTransitCfInterconnectGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitCfInterconnectGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitCfInterconnectGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitCfInterconnectGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// magicTransitCfInterconnectGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [MagicTransitCfInterconnectGetResponseEnvelopeMessages] +type magicTransitCfInterconnectGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitCfInterconnectGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type MagicTransitCfInterconnectGetResponseEnvelopeSuccess bool + +const ( + MagicTransitCfInterconnectGetResponseEnvelopeSuccessTrue MagicTransitCfInterconnectGetResponseEnvelopeSuccess = true +) diff --git a/magiccfinterconnect_test.go b/magictransitcfinterconnect_test.go similarity index 80% rename from magiccfinterconnect_test.go rename to magictransitcfinterconnect_test.go index b9d080c127e..c20886da229 100644 --- a/magiccfinterconnect_test.go +++ b/magictransitcfinterconnect_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestMagicCfInterconnectUpdateWithOptionalParams(t *testing.T) { +func TestMagicTransitCfInterconnectUpdateWithOptionalParams(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 { @@ -29,20 +29,20 @@ func TestMagicCfInterconnectUpdateWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Magics.CfInterconnects.Update( + _, err := client.MagicTransit.CfInterconnects.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.MagicCfInterconnectUpdateParams{ + cloudflare.MagicTransitCfInterconnectUpdateParams{ Description: cloudflare.F("Tunnel for Interconnect to ORD"), - GRE: cloudflare.F(cloudflare.MagicCfInterconnectUpdateParamsGRE{ + GRE: cloudflare.F(cloudflare.MagicTransitCfInterconnectUpdateParamsGRE{ CloudflareEndpoint: cloudflare.F("203.0.113.1"), }), - HealthCheck: cloudflare.F(cloudflare.MagicCfInterconnectUpdateParamsHealthCheck{ + HealthCheck: cloudflare.F(cloudflare.MagicTransitCfInterconnectUpdateParamsHealthCheck{ Enabled: cloudflare.F(true), - Rate: cloudflare.F(cloudflare.MagicCfInterconnectUpdateParamsHealthCheckRateLow), + Rate: cloudflare.F(cloudflare.MagicTransitCfInterconnectUpdateParamsHealthCheckRateLow), Target: cloudflare.F("203.0.113.1"), - Type: cloudflare.F(cloudflare.MagicCfInterconnectUpdateParamsHealthCheckTypeRequest), + Type: cloudflare.F(cloudflare.MagicTransitCfInterconnectUpdateParamsHealthCheckTypeRequest), }), InterfaceAddress: cloudflare.F("192.0.2.0/31"), Mtu: cloudflare.F(int64(0)), @@ -57,7 +57,7 @@ func TestMagicCfInterconnectUpdateWithOptionalParams(t *testing.T) { } } -func TestMagicCfInterconnectList(t *testing.T) { +func TestMagicTransitCfInterconnectList(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 { @@ -73,7 +73,7 @@ func TestMagicCfInterconnectList(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Magics.CfInterconnects.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") + _, err := client.MagicTransit.CfInterconnects.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { var apierr *cloudflare.Error if errors.As(err, &apierr) { @@ -83,7 +83,7 @@ func TestMagicCfInterconnectList(t *testing.T) { } } -func TestMagicCfInterconnectGet(t *testing.T) { +func TestMagicTransitCfInterconnectGet(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 { @@ -99,7 +99,7 @@ func TestMagicCfInterconnectGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Magics.CfInterconnects.Get( + _, err := client.MagicTransit.CfInterconnects.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", diff --git a/magictransitgretunnel.go b/magictransitgretunnel.go new file mode 100644 index 00000000000..53c03ff0420 --- /dev/null +++ b/magictransitgretunnel.go @@ -0,0 +1,865 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// MagicTransitGRETunnelService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewMagicTransitGRETunnelService] +// method instead. +type MagicTransitGRETunnelService struct { + Options []option.RequestOption +} + +// NewMagicTransitGRETunnelService generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewMagicTransitGRETunnelService(opts ...option.RequestOption) (r *MagicTransitGRETunnelService) { + r = &MagicTransitGRETunnelService{} + r.Options = opts + return +} + +// Creates new GRE tunnels. Use `?validate_only=true` as an optional query +// parameter to only run validation without persisting changes. +func (r *MagicTransitGRETunnelService) New(ctx context.Context, accountIdentifier string, body MagicTransitGRETunnelNewParams, opts ...option.RequestOption) (res *MagicTransitGRETunnelNewResponse, err error) { + opts = append(r.Options[:], opts...) + var env MagicTransitGRETunnelNewResponseEnvelope + path := fmt.Sprintf("accounts/%s/magic/gre_tunnels", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Updates a specific GRE tunnel. Use `?validate_only=true` as an optional query +// parameter to only run validation without persisting changes. +func (r *MagicTransitGRETunnelService) Update(ctx context.Context, accountIdentifier string, tunnelIdentifier string, body MagicTransitGRETunnelUpdateParams, opts ...option.RequestOption) (res *MagicTransitGRETunnelUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + var env MagicTransitGRETunnelUpdateResponseEnvelope + path := fmt.Sprintf("accounts/%s/magic/gre_tunnels/%s", accountIdentifier, tunnelIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Lists GRE tunnels associated with an account. +func (r *MagicTransitGRETunnelService) List(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *MagicTransitGRETunnelListResponse, err error) { + opts = append(r.Options[:], opts...) + var env MagicTransitGRETunnelListResponseEnvelope + path := fmt.Sprintf("accounts/%s/magic/gre_tunnels", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Disables and removes a specific static GRE tunnel. Use `?validate_only=true` as +// an optional query parameter to only run validation without persisting changes. +func (r *MagicTransitGRETunnelService) Delete(ctx context.Context, accountIdentifier string, tunnelIdentifier string, opts ...option.RequestOption) (res *MagicTransitGRETunnelDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + var env MagicTransitGRETunnelDeleteResponseEnvelope + path := fmt.Sprintf("accounts/%s/magic/gre_tunnels/%s", accountIdentifier, tunnelIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Lists informtion for a specific GRE tunnel. +func (r *MagicTransitGRETunnelService) Get(ctx context.Context, accountIdentifier string, tunnelIdentifier string, opts ...option.RequestOption) (res *MagicTransitGRETunnelGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env MagicTransitGRETunnelGetResponseEnvelope + path := fmt.Sprintf("accounts/%s/magic/gre_tunnels/%s", accountIdentifier, tunnelIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +type MagicTransitGRETunnelNewResponse struct { + GRETunnels []MagicTransitGRETunnelNewResponseGRETunnel `json:"gre_tunnels"` + JSON magicTransitGRETunnelNewResponseJSON `json:"-"` +} + +// magicTransitGRETunnelNewResponseJSON contains the JSON metadata for the struct +// [MagicTransitGRETunnelNewResponse] +type magicTransitGRETunnelNewResponseJSON struct { + GRETunnels apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitGRETunnelNewResponseGRETunnel struct { + // The IP address assigned to the Cloudflare side of the GRE tunnel. + CloudflareGREEndpoint string `json:"cloudflare_gre_endpoint,required"` + // The IP address assigned to the customer side of the GRE tunnel. + CustomerGREEndpoint string `json:"customer_gre_endpoint,required"` + // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + // of the tunnel. Select the subnet from the following private IP space: + // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + InterfaceAddress string `json:"interface_address,required"` + // The name of the tunnel. The name cannot contain spaces or special characters, + // must be 15 characters or less, and cannot share a name with another GRE tunnel. + Name string `json:"name,required"` + // Tunnel identifier tag. + ID string `json:"id"` + // The date and time the tunnel was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // An optional description of the GRE tunnel. + Description string `json:"description"` + HealthCheck MagicTransitGRETunnelNewResponseGRETunnelsHealthCheck `json:"health_check"` + // The date and time the tunnel was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value + // is 576. + Mtu int64 `json:"mtu"` + // Time To Live (TTL) in number of hops of the GRE tunnel. + TTL int64 `json:"ttl"` + JSON magicTransitGRETunnelNewResponseGRETunnelJSON `json:"-"` +} + +// magicTransitGRETunnelNewResponseGRETunnelJSON contains the JSON metadata for the +// struct [MagicTransitGRETunnelNewResponseGRETunnel] +type magicTransitGRETunnelNewResponseGRETunnelJSON struct { + CloudflareGREEndpoint apijson.Field + CustomerGREEndpoint apijson.Field + InterfaceAddress apijson.Field + Name apijson.Field + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + HealthCheck apijson.Field + ModifiedOn apijson.Field + Mtu apijson.Field + TTL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelNewResponseGRETunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitGRETunnelNewResponseGRETunnelsHealthCheck struct { + // The direction of the flow of the healthcheck. Either unidirectional, where the + // probe comes to you via the tunnel and the result comes back to Cloudflare via + // the open Internet, or bidirectional where both the probe and result come and go + // via the tunnel. Note in the case of bidirecitonal healthchecks, the target field + // in health_check is ignored as the interface_address is used to send traffic into + // the tunnel. + Direction MagicTransitGRETunnelNewResponseGRETunnelsHealthCheckDirection `json:"direction"` + // Determines whether to run healthchecks for a tunnel. + Enabled bool `json:"enabled"` + // How frequent the health check is run. The default value is `mid`. + Rate MagicTransitGRETunnelNewResponseGRETunnelsHealthCheckRate `json:"rate"` + // The destination address in a request type health check. After the healthcheck is + // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + // to this address. This field defaults to `customer_gre_endpoint address`. This + // field is ignored for bidirectional healthchecks as the interface_address (not + // assigned to the Cloudflare side of the tunnel) is used as the target. + Target string `json:"target"` + // The type of healthcheck to run, reply or request. The default value is `reply`. + Type MagicTransitGRETunnelNewResponseGRETunnelsHealthCheckType `json:"type"` + JSON magicTransitGRETunnelNewResponseGRETunnelsHealthCheckJSON `json:"-"` +} + +// magicTransitGRETunnelNewResponseGRETunnelsHealthCheckJSON contains the JSON +// metadata for the struct [MagicTransitGRETunnelNewResponseGRETunnelsHealthCheck] +type magicTransitGRETunnelNewResponseGRETunnelsHealthCheckJSON struct { + Direction apijson.Field + Enabled apijson.Field + Rate apijson.Field + Target apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelNewResponseGRETunnelsHealthCheck) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The direction of the flow of the healthcheck. Either unidirectional, where the +// probe comes to you via the tunnel and the result comes back to Cloudflare via +// the open Internet, or bidirectional where both the probe and result come and go +// via the tunnel. Note in the case of bidirecitonal healthchecks, the target field +// in health_check is ignored as the interface_address is used to send traffic into +// the tunnel. +type MagicTransitGRETunnelNewResponseGRETunnelsHealthCheckDirection string + +const ( + MagicTransitGRETunnelNewResponseGRETunnelsHealthCheckDirectionUnidirectional MagicTransitGRETunnelNewResponseGRETunnelsHealthCheckDirection = "unidirectional" + MagicTransitGRETunnelNewResponseGRETunnelsHealthCheckDirectionBidirectional MagicTransitGRETunnelNewResponseGRETunnelsHealthCheckDirection = "bidirectional" +) + +// How frequent the health check is run. The default value is `mid`. +type MagicTransitGRETunnelNewResponseGRETunnelsHealthCheckRate string + +const ( + MagicTransitGRETunnelNewResponseGRETunnelsHealthCheckRateLow MagicTransitGRETunnelNewResponseGRETunnelsHealthCheckRate = "low" + MagicTransitGRETunnelNewResponseGRETunnelsHealthCheckRateMid MagicTransitGRETunnelNewResponseGRETunnelsHealthCheckRate = "mid" + MagicTransitGRETunnelNewResponseGRETunnelsHealthCheckRateHigh MagicTransitGRETunnelNewResponseGRETunnelsHealthCheckRate = "high" +) + +// The type of healthcheck to run, reply or request. The default value is `reply`. +type MagicTransitGRETunnelNewResponseGRETunnelsHealthCheckType string + +const ( + MagicTransitGRETunnelNewResponseGRETunnelsHealthCheckTypeReply MagicTransitGRETunnelNewResponseGRETunnelsHealthCheckType = "reply" + MagicTransitGRETunnelNewResponseGRETunnelsHealthCheckTypeRequest MagicTransitGRETunnelNewResponseGRETunnelsHealthCheckType = "request" +) + +type MagicTransitGRETunnelUpdateResponse struct { + Modified bool `json:"modified"` + ModifiedGRETunnel interface{} `json:"modified_gre_tunnel"` + JSON magicTransitGRETunnelUpdateResponseJSON `json:"-"` +} + +// magicTransitGRETunnelUpdateResponseJSON contains the JSON metadata for the +// struct [MagicTransitGRETunnelUpdateResponse] +type magicTransitGRETunnelUpdateResponseJSON struct { + Modified apijson.Field + ModifiedGRETunnel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitGRETunnelListResponse struct { + GRETunnels []MagicTransitGRETunnelListResponseGRETunnel `json:"gre_tunnels"` + JSON magicTransitGRETunnelListResponseJSON `json:"-"` +} + +// magicTransitGRETunnelListResponseJSON contains the JSON metadata for the struct +// [MagicTransitGRETunnelListResponse] +type magicTransitGRETunnelListResponseJSON struct { + GRETunnels apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitGRETunnelListResponseGRETunnel struct { + // The IP address assigned to the Cloudflare side of the GRE tunnel. + CloudflareGREEndpoint string `json:"cloudflare_gre_endpoint,required"` + // The IP address assigned to the customer side of the GRE tunnel. + CustomerGREEndpoint string `json:"customer_gre_endpoint,required"` + // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + // of the tunnel. Select the subnet from the following private IP space: + // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + InterfaceAddress string `json:"interface_address,required"` + // The name of the tunnel. The name cannot contain spaces or special characters, + // must be 15 characters or less, and cannot share a name with another GRE tunnel. + Name string `json:"name,required"` + // Tunnel identifier tag. + ID string `json:"id"` + // The date and time the tunnel was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // An optional description of the GRE tunnel. + Description string `json:"description"` + HealthCheck MagicTransitGRETunnelListResponseGRETunnelsHealthCheck `json:"health_check"` + // The date and time the tunnel was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value + // is 576. + Mtu int64 `json:"mtu"` + // Time To Live (TTL) in number of hops of the GRE tunnel. + TTL int64 `json:"ttl"` + JSON magicTransitGRETunnelListResponseGRETunnelJSON `json:"-"` +} + +// magicTransitGRETunnelListResponseGRETunnelJSON contains the JSON metadata for +// the struct [MagicTransitGRETunnelListResponseGRETunnel] +type magicTransitGRETunnelListResponseGRETunnelJSON struct { + CloudflareGREEndpoint apijson.Field + CustomerGREEndpoint apijson.Field + InterfaceAddress apijson.Field + Name apijson.Field + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + HealthCheck apijson.Field + ModifiedOn apijson.Field + Mtu apijson.Field + TTL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelListResponseGRETunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitGRETunnelListResponseGRETunnelsHealthCheck struct { + // The direction of the flow of the healthcheck. Either unidirectional, where the + // probe comes to you via the tunnel and the result comes back to Cloudflare via + // the open Internet, or bidirectional where both the probe and result come and go + // via the tunnel. Note in the case of bidirecitonal healthchecks, the target field + // in health_check is ignored as the interface_address is used to send traffic into + // the tunnel. + Direction MagicTransitGRETunnelListResponseGRETunnelsHealthCheckDirection `json:"direction"` + // Determines whether to run healthchecks for a tunnel. + Enabled bool `json:"enabled"` + // How frequent the health check is run. The default value is `mid`. + Rate MagicTransitGRETunnelListResponseGRETunnelsHealthCheckRate `json:"rate"` + // The destination address in a request type health check. After the healthcheck is + // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + // to this address. This field defaults to `customer_gre_endpoint address`. This + // field is ignored for bidirectional healthchecks as the interface_address (not + // assigned to the Cloudflare side of the tunnel) is used as the target. + Target string `json:"target"` + // The type of healthcheck to run, reply or request. The default value is `reply`. + Type MagicTransitGRETunnelListResponseGRETunnelsHealthCheckType `json:"type"` + JSON magicTransitGRETunnelListResponseGRETunnelsHealthCheckJSON `json:"-"` +} + +// magicTransitGRETunnelListResponseGRETunnelsHealthCheckJSON contains the JSON +// metadata for the struct [MagicTransitGRETunnelListResponseGRETunnelsHealthCheck] +type magicTransitGRETunnelListResponseGRETunnelsHealthCheckJSON struct { + Direction apijson.Field + Enabled apijson.Field + Rate apijson.Field + Target apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelListResponseGRETunnelsHealthCheck) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The direction of the flow of the healthcheck. Either unidirectional, where the +// probe comes to you via the tunnel and the result comes back to Cloudflare via +// the open Internet, or bidirectional where both the probe and result come and go +// via the tunnel. Note in the case of bidirecitonal healthchecks, the target field +// in health_check is ignored as the interface_address is used to send traffic into +// the tunnel. +type MagicTransitGRETunnelListResponseGRETunnelsHealthCheckDirection string + +const ( + MagicTransitGRETunnelListResponseGRETunnelsHealthCheckDirectionUnidirectional MagicTransitGRETunnelListResponseGRETunnelsHealthCheckDirection = "unidirectional" + MagicTransitGRETunnelListResponseGRETunnelsHealthCheckDirectionBidirectional MagicTransitGRETunnelListResponseGRETunnelsHealthCheckDirection = "bidirectional" +) + +// How frequent the health check is run. The default value is `mid`. +type MagicTransitGRETunnelListResponseGRETunnelsHealthCheckRate string + +const ( + MagicTransitGRETunnelListResponseGRETunnelsHealthCheckRateLow MagicTransitGRETunnelListResponseGRETunnelsHealthCheckRate = "low" + MagicTransitGRETunnelListResponseGRETunnelsHealthCheckRateMid MagicTransitGRETunnelListResponseGRETunnelsHealthCheckRate = "mid" + MagicTransitGRETunnelListResponseGRETunnelsHealthCheckRateHigh MagicTransitGRETunnelListResponseGRETunnelsHealthCheckRate = "high" +) + +// The type of healthcheck to run, reply or request. The default value is `reply`. +type MagicTransitGRETunnelListResponseGRETunnelsHealthCheckType string + +const ( + MagicTransitGRETunnelListResponseGRETunnelsHealthCheckTypeReply MagicTransitGRETunnelListResponseGRETunnelsHealthCheckType = "reply" + MagicTransitGRETunnelListResponseGRETunnelsHealthCheckTypeRequest MagicTransitGRETunnelListResponseGRETunnelsHealthCheckType = "request" +) + +type MagicTransitGRETunnelDeleteResponse struct { + Deleted bool `json:"deleted"` + DeletedGRETunnel interface{} `json:"deleted_gre_tunnel"` + JSON magicTransitGRETunnelDeleteResponseJSON `json:"-"` +} + +// magicTransitGRETunnelDeleteResponseJSON contains the JSON metadata for the +// struct [MagicTransitGRETunnelDeleteResponse] +type magicTransitGRETunnelDeleteResponseJSON struct { + Deleted apijson.Field + DeletedGRETunnel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitGRETunnelGetResponse struct { + GRETunnel interface{} `json:"gre_tunnel"` + JSON magicTransitGRETunnelGetResponseJSON `json:"-"` +} + +// magicTransitGRETunnelGetResponseJSON contains the JSON metadata for the struct +// [MagicTransitGRETunnelGetResponse] +type magicTransitGRETunnelGetResponseJSON struct { + GRETunnel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitGRETunnelNewParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r MagicTransitGRETunnelNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type MagicTransitGRETunnelNewResponseEnvelope struct { + Errors []MagicTransitGRETunnelNewResponseEnvelopeErrors `json:"errors,required"` + Messages []MagicTransitGRETunnelNewResponseEnvelopeMessages `json:"messages,required"` + Result MagicTransitGRETunnelNewResponse `json:"result,required"` + // Whether the API call was successful + Success MagicTransitGRETunnelNewResponseEnvelopeSuccess `json:"success,required"` + JSON magicTransitGRETunnelNewResponseEnvelopeJSON `json:"-"` +} + +// magicTransitGRETunnelNewResponseEnvelopeJSON contains the JSON metadata for the +// struct [MagicTransitGRETunnelNewResponseEnvelope] +type magicTransitGRETunnelNewResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitGRETunnelNewResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitGRETunnelNewResponseEnvelopeErrorsJSON `json:"-"` +} + +// magicTransitGRETunnelNewResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [MagicTransitGRETunnelNewResponseEnvelopeErrors] +type magicTransitGRETunnelNewResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitGRETunnelNewResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitGRETunnelNewResponseEnvelopeMessagesJSON `json:"-"` +} + +// magicTransitGRETunnelNewResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [MagicTransitGRETunnelNewResponseEnvelopeMessages] +type magicTransitGRETunnelNewResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type MagicTransitGRETunnelNewResponseEnvelopeSuccess bool + +const ( + MagicTransitGRETunnelNewResponseEnvelopeSuccessTrue MagicTransitGRETunnelNewResponseEnvelopeSuccess = true +) + +type MagicTransitGRETunnelUpdateParams struct { + // The IP address assigned to the Cloudflare side of the GRE tunnel. + CloudflareGREEndpoint param.Field[string] `json:"cloudflare_gre_endpoint,required"` + // The IP address assigned to the customer side of the GRE tunnel. + CustomerGREEndpoint param.Field[string] `json:"customer_gre_endpoint,required"` + // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + // of the tunnel. Select the subnet from the following private IP space: + // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + InterfaceAddress param.Field[string] `json:"interface_address,required"` + // The name of the tunnel. The name cannot contain spaces or special characters, + // must be 15 characters or less, and cannot share a name with another GRE tunnel. + Name param.Field[string] `json:"name,required"` + // An optional description of the GRE tunnel. + Description param.Field[string] `json:"description"` + HealthCheck param.Field[MagicTransitGRETunnelUpdateParamsHealthCheck] `json:"health_check"` + // Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value + // is 576. + Mtu param.Field[int64] `json:"mtu"` + // Time To Live (TTL) in number of hops of the GRE tunnel. + TTL param.Field[int64] `json:"ttl"` +} + +func (r MagicTransitGRETunnelUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type MagicTransitGRETunnelUpdateParamsHealthCheck struct { + // The direction of the flow of the healthcheck. Either unidirectional, where the + // probe comes to you via the tunnel and the result comes back to Cloudflare via + // the open Internet, or bidirectional where both the probe and result come and go + // via the tunnel. Note in the case of bidirecitonal healthchecks, the target field + // in health_check is ignored as the interface_address is used to send traffic into + // the tunnel. + Direction param.Field[MagicTransitGRETunnelUpdateParamsHealthCheckDirection] `json:"direction"` + // Determines whether to run healthchecks for a tunnel. + Enabled param.Field[bool] `json:"enabled"` + // How frequent the health check is run. The default value is `mid`. + Rate param.Field[MagicTransitGRETunnelUpdateParamsHealthCheckRate] `json:"rate"` + // The destination address in a request type health check. After the healthcheck is + // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + // to this address. This field defaults to `customer_gre_endpoint address`. This + // field is ignored for bidirectional healthchecks as the interface_address (not + // assigned to the Cloudflare side of the tunnel) is used as the target. + Target param.Field[string] `json:"target"` + // The type of healthcheck to run, reply or request. The default value is `reply`. + Type param.Field[MagicTransitGRETunnelUpdateParamsHealthCheckType] `json:"type"` +} + +func (r MagicTransitGRETunnelUpdateParamsHealthCheck) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The direction of the flow of the healthcheck. Either unidirectional, where the +// probe comes to you via the tunnel and the result comes back to Cloudflare via +// the open Internet, or bidirectional where both the probe and result come and go +// via the tunnel. Note in the case of bidirecitonal healthchecks, the target field +// in health_check is ignored as the interface_address is used to send traffic into +// the tunnel. +type MagicTransitGRETunnelUpdateParamsHealthCheckDirection string + +const ( + MagicTransitGRETunnelUpdateParamsHealthCheckDirectionUnidirectional MagicTransitGRETunnelUpdateParamsHealthCheckDirection = "unidirectional" + MagicTransitGRETunnelUpdateParamsHealthCheckDirectionBidirectional MagicTransitGRETunnelUpdateParamsHealthCheckDirection = "bidirectional" +) + +// How frequent the health check is run. The default value is `mid`. +type MagicTransitGRETunnelUpdateParamsHealthCheckRate string + +const ( + MagicTransitGRETunnelUpdateParamsHealthCheckRateLow MagicTransitGRETunnelUpdateParamsHealthCheckRate = "low" + MagicTransitGRETunnelUpdateParamsHealthCheckRateMid MagicTransitGRETunnelUpdateParamsHealthCheckRate = "mid" + MagicTransitGRETunnelUpdateParamsHealthCheckRateHigh MagicTransitGRETunnelUpdateParamsHealthCheckRate = "high" +) + +// The type of healthcheck to run, reply or request. The default value is `reply`. +type MagicTransitGRETunnelUpdateParamsHealthCheckType string + +const ( + MagicTransitGRETunnelUpdateParamsHealthCheckTypeReply MagicTransitGRETunnelUpdateParamsHealthCheckType = "reply" + MagicTransitGRETunnelUpdateParamsHealthCheckTypeRequest MagicTransitGRETunnelUpdateParamsHealthCheckType = "request" +) + +type MagicTransitGRETunnelUpdateResponseEnvelope struct { + Errors []MagicTransitGRETunnelUpdateResponseEnvelopeErrors `json:"errors,required"` + Messages []MagicTransitGRETunnelUpdateResponseEnvelopeMessages `json:"messages,required"` + Result MagicTransitGRETunnelUpdateResponse `json:"result,required"` + // Whether the API call was successful + Success MagicTransitGRETunnelUpdateResponseEnvelopeSuccess `json:"success,required"` + JSON magicTransitGRETunnelUpdateResponseEnvelopeJSON `json:"-"` +} + +// magicTransitGRETunnelUpdateResponseEnvelopeJSON contains the JSON metadata for +// the struct [MagicTransitGRETunnelUpdateResponseEnvelope] +type magicTransitGRETunnelUpdateResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitGRETunnelUpdateResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitGRETunnelUpdateResponseEnvelopeErrorsJSON `json:"-"` +} + +// magicTransitGRETunnelUpdateResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [MagicTransitGRETunnelUpdateResponseEnvelopeErrors] +type magicTransitGRETunnelUpdateResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitGRETunnelUpdateResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitGRETunnelUpdateResponseEnvelopeMessagesJSON `json:"-"` +} + +// magicTransitGRETunnelUpdateResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [MagicTransitGRETunnelUpdateResponseEnvelopeMessages] +type magicTransitGRETunnelUpdateResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type MagicTransitGRETunnelUpdateResponseEnvelopeSuccess bool + +const ( + MagicTransitGRETunnelUpdateResponseEnvelopeSuccessTrue MagicTransitGRETunnelUpdateResponseEnvelopeSuccess = true +) + +type MagicTransitGRETunnelListResponseEnvelope struct { + Errors []MagicTransitGRETunnelListResponseEnvelopeErrors `json:"errors,required"` + Messages []MagicTransitGRETunnelListResponseEnvelopeMessages `json:"messages,required"` + Result MagicTransitGRETunnelListResponse `json:"result,required"` + // Whether the API call was successful + Success MagicTransitGRETunnelListResponseEnvelopeSuccess `json:"success,required"` + JSON magicTransitGRETunnelListResponseEnvelopeJSON `json:"-"` +} + +// magicTransitGRETunnelListResponseEnvelopeJSON contains the JSON metadata for the +// struct [MagicTransitGRETunnelListResponseEnvelope] +type magicTransitGRETunnelListResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitGRETunnelListResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitGRETunnelListResponseEnvelopeErrorsJSON `json:"-"` +} + +// magicTransitGRETunnelListResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [MagicTransitGRETunnelListResponseEnvelopeErrors] +type magicTransitGRETunnelListResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitGRETunnelListResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitGRETunnelListResponseEnvelopeMessagesJSON `json:"-"` +} + +// magicTransitGRETunnelListResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [MagicTransitGRETunnelListResponseEnvelopeMessages] +type magicTransitGRETunnelListResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type MagicTransitGRETunnelListResponseEnvelopeSuccess bool + +const ( + MagicTransitGRETunnelListResponseEnvelopeSuccessTrue MagicTransitGRETunnelListResponseEnvelopeSuccess = true +) + +type MagicTransitGRETunnelDeleteResponseEnvelope struct { + Errors []MagicTransitGRETunnelDeleteResponseEnvelopeErrors `json:"errors,required"` + Messages []MagicTransitGRETunnelDeleteResponseEnvelopeMessages `json:"messages,required"` + Result MagicTransitGRETunnelDeleteResponse `json:"result,required"` + // Whether the API call was successful + Success MagicTransitGRETunnelDeleteResponseEnvelopeSuccess `json:"success,required"` + JSON magicTransitGRETunnelDeleteResponseEnvelopeJSON `json:"-"` +} + +// magicTransitGRETunnelDeleteResponseEnvelopeJSON contains the JSON metadata for +// the struct [MagicTransitGRETunnelDeleteResponseEnvelope] +type magicTransitGRETunnelDeleteResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitGRETunnelDeleteResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitGRETunnelDeleteResponseEnvelopeErrorsJSON `json:"-"` +} + +// magicTransitGRETunnelDeleteResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [MagicTransitGRETunnelDeleteResponseEnvelopeErrors] +type magicTransitGRETunnelDeleteResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitGRETunnelDeleteResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitGRETunnelDeleteResponseEnvelopeMessagesJSON `json:"-"` +} + +// magicTransitGRETunnelDeleteResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [MagicTransitGRETunnelDeleteResponseEnvelopeMessages] +type magicTransitGRETunnelDeleteResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type MagicTransitGRETunnelDeleteResponseEnvelopeSuccess bool + +const ( + MagicTransitGRETunnelDeleteResponseEnvelopeSuccessTrue MagicTransitGRETunnelDeleteResponseEnvelopeSuccess = true +) + +type MagicTransitGRETunnelGetResponseEnvelope struct { + Errors []MagicTransitGRETunnelGetResponseEnvelopeErrors `json:"errors,required"` + Messages []MagicTransitGRETunnelGetResponseEnvelopeMessages `json:"messages,required"` + Result MagicTransitGRETunnelGetResponse `json:"result,required"` + // Whether the API call was successful + Success MagicTransitGRETunnelGetResponseEnvelopeSuccess `json:"success,required"` + JSON magicTransitGRETunnelGetResponseEnvelopeJSON `json:"-"` +} + +// magicTransitGRETunnelGetResponseEnvelopeJSON contains the JSON metadata for the +// struct [MagicTransitGRETunnelGetResponseEnvelope] +type magicTransitGRETunnelGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitGRETunnelGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitGRETunnelGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// magicTransitGRETunnelGetResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [MagicTransitGRETunnelGetResponseEnvelopeErrors] +type magicTransitGRETunnelGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitGRETunnelGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitGRETunnelGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// magicTransitGRETunnelGetResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [MagicTransitGRETunnelGetResponseEnvelopeMessages] +type magicTransitGRETunnelGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitGRETunnelGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type MagicTransitGRETunnelGetResponseEnvelopeSuccess bool + +const ( + MagicTransitGRETunnelGetResponseEnvelopeSuccessTrue MagicTransitGRETunnelGetResponseEnvelopeSuccess = true +) diff --git a/magicgretunnel_test.go b/magictransitgretunnel_test.go similarity index 83% rename from magicgretunnel_test.go rename to magictransitgretunnel_test.go index f52a210a659..3fb4453546c 100644 --- a/magicgretunnel_test.go +++ b/magictransitgretunnel_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestMagicGRETunnelNew(t *testing.T) { +func TestMagicTransitGRETunnelNew(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 { @@ -29,10 +29,10 @@ func TestMagicGRETunnelNew(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Magics.GRETunnels.New( + _, err := client.MagicTransit.GRETunnels.New( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.MagicGRETunnelNewParams{ + cloudflare.MagicTransitGRETunnelNewParams{ Body: cloudflare.F[any](map[string]interface{}{}), }, ) @@ -45,7 +45,7 @@ func TestMagicGRETunnelNew(t *testing.T) { } } -func TestMagicGRETunnelUpdateWithOptionalParams(t *testing.T) { +func TestMagicTransitGRETunnelUpdateWithOptionalParams(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 { @@ -61,22 +61,22 @@ func TestMagicGRETunnelUpdateWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Magics.GRETunnels.Update( + _, err := client.MagicTransit.GRETunnels.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.MagicGRETunnelUpdateParams{ + cloudflare.MagicTransitGRETunnelUpdateParams{ CloudflareGREEndpoint: cloudflare.F("203.0.113.1"), CustomerGREEndpoint: cloudflare.F("203.0.113.1"), InterfaceAddress: cloudflare.F("192.0.2.0/31"), Name: cloudflare.F("GRE_1"), Description: cloudflare.F("Tunnel for ISP X"), - HealthCheck: cloudflare.F(cloudflare.MagicGRETunnelUpdateParamsHealthCheck{ - Direction: cloudflare.F(cloudflare.MagicGRETunnelUpdateParamsHealthCheckDirectionBidirectional), + HealthCheck: cloudflare.F(cloudflare.MagicTransitGRETunnelUpdateParamsHealthCheck{ + Direction: cloudflare.F(cloudflare.MagicTransitGRETunnelUpdateParamsHealthCheckDirectionBidirectional), Enabled: cloudflare.F(true), - Rate: cloudflare.F(cloudflare.MagicGRETunnelUpdateParamsHealthCheckRateLow), + Rate: cloudflare.F(cloudflare.MagicTransitGRETunnelUpdateParamsHealthCheckRateLow), Target: cloudflare.F("203.0.113.1"), - Type: cloudflare.F(cloudflare.MagicGRETunnelUpdateParamsHealthCheckTypeRequest), + Type: cloudflare.F(cloudflare.MagicTransitGRETunnelUpdateParamsHealthCheckTypeRequest), }), Mtu: cloudflare.F(int64(0)), TTL: cloudflare.F(int64(0)), @@ -91,7 +91,7 @@ func TestMagicGRETunnelUpdateWithOptionalParams(t *testing.T) { } } -func TestMagicGRETunnelList(t *testing.T) { +func TestMagicTransitGRETunnelList(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 { @@ -107,7 +107,7 @@ func TestMagicGRETunnelList(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Magics.GRETunnels.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") + _, err := client.MagicTransit.GRETunnels.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { var apierr *cloudflare.Error if errors.As(err, &apierr) { @@ -117,7 +117,7 @@ func TestMagicGRETunnelList(t *testing.T) { } } -func TestMagicGRETunnelDelete(t *testing.T) { +func TestMagicTransitGRETunnelDelete(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 { @@ -133,7 +133,7 @@ func TestMagicGRETunnelDelete(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Magics.GRETunnels.Delete( + _, err := client.MagicTransit.GRETunnels.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", @@ -147,7 +147,7 @@ func TestMagicGRETunnelDelete(t *testing.T) { } } -func TestMagicGRETunnelGet(t *testing.T) { +func TestMagicTransitGRETunnelGet(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 { @@ -163,7 +163,7 @@ func TestMagicGRETunnelGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Magics.GRETunnels.Get( + _, err := client.MagicTransit.GRETunnels.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", diff --git a/magictransitipsectunnel.go b/magictransitipsectunnel.go new file mode 100644 index 00000000000..2c4ec4bca07 --- /dev/null +++ b/magictransitipsectunnel.go @@ -0,0 +1,944 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// MagicTransitIPSECTunnelService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewMagicTransitIPSECTunnelService] method instead. +type MagicTransitIPSECTunnelService struct { + Options []option.RequestOption + PSKGenerates *MagicTransitIPSECTunnelPSKGenerateService +} + +// NewMagicTransitIPSECTunnelService generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewMagicTransitIPSECTunnelService(opts ...option.RequestOption) (r *MagicTransitIPSECTunnelService) { + r = &MagicTransitIPSECTunnelService{} + r.Options = opts + r.PSKGenerates = NewMagicTransitIPSECTunnelPSKGenerateService(opts...) + return +} + +// Creates new IPsec tunnels associated with an account. Use `?validate_only=true` +// as an optional query parameter to only run validation without persisting +// changes. +func (r *MagicTransitIPSECTunnelService) New(ctx context.Context, accountIdentifier string, body MagicTransitIPSECTunnelNewParams, opts ...option.RequestOption) (res *MagicTransitIPSECTunnelNewResponse, err error) { + opts = append(r.Options[:], opts...) + var env MagicTransitIPSECTunnelNewResponseEnvelope + path := fmt.Sprintf("accounts/%s/magic/ipsec_tunnels", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Updates a specific IPsec tunnel associated with an account. Use +// `?validate_only=true` as an optional query parameter to only run validation +// without persisting changes. +func (r *MagicTransitIPSECTunnelService) Update(ctx context.Context, accountIdentifier string, tunnelIdentifier string, body MagicTransitIPSECTunnelUpdateParams, opts ...option.RequestOption) (res *MagicTransitIPSECTunnelUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + var env MagicTransitIPSECTunnelUpdateResponseEnvelope + path := fmt.Sprintf("accounts/%s/magic/ipsec_tunnels/%s", accountIdentifier, tunnelIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Lists IPsec tunnels associated with an account. +func (r *MagicTransitIPSECTunnelService) List(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *MagicTransitIPSECTunnelListResponse, err error) { + opts = append(r.Options[:], opts...) + var env MagicTransitIPSECTunnelListResponseEnvelope + path := fmt.Sprintf("accounts/%s/magic/ipsec_tunnels", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Disables and removes a specific static IPsec Tunnel associated with an account. +// Use `?validate_only=true` as an optional query parameter to only run validation +// without persisting changes. +func (r *MagicTransitIPSECTunnelService) Delete(ctx context.Context, accountIdentifier string, tunnelIdentifier string, opts ...option.RequestOption) (res *MagicTransitIPSECTunnelDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + var env MagicTransitIPSECTunnelDeleteResponseEnvelope + path := fmt.Sprintf("accounts/%s/magic/ipsec_tunnels/%s", accountIdentifier, tunnelIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Lists details for a specific IPsec tunnel. +func (r *MagicTransitIPSECTunnelService) Get(ctx context.Context, accountIdentifier string, tunnelIdentifier string, opts ...option.RequestOption) (res *MagicTransitIPSECTunnelGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env MagicTransitIPSECTunnelGetResponseEnvelope + path := fmt.Sprintf("accounts/%s/magic/ipsec_tunnels/%s", accountIdentifier, tunnelIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +type MagicTransitIPSECTunnelNewResponse struct { + IPSECTunnels []MagicTransitIPSECTunnelNewResponseIPSECTunnel `json:"ipsec_tunnels"` + JSON magicTransitIPSECTunnelNewResponseJSON `json:"-"` +} + +// magicTransitIPSECTunnelNewResponseJSON contains the JSON metadata for the struct +// [MagicTransitIPSECTunnelNewResponse] +type magicTransitIPSECTunnelNewResponseJSON struct { + IPSECTunnels apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitIPSECTunnelNewResponseIPSECTunnel struct { + // The IP address assigned to the Cloudflare side of the IPsec tunnel. + CloudflareEndpoint string `json:"cloudflare_endpoint,required"` + // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + // of the tunnel. Select the subnet from the following private IP space: + // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + InterfaceAddress string `json:"interface_address,required"` + // The name of the IPsec tunnel. The name cannot share a name with other tunnels. + Name string `json:"name,required"` + // Tunnel identifier tag. + ID string `json:"id"` + // When `true`, the tunnel can use a null-cipher (`ENCR_NULL`) in the ESP tunnel + // (Phase 2). + AllowNullCipher bool `json:"allow_null_cipher"` + // The date and time the tunnel was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // The IP address assigned to the customer side of the IPsec tunnel. + CustomerEndpoint string `json:"customer_endpoint"` + // An optional description forthe IPsec tunnel. + Description string `json:"description"` + // The date and time the tunnel was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The PSK metadata that includes when the PSK was generated. + PSKMetadata MagicTransitIPSECTunnelNewResponseIPSECTunnelsPSKMetadata `json:"psk_metadata"` + // If `true`, then IPsec replay protection will be supported in the + // Cloudflare-to-customer direction. + ReplayProtection bool `json:"replay_protection"` + TunnelHealthCheck MagicTransitIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheck `json:"tunnel_health_check"` + JSON magicTransitIPSECTunnelNewResponseIPSECTunnelJSON `json:"-"` +} + +// magicTransitIPSECTunnelNewResponseIPSECTunnelJSON contains the JSON metadata for +// the struct [MagicTransitIPSECTunnelNewResponseIPSECTunnel] +type magicTransitIPSECTunnelNewResponseIPSECTunnelJSON struct { + CloudflareEndpoint apijson.Field + InterfaceAddress apijson.Field + Name apijson.Field + ID apijson.Field + AllowNullCipher apijson.Field + CreatedOn apijson.Field + CustomerEndpoint apijson.Field + Description apijson.Field + ModifiedOn apijson.Field + PSKMetadata apijson.Field + ReplayProtection apijson.Field + TunnelHealthCheck apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelNewResponseIPSECTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The PSK metadata that includes when the PSK was generated. +type MagicTransitIPSECTunnelNewResponseIPSECTunnelsPSKMetadata struct { + // The date and time the tunnel was last modified. + LastGeneratedOn time.Time `json:"last_generated_on" format:"date-time"` + JSON magicTransitIPSECTunnelNewResponseIPSECTunnelsPSKMetadataJSON `json:"-"` +} + +// magicTransitIPSECTunnelNewResponseIPSECTunnelsPSKMetadataJSON contains the JSON +// metadata for the struct +// [MagicTransitIPSECTunnelNewResponseIPSECTunnelsPSKMetadata] +type magicTransitIPSECTunnelNewResponseIPSECTunnelsPSKMetadataJSON struct { + LastGeneratedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelNewResponseIPSECTunnelsPSKMetadata) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheck struct { + // Determines whether to run healthchecks for a tunnel. + Enabled bool `json:"enabled"` + // How frequent the health check is run. The default value is `mid`. + Rate MagicTransitIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckRate `json:"rate"` + // The destination address in a request type health check. After the healthcheck is + // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + // to this address. This field defaults to `customer_gre_endpoint address`. + Target string `json:"target"` + // The type of healthcheck to run, reply or request. The default value is `reply`. + Type MagicTransitIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckType `json:"type"` + JSON magicTransitIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckJSON `json:"-"` +} + +// magicTransitIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckJSON contains the +// JSON metadata for the struct +// [MagicTransitIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheck] +type magicTransitIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckJSON struct { + Enabled apijson.Field + Rate apijson.Field + Target apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheck) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// How frequent the health check is run. The default value is `mid`. +type MagicTransitIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckRate string + +const ( + MagicTransitIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckRateLow MagicTransitIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckRate = "low" + MagicTransitIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckRateMid MagicTransitIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckRate = "mid" + MagicTransitIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckRateHigh MagicTransitIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckRate = "high" +) + +// The type of healthcheck to run, reply or request. The default value is `reply`. +type MagicTransitIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckType string + +const ( + MagicTransitIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckTypeReply MagicTransitIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckType = "reply" + MagicTransitIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckTypeRequest MagicTransitIPSECTunnelNewResponseIPSECTunnelsTunnelHealthCheckType = "request" +) + +type MagicTransitIPSECTunnelUpdateResponse struct { + Modified bool `json:"modified"` + ModifiedIPSECTunnel interface{} `json:"modified_ipsec_tunnel"` + JSON magicTransitIPSECTunnelUpdateResponseJSON `json:"-"` +} + +// magicTransitIPSECTunnelUpdateResponseJSON contains the JSON metadata for the +// struct [MagicTransitIPSECTunnelUpdateResponse] +type magicTransitIPSECTunnelUpdateResponseJSON struct { + Modified apijson.Field + ModifiedIPSECTunnel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitIPSECTunnelListResponse struct { + IPSECTunnels []MagicTransitIPSECTunnelListResponseIPSECTunnel `json:"ipsec_tunnels"` + JSON magicTransitIPSECTunnelListResponseJSON `json:"-"` +} + +// magicTransitIPSECTunnelListResponseJSON contains the JSON metadata for the +// struct [MagicTransitIPSECTunnelListResponse] +type magicTransitIPSECTunnelListResponseJSON struct { + IPSECTunnels apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitIPSECTunnelListResponseIPSECTunnel struct { + // The IP address assigned to the Cloudflare side of the IPsec tunnel. + CloudflareEndpoint string `json:"cloudflare_endpoint,required"` + // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + // of the tunnel. Select the subnet from the following private IP space: + // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + InterfaceAddress string `json:"interface_address,required"` + // The name of the IPsec tunnel. The name cannot share a name with other tunnels. + Name string `json:"name,required"` + // Tunnel identifier tag. + ID string `json:"id"` + // When `true`, the tunnel can use a null-cipher (`ENCR_NULL`) in the ESP tunnel + // (Phase 2). + AllowNullCipher bool `json:"allow_null_cipher"` + // The date and time the tunnel was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // The IP address assigned to the customer side of the IPsec tunnel. + CustomerEndpoint string `json:"customer_endpoint"` + // An optional description forthe IPsec tunnel. + Description string `json:"description"` + // The date and time the tunnel was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The PSK metadata that includes when the PSK was generated. + PSKMetadata MagicTransitIPSECTunnelListResponseIPSECTunnelsPSKMetadata `json:"psk_metadata"` + // If `true`, then IPsec replay protection will be supported in the + // Cloudflare-to-customer direction. + ReplayProtection bool `json:"replay_protection"` + TunnelHealthCheck MagicTransitIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheck `json:"tunnel_health_check"` + JSON magicTransitIPSECTunnelListResponseIPSECTunnelJSON `json:"-"` +} + +// magicTransitIPSECTunnelListResponseIPSECTunnelJSON contains the JSON metadata +// for the struct [MagicTransitIPSECTunnelListResponseIPSECTunnel] +type magicTransitIPSECTunnelListResponseIPSECTunnelJSON struct { + CloudflareEndpoint apijson.Field + InterfaceAddress apijson.Field + Name apijson.Field + ID apijson.Field + AllowNullCipher apijson.Field + CreatedOn apijson.Field + CustomerEndpoint apijson.Field + Description apijson.Field + ModifiedOn apijson.Field + PSKMetadata apijson.Field + ReplayProtection apijson.Field + TunnelHealthCheck apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelListResponseIPSECTunnel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The PSK metadata that includes when the PSK was generated. +type MagicTransitIPSECTunnelListResponseIPSECTunnelsPSKMetadata struct { + // The date and time the tunnel was last modified. + LastGeneratedOn time.Time `json:"last_generated_on" format:"date-time"` + JSON magicTransitIPSECTunnelListResponseIPSECTunnelsPSKMetadataJSON `json:"-"` +} + +// magicTransitIPSECTunnelListResponseIPSECTunnelsPSKMetadataJSON contains the JSON +// metadata for the struct +// [MagicTransitIPSECTunnelListResponseIPSECTunnelsPSKMetadata] +type magicTransitIPSECTunnelListResponseIPSECTunnelsPSKMetadataJSON struct { + LastGeneratedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelListResponseIPSECTunnelsPSKMetadata) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheck struct { + // Determines whether to run healthchecks for a tunnel. + Enabled bool `json:"enabled"` + // How frequent the health check is run. The default value is `mid`. + Rate MagicTransitIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckRate `json:"rate"` + // The destination address in a request type health check. After the healthcheck is + // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + // to this address. This field defaults to `customer_gre_endpoint address`. + Target string `json:"target"` + // The type of healthcheck to run, reply or request. The default value is `reply`. + Type MagicTransitIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckType `json:"type"` + JSON magicTransitIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckJSON `json:"-"` +} + +// magicTransitIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckJSON contains +// the JSON metadata for the struct +// [MagicTransitIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheck] +type magicTransitIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckJSON struct { + Enabled apijson.Field + Rate apijson.Field + Target apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheck) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// How frequent the health check is run. The default value is `mid`. +type MagicTransitIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckRate string + +const ( + MagicTransitIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckRateLow MagicTransitIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckRate = "low" + MagicTransitIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckRateMid MagicTransitIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckRate = "mid" + MagicTransitIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckRateHigh MagicTransitIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckRate = "high" +) + +// The type of healthcheck to run, reply or request. The default value is `reply`. +type MagicTransitIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckType string + +const ( + MagicTransitIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckTypeReply MagicTransitIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckType = "reply" + MagicTransitIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckTypeRequest MagicTransitIPSECTunnelListResponseIPSECTunnelsTunnelHealthCheckType = "request" +) + +type MagicTransitIPSECTunnelDeleteResponse struct { + Deleted bool `json:"deleted"` + DeletedIPSECTunnel interface{} `json:"deleted_ipsec_tunnel"` + JSON magicTransitIPSECTunnelDeleteResponseJSON `json:"-"` +} + +// magicTransitIPSECTunnelDeleteResponseJSON contains the JSON metadata for the +// struct [MagicTransitIPSECTunnelDeleteResponse] +type magicTransitIPSECTunnelDeleteResponseJSON struct { + Deleted apijson.Field + DeletedIPSECTunnel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitIPSECTunnelGetResponse struct { + IPSECTunnel interface{} `json:"ipsec_tunnel"` + JSON magicTransitIPSECTunnelGetResponseJSON `json:"-"` +} + +// magicTransitIPSECTunnelGetResponseJSON contains the JSON metadata for the struct +// [MagicTransitIPSECTunnelGetResponse] +type magicTransitIPSECTunnelGetResponseJSON struct { + IPSECTunnel apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitIPSECTunnelNewParams struct { + // The IP address assigned to the Cloudflare side of the IPsec tunnel. + CloudflareEndpoint param.Field[string] `json:"cloudflare_endpoint,required"` + // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + // of the tunnel. Select the subnet from the following private IP space: + // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + InterfaceAddress param.Field[string] `json:"interface_address,required"` + // The name of the IPsec tunnel. The name cannot share a name with other tunnels. + Name param.Field[string] `json:"name,required"` + // The IP address assigned to the customer side of the IPsec tunnel. + CustomerEndpoint param.Field[string] `json:"customer_endpoint"` + // An optional description forthe IPsec tunnel. + Description param.Field[string] `json:"description"` + HealthCheck param.Field[MagicTransitIPSECTunnelNewParamsHealthCheck] `json:"health_check"` + // A randomly generated or provided string for use in the IPsec tunnel. + PSK param.Field[string] `json:"psk"` + // If `true`, then IPsec replay protection will be supported in the + // Cloudflare-to-customer direction. + ReplayProtection param.Field[bool] `json:"replay_protection"` +} + +func (r MagicTransitIPSECTunnelNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type MagicTransitIPSECTunnelNewParamsHealthCheck struct { + // The direction of the flow of the healthcheck. Either unidirectional, where the + // probe comes to you via the tunnel and the result comes back to Cloudflare via + // the open Internet, or bidirectional where both the probe and result come and go + // via the tunnel. Note in the case of bidirecitonal healthchecks, the target field + // in health_check is ignored as the interface_address is used to send traffic into + // the tunnel. + Direction param.Field[MagicTransitIPSECTunnelNewParamsHealthCheckDirection] `json:"direction"` + // Determines whether to run healthchecks for a tunnel. + Enabled param.Field[bool] `json:"enabled"` + // How frequent the health check is run. The default value is `mid`. + Rate param.Field[MagicTransitIPSECTunnelNewParamsHealthCheckRate] `json:"rate"` + // The destination address in a request type health check. After the healthcheck is + // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + // to this address. This field defaults to `customer_gre_endpoint address`. This + // field is ignored for bidirectional healthchecks as the interface_address (not + // assigned to the Cloudflare side of the tunnel) is used as the target. + Target param.Field[string] `json:"target"` + // The type of healthcheck to run, reply or request. The default value is `reply`. + Type param.Field[MagicTransitIPSECTunnelNewParamsHealthCheckType] `json:"type"` +} + +func (r MagicTransitIPSECTunnelNewParamsHealthCheck) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The direction of the flow of the healthcheck. Either unidirectional, where the +// probe comes to you via the tunnel and the result comes back to Cloudflare via +// the open Internet, or bidirectional where both the probe and result come and go +// via the tunnel. Note in the case of bidirecitonal healthchecks, the target field +// in health_check is ignored as the interface_address is used to send traffic into +// the tunnel. +type MagicTransitIPSECTunnelNewParamsHealthCheckDirection string + +const ( + MagicTransitIPSECTunnelNewParamsHealthCheckDirectionUnidirectional MagicTransitIPSECTunnelNewParamsHealthCheckDirection = "unidirectional" + MagicTransitIPSECTunnelNewParamsHealthCheckDirectionBidirectional MagicTransitIPSECTunnelNewParamsHealthCheckDirection = "bidirectional" +) + +// How frequent the health check is run. The default value is `mid`. +type MagicTransitIPSECTunnelNewParamsHealthCheckRate string + +const ( + MagicTransitIPSECTunnelNewParamsHealthCheckRateLow MagicTransitIPSECTunnelNewParamsHealthCheckRate = "low" + MagicTransitIPSECTunnelNewParamsHealthCheckRateMid MagicTransitIPSECTunnelNewParamsHealthCheckRate = "mid" + MagicTransitIPSECTunnelNewParamsHealthCheckRateHigh MagicTransitIPSECTunnelNewParamsHealthCheckRate = "high" +) + +// The type of healthcheck to run, reply or request. The default value is `reply`. +type MagicTransitIPSECTunnelNewParamsHealthCheckType string + +const ( + MagicTransitIPSECTunnelNewParamsHealthCheckTypeReply MagicTransitIPSECTunnelNewParamsHealthCheckType = "reply" + MagicTransitIPSECTunnelNewParamsHealthCheckTypeRequest MagicTransitIPSECTunnelNewParamsHealthCheckType = "request" +) + +type MagicTransitIPSECTunnelNewResponseEnvelope struct { + Errors []MagicTransitIPSECTunnelNewResponseEnvelopeErrors `json:"errors,required"` + Messages []MagicTransitIPSECTunnelNewResponseEnvelopeMessages `json:"messages,required"` + Result MagicTransitIPSECTunnelNewResponse `json:"result,required"` + // Whether the API call was successful + Success MagicTransitIPSECTunnelNewResponseEnvelopeSuccess `json:"success,required"` + JSON magicTransitIPSECTunnelNewResponseEnvelopeJSON `json:"-"` +} + +// magicTransitIPSECTunnelNewResponseEnvelopeJSON contains the JSON metadata for +// the struct [MagicTransitIPSECTunnelNewResponseEnvelope] +type magicTransitIPSECTunnelNewResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitIPSECTunnelNewResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitIPSECTunnelNewResponseEnvelopeErrorsJSON `json:"-"` +} + +// magicTransitIPSECTunnelNewResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [MagicTransitIPSECTunnelNewResponseEnvelopeErrors] +type magicTransitIPSECTunnelNewResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitIPSECTunnelNewResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitIPSECTunnelNewResponseEnvelopeMessagesJSON `json:"-"` +} + +// magicTransitIPSECTunnelNewResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [MagicTransitIPSECTunnelNewResponseEnvelopeMessages] +type magicTransitIPSECTunnelNewResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type MagicTransitIPSECTunnelNewResponseEnvelopeSuccess bool + +const ( + MagicTransitIPSECTunnelNewResponseEnvelopeSuccessTrue MagicTransitIPSECTunnelNewResponseEnvelopeSuccess = true +) + +type MagicTransitIPSECTunnelUpdateParams struct { + // The IP address assigned to the Cloudflare side of the IPsec tunnel. + CloudflareEndpoint param.Field[string] `json:"cloudflare_endpoint,required"` + // A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + // of the tunnel. Select the subnet from the following private IP space: + // 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + InterfaceAddress param.Field[string] `json:"interface_address,required"` + // The name of the IPsec tunnel. The name cannot share a name with other tunnels. + Name param.Field[string] `json:"name,required"` + // The IP address assigned to the customer side of the IPsec tunnel. + CustomerEndpoint param.Field[string] `json:"customer_endpoint"` + // An optional description forthe IPsec tunnel. + Description param.Field[string] `json:"description"` + HealthCheck param.Field[MagicTransitIPSECTunnelUpdateParamsHealthCheck] `json:"health_check"` + // A randomly generated or provided string for use in the IPsec tunnel. + PSK param.Field[string] `json:"psk"` + // If `true`, then IPsec replay protection will be supported in the + // Cloudflare-to-customer direction. + ReplayProtection param.Field[bool] `json:"replay_protection"` +} + +func (r MagicTransitIPSECTunnelUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type MagicTransitIPSECTunnelUpdateParamsHealthCheck struct { + // The direction of the flow of the healthcheck. Either unidirectional, where the + // probe comes to you via the tunnel and the result comes back to Cloudflare via + // the open Internet, or bidirectional where both the probe and result come and go + // via the tunnel. Note in the case of bidirecitonal healthchecks, the target field + // in health_check is ignored as the interface_address is used to send traffic into + // the tunnel. + Direction param.Field[MagicTransitIPSECTunnelUpdateParamsHealthCheckDirection] `json:"direction"` + // Determines whether to run healthchecks for a tunnel. + Enabled param.Field[bool] `json:"enabled"` + // How frequent the health check is run. The default value is `mid`. + Rate param.Field[MagicTransitIPSECTunnelUpdateParamsHealthCheckRate] `json:"rate"` + // The destination address in a request type health check. After the healthcheck is + // decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + // to this address. This field defaults to `customer_gre_endpoint address`. This + // field is ignored for bidirectional healthchecks as the interface_address (not + // assigned to the Cloudflare side of the tunnel) is used as the target. + Target param.Field[string] `json:"target"` + // The type of healthcheck to run, reply or request. The default value is `reply`. + Type param.Field[MagicTransitIPSECTunnelUpdateParamsHealthCheckType] `json:"type"` +} + +func (r MagicTransitIPSECTunnelUpdateParamsHealthCheck) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The direction of the flow of the healthcheck. Either unidirectional, where the +// probe comes to you via the tunnel and the result comes back to Cloudflare via +// the open Internet, or bidirectional where both the probe and result come and go +// via the tunnel. Note in the case of bidirecitonal healthchecks, the target field +// in health_check is ignored as the interface_address is used to send traffic into +// the tunnel. +type MagicTransitIPSECTunnelUpdateParamsHealthCheckDirection string + +const ( + MagicTransitIPSECTunnelUpdateParamsHealthCheckDirectionUnidirectional MagicTransitIPSECTunnelUpdateParamsHealthCheckDirection = "unidirectional" + MagicTransitIPSECTunnelUpdateParamsHealthCheckDirectionBidirectional MagicTransitIPSECTunnelUpdateParamsHealthCheckDirection = "bidirectional" +) + +// How frequent the health check is run. The default value is `mid`. +type MagicTransitIPSECTunnelUpdateParamsHealthCheckRate string + +const ( + MagicTransitIPSECTunnelUpdateParamsHealthCheckRateLow MagicTransitIPSECTunnelUpdateParamsHealthCheckRate = "low" + MagicTransitIPSECTunnelUpdateParamsHealthCheckRateMid MagicTransitIPSECTunnelUpdateParamsHealthCheckRate = "mid" + MagicTransitIPSECTunnelUpdateParamsHealthCheckRateHigh MagicTransitIPSECTunnelUpdateParamsHealthCheckRate = "high" +) + +// The type of healthcheck to run, reply or request. The default value is `reply`. +type MagicTransitIPSECTunnelUpdateParamsHealthCheckType string + +const ( + MagicTransitIPSECTunnelUpdateParamsHealthCheckTypeReply MagicTransitIPSECTunnelUpdateParamsHealthCheckType = "reply" + MagicTransitIPSECTunnelUpdateParamsHealthCheckTypeRequest MagicTransitIPSECTunnelUpdateParamsHealthCheckType = "request" +) + +type MagicTransitIPSECTunnelUpdateResponseEnvelope struct { + Errors []MagicTransitIPSECTunnelUpdateResponseEnvelopeErrors `json:"errors,required"` + Messages []MagicTransitIPSECTunnelUpdateResponseEnvelopeMessages `json:"messages,required"` + Result MagicTransitIPSECTunnelUpdateResponse `json:"result,required"` + // Whether the API call was successful + Success MagicTransitIPSECTunnelUpdateResponseEnvelopeSuccess `json:"success,required"` + JSON magicTransitIPSECTunnelUpdateResponseEnvelopeJSON `json:"-"` +} + +// magicTransitIPSECTunnelUpdateResponseEnvelopeJSON contains the JSON metadata for +// the struct [MagicTransitIPSECTunnelUpdateResponseEnvelope] +type magicTransitIPSECTunnelUpdateResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitIPSECTunnelUpdateResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitIPSECTunnelUpdateResponseEnvelopeErrorsJSON `json:"-"` +} + +// magicTransitIPSECTunnelUpdateResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [MagicTransitIPSECTunnelUpdateResponseEnvelopeErrors] +type magicTransitIPSECTunnelUpdateResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitIPSECTunnelUpdateResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitIPSECTunnelUpdateResponseEnvelopeMessagesJSON `json:"-"` +} + +// magicTransitIPSECTunnelUpdateResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [MagicTransitIPSECTunnelUpdateResponseEnvelopeMessages] +type magicTransitIPSECTunnelUpdateResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type MagicTransitIPSECTunnelUpdateResponseEnvelopeSuccess bool + +const ( + MagicTransitIPSECTunnelUpdateResponseEnvelopeSuccessTrue MagicTransitIPSECTunnelUpdateResponseEnvelopeSuccess = true +) + +type MagicTransitIPSECTunnelListResponseEnvelope struct { + Errors []MagicTransitIPSECTunnelListResponseEnvelopeErrors `json:"errors,required"` + Messages []MagicTransitIPSECTunnelListResponseEnvelopeMessages `json:"messages,required"` + Result MagicTransitIPSECTunnelListResponse `json:"result,required"` + // Whether the API call was successful + Success MagicTransitIPSECTunnelListResponseEnvelopeSuccess `json:"success,required"` + JSON magicTransitIPSECTunnelListResponseEnvelopeJSON `json:"-"` +} + +// magicTransitIPSECTunnelListResponseEnvelopeJSON contains the JSON metadata for +// the struct [MagicTransitIPSECTunnelListResponseEnvelope] +type magicTransitIPSECTunnelListResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitIPSECTunnelListResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitIPSECTunnelListResponseEnvelopeErrorsJSON `json:"-"` +} + +// magicTransitIPSECTunnelListResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [MagicTransitIPSECTunnelListResponseEnvelopeErrors] +type magicTransitIPSECTunnelListResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitIPSECTunnelListResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitIPSECTunnelListResponseEnvelopeMessagesJSON `json:"-"` +} + +// magicTransitIPSECTunnelListResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [MagicTransitIPSECTunnelListResponseEnvelopeMessages] +type magicTransitIPSECTunnelListResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type MagicTransitIPSECTunnelListResponseEnvelopeSuccess bool + +const ( + MagicTransitIPSECTunnelListResponseEnvelopeSuccessTrue MagicTransitIPSECTunnelListResponseEnvelopeSuccess = true +) + +type MagicTransitIPSECTunnelDeleteResponseEnvelope struct { + Errors []MagicTransitIPSECTunnelDeleteResponseEnvelopeErrors `json:"errors,required"` + Messages []MagicTransitIPSECTunnelDeleteResponseEnvelopeMessages `json:"messages,required"` + Result MagicTransitIPSECTunnelDeleteResponse `json:"result,required"` + // Whether the API call was successful + Success MagicTransitIPSECTunnelDeleteResponseEnvelopeSuccess `json:"success,required"` + JSON magicTransitIPSECTunnelDeleteResponseEnvelopeJSON `json:"-"` +} + +// magicTransitIPSECTunnelDeleteResponseEnvelopeJSON contains the JSON metadata for +// the struct [MagicTransitIPSECTunnelDeleteResponseEnvelope] +type magicTransitIPSECTunnelDeleteResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitIPSECTunnelDeleteResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitIPSECTunnelDeleteResponseEnvelopeErrorsJSON `json:"-"` +} + +// magicTransitIPSECTunnelDeleteResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [MagicTransitIPSECTunnelDeleteResponseEnvelopeErrors] +type magicTransitIPSECTunnelDeleteResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitIPSECTunnelDeleteResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitIPSECTunnelDeleteResponseEnvelopeMessagesJSON `json:"-"` +} + +// magicTransitIPSECTunnelDeleteResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [MagicTransitIPSECTunnelDeleteResponseEnvelopeMessages] +type magicTransitIPSECTunnelDeleteResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type MagicTransitIPSECTunnelDeleteResponseEnvelopeSuccess bool + +const ( + MagicTransitIPSECTunnelDeleteResponseEnvelopeSuccessTrue MagicTransitIPSECTunnelDeleteResponseEnvelopeSuccess = true +) + +type MagicTransitIPSECTunnelGetResponseEnvelope struct { + Errors []MagicTransitIPSECTunnelGetResponseEnvelopeErrors `json:"errors,required"` + Messages []MagicTransitIPSECTunnelGetResponseEnvelopeMessages `json:"messages,required"` + Result MagicTransitIPSECTunnelGetResponse `json:"result,required"` + // Whether the API call was successful + Success MagicTransitIPSECTunnelGetResponseEnvelopeSuccess `json:"success,required"` + JSON magicTransitIPSECTunnelGetResponseEnvelopeJSON `json:"-"` +} + +// magicTransitIPSECTunnelGetResponseEnvelopeJSON contains the JSON metadata for +// the struct [MagicTransitIPSECTunnelGetResponseEnvelope] +type magicTransitIPSECTunnelGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitIPSECTunnelGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitIPSECTunnelGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// magicTransitIPSECTunnelGetResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [MagicTransitIPSECTunnelGetResponseEnvelopeErrors] +type magicTransitIPSECTunnelGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitIPSECTunnelGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitIPSECTunnelGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// magicTransitIPSECTunnelGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [MagicTransitIPSECTunnelGetResponseEnvelopeMessages] +type magicTransitIPSECTunnelGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type MagicTransitIPSECTunnelGetResponseEnvelopeSuccess bool + +const ( + MagicTransitIPSECTunnelGetResponseEnvelopeSuccessTrue MagicTransitIPSECTunnelGetResponseEnvelopeSuccess = true +) diff --git a/magicipsectunnel_test.go b/magictransitipsectunnel_test.go similarity index 79% rename from magicipsectunnel_test.go rename to magictransitipsectunnel_test.go index 2720282d723..58e7d1a02d1 100644 --- a/magicipsectunnel_test.go +++ b/magictransitipsectunnel_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestMagicIPSECTunnelNewWithOptionalParams(t *testing.T) { +func TestMagicTransitIPSECTunnelNewWithOptionalParams(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 { @@ -29,21 +29,21 @@ func TestMagicIPSECTunnelNewWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Magics.IPSECTunnels.New( + _, err := client.MagicTransit.IPSECTunnels.New( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.MagicIPSECTunnelNewParams{ + cloudflare.MagicTransitIPSECTunnelNewParams{ CloudflareEndpoint: cloudflare.F("203.0.113.1"), InterfaceAddress: cloudflare.F("192.0.2.0/31"), Name: cloudflare.F("IPsec_1"), CustomerEndpoint: cloudflare.F("203.0.113.1"), Description: cloudflare.F("Tunnel for ISP X"), - HealthCheck: cloudflare.F(cloudflare.MagicIPSECTunnelNewParamsHealthCheck{ - Direction: cloudflare.F(cloudflare.MagicIPSECTunnelNewParamsHealthCheckDirectionBidirectional), + HealthCheck: cloudflare.F(cloudflare.MagicTransitIPSECTunnelNewParamsHealthCheck{ + Direction: cloudflare.F(cloudflare.MagicTransitIPSECTunnelNewParamsHealthCheckDirectionBidirectional), Enabled: cloudflare.F(true), - Rate: cloudflare.F(cloudflare.MagicIPSECTunnelNewParamsHealthCheckRateLow), + Rate: cloudflare.F(cloudflare.MagicTransitIPSECTunnelNewParamsHealthCheckRateLow), Target: cloudflare.F("203.0.113.1"), - Type: cloudflare.F(cloudflare.MagicIPSECTunnelNewParamsHealthCheckTypeRequest), + Type: cloudflare.F(cloudflare.MagicTransitIPSECTunnelNewParamsHealthCheckTypeRequest), }), PSK: cloudflare.F("O3bwKSjnaoCxDoUxjcq4Rk8ZKkezQUiy"), ReplayProtection: cloudflare.F(false), @@ -58,7 +58,7 @@ func TestMagicIPSECTunnelNewWithOptionalParams(t *testing.T) { } } -func TestMagicIPSECTunnelUpdateWithOptionalParams(t *testing.T) { +func TestMagicTransitIPSECTunnelUpdateWithOptionalParams(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 { @@ -74,22 +74,22 @@ func TestMagicIPSECTunnelUpdateWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Magics.IPSECTunnels.Update( + _, err := client.MagicTransit.IPSECTunnels.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.MagicIPSECTunnelUpdateParams{ + cloudflare.MagicTransitIPSECTunnelUpdateParams{ CloudflareEndpoint: cloudflare.F("203.0.113.1"), InterfaceAddress: cloudflare.F("192.0.2.0/31"), Name: cloudflare.F("IPsec_1"), CustomerEndpoint: cloudflare.F("203.0.113.1"), Description: cloudflare.F("Tunnel for ISP X"), - HealthCheck: cloudflare.F(cloudflare.MagicIPSECTunnelUpdateParamsHealthCheck{ - Direction: cloudflare.F(cloudflare.MagicIPSECTunnelUpdateParamsHealthCheckDirectionBidirectional), + HealthCheck: cloudflare.F(cloudflare.MagicTransitIPSECTunnelUpdateParamsHealthCheck{ + Direction: cloudflare.F(cloudflare.MagicTransitIPSECTunnelUpdateParamsHealthCheckDirectionBidirectional), Enabled: cloudflare.F(true), - Rate: cloudflare.F(cloudflare.MagicIPSECTunnelUpdateParamsHealthCheckRateLow), + Rate: cloudflare.F(cloudflare.MagicTransitIPSECTunnelUpdateParamsHealthCheckRateLow), Target: cloudflare.F("203.0.113.1"), - Type: cloudflare.F(cloudflare.MagicIPSECTunnelUpdateParamsHealthCheckTypeRequest), + Type: cloudflare.F(cloudflare.MagicTransitIPSECTunnelUpdateParamsHealthCheckTypeRequest), }), PSK: cloudflare.F("O3bwKSjnaoCxDoUxjcq4Rk8ZKkezQUiy"), ReplayProtection: cloudflare.F(false), @@ -104,7 +104,7 @@ func TestMagicIPSECTunnelUpdateWithOptionalParams(t *testing.T) { } } -func TestMagicIPSECTunnelList(t *testing.T) { +func TestMagicTransitIPSECTunnelList(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 { @@ -120,7 +120,7 @@ func TestMagicIPSECTunnelList(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Magics.IPSECTunnels.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") + _, err := client.MagicTransit.IPSECTunnels.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { var apierr *cloudflare.Error if errors.As(err, &apierr) { @@ -130,7 +130,7 @@ func TestMagicIPSECTunnelList(t *testing.T) { } } -func TestMagicIPSECTunnelDelete(t *testing.T) { +func TestMagicTransitIPSECTunnelDelete(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 { @@ -146,7 +146,7 @@ func TestMagicIPSECTunnelDelete(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Magics.IPSECTunnels.Delete( + _, err := client.MagicTransit.IPSECTunnels.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", @@ -160,7 +160,7 @@ func TestMagicIPSECTunnelDelete(t *testing.T) { } } -func TestMagicIPSECTunnelGet(t *testing.T) { +func TestMagicTransitIPSECTunnelGet(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 { @@ -176,7 +176,7 @@ func TestMagicIPSECTunnelGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Magics.IPSECTunnels.Get( + _, err := client.MagicTransit.IPSECTunnels.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", diff --git a/magictransitipsectunnelpskgenerate.go b/magictransitipsectunnelpskgenerate.go new file mode 100644 index 00000000000..9696eb46875 --- /dev/null +++ b/magictransitipsectunnelpskgenerate.go @@ -0,0 +1,165 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// MagicTransitIPSECTunnelPSKGenerateService contains methods and other services +// that help with interacting with the cloudflare API. Note, unlike clients, this +// service does not read variables from the environment automatically. You should +// not instantiate this service directly, and instead use the +// [NewMagicTransitIPSECTunnelPSKGenerateService] method instead. +type MagicTransitIPSECTunnelPSKGenerateService struct { + Options []option.RequestOption +} + +// NewMagicTransitIPSECTunnelPSKGenerateService generates a new service that +// applies the given options to each request. These options are applied after the +// parent client's options (if there is one), and before any request-specific +// options. +func NewMagicTransitIPSECTunnelPSKGenerateService(opts ...option.RequestOption) (r *MagicTransitIPSECTunnelPSKGenerateService) { + r = &MagicTransitIPSECTunnelPSKGenerateService{} + r.Options = opts + return +} + +// Generates a Pre Shared Key for a specific IPsec tunnel used in the IKE session. +// Use `?validate_only=true` as an optional query parameter to only run validation +// without persisting changes. After a PSK is generated, the PSK is immediately +// persisted to Cloudflare's edge and cannot be retrieved later. Note the PSK in a +// safe place. +func (r *MagicTransitIPSECTunnelPSKGenerateService) New(ctx context.Context, accountIdentifier string, tunnelIdentifier string, opts ...option.RequestOption) (res *MagicTransitIPSECTunnelPSKGenerateNewResponse, err error) { + opts = append(r.Options[:], opts...) + var env MagicTransitIPSECTunnelPSKGenerateNewResponseEnvelope + path := fmt.Sprintf("accounts/%s/magic/ipsec_tunnels/%s/psk_generate", accountIdentifier, tunnelIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +type MagicTransitIPSECTunnelPSKGenerateNewResponse struct { + // Identifier + IPSECTunnelID string `json:"ipsec_tunnel_id"` + // A randomly generated or provided string for use in the IPsec tunnel. + PSK string `json:"psk"` + // The PSK metadata that includes when the PSK was generated. + PSKMetadata MagicTransitIPSECTunnelPSKGenerateNewResponsePSKMetadata `json:"psk_metadata"` + JSON magicTransitIPSECTunnelPSKGenerateNewResponseJSON `json:"-"` +} + +// magicTransitIPSECTunnelPSKGenerateNewResponseJSON contains the JSON metadata for +// the struct [MagicTransitIPSECTunnelPSKGenerateNewResponse] +type magicTransitIPSECTunnelPSKGenerateNewResponseJSON struct { + IPSECTunnelID apijson.Field + PSK apijson.Field + PSKMetadata apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelPSKGenerateNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The PSK metadata that includes when the PSK was generated. +type MagicTransitIPSECTunnelPSKGenerateNewResponsePSKMetadata struct { + // The date and time the tunnel was last modified. + LastGeneratedOn time.Time `json:"last_generated_on" format:"date-time"` + JSON magicTransitIPSECTunnelPSKGenerateNewResponsePSKMetadataJSON `json:"-"` +} + +// magicTransitIPSECTunnelPSKGenerateNewResponsePSKMetadataJSON contains the JSON +// metadata for the struct +// [MagicTransitIPSECTunnelPSKGenerateNewResponsePSKMetadata] +type magicTransitIPSECTunnelPSKGenerateNewResponsePSKMetadataJSON struct { + LastGeneratedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelPSKGenerateNewResponsePSKMetadata) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitIPSECTunnelPSKGenerateNewResponseEnvelope struct { + Errors []MagicTransitIPSECTunnelPSKGenerateNewResponseEnvelopeErrors `json:"errors,required"` + Messages []MagicTransitIPSECTunnelPSKGenerateNewResponseEnvelopeMessages `json:"messages,required"` + Result MagicTransitIPSECTunnelPSKGenerateNewResponse `json:"result,required"` + // Whether the API call was successful + Success MagicTransitIPSECTunnelPSKGenerateNewResponseEnvelopeSuccess `json:"success,required"` + JSON magicTransitIPSECTunnelPSKGenerateNewResponseEnvelopeJSON `json:"-"` +} + +// magicTransitIPSECTunnelPSKGenerateNewResponseEnvelopeJSON contains the JSON +// metadata for the struct [MagicTransitIPSECTunnelPSKGenerateNewResponseEnvelope] +type magicTransitIPSECTunnelPSKGenerateNewResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelPSKGenerateNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitIPSECTunnelPSKGenerateNewResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitIPSECTunnelPSKGenerateNewResponseEnvelopeErrorsJSON `json:"-"` +} + +// magicTransitIPSECTunnelPSKGenerateNewResponseEnvelopeErrorsJSON contains the +// JSON metadata for the struct +// [MagicTransitIPSECTunnelPSKGenerateNewResponseEnvelopeErrors] +type magicTransitIPSECTunnelPSKGenerateNewResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelPSKGenerateNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitIPSECTunnelPSKGenerateNewResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitIPSECTunnelPSKGenerateNewResponseEnvelopeMessagesJSON `json:"-"` +} + +// magicTransitIPSECTunnelPSKGenerateNewResponseEnvelopeMessagesJSON contains the +// JSON metadata for the struct +// [MagicTransitIPSECTunnelPSKGenerateNewResponseEnvelopeMessages] +type magicTransitIPSECTunnelPSKGenerateNewResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitIPSECTunnelPSKGenerateNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type MagicTransitIPSECTunnelPSKGenerateNewResponseEnvelopeSuccess bool + +const ( + MagicTransitIPSECTunnelPSKGenerateNewResponseEnvelopeSuccessTrue MagicTransitIPSECTunnelPSKGenerateNewResponseEnvelopeSuccess = true +) diff --git a/magicipsectunnelpskgenerate_test.go b/magictransitipsectunnelpskgenerate_test.go similarity index 90% rename from magicipsectunnelpskgenerate_test.go rename to magictransitipsectunnelpskgenerate_test.go index fbe7a24fc99..b018c929948 100644 --- a/magicipsectunnelpskgenerate_test.go +++ b/magictransitipsectunnelpskgenerate_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestMagicIPSECTunnelPSKGenerateNew(t *testing.T) { +func TestMagicTransitIPSECTunnelPSKGenerateNew(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 { @@ -29,7 +29,7 @@ func TestMagicIPSECTunnelPSKGenerateNew(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Magics.IPSECTunnels.PSKGenerates.New( + _, err := client.MagicTransit.IPSECTunnels.PSKGenerates.New( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", diff --git a/magictransitroute.go b/magictransitroute.go new file mode 100644 index 00000000000..2c88bd6e559 --- /dev/null +++ b/magictransitroute.go @@ -0,0 +1,817 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// MagicTransitRouteService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewMagicTransitRouteService] method +// instead. +type MagicTransitRouteService struct { + Options []option.RequestOption +} + +// NewMagicTransitRouteService generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewMagicTransitRouteService(opts ...option.RequestOption) (r *MagicTransitRouteService) { + r = &MagicTransitRouteService{} + r.Options = opts + return +} + +// Creates a new Magic static route. Use `?validate_only=true` as an optional query +// parameter to run validation only without persisting changes. +func (r *MagicTransitRouteService) New(ctx context.Context, accountIdentifier string, body MagicTransitRouteNewParams, opts ...option.RequestOption) (res *MagicTransitRouteNewResponse, err error) { + opts = append(r.Options[:], opts...) + var env MagicTransitRouteNewResponseEnvelope + path := fmt.Sprintf("accounts/%s/magic/routes", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Update a specific Magic static route. Use `?validate_only=true` as an optional +// query parameter to run validation only without persisting changes. +func (r *MagicTransitRouteService) Update(ctx context.Context, accountIdentifier string, routeIdentifier string, body MagicTransitRouteUpdateParams, opts ...option.RequestOption) (res *MagicTransitRouteUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + var env MagicTransitRouteUpdateResponseEnvelope + path := fmt.Sprintf("accounts/%s/magic/routes/%s", accountIdentifier, routeIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// List all Magic static routes. +func (r *MagicTransitRouteService) List(ctx context.Context, accountIdentifier string, opts ...option.RequestOption) (res *MagicTransitRouteListResponse, err error) { + opts = append(r.Options[:], opts...) + var env MagicTransitRouteListResponseEnvelope + path := fmt.Sprintf("accounts/%s/magic/routes", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Disable and remove a specific Magic static route. +func (r *MagicTransitRouteService) Delete(ctx context.Context, accountIdentifier string, routeIdentifier string, opts ...option.RequestOption) (res *MagicTransitRouteDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + var env MagicTransitRouteDeleteResponseEnvelope + path := fmt.Sprintf("accounts/%s/magic/routes/%s", accountIdentifier, routeIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Delete multiple Magic static routes. +func (r *MagicTransitRouteService) Empty(ctx context.Context, accountIdentifier string, body MagicTransitRouteEmptyParams, opts ...option.RequestOption) (res *MagicTransitRouteEmptyResponse, err error) { + opts = append(r.Options[:], opts...) + var env MagicTransitRouteEmptyResponseEnvelope + path := fmt.Sprintf("accounts/%s/magic/routes", accountIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Get a specific Magic static route. +func (r *MagicTransitRouteService) Get(ctx context.Context, accountIdentifier string, routeIdentifier string, opts ...option.RequestOption) (res *MagicTransitRouteGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env MagicTransitRouteGetResponseEnvelope + path := fmt.Sprintf("accounts/%s/magic/routes/%s", accountIdentifier, routeIdentifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +type MagicTransitRouteNewResponse struct { + Routes []MagicTransitRouteNewResponseRoute `json:"routes"` + JSON magicTransitRouteNewResponseJSON `json:"-"` +} + +// magicTransitRouteNewResponseJSON contains the JSON metadata for the struct +// [MagicTransitRouteNewResponse] +type magicTransitRouteNewResponseJSON struct { + Routes apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitRouteNewResponseRoute struct { + // The next-hop IP Address for the static route. + Nexthop string `json:"nexthop,required"` + // IP Prefix in Classless Inter-Domain Routing format. + Prefix string `json:"prefix,required"` + // Priority of the static route. + Priority int64 `json:"priority,required"` + // Identifier + ID string `json:"id"` + // When the route was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // An optional human provided description of the static route. + Description string `json:"description"` + // When the route was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Used only for ECMP routes. + Scope MagicTransitRouteNewResponseRoutesScope `json:"scope"` + // Optional weight of the ECMP scope - if provided. + Weight int64 `json:"weight"` + JSON magicTransitRouteNewResponseRouteJSON `json:"-"` +} + +// magicTransitRouteNewResponseRouteJSON contains the JSON metadata for the struct +// [MagicTransitRouteNewResponseRoute] +type magicTransitRouteNewResponseRouteJSON struct { + Nexthop apijson.Field + Prefix apijson.Field + Priority apijson.Field + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + ModifiedOn apijson.Field + Scope apijson.Field + Weight apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteNewResponseRoute) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Used only for ECMP routes. +type MagicTransitRouteNewResponseRoutesScope struct { + // List of colo names for the ECMP scope. + ColoNames []string `json:"colo_names"` + // List of colo regions for the ECMP scope. + ColoRegions []string `json:"colo_regions"` + JSON magicTransitRouteNewResponseRoutesScopeJSON `json:"-"` +} + +// magicTransitRouteNewResponseRoutesScopeJSON contains the JSON metadata for the +// struct [MagicTransitRouteNewResponseRoutesScope] +type magicTransitRouteNewResponseRoutesScopeJSON struct { + ColoNames apijson.Field + ColoRegions apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteNewResponseRoutesScope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitRouteUpdateResponse struct { + Modified bool `json:"modified"` + ModifiedRoute interface{} `json:"modified_route"` + JSON magicTransitRouteUpdateResponseJSON `json:"-"` +} + +// magicTransitRouteUpdateResponseJSON contains the JSON metadata for the struct +// [MagicTransitRouteUpdateResponse] +type magicTransitRouteUpdateResponseJSON struct { + Modified apijson.Field + ModifiedRoute apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitRouteListResponse struct { + Routes []MagicTransitRouteListResponseRoute `json:"routes"` + JSON magicTransitRouteListResponseJSON `json:"-"` +} + +// magicTransitRouteListResponseJSON contains the JSON metadata for the struct +// [MagicTransitRouteListResponse] +type magicTransitRouteListResponseJSON struct { + Routes apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitRouteListResponseRoute struct { + // The next-hop IP Address for the static route. + Nexthop string `json:"nexthop,required"` + // IP Prefix in Classless Inter-Domain Routing format. + Prefix string `json:"prefix,required"` + // Priority of the static route. + Priority int64 `json:"priority,required"` + // Identifier + ID string `json:"id"` + // When the route was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // An optional human provided description of the static route. + Description string `json:"description"` + // When the route was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // Used only for ECMP routes. + Scope MagicTransitRouteListResponseRoutesScope `json:"scope"` + // Optional weight of the ECMP scope - if provided. + Weight int64 `json:"weight"` + JSON magicTransitRouteListResponseRouteJSON `json:"-"` +} + +// magicTransitRouteListResponseRouteJSON contains the JSON metadata for the struct +// [MagicTransitRouteListResponseRoute] +type magicTransitRouteListResponseRouteJSON struct { + Nexthop apijson.Field + Prefix apijson.Field + Priority apijson.Field + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + ModifiedOn apijson.Field + Scope apijson.Field + Weight apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteListResponseRoute) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Used only for ECMP routes. +type MagicTransitRouteListResponseRoutesScope struct { + // List of colo names for the ECMP scope. + ColoNames []string `json:"colo_names"` + // List of colo regions for the ECMP scope. + ColoRegions []string `json:"colo_regions"` + JSON magicTransitRouteListResponseRoutesScopeJSON `json:"-"` +} + +// magicTransitRouteListResponseRoutesScopeJSON contains the JSON metadata for the +// struct [MagicTransitRouteListResponseRoutesScope] +type magicTransitRouteListResponseRoutesScopeJSON struct { + ColoNames apijson.Field + ColoRegions apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteListResponseRoutesScope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitRouteDeleteResponse struct { + Deleted bool `json:"deleted"` + DeletedRoute interface{} `json:"deleted_route"` + JSON magicTransitRouteDeleteResponseJSON `json:"-"` +} + +// magicTransitRouteDeleteResponseJSON contains the JSON metadata for the struct +// [MagicTransitRouteDeleteResponse] +type magicTransitRouteDeleteResponseJSON struct { + Deleted apijson.Field + DeletedRoute apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitRouteEmptyResponse struct { + Deleted bool `json:"deleted"` + DeletedRoutes interface{} `json:"deleted_routes"` + JSON magicTransitRouteEmptyResponseJSON `json:"-"` +} + +// magicTransitRouteEmptyResponseJSON contains the JSON metadata for the struct +// [MagicTransitRouteEmptyResponse] +type magicTransitRouteEmptyResponseJSON struct { + Deleted apijson.Field + DeletedRoutes apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteEmptyResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitRouteGetResponse struct { + Route interface{} `json:"route"` + JSON magicTransitRouteGetResponseJSON `json:"-"` +} + +// magicTransitRouteGetResponseJSON contains the JSON metadata for the struct +// [MagicTransitRouteGetResponse] +type magicTransitRouteGetResponseJSON struct { + Route apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitRouteNewParams struct { + Body param.Field[interface{}] `json:"body,required"` +} + +func (r MagicTransitRouteNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r.Body) +} + +type MagicTransitRouteNewResponseEnvelope struct { + Errors []MagicTransitRouteNewResponseEnvelopeErrors `json:"errors,required"` + Messages []MagicTransitRouteNewResponseEnvelopeMessages `json:"messages,required"` + Result MagicTransitRouteNewResponse `json:"result,required"` + // Whether the API call was successful + Success MagicTransitRouteNewResponseEnvelopeSuccess `json:"success,required"` + JSON magicTransitRouteNewResponseEnvelopeJSON `json:"-"` +} + +// magicTransitRouteNewResponseEnvelopeJSON contains the JSON metadata for the +// struct [MagicTransitRouteNewResponseEnvelope] +type magicTransitRouteNewResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitRouteNewResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitRouteNewResponseEnvelopeErrorsJSON `json:"-"` +} + +// magicTransitRouteNewResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [MagicTransitRouteNewResponseEnvelopeErrors] +type magicTransitRouteNewResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitRouteNewResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitRouteNewResponseEnvelopeMessagesJSON `json:"-"` +} + +// magicTransitRouteNewResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [MagicTransitRouteNewResponseEnvelopeMessages] +type magicTransitRouteNewResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type MagicTransitRouteNewResponseEnvelopeSuccess bool + +const ( + MagicTransitRouteNewResponseEnvelopeSuccessTrue MagicTransitRouteNewResponseEnvelopeSuccess = true +) + +type MagicTransitRouteUpdateParams struct { + // The next-hop IP Address for the static route. + Nexthop param.Field[string] `json:"nexthop,required"` + // IP Prefix in Classless Inter-Domain Routing format. + Prefix param.Field[string] `json:"prefix,required"` + // Priority of the static route. + Priority param.Field[int64] `json:"priority,required"` + // An optional human provided description of the static route. + Description param.Field[string] `json:"description"` + // Used only for ECMP routes. + Scope param.Field[MagicTransitRouteUpdateParamsScope] `json:"scope"` + // Optional weight of the ECMP scope - if provided. + Weight param.Field[int64] `json:"weight"` +} + +func (r MagicTransitRouteUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Used only for ECMP routes. +type MagicTransitRouteUpdateParamsScope struct { + // List of colo names for the ECMP scope. + ColoNames param.Field[[]string] `json:"colo_names"` + // List of colo regions for the ECMP scope. + ColoRegions param.Field[[]string] `json:"colo_regions"` +} + +func (r MagicTransitRouteUpdateParamsScope) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type MagicTransitRouteUpdateResponseEnvelope struct { + Errors []MagicTransitRouteUpdateResponseEnvelopeErrors `json:"errors,required"` + Messages []MagicTransitRouteUpdateResponseEnvelopeMessages `json:"messages,required"` + Result MagicTransitRouteUpdateResponse `json:"result,required"` + // Whether the API call was successful + Success MagicTransitRouteUpdateResponseEnvelopeSuccess `json:"success,required"` + JSON magicTransitRouteUpdateResponseEnvelopeJSON `json:"-"` +} + +// magicTransitRouteUpdateResponseEnvelopeJSON contains the JSON metadata for the +// struct [MagicTransitRouteUpdateResponseEnvelope] +type magicTransitRouteUpdateResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitRouteUpdateResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitRouteUpdateResponseEnvelopeErrorsJSON `json:"-"` +} + +// magicTransitRouteUpdateResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [MagicTransitRouteUpdateResponseEnvelopeErrors] +type magicTransitRouteUpdateResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitRouteUpdateResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitRouteUpdateResponseEnvelopeMessagesJSON `json:"-"` +} + +// magicTransitRouteUpdateResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [MagicTransitRouteUpdateResponseEnvelopeMessages] +type magicTransitRouteUpdateResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type MagicTransitRouteUpdateResponseEnvelopeSuccess bool + +const ( + MagicTransitRouteUpdateResponseEnvelopeSuccessTrue MagicTransitRouteUpdateResponseEnvelopeSuccess = true +) + +type MagicTransitRouteListResponseEnvelope struct { + Errors []MagicTransitRouteListResponseEnvelopeErrors `json:"errors,required"` + Messages []MagicTransitRouteListResponseEnvelopeMessages `json:"messages,required"` + Result MagicTransitRouteListResponse `json:"result,required"` + // Whether the API call was successful + Success MagicTransitRouteListResponseEnvelopeSuccess `json:"success,required"` + JSON magicTransitRouteListResponseEnvelopeJSON `json:"-"` +} + +// magicTransitRouteListResponseEnvelopeJSON contains the JSON metadata for the +// struct [MagicTransitRouteListResponseEnvelope] +type magicTransitRouteListResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitRouteListResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitRouteListResponseEnvelopeErrorsJSON `json:"-"` +} + +// magicTransitRouteListResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [MagicTransitRouteListResponseEnvelopeErrors] +type magicTransitRouteListResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitRouteListResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitRouteListResponseEnvelopeMessagesJSON `json:"-"` +} + +// magicTransitRouteListResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [MagicTransitRouteListResponseEnvelopeMessages] +type magicTransitRouteListResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type MagicTransitRouteListResponseEnvelopeSuccess bool + +const ( + MagicTransitRouteListResponseEnvelopeSuccessTrue MagicTransitRouteListResponseEnvelopeSuccess = true +) + +type MagicTransitRouteDeleteResponseEnvelope struct { + Errors []MagicTransitRouteDeleteResponseEnvelopeErrors `json:"errors,required"` + Messages []MagicTransitRouteDeleteResponseEnvelopeMessages `json:"messages,required"` + Result MagicTransitRouteDeleteResponse `json:"result,required"` + // Whether the API call was successful + Success MagicTransitRouteDeleteResponseEnvelopeSuccess `json:"success,required"` + JSON magicTransitRouteDeleteResponseEnvelopeJSON `json:"-"` +} + +// magicTransitRouteDeleteResponseEnvelopeJSON contains the JSON metadata for the +// struct [MagicTransitRouteDeleteResponseEnvelope] +type magicTransitRouteDeleteResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitRouteDeleteResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitRouteDeleteResponseEnvelopeErrorsJSON `json:"-"` +} + +// magicTransitRouteDeleteResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [MagicTransitRouteDeleteResponseEnvelopeErrors] +type magicTransitRouteDeleteResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitRouteDeleteResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitRouteDeleteResponseEnvelopeMessagesJSON `json:"-"` +} + +// magicTransitRouteDeleteResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [MagicTransitRouteDeleteResponseEnvelopeMessages] +type magicTransitRouteDeleteResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type MagicTransitRouteDeleteResponseEnvelopeSuccess bool + +const ( + MagicTransitRouteDeleteResponseEnvelopeSuccessTrue MagicTransitRouteDeleteResponseEnvelopeSuccess = true +) + +type MagicTransitRouteEmptyParams struct { + Routes param.Field[[]MagicTransitRouteEmptyParamsRoute] `json:"routes,required"` +} + +func (r MagicTransitRouteEmptyParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type MagicTransitRouteEmptyParamsRoute struct { +} + +func (r MagicTransitRouteEmptyParamsRoute) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type MagicTransitRouteEmptyResponseEnvelope struct { + Errors []MagicTransitRouteEmptyResponseEnvelopeErrors `json:"errors,required"` + Messages []MagicTransitRouteEmptyResponseEnvelopeMessages `json:"messages,required"` + Result MagicTransitRouteEmptyResponse `json:"result,required"` + // Whether the API call was successful + Success MagicTransitRouteEmptyResponseEnvelopeSuccess `json:"success,required"` + JSON magicTransitRouteEmptyResponseEnvelopeJSON `json:"-"` +} + +// magicTransitRouteEmptyResponseEnvelopeJSON contains the JSON metadata for the +// struct [MagicTransitRouteEmptyResponseEnvelope] +type magicTransitRouteEmptyResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteEmptyResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitRouteEmptyResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitRouteEmptyResponseEnvelopeErrorsJSON `json:"-"` +} + +// magicTransitRouteEmptyResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [MagicTransitRouteEmptyResponseEnvelopeErrors] +type magicTransitRouteEmptyResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteEmptyResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitRouteEmptyResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitRouteEmptyResponseEnvelopeMessagesJSON `json:"-"` +} + +// magicTransitRouteEmptyResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [MagicTransitRouteEmptyResponseEnvelopeMessages] +type magicTransitRouteEmptyResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteEmptyResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type MagicTransitRouteEmptyResponseEnvelopeSuccess bool + +const ( + MagicTransitRouteEmptyResponseEnvelopeSuccessTrue MagicTransitRouteEmptyResponseEnvelopeSuccess = true +) + +type MagicTransitRouteGetResponseEnvelope struct { + Errors []MagicTransitRouteGetResponseEnvelopeErrors `json:"errors,required"` + Messages []MagicTransitRouteGetResponseEnvelopeMessages `json:"messages,required"` + Result MagicTransitRouteGetResponse `json:"result,required"` + // Whether the API call was successful + Success MagicTransitRouteGetResponseEnvelopeSuccess `json:"success,required"` + JSON magicTransitRouteGetResponseEnvelopeJSON `json:"-"` +} + +// magicTransitRouteGetResponseEnvelopeJSON contains the JSON metadata for the +// struct [MagicTransitRouteGetResponseEnvelope] +type magicTransitRouteGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitRouteGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitRouteGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// magicTransitRouteGetResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [MagicTransitRouteGetResponseEnvelopeErrors] +type magicTransitRouteGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type MagicTransitRouteGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON magicTransitRouteGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// magicTransitRouteGetResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [MagicTransitRouteGetResponseEnvelopeMessages] +type magicTransitRouteGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MagicTransitRouteGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type MagicTransitRouteGetResponseEnvelopeSuccess bool + +const ( + MagicTransitRouteGetResponseEnvelopeSuccessTrue MagicTransitRouteGetResponseEnvelopeSuccess = true +) diff --git a/magicroute_test.go b/magictransitroute_test.go similarity index 87% rename from magicroute_test.go rename to magictransitroute_test.go index a2360f7b275..560b93d3ade 100644 --- a/magicroute_test.go +++ b/magictransitroute_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestMagicRouteNew(t *testing.T) { +func TestMagicTransitRouteNew(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 { @@ -29,10 +29,10 @@ func TestMagicRouteNew(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Magics.Routes.New( + _, err := client.MagicTransit.Routes.New( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.MagicRouteNewParams{ + cloudflare.MagicTransitRouteNewParams{ Body: cloudflare.F[any](map[string]interface{}{}), }, ) @@ -45,7 +45,7 @@ func TestMagicRouteNew(t *testing.T) { } } -func TestMagicRouteUpdateWithOptionalParams(t *testing.T) { +func TestMagicTransitRouteUpdateWithOptionalParams(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 { @@ -61,16 +61,16 @@ func TestMagicRouteUpdateWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Magics.Routes.Update( + _, err := client.MagicTransit.Routes.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.MagicRouteUpdateParams{ + cloudflare.MagicTransitRouteUpdateParams{ Nexthop: cloudflare.F("203.0.113.1"), Prefix: cloudflare.F("192.0.2.0/24"), Priority: cloudflare.F(int64(0)), Description: cloudflare.F("New route for new prefix 203.0.113.1"), - Scope: cloudflare.F(cloudflare.MagicRouteUpdateParamsScope{ + Scope: cloudflare.F(cloudflare.MagicTransitRouteUpdateParamsScope{ ColoNames: cloudflare.F([]string{"den01", "den01", "den01"}), ColoRegions: cloudflare.F([]string{"APAC", "APAC", "APAC"}), }), @@ -86,7 +86,7 @@ func TestMagicRouteUpdateWithOptionalParams(t *testing.T) { } } -func TestMagicRouteList(t *testing.T) { +func TestMagicTransitRouteList(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 { @@ -102,7 +102,7 @@ func TestMagicRouteList(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Magics.Routes.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") + _, err := client.MagicTransit.Routes.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { var apierr *cloudflare.Error if errors.As(err, &apierr) { @@ -112,7 +112,7 @@ func TestMagicRouteList(t *testing.T) { } } -func TestMagicRouteDelete(t *testing.T) { +func TestMagicTransitRouteDelete(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 { @@ -128,7 +128,7 @@ func TestMagicRouteDelete(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Magics.Routes.Delete( + _, err := client.MagicTransit.Routes.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", @@ -142,7 +142,7 @@ func TestMagicRouteDelete(t *testing.T) { } } -func TestMagicRouteEmpty(t *testing.T) { +func TestMagicTransitRouteEmpty(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 { @@ -158,11 +158,11 @@ func TestMagicRouteEmpty(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Magics.Routes.Empty( + _, err := client.MagicTransit.Routes.Empty( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", - cloudflare.MagicRouteEmptyParams{ - Routes: cloudflare.F([]cloudflare.MagicRouteEmptyParamsRoute{{}, {}, {}}), + cloudflare.MagicTransitRouteEmptyParams{ + Routes: cloudflare.F([]cloudflare.MagicTransitRouteEmptyParamsRoute{{}, {}, {}}), }, ) if err != nil { @@ -174,7 +174,7 @@ func TestMagicRouteEmpty(t *testing.T) { } } -func TestMagicRouteGet(t *testing.T) { +func TestMagicTransitRouteGet(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 { @@ -190,7 +190,7 @@ func TestMagicRouteGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Magics.Routes.Get( + _, err := client.MagicTransit.Routes.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", diff --git a/radar.go b/radar.go index 01ef82444fa..2ea9a164d77 100644 --- a/radar.go +++ b/radar.go @@ -23,7 +23,6 @@ type RadarService struct { ConnectionTampering *RadarConnectionTamperingService Email *RadarEmailService Attacks *RadarAttackService - Emails *RadarEmailService Entities *RadarEntityService HTTP *RadarHTTPService Quality *RadarQualityService @@ -48,7 +47,6 @@ func NewRadarService(opts ...option.RequestOption) (r *RadarService) { r.ConnectionTampering = NewRadarConnectionTamperingService(opts...) r.Email = NewRadarEmailService(opts...) r.Attacks = NewRadarAttackService(opts...) - r.Emails = NewRadarEmailService(opts...) r.Entities = NewRadarEntityService(opts...) r.HTTP = NewRadarHTTPService(opts...) r.Quality = NewRadarQualityService(opts...) diff --git a/radaremailsecuritytimeseriesgroup.go b/radaremailsecuritytimeseriesgroup.go index 64bdd3da7e6..ef189e30c68 100644 --- a/radaremailsecuritytimeseriesgroup.go +++ b/radaremailsecuritytimeseriesgroup.go @@ -59,6 +59,71 @@ func (r *RadarEmailSecurityTimeseriesGroupService) DKIM(ctx context.Context, que return } +// Percentage distribution of emails classified per DMARC validation over time. +func (r *RadarEmailSecurityTimeseriesGroupService) DMARC(ctx context.Context, query RadarEmailSecurityTimeseriesGroupDMARCParams, opts ...option.RequestOption) (res *RadarEmailSecurityTimeseriesGroupDMARCResponse, err error) { + opts = append(r.Options[:], opts...) + var env RadarEmailSecurityTimeseriesGroupDMARCResponseEnvelope + path := "radar/email/security/timeseries_groups/dmarc" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Percentage distribution of emails classified as MALICIOUS over time. +func (r *RadarEmailSecurityTimeseriesGroupService) Malicious(ctx context.Context, query RadarEmailSecurityTimeseriesGroupMaliciousParams, opts ...option.RequestOption) (res *RadarEmailSecurityTimeseriesGroupMaliciousResponse, err error) { + opts = append(r.Options[:], opts...) + var env RadarEmailSecurityTimeseriesGroupMaliciousResponseEnvelope + path := "radar/email/security/timeseries_groups/malicious" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Percentage distribution of emails classified as SPAM over time. +func (r *RadarEmailSecurityTimeseriesGroupService) Spam(ctx context.Context, query RadarEmailSecurityTimeseriesGroupSpamParams, opts ...option.RequestOption) (res *RadarEmailSecurityTimeseriesGroupSpamResponse, err error) { + opts = append(r.Options[:], opts...) + var env RadarEmailSecurityTimeseriesGroupSpamResponseEnvelope + path := "radar/email/security/timeseries_groups/spam" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Percentage distribution of emails classified per SPF validation over time. +func (r *RadarEmailSecurityTimeseriesGroupService) SPF(ctx context.Context, query RadarEmailSecurityTimeseriesGroupSPFParams, opts ...option.RequestOption) (res *RadarEmailSecurityTimeseriesGroupSPFResponse, err error) { + opts = append(r.Options[:], opts...) + var env RadarEmailSecurityTimeseriesGroupSPFResponseEnvelope + path := "radar/email/security/timeseries_groups/spf" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Percentage distribution of emails classified in Threat Categories over time. +func (r *RadarEmailSecurityTimeseriesGroupService) ThreatCategory(ctx context.Context, query RadarEmailSecurityTimeseriesGroupThreatCategoryParams, opts ...option.RequestOption) (res *RadarEmailSecurityTimeseriesGroupThreatCategoryResponse, err error) { + opts = append(r.Options[:], opts...) + var env RadarEmailSecurityTimeseriesGroupThreatCategoryResponseEnvelope + path := "radar/email/security/timeseries_groups/threat_category" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + type RadarEmailSecurityTimeseriesGroupARCResponse struct { Meta interface{} `json:"meta,required"` Serie0 RadarEmailSecurityTimeseriesGroupARCResponseSerie0 `json:"serie_0,required"` @@ -139,6 +204,207 @@ func (r *RadarEmailSecurityTimeseriesGroupDKIMResponseSerie0) UnmarshalJSON(data return apijson.UnmarshalRoot(data, r) } +type RadarEmailSecurityTimeseriesGroupDMARCResponse struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarEmailSecurityTimeseriesGroupDMARCResponseSerie0 `json:"serie_0,required"` + JSON radarEmailSecurityTimeseriesGroupDMARCResponseJSON `json:"-"` +} + +// radarEmailSecurityTimeseriesGroupDMARCResponseJSON contains the JSON metadata +// for the struct [RadarEmailSecurityTimeseriesGroupDMARCResponse] +type radarEmailSecurityTimeseriesGroupDMARCResponseJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTimeseriesGroupDMARCResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTimeseriesGroupDMARCResponseSerie0 struct { + Fail []string `json:"FAIL,required"` + None []string `json:"NONE,required"` + Pass []string `json:"PASS,required"` + JSON radarEmailSecurityTimeseriesGroupDMARCResponseSerie0JSON `json:"-"` +} + +// radarEmailSecurityTimeseriesGroupDMARCResponseSerie0JSON contains the JSON +// metadata for the struct [RadarEmailSecurityTimeseriesGroupDMARCResponseSerie0] +type radarEmailSecurityTimeseriesGroupDMARCResponseSerie0JSON struct { + Fail apijson.Field + None apijson.Field + Pass apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTimeseriesGroupDMARCResponseSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTimeseriesGroupMaliciousResponse struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarEmailSecurityTimeseriesGroupMaliciousResponseSerie0 `json:"serie_0,required"` + JSON radarEmailSecurityTimeseriesGroupMaliciousResponseJSON `json:"-"` +} + +// radarEmailSecurityTimeseriesGroupMaliciousResponseJSON contains the JSON +// metadata for the struct [RadarEmailSecurityTimeseriesGroupMaliciousResponse] +type radarEmailSecurityTimeseriesGroupMaliciousResponseJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTimeseriesGroupMaliciousResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTimeseriesGroupMaliciousResponseSerie0 struct { + Malicious []string `json:"MALICIOUS,required"` + NotMalicious []string `json:"NOT_MALICIOUS,required"` + JSON radarEmailSecurityTimeseriesGroupMaliciousResponseSerie0JSON `json:"-"` +} + +// radarEmailSecurityTimeseriesGroupMaliciousResponseSerie0JSON contains the JSON +// metadata for the struct +// [RadarEmailSecurityTimeseriesGroupMaliciousResponseSerie0] +type radarEmailSecurityTimeseriesGroupMaliciousResponseSerie0JSON struct { + Malicious apijson.Field + NotMalicious apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTimeseriesGroupMaliciousResponseSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTimeseriesGroupSpamResponse struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarEmailSecurityTimeseriesGroupSpamResponseSerie0 `json:"serie_0,required"` + JSON radarEmailSecurityTimeseriesGroupSpamResponseJSON `json:"-"` +} + +// radarEmailSecurityTimeseriesGroupSpamResponseJSON contains the JSON metadata for +// the struct [RadarEmailSecurityTimeseriesGroupSpamResponse] +type radarEmailSecurityTimeseriesGroupSpamResponseJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTimeseriesGroupSpamResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTimeseriesGroupSpamResponseSerie0 struct { + NotSpam []string `json:"NOT_SPAM,required"` + Spam []string `json:"SPAM,required"` + JSON radarEmailSecurityTimeseriesGroupSpamResponseSerie0JSON `json:"-"` +} + +// radarEmailSecurityTimeseriesGroupSpamResponseSerie0JSON contains the JSON +// metadata for the struct [RadarEmailSecurityTimeseriesGroupSpamResponseSerie0] +type radarEmailSecurityTimeseriesGroupSpamResponseSerie0JSON struct { + NotSpam apijson.Field + Spam apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTimeseriesGroupSpamResponseSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTimeseriesGroupSPFResponse struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarEmailSecurityTimeseriesGroupSPFResponseSerie0 `json:"serie_0,required"` + JSON radarEmailSecurityTimeseriesGroupSPFResponseJSON `json:"-"` +} + +// radarEmailSecurityTimeseriesGroupSPFResponseJSON contains the JSON metadata for +// the struct [RadarEmailSecurityTimeseriesGroupSPFResponse] +type radarEmailSecurityTimeseriesGroupSPFResponseJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTimeseriesGroupSPFResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTimeseriesGroupSPFResponseSerie0 struct { + Fail []string `json:"FAIL,required"` + None []string `json:"NONE,required"` + Pass []string `json:"PASS,required"` + JSON radarEmailSecurityTimeseriesGroupSPFResponseSerie0JSON `json:"-"` +} + +// radarEmailSecurityTimeseriesGroupSPFResponseSerie0JSON contains the JSON +// metadata for the struct [RadarEmailSecurityTimeseriesGroupSPFResponseSerie0] +type radarEmailSecurityTimeseriesGroupSPFResponseSerie0JSON struct { + Fail apijson.Field + None apijson.Field + Pass apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTimeseriesGroupSPFResponseSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTimeseriesGroupThreatCategoryResponse struct { + Meta interface{} `json:"meta,required"` + Serie0 RadarEmailSecurityTimeseriesGroupThreatCategoryResponseSerie0 `json:"serie_0,required"` + JSON radarEmailSecurityTimeseriesGroupThreatCategoryResponseJSON `json:"-"` +} + +// radarEmailSecurityTimeseriesGroupThreatCategoryResponseJSON contains the JSON +// metadata for the struct +// [RadarEmailSecurityTimeseriesGroupThreatCategoryResponse] +type radarEmailSecurityTimeseriesGroupThreatCategoryResponseJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTimeseriesGroupThreatCategoryResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTimeseriesGroupThreatCategoryResponseSerie0 struct { + BrandImpersonation []string `json:"BrandImpersonation,required"` + CredentialHarvester []string `json:"CredentialHarvester,required"` + IdentityDeception []string `json:"IdentityDeception,required"` + Link []string `json:"Link,required"` + JSON radarEmailSecurityTimeseriesGroupThreatCategoryResponseSerie0JSON `json:"-"` +} + +// radarEmailSecurityTimeseriesGroupThreatCategoryResponseSerie0JSON contains the +// JSON metadata for the struct +// [RadarEmailSecurityTimeseriesGroupThreatCategoryResponseSerie0] +type radarEmailSecurityTimeseriesGroupThreatCategoryResponseSerie0JSON struct { + BrandImpersonation apijson.Field + CredentialHarvester apijson.Field + IdentityDeception apijson.Field + Link apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTimeseriesGroupThreatCategoryResponseSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + type RadarEmailSecurityTimeseriesGroupARCParams struct { // Aggregation interval results should be returned in (for example, in 15 minutes // or 1 hour intervals). Refer to @@ -388,3 +654,660 @@ type radarEmailSecurityTimeseriesGroupDKIMResponseEnvelopeJSON struct { func (r *RadarEmailSecurityTimeseriesGroupDKIMResponseEnvelope) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } + +type RadarEmailSecurityTimeseriesGroupDMARCParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarEmailSecurityTimeseriesGroupDMARCParamsAggInterval] `query:"aggInterval"` + // Filter for arc (Authenticated Received Chain). + ARC param.Field[[]RadarEmailSecurityTimeseriesGroupDMARCParamsARC] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + DKIM param.Field[[]RadarEmailSecurityTimeseriesGroupDMARCParamsDKIM] `query:"dkim"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityTimeseriesGroupDMARCParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + SPF param.Field[[]RadarEmailSecurityTimeseriesGroupDMARCParamsSPF] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityTimeseriesGroupDMARCParams]'s query +// parameters as `url.Values`. +func (r RadarEmailSecurityTimeseriesGroupDMARCParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarEmailSecurityTimeseriesGroupDMARCParamsAggInterval string + +const ( + RadarEmailSecurityTimeseriesGroupDMARCParamsAggInterval15m RadarEmailSecurityTimeseriesGroupDMARCParamsAggInterval = "15m" + RadarEmailSecurityTimeseriesGroupDMARCParamsAggInterval1h RadarEmailSecurityTimeseriesGroupDMARCParamsAggInterval = "1h" + RadarEmailSecurityTimeseriesGroupDMARCParamsAggInterval1d RadarEmailSecurityTimeseriesGroupDMARCParamsAggInterval = "1d" + RadarEmailSecurityTimeseriesGroupDMARCParamsAggInterval1w RadarEmailSecurityTimeseriesGroupDMARCParamsAggInterval = "1w" +) + +type RadarEmailSecurityTimeseriesGroupDMARCParamsARC string + +const ( + RadarEmailSecurityTimeseriesGroupDMARCParamsARCPass RadarEmailSecurityTimeseriesGroupDMARCParamsARC = "PASS" + RadarEmailSecurityTimeseriesGroupDMARCParamsARCNone RadarEmailSecurityTimeseriesGroupDMARCParamsARC = "NONE" + RadarEmailSecurityTimeseriesGroupDMARCParamsARCFail RadarEmailSecurityTimeseriesGroupDMARCParamsARC = "FAIL" +) + +type RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange string + +const ( + RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange1d RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange = "1d" + RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange2d RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange = "2d" + RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange7d RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange = "7d" + RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange14d RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange = "14d" + RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange28d RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange = "28d" + RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange12w RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange = "12w" + RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange24w RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange = "24w" + RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange52w RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange = "52w" + RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange1dControl RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange = "1dControl" + RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange2dControl RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange = "2dControl" + RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange7dControl RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange = "7dControl" + RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange14dControl RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange = "14dControl" + RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange28dControl RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange = "28dControl" + RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange12wControl RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange = "12wControl" + RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange24wControl RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange = "24wControl" +) + +type RadarEmailSecurityTimeseriesGroupDMARCParamsDKIM string + +const ( + RadarEmailSecurityTimeseriesGroupDMARCParamsDKIMPass RadarEmailSecurityTimeseriesGroupDMARCParamsDKIM = "PASS" + RadarEmailSecurityTimeseriesGroupDMARCParamsDKIMNone RadarEmailSecurityTimeseriesGroupDMARCParamsDKIM = "NONE" + RadarEmailSecurityTimeseriesGroupDMARCParamsDKIMFail RadarEmailSecurityTimeseriesGroupDMARCParamsDKIM = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityTimeseriesGroupDMARCParamsFormat string + +const ( + RadarEmailSecurityTimeseriesGroupDMARCParamsFormatJson RadarEmailSecurityTimeseriesGroupDMARCParamsFormat = "JSON" + RadarEmailSecurityTimeseriesGroupDMARCParamsFormatCsv RadarEmailSecurityTimeseriesGroupDMARCParamsFormat = "CSV" +) + +type RadarEmailSecurityTimeseriesGroupDMARCParamsSPF string + +const ( + RadarEmailSecurityTimeseriesGroupDMARCParamsSPFPass RadarEmailSecurityTimeseriesGroupDMARCParamsSPF = "PASS" + RadarEmailSecurityTimeseriesGroupDMARCParamsSPFNone RadarEmailSecurityTimeseriesGroupDMARCParamsSPF = "NONE" + RadarEmailSecurityTimeseriesGroupDMARCParamsSPFFail RadarEmailSecurityTimeseriesGroupDMARCParamsSPF = "FAIL" +) + +type RadarEmailSecurityTimeseriesGroupDMARCResponseEnvelope struct { + Result RadarEmailSecurityTimeseriesGroupDMARCResponse `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityTimeseriesGroupDMARCResponseEnvelopeJSON `json:"-"` +} + +// radarEmailSecurityTimeseriesGroupDMARCResponseEnvelopeJSON contains the JSON +// metadata for the struct [RadarEmailSecurityTimeseriesGroupDMARCResponseEnvelope] +type radarEmailSecurityTimeseriesGroupDMARCResponseEnvelopeJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTimeseriesGroupDMARCResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTimeseriesGroupMaliciousParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarEmailSecurityTimeseriesGroupMaliciousParamsAggInterval] `query:"aggInterval"` + // Filter for arc (Authenticated Received Chain). + ARC param.Field[[]RadarEmailSecurityTimeseriesGroupMaliciousParamsARC] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + DKIM param.Field[[]RadarEmailSecurityTimeseriesGroupMaliciousParamsDKIM] `query:"dkim"` + // Filter for dmarc. + DMARC param.Field[[]RadarEmailSecurityTimeseriesGroupMaliciousParamsDMARC] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityTimeseriesGroupMaliciousParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + SPF param.Field[[]RadarEmailSecurityTimeseriesGroupMaliciousParamsSPF] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityTimeseriesGroupMaliciousParams]'s query +// parameters as `url.Values`. +func (r RadarEmailSecurityTimeseriesGroupMaliciousParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarEmailSecurityTimeseriesGroupMaliciousParamsAggInterval string + +const ( + RadarEmailSecurityTimeseriesGroupMaliciousParamsAggInterval15m RadarEmailSecurityTimeseriesGroupMaliciousParamsAggInterval = "15m" + RadarEmailSecurityTimeseriesGroupMaliciousParamsAggInterval1h RadarEmailSecurityTimeseriesGroupMaliciousParamsAggInterval = "1h" + RadarEmailSecurityTimeseriesGroupMaliciousParamsAggInterval1d RadarEmailSecurityTimeseriesGroupMaliciousParamsAggInterval = "1d" + RadarEmailSecurityTimeseriesGroupMaliciousParamsAggInterval1w RadarEmailSecurityTimeseriesGroupMaliciousParamsAggInterval = "1w" +) + +type RadarEmailSecurityTimeseriesGroupMaliciousParamsARC string + +const ( + RadarEmailSecurityTimeseriesGroupMaliciousParamsARCPass RadarEmailSecurityTimeseriesGroupMaliciousParamsARC = "PASS" + RadarEmailSecurityTimeseriesGroupMaliciousParamsARCNone RadarEmailSecurityTimeseriesGroupMaliciousParamsARC = "NONE" + RadarEmailSecurityTimeseriesGroupMaliciousParamsARCFail RadarEmailSecurityTimeseriesGroupMaliciousParamsARC = "FAIL" +) + +type RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange string + +const ( + RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange1d RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange = "1d" + RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange2d RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange = "2d" + RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange7d RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange = "7d" + RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange14d RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange = "14d" + RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange28d RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange = "28d" + RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange12w RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange = "12w" + RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange24w RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange = "24w" + RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange52w RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange = "52w" + RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange1dControl RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange = "1dControl" + RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange2dControl RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange = "2dControl" + RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange7dControl RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange = "7dControl" + RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange14dControl RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange = "14dControl" + RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange28dControl RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange = "28dControl" + RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange12wControl RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange = "12wControl" + RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange24wControl RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange = "24wControl" +) + +type RadarEmailSecurityTimeseriesGroupMaliciousParamsDKIM string + +const ( + RadarEmailSecurityTimeseriesGroupMaliciousParamsDKIMPass RadarEmailSecurityTimeseriesGroupMaliciousParamsDKIM = "PASS" + RadarEmailSecurityTimeseriesGroupMaliciousParamsDKIMNone RadarEmailSecurityTimeseriesGroupMaliciousParamsDKIM = "NONE" + RadarEmailSecurityTimeseriesGroupMaliciousParamsDKIMFail RadarEmailSecurityTimeseriesGroupMaliciousParamsDKIM = "FAIL" +) + +type RadarEmailSecurityTimeseriesGroupMaliciousParamsDMARC string + +const ( + RadarEmailSecurityTimeseriesGroupMaliciousParamsDMARCPass RadarEmailSecurityTimeseriesGroupMaliciousParamsDMARC = "PASS" + RadarEmailSecurityTimeseriesGroupMaliciousParamsDMARCNone RadarEmailSecurityTimeseriesGroupMaliciousParamsDMARC = "NONE" + RadarEmailSecurityTimeseriesGroupMaliciousParamsDMARCFail RadarEmailSecurityTimeseriesGroupMaliciousParamsDMARC = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityTimeseriesGroupMaliciousParamsFormat string + +const ( + RadarEmailSecurityTimeseriesGroupMaliciousParamsFormatJson RadarEmailSecurityTimeseriesGroupMaliciousParamsFormat = "JSON" + RadarEmailSecurityTimeseriesGroupMaliciousParamsFormatCsv RadarEmailSecurityTimeseriesGroupMaliciousParamsFormat = "CSV" +) + +type RadarEmailSecurityTimeseriesGroupMaliciousParamsSPF string + +const ( + RadarEmailSecurityTimeseriesGroupMaliciousParamsSPFPass RadarEmailSecurityTimeseriesGroupMaliciousParamsSPF = "PASS" + RadarEmailSecurityTimeseriesGroupMaliciousParamsSPFNone RadarEmailSecurityTimeseriesGroupMaliciousParamsSPF = "NONE" + RadarEmailSecurityTimeseriesGroupMaliciousParamsSPFFail RadarEmailSecurityTimeseriesGroupMaliciousParamsSPF = "FAIL" +) + +type RadarEmailSecurityTimeseriesGroupMaliciousResponseEnvelope struct { + Result RadarEmailSecurityTimeseriesGroupMaliciousResponse `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityTimeseriesGroupMaliciousResponseEnvelopeJSON `json:"-"` +} + +// radarEmailSecurityTimeseriesGroupMaliciousResponseEnvelopeJSON contains the JSON +// metadata for the struct +// [RadarEmailSecurityTimeseriesGroupMaliciousResponseEnvelope] +type radarEmailSecurityTimeseriesGroupMaliciousResponseEnvelopeJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTimeseriesGroupMaliciousResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTimeseriesGroupSpamParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarEmailSecurityTimeseriesGroupSpamParamsAggInterval] `query:"aggInterval"` + // Filter for arc (Authenticated Received Chain). + ARC param.Field[[]RadarEmailSecurityTimeseriesGroupSpamParamsARC] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityTimeseriesGroupSpamParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + DKIM param.Field[[]RadarEmailSecurityTimeseriesGroupSpamParamsDKIM] `query:"dkim"` + // Filter for dmarc. + DMARC param.Field[[]RadarEmailSecurityTimeseriesGroupSpamParamsDMARC] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityTimeseriesGroupSpamParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + SPF param.Field[[]RadarEmailSecurityTimeseriesGroupSpamParamsSPF] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityTimeseriesGroupSpamParams]'s query +// parameters as `url.Values`. +func (r RadarEmailSecurityTimeseriesGroupSpamParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarEmailSecurityTimeseriesGroupSpamParamsAggInterval string + +const ( + RadarEmailSecurityTimeseriesGroupSpamParamsAggInterval15m RadarEmailSecurityTimeseriesGroupSpamParamsAggInterval = "15m" + RadarEmailSecurityTimeseriesGroupSpamParamsAggInterval1h RadarEmailSecurityTimeseriesGroupSpamParamsAggInterval = "1h" + RadarEmailSecurityTimeseriesGroupSpamParamsAggInterval1d RadarEmailSecurityTimeseriesGroupSpamParamsAggInterval = "1d" + RadarEmailSecurityTimeseriesGroupSpamParamsAggInterval1w RadarEmailSecurityTimeseriesGroupSpamParamsAggInterval = "1w" +) + +type RadarEmailSecurityTimeseriesGroupSpamParamsARC string + +const ( + RadarEmailSecurityTimeseriesGroupSpamParamsARCPass RadarEmailSecurityTimeseriesGroupSpamParamsARC = "PASS" + RadarEmailSecurityTimeseriesGroupSpamParamsARCNone RadarEmailSecurityTimeseriesGroupSpamParamsARC = "NONE" + RadarEmailSecurityTimeseriesGroupSpamParamsARCFail RadarEmailSecurityTimeseriesGroupSpamParamsARC = "FAIL" +) + +type RadarEmailSecurityTimeseriesGroupSpamParamsDateRange string + +const ( + RadarEmailSecurityTimeseriesGroupSpamParamsDateRange1d RadarEmailSecurityTimeseriesGroupSpamParamsDateRange = "1d" + RadarEmailSecurityTimeseriesGroupSpamParamsDateRange2d RadarEmailSecurityTimeseriesGroupSpamParamsDateRange = "2d" + RadarEmailSecurityTimeseriesGroupSpamParamsDateRange7d RadarEmailSecurityTimeseriesGroupSpamParamsDateRange = "7d" + RadarEmailSecurityTimeseriesGroupSpamParamsDateRange14d RadarEmailSecurityTimeseriesGroupSpamParamsDateRange = "14d" + RadarEmailSecurityTimeseriesGroupSpamParamsDateRange28d RadarEmailSecurityTimeseriesGroupSpamParamsDateRange = "28d" + RadarEmailSecurityTimeseriesGroupSpamParamsDateRange12w RadarEmailSecurityTimeseriesGroupSpamParamsDateRange = "12w" + RadarEmailSecurityTimeseriesGroupSpamParamsDateRange24w RadarEmailSecurityTimeseriesGroupSpamParamsDateRange = "24w" + RadarEmailSecurityTimeseriesGroupSpamParamsDateRange52w RadarEmailSecurityTimeseriesGroupSpamParamsDateRange = "52w" + RadarEmailSecurityTimeseriesGroupSpamParamsDateRange1dControl RadarEmailSecurityTimeseriesGroupSpamParamsDateRange = "1dControl" + RadarEmailSecurityTimeseriesGroupSpamParamsDateRange2dControl RadarEmailSecurityTimeseriesGroupSpamParamsDateRange = "2dControl" + RadarEmailSecurityTimeseriesGroupSpamParamsDateRange7dControl RadarEmailSecurityTimeseriesGroupSpamParamsDateRange = "7dControl" + RadarEmailSecurityTimeseriesGroupSpamParamsDateRange14dControl RadarEmailSecurityTimeseriesGroupSpamParamsDateRange = "14dControl" + RadarEmailSecurityTimeseriesGroupSpamParamsDateRange28dControl RadarEmailSecurityTimeseriesGroupSpamParamsDateRange = "28dControl" + RadarEmailSecurityTimeseriesGroupSpamParamsDateRange12wControl RadarEmailSecurityTimeseriesGroupSpamParamsDateRange = "12wControl" + RadarEmailSecurityTimeseriesGroupSpamParamsDateRange24wControl RadarEmailSecurityTimeseriesGroupSpamParamsDateRange = "24wControl" +) + +type RadarEmailSecurityTimeseriesGroupSpamParamsDKIM string + +const ( + RadarEmailSecurityTimeseriesGroupSpamParamsDKIMPass RadarEmailSecurityTimeseriesGroupSpamParamsDKIM = "PASS" + RadarEmailSecurityTimeseriesGroupSpamParamsDKIMNone RadarEmailSecurityTimeseriesGroupSpamParamsDKIM = "NONE" + RadarEmailSecurityTimeseriesGroupSpamParamsDKIMFail RadarEmailSecurityTimeseriesGroupSpamParamsDKIM = "FAIL" +) + +type RadarEmailSecurityTimeseriesGroupSpamParamsDMARC string + +const ( + RadarEmailSecurityTimeseriesGroupSpamParamsDMARCPass RadarEmailSecurityTimeseriesGroupSpamParamsDMARC = "PASS" + RadarEmailSecurityTimeseriesGroupSpamParamsDMARCNone RadarEmailSecurityTimeseriesGroupSpamParamsDMARC = "NONE" + RadarEmailSecurityTimeseriesGroupSpamParamsDMARCFail RadarEmailSecurityTimeseriesGroupSpamParamsDMARC = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityTimeseriesGroupSpamParamsFormat string + +const ( + RadarEmailSecurityTimeseriesGroupSpamParamsFormatJson RadarEmailSecurityTimeseriesGroupSpamParamsFormat = "JSON" + RadarEmailSecurityTimeseriesGroupSpamParamsFormatCsv RadarEmailSecurityTimeseriesGroupSpamParamsFormat = "CSV" +) + +type RadarEmailSecurityTimeseriesGroupSpamParamsSPF string + +const ( + RadarEmailSecurityTimeseriesGroupSpamParamsSPFPass RadarEmailSecurityTimeseriesGroupSpamParamsSPF = "PASS" + RadarEmailSecurityTimeseriesGroupSpamParamsSPFNone RadarEmailSecurityTimeseriesGroupSpamParamsSPF = "NONE" + RadarEmailSecurityTimeseriesGroupSpamParamsSPFFail RadarEmailSecurityTimeseriesGroupSpamParamsSPF = "FAIL" +) + +type RadarEmailSecurityTimeseriesGroupSpamResponseEnvelope struct { + Result RadarEmailSecurityTimeseriesGroupSpamResponse `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityTimeseriesGroupSpamResponseEnvelopeJSON `json:"-"` +} + +// radarEmailSecurityTimeseriesGroupSpamResponseEnvelopeJSON contains the JSON +// metadata for the struct [RadarEmailSecurityTimeseriesGroupSpamResponseEnvelope] +type radarEmailSecurityTimeseriesGroupSpamResponseEnvelopeJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTimeseriesGroupSpamResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTimeseriesGroupSPFParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarEmailSecurityTimeseriesGroupSPFParamsAggInterval] `query:"aggInterval"` + // Filter for arc (Authenticated Received Chain). + ARC param.Field[[]RadarEmailSecurityTimeseriesGroupSPFParamsARC] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityTimeseriesGroupSPFParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + DKIM param.Field[[]RadarEmailSecurityTimeseriesGroupSPFParamsDKIM] `query:"dkim"` + // Filter for dmarc. + DMARC param.Field[[]RadarEmailSecurityTimeseriesGroupSPFParamsDMARC] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityTimeseriesGroupSPFParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` +} + +// URLQuery serializes [RadarEmailSecurityTimeseriesGroupSPFParams]'s query +// parameters as `url.Values`. +func (r RadarEmailSecurityTimeseriesGroupSPFParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarEmailSecurityTimeseriesGroupSPFParamsAggInterval string + +const ( + RadarEmailSecurityTimeseriesGroupSPFParamsAggInterval15m RadarEmailSecurityTimeseriesGroupSPFParamsAggInterval = "15m" + RadarEmailSecurityTimeseriesGroupSPFParamsAggInterval1h RadarEmailSecurityTimeseriesGroupSPFParamsAggInterval = "1h" + RadarEmailSecurityTimeseriesGroupSPFParamsAggInterval1d RadarEmailSecurityTimeseriesGroupSPFParamsAggInterval = "1d" + RadarEmailSecurityTimeseriesGroupSPFParamsAggInterval1w RadarEmailSecurityTimeseriesGroupSPFParamsAggInterval = "1w" +) + +type RadarEmailSecurityTimeseriesGroupSPFParamsARC string + +const ( + RadarEmailSecurityTimeseriesGroupSPFParamsARCPass RadarEmailSecurityTimeseriesGroupSPFParamsARC = "PASS" + RadarEmailSecurityTimeseriesGroupSPFParamsARCNone RadarEmailSecurityTimeseriesGroupSPFParamsARC = "NONE" + RadarEmailSecurityTimeseriesGroupSPFParamsARCFail RadarEmailSecurityTimeseriesGroupSPFParamsARC = "FAIL" +) + +type RadarEmailSecurityTimeseriesGroupSPFParamsDateRange string + +const ( + RadarEmailSecurityTimeseriesGroupSPFParamsDateRange1d RadarEmailSecurityTimeseriesGroupSPFParamsDateRange = "1d" + RadarEmailSecurityTimeseriesGroupSPFParamsDateRange2d RadarEmailSecurityTimeseriesGroupSPFParamsDateRange = "2d" + RadarEmailSecurityTimeseriesGroupSPFParamsDateRange7d RadarEmailSecurityTimeseriesGroupSPFParamsDateRange = "7d" + RadarEmailSecurityTimeseriesGroupSPFParamsDateRange14d RadarEmailSecurityTimeseriesGroupSPFParamsDateRange = "14d" + RadarEmailSecurityTimeseriesGroupSPFParamsDateRange28d RadarEmailSecurityTimeseriesGroupSPFParamsDateRange = "28d" + RadarEmailSecurityTimeseriesGroupSPFParamsDateRange12w RadarEmailSecurityTimeseriesGroupSPFParamsDateRange = "12w" + RadarEmailSecurityTimeseriesGroupSPFParamsDateRange24w RadarEmailSecurityTimeseriesGroupSPFParamsDateRange = "24w" + RadarEmailSecurityTimeseriesGroupSPFParamsDateRange52w RadarEmailSecurityTimeseriesGroupSPFParamsDateRange = "52w" + RadarEmailSecurityTimeseriesGroupSPFParamsDateRange1dControl RadarEmailSecurityTimeseriesGroupSPFParamsDateRange = "1dControl" + RadarEmailSecurityTimeseriesGroupSPFParamsDateRange2dControl RadarEmailSecurityTimeseriesGroupSPFParamsDateRange = "2dControl" + RadarEmailSecurityTimeseriesGroupSPFParamsDateRange7dControl RadarEmailSecurityTimeseriesGroupSPFParamsDateRange = "7dControl" + RadarEmailSecurityTimeseriesGroupSPFParamsDateRange14dControl RadarEmailSecurityTimeseriesGroupSPFParamsDateRange = "14dControl" + RadarEmailSecurityTimeseriesGroupSPFParamsDateRange28dControl RadarEmailSecurityTimeseriesGroupSPFParamsDateRange = "28dControl" + RadarEmailSecurityTimeseriesGroupSPFParamsDateRange12wControl RadarEmailSecurityTimeseriesGroupSPFParamsDateRange = "12wControl" + RadarEmailSecurityTimeseriesGroupSPFParamsDateRange24wControl RadarEmailSecurityTimeseriesGroupSPFParamsDateRange = "24wControl" +) + +type RadarEmailSecurityTimeseriesGroupSPFParamsDKIM string + +const ( + RadarEmailSecurityTimeseriesGroupSPFParamsDKIMPass RadarEmailSecurityTimeseriesGroupSPFParamsDKIM = "PASS" + RadarEmailSecurityTimeseriesGroupSPFParamsDKIMNone RadarEmailSecurityTimeseriesGroupSPFParamsDKIM = "NONE" + RadarEmailSecurityTimeseriesGroupSPFParamsDKIMFail RadarEmailSecurityTimeseriesGroupSPFParamsDKIM = "FAIL" +) + +type RadarEmailSecurityTimeseriesGroupSPFParamsDMARC string + +const ( + RadarEmailSecurityTimeseriesGroupSPFParamsDMARCPass RadarEmailSecurityTimeseriesGroupSPFParamsDMARC = "PASS" + RadarEmailSecurityTimeseriesGroupSPFParamsDMARCNone RadarEmailSecurityTimeseriesGroupSPFParamsDMARC = "NONE" + RadarEmailSecurityTimeseriesGroupSPFParamsDMARCFail RadarEmailSecurityTimeseriesGroupSPFParamsDMARC = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityTimeseriesGroupSPFParamsFormat string + +const ( + RadarEmailSecurityTimeseriesGroupSPFParamsFormatJson RadarEmailSecurityTimeseriesGroupSPFParamsFormat = "JSON" + RadarEmailSecurityTimeseriesGroupSPFParamsFormatCsv RadarEmailSecurityTimeseriesGroupSPFParamsFormat = "CSV" +) + +type RadarEmailSecurityTimeseriesGroupSPFResponseEnvelope struct { + Result RadarEmailSecurityTimeseriesGroupSPFResponse `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityTimeseriesGroupSPFResponseEnvelopeJSON `json:"-"` +} + +// radarEmailSecurityTimeseriesGroupSPFResponseEnvelopeJSON contains the JSON +// metadata for the struct [RadarEmailSecurityTimeseriesGroupSPFResponseEnvelope] +type radarEmailSecurityTimeseriesGroupSPFResponseEnvelopeJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTimeseriesGroupSPFResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type RadarEmailSecurityTimeseriesGroupThreatCategoryParams struct { + // Aggregation interval results should be returned in (for example, in 15 minutes + // or 1 hour intervals). Refer to + // [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + AggInterval param.Field[RadarEmailSecurityTimeseriesGroupThreatCategoryParamsAggInterval] `query:"aggInterval"` + // Filter for arc (Authenticated Received Chain). + ARC param.Field[[]RadarEmailSecurityTimeseriesGroupThreatCategoryParamsARC] `query:"arc"` + // Array of comma separated list of ASNs, start with `-` to exclude from results. + // For example, `-174, 3356` excludes results from AS174, but includes results from + // AS3356. + ASN param.Field[[]string] `query:"asn"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // For example, use `7d` and `7dControl` to compare this week with the previous + // week. Use this parameter or set specific start and end dates (`dateStart` and + // `dateEnd` parameters). + DateRange param.Field[[]RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for dkim. + DKIM param.Field[[]RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDKIM] `query:"dkim"` + // Filter for dmarc. + DMARC param.Field[[]RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDMARC] `query:"dmarc"` + // Format results are returned in. + Format param.Field[RadarEmailSecurityTimeseriesGroupThreatCategoryParamsFormat] `query:"format"` + // Array of comma separated list of locations (alpha-2 country codes). Start with + // `-` to exclude from results. For example, `-US,PT` excludes results from the US, + // but includes results from PT. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for spf. + SPF param.Field[[]RadarEmailSecurityTimeseriesGroupThreatCategoryParamsSPF] `query:"spf"` +} + +// URLQuery serializes [RadarEmailSecurityTimeseriesGroupThreatCategoryParams]'s +// query parameters as `url.Values`. +func (r RadarEmailSecurityTimeseriesGroupThreatCategoryParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Aggregation interval results should be returned in (for example, in 15 minutes +// or 1 hour intervals). Refer to +// [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). +type RadarEmailSecurityTimeseriesGroupThreatCategoryParamsAggInterval string + +const ( + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsAggInterval15m RadarEmailSecurityTimeseriesGroupThreatCategoryParamsAggInterval = "15m" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsAggInterval1h RadarEmailSecurityTimeseriesGroupThreatCategoryParamsAggInterval = "1h" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsAggInterval1d RadarEmailSecurityTimeseriesGroupThreatCategoryParamsAggInterval = "1d" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsAggInterval1w RadarEmailSecurityTimeseriesGroupThreatCategoryParamsAggInterval = "1w" +) + +type RadarEmailSecurityTimeseriesGroupThreatCategoryParamsARC string + +const ( + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsARCPass RadarEmailSecurityTimeseriesGroupThreatCategoryParamsARC = "PASS" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsARCNone RadarEmailSecurityTimeseriesGroupThreatCategoryParamsARC = "NONE" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsARCFail RadarEmailSecurityTimeseriesGroupThreatCategoryParamsARC = "FAIL" +) + +type RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange string + +const ( + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange1d RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange = "1d" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange2d RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange = "2d" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange7d RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange = "7d" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange14d RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange = "14d" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange28d RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange = "28d" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange12w RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange = "12w" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange24w RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange = "24w" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange52w RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange = "52w" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange1dControl RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange = "1dControl" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange2dControl RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange = "2dControl" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange7dControl RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange = "7dControl" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange14dControl RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange = "14dControl" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange28dControl RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange = "28dControl" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange12wControl RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange = "12wControl" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange24wControl RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange = "24wControl" +) + +type RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDKIM string + +const ( + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDKIMPass RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDKIM = "PASS" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDKIMNone RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDKIM = "NONE" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDKIMFail RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDKIM = "FAIL" +) + +type RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDMARC string + +const ( + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDMARCPass RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDMARC = "PASS" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDMARCNone RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDMARC = "NONE" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDMARCFail RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDMARC = "FAIL" +) + +// Format results are returned in. +type RadarEmailSecurityTimeseriesGroupThreatCategoryParamsFormat string + +const ( + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsFormatJson RadarEmailSecurityTimeseriesGroupThreatCategoryParamsFormat = "JSON" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsFormatCsv RadarEmailSecurityTimeseriesGroupThreatCategoryParamsFormat = "CSV" +) + +type RadarEmailSecurityTimeseriesGroupThreatCategoryParamsSPF string + +const ( + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsSPFPass RadarEmailSecurityTimeseriesGroupThreatCategoryParamsSPF = "PASS" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsSPFNone RadarEmailSecurityTimeseriesGroupThreatCategoryParamsSPF = "NONE" + RadarEmailSecurityTimeseriesGroupThreatCategoryParamsSPFFail RadarEmailSecurityTimeseriesGroupThreatCategoryParamsSPF = "FAIL" +) + +type RadarEmailSecurityTimeseriesGroupThreatCategoryResponseEnvelope struct { + Result RadarEmailSecurityTimeseriesGroupThreatCategoryResponse `json:"result,required"` + Success bool `json:"success,required"` + JSON radarEmailSecurityTimeseriesGroupThreatCategoryResponseEnvelopeJSON `json:"-"` +} + +// radarEmailSecurityTimeseriesGroupThreatCategoryResponseEnvelopeJSON contains the +// JSON metadata for the struct +// [RadarEmailSecurityTimeseriesGroupThreatCategoryResponseEnvelope] +type radarEmailSecurityTimeseriesGroupThreatCategoryResponseEnvelopeJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RadarEmailSecurityTimeseriesGroupThreatCategoryResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/radaremailsecuritytimeseriesgroup_test.go b/radaremailsecuritytimeseriesgroup_test.go index e94b11375c2..ce6d4578821 100644 --- a/radaremailsecuritytimeseriesgroup_test.go +++ b/radaremailsecuritytimeseriesgroup_test.go @@ -89,3 +89,196 @@ func TestRadarEmailSecurityTimeseriesGroupDKIMWithOptionalParams(t *testing.T) { t.Fatalf("err should be nil: %s", err.Error()) } } + +func TestRadarEmailSecurityTimeseriesGroupDMARCWithOptionalParams(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Radar.Email.Security.TimeseriesGroups.DMARC(context.TODO(), cloudflare.RadarEmailSecurityTimeseriesGroupDMARCParams{ + AggInterval: cloudflare.F(cloudflare.RadarEmailSecurityTimeseriesGroupDMARCParamsAggInterval1h), + ARC: cloudflare.F([]cloudflare.RadarEmailSecurityTimeseriesGroupDMARCParamsARC{cloudflare.RadarEmailSecurityTimeseriesGroupDMARCParamsARCPass, cloudflare.RadarEmailSecurityTimeseriesGroupDMARCParamsARCNone, cloudflare.RadarEmailSecurityTimeseriesGroupDMARCParamsARCFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange{cloudflare.RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange1d, cloudflare.RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange2d, cloudflare.RadarEmailSecurityTimeseriesGroupDMARCParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DKIM: cloudflare.F([]cloudflare.RadarEmailSecurityTimeseriesGroupDMARCParamsDKIM{cloudflare.RadarEmailSecurityTimeseriesGroupDMARCParamsDKIMPass, cloudflare.RadarEmailSecurityTimeseriesGroupDMARCParamsDKIMNone, cloudflare.RadarEmailSecurityTimeseriesGroupDMARCParamsDKIMFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityTimeseriesGroupDMARCParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + SPF: cloudflare.F([]cloudflare.RadarEmailSecurityTimeseriesGroupDMARCParamsSPF{cloudflare.RadarEmailSecurityTimeseriesGroupDMARCParamsSPFPass, cloudflare.RadarEmailSecurityTimeseriesGroupDMARCParamsSPFNone, cloudflare.RadarEmailSecurityTimeseriesGroupDMARCParamsSPFFail}), + }) + 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 TestRadarEmailSecurityTimeseriesGroupMaliciousWithOptionalParams(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Radar.Email.Security.TimeseriesGroups.Malicious(context.TODO(), cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParams{ + AggInterval: cloudflare.F(cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParamsAggInterval1h), + ARC: cloudflare.F([]cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParamsARC{cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParamsARCPass, cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParamsARCNone, cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParamsARCFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange{cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange1d, cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange2d, cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DKIM: cloudflare.F([]cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParamsDKIM{cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParamsDKIMPass, cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParamsDKIMNone, cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParamsDKIMFail}), + DMARC: cloudflare.F([]cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParamsDMARC{cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParamsDMARCPass, cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParamsDMARCNone, cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParamsDMARCFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + SPF: cloudflare.F([]cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParamsSPF{cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParamsSPFPass, cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParamsSPFNone, cloudflare.RadarEmailSecurityTimeseriesGroupMaliciousParamsSPFFail}), + }) + 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 TestRadarEmailSecurityTimeseriesGroupSpamWithOptionalParams(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Radar.Email.Security.TimeseriesGroups.Spam(context.TODO(), cloudflare.RadarEmailSecurityTimeseriesGroupSpamParams{ + AggInterval: cloudflare.F(cloudflare.RadarEmailSecurityTimeseriesGroupSpamParamsAggInterval1h), + ARC: cloudflare.F([]cloudflare.RadarEmailSecurityTimeseriesGroupSpamParamsARC{cloudflare.RadarEmailSecurityTimeseriesGroupSpamParamsARCPass, cloudflare.RadarEmailSecurityTimeseriesGroupSpamParamsARCNone, cloudflare.RadarEmailSecurityTimeseriesGroupSpamParamsARCFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityTimeseriesGroupSpamParamsDateRange{cloudflare.RadarEmailSecurityTimeseriesGroupSpamParamsDateRange1d, cloudflare.RadarEmailSecurityTimeseriesGroupSpamParamsDateRange2d, cloudflare.RadarEmailSecurityTimeseriesGroupSpamParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DKIM: cloudflare.F([]cloudflare.RadarEmailSecurityTimeseriesGroupSpamParamsDKIM{cloudflare.RadarEmailSecurityTimeseriesGroupSpamParamsDKIMPass, cloudflare.RadarEmailSecurityTimeseriesGroupSpamParamsDKIMNone, cloudflare.RadarEmailSecurityTimeseriesGroupSpamParamsDKIMFail}), + DMARC: cloudflare.F([]cloudflare.RadarEmailSecurityTimeseriesGroupSpamParamsDMARC{cloudflare.RadarEmailSecurityTimeseriesGroupSpamParamsDMARCPass, cloudflare.RadarEmailSecurityTimeseriesGroupSpamParamsDMARCNone, cloudflare.RadarEmailSecurityTimeseriesGroupSpamParamsDMARCFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityTimeseriesGroupSpamParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + SPF: cloudflare.F([]cloudflare.RadarEmailSecurityTimeseriesGroupSpamParamsSPF{cloudflare.RadarEmailSecurityTimeseriesGroupSpamParamsSPFPass, cloudflare.RadarEmailSecurityTimeseriesGroupSpamParamsSPFNone, cloudflare.RadarEmailSecurityTimeseriesGroupSpamParamsSPFFail}), + }) + 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 TestRadarEmailSecurityTimeseriesGroupSPFWithOptionalParams(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Radar.Email.Security.TimeseriesGroups.SPF(context.TODO(), cloudflare.RadarEmailSecurityTimeseriesGroupSPFParams{ + AggInterval: cloudflare.F(cloudflare.RadarEmailSecurityTimeseriesGroupSPFParamsAggInterval1h), + ARC: cloudflare.F([]cloudflare.RadarEmailSecurityTimeseriesGroupSPFParamsARC{cloudflare.RadarEmailSecurityTimeseriesGroupSPFParamsARCPass, cloudflare.RadarEmailSecurityTimeseriesGroupSPFParamsARCNone, cloudflare.RadarEmailSecurityTimeseriesGroupSPFParamsARCFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityTimeseriesGroupSPFParamsDateRange{cloudflare.RadarEmailSecurityTimeseriesGroupSPFParamsDateRange1d, cloudflare.RadarEmailSecurityTimeseriesGroupSPFParamsDateRange2d, cloudflare.RadarEmailSecurityTimeseriesGroupSPFParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DKIM: cloudflare.F([]cloudflare.RadarEmailSecurityTimeseriesGroupSPFParamsDKIM{cloudflare.RadarEmailSecurityTimeseriesGroupSPFParamsDKIMPass, cloudflare.RadarEmailSecurityTimeseriesGroupSPFParamsDKIMNone, cloudflare.RadarEmailSecurityTimeseriesGroupSPFParamsDKIMFail}), + DMARC: cloudflare.F([]cloudflare.RadarEmailSecurityTimeseriesGroupSPFParamsDMARC{cloudflare.RadarEmailSecurityTimeseriesGroupSPFParamsDMARCPass, cloudflare.RadarEmailSecurityTimeseriesGroupSPFParamsDMARCNone, cloudflare.RadarEmailSecurityTimeseriesGroupSPFParamsDMARCFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityTimeseriesGroupSPFParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "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 TestRadarEmailSecurityTimeseriesGroupThreatCategoryWithOptionalParams(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Radar.Email.Security.TimeseriesGroups.ThreatCategory(context.TODO(), cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParams{ + AggInterval: cloudflare.F(cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParamsAggInterval1h), + ARC: cloudflare.F([]cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParamsARC{cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParamsARCPass, cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParamsARCNone, cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParamsARCFail}), + ASN: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange{cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange1d, cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange2d, cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DKIM: cloudflare.F([]cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDKIM{cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDKIMPass, cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDKIMNone, cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDKIMFail}), + DMARC: cloudflare.F([]cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDMARC{cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDMARCPass, cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDMARCNone, cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParamsDMARCFail}), + Format: cloudflare.F(cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParamsFormatJson), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + SPF: cloudflare.F([]cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParamsSPF{cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParamsSPFPass, cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParamsSPFNone, cloudflare.RadarEmailSecurityTimeseriesGroupThreatCategoryParamsSPFFail}), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/requesttracertrace.go b/requesttracertrace.go index 5165f46f7a0..f67d8569716 100644 --- a/requesttracertrace.go +++ b/requesttracertrace.go @@ -44,12 +44,14 @@ func (r *RequestTracerTraceService) New(ctx context.Context, accountIdentifier s return } +type JjJoFrd1Trace []JjJoFrd1Trace + // Trace result with an origin status code type RequestTracerTraceNewResponse struct { // HTTP Status code of zone response - StatusCode int64 `json:"status_code"` - Trace []RequestTracerTraceNewResponseTrace `json:"trace"` - JSON requestTracerTraceNewResponseJSON `json:"-"` + StatusCode int64 `json:"status_code"` + Trace JjJoFrd1Trace `json:"trace"` + JSON requestTracerTraceNewResponseJSON `json:"-"` } // requestTracerTraceNewResponseJSON contains the JSON metadata for the struct @@ -65,96 +67,6 @@ func (r *RequestTracerTraceNewResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -// List of steps acting on request/response -type RequestTracerTraceNewResponseTrace struct { - // If step type is rule, then action performed by this rule - Action string `json:"action"` - // If step type is rule, then action parameters of this rule as JSON - ActionParameters interface{} `json:"action_parameters"` - // If step type is rule or ruleset, the description of this entity - Description string `json:"description"` - // If step type is rule, then expression used to match for this rule - Expression string `json:"expression"` - // If step type is ruleset, then kind of this ruleset - Kind string `json:"kind"` - // Whether tracing step affected tracing request/response - Matched bool `json:"matched"` - // If step type is ruleset, then name of this ruleset - Name string `json:"name"` - // Tracing step identifying name - StepName string `json:"step_name"` - Trace []RequestTracerTraceNewResponseTraceTrace `json:"trace"` - // Tracing step type - Type string `json:"type"` - JSON requestTracerTraceNewResponseTraceJSON `json:"-"` -} - -// requestTracerTraceNewResponseTraceJSON contains the JSON metadata for the struct -// [RequestTracerTraceNewResponseTrace] -type requestTracerTraceNewResponseTraceJSON struct { - Action apijson.Field - ActionParameters apijson.Field - Description apijson.Field - Expression apijson.Field - Kind apijson.Field - Matched apijson.Field - Name apijson.Field - StepName apijson.Field - Trace apijson.Field - Type apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RequestTracerTraceNewResponseTrace) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// List of steps acting on request/response -type RequestTracerTraceNewResponseTraceTrace struct { - // If step type is rule, then action performed by this rule - Action string `json:"action"` - // If step type is rule, then action parameters of this rule as JSON - ActionParameters interface{} `json:"action_parameters"` - // If step type is rule or ruleset, the description of this entity - Description string `json:"description"` - // If step type is rule, then expression used to match for this rule - Expression string `json:"expression"` - // If step type is ruleset, then kind of this ruleset - Kind string `json:"kind"` - // Whether tracing step affected tracing request/response - Matched bool `json:"matched"` - // If step type is ruleset, then name of this ruleset - Name string `json:"name"` - // Tracing step identifying name - StepName string `json:"step_name"` - Trace interface{} `json:"trace"` - // Tracing step type - Type string `json:"type"` - JSON requestTracerTraceNewResponseTraceTraceJSON `json:"-"` -} - -// requestTracerTraceNewResponseTraceTraceJSON contains the JSON metadata for the -// struct [RequestTracerTraceNewResponseTraceTrace] -type requestTracerTraceNewResponseTraceTraceJSON struct { - Action apijson.Field - ActionParameters apijson.Field - Description apijson.Field - Expression apijson.Field - Kind apijson.Field - Matched apijson.Field - Name apijson.Field - StepName apijson.Field - Trace apijson.Field - Type apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RequestTracerTraceNewResponseTraceTrace) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - type RequestTracerTraceNewParams struct { // HTTP Method of tracing request Method param.Field[string] `json:"method,required"` diff --git a/rulesetrule.go b/rulesetrule.go index bf6f6a71073..99649cf7b35 100644 --- a/rulesetrule.go +++ b/rulesetrule.go @@ -2281,24 +2281,24 @@ func (r RulesetRuleNewParams) MarshalJSON() (data []byte, err error) { // An object configuring where the rule will be placed. // -// Satisfied by [RulesetRuleNewParamsPositionObject], -// [RulesetRuleNewParamsPositionObject], [RulesetRuleNewParamsPositionObject]. +// Satisfied by [RulesetRuleNewParamsPositionPosition], +// [RulesetRuleNewParamsPositionPosition], [RulesetRuleNewParamsPositionPosition]. type RulesetRuleNewParamsPosition interface { implementsRulesetRuleNewParamsPosition() } // An object configuring where the rule will be placed. -type RulesetRuleNewParamsPositionObject struct { +type RulesetRuleNewParamsPositionPosition 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 RulesetRuleNewParamsPositionObject) MarshalJSON() (data []byte, err error) { +func (r RulesetRuleNewParamsPositionPosition) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r RulesetRuleNewParamsPositionObject) implementsRulesetRuleNewParamsPosition() {} +func (r RulesetRuleNewParamsPositionPosition) implementsRulesetRuleNewParamsPosition() {} // A response object. type RulesetRuleNewResponseEnvelope struct { @@ -2566,24 +2566,25 @@ func (r RulesetRuleEditParams) MarshalJSON() (data []byte, err error) { // An object configuring where the rule will be placed. // -// Satisfied by [RulesetRuleEditParamsPositionObject], -// [RulesetRuleEditParamsPositionObject], [RulesetRuleEditParamsPositionObject]. +// Satisfied by [RulesetRuleEditParamsPositionPosition], +// [RulesetRuleEditParamsPositionPosition], +// [RulesetRuleEditParamsPositionPosition]. type RulesetRuleEditParamsPosition interface { implementsRulesetRuleEditParamsPosition() } // An object configuring where the rule will be placed. -type RulesetRuleEditParamsPositionObject struct { +type RulesetRuleEditParamsPositionPosition 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 RulesetRuleEditParamsPositionObject) MarshalJSON() (data []byte, err error) { +func (r RulesetRuleEditParamsPositionPosition) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r RulesetRuleEditParamsPositionObject) implementsRulesetRuleEditParamsPosition() {} +func (r RulesetRuleEditParamsPositionPosition) implementsRulesetRuleEditParamsPosition() {} // A response object. type RulesetRuleEditResponseEnvelope struct { diff --git a/rulesetrule_test.go b/rulesetrule_test.go index cbddb78456c..61e6e775d06 100644 --- a/rulesetrule_test.go +++ b/rulesetrule_test.go @@ -35,7 +35,7 @@ func TestRulesetRuleNewWithOptionalParams(t *testing.T) { cloudflare.RulesetRuleNewParams{ AccountID: cloudflare.F("string"), ZoneID: cloudflare.F("string"), - Position: cloudflare.F[cloudflare.RulesetRuleNewParamsPosition](cloudflare.RulesetRuleNewParamsPositionObject(cloudflare.RulesetRuleNewParamsPositionObject{ + Position: cloudflare.F[cloudflare.RulesetRuleNewParamsPosition](cloudflare.RulesetRuleNewParamsPositionPosition(cloudflare.RulesetRuleNewParamsPositionPosition{ Before: cloudflare.F("da5e8e506c8e7877fe06cdf4c41add54"), })), }, @@ -105,7 +105,7 @@ func TestRulesetRuleEditWithOptionalParams(t *testing.T) { "3a03d665bac047339bb530ecb439a90d", cloudflare.RulesetRuleEditParams{ AccountID: cloudflare.F("abf9b32d38c5f572afde3336ec0ce302"), - Position: cloudflare.F[cloudflare.RulesetRuleEditParamsPosition](cloudflare.RulesetRuleEditParamsPositionObject(cloudflare.RulesetRuleEditParamsPositionObject{ + Position: cloudflare.F[cloudflare.RulesetRuleEditParamsPosition](cloudflare.RulesetRuleEditParamsPositionPosition(cloudflare.RulesetRuleEditParamsPositionPosition{ Before: cloudflare.F("da5e8e506c8e7877fe06cdf4c41add54"), })), }, diff --git a/setting.go b/setting.go deleted file mode 100644 index 2b86800c73a..00000000000 --- a/setting.go +++ /dev/null @@ -1,9343 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "reflect" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingService contains methods and other services that help with interacting -// with the cloudflare API. Note, unlike clients, this service does not read -// variables from the environment automatically. You should not instantiate this -// service directly, and instead use the [NewSettingService] method instead. -type SettingService struct { - Options []option.RequestOption - ZeroRTT *SettingZeroRTTService - AdvancedDDOS *SettingAdvancedDDOSService - AlwaysOnline *SettingAlwaysOnlineService - AlwaysUseHTTPS *SettingAlwaysUseHTTPSService - AutomaticHTTPSRewrites *SettingAutomaticHTTPSRewriteService - AutomaticPlatformOptimization *SettingAutomaticPlatformOptimizationService - Brotli *SettingBrotliService - BrowserCacheTTL *SettingBrowserCacheTTLService - BrowserCheck *SettingBrowserCheckService - CacheLevel *SettingCacheLevelService - ChallengeTTL *SettingChallengeTTLService - Ciphers *SettingCipherService - DevelopmentMode *SettingDevelopmentModeService - EarlyHints *SettingEarlyHintService - EmailObfuscation *SettingEmailObfuscationService - H2Prioritization *SettingH2PrioritizationService - HotlinkProtection *SettingHotlinkProtectionService - HTTP2 *SettingHTTP2Service - HTTP3 *SettingHTTP3Service - ImageResizing *SettingImageResizingService - IPGeolocation *SettingIPGeolocationService - IPV6 *SettingIPV6Service - MinTLSVersion *SettingMinTLSVersionService - Minify *SettingMinifyService - Mirage *SettingMirageService - MobileRedirect *SettingMobileRedirectService - NEL *SettingNELService - OpportunisticEncryption *SettingOpportunisticEncryptionService - OpportunisticOnion *SettingOpportunisticOnionService - OrangeToOrange *SettingOrangeToOrangeService - OriginErrorPagePassThru *SettingOriginErrorPagePassThruService - OriginMaxHTTPVersion *SettingOriginMaxHTTPVersionService - Polish *SettingPolishService - PrefetchPreload *SettingPrefetchPreloadService - ProxyReadTimeout *SettingProxyReadTimeoutService - PseudoIPV4 *SettingPseudoIPV4Service - ResponseBuffering *SettingResponseBufferingService - RocketLoader *SettingRocketLoaderService - SecurityHeaders *SettingSecurityHeaderService - SecurityLevel *SettingSecurityLevelService - ServerSideExcludes *SettingServerSideExcludeService - SortQueryStringForCache *SettingSortQueryStringForCacheService - SSL *SettingSSLService - SSLRecommender *SettingSSLRecommenderService - TLS1_3 *SettingTLS1_3Service - TLSClientAuth *SettingTLSClientAuthService - TrueClientIPHeader *SettingTrueClientIPHeaderService - WAF *SettingWAFService - Webp *SettingWebpService - Websocket *SettingWebsocketService - FontSettings *SettingFontSettingService -} - -// NewSettingService generates a new service that applies the given options to each -// request. These options are applied after the parent client's options (if there -// is one), and before any request-specific options. -func NewSettingService(opts ...option.RequestOption) (r *SettingService) { - r = &SettingService{} - r.Options = opts - r.ZeroRTT = NewSettingZeroRTTService(opts...) - r.AdvancedDDOS = NewSettingAdvancedDDOSService(opts...) - r.AlwaysOnline = NewSettingAlwaysOnlineService(opts...) - r.AlwaysUseHTTPS = NewSettingAlwaysUseHTTPSService(opts...) - r.AutomaticHTTPSRewrites = NewSettingAutomaticHTTPSRewriteService(opts...) - r.AutomaticPlatformOptimization = NewSettingAutomaticPlatformOptimizationService(opts...) - r.Brotli = NewSettingBrotliService(opts...) - r.BrowserCacheTTL = NewSettingBrowserCacheTTLService(opts...) - r.BrowserCheck = NewSettingBrowserCheckService(opts...) - r.CacheLevel = NewSettingCacheLevelService(opts...) - r.ChallengeTTL = NewSettingChallengeTTLService(opts...) - r.Ciphers = NewSettingCipherService(opts...) - r.DevelopmentMode = NewSettingDevelopmentModeService(opts...) - r.EarlyHints = NewSettingEarlyHintService(opts...) - r.EmailObfuscation = NewSettingEmailObfuscationService(opts...) - r.H2Prioritization = NewSettingH2PrioritizationService(opts...) - r.HotlinkProtection = NewSettingHotlinkProtectionService(opts...) - r.HTTP2 = NewSettingHTTP2Service(opts...) - r.HTTP3 = NewSettingHTTP3Service(opts...) - r.ImageResizing = NewSettingImageResizingService(opts...) - r.IPGeolocation = NewSettingIPGeolocationService(opts...) - r.IPV6 = NewSettingIPV6Service(opts...) - r.MinTLSVersion = NewSettingMinTLSVersionService(opts...) - r.Minify = NewSettingMinifyService(opts...) - r.Mirage = NewSettingMirageService(opts...) - r.MobileRedirect = NewSettingMobileRedirectService(opts...) - r.NEL = NewSettingNELService(opts...) - r.OpportunisticEncryption = NewSettingOpportunisticEncryptionService(opts...) - r.OpportunisticOnion = NewSettingOpportunisticOnionService(opts...) - r.OrangeToOrange = NewSettingOrangeToOrangeService(opts...) - r.OriginErrorPagePassThru = NewSettingOriginErrorPagePassThruService(opts...) - r.OriginMaxHTTPVersion = NewSettingOriginMaxHTTPVersionService(opts...) - r.Polish = NewSettingPolishService(opts...) - r.PrefetchPreload = NewSettingPrefetchPreloadService(opts...) - r.ProxyReadTimeout = NewSettingProxyReadTimeoutService(opts...) - r.PseudoIPV4 = NewSettingPseudoIPV4Service(opts...) - r.ResponseBuffering = NewSettingResponseBufferingService(opts...) - r.RocketLoader = NewSettingRocketLoaderService(opts...) - r.SecurityHeaders = NewSettingSecurityHeaderService(opts...) - r.SecurityLevel = NewSettingSecurityLevelService(opts...) - r.ServerSideExcludes = NewSettingServerSideExcludeService(opts...) - r.SortQueryStringForCache = NewSettingSortQueryStringForCacheService(opts...) - r.SSL = NewSettingSSLService(opts...) - r.SSLRecommender = NewSettingSSLRecommenderService(opts...) - r.TLS1_3 = NewSettingTLS1_3Service(opts...) - r.TLSClientAuth = NewSettingTLSClientAuthService(opts...) - r.TrueClientIPHeader = NewSettingTrueClientIPHeaderService(opts...) - r.WAF = NewSettingWAFService(opts...) - r.Webp = NewSettingWebpService(opts...) - r.Websocket = NewSettingWebsocketService(opts...) - r.FontSettings = NewSettingFontSettingService(opts...) - return -} - -// Available settings for your user in relation to a zone. -func (r *SettingService) List(ctx context.Context, query SettingListParams, opts ...option.RequestOption) (res *[]SettingListResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingListResponseEnvelope - path := fmt.Sprintf("zones/%s/settings", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Edit settings for a zone. -func (r *SettingService) Edit(ctx context.Context, params SettingEditParams, opts ...option.RequestOption) (res *[]SettingEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// 0-RTT session resumption enabled for this zone. -// -// Union satisfied by [SettingListResponseZones0rtt], -// [SettingListResponseZonesAdvancedDDOS], [SettingListResponseZonesAlwaysOnline], -// [SettingListResponseZonesAlwaysUseHTTPS], -// [SettingListResponseZonesAutomaticHTTPSRewrites], -// [SettingListResponseZonesBrotli], [SettingListResponseZonesBrowserCacheTTL], -// [SettingListResponseZonesBrowserCheck], [SettingListResponseZonesCacheLevel], -// [SettingListResponseZonesChallengeTTL], [SettingListResponseZonesCiphers], -// [SettingListResponseZonesCnameFlattening], -// [SettingListResponseZonesDevelopmentMode], [SettingListResponseZonesEarlyHints], -// [SettingListResponseZonesEdgeCacheTTL], -// [SettingListResponseZonesEmailObfuscation], -// [SettingListResponseZonesH2Prioritization], -// [SettingListResponseZonesHotlinkProtection], [SettingListResponseZonesHTTP2], -// [SettingListResponseZonesHTTP3], [SettingListResponseZonesImageResizing], -// [SettingListResponseZonesIPGeolocation], [SettingListResponseZonesIPV6], -// [SettingListResponseZonesMaxUpload], [SettingListResponseZonesMinTLSVersion], -// [SettingListResponseZonesMinify], [SettingListResponseZonesMirage], -// [SettingListResponseZonesMobileRedirect], [SettingListResponseZonesNEL], -// [SettingListResponseZonesOpportunisticEncryption], -// [SettingListResponseZonesOpportunisticOnion], -// [SettingListResponseZonesOrangeToOrange], -// [SettingListResponseZonesOriginErrorPagePassThru], -// [SettingListResponseZonesPolish], [SettingListResponseZonesPrefetchPreload], -// [SettingListResponseZonesProxyReadTimeout], -// [SettingListResponseZonesPseudoIPV4], -// [SettingListResponseZonesResponseBuffering], -// [SettingListResponseZonesRocketLoader], -// [SettingListResponseZonesSchemasAutomaticPlatformOptimization], -// [SettingListResponseZonesSecurityHeader], -// [SettingListResponseZonesSecurityLevel], -// [SettingListResponseZonesServerSideExclude], -// [SettingListResponseZonesSha1Support], -// [SettingListResponseZonesSortQueryStringForCache], -// [SettingListResponseZonesSSL], [SettingListResponseZonesSSLRecommender], -// [SettingListResponseZonesTLS1_2Only], [SettingListResponseZonesTLS1_3], -// [SettingListResponseZonesTLSClientAuth], -// [SettingListResponseZonesTrueClientIPHeader], [SettingListResponseZonesWAF], -// [SettingListResponseZonesWebp] or [SettingListResponseZonesWebsockets]. -type SettingListResponse interface { - implementsSettingListResponse() -} - -func init() { - apijson.RegisterUnion(reflect.TypeOf((*SettingListResponse)(nil)).Elem(), "") -} - -// 0-RTT session resumption enabled for this zone. -type SettingListResponseZones0rtt struct { - // ID of the zone setting. - ID SettingListResponseZones0rttID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZones0rttValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZones0rttEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZones0rttJSON `json:"-"` -} - -// settingListResponseZones0rttJSON contains the JSON metadata for the struct -// [SettingListResponseZones0rtt] -type settingListResponseZones0rttJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZones0rtt) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZones0rtt) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZones0rttID string - -const ( - SettingListResponseZones0rttID0rtt SettingListResponseZones0rttID = "0rtt" -) - -// Current value of the zone setting. -type SettingListResponseZones0rttValue string - -const ( - SettingListResponseZones0rttValueOn SettingListResponseZones0rttValue = "on" - SettingListResponseZones0rttValueOff SettingListResponseZones0rttValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZones0rttEditable bool - -const ( - SettingListResponseZones0rttEditableTrue SettingListResponseZones0rttEditable = true - SettingListResponseZones0rttEditableFalse SettingListResponseZones0rttEditable = false -) - -// Advanced protection from Distributed Denial of Service (DDoS) attacks on your -// website. This is an uneditable value that is 'on' in the case of Business and -// Enterprise zones. -type SettingListResponseZonesAdvancedDDOS struct { - // ID of the zone setting. - ID SettingListResponseZonesAdvancedDDOSID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesAdvancedDDOSValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesAdvancedDDOSEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesAdvancedDDOSJSON `json:"-"` -} - -// settingListResponseZonesAdvancedDDOSJSON contains the JSON metadata for the -// struct [SettingListResponseZonesAdvancedDDOS] -type settingListResponseZonesAdvancedDDOSJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesAdvancedDDOS) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesAdvancedDDOS) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesAdvancedDDOSID string - -const ( - SettingListResponseZonesAdvancedDDOSIDAdvancedDDOS SettingListResponseZonesAdvancedDDOSID = "advanced_ddos" -) - -// Current value of the zone setting. -type SettingListResponseZonesAdvancedDDOSValue string - -const ( - SettingListResponseZonesAdvancedDDOSValueOn SettingListResponseZonesAdvancedDDOSValue = "on" - SettingListResponseZonesAdvancedDDOSValueOff SettingListResponseZonesAdvancedDDOSValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesAdvancedDDOSEditable bool - -const ( - SettingListResponseZonesAdvancedDDOSEditableTrue SettingListResponseZonesAdvancedDDOSEditable = true - SettingListResponseZonesAdvancedDDOSEditableFalse SettingListResponseZonesAdvancedDDOSEditable = false -) - -// When enabled, Cloudflare serves limited copies of web pages available from the -// [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is -// offline. Refer to -// [Always Online](https://developers.cloudflare.com/cache/about/always-online) for -// more information. -type SettingListResponseZonesAlwaysOnline struct { - // ID of the zone setting. - ID SettingListResponseZonesAlwaysOnlineID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesAlwaysOnlineValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesAlwaysOnlineEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesAlwaysOnlineJSON `json:"-"` -} - -// settingListResponseZonesAlwaysOnlineJSON contains the JSON metadata for the -// struct [SettingListResponseZonesAlwaysOnline] -type settingListResponseZonesAlwaysOnlineJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesAlwaysOnline) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesAlwaysOnline) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesAlwaysOnlineID string - -const ( - SettingListResponseZonesAlwaysOnlineIDAlwaysOnline SettingListResponseZonesAlwaysOnlineID = "always_online" -) - -// Current value of the zone setting. -type SettingListResponseZonesAlwaysOnlineValue string - -const ( - SettingListResponseZonesAlwaysOnlineValueOn SettingListResponseZonesAlwaysOnlineValue = "on" - SettingListResponseZonesAlwaysOnlineValueOff SettingListResponseZonesAlwaysOnlineValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesAlwaysOnlineEditable bool - -const ( - SettingListResponseZonesAlwaysOnlineEditableTrue SettingListResponseZonesAlwaysOnlineEditable = true - SettingListResponseZonesAlwaysOnlineEditableFalse SettingListResponseZonesAlwaysOnlineEditable = false -) - -// Reply to all requests for URLs that use "http" with a 301 redirect to the -// equivalent "https" URL. If you only want to redirect for a subset of requests, -// consider creating an "Always use HTTPS" page rule. -type SettingListResponseZonesAlwaysUseHTTPS struct { - // ID of the zone setting. - ID SettingListResponseZonesAlwaysUseHTTPSID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesAlwaysUseHTTPSValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesAlwaysUseHTTPSEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesAlwaysUseHTTPSJSON `json:"-"` -} - -// settingListResponseZonesAlwaysUseHTTPSJSON contains the JSON metadata for the -// struct [SettingListResponseZonesAlwaysUseHTTPS] -type settingListResponseZonesAlwaysUseHTTPSJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesAlwaysUseHTTPS) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesAlwaysUseHTTPS) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesAlwaysUseHTTPSID string - -const ( - SettingListResponseZonesAlwaysUseHTTPSIDAlwaysUseHTTPS SettingListResponseZonesAlwaysUseHTTPSID = "always_use_https" -) - -// Current value of the zone setting. -type SettingListResponseZonesAlwaysUseHTTPSValue string - -const ( - SettingListResponseZonesAlwaysUseHTTPSValueOn SettingListResponseZonesAlwaysUseHTTPSValue = "on" - SettingListResponseZonesAlwaysUseHTTPSValueOff SettingListResponseZonesAlwaysUseHTTPSValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesAlwaysUseHTTPSEditable bool - -const ( - SettingListResponseZonesAlwaysUseHTTPSEditableTrue SettingListResponseZonesAlwaysUseHTTPSEditable = true - SettingListResponseZonesAlwaysUseHTTPSEditableFalse SettingListResponseZonesAlwaysUseHTTPSEditable = false -) - -// Enable the Automatic HTTPS Rewrites feature for this zone. -type SettingListResponseZonesAutomaticHTTPSRewrites struct { - // ID of the zone setting. - ID SettingListResponseZonesAutomaticHTTPSRewritesID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesAutomaticHTTPSRewritesValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesAutomaticHTTPSRewritesEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesAutomaticHTTPSRewritesJSON `json:"-"` -} - -// settingListResponseZonesAutomaticHTTPSRewritesJSON contains the JSON metadata -// for the struct [SettingListResponseZonesAutomaticHTTPSRewrites] -type settingListResponseZonesAutomaticHTTPSRewritesJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesAutomaticHTTPSRewrites) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesAutomaticHTTPSRewrites) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesAutomaticHTTPSRewritesID string - -const ( - SettingListResponseZonesAutomaticHTTPSRewritesIDAutomaticHTTPSRewrites SettingListResponseZonesAutomaticHTTPSRewritesID = "automatic_https_rewrites" -) - -// Current value of the zone setting. -type SettingListResponseZonesAutomaticHTTPSRewritesValue string - -const ( - SettingListResponseZonesAutomaticHTTPSRewritesValueOn SettingListResponseZonesAutomaticHTTPSRewritesValue = "on" - SettingListResponseZonesAutomaticHTTPSRewritesValueOff SettingListResponseZonesAutomaticHTTPSRewritesValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesAutomaticHTTPSRewritesEditable bool - -const ( - SettingListResponseZonesAutomaticHTTPSRewritesEditableTrue SettingListResponseZonesAutomaticHTTPSRewritesEditable = true - SettingListResponseZonesAutomaticHTTPSRewritesEditableFalse SettingListResponseZonesAutomaticHTTPSRewritesEditable = false -) - -// When the client requesting an asset supports the Brotli compression algorithm, -// Cloudflare will serve a Brotli compressed version of the asset. -type SettingListResponseZonesBrotli struct { - // ID of the zone setting. - ID SettingListResponseZonesBrotliID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesBrotliValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesBrotliEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesBrotliJSON `json:"-"` -} - -// settingListResponseZonesBrotliJSON contains the JSON metadata for the struct -// [SettingListResponseZonesBrotli] -type settingListResponseZonesBrotliJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesBrotli) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesBrotli) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesBrotliID string - -const ( - SettingListResponseZonesBrotliIDBrotli SettingListResponseZonesBrotliID = "brotli" -) - -// Current value of the zone setting. -type SettingListResponseZonesBrotliValue string - -const ( - SettingListResponseZonesBrotliValueOff SettingListResponseZonesBrotliValue = "off" - SettingListResponseZonesBrotliValueOn SettingListResponseZonesBrotliValue = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesBrotliEditable bool - -const ( - SettingListResponseZonesBrotliEditableTrue SettingListResponseZonesBrotliEditable = true - SettingListResponseZonesBrotliEditableFalse SettingListResponseZonesBrotliEditable = false -) - -// Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources -// will remain on your visitors' computers. Cloudflare will honor any larger times -// specified by your server. -// (https://support.cloudflare.com/hc/en-us/articles/200168276). -type SettingListResponseZonesBrowserCacheTTL struct { - // ID of the zone setting. - ID SettingListResponseZonesBrowserCacheTTLID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesBrowserCacheTTLValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesBrowserCacheTTLEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesBrowserCacheTTLJSON `json:"-"` -} - -// settingListResponseZonesBrowserCacheTTLJSON contains the JSON metadata for the -// struct [SettingListResponseZonesBrowserCacheTTL] -type settingListResponseZonesBrowserCacheTTLJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesBrowserCacheTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesBrowserCacheTTL) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesBrowserCacheTTLID string - -const ( - SettingListResponseZonesBrowserCacheTTLIDBrowserCacheTTL SettingListResponseZonesBrowserCacheTTLID = "browser_cache_ttl" -) - -// Current value of the zone setting. -type SettingListResponseZonesBrowserCacheTTLValue float64 - -const ( - SettingListResponseZonesBrowserCacheTTLValue0 SettingListResponseZonesBrowserCacheTTLValue = 0 - SettingListResponseZonesBrowserCacheTTLValue30 SettingListResponseZonesBrowserCacheTTLValue = 30 - SettingListResponseZonesBrowserCacheTTLValue60 SettingListResponseZonesBrowserCacheTTLValue = 60 - SettingListResponseZonesBrowserCacheTTLValue120 SettingListResponseZonesBrowserCacheTTLValue = 120 - SettingListResponseZonesBrowserCacheTTLValue300 SettingListResponseZonesBrowserCacheTTLValue = 300 - SettingListResponseZonesBrowserCacheTTLValue1200 SettingListResponseZonesBrowserCacheTTLValue = 1200 - SettingListResponseZonesBrowserCacheTTLValue1800 SettingListResponseZonesBrowserCacheTTLValue = 1800 - SettingListResponseZonesBrowserCacheTTLValue3600 SettingListResponseZonesBrowserCacheTTLValue = 3600 - SettingListResponseZonesBrowserCacheTTLValue7200 SettingListResponseZonesBrowserCacheTTLValue = 7200 - SettingListResponseZonesBrowserCacheTTLValue10800 SettingListResponseZonesBrowserCacheTTLValue = 10800 - SettingListResponseZonesBrowserCacheTTLValue14400 SettingListResponseZonesBrowserCacheTTLValue = 14400 - SettingListResponseZonesBrowserCacheTTLValue18000 SettingListResponseZonesBrowserCacheTTLValue = 18000 - SettingListResponseZonesBrowserCacheTTLValue28800 SettingListResponseZonesBrowserCacheTTLValue = 28800 - SettingListResponseZonesBrowserCacheTTLValue43200 SettingListResponseZonesBrowserCacheTTLValue = 43200 - SettingListResponseZonesBrowserCacheTTLValue57600 SettingListResponseZonesBrowserCacheTTLValue = 57600 - SettingListResponseZonesBrowserCacheTTLValue72000 SettingListResponseZonesBrowserCacheTTLValue = 72000 - SettingListResponseZonesBrowserCacheTTLValue86400 SettingListResponseZonesBrowserCacheTTLValue = 86400 - SettingListResponseZonesBrowserCacheTTLValue172800 SettingListResponseZonesBrowserCacheTTLValue = 172800 - SettingListResponseZonesBrowserCacheTTLValue259200 SettingListResponseZonesBrowserCacheTTLValue = 259200 - SettingListResponseZonesBrowserCacheTTLValue345600 SettingListResponseZonesBrowserCacheTTLValue = 345600 - SettingListResponseZonesBrowserCacheTTLValue432000 SettingListResponseZonesBrowserCacheTTLValue = 432000 - SettingListResponseZonesBrowserCacheTTLValue691200 SettingListResponseZonesBrowserCacheTTLValue = 691200 - SettingListResponseZonesBrowserCacheTTLValue1382400 SettingListResponseZonesBrowserCacheTTLValue = 1382400 - SettingListResponseZonesBrowserCacheTTLValue2073600 SettingListResponseZonesBrowserCacheTTLValue = 2073600 - SettingListResponseZonesBrowserCacheTTLValue2678400 SettingListResponseZonesBrowserCacheTTLValue = 2678400 - SettingListResponseZonesBrowserCacheTTLValue5356800 SettingListResponseZonesBrowserCacheTTLValue = 5356800 - SettingListResponseZonesBrowserCacheTTLValue16070400 SettingListResponseZonesBrowserCacheTTLValue = 16070400 - SettingListResponseZonesBrowserCacheTTLValue31536000 SettingListResponseZonesBrowserCacheTTLValue = 31536000 -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesBrowserCacheTTLEditable bool - -const ( - SettingListResponseZonesBrowserCacheTTLEditableTrue SettingListResponseZonesBrowserCacheTTLEditable = true - SettingListResponseZonesBrowserCacheTTLEditableFalse SettingListResponseZonesBrowserCacheTTLEditable = false -) - -// Browser Integrity Check is similar to Bad Behavior and looks for common HTTP -// headers abused most commonly by spammers and denies access to your page. It will -// also challenge visitors that do not have a user agent or a non standard user -// agent (also commonly used by abuse bots, crawlers or visitors). -// (https://support.cloudflare.com/hc/en-us/articles/200170086). -type SettingListResponseZonesBrowserCheck struct { - // ID of the zone setting. - ID SettingListResponseZonesBrowserCheckID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesBrowserCheckValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesBrowserCheckEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesBrowserCheckJSON `json:"-"` -} - -// settingListResponseZonesBrowserCheckJSON contains the JSON metadata for the -// struct [SettingListResponseZonesBrowserCheck] -type settingListResponseZonesBrowserCheckJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesBrowserCheck) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesBrowserCheck) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesBrowserCheckID string - -const ( - SettingListResponseZonesBrowserCheckIDBrowserCheck SettingListResponseZonesBrowserCheckID = "browser_check" -) - -// Current value of the zone setting. -type SettingListResponseZonesBrowserCheckValue string - -const ( - SettingListResponseZonesBrowserCheckValueOn SettingListResponseZonesBrowserCheckValue = "on" - SettingListResponseZonesBrowserCheckValueOff SettingListResponseZonesBrowserCheckValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesBrowserCheckEditable bool - -const ( - SettingListResponseZonesBrowserCheckEditableTrue SettingListResponseZonesBrowserCheckEditable = true - SettingListResponseZonesBrowserCheckEditableFalse SettingListResponseZonesBrowserCheckEditable = false -) - -// Cache Level functions based off the setting level. The basic setting will cache -// most static resources (i.e., css, images, and JavaScript). The simplified -// setting will ignore the query string when delivering a cached resource. The -// aggressive setting will cache all static resources, including ones with a query -// string. (https://support.cloudflare.com/hc/en-us/articles/200168256). -type SettingListResponseZonesCacheLevel struct { - // ID of the zone setting. - ID SettingListResponseZonesCacheLevelID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesCacheLevelValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesCacheLevelEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesCacheLevelJSON `json:"-"` -} - -// settingListResponseZonesCacheLevelJSON contains the JSON metadata for the struct -// [SettingListResponseZonesCacheLevel] -type settingListResponseZonesCacheLevelJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesCacheLevel) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesCacheLevel) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesCacheLevelID string - -const ( - SettingListResponseZonesCacheLevelIDCacheLevel SettingListResponseZonesCacheLevelID = "cache_level" -) - -// Current value of the zone setting. -type SettingListResponseZonesCacheLevelValue string - -const ( - SettingListResponseZonesCacheLevelValueAggressive SettingListResponseZonesCacheLevelValue = "aggressive" - SettingListResponseZonesCacheLevelValueBasic SettingListResponseZonesCacheLevelValue = "basic" - SettingListResponseZonesCacheLevelValueSimplified SettingListResponseZonesCacheLevelValue = "simplified" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesCacheLevelEditable bool - -const ( - SettingListResponseZonesCacheLevelEditableTrue SettingListResponseZonesCacheLevelEditable = true - SettingListResponseZonesCacheLevelEditableFalse SettingListResponseZonesCacheLevelEditable = false -) - -// Specify how long a visitor is allowed access to your site after successfully -// completing a challenge (such as a CAPTCHA). After the TTL has expired the -// visitor will have to complete a new challenge. We recommend a 15 - 45 minute -// setting and will attempt to honor any setting above 45 minutes. -// (https://support.cloudflare.com/hc/en-us/articles/200170136). -type SettingListResponseZonesChallengeTTL struct { - // ID of the zone setting. - ID SettingListResponseZonesChallengeTTLID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesChallengeTTLValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesChallengeTTLEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesChallengeTTLJSON `json:"-"` -} - -// settingListResponseZonesChallengeTTLJSON contains the JSON metadata for the -// struct [SettingListResponseZonesChallengeTTL] -type settingListResponseZonesChallengeTTLJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesChallengeTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesChallengeTTL) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesChallengeTTLID string - -const ( - SettingListResponseZonesChallengeTTLIDChallengeTTL SettingListResponseZonesChallengeTTLID = "challenge_ttl" -) - -// Current value of the zone setting. -type SettingListResponseZonesChallengeTTLValue float64 - -const ( - SettingListResponseZonesChallengeTTLValue300 SettingListResponseZonesChallengeTTLValue = 300 - SettingListResponseZonesChallengeTTLValue900 SettingListResponseZonesChallengeTTLValue = 900 - SettingListResponseZonesChallengeTTLValue1800 SettingListResponseZonesChallengeTTLValue = 1800 - SettingListResponseZonesChallengeTTLValue2700 SettingListResponseZonesChallengeTTLValue = 2700 - SettingListResponseZonesChallengeTTLValue3600 SettingListResponseZonesChallengeTTLValue = 3600 - SettingListResponseZonesChallengeTTLValue7200 SettingListResponseZonesChallengeTTLValue = 7200 - SettingListResponseZonesChallengeTTLValue10800 SettingListResponseZonesChallengeTTLValue = 10800 - SettingListResponseZonesChallengeTTLValue14400 SettingListResponseZonesChallengeTTLValue = 14400 - SettingListResponseZonesChallengeTTLValue28800 SettingListResponseZonesChallengeTTLValue = 28800 - SettingListResponseZonesChallengeTTLValue57600 SettingListResponseZonesChallengeTTLValue = 57600 - SettingListResponseZonesChallengeTTLValue86400 SettingListResponseZonesChallengeTTLValue = 86400 - SettingListResponseZonesChallengeTTLValue604800 SettingListResponseZonesChallengeTTLValue = 604800 - SettingListResponseZonesChallengeTTLValue2592000 SettingListResponseZonesChallengeTTLValue = 2592000 - SettingListResponseZonesChallengeTTLValue31536000 SettingListResponseZonesChallengeTTLValue = 31536000 -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesChallengeTTLEditable bool - -const ( - SettingListResponseZonesChallengeTTLEditableTrue SettingListResponseZonesChallengeTTLEditable = true - SettingListResponseZonesChallengeTTLEditableFalse SettingListResponseZonesChallengeTTLEditable = false -) - -// An allowlist of ciphers for TLS termination. These ciphers must be in the -// BoringSSL format. -type SettingListResponseZonesCiphers struct { - // ID of the zone setting. - ID SettingListResponseZonesCiphersID `json:"id,required"` - // Current value of the zone setting. - Value []string `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesCiphersEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesCiphersJSON `json:"-"` -} - -// settingListResponseZonesCiphersJSON contains the JSON metadata for the struct -// [SettingListResponseZonesCiphers] -type settingListResponseZonesCiphersJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesCiphers) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesCiphers) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesCiphersID string - -const ( - SettingListResponseZonesCiphersIDCiphers SettingListResponseZonesCiphersID = "ciphers" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesCiphersEditable bool - -const ( - SettingListResponseZonesCiphersEditableTrue SettingListResponseZonesCiphersEditable = true - SettingListResponseZonesCiphersEditableFalse SettingListResponseZonesCiphersEditable = false -) - -// Whether or not cname flattening is on. -type SettingListResponseZonesCnameFlattening struct { - // How to flatten the cname destination. - ID SettingListResponseZonesCnameFlatteningID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesCnameFlatteningValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesCnameFlatteningEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesCnameFlatteningJSON `json:"-"` -} - -// settingListResponseZonesCnameFlatteningJSON contains the JSON metadata for the -// struct [SettingListResponseZonesCnameFlattening] -type settingListResponseZonesCnameFlatteningJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesCnameFlattening) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesCnameFlattening) implementsSettingListResponse() {} - -// How to flatten the cname destination. -type SettingListResponseZonesCnameFlatteningID string - -const ( - SettingListResponseZonesCnameFlatteningIDCnameFlattening SettingListResponseZonesCnameFlatteningID = "cname_flattening" -) - -// Current value of the zone setting. -type SettingListResponseZonesCnameFlatteningValue string - -const ( - SettingListResponseZonesCnameFlatteningValueFlattenAtRoot SettingListResponseZonesCnameFlatteningValue = "flatten_at_root" - SettingListResponseZonesCnameFlatteningValueFlattenAll SettingListResponseZonesCnameFlatteningValue = "flatten_all" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesCnameFlatteningEditable bool - -const ( - SettingListResponseZonesCnameFlatteningEditableTrue SettingListResponseZonesCnameFlatteningEditable = true - SettingListResponseZonesCnameFlatteningEditableFalse SettingListResponseZonesCnameFlatteningEditable = false -) - -// Development Mode temporarily allows you to enter development mode for your -// websites if you need to make changes to your site. This will bypass Cloudflare's -// accelerated cache and slow down your site, but is useful if you are making -// changes to cacheable content (like images, css, or JavaScript) and would like to -// see those changes right away. Once entered, development mode will last for 3 -// hours and then automatically toggle off. -type SettingListResponseZonesDevelopmentMode struct { - // ID of the zone setting. - ID SettingListResponseZonesDevelopmentModeID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesDevelopmentModeValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesDevelopmentModeEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - // Value of the zone setting. Notes: The interval (in seconds) from when - // development mode expires (positive integer) or last expired (negative integer) - // for the domain. If development mode has never been enabled, this value is false. - TimeRemaining float64 `json:"time_remaining"` - JSON settingListResponseZonesDevelopmentModeJSON `json:"-"` -} - -// settingListResponseZonesDevelopmentModeJSON contains the JSON metadata for the -// struct [SettingListResponseZonesDevelopmentMode] -type settingListResponseZonesDevelopmentModeJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - TimeRemaining apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesDevelopmentMode) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesDevelopmentMode) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesDevelopmentModeID string - -const ( - SettingListResponseZonesDevelopmentModeIDDevelopmentMode SettingListResponseZonesDevelopmentModeID = "development_mode" -) - -// Current value of the zone setting. -type SettingListResponseZonesDevelopmentModeValue string - -const ( - SettingListResponseZonesDevelopmentModeValueOn SettingListResponseZonesDevelopmentModeValue = "on" - SettingListResponseZonesDevelopmentModeValueOff SettingListResponseZonesDevelopmentModeValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesDevelopmentModeEditable bool - -const ( - SettingListResponseZonesDevelopmentModeEditableTrue SettingListResponseZonesDevelopmentModeEditable = true - SettingListResponseZonesDevelopmentModeEditableFalse SettingListResponseZonesDevelopmentModeEditable = false -) - -// When enabled, Cloudflare will attempt to speed up overall page loads by serving -// `103` responses with `Link` headers from the final response. Refer to -// [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for -// more information. -type SettingListResponseZonesEarlyHints struct { - // ID of the zone setting. - ID SettingListResponseZonesEarlyHintsID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesEarlyHintsValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesEarlyHintsEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesEarlyHintsJSON `json:"-"` -} - -// settingListResponseZonesEarlyHintsJSON contains the JSON metadata for the struct -// [SettingListResponseZonesEarlyHints] -type settingListResponseZonesEarlyHintsJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesEarlyHints) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesEarlyHints) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesEarlyHintsID string - -const ( - SettingListResponseZonesEarlyHintsIDEarlyHints SettingListResponseZonesEarlyHintsID = "early_hints" -) - -// Current value of the zone setting. -type SettingListResponseZonesEarlyHintsValue string - -const ( - SettingListResponseZonesEarlyHintsValueOn SettingListResponseZonesEarlyHintsValue = "on" - SettingListResponseZonesEarlyHintsValueOff SettingListResponseZonesEarlyHintsValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesEarlyHintsEditable bool - -const ( - SettingListResponseZonesEarlyHintsEditableTrue SettingListResponseZonesEarlyHintsEditable = true - SettingListResponseZonesEarlyHintsEditableFalse SettingListResponseZonesEarlyHintsEditable = false -) - -// Time (in seconds) that a resource will be ensured to remain on Cloudflare's -// cache servers. -type SettingListResponseZonesEdgeCacheTTL struct { - // ID of the zone setting. - ID SettingListResponseZonesEdgeCacheTTLID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesEdgeCacheTTLValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesEdgeCacheTTLEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesEdgeCacheTTLJSON `json:"-"` -} - -// settingListResponseZonesEdgeCacheTTLJSON contains the JSON metadata for the -// struct [SettingListResponseZonesEdgeCacheTTL] -type settingListResponseZonesEdgeCacheTTLJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesEdgeCacheTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesEdgeCacheTTL) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesEdgeCacheTTLID string - -const ( - SettingListResponseZonesEdgeCacheTTLIDEdgeCacheTTL SettingListResponseZonesEdgeCacheTTLID = "edge_cache_ttl" -) - -// Current value of the zone setting. -type SettingListResponseZonesEdgeCacheTTLValue float64 - -const ( - SettingListResponseZonesEdgeCacheTTLValue30 SettingListResponseZonesEdgeCacheTTLValue = 30 - SettingListResponseZonesEdgeCacheTTLValue60 SettingListResponseZonesEdgeCacheTTLValue = 60 - SettingListResponseZonesEdgeCacheTTLValue300 SettingListResponseZonesEdgeCacheTTLValue = 300 - SettingListResponseZonesEdgeCacheTTLValue1200 SettingListResponseZonesEdgeCacheTTLValue = 1200 - SettingListResponseZonesEdgeCacheTTLValue1800 SettingListResponseZonesEdgeCacheTTLValue = 1800 - SettingListResponseZonesEdgeCacheTTLValue3600 SettingListResponseZonesEdgeCacheTTLValue = 3600 - SettingListResponseZonesEdgeCacheTTLValue7200 SettingListResponseZonesEdgeCacheTTLValue = 7200 - SettingListResponseZonesEdgeCacheTTLValue10800 SettingListResponseZonesEdgeCacheTTLValue = 10800 - SettingListResponseZonesEdgeCacheTTLValue14400 SettingListResponseZonesEdgeCacheTTLValue = 14400 - SettingListResponseZonesEdgeCacheTTLValue18000 SettingListResponseZonesEdgeCacheTTLValue = 18000 - SettingListResponseZonesEdgeCacheTTLValue28800 SettingListResponseZonesEdgeCacheTTLValue = 28800 - SettingListResponseZonesEdgeCacheTTLValue43200 SettingListResponseZonesEdgeCacheTTLValue = 43200 - SettingListResponseZonesEdgeCacheTTLValue57600 SettingListResponseZonesEdgeCacheTTLValue = 57600 - SettingListResponseZonesEdgeCacheTTLValue72000 SettingListResponseZonesEdgeCacheTTLValue = 72000 - SettingListResponseZonesEdgeCacheTTLValue86400 SettingListResponseZonesEdgeCacheTTLValue = 86400 - SettingListResponseZonesEdgeCacheTTLValue172800 SettingListResponseZonesEdgeCacheTTLValue = 172800 - SettingListResponseZonesEdgeCacheTTLValue259200 SettingListResponseZonesEdgeCacheTTLValue = 259200 - SettingListResponseZonesEdgeCacheTTLValue345600 SettingListResponseZonesEdgeCacheTTLValue = 345600 - SettingListResponseZonesEdgeCacheTTLValue432000 SettingListResponseZonesEdgeCacheTTLValue = 432000 - SettingListResponseZonesEdgeCacheTTLValue518400 SettingListResponseZonesEdgeCacheTTLValue = 518400 - SettingListResponseZonesEdgeCacheTTLValue604800 SettingListResponseZonesEdgeCacheTTLValue = 604800 -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesEdgeCacheTTLEditable bool - -const ( - SettingListResponseZonesEdgeCacheTTLEditableTrue SettingListResponseZonesEdgeCacheTTLEditable = true - SettingListResponseZonesEdgeCacheTTLEditableFalse SettingListResponseZonesEdgeCacheTTLEditable = false -) - -// Encrypt email adresses on your web page from bots, while keeping them visible to -// humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). -type SettingListResponseZonesEmailObfuscation struct { - // ID of the zone setting. - ID SettingListResponseZonesEmailObfuscationID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesEmailObfuscationValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesEmailObfuscationEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesEmailObfuscationJSON `json:"-"` -} - -// settingListResponseZonesEmailObfuscationJSON contains the JSON metadata for the -// struct [SettingListResponseZonesEmailObfuscation] -type settingListResponseZonesEmailObfuscationJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesEmailObfuscation) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesEmailObfuscation) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesEmailObfuscationID string - -const ( - SettingListResponseZonesEmailObfuscationIDEmailObfuscation SettingListResponseZonesEmailObfuscationID = "email_obfuscation" -) - -// Current value of the zone setting. -type SettingListResponseZonesEmailObfuscationValue string - -const ( - SettingListResponseZonesEmailObfuscationValueOn SettingListResponseZonesEmailObfuscationValue = "on" - SettingListResponseZonesEmailObfuscationValueOff SettingListResponseZonesEmailObfuscationValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesEmailObfuscationEditable bool - -const ( - SettingListResponseZonesEmailObfuscationEditableTrue SettingListResponseZonesEmailObfuscationEditable = true - SettingListResponseZonesEmailObfuscationEditableFalse SettingListResponseZonesEmailObfuscationEditable = false -) - -// HTTP/2 Edge Prioritization optimises the delivery of resources served through -// HTTP/2 to improve page load performance. It also supports fine control of -// content delivery when used in conjunction with Workers. -type SettingListResponseZonesH2Prioritization struct { - // ID of the zone setting. - ID SettingListResponseZonesH2PrioritizationID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesH2PrioritizationValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesH2PrioritizationEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesH2PrioritizationJSON `json:"-"` -} - -// settingListResponseZonesH2PrioritizationJSON contains the JSON metadata for the -// struct [SettingListResponseZonesH2Prioritization] -type settingListResponseZonesH2PrioritizationJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesH2Prioritization) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesH2Prioritization) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesH2PrioritizationID string - -const ( - SettingListResponseZonesH2PrioritizationIDH2Prioritization SettingListResponseZonesH2PrioritizationID = "h2_prioritization" -) - -// Current value of the zone setting. -type SettingListResponseZonesH2PrioritizationValue string - -const ( - SettingListResponseZonesH2PrioritizationValueOn SettingListResponseZonesH2PrioritizationValue = "on" - SettingListResponseZonesH2PrioritizationValueOff SettingListResponseZonesH2PrioritizationValue = "off" - SettingListResponseZonesH2PrioritizationValueCustom SettingListResponseZonesH2PrioritizationValue = "custom" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesH2PrioritizationEditable bool - -const ( - SettingListResponseZonesH2PrioritizationEditableTrue SettingListResponseZonesH2PrioritizationEditable = true - SettingListResponseZonesH2PrioritizationEditableFalse SettingListResponseZonesH2PrioritizationEditable = false -) - -// When enabled, the Hotlink Protection option ensures that other sites cannot suck -// up your bandwidth by building pages that use images hosted on your site. Anytime -// a request for an image on your site hits Cloudflare, we check to ensure that -// it's not another site requesting them. People will still be able to download and -// view images from your page, but other sites won't be able to steal them for use -// on their own pages. -// (https://support.cloudflare.com/hc/en-us/articles/200170026). -type SettingListResponseZonesHotlinkProtection struct { - // ID of the zone setting. - ID SettingListResponseZonesHotlinkProtectionID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesHotlinkProtectionValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesHotlinkProtectionEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesHotlinkProtectionJSON `json:"-"` -} - -// settingListResponseZonesHotlinkProtectionJSON contains the JSON metadata for the -// struct [SettingListResponseZonesHotlinkProtection] -type settingListResponseZonesHotlinkProtectionJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesHotlinkProtection) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesHotlinkProtection) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesHotlinkProtectionID string - -const ( - SettingListResponseZonesHotlinkProtectionIDHotlinkProtection SettingListResponseZonesHotlinkProtectionID = "hotlink_protection" -) - -// Current value of the zone setting. -type SettingListResponseZonesHotlinkProtectionValue string - -const ( - SettingListResponseZonesHotlinkProtectionValueOn SettingListResponseZonesHotlinkProtectionValue = "on" - SettingListResponseZonesHotlinkProtectionValueOff SettingListResponseZonesHotlinkProtectionValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesHotlinkProtectionEditable bool - -const ( - SettingListResponseZonesHotlinkProtectionEditableTrue SettingListResponseZonesHotlinkProtectionEditable = true - SettingListResponseZonesHotlinkProtectionEditableFalse SettingListResponseZonesHotlinkProtectionEditable = false -) - -// HTTP2 enabled for this zone. -type SettingListResponseZonesHTTP2 struct { - // ID of the zone setting. - ID SettingListResponseZonesHTTP2ID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesHTTP2Value `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesHTTP2Editable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesHTTP2JSON `json:"-"` -} - -// settingListResponseZonesHTTP2JSON contains the JSON metadata for the struct -// [SettingListResponseZonesHTTP2] -type settingListResponseZonesHTTP2JSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesHTTP2) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesHTTP2) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesHTTP2ID string - -const ( - SettingListResponseZonesHTTP2IDHTTP2 SettingListResponseZonesHTTP2ID = "http2" -) - -// Current value of the zone setting. -type SettingListResponseZonesHTTP2Value string - -const ( - SettingListResponseZonesHTTP2ValueOn SettingListResponseZonesHTTP2Value = "on" - SettingListResponseZonesHTTP2ValueOff SettingListResponseZonesHTTP2Value = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesHTTP2Editable bool - -const ( - SettingListResponseZonesHTTP2EditableTrue SettingListResponseZonesHTTP2Editable = true - SettingListResponseZonesHTTP2EditableFalse SettingListResponseZonesHTTP2Editable = false -) - -// HTTP3 enabled for this zone. -type SettingListResponseZonesHTTP3 struct { - // ID of the zone setting. - ID SettingListResponseZonesHTTP3ID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesHTTP3Value `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesHTTP3Editable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesHTTP3JSON `json:"-"` -} - -// settingListResponseZonesHTTP3JSON contains the JSON metadata for the struct -// [SettingListResponseZonesHTTP3] -type settingListResponseZonesHTTP3JSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesHTTP3) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesHTTP3) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesHTTP3ID string - -const ( - SettingListResponseZonesHTTP3IDHTTP3 SettingListResponseZonesHTTP3ID = "http3" -) - -// Current value of the zone setting. -type SettingListResponseZonesHTTP3Value string - -const ( - SettingListResponseZonesHTTP3ValueOn SettingListResponseZonesHTTP3Value = "on" - SettingListResponseZonesHTTP3ValueOff SettingListResponseZonesHTTP3Value = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesHTTP3Editable bool - -const ( - SettingListResponseZonesHTTP3EditableTrue SettingListResponseZonesHTTP3Editable = true - SettingListResponseZonesHTTP3EditableFalse SettingListResponseZonesHTTP3Editable = false -) - -// Image Resizing provides on-demand resizing, conversion and optimisation for -// images served through Cloudflare's network. Refer to the -// [Image Resizing documentation](https://developers.cloudflare.com/images/) for -// more information. -type SettingListResponseZonesImageResizing struct { - // ID of the zone setting. - ID SettingListResponseZonesImageResizingID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesImageResizingValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesImageResizingEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesImageResizingJSON `json:"-"` -} - -// settingListResponseZonesImageResizingJSON contains the JSON metadata for the -// struct [SettingListResponseZonesImageResizing] -type settingListResponseZonesImageResizingJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesImageResizing) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesImageResizing) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesImageResizingID string - -const ( - SettingListResponseZonesImageResizingIDImageResizing SettingListResponseZonesImageResizingID = "image_resizing" -) - -// Current value of the zone setting. -type SettingListResponseZonesImageResizingValue string - -const ( - SettingListResponseZonesImageResizingValueOn SettingListResponseZonesImageResizingValue = "on" - SettingListResponseZonesImageResizingValueOff SettingListResponseZonesImageResizingValue = "off" - SettingListResponseZonesImageResizingValueOpen SettingListResponseZonesImageResizingValue = "open" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesImageResizingEditable bool - -const ( - SettingListResponseZonesImageResizingEditableTrue SettingListResponseZonesImageResizingEditable = true - SettingListResponseZonesImageResizingEditableFalse SettingListResponseZonesImageResizingEditable = false -) - -// Enable IP Geolocation to have Cloudflare geolocate visitors to your website and -// pass the country code to you. -// (https://support.cloudflare.com/hc/en-us/articles/200168236). -type SettingListResponseZonesIPGeolocation struct { - // ID of the zone setting. - ID SettingListResponseZonesIPGeolocationID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesIPGeolocationValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesIPGeolocationEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesIPGeolocationJSON `json:"-"` -} - -// settingListResponseZonesIPGeolocationJSON contains the JSON metadata for the -// struct [SettingListResponseZonesIPGeolocation] -type settingListResponseZonesIPGeolocationJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesIPGeolocation) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesIPGeolocation) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesIPGeolocationID string - -const ( - SettingListResponseZonesIPGeolocationIDIPGeolocation SettingListResponseZonesIPGeolocationID = "ip_geolocation" -) - -// Current value of the zone setting. -type SettingListResponseZonesIPGeolocationValue string - -const ( - SettingListResponseZonesIPGeolocationValueOn SettingListResponseZonesIPGeolocationValue = "on" - SettingListResponseZonesIPGeolocationValueOff SettingListResponseZonesIPGeolocationValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesIPGeolocationEditable bool - -const ( - SettingListResponseZonesIPGeolocationEditableTrue SettingListResponseZonesIPGeolocationEditable = true - SettingListResponseZonesIPGeolocationEditableFalse SettingListResponseZonesIPGeolocationEditable = false -) - -// Enable IPv6 on all subdomains that are Cloudflare enabled. -// (https://support.cloudflare.com/hc/en-us/articles/200168586). -type SettingListResponseZonesIPV6 struct { - // ID of the zone setting. - ID SettingListResponseZonesIPV6ID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesIPV6Value `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesIPV6Editable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesIPV6JSON `json:"-"` -} - -// settingListResponseZonesIPV6JSON contains the JSON metadata for the struct -// [SettingListResponseZonesIPV6] -type settingListResponseZonesIPV6JSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesIPV6) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesIPV6) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesIPV6ID string - -const ( - SettingListResponseZonesIPV6IDIPV6 SettingListResponseZonesIPV6ID = "ipv6" -) - -// Current value of the zone setting. -type SettingListResponseZonesIPV6Value string - -const ( - SettingListResponseZonesIPV6ValueOff SettingListResponseZonesIPV6Value = "off" - SettingListResponseZonesIPV6ValueOn SettingListResponseZonesIPV6Value = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesIPV6Editable bool - -const ( - SettingListResponseZonesIPV6EditableTrue SettingListResponseZonesIPV6Editable = true - SettingListResponseZonesIPV6EditableFalse SettingListResponseZonesIPV6Editable = false -) - -// Maximum size of an allowable upload. -type SettingListResponseZonesMaxUpload struct { - // identifier of the zone setting. - ID SettingListResponseZonesMaxUploadID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesMaxUploadValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesMaxUploadEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesMaxUploadJSON `json:"-"` -} - -// settingListResponseZonesMaxUploadJSON contains the JSON metadata for the struct -// [SettingListResponseZonesMaxUpload] -type settingListResponseZonesMaxUploadJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesMaxUpload) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesMaxUpload) implementsSettingListResponse() {} - -// identifier of the zone setting. -type SettingListResponseZonesMaxUploadID string - -const ( - SettingListResponseZonesMaxUploadIDMaxUpload SettingListResponseZonesMaxUploadID = "max_upload" -) - -// Current value of the zone setting. -type SettingListResponseZonesMaxUploadValue float64 - -const ( - SettingListResponseZonesMaxUploadValue100 SettingListResponseZonesMaxUploadValue = 100 - SettingListResponseZonesMaxUploadValue200 SettingListResponseZonesMaxUploadValue = 200 - SettingListResponseZonesMaxUploadValue500 SettingListResponseZonesMaxUploadValue = 500 -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesMaxUploadEditable bool - -const ( - SettingListResponseZonesMaxUploadEditableTrue SettingListResponseZonesMaxUploadEditable = true - SettingListResponseZonesMaxUploadEditableFalse SettingListResponseZonesMaxUploadEditable = false -) - -// Only accepts HTTPS requests that use at least the TLS protocol version -// specified. For example, if TLS 1.1 is selected, TLS 1.0 connections will be -// rejected, while 1.1, 1.2, and 1.3 (if enabled) will be permitted. -type SettingListResponseZonesMinTLSVersion struct { - // ID of the zone setting. - ID SettingListResponseZonesMinTLSVersionID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesMinTLSVersionValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesMinTLSVersionEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesMinTLSVersionJSON `json:"-"` -} - -// settingListResponseZonesMinTLSVersionJSON contains the JSON metadata for the -// struct [SettingListResponseZonesMinTLSVersion] -type settingListResponseZonesMinTLSVersionJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesMinTLSVersion) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesMinTLSVersion) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesMinTLSVersionID string - -const ( - SettingListResponseZonesMinTLSVersionIDMinTLSVersion SettingListResponseZonesMinTLSVersionID = "min_tls_version" -) - -// Current value of the zone setting. -type SettingListResponseZonesMinTLSVersionValue string - -const ( - SettingListResponseZonesMinTLSVersionValue1_0 SettingListResponseZonesMinTLSVersionValue = "1.0" - SettingListResponseZonesMinTLSVersionValue1_1 SettingListResponseZonesMinTLSVersionValue = "1.1" - SettingListResponseZonesMinTLSVersionValue1_2 SettingListResponseZonesMinTLSVersionValue = "1.2" - SettingListResponseZonesMinTLSVersionValue1_3 SettingListResponseZonesMinTLSVersionValue = "1.3" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesMinTLSVersionEditable bool - -const ( - SettingListResponseZonesMinTLSVersionEditableTrue SettingListResponseZonesMinTLSVersionEditable = true - SettingListResponseZonesMinTLSVersionEditableFalse SettingListResponseZonesMinTLSVersionEditable = false -) - -// Automatically minify certain assets for your website. Refer to -// [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) -// for more information. -type SettingListResponseZonesMinify struct { - // Zone setting identifier. - ID SettingListResponseZonesMinifyID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesMinifyValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesMinifyEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesMinifyJSON `json:"-"` -} - -// settingListResponseZonesMinifyJSON contains the JSON metadata for the struct -// [SettingListResponseZonesMinify] -type settingListResponseZonesMinifyJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesMinify) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesMinify) implementsSettingListResponse() {} - -// Zone setting identifier. -type SettingListResponseZonesMinifyID string - -const ( - SettingListResponseZonesMinifyIDMinify SettingListResponseZonesMinifyID = "minify" -) - -// Current value of the zone setting. -type SettingListResponseZonesMinifyValue struct { - // Automatically minify all CSS files for your website. - Css SettingListResponseZonesMinifyValueCss `json:"css"` - // Automatically minify all HTML files for your website. - HTML SettingListResponseZonesMinifyValueHTML `json:"html"` - // Automatically minify all JavaScript files for your website. - Js SettingListResponseZonesMinifyValueJs `json:"js"` - JSON settingListResponseZonesMinifyValueJSON `json:"-"` -} - -// settingListResponseZonesMinifyValueJSON contains the JSON metadata for the -// struct [SettingListResponseZonesMinifyValue] -type settingListResponseZonesMinifyValueJSON struct { - Css apijson.Field - HTML apijson.Field - Js apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesMinifyValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Automatically minify all CSS files for your website. -type SettingListResponseZonesMinifyValueCss string - -const ( - SettingListResponseZonesMinifyValueCssOn SettingListResponseZonesMinifyValueCss = "on" - SettingListResponseZonesMinifyValueCssOff SettingListResponseZonesMinifyValueCss = "off" -) - -// Automatically minify all HTML files for your website. -type SettingListResponseZonesMinifyValueHTML string - -const ( - SettingListResponseZonesMinifyValueHTMLOn SettingListResponseZonesMinifyValueHTML = "on" - SettingListResponseZonesMinifyValueHTMLOff SettingListResponseZonesMinifyValueHTML = "off" -) - -// Automatically minify all JavaScript files for your website. -type SettingListResponseZonesMinifyValueJs string - -const ( - SettingListResponseZonesMinifyValueJsOn SettingListResponseZonesMinifyValueJs = "on" - SettingListResponseZonesMinifyValueJsOff SettingListResponseZonesMinifyValueJs = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesMinifyEditable bool - -const ( - SettingListResponseZonesMinifyEditableTrue SettingListResponseZonesMinifyEditable = true - SettingListResponseZonesMinifyEditableFalse SettingListResponseZonesMinifyEditable = false -) - -// Automatically optimize image loading for website visitors on mobile devices. -// Refer to -// [our blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for -// more information. -type SettingListResponseZonesMirage struct { - // ID of the zone setting. - ID SettingListResponseZonesMirageID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesMirageValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesMirageEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesMirageJSON `json:"-"` -} - -// settingListResponseZonesMirageJSON contains the JSON metadata for the struct -// [SettingListResponseZonesMirage] -type settingListResponseZonesMirageJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesMirage) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesMirage) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesMirageID string - -const ( - SettingListResponseZonesMirageIDMirage SettingListResponseZonesMirageID = "mirage" -) - -// Current value of the zone setting. -type SettingListResponseZonesMirageValue string - -const ( - SettingListResponseZonesMirageValueOn SettingListResponseZonesMirageValue = "on" - SettingListResponseZonesMirageValueOff SettingListResponseZonesMirageValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesMirageEditable bool - -const ( - SettingListResponseZonesMirageEditableTrue SettingListResponseZonesMirageEditable = true - SettingListResponseZonesMirageEditableFalse SettingListResponseZonesMirageEditable = false -) - -// Automatically redirect visitors on mobile devices to a mobile-optimized -// subdomain. Refer to -// [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) -// for more information. -type SettingListResponseZonesMobileRedirect struct { - // Identifier of the zone setting. - ID SettingListResponseZonesMobileRedirectID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesMobileRedirectValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesMobileRedirectEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesMobileRedirectJSON `json:"-"` -} - -// settingListResponseZonesMobileRedirectJSON contains the JSON metadata for the -// struct [SettingListResponseZonesMobileRedirect] -type settingListResponseZonesMobileRedirectJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesMobileRedirect) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesMobileRedirect) implementsSettingListResponse() {} - -// Identifier of the zone setting. -type SettingListResponseZonesMobileRedirectID string - -const ( - SettingListResponseZonesMobileRedirectIDMobileRedirect SettingListResponseZonesMobileRedirectID = "mobile_redirect" -) - -// Current value of the zone setting. -type SettingListResponseZonesMobileRedirectValue struct { - // Which subdomain prefix you wish to redirect visitors on mobile devices to - // (subdomain must already exist). - MobileSubdomain string `json:"mobile_subdomain,nullable"` - // Whether or not mobile redirect is enabled. - Status SettingListResponseZonesMobileRedirectValueStatus `json:"status"` - // Whether to drop the current page path and redirect to the mobile subdomain URL - // root, or keep the path and redirect to the same page on the mobile subdomain. - StripUri bool `json:"strip_uri"` - JSON settingListResponseZonesMobileRedirectValueJSON `json:"-"` -} - -// settingListResponseZonesMobileRedirectValueJSON contains the JSON metadata for -// the struct [SettingListResponseZonesMobileRedirectValue] -type settingListResponseZonesMobileRedirectValueJSON struct { - MobileSubdomain apijson.Field - Status apijson.Field - StripUri apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesMobileRedirectValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether or not mobile redirect is enabled. -type SettingListResponseZonesMobileRedirectValueStatus string - -const ( - SettingListResponseZonesMobileRedirectValueStatusOn SettingListResponseZonesMobileRedirectValueStatus = "on" - SettingListResponseZonesMobileRedirectValueStatusOff SettingListResponseZonesMobileRedirectValueStatus = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesMobileRedirectEditable bool - -const ( - SettingListResponseZonesMobileRedirectEditableTrue SettingListResponseZonesMobileRedirectEditable = true - SettingListResponseZonesMobileRedirectEditableFalse SettingListResponseZonesMobileRedirectEditable = false -) - -// Enable Network Error Logging reporting on your zone. (Beta) -type SettingListResponseZonesNEL struct { - // Zone setting identifier. - ID SettingListResponseZonesNELID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesNELValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesNELEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesNELJSON `json:"-"` -} - -// settingListResponseZonesNELJSON contains the JSON metadata for the struct -// [SettingListResponseZonesNEL] -type settingListResponseZonesNELJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesNEL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesNEL) implementsSettingListResponse() {} - -// Zone setting identifier. -type SettingListResponseZonesNELID string - -const ( - SettingListResponseZonesNELIDNEL SettingListResponseZonesNELID = "nel" -) - -// Current value of the zone setting. -type SettingListResponseZonesNELValue struct { - Enabled bool `json:"enabled"` - JSON settingListResponseZonesNELValueJSON `json:"-"` -} - -// settingListResponseZonesNELValueJSON contains the JSON metadata for the struct -// [SettingListResponseZonesNELValue] -type settingListResponseZonesNELValueJSON struct { - Enabled apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesNELValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesNELEditable bool - -const ( - SettingListResponseZonesNELEditableTrue SettingListResponseZonesNELEditable = true - SettingListResponseZonesNELEditableFalse SettingListResponseZonesNELEditable = false -) - -// Enables the Opportunistic Encryption feature for a zone. -type SettingListResponseZonesOpportunisticEncryption struct { - // ID of the zone setting. - ID SettingListResponseZonesOpportunisticEncryptionID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesOpportunisticEncryptionValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesOpportunisticEncryptionEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesOpportunisticEncryptionJSON `json:"-"` -} - -// settingListResponseZonesOpportunisticEncryptionJSON contains the JSON metadata -// for the struct [SettingListResponseZonesOpportunisticEncryption] -type settingListResponseZonesOpportunisticEncryptionJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesOpportunisticEncryption) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesOpportunisticEncryption) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesOpportunisticEncryptionID string - -const ( - SettingListResponseZonesOpportunisticEncryptionIDOpportunisticEncryption SettingListResponseZonesOpportunisticEncryptionID = "opportunistic_encryption" -) - -// Current value of the zone setting. -type SettingListResponseZonesOpportunisticEncryptionValue string - -const ( - SettingListResponseZonesOpportunisticEncryptionValueOn SettingListResponseZonesOpportunisticEncryptionValue = "on" - SettingListResponseZonesOpportunisticEncryptionValueOff SettingListResponseZonesOpportunisticEncryptionValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesOpportunisticEncryptionEditable bool - -const ( - SettingListResponseZonesOpportunisticEncryptionEditableTrue SettingListResponseZonesOpportunisticEncryptionEditable = true - SettingListResponseZonesOpportunisticEncryptionEditableFalse SettingListResponseZonesOpportunisticEncryptionEditable = false -) - -// Add an Alt-Svc header to all legitimate requests from Tor, allowing the -// connection to use our onion services instead of exit nodes. -type SettingListResponseZonesOpportunisticOnion struct { - // ID of the zone setting. - ID SettingListResponseZonesOpportunisticOnionID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesOpportunisticOnionValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesOpportunisticOnionEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesOpportunisticOnionJSON `json:"-"` -} - -// settingListResponseZonesOpportunisticOnionJSON contains the JSON metadata for -// the struct [SettingListResponseZonesOpportunisticOnion] -type settingListResponseZonesOpportunisticOnionJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesOpportunisticOnion) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesOpportunisticOnion) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesOpportunisticOnionID string - -const ( - SettingListResponseZonesOpportunisticOnionIDOpportunisticOnion SettingListResponseZonesOpportunisticOnionID = "opportunistic_onion" -) - -// Current value of the zone setting. -type SettingListResponseZonesOpportunisticOnionValue string - -const ( - SettingListResponseZonesOpportunisticOnionValueOn SettingListResponseZonesOpportunisticOnionValue = "on" - SettingListResponseZonesOpportunisticOnionValueOff SettingListResponseZonesOpportunisticOnionValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesOpportunisticOnionEditable bool - -const ( - SettingListResponseZonesOpportunisticOnionEditableTrue SettingListResponseZonesOpportunisticOnionEditable = true - SettingListResponseZonesOpportunisticOnionEditableFalse SettingListResponseZonesOpportunisticOnionEditable = false -) - -// Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also -// on Cloudflare. -type SettingListResponseZonesOrangeToOrange struct { - // ID of the zone setting. - ID SettingListResponseZonesOrangeToOrangeID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesOrangeToOrangeValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesOrangeToOrangeEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesOrangeToOrangeJSON `json:"-"` -} - -// settingListResponseZonesOrangeToOrangeJSON contains the JSON metadata for the -// struct [SettingListResponseZonesOrangeToOrange] -type settingListResponseZonesOrangeToOrangeJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesOrangeToOrange) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesOrangeToOrange) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesOrangeToOrangeID string - -const ( - SettingListResponseZonesOrangeToOrangeIDOrangeToOrange SettingListResponseZonesOrangeToOrangeID = "orange_to_orange" -) - -// Current value of the zone setting. -type SettingListResponseZonesOrangeToOrangeValue string - -const ( - SettingListResponseZonesOrangeToOrangeValueOn SettingListResponseZonesOrangeToOrangeValue = "on" - SettingListResponseZonesOrangeToOrangeValueOff SettingListResponseZonesOrangeToOrangeValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesOrangeToOrangeEditable bool - -const ( - SettingListResponseZonesOrangeToOrangeEditableTrue SettingListResponseZonesOrangeToOrangeEditable = true - SettingListResponseZonesOrangeToOrangeEditableFalse SettingListResponseZonesOrangeToOrangeEditable = false -) - -// Cloudflare will proxy customer error pages on any 502,504 errors on origin -// server instead of showing a default Cloudflare error page. This does not apply -// to 522 errors and is limited to Enterprise Zones. -type SettingListResponseZonesOriginErrorPagePassThru struct { - // ID of the zone setting. - ID SettingListResponseZonesOriginErrorPagePassThruID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesOriginErrorPagePassThruValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesOriginErrorPagePassThruEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesOriginErrorPagePassThruJSON `json:"-"` -} - -// settingListResponseZonesOriginErrorPagePassThruJSON contains the JSON metadata -// for the struct [SettingListResponseZonesOriginErrorPagePassThru] -type settingListResponseZonesOriginErrorPagePassThruJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesOriginErrorPagePassThru) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesOriginErrorPagePassThru) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesOriginErrorPagePassThruID string - -const ( - SettingListResponseZonesOriginErrorPagePassThruIDOriginErrorPagePassThru SettingListResponseZonesOriginErrorPagePassThruID = "origin_error_page_pass_thru" -) - -// Current value of the zone setting. -type SettingListResponseZonesOriginErrorPagePassThruValue string - -const ( - SettingListResponseZonesOriginErrorPagePassThruValueOn SettingListResponseZonesOriginErrorPagePassThruValue = "on" - SettingListResponseZonesOriginErrorPagePassThruValueOff SettingListResponseZonesOriginErrorPagePassThruValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesOriginErrorPagePassThruEditable bool - -const ( - SettingListResponseZonesOriginErrorPagePassThruEditableTrue SettingListResponseZonesOriginErrorPagePassThruEditable = true - SettingListResponseZonesOriginErrorPagePassThruEditableFalse SettingListResponseZonesOriginErrorPagePassThruEditable = false -) - -// Removes metadata and compresses your images for faster page load times. Basic -// (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual -// quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster -// image loading. Larger JPEGs are converted to progressive images, loading a -// lower-resolution image first and ending in a higher-resolution version. Not -// recommended for hi-res photography sites. -type SettingListResponseZonesPolish struct { - // ID of the zone setting. - ID SettingListResponseZonesPolishID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesPolishValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesPolishEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesPolishJSON `json:"-"` -} - -// settingListResponseZonesPolishJSON contains the JSON metadata for the struct -// [SettingListResponseZonesPolish] -type settingListResponseZonesPolishJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesPolish) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesPolish) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesPolishID string - -const ( - SettingListResponseZonesPolishIDPolish SettingListResponseZonesPolishID = "polish" -) - -// Current value of the zone setting. -type SettingListResponseZonesPolishValue string - -const ( - SettingListResponseZonesPolishValueOff SettingListResponseZonesPolishValue = "off" - SettingListResponseZonesPolishValueLossless SettingListResponseZonesPolishValue = "lossless" - SettingListResponseZonesPolishValueLossy SettingListResponseZonesPolishValue = "lossy" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesPolishEditable bool - -const ( - SettingListResponseZonesPolishEditableTrue SettingListResponseZonesPolishEditable = true - SettingListResponseZonesPolishEditableFalse SettingListResponseZonesPolishEditable = false -) - -// Cloudflare will prefetch any URLs that are included in the response headers. -// This is limited to Enterprise Zones. -type SettingListResponseZonesPrefetchPreload struct { - // ID of the zone setting. - ID SettingListResponseZonesPrefetchPreloadID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesPrefetchPreloadValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesPrefetchPreloadEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesPrefetchPreloadJSON `json:"-"` -} - -// settingListResponseZonesPrefetchPreloadJSON contains the JSON metadata for the -// struct [SettingListResponseZonesPrefetchPreload] -type settingListResponseZonesPrefetchPreloadJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesPrefetchPreload) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesPrefetchPreload) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesPrefetchPreloadID string - -const ( - SettingListResponseZonesPrefetchPreloadIDPrefetchPreload SettingListResponseZonesPrefetchPreloadID = "prefetch_preload" -) - -// Current value of the zone setting. -type SettingListResponseZonesPrefetchPreloadValue string - -const ( - SettingListResponseZonesPrefetchPreloadValueOn SettingListResponseZonesPrefetchPreloadValue = "on" - SettingListResponseZonesPrefetchPreloadValueOff SettingListResponseZonesPrefetchPreloadValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesPrefetchPreloadEditable bool - -const ( - SettingListResponseZonesPrefetchPreloadEditableTrue SettingListResponseZonesPrefetchPreloadEditable = true - SettingListResponseZonesPrefetchPreloadEditableFalse SettingListResponseZonesPrefetchPreloadEditable = false -) - -// Maximum time between two read operations from origin. -type SettingListResponseZonesProxyReadTimeout struct { - // ID of the zone setting. - ID SettingListResponseZonesProxyReadTimeoutID `json:"id,required"` - // Current value of the zone setting. - Value float64 `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesProxyReadTimeoutEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesProxyReadTimeoutJSON `json:"-"` -} - -// settingListResponseZonesProxyReadTimeoutJSON contains the JSON metadata for the -// struct [SettingListResponseZonesProxyReadTimeout] -type settingListResponseZonesProxyReadTimeoutJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesProxyReadTimeout) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesProxyReadTimeout) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesProxyReadTimeoutID string - -const ( - SettingListResponseZonesProxyReadTimeoutIDProxyReadTimeout SettingListResponseZonesProxyReadTimeoutID = "proxy_read_timeout" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesProxyReadTimeoutEditable bool - -const ( - SettingListResponseZonesProxyReadTimeoutEditableTrue SettingListResponseZonesProxyReadTimeoutEditable = true - SettingListResponseZonesProxyReadTimeoutEditableFalse SettingListResponseZonesProxyReadTimeoutEditable = false -) - -// The value set for the Pseudo IPv4 setting. -type SettingListResponseZonesPseudoIPV4 struct { - // Value of the Pseudo IPv4 setting. - ID SettingListResponseZonesPseudoIPV4ID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesPseudoIPV4Value `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesPseudoIPV4Editable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesPseudoIPV4JSON `json:"-"` -} - -// settingListResponseZonesPseudoIPV4JSON contains the JSON metadata for the struct -// [SettingListResponseZonesPseudoIPV4] -type settingListResponseZonesPseudoIPV4JSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesPseudoIPV4) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesPseudoIPV4) implementsSettingListResponse() {} - -// Value of the Pseudo IPv4 setting. -type SettingListResponseZonesPseudoIPV4ID string - -const ( - SettingListResponseZonesPseudoIPV4IDPseudoIPV4 SettingListResponseZonesPseudoIPV4ID = "pseudo_ipv4" -) - -// Current value of the zone setting. -type SettingListResponseZonesPseudoIPV4Value string - -const ( - SettingListResponseZonesPseudoIPV4ValueOff SettingListResponseZonesPseudoIPV4Value = "off" - SettingListResponseZonesPseudoIPV4ValueAddHeader SettingListResponseZonesPseudoIPV4Value = "add_header" - SettingListResponseZonesPseudoIPV4ValueOverwriteHeader SettingListResponseZonesPseudoIPV4Value = "overwrite_header" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesPseudoIPV4Editable bool - -const ( - SettingListResponseZonesPseudoIPV4EditableTrue SettingListResponseZonesPseudoIPV4Editable = true - SettingListResponseZonesPseudoIPV4EditableFalse SettingListResponseZonesPseudoIPV4Editable = false -) - -// Enables or disables buffering of responses from the proxied server. Cloudflare -// may buffer the whole payload to deliver it at once to the client versus allowing -// it to be delivered in chunks. By default, the proxied server streams directly -// and is not buffered by Cloudflare. This is limited to Enterprise Zones. -type SettingListResponseZonesResponseBuffering struct { - // ID of the zone setting. - ID SettingListResponseZonesResponseBufferingID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesResponseBufferingValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesResponseBufferingEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesResponseBufferingJSON `json:"-"` -} - -// settingListResponseZonesResponseBufferingJSON contains the JSON metadata for the -// struct [SettingListResponseZonesResponseBuffering] -type settingListResponseZonesResponseBufferingJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesResponseBuffering) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesResponseBuffering) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesResponseBufferingID string - -const ( - SettingListResponseZonesResponseBufferingIDResponseBuffering SettingListResponseZonesResponseBufferingID = "response_buffering" -) - -// Current value of the zone setting. -type SettingListResponseZonesResponseBufferingValue string - -const ( - SettingListResponseZonesResponseBufferingValueOn SettingListResponseZonesResponseBufferingValue = "on" - SettingListResponseZonesResponseBufferingValueOff SettingListResponseZonesResponseBufferingValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesResponseBufferingEditable bool - -const ( - SettingListResponseZonesResponseBufferingEditableTrue SettingListResponseZonesResponseBufferingEditable = true - SettingListResponseZonesResponseBufferingEditableFalse SettingListResponseZonesResponseBufferingEditable = false -) - -// Rocket Loader is a general-purpose asynchronous JavaScript optimisation that -// prioritises rendering your content while loading your site's Javascript -// asynchronously. Turning on Rocket Loader will immediately improve a web page's -// rendering time sometimes measured as Time to First Paint (TTFP), and also the -// `window.onload` time (assuming there is JavaScript on the page). This can have a -// positive impact on your Google search ranking. When turned on, Rocket Loader -// will automatically defer the loading of all Javascript referenced in your HTML, -// with no configuration required. Refer to -// [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) -// for more information. -type SettingListResponseZonesRocketLoader struct { - // ID of the zone setting. - ID SettingListResponseZonesRocketLoaderID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesRocketLoaderValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesRocketLoaderEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesRocketLoaderJSON `json:"-"` -} - -// settingListResponseZonesRocketLoaderJSON contains the JSON metadata for the -// struct [SettingListResponseZonesRocketLoader] -type settingListResponseZonesRocketLoaderJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesRocketLoader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesRocketLoader) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesRocketLoaderID string - -const ( - SettingListResponseZonesRocketLoaderIDRocketLoader SettingListResponseZonesRocketLoaderID = "rocket_loader" -) - -// Current value of the zone setting. -type SettingListResponseZonesRocketLoaderValue string - -const ( - SettingListResponseZonesRocketLoaderValueOn SettingListResponseZonesRocketLoaderValue = "on" - SettingListResponseZonesRocketLoaderValueOff SettingListResponseZonesRocketLoaderValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesRocketLoaderEditable bool - -const ( - SettingListResponseZonesRocketLoaderEditableTrue SettingListResponseZonesRocketLoaderEditable = true - SettingListResponseZonesRocketLoaderEditableFalse SettingListResponseZonesRocketLoaderEditable = false -) - -// [Automatic Platform Optimization for WordPress](https://developers.cloudflare.com/automatic-platform-optimization/) -// serves your WordPress site from Cloudflare's edge network and caches third-party -// fonts. -type SettingListResponseZonesSchemasAutomaticPlatformOptimization struct { - // ID of the zone setting. - ID SettingListResponseZonesSchemasAutomaticPlatformOptimizationID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesSchemasAutomaticPlatformOptimizationValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesSchemasAutomaticPlatformOptimizationEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesSchemasAutomaticPlatformOptimizationJSON `json:"-"` -} - -// settingListResponseZonesSchemasAutomaticPlatformOptimizationJSON contains the -// JSON metadata for the struct -// [SettingListResponseZonesSchemasAutomaticPlatformOptimization] -type settingListResponseZonesSchemasAutomaticPlatformOptimizationJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesSchemasAutomaticPlatformOptimization) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesSchemasAutomaticPlatformOptimization) implementsSettingListResponse() { -} - -// ID of the zone setting. -type SettingListResponseZonesSchemasAutomaticPlatformOptimizationID string - -const ( - SettingListResponseZonesSchemasAutomaticPlatformOptimizationIDAutomaticPlatformOptimization SettingListResponseZonesSchemasAutomaticPlatformOptimizationID = "automatic_platform_optimization" -) - -// Current value of the zone setting. -type SettingListResponseZonesSchemasAutomaticPlatformOptimizationValue struct { - // Indicates whether or not - // [cache by device type](https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/) - // is enabled. - CacheByDeviceType bool `json:"cache_by_device_type,required"` - // Indicates whether or not Cloudflare proxy is enabled. - Cf bool `json:"cf,required"` - // Indicates whether or not Automatic Platform Optimization is enabled. - Enabled bool `json:"enabled,required"` - // An array of hostnames where Automatic Platform Optimization for WordPress is - // activated. - Hostnames []string `json:"hostnames,required" format:"hostname"` - // Indicates whether or not site is powered by WordPress. - Wordpress bool `json:"wordpress,required"` - // Indicates whether or not - // [Cloudflare for WordPress plugin](https://wordpress.org/plugins/cloudflare/) is - // installed. - WpPlugin bool `json:"wp_plugin,required"` - JSON settingListResponseZonesSchemasAutomaticPlatformOptimizationValueJSON `json:"-"` -} - -// settingListResponseZonesSchemasAutomaticPlatformOptimizationValueJSON contains -// the JSON metadata for the struct -// [SettingListResponseZonesSchemasAutomaticPlatformOptimizationValue] -type settingListResponseZonesSchemasAutomaticPlatformOptimizationValueJSON struct { - CacheByDeviceType apijson.Field - Cf apijson.Field - Enabled apijson.Field - Hostnames apijson.Field - Wordpress apijson.Field - WpPlugin apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesSchemasAutomaticPlatformOptimizationValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesSchemasAutomaticPlatformOptimizationEditable bool - -const ( - SettingListResponseZonesSchemasAutomaticPlatformOptimizationEditableTrue SettingListResponseZonesSchemasAutomaticPlatformOptimizationEditable = true - SettingListResponseZonesSchemasAutomaticPlatformOptimizationEditableFalse SettingListResponseZonesSchemasAutomaticPlatformOptimizationEditable = false -) - -// Cloudflare security header for a zone. -type SettingListResponseZonesSecurityHeader struct { - // ID of the zone's security header. - ID SettingListResponseZonesSecurityHeaderID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesSecurityHeaderValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesSecurityHeaderEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesSecurityHeaderJSON `json:"-"` -} - -// settingListResponseZonesSecurityHeaderJSON contains the JSON metadata for the -// struct [SettingListResponseZonesSecurityHeader] -type settingListResponseZonesSecurityHeaderJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesSecurityHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesSecurityHeader) implementsSettingListResponse() {} - -// ID of the zone's security header. -type SettingListResponseZonesSecurityHeaderID string - -const ( - SettingListResponseZonesSecurityHeaderIDSecurityHeader SettingListResponseZonesSecurityHeaderID = "security_header" -) - -// Current value of the zone setting. -type SettingListResponseZonesSecurityHeaderValue struct { - // Strict Transport Security. - StrictTransportSecurity SettingListResponseZonesSecurityHeaderValueStrictTransportSecurity `json:"strict_transport_security"` - JSON settingListResponseZonesSecurityHeaderValueJSON `json:"-"` -} - -// settingListResponseZonesSecurityHeaderValueJSON contains the JSON metadata for -// the struct [SettingListResponseZonesSecurityHeaderValue] -type settingListResponseZonesSecurityHeaderValueJSON struct { - StrictTransportSecurity apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesSecurityHeaderValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Strict Transport Security. -type SettingListResponseZonesSecurityHeaderValueStrictTransportSecurity struct { - // Whether or not strict transport security is enabled. - Enabled bool `json:"enabled"` - // Include all subdomains for strict transport security. - IncludeSubdomains bool `json:"include_subdomains"` - // Max age in seconds of the strict transport security. - MaxAge float64 `json:"max_age"` - // Whether or not to include 'X-Content-Type-Options: nosniff' header. - Nosniff bool `json:"nosniff"` - JSON settingListResponseZonesSecurityHeaderValueStrictTransportSecurityJSON `json:"-"` -} - -// settingListResponseZonesSecurityHeaderValueStrictTransportSecurityJSON contains -// the JSON metadata for the struct -// [SettingListResponseZonesSecurityHeaderValueStrictTransportSecurity] -type settingListResponseZonesSecurityHeaderValueStrictTransportSecurityJSON struct { - Enabled apijson.Field - IncludeSubdomains apijson.Field - MaxAge apijson.Field - Nosniff apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesSecurityHeaderValueStrictTransportSecurity) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesSecurityHeaderEditable bool - -const ( - SettingListResponseZonesSecurityHeaderEditableTrue SettingListResponseZonesSecurityHeaderEditable = true - SettingListResponseZonesSecurityHeaderEditableFalse SettingListResponseZonesSecurityHeaderEditable = false -) - -// Choose the appropriate security profile for your website, which will -// automatically adjust each of the security settings. If you choose to customize -// an individual security setting, the profile will become Custom. -// (https://support.cloudflare.com/hc/en-us/articles/200170056). -type SettingListResponseZonesSecurityLevel struct { - // ID of the zone setting. - ID SettingListResponseZonesSecurityLevelID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesSecurityLevelValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesSecurityLevelEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesSecurityLevelJSON `json:"-"` -} - -// settingListResponseZonesSecurityLevelJSON contains the JSON metadata for the -// struct [SettingListResponseZonesSecurityLevel] -type settingListResponseZonesSecurityLevelJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesSecurityLevel) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesSecurityLevel) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesSecurityLevelID string - -const ( - SettingListResponseZonesSecurityLevelIDSecurityLevel SettingListResponseZonesSecurityLevelID = "security_level" -) - -// Current value of the zone setting. -type SettingListResponseZonesSecurityLevelValue string - -const ( - SettingListResponseZonesSecurityLevelValueOff SettingListResponseZonesSecurityLevelValue = "off" - SettingListResponseZonesSecurityLevelValueEssentiallyOff SettingListResponseZonesSecurityLevelValue = "essentially_off" - SettingListResponseZonesSecurityLevelValueLow SettingListResponseZonesSecurityLevelValue = "low" - SettingListResponseZonesSecurityLevelValueMedium SettingListResponseZonesSecurityLevelValue = "medium" - SettingListResponseZonesSecurityLevelValueHigh SettingListResponseZonesSecurityLevelValue = "high" - SettingListResponseZonesSecurityLevelValueUnderAttack SettingListResponseZonesSecurityLevelValue = "under_attack" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesSecurityLevelEditable bool - -const ( - SettingListResponseZonesSecurityLevelEditableTrue SettingListResponseZonesSecurityLevelEditable = true - SettingListResponseZonesSecurityLevelEditableFalse SettingListResponseZonesSecurityLevelEditable = false -) - -// If there is sensitive content on your website that you want visible to real -// visitors, but that you want to hide from suspicious visitors, all you have to do -// is wrap the content with Cloudflare SSE tags. Wrap any content that you want to -// be excluded from suspicious visitors in the following SSE tags: -// . For example: Bad visitors won't see my phone -// number, 555-555-5555 . Note: SSE only will work with HTML. If you -// have HTML minification enabled, you won't see the SSE tags in your HTML source -// when it's served through Cloudflare. SSE will still function in this case, as -// Cloudflare's HTML minification and SSE functionality occur on-the-fly as the -// resource moves through our network to the visitor's computer. -// (https://support.cloudflare.com/hc/en-us/articles/200170036). -type SettingListResponseZonesServerSideExclude struct { - // ID of the zone setting. - ID SettingListResponseZonesServerSideExcludeID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesServerSideExcludeValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesServerSideExcludeEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesServerSideExcludeJSON `json:"-"` -} - -// settingListResponseZonesServerSideExcludeJSON contains the JSON metadata for the -// struct [SettingListResponseZonesServerSideExclude] -type settingListResponseZonesServerSideExcludeJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesServerSideExclude) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesServerSideExclude) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesServerSideExcludeID string - -const ( - SettingListResponseZonesServerSideExcludeIDServerSideExclude SettingListResponseZonesServerSideExcludeID = "server_side_exclude" -) - -// Current value of the zone setting. -type SettingListResponseZonesServerSideExcludeValue string - -const ( - SettingListResponseZonesServerSideExcludeValueOn SettingListResponseZonesServerSideExcludeValue = "on" - SettingListResponseZonesServerSideExcludeValueOff SettingListResponseZonesServerSideExcludeValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesServerSideExcludeEditable bool - -const ( - SettingListResponseZonesServerSideExcludeEditableTrue SettingListResponseZonesServerSideExcludeEditable = true - SettingListResponseZonesServerSideExcludeEditableFalse SettingListResponseZonesServerSideExcludeEditable = false -) - -// Allow SHA1 support. -type SettingListResponseZonesSha1Support struct { - // Zone setting identifier. - ID SettingListResponseZonesSha1SupportID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesSha1SupportValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesSha1SupportEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesSha1SupportJSON `json:"-"` -} - -// settingListResponseZonesSha1SupportJSON contains the JSON metadata for the -// struct [SettingListResponseZonesSha1Support] -type settingListResponseZonesSha1SupportJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesSha1Support) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesSha1Support) implementsSettingListResponse() {} - -// Zone setting identifier. -type SettingListResponseZonesSha1SupportID string - -const ( - SettingListResponseZonesSha1SupportIDSha1Support SettingListResponseZonesSha1SupportID = "sha1_support" -) - -// Current value of the zone setting. -type SettingListResponseZonesSha1SupportValue string - -const ( - SettingListResponseZonesSha1SupportValueOff SettingListResponseZonesSha1SupportValue = "off" - SettingListResponseZonesSha1SupportValueOn SettingListResponseZonesSha1SupportValue = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesSha1SupportEditable bool - -const ( - SettingListResponseZonesSha1SupportEditableTrue SettingListResponseZonesSha1SupportEditable = true - SettingListResponseZonesSha1SupportEditableFalse SettingListResponseZonesSha1SupportEditable = false -) - -// Cloudflare will treat files with the same query strings as the same file in -// cache, regardless of the order of the query strings. This is limited to -// Enterprise Zones. -type SettingListResponseZonesSortQueryStringForCache struct { - // ID of the zone setting. - ID SettingListResponseZonesSortQueryStringForCacheID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesSortQueryStringForCacheValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesSortQueryStringForCacheEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesSortQueryStringForCacheJSON `json:"-"` -} - -// settingListResponseZonesSortQueryStringForCacheJSON contains the JSON metadata -// for the struct [SettingListResponseZonesSortQueryStringForCache] -type settingListResponseZonesSortQueryStringForCacheJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesSortQueryStringForCache) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesSortQueryStringForCache) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesSortQueryStringForCacheID string - -const ( - SettingListResponseZonesSortQueryStringForCacheIDSortQueryStringForCache SettingListResponseZonesSortQueryStringForCacheID = "sort_query_string_for_cache" -) - -// Current value of the zone setting. -type SettingListResponseZonesSortQueryStringForCacheValue string - -const ( - SettingListResponseZonesSortQueryStringForCacheValueOn SettingListResponseZonesSortQueryStringForCacheValue = "on" - SettingListResponseZonesSortQueryStringForCacheValueOff SettingListResponseZonesSortQueryStringForCacheValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesSortQueryStringForCacheEditable bool - -const ( - SettingListResponseZonesSortQueryStringForCacheEditableTrue SettingListResponseZonesSortQueryStringForCacheEditable = true - SettingListResponseZonesSortQueryStringForCacheEditableFalse SettingListResponseZonesSortQueryStringForCacheEditable = false -) - -// SSL encrypts your visitor's connection and safeguards credit card numbers and -// other personal data to and from your website. SSL can take up to 5 minutes to -// fully activate. Requires Cloudflare active on your root domain or www domain. -// Off: no SSL between the visitor and Cloudflare, and no SSL between Cloudflare -// and your web server (all HTTP traffic). Flexible: SSL between the visitor and -// Cloudflare -- visitor sees HTTPS on your site, but no SSL between Cloudflare and -// your web server. You don't need to have an SSL cert on your web server, but your -// vistors will still see the site as being HTTPS enabled. Full: SSL between the -// visitor and Cloudflare -- visitor sees HTTPS on your site, and SSL between -// Cloudflare and your web server. You'll need to have your own SSL cert or -// self-signed cert at the very least. Full (Strict): SSL between the visitor and -// Cloudflare -- visitor sees HTTPS on your site, and SSL between Cloudflare and -// your web server. You'll need to have a valid SSL certificate installed on your -// web server. This certificate must be signed by a certificate authority, have an -// expiration date in the future, and respond for the request domain name -// (hostname). (https://support.cloudflare.com/hc/en-us/articles/200170416). -type SettingListResponseZonesSSL struct { - // ID of the zone setting. - ID SettingListResponseZonesSSLID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesSSLValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesSSLEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesSSLJSON `json:"-"` -} - -// settingListResponseZonesSSLJSON contains the JSON metadata for the struct -// [SettingListResponseZonesSSL] -type settingListResponseZonesSSLJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesSSL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesSSL) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesSSLID string - -const ( - SettingListResponseZonesSSLIDSSL SettingListResponseZonesSSLID = "ssl" -) - -// Current value of the zone setting. -type SettingListResponseZonesSSLValue string - -const ( - SettingListResponseZonesSSLValueOff SettingListResponseZonesSSLValue = "off" - SettingListResponseZonesSSLValueFlexible SettingListResponseZonesSSLValue = "flexible" - SettingListResponseZonesSSLValueFull SettingListResponseZonesSSLValue = "full" - SettingListResponseZonesSSLValueStrict SettingListResponseZonesSSLValue = "strict" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesSSLEditable bool - -const ( - SettingListResponseZonesSSLEditableTrue SettingListResponseZonesSSLEditable = true - SettingListResponseZonesSSLEditableFalse SettingListResponseZonesSSLEditable = false -) - -// Enrollment in the SSL/TLS Recommender service which tries to detect and -// recommend (by sending periodic emails) the most secure SSL/TLS setting your -// origin servers support. -type SettingListResponseZonesSSLRecommender struct { - // Enrollment value for SSL/TLS Recommender. - ID SettingListResponseZonesSSLRecommenderID `json:"id"` - // ssl-recommender enrollment setting. - Enabled bool `json:"enabled"` - JSON settingListResponseZonesSSLRecommenderJSON `json:"-"` -} - -// settingListResponseZonesSSLRecommenderJSON contains the JSON metadata for the -// struct [SettingListResponseZonesSSLRecommender] -type settingListResponseZonesSSLRecommenderJSON struct { - ID apijson.Field - Enabled apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesSSLRecommender) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesSSLRecommender) implementsSettingListResponse() {} - -// Enrollment value for SSL/TLS Recommender. -type SettingListResponseZonesSSLRecommenderID string - -const ( - SettingListResponseZonesSSLRecommenderIDSSLRecommender SettingListResponseZonesSSLRecommenderID = "ssl_recommender" -) - -// Only allows TLS1.2. -type SettingListResponseZonesTLS1_2Only struct { - // Zone setting identifier. - ID SettingListResponseZonesTLS1_2OnlyID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesTLS1_2OnlyValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesTLS1_2OnlyEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesTls1_2OnlyJSON `json:"-"` -} - -// settingListResponseZonesTls1_2OnlyJSON contains the JSON metadata for the struct -// [SettingListResponseZonesTLS1_2Only] -type settingListResponseZonesTls1_2OnlyJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesTLS1_2Only) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesTLS1_2Only) implementsSettingListResponse() {} - -// Zone setting identifier. -type SettingListResponseZonesTLS1_2OnlyID string - -const ( - SettingListResponseZonesTLS1_2OnlyIDTLS1_2Only SettingListResponseZonesTLS1_2OnlyID = "tls_1_2_only" -) - -// Current value of the zone setting. -type SettingListResponseZonesTLS1_2OnlyValue string - -const ( - SettingListResponseZonesTLS1_2OnlyValueOff SettingListResponseZonesTLS1_2OnlyValue = "off" - SettingListResponseZonesTLS1_2OnlyValueOn SettingListResponseZonesTLS1_2OnlyValue = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesTLS1_2OnlyEditable bool - -const ( - SettingListResponseZonesTLS1_2OnlyEditableTrue SettingListResponseZonesTLS1_2OnlyEditable = true - SettingListResponseZonesTLS1_2OnlyEditableFalse SettingListResponseZonesTLS1_2OnlyEditable = false -) - -// Enables Crypto TLS 1.3 feature for a zone. -type SettingListResponseZonesTLS1_3 struct { - // ID of the zone setting. - ID SettingListResponseZonesTLS1_3ID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesTLS1_3Value `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesTLS1_3Editable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesTls1_3JSON `json:"-"` -} - -// settingListResponseZonesTls1_3JSON contains the JSON metadata for the struct -// [SettingListResponseZonesTLS1_3] -type settingListResponseZonesTls1_3JSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesTLS1_3) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesTLS1_3) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesTLS1_3ID string - -const ( - SettingListResponseZonesTLS1_3IDTLS1_3 SettingListResponseZonesTLS1_3ID = "tls_1_3" -) - -// Current value of the zone setting. -type SettingListResponseZonesTLS1_3Value string - -const ( - SettingListResponseZonesTLS1_3ValueOn SettingListResponseZonesTLS1_3Value = "on" - SettingListResponseZonesTLS1_3ValueOff SettingListResponseZonesTLS1_3Value = "off" - SettingListResponseZonesTLS1_3ValueZrt SettingListResponseZonesTLS1_3Value = "zrt" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesTLS1_3Editable bool - -const ( - SettingListResponseZonesTLS1_3EditableTrue SettingListResponseZonesTLS1_3Editable = true - SettingListResponseZonesTLS1_3EditableFalse SettingListResponseZonesTLS1_3Editable = false -) - -// TLS Client Auth requires Cloudflare to connect to your origin server using a -// client certificate (Enterprise Only). -type SettingListResponseZonesTLSClientAuth struct { - // ID of the zone setting. - ID SettingListResponseZonesTLSClientAuthID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesTLSClientAuthValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesTLSClientAuthEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesTLSClientAuthJSON `json:"-"` -} - -// settingListResponseZonesTLSClientAuthJSON contains the JSON metadata for the -// struct [SettingListResponseZonesTLSClientAuth] -type settingListResponseZonesTLSClientAuthJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesTLSClientAuth) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesTLSClientAuth) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesTLSClientAuthID string - -const ( - SettingListResponseZonesTLSClientAuthIDTLSClientAuth SettingListResponseZonesTLSClientAuthID = "tls_client_auth" -) - -// Current value of the zone setting. -type SettingListResponseZonesTLSClientAuthValue string - -const ( - SettingListResponseZonesTLSClientAuthValueOn SettingListResponseZonesTLSClientAuthValue = "on" - SettingListResponseZonesTLSClientAuthValueOff SettingListResponseZonesTLSClientAuthValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesTLSClientAuthEditable bool - -const ( - SettingListResponseZonesTLSClientAuthEditableTrue SettingListResponseZonesTLSClientAuthEditable = true - SettingListResponseZonesTLSClientAuthEditableFalse SettingListResponseZonesTLSClientAuthEditable = false -) - -// Allows customer to continue to use True Client IP (Akamai feature) in the -// headers we send to the origin. This is limited to Enterprise Zones. -type SettingListResponseZonesTrueClientIPHeader struct { - // ID of the zone setting. - ID SettingListResponseZonesTrueClientIPHeaderID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesTrueClientIPHeaderValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesTrueClientIPHeaderEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesTrueClientIPHeaderJSON `json:"-"` -} - -// settingListResponseZonesTrueClientIPHeaderJSON contains the JSON metadata for -// the struct [SettingListResponseZonesTrueClientIPHeader] -type settingListResponseZonesTrueClientIPHeaderJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesTrueClientIPHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesTrueClientIPHeader) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesTrueClientIPHeaderID string - -const ( - SettingListResponseZonesTrueClientIPHeaderIDTrueClientIPHeader SettingListResponseZonesTrueClientIPHeaderID = "true_client_ip_header" -) - -// Current value of the zone setting. -type SettingListResponseZonesTrueClientIPHeaderValue string - -const ( - SettingListResponseZonesTrueClientIPHeaderValueOn SettingListResponseZonesTrueClientIPHeaderValue = "on" - SettingListResponseZonesTrueClientIPHeaderValueOff SettingListResponseZonesTrueClientIPHeaderValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesTrueClientIPHeaderEditable bool - -const ( - SettingListResponseZonesTrueClientIPHeaderEditableTrue SettingListResponseZonesTrueClientIPHeaderEditable = true - SettingListResponseZonesTrueClientIPHeaderEditableFalse SettingListResponseZonesTrueClientIPHeaderEditable = false -) - -// The WAF examines HTTP requests to your website. It inspects both GET and POST -// requests and applies rules to help filter out illegitimate traffic from -// legitimate website visitors. The Cloudflare WAF inspects website addresses or -// URLs to detect anything out of the ordinary. If the Cloudflare WAF determines -// suspicious user behavior, then the WAF will 'challenge' the web visitor with a -// page that asks them to submit a CAPTCHA successfully to continue their action. -// If the challenge is failed, the action will be stopped. What this means is that -// Cloudflare's WAF will block any traffic identified as illegitimate before it -// reaches your origin web server. -// (https://support.cloudflare.com/hc/en-us/articles/200172016). -type SettingListResponseZonesWAF struct { - // ID of the zone setting. - ID SettingListResponseZonesWAFID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesWAFValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesWAFEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesWAFJSON `json:"-"` -} - -// settingListResponseZonesWAFJSON contains the JSON metadata for the struct -// [SettingListResponseZonesWAF] -type settingListResponseZonesWAFJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesWAF) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesWAF) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesWAFID string - -const ( - SettingListResponseZonesWAFIDWAF SettingListResponseZonesWAFID = "waf" -) - -// Current value of the zone setting. -type SettingListResponseZonesWAFValue string - -const ( - SettingListResponseZonesWAFValueOn SettingListResponseZonesWAFValue = "on" - SettingListResponseZonesWAFValueOff SettingListResponseZonesWAFValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesWAFEditable bool - -const ( - SettingListResponseZonesWAFEditableTrue SettingListResponseZonesWAFEditable = true - SettingListResponseZonesWAFEditableFalse SettingListResponseZonesWAFEditable = false -) - -// When the client requesting the image supports the WebP image codec, and WebP -// offers a performance advantage over the original image format, Cloudflare will -// serve a WebP version of the original image. -type SettingListResponseZonesWebp struct { - // ID of the zone setting. - ID SettingListResponseZonesWebpID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesWebpValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesWebpEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesWebpJSON `json:"-"` -} - -// settingListResponseZonesWebpJSON contains the JSON metadata for the struct -// [SettingListResponseZonesWebp] -type settingListResponseZonesWebpJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesWebp) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesWebp) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesWebpID string - -const ( - SettingListResponseZonesWebpIDWebp SettingListResponseZonesWebpID = "webp" -) - -// Current value of the zone setting. -type SettingListResponseZonesWebpValue string - -const ( - SettingListResponseZonesWebpValueOff SettingListResponseZonesWebpValue = "off" - SettingListResponseZonesWebpValueOn SettingListResponseZonesWebpValue = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesWebpEditable bool - -const ( - SettingListResponseZonesWebpEditableTrue SettingListResponseZonesWebpEditable = true - SettingListResponseZonesWebpEditableFalse SettingListResponseZonesWebpEditable = false -) - -// WebSockets are open connections sustained between the client and the origin -// server. Inside a WebSockets connection, the client and the origin can pass data -// back and forth without having to reestablish sessions. This makes exchanging -// data within a WebSockets connection fast. WebSockets are often used for -// real-time applications such as live chat and gaming. For more information refer -// to -// [Can I use Cloudflare with Websockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Can-I-use-Cloudflare-with-WebSockets-). -type SettingListResponseZonesWebsockets struct { - // ID of the zone setting. - ID SettingListResponseZonesWebsocketsID `json:"id,required"` - // Current value of the zone setting. - Value SettingListResponseZonesWebsocketsValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingListResponseZonesWebsocketsEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingListResponseZonesWebsocketsJSON `json:"-"` -} - -// settingListResponseZonesWebsocketsJSON contains the JSON metadata for the struct -// [SettingListResponseZonesWebsockets] -type settingListResponseZonesWebsocketsJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseZonesWebsockets) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingListResponseZonesWebsockets) implementsSettingListResponse() {} - -// ID of the zone setting. -type SettingListResponseZonesWebsocketsID string - -const ( - SettingListResponseZonesWebsocketsIDWebsockets SettingListResponseZonesWebsocketsID = "websockets" -) - -// Current value of the zone setting. -type SettingListResponseZonesWebsocketsValue string - -const ( - SettingListResponseZonesWebsocketsValueOff SettingListResponseZonesWebsocketsValue = "off" - SettingListResponseZonesWebsocketsValueOn SettingListResponseZonesWebsocketsValue = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingListResponseZonesWebsocketsEditable bool - -const ( - SettingListResponseZonesWebsocketsEditableTrue SettingListResponseZonesWebsocketsEditable = true - SettingListResponseZonesWebsocketsEditableFalse SettingListResponseZonesWebsocketsEditable = false -) - -// 0-RTT session resumption enabled for this zone. -// -// Union satisfied by [SettingEditResponseZones0rtt], -// [SettingEditResponseZonesAdvancedDDOS], [SettingEditResponseZonesAlwaysOnline], -// [SettingEditResponseZonesAlwaysUseHTTPS], -// [SettingEditResponseZonesAutomaticHTTPSRewrites], -// [SettingEditResponseZonesBrotli], [SettingEditResponseZonesBrowserCacheTTL], -// [SettingEditResponseZonesBrowserCheck], [SettingEditResponseZonesCacheLevel], -// [SettingEditResponseZonesChallengeTTL], [SettingEditResponseZonesCiphers], -// [SettingEditResponseZonesCnameFlattening], -// [SettingEditResponseZonesDevelopmentMode], [SettingEditResponseZonesEarlyHints], -// [SettingEditResponseZonesEdgeCacheTTL], -// [SettingEditResponseZonesEmailObfuscation], -// [SettingEditResponseZonesH2Prioritization], -// [SettingEditResponseZonesHotlinkProtection], [SettingEditResponseZonesHTTP2], -// [SettingEditResponseZonesHTTP3], [SettingEditResponseZonesImageResizing], -// [SettingEditResponseZonesIPGeolocation], [SettingEditResponseZonesIPV6], -// [SettingEditResponseZonesMaxUpload], [SettingEditResponseZonesMinTLSVersion], -// [SettingEditResponseZonesMinify], [SettingEditResponseZonesMirage], -// [SettingEditResponseZonesMobileRedirect], [SettingEditResponseZonesNEL], -// [SettingEditResponseZonesOpportunisticEncryption], -// [SettingEditResponseZonesOpportunisticOnion], -// [SettingEditResponseZonesOrangeToOrange], -// [SettingEditResponseZonesOriginErrorPagePassThru], -// [SettingEditResponseZonesPolish], [SettingEditResponseZonesPrefetchPreload], -// [SettingEditResponseZonesProxyReadTimeout], -// [SettingEditResponseZonesPseudoIPV4], -// [SettingEditResponseZonesResponseBuffering], -// [SettingEditResponseZonesRocketLoader], -// [SettingEditResponseZonesSchemasAutomaticPlatformOptimization], -// [SettingEditResponseZonesSecurityHeader], -// [SettingEditResponseZonesSecurityLevel], -// [SettingEditResponseZonesServerSideExclude], -// [SettingEditResponseZonesSha1Support], -// [SettingEditResponseZonesSortQueryStringForCache], -// [SettingEditResponseZonesSSL], [SettingEditResponseZonesSSLRecommender], -// [SettingEditResponseZonesTLS1_2Only], [SettingEditResponseZonesTLS1_3], -// [SettingEditResponseZonesTLSClientAuth], -// [SettingEditResponseZonesTrueClientIPHeader], [SettingEditResponseZonesWAF], -// [SettingEditResponseZonesWebp] or [SettingEditResponseZonesWebsockets]. -type SettingEditResponse interface { - implementsSettingEditResponse() -} - -func init() { - apijson.RegisterUnion(reflect.TypeOf((*SettingEditResponse)(nil)).Elem(), "") -} - -// 0-RTT session resumption enabled for this zone. -type SettingEditResponseZones0rtt struct { - // ID of the zone setting. - ID SettingEditResponseZones0rttID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZones0rttValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZones0rttEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZones0rttJSON `json:"-"` -} - -// settingEditResponseZones0rttJSON contains the JSON metadata for the struct -// [SettingEditResponseZones0rtt] -type settingEditResponseZones0rttJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZones0rtt) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZones0rtt) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZones0rttID string - -const ( - SettingEditResponseZones0rttID0rtt SettingEditResponseZones0rttID = "0rtt" -) - -// Current value of the zone setting. -type SettingEditResponseZones0rttValue string - -const ( - SettingEditResponseZones0rttValueOn SettingEditResponseZones0rttValue = "on" - SettingEditResponseZones0rttValueOff SettingEditResponseZones0rttValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZones0rttEditable bool - -const ( - SettingEditResponseZones0rttEditableTrue SettingEditResponseZones0rttEditable = true - SettingEditResponseZones0rttEditableFalse SettingEditResponseZones0rttEditable = false -) - -// Advanced protection from Distributed Denial of Service (DDoS) attacks on your -// website. This is an uneditable value that is 'on' in the case of Business and -// Enterprise zones. -type SettingEditResponseZonesAdvancedDDOS struct { - // ID of the zone setting. - ID SettingEditResponseZonesAdvancedDDOSID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesAdvancedDDOSValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesAdvancedDDOSEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesAdvancedDDOSJSON `json:"-"` -} - -// settingEditResponseZonesAdvancedDDOSJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesAdvancedDDOS] -type settingEditResponseZonesAdvancedDDOSJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesAdvancedDDOS) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesAdvancedDDOS) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesAdvancedDDOSID string - -const ( - SettingEditResponseZonesAdvancedDDOSIDAdvancedDDOS SettingEditResponseZonesAdvancedDDOSID = "advanced_ddos" -) - -// Current value of the zone setting. -type SettingEditResponseZonesAdvancedDDOSValue string - -const ( - SettingEditResponseZonesAdvancedDDOSValueOn SettingEditResponseZonesAdvancedDDOSValue = "on" - SettingEditResponseZonesAdvancedDDOSValueOff SettingEditResponseZonesAdvancedDDOSValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesAdvancedDDOSEditable bool - -const ( - SettingEditResponseZonesAdvancedDDOSEditableTrue SettingEditResponseZonesAdvancedDDOSEditable = true - SettingEditResponseZonesAdvancedDDOSEditableFalse SettingEditResponseZonesAdvancedDDOSEditable = false -) - -// When enabled, Cloudflare serves limited copies of web pages available from the -// [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is -// offline. Refer to -// [Always Online](https://developers.cloudflare.com/cache/about/always-online) for -// more information. -type SettingEditResponseZonesAlwaysOnline struct { - // ID of the zone setting. - ID SettingEditResponseZonesAlwaysOnlineID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesAlwaysOnlineValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesAlwaysOnlineEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesAlwaysOnlineJSON `json:"-"` -} - -// settingEditResponseZonesAlwaysOnlineJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesAlwaysOnline] -type settingEditResponseZonesAlwaysOnlineJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesAlwaysOnline) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesAlwaysOnline) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesAlwaysOnlineID string - -const ( - SettingEditResponseZonesAlwaysOnlineIDAlwaysOnline SettingEditResponseZonesAlwaysOnlineID = "always_online" -) - -// Current value of the zone setting. -type SettingEditResponseZonesAlwaysOnlineValue string - -const ( - SettingEditResponseZonesAlwaysOnlineValueOn SettingEditResponseZonesAlwaysOnlineValue = "on" - SettingEditResponseZonesAlwaysOnlineValueOff SettingEditResponseZonesAlwaysOnlineValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesAlwaysOnlineEditable bool - -const ( - SettingEditResponseZonesAlwaysOnlineEditableTrue SettingEditResponseZonesAlwaysOnlineEditable = true - SettingEditResponseZonesAlwaysOnlineEditableFalse SettingEditResponseZonesAlwaysOnlineEditable = false -) - -// Reply to all requests for URLs that use "http" with a 301 redirect to the -// equivalent "https" URL. If you only want to redirect for a subset of requests, -// consider creating an "Always use HTTPS" page rule. -type SettingEditResponseZonesAlwaysUseHTTPS struct { - // ID of the zone setting. - ID SettingEditResponseZonesAlwaysUseHTTPSID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesAlwaysUseHTTPSValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesAlwaysUseHTTPSEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesAlwaysUseHTTPSJSON `json:"-"` -} - -// settingEditResponseZonesAlwaysUseHTTPSJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesAlwaysUseHTTPS] -type settingEditResponseZonesAlwaysUseHTTPSJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesAlwaysUseHTTPS) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesAlwaysUseHTTPS) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesAlwaysUseHTTPSID string - -const ( - SettingEditResponseZonesAlwaysUseHTTPSIDAlwaysUseHTTPS SettingEditResponseZonesAlwaysUseHTTPSID = "always_use_https" -) - -// Current value of the zone setting. -type SettingEditResponseZonesAlwaysUseHTTPSValue string - -const ( - SettingEditResponseZonesAlwaysUseHTTPSValueOn SettingEditResponseZonesAlwaysUseHTTPSValue = "on" - SettingEditResponseZonesAlwaysUseHTTPSValueOff SettingEditResponseZonesAlwaysUseHTTPSValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesAlwaysUseHTTPSEditable bool - -const ( - SettingEditResponseZonesAlwaysUseHTTPSEditableTrue SettingEditResponseZonesAlwaysUseHTTPSEditable = true - SettingEditResponseZonesAlwaysUseHTTPSEditableFalse SettingEditResponseZonesAlwaysUseHTTPSEditable = false -) - -// Enable the Automatic HTTPS Rewrites feature for this zone. -type SettingEditResponseZonesAutomaticHTTPSRewrites struct { - // ID of the zone setting. - ID SettingEditResponseZonesAutomaticHTTPSRewritesID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesAutomaticHTTPSRewritesValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesAutomaticHTTPSRewritesEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesAutomaticHTTPSRewritesJSON `json:"-"` -} - -// settingEditResponseZonesAutomaticHTTPSRewritesJSON contains the JSON metadata -// for the struct [SettingEditResponseZonesAutomaticHTTPSRewrites] -type settingEditResponseZonesAutomaticHTTPSRewritesJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesAutomaticHTTPSRewrites) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesAutomaticHTTPSRewrites) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesAutomaticHTTPSRewritesID string - -const ( - SettingEditResponseZonesAutomaticHTTPSRewritesIDAutomaticHTTPSRewrites SettingEditResponseZonesAutomaticHTTPSRewritesID = "automatic_https_rewrites" -) - -// Current value of the zone setting. -type SettingEditResponseZonesAutomaticHTTPSRewritesValue string - -const ( - SettingEditResponseZonesAutomaticHTTPSRewritesValueOn SettingEditResponseZonesAutomaticHTTPSRewritesValue = "on" - SettingEditResponseZonesAutomaticHTTPSRewritesValueOff SettingEditResponseZonesAutomaticHTTPSRewritesValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesAutomaticHTTPSRewritesEditable bool - -const ( - SettingEditResponseZonesAutomaticHTTPSRewritesEditableTrue SettingEditResponseZonesAutomaticHTTPSRewritesEditable = true - SettingEditResponseZonesAutomaticHTTPSRewritesEditableFalse SettingEditResponseZonesAutomaticHTTPSRewritesEditable = false -) - -// When the client requesting an asset supports the Brotli compression algorithm, -// Cloudflare will serve a Brotli compressed version of the asset. -type SettingEditResponseZonesBrotli struct { - // ID of the zone setting. - ID SettingEditResponseZonesBrotliID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesBrotliValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesBrotliEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesBrotliJSON `json:"-"` -} - -// settingEditResponseZonesBrotliJSON contains the JSON metadata for the struct -// [SettingEditResponseZonesBrotli] -type settingEditResponseZonesBrotliJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesBrotli) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesBrotli) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesBrotliID string - -const ( - SettingEditResponseZonesBrotliIDBrotli SettingEditResponseZonesBrotliID = "brotli" -) - -// Current value of the zone setting. -type SettingEditResponseZonesBrotliValue string - -const ( - SettingEditResponseZonesBrotliValueOff SettingEditResponseZonesBrotliValue = "off" - SettingEditResponseZonesBrotliValueOn SettingEditResponseZonesBrotliValue = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesBrotliEditable bool - -const ( - SettingEditResponseZonesBrotliEditableTrue SettingEditResponseZonesBrotliEditable = true - SettingEditResponseZonesBrotliEditableFalse SettingEditResponseZonesBrotliEditable = false -) - -// Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources -// will remain on your visitors' computers. Cloudflare will honor any larger times -// specified by your server. -// (https://support.cloudflare.com/hc/en-us/articles/200168276). -type SettingEditResponseZonesBrowserCacheTTL struct { - // ID of the zone setting. - ID SettingEditResponseZonesBrowserCacheTTLID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesBrowserCacheTTLValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesBrowserCacheTTLEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesBrowserCacheTTLJSON `json:"-"` -} - -// settingEditResponseZonesBrowserCacheTTLJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesBrowserCacheTTL] -type settingEditResponseZonesBrowserCacheTTLJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesBrowserCacheTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesBrowserCacheTTL) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesBrowserCacheTTLID string - -const ( - SettingEditResponseZonesBrowserCacheTTLIDBrowserCacheTTL SettingEditResponseZonesBrowserCacheTTLID = "browser_cache_ttl" -) - -// Current value of the zone setting. -type SettingEditResponseZonesBrowserCacheTTLValue float64 - -const ( - SettingEditResponseZonesBrowserCacheTTLValue0 SettingEditResponseZonesBrowserCacheTTLValue = 0 - SettingEditResponseZonesBrowserCacheTTLValue30 SettingEditResponseZonesBrowserCacheTTLValue = 30 - SettingEditResponseZonesBrowserCacheTTLValue60 SettingEditResponseZonesBrowserCacheTTLValue = 60 - SettingEditResponseZonesBrowserCacheTTLValue120 SettingEditResponseZonesBrowserCacheTTLValue = 120 - SettingEditResponseZonesBrowserCacheTTLValue300 SettingEditResponseZonesBrowserCacheTTLValue = 300 - SettingEditResponseZonesBrowserCacheTTLValue1200 SettingEditResponseZonesBrowserCacheTTLValue = 1200 - SettingEditResponseZonesBrowserCacheTTLValue1800 SettingEditResponseZonesBrowserCacheTTLValue = 1800 - SettingEditResponseZonesBrowserCacheTTLValue3600 SettingEditResponseZonesBrowserCacheTTLValue = 3600 - SettingEditResponseZonesBrowserCacheTTLValue7200 SettingEditResponseZonesBrowserCacheTTLValue = 7200 - SettingEditResponseZonesBrowserCacheTTLValue10800 SettingEditResponseZonesBrowserCacheTTLValue = 10800 - SettingEditResponseZonesBrowserCacheTTLValue14400 SettingEditResponseZonesBrowserCacheTTLValue = 14400 - SettingEditResponseZonesBrowserCacheTTLValue18000 SettingEditResponseZonesBrowserCacheTTLValue = 18000 - SettingEditResponseZonesBrowserCacheTTLValue28800 SettingEditResponseZonesBrowserCacheTTLValue = 28800 - SettingEditResponseZonesBrowserCacheTTLValue43200 SettingEditResponseZonesBrowserCacheTTLValue = 43200 - SettingEditResponseZonesBrowserCacheTTLValue57600 SettingEditResponseZonesBrowserCacheTTLValue = 57600 - SettingEditResponseZonesBrowserCacheTTLValue72000 SettingEditResponseZonesBrowserCacheTTLValue = 72000 - SettingEditResponseZonesBrowserCacheTTLValue86400 SettingEditResponseZonesBrowserCacheTTLValue = 86400 - SettingEditResponseZonesBrowserCacheTTLValue172800 SettingEditResponseZonesBrowserCacheTTLValue = 172800 - SettingEditResponseZonesBrowserCacheTTLValue259200 SettingEditResponseZonesBrowserCacheTTLValue = 259200 - SettingEditResponseZonesBrowserCacheTTLValue345600 SettingEditResponseZonesBrowserCacheTTLValue = 345600 - SettingEditResponseZonesBrowserCacheTTLValue432000 SettingEditResponseZonesBrowserCacheTTLValue = 432000 - SettingEditResponseZonesBrowserCacheTTLValue691200 SettingEditResponseZonesBrowserCacheTTLValue = 691200 - SettingEditResponseZonesBrowserCacheTTLValue1382400 SettingEditResponseZonesBrowserCacheTTLValue = 1382400 - SettingEditResponseZonesBrowserCacheTTLValue2073600 SettingEditResponseZonesBrowserCacheTTLValue = 2073600 - SettingEditResponseZonesBrowserCacheTTLValue2678400 SettingEditResponseZonesBrowserCacheTTLValue = 2678400 - SettingEditResponseZonesBrowserCacheTTLValue5356800 SettingEditResponseZonesBrowserCacheTTLValue = 5356800 - SettingEditResponseZonesBrowserCacheTTLValue16070400 SettingEditResponseZonesBrowserCacheTTLValue = 16070400 - SettingEditResponseZonesBrowserCacheTTLValue31536000 SettingEditResponseZonesBrowserCacheTTLValue = 31536000 -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesBrowserCacheTTLEditable bool - -const ( - SettingEditResponseZonesBrowserCacheTTLEditableTrue SettingEditResponseZonesBrowserCacheTTLEditable = true - SettingEditResponseZonesBrowserCacheTTLEditableFalse SettingEditResponseZonesBrowserCacheTTLEditable = false -) - -// Browser Integrity Check is similar to Bad Behavior and looks for common HTTP -// headers abused most commonly by spammers and denies access to your page. It will -// also challenge visitors that do not have a user agent or a non standard user -// agent (also commonly used by abuse bots, crawlers or visitors). -// (https://support.cloudflare.com/hc/en-us/articles/200170086). -type SettingEditResponseZonesBrowserCheck struct { - // ID of the zone setting. - ID SettingEditResponseZonesBrowserCheckID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesBrowserCheckValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesBrowserCheckEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesBrowserCheckJSON `json:"-"` -} - -// settingEditResponseZonesBrowserCheckJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesBrowserCheck] -type settingEditResponseZonesBrowserCheckJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesBrowserCheck) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesBrowserCheck) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesBrowserCheckID string - -const ( - SettingEditResponseZonesBrowserCheckIDBrowserCheck SettingEditResponseZonesBrowserCheckID = "browser_check" -) - -// Current value of the zone setting. -type SettingEditResponseZonesBrowserCheckValue string - -const ( - SettingEditResponseZonesBrowserCheckValueOn SettingEditResponseZonesBrowserCheckValue = "on" - SettingEditResponseZonesBrowserCheckValueOff SettingEditResponseZonesBrowserCheckValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesBrowserCheckEditable bool - -const ( - SettingEditResponseZonesBrowserCheckEditableTrue SettingEditResponseZonesBrowserCheckEditable = true - SettingEditResponseZonesBrowserCheckEditableFalse SettingEditResponseZonesBrowserCheckEditable = false -) - -// Cache Level functions based off the setting level. The basic setting will cache -// most static resources (i.e., css, images, and JavaScript). The simplified -// setting will ignore the query string when delivering a cached resource. The -// aggressive setting will cache all static resources, including ones with a query -// string. (https://support.cloudflare.com/hc/en-us/articles/200168256). -type SettingEditResponseZonesCacheLevel struct { - // ID of the zone setting. - ID SettingEditResponseZonesCacheLevelID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesCacheLevelValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesCacheLevelEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesCacheLevelJSON `json:"-"` -} - -// settingEditResponseZonesCacheLevelJSON contains the JSON metadata for the struct -// [SettingEditResponseZonesCacheLevel] -type settingEditResponseZonesCacheLevelJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesCacheLevel) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesCacheLevel) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesCacheLevelID string - -const ( - SettingEditResponseZonesCacheLevelIDCacheLevel SettingEditResponseZonesCacheLevelID = "cache_level" -) - -// Current value of the zone setting. -type SettingEditResponseZonesCacheLevelValue string - -const ( - SettingEditResponseZonesCacheLevelValueAggressive SettingEditResponseZonesCacheLevelValue = "aggressive" - SettingEditResponseZonesCacheLevelValueBasic SettingEditResponseZonesCacheLevelValue = "basic" - SettingEditResponseZonesCacheLevelValueSimplified SettingEditResponseZonesCacheLevelValue = "simplified" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesCacheLevelEditable bool - -const ( - SettingEditResponseZonesCacheLevelEditableTrue SettingEditResponseZonesCacheLevelEditable = true - SettingEditResponseZonesCacheLevelEditableFalse SettingEditResponseZonesCacheLevelEditable = false -) - -// Specify how long a visitor is allowed access to your site after successfully -// completing a challenge (such as a CAPTCHA). After the TTL has expired the -// visitor will have to complete a new challenge. We recommend a 15 - 45 minute -// setting and will attempt to honor any setting above 45 minutes. -// (https://support.cloudflare.com/hc/en-us/articles/200170136). -type SettingEditResponseZonesChallengeTTL struct { - // ID of the zone setting. - ID SettingEditResponseZonesChallengeTTLID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesChallengeTTLValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesChallengeTTLEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesChallengeTTLJSON `json:"-"` -} - -// settingEditResponseZonesChallengeTTLJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesChallengeTTL] -type settingEditResponseZonesChallengeTTLJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesChallengeTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesChallengeTTL) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesChallengeTTLID string - -const ( - SettingEditResponseZonesChallengeTTLIDChallengeTTL SettingEditResponseZonesChallengeTTLID = "challenge_ttl" -) - -// Current value of the zone setting. -type SettingEditResponseZonesChallengeTTLValue float64 - -const ( - SettingEditResponseZonesChallengeTTLValue300 SettingEditResponseZonesChallengeTTLValue = 300 - SettingEditResponseZonesChallengeTTLValue900 SettingEditResponseZonesChallengeTTLValue = 900 - SettingEditResponseZonesChallengeTTLValue1800 SettingEditResponseZonesChallengeTTLValue = 1800 - SettingEditResponseZonesChallengeTTLValue2700 SettingEditResponseZonesChallengeTTLValue = 2700 - SettingEditResponseZonesChallengeTTLValue3600 SettingEditResponseZonesChallengeTTLValue = 3600 - SettingEditResponseZonesChallengeTTLValue7200 SettingEditResponseZonesChallengeTTLValue = 7200 - SettingEditResponseZonesChallengeTTLValue10800 SettingEditResponseZonesChallengeTTLValue = 10800 - SettingEditResponseZonesChallengeTTLValue14400 SettingEditResponseZonesChallengeTTLValue = 14400 - SettingEditResponseZonesChallengeTTLValue28800 SettingEditResponseZonesChallengeTTLValue = 28800 - SettingEditResponseZonesChallengeTTLValue57600 SettingEditResponseZonesChallengeTTLValue = 57600 - SettingEditResponseZonesChallengeTTLValue86400 SettingEditResponseZonesChallengeTTLValue = 86400 - SettingEditResponseZonesChallengeTTLValue604800 SettingEditResponseZonesChallengeTTLValue = 604800 - SettingEditResponseZonesChallengeTTLValue2592000 SettingEditResponseZonesChallengeTTLValue = 2592000 - SettingEditResponseZonesChallengeTTLValue31536000 SettingEditResponseZonesChallengeTTLValue = 31536000 -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesChallengeTTLEditable bool - -const ( - SettingEditResponseZonesChallengeTTLEditableTrue SettingEditResponseZonesChallengeTTLEditable = true - SettingEditResponseZonesChallengeTTLEditableFalse SettingEditResponseZonesChallengeTTLEditable = false -) - -// An allowlist of ciphers for TLS termination. These ciphers must be in the -// BoringSSL format. -type SettingEditResponseZonesCiphers struct { - // ID of the zone setting. - ID SettingEditResponseZonesCiphersID `json:"id,required"` - // Current value of the zone setting. - Value []string `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesCiphersEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesCiphersJSON `json:"-"` -} - -// settingEditResponseZonesCiphersJSON contains the JSON metadata for the struct -// [SettingEditResponseZonesCiphers] -type settingEditResponseZonesCiphersJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesCiphers) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesCiphers) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesCiphersID string - -const ( - SettingEditResponseZonesCiphersIDCiphers SettingEditResponseZonesCiphersID = "ciphers" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesCiphersEditable bool - -const ( - SettingEditResponseZonesCiphersEditableTrue SettingEditResponseZonesCiphersEditable = true - SettingEditResponseZonesCiphersEditableFalse SettingEditResponseZonesCiphersEditable = false -) - -// Whether or not cname flattening is on. -type SettingEditResponseZonesCnameFlattening struct { - // How to flatten the cname destination. - ID SettingEditResponseZonesCnameFlatteningID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesCnameFlatteningValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesCnameFlatteningEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesCnameFlatteningJSON `json:"-"` -} - -// settingEditResponseZonesCnameFlatteningJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesCnameFlattening] -type settingEditResponseZonesCnameFlatteningJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesCnameFlattening) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesCnameFlattening) implementsSettingEditResponse() {} - -// How to flatten the cname destination. -type SettingEditResponseZonesCnameFlatteningID string - -const ( - SettingEditResponseZonesCnameFlatteningIDCnameFlattening SettingEditResponseZonesCnameFlatteningID = "cname_flattening" -) - -// Current value of the zone setting. -type SettingEditResponseZonesCnameFlatteningValue string - -const ( - SettingEditResponseZonesCnameFlatteningValueFlattenAtRoot SettingEditResponseZonesCnameFlatteningValue = "flatten_at_root" - SettingEditResponseZonesCnameFlatteningValueFlattenAll SettingEditResponseZonesCnameFlatteningValue = "flatten_all" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesCnameFlatteningEditable bool - -const ( - SettingEditResponseZonesCnameFlatteningEditableTrue SettingEditResponseZonesCnameFlatteningEditable = true - SettingEditResponseZonesCnameFlatteningEditableFalse SettingEditResponseZonesCnameFlatteningEditable = false -) - -// Development Mode temporarily allows you to enter development mode for your -// websites if you need to make changes to your site. This will bypass Cloudflare's -// accelerated cache and slow down your site, but is useful if you are making -// changes to cacheable content (like images, css, or JavaScript) and would like to -// see those changes right away. Once entered, development mode will last for 3 -// hours and then automatically toggle off. -type SettingEditResponseZonesDevelopmentMode struct { - // ID of the zone setting. - ID SettingEditResponseZonesDevelopmentModeID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesDevelopmentModeValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesDevelopmentModeEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - // Value of the zone setting. Notes: The interval (in seconds) from when - // development mode expires (positive integer) or last expired (negative integer) - // for the domain. If development mode has never been enabled, this value is false. - TimeRemaining float64 `json:"time_remaining"` - JSON settingEditResponseZonesDevelopmentModeJSON `json:"-"` -} - -// settingEditResponseZonesDevelopmentModeJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesDevelopmentMode] -type settingEditResponseZonesDevelopmentModeJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - TimeRemaining apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesDevelopmentMode) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesDevelopmentMode) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesDevelopmentModeID string - -const ( - SettingEditResponseZonesDevelopmentModeIDDevelopmentMode SettingEditResponseZonesDevelopmentModeID = "development_mode" -) - -// Current value of the zone setting. -type SettingEditResponseZonesDevelopmentModeValue string - -const ( - SettingEditResponseZonesDevelopmentModeValueOn SettingEditResponseZonesDevelopmentModeValue = "on" - SettingEditResponseZonesDevelopmentModeValueOff SettingEditResponseZonesDevelopmentModeValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesDevelopmentModeEditable bool - -const ( - SettingEditResponseZonesDevelopmentModeEditableTrue SettingEditResponseZonesDevelopmentModeEditable = true - SettingEditResponseZonesDevelopmentModeEditableFalse SettingEditResponseZonesDevelopmentModeEditable = false -) - -// When enabled, Cloudflare will attempt to speed up overall page loads by serving -// `103` responses with `Link` headers from the final response. Refer to -// [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for -// more information. -type SettingEditResponseZonesEarlyHints struct { - // ID of the zone setting. - ID SettingEditResponseZonesEarlyHintsID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesEarlyHintsValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesEarlyHintsEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesEarlyHintsJSON `json:"-"` -} - -// settingEditResponseZonesEarlyHintsJSON contains the JSON metadata for the struct -// [SettingEditResponseZonesEarlyHints] -type settingEditResponseZonesEarlyHintsJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesEarlyHints) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesEarlyHints) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesEarlyHintsID string - -const ( - SettingEditResponseZonesEarlyHintsIDEarlyHints SettingEditResponseZonesEarlyHintsID = "early_hints" -) - -// Current value of the zone setting. -type SettingEditResponseZonesEarlyHintsValue string - -const ( - SettingEditResponseZonesEarlyHintsValueOn SettingEditResponseZonesEarlyHintsValue = "on" - SettingEditResponseZonesEarlyHintsValueOff SettingEditResponseZonesEarlyHintsValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesEarlyHintsEditable bool - -const ( - SettingEditResponseZonesEarlyHintsEditableTrue SettingEditResponseZonesEarlyHintsEditable = true - SettingEditResponseZonesEarlyHintsEditableFalse SettingEditResponseZonesEarlyHintsEditable = false -) - -// Time (in seconds) that a resource will be ensured to remain on Cloudflare's -// cache servers. -type SettingEditResponseZonesEdgeCacheTTL struct { - // ID of the zone setting. - ID SettingEditResponseZonesEdgeCacheTTLID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesEdgeCacheTTLValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesEdgeCacheTTLEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesEdgeCacheTTLJSON `json:"-"` -} - -// settingEditResponseZonesEdgeCacheTTLJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesEdgeCacheTTL] -type settingEditResponseZonesEdgeCacheTTLJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesEdgeCacheTTL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesEdgeCacheTTL) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesEdgeCacheTTLID string - -const ( - SettingEditResponseZonesEdgeCacheTTLIDEdgeCacheTTL SettingEditResponseZonesEdgeCacheTTLID = "edge_cache_ttl" -) - -// Current value of the zone setting. -type SettingEditResponseZonesEdgeCacheTTLValue float64 - -const ( - SettingEditResponseZonesEdgeCacheTTLValue30 SettingEditResponseZonesEdgeCacheTTLValue = 30 - SettingEditResponseZonesEdgeCacheTTLValue60 SettingEditResponseZonesEdgeCacheTTLValue = 60 - SettingEditResponseZonesEdgeCacheTTLValue300 SettingEditResponseZonesEdgeCacheTTLValue = 300 - SettingEditResponseZonesEdgeCacheTTLValue1200 SettingEditResponseZonesEdgeCacheTTLValue = 1200 - SettingEditResponseZonesEdgeCacheTTLValue1800 SettingEditResponseZonesEdgeCacheTTLValue = 1800 - SettingEditResponseZonesEdgeCacheTTLValue3600 SettingEditResponseZonesEdgeCacheTTLValue = 3600 - SettingEditResponseZonesEdgeCacheTTLValue7200 SettingEditResponseZonesEdgeCacheTTLValue = 7200 - SettingEditResponseZonesEdgeCacheTTLValue10800 SettingEditResponseZonesEdgeCacheTTLValue = 10800 - SettingEditResponseZonesEdgeCacheTTLValue14400 SettingEditResponseZonesEdgeCacheTTLValue = 14400 - SettingEditResponseZonesEdgeCacheTTLValue18000 SettingEditResponseZonesEdgeCacheTTLValue = 18000 - SettingEditResponseZonesEdgeCacheTTLValue28800 SettingEditResponseZonesEdgeCacheTTLValue = 28800 - SettingEditResponseZonesEdgeCacheTTLValue43200 SettingEditResponseZonesEdgeCacheTTLValue = 43200 - SettingEditResponseZonesEdgeCacheTTLValue57600 SettingEditResponseZonesEdgeCacheTTLValue = 57600 - SettingEditResponseZonesEdgeCacheTTLValue72000 SettingEditResponseZonesEdgeCacheTTLValue = 72000 - SettingEditResponseZonesEdgeCacheTTLValue86400 SettingEditResponseZonesEdgeCacheTTLValue = 86400 - SettingEditResponseZonesEdgeCacheTTLValue172800 SettingEditResponseZonesEdgeCacheTTLValue = 172800 - SettingEditResponseZonesEdgeCacheTTLValue259200 SettingEditResponseZonesEdgeCacheTTLValue = 259200 - SettingEditResponseZonesEdgeCacheTTLValue345600 SettingEditResponseZonesEdgeCacheTTLValue = 345600 - SettingEditResponseZonesEdgeCacheTTLValue432000 SettingEditResponseZonesEdgeCacheTTLValue = 432000 - SettingEditResponseZonesEdgeCacheTTLValue518400 SettingEditResponseZonesEdgeCacheTTLValue = 518400 - SettingEditResponseZonesEdgeCacheTTLValue604800 SettingEditResponseZonesEdgeCacheTTLValue = 604800 -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesEdgeCacheTTLEditable bool - -const ( - SettingEditResponseZonesEdgeCacheTTLEditableTrue SettingEditResponseZonesEdgeCacheTTLEditable = true - SettingEditResponseZonesEdgeCacheTTLEditableFalse SettingEditResponseZonesEdgeCacheTTLEditable = false -) - -// Encrypt email adresses on your web page from bots, while keeping them visible to -// humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). -type SettingEditResponseZonesEmailObfuscation struct { - // ID of the zone setting. - ID SettingEditResponseZonesEmailObfuscationID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesEmailObfuscationValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesEmailObfuscationEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesEmailObfuscationJSON `json:"-"` -} - -// settingEditResponseZonesEmailObfuscationJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesEmailObfuscation] -type settingEditResponseZonesEmailObfuscationJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesEmailObfuscation) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesEmailObfuscation) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesEmailObfuscationID string - -const ( - SettingEditResponseZonesEmailObfuscationIDEmailObfuscation SettingEditResponseZonesEmailObfuscationID = "email_obfuscation" -) - -// Current value of the zone setting. -type SettingEditResponseZonesEmailObfuscationValue string - -const ( - SettingEditResponseZonesEmailObfuscationValueOn SettingEditResponseZonesEmailObfuscationValue = "on" - SettingEditResponseZonesEmailObfuscationValueOff SettingEditResponseZonesEmailObfuscationValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesEmailObfuscationEditable bool - -const ( - SettingEditResponseZonesEmailObfuscationEditableTrue SettingEditResponseZonesEmailObfuscationEditable = true - SettingEditResponseZonesEmailObfuscationEditableFalse SettingEditResponseZonesEmailObfuscationEditable = false -) - -// HTTP/2 Edge Prioritization optimises the delivery of resources served through -// HTTP/2 to improve page load performance. It also supports fine control of -// content delivery when used in conjunction with Workers. -type SettingEditResponseZonesH2Prioritization struct { - // ID of the zone setting. - ID SettingEditResponseZonesH2PrioritizationID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesH2PrioritizationValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesH2PrioritizationEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesH2PrioritizationJSON `json:"-"` -} - -// settingEditResponseZonesH2PrioritizationJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesH2Prioritization] -type settingEditResponseZonesH2PrioritizationJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesH2Prioritization) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesH2Prioritization) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesH2PrioritizationID string - -const ( - SettingEditResponseZonesH2PrioritizationIDH2Prioritization SettingEditResponseZonesH2PrioritizationID = "h2_prioritization" -) - -// Current value of the zone setting. -type SettingEditResponseZonesH2PrioritizationValue string - -const ( - SettingEditResponseZonesH2PrioritizationValueOn SettingEditResponseZonesH2PrioritizationValue = "on" - SettingEditResponseZonesH2PrioritizationValueOff SettingEditResponseZonesH2PrioritizationValue = "off" - SettingEditResponseZonesH2PrioritizationValueCustom SettingEditResponseZonesH2PrioritizationValue = "custom" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesH2PrioritizationEditable bool - -const ( - SettingEditResponseZonesH2PrioritizationEditableTrue SettingEditResponseZonesH2PrioritizationEditable = true - SettingEditResponseZonesH2PrioritizationEditableFalse SettingEditResponseZonesH2PrioritizationEditable = false -) - -// When enabled, the Hotlink Protection option ensures that other sites cannot suck -// up your bandwidth by building pages that use images hosted on your site. Anytime -// a request for an image on your site hits Cloudflare, we check to ensure that -// it's not another site requesting them. People will still be able to download and -// view images from your page, but other sites won't be able to steal them for use -// on their own pages. -// (https://support.cloudflare.com/hc/en-us/articles/200170026). -type SettingEditResponseZonesHotlinkProtection struct { - // ID of the zone setting. - ID SettingEditResponseZonesHotlinkProtectionID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesHotlinkProtectionValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesHotlinkProtectionEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesHotlinkProtectionJSON `json:"-"` -} - -// settingEditResponseZonesHotlinkProtectionJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesHotlinkProtection] -type settingEditResponseZonesHotlinkProtectionJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesHotlinkProtection) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesHotlinkProtection) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesHotlinkProtectionID string - -const ( - SettingEditResponseZonesHotlinkProtectionIDHotlinkProtection SettingEditResponseZonesHotlinkProtectionID = "hotlink_protection" -) - -// Current value of the zone setting. -type SettingEditResponseZonesHotlinkProtectionValue string - -const ( - SettingEditResponseZonesHotlinkProtectionValueOn SettingEditResponseZonesHotlinkProtectionValue = "on" - SettingEditResponseZonesHotlinkProtectionValueOff SettingEditResponseZonesHotlinkProtectionValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesHotlinkProtectionEditable bool - -const ( - SettingEditResponseZonesHotlinkProtectionEditableTrue SettingEditResponseZonesHotlinkProtectionEditable = true - SettingEditResponseZonesHotlinkProtectionEditableFalse SettingEditResponseZonesHotlinkProtectionEditable = false -) - -// HTTP2 enabled for this zone. -type SettingEditResponseZonesHTTP2 struct { - // ID of the zone setting. - ID SettingEditResponseZonesHTTP2ID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesHTTP2Value `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesHTTP2Editable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesHTTP2JSON `json:"-"` -} - -// settingEditResponseZonesHTTP2JSON contains the JSON metadata for the struct -// [SettingEditResponseZonesHTTP2] -type settingEditResponseZonesHTTP2JSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesHTTP2) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesHTTP2) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesHTTP2ID string - -const ( - SettingEditResponseZonesHTTP2IDHTTP2 SettingEditResponseZonesHTTP2ID = "http2" -) - -// Current value of the zone setting. -type SettingEditResponseZonesHTTP2Value string - -const ( - SettingEditResponseZonesHTTP2ValueOn SettingEditResponseZonesHTTP2Value = "on" - SettingEditResponseZonesHTTP2ValueOff SettingEditResponseZonesHTTP2Value = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesHTTP2Editable bool - -const ( - SettingEditResponseZonesHTTP2EditableTrue SettingEditResponseZonesHTTP2Editable = true - SettingEditResponseZonesHTTP2EditableFalse SettingEditResponseZonesHTTP2Editable = false -) - -// HTTP3 enabled for this zone. -type SettingEditResponseZonesHTTP3 struct { - // ID of the zone setting. - ID SettingEditResponseZonesHTTP3ID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesHTTP3Value `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesHTTP3Editable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesHTTP3JSON `json:"-"` -} - -// settingEditResponseZonesHTTP3JSON contains the JSON metadata for the struct -// [SettingEditResponseZonesHTTP3] -type settingEditResponseZonesHTTP3JSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesHTTP3) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesHTTP3) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesHTTP3ID string - -const ( - SettingEditResponseZonesHTTP3IDHTTP3 SettingEditResponseZonesHTTP3ID = "http3" -) - -// Current value of the zone setting. -type SettingEditResponseZonesHTTP3Value string - -const ( - SettingEditResponseZonesHTTP3ValueOn SettingEditResponseZonesHTTP3Value = "on" - SettingEditResponseZonesHTTP3ValueOff SettingEditResponseZonesHTTP3Value = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesHTTP3Editable bool - -const ( - SettingEditResponseZonesHTTP3EditableTrue SettingEditResponseZonesHTTP3Editable = true - SettingEditResponseZonesHTTP3EditableFalse SettingEditResponseZonesHTTP3Editable = false -) - -// Image Resizing provides on-demand resizing, conversion and optimisation for -// images served through Cloudflare's network. Refer to the -// [Image Resizing documentation](https://developers.cloudflare.com/images/) for -// more information. -type SettingEditResponseZonesImageResizing struct { - // ID of the zone setting. - ID SettingEditResponseZonesImageResizingID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesImageResizingValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesImageResizingEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesImageResizingJSON `json:"-"` -} - -// settingEditResponseZonesImageResizingJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesImageResizing] -type settingEditResponseZonesImageResizingJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesImageResizing) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesImageResizing) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesImageResizingID string - -const ( - SettingEditResponseZonesImageResizingIDImageResizing SettingEditResponseZonesImageResizingID = "image_resizing" -) - -// Current value of the zone setting. -type SettingEditResponseZonesImageResizingValue string - -const ( - SettingEditResponseZonesImageResizingValueOn SettingEditResponseZonesImageResizingValue = "on" - SettingEditResponseZonesImageResizingValueOff SettingEditResponseZonesImageResizingValue = "off" - SettingEditResponseZonesImageResizingValueOpen SettingEditResponseZonesImageResizingValue = "open" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesImageResizingEditable bool - -const ( - SettingEditResponseZonesImageResizingEditableTrue SettingEditResponseZonesImageResizingEditable = true - SettingEditResponseZonesImageResizingEditableFalse SettingEditResponseZonesImageResizingEditable = false -) - -// Enable IP Geolocation to have Cloudflare geolocate visitors to your website and -// pass the country code to you. -// (https://support.cloudflare.com/hc/en-us/articles/200168236). -type SettingEditResponseZonesIPGeolocation struct { - // ID of the zone setting. - ID SettingEditResponseZonesIPGeolocationID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesIPGeolocationValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesIPGeolocationEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesIPGeolocationJSON `json:"-"` -} - -// settingEditResponseZonesIPGeolocationJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesIPGeolocation] -type settingEditResponseZonesIPGeolocationJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesIPGeolocation) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesIPGeolocation) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesIPGeolocationID string - -const ( - SettingEditResponseZonesIPGeolocationIDIPGeolocation SettingEditResponseZonesIPGeolocationID = "ip_geolocation" -) - -// Current value of the zone setting. -type SettingEditResponseZonesIPGeolocationValue string - -const ( - SettingEditResponseZonesIPGeolocationValueOn SettingEditResponseZonesIPGeolocationValue = "on" - SettingEditResponseZonesIPGeolocationValueOff SettingEditResponseZonesIPGeolocationValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesIPGeolocationEditable bool - -const ( - SettingEditResponseZonesIPGeolocationEditableTrue SettingEditResponseZonesIPGeolocationEditable = true - SettingEditResponseZonesIPGeolocationEditableFalse SettingEditResponseZonesIPGeolocationEditable = false -) - -// Enable IPv6 on all subdomains that are Cloudflare enabled. -// (https://support.cloudflare.com/hc/en-us/articles/200168586). -type SettingEditResponseZonesIPV6 struct { - // ID of the zone setting. - ID SettingEditResponseZonesIPV6ID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesIPV6Value `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesIPV6Editable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesIPV6JSON `json:"-"` -} - -// settingEditResponseZonesIPV6JSON contains the JSON metadata for the struct -// [SettingEditResponseZonesIPV6] -type settingEditResponseZonesIPV6JSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesIPV6) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesIPV6) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesIPV6ID string - -const ( - SettingEditResponseZonesIPV6IDIPV6 SettingEditResponseZonesIPV6ID = "ipv6" -) - -// Current value of the zone setting. -type SettingEditResponseZonesIPV6Value string - -const ( - SettingEditResponseZonesIPV6ValueOff SettingEditResponseZonesIPV6Value = "off" - SettingEditResponseZonesIPV6ValueOn SettingEditResponseZonesIPV6Value = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesIPV6Editable bool - -const ( - SettingEditResponseZonesIPV6EditableTrue SettingEditResponseZonesIPV6Editable = true - SettingEditResponseZonesIPV6EditableFalse SettingEditResponseZonesIPV6Editable = false -) - -// Maximum size of an allowable upload. -type SettingEditResponseZonesMaxUpload struct { - // identifier of the zone setting. - ID SettingEditResponseZonesMaxUploadID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesMaxUploadValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesMaxUploadEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesMaxUploadJSON `json:"-"` -} - -// settingEditResponseZonesMaxUploadJSON contains the JSON metadata for the struct -// [SettingEditResponseZonesMaxUpload] -type settingEditResponseZonesMaxUploadJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesMaxUpload) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesMaxUpload) implementsSettingEditResponse() {} - -// identifier of the zone setting. -type SettingEditResponseZonesMaxUploadID string - -const ( - SettingEditResponseZonesMaxUploadIDMaxUpload SettingEditResponseZonesMaxUploadID = "max_upload" -) - -// Current value of the zone setting. -type SettingEditResponseZonesMaxUploadValue float64 - -const ( - SettingEditResponseZonesMaxUploadValue100 SettingEditResponseZonesMaxUploadValue = 100 - SettingEditResponseZonesMaxUploadValue200 SettingEditResponseZonesMaxUploadValue = 200 - SettingEditResponseZonesMaxUploadValue500 SettingEditResponseZonesMaxUploadValue = 500 -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesMaxUploadEditable bool - -const ( - SettingEditResponseZonesMaxUploadEditableTrue SettingEditResponseZonesMaxUploadEditable = true - SettingEditResponseZonesMaxUploadEditableFalse SettingEditResponseZonesMaxUploadEditable = false -) - -// Only accepts HTTPS requests that use at least the TLS protocol version -// specified. For example, if TLS 1.1 is selected, TLS 1.0 connections will be -// rejected, while 1.1, 1.2, and 1.3 (if enabled) will be permitted. -type SettingEditResponseZonesMinTLSVersion struct { - // ID of the zone setting. - ID SettingEditResponseZonesMinTLSVersionID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesMinTLSVersionValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesMinTLSVersionEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesMinTLSVersionJSON `json:"-"` -} - -// settingEditResponseZonesMinTLSVersionJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesMinTLSVersion] -type settingEditResponseZonesMinTLSVersionJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesMinTLSVersion) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesMinTLSVersion) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesMinTLSVersionID string - -const ( - SettingEditResponseZonesMinTLSVersionIDMinTLSVersion SettingEditResponseZonesMinTLSVersionID = "min_tls_version" -) - -// Current value of the zone setting. -type SettingEditResponseZonesMinTLSVersionValue string - -const ( - SettingEditResponseZonesMinTLSVersionValue1_0 SettingEditResponseZonesMinTLSVersionValue = "1.0" - SettingEditResponseZonesMinTLSVersionValue1_1 SettingEditResponseZonesMinTLSVersionValue = "1.1" - SettingEditResponseZonesMinTLSVersionValue1_2 SettingEditResponseZonesMinTLSVersionValue = "1.2" - SettingEditResponseZonesMinTLSVersionValue1_3 SettingEditResponseZonesMinTLSVersionValue = "1.3" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesMinTLSVersionEditable bool - -const ( - SettingEditResponseZonesMinTLSVersionEditableTrue SettingEditResponseZonesMinTLSVersionEditable = true - SettingEditResponseZonesMinTLSVersionEditableFalse SettingEditResponseZonesMinTLSVersionEditable = false -) - -// Automatically minify certain assets for your website. Refer to -// [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) -// for more information. -type SettingEditResponseZonesMinify struct { - // Zone setting identifier. - ID SettingEditResponseZonesMinifyID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesMinifyValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesMinifyEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesMinifyJSON `json:"-"` -} - -// settingEditResponseZonesMinifyJSON contains the JSON metadata for the struct -// [SettingEditResponseZonesMinify] -type settingEditResponseZonesMinifyJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesMinify) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesMinify) implementsSettingEditResponse() {} - -// Zone setting identifier. -type SettingEditResponseZonesMinifyID string - -const ( - SettingEditResponseZonesMinifyIDMinify SettingEditResponseZonesMinifyID = "minify" -) - -// Current value of the zone setting. -type SettingEditResponseZonesMinifyValue struct { - // Automatically minify all CSS files for your website. - Css SettingEditResponseZonesMinifyValueCss `json:"css"` - // Automatically minify all HTML files for your website. - HTML SettingEditResponseZonesMinifyValueHTML `json:"html"` - // Automatically minify all JavaScript files for your website. - Js SettingEditResponseZonesMinifyValueJs `json:"js"` - JSON settingEditResponseZonesMinifyValueJSON `json:"-"` -} - -// settingEditResponseZonesMinifyValueJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesMinifyValue] -type settingEditResponseZonesMinifyValueJSON struct { - Css apijson.Field - HTML apijson.Field - Js apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesMinifyValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Automatically minify all CSS files for your website. -type SettingEditResponseZonesMinifyValueCss string - -const ( - SettingEditResponseZonesMinifyValueCssOn SettingEditResponseZonesMinifyValueCss = "on" - SettingEditResponseZonesMinifyValueCssOff SettingEditResponseZonesMinifyValueCss = "off" -) - -// Automatically minify all HTML files for your website. -type SettingEditResponseZonesMinifyValueHTML string - -const ( - SettingEditResponseZonesMinifyValueHTMLOn SettingEditResponseZonesMinifyValueHTML = "on" - SettingEditResponseZonesMinifyValueHTMLOff SettingEditResponseZonesMinifyValueHTML = "off" -) - -// Automatically minify all JavaScript files for your website. -type SettingEditResponseZonesMinifyValueJs string - -const ( - SettingEditResponseZonesMinifyValueJsOn SettingEditResponseZonesMinifyValueJs = "on" - SettingEditResponseZonesMinifyValueJsOff SettingEditResponseZonesMinifyValueJs = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesMinifyEditable bool - -const ( - SettingEditResponseZonesMinifyEditableTrue SettingEditResponseZonesMinifyEditable = true - SettingEditResponseZonesMinifyEditableFalse SettingEditResponseZonesMinifyEditable = false -) - -// Automatically optimize image loading for website visitors on mobile devices. -// Refer to -// [our blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for -// more information. -type SettingEditResponseZonesMirage struct { - // ID of the zone setting. - ID SettingEditResponseZonesMirageID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesMirageValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesMirageEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesMirageJSON `json:"-"` -} - -// settingEditResponseZonesMirageJSON contains the JSON metadata for the struct -// [SettingEditResponseZonesMirage] -type settingEditResponseZonesMirageJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesMirage) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesMirage) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesMirageID string - -const ( - SettingEditResponseZonesMirageIDMirage SettingEditResponseZonesMirageID = "mirage" -) - -// Current value of the zone setting. -type SettingEditResponseZonesMirageValue string - -const ( - SettingEditResponseZonesMirageValueOn SettingEditResponseZonesMirageValue = "on" - SettingEditResponseZonesMirageValueOff SettingEditResponseZonesMirageValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesMirageEditable bool - -const ( - SettingEditResponseZonesMirageEditableTrue SettingEditResponseZonesMirageEditable = true - SettingEditResponseZonesMirageEditableFalse SettingEditResponseZonesMirageEditable = false -) - -// Automatically redirect visitors on mobile devices to a mobile-optimized -// subdomain. Refer to -// [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) -// for more information. -type SettingEditResponseZonesMobileRedirect struct { - // Identifier of the zone setting. - ID SettingEditResponseZonesMobileRedirectID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesMobileRedirectValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesMobileRedirectEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesMobileRedirectJSON `json:"-"` -} - -// settingEditResponseZonesMobileRedirectJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesMobileRedirect] -type settingEditResponseZonesMobileRedirectJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesMobileRedirect) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesMobileRedirect) implementsSettingEditResponse() {} - -// Identifier of the zone setting. -type SettingEditResponseZonesMobileRedirectID string - -const ( - SettingEditResponseZonesMobileRedirectIDMobileRedirect SettingEditResponseZonesMobileRedirectID = "mobile_redirect" -) - -// Current value of the zone setting. -type SettingEditResponseZonesMobileRedirectValue struct { - // Which subdomain prefix you wish to redirect visitors on mobile devices to - // (subdomain must already exist). - MobileSubdomain string `json:"mobile_subdomain,nullable"` - // Whether or not mobile redirect is enabled. - Status SettingEditResponseZonesMobileRedirectValueStatus `json:"status"` - // Whether to drop the current page path and redirect to the mobile subdomain URL - // root, or keep the path and redirect to the same page on the mobile subdomain. - StripUri bool `json:"strip_uri"` - JSON settingEditResponseZonesMobileRedirectValueJSON `json:"-"` -} - -// settingEditResponseZonesMobileRedirectValueJSON contains the JSON metadata for -// the struct [SettingEditResponseZonesMobileRedirectValue] -type settingEditResponseZonesMobileRedirectValueJSON struct { - MobileSubdomain apijson.Field - Status apijson.Field - StripUri apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesMobileRedirectValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether or not mobile redirect is enabled. -type SettingEditResponseZonesMobileRedirectValueStatus string - -const ( - SettingEditResponseZonesMobileRedirectValueStatusOn SettingEditResponseZonesMobileRedirectValueStatus = "on" - SettingEditResponseZonesMobileRedirectValueStatusOff SettingEditResponseZonesMobileRedirectValueStatus = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesMobileRedirectEditable bool - -const ( - SettingEditResponseZonesMobileRedirectEditableTrue SettingEditResponseZonesMobileRedirectEditable = true - SettingEditResponseZonesMobileRedirectEditableFalse SettingEditResponseZonesMobileRedirectEditable = false -) - -// Enable Network Error Logging reporting on your zone. (Beta) -type SettingEditResponseZonesNEL struct { - // Zone setting identifier. - ID SettingEditResponseZonesNELID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesNELValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesNELEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesNELJSON `json:"-"` -} - -// settingEditResponseZonesNELJSON contains the JSON metadata for the struct -// [SettingEditResponseZonesNEL] -type settingEditResponseZonesNELJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesNEL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesNEL) implementsSettingEditResponse() {} - -// Zone setting identifier. -type SettingEditResponseZonesNELID string - -const ( - SettingEditResponseZonesNELIDNEL SettingEditResponseZonesNELID = "nel" -) - -// Current value of the zone setting. -type SettingEditResponseZonesNELValue struct { - Enabled bool `json:"enabled"` - JSON settingEditResponseZonesNELValueJSON `json:"-"` -} - -// settingEditResponseZonesNELValueJSON contains the JSON metadata for the struct -// [SettingEditResponseZonesNELValue] -type settingEditResponseZonesNELValueJSON struct { - Enabled apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesNELValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesNELEditable bool - -const ( - SettingEditResponseZonesNELEditableTrue SettingEditResponseZonesNELEditable = true - SettingEditResponseZonesNELEditableFalse SettingEditResponseZonesNELEditable = false -) - -// Enables the Opportunistic Encryption feature for a zone. -type SettingEditResponseZonesOpportunisticEncryption struct { - // ID of the zone setting. - ID SettingEditResponseZonesOpportunisticEncryptionID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesOpportunisticEncryptionValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesOpportunisticEncryptionEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesOpportunisticEncryptionJSON `json:"-"` -} - -// settingEditResponseZonesOpportunisticEncryptionJSON contains the JSON metadata -// for the struct [SettingEditResponseZonesOpportunisticEncryption] -type settingEditResponseZonesOpportunisticEncryptionJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesOpportunisticEncryption) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesOpportunisticEncryption) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesOpportunisticEncryptionID string - -const ( - SettingEditResponseZonesOpportunisticEncryptionIDOpportunisticEncryption SettingEditResponseZonesOpportunisticEncryptionID = "opportunistic_encryption" -) - -// Current value of the zone setting. -type SettingEditResponseZonesOpportunisticEncryptionValue string - -const ( - SettingEditResponseZonesOpportunisticEncryptionValueOn SettingEditResponseZonesOpportunisticEncryptionValue = "on" - SettingEditResponseZonesOpportunisticEncryptionValueOff SettingEditResponseZonesOpportunisticEncryptionValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesOpportunisticEncryptionEditable bool - -const ( - SettingEditResponseZonesOpportunisticEncryptionEditableTrue SettingEditResponseZonesOpportunisticEncryptionEditable = true - SettingEditResponseZonesOpportunisticEncryptionEditableFalse SettingEditResponseZonesOpportunisticEncryptionEditable = false -) - -// Add an Alt-Svc header to all legitimate requests from Tor, allowing the -// connection to use our onion services instead of exit nodes. -type SettingEditResponseZonesOpportunisticOnion struct { - // ID of the zone setting. - ID SettingEditResponseZonesOpportunisticOnionID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesOpportunisticOnionValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesOpportunisticOnionEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesOpportunisticOnionJSON `json:"-"` -} - -// settingEditResponseZonesOpportunisticOnionJSON contains the JSON metadata for -// the struct [SettingEditResponseZonesOpportunisticOnion] -type settingEditResponseZonesOpportunisticOnionJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesOpportunisticOnion) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesOpportunisticOnion) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesOpportunisticOnionID string - -const ( - SettingEditResponseZonesOpportunisticOnionIDOpportunisticOnion SettingEditResponseZonesOpportunisticOnionID = "opportunistic_onion" -) - -// Current value of the zone setting. -type SettingEditResponseZonesOpportunisticOnionValue string - -const ( - SettingEditResponseZonesOpportunisticOnionValueOn SettingEditResponseZonesOpportunisticOnionValue = "on" - SettingEditResponseZonesOpportunisticOnionValueOff SettingEditResponseZonesOpportunisticOnionValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesOpportunisticOnionEditable bool - -const ( - SettingEditResponseZonesOpportunisticOnionEditableTrue SettingEditResponseZonesOpportunisticOnionEditable = true - SettingEditResponseZonesOpportunisticOnionEditableFalse SettingEditResponseZonesOpportunisticOnionEditable = false -) - -// Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also -// on Cloudflare. -type SettingEditResponseZonesOrangeToOrange struct { - // ID of the zone setting. - ID SettingEditResponseZonesOrangeToOrangeID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesOrangeToOrangeValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesOrangeToOrangeEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesOrangeToOrangeJSON `json:"-"` -} - -// settingEditResponseZonesOrangeToOrangeJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesOrangeToOrange] -type settingEditResponseZonesOrangeToOrangeJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesOrangeToOrange) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesOrangeToOrange) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesOrangeToOrangeID string - -const ( - SettingEditResponseZonesOrangeToOrangeIDOrangeToOrange SettingEditResponseZonesOrangeToOrangeID = "orange_to_orange" -) - -// Current value of the zone setting. -type SettingEditResponseZonesOrangeToOrangeValue string - -const ( - SettingEditResponseZonesOrangeToOrangeValueOn SettingEditResponseZonesOrangeToOrangeValue = "on" - SettingEditResponseZonesOrangeToOrangeValueOff SettingEditResponseZonesOrangeToOrangeValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesOrangeToOrangeEditable bool - -const ( - SettingEditResponseZonesOrangeToOrangeEditableTrue SettingEditResponseZonesOrangeToOrangeEditable = true - SettingEditResponseZonesOrangeToOrangeEditableFalse SettingEditResponseZonesOrangeToOrangeEditable = false -) - -// Cloudflare will proxy customer error pages on any 502,504 errors on origin -// server instead of showing a default Cloudflare error page. This does not apply -// to 522 errors and is limited to Enterprise Zones. -type SettingEditResponseZonesOriginErrorPagePassThru struct { - // ID of the zone setting. - ID SettingEditResponseZonesOriginErrorPagePassThruID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesOriginErrorPagePassThruValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesOriginErrorPagePassThruEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesOriginErrorPagePassThruJSON `json:"-"` -} - -// settingEditResponseZonesOriginErrorPagePassThruJSON contains the JSON metadata -// for the struct [SettingEditResponseZonesOriginErrorPagePassThru] -type settingEditResponseZonesOriginErrorPagePassThruJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesOriginErrorPagePassThru) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesOriginErrorPagePassThru) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesOriginErrorPagePassThruID string - -const ( - SettingEditResponseZonesOriginErrorPagePassThruIDOriginErrorPagePassThru SettingEditResponseZonesOriginErrorPagePassThruID = "origin_error_page_pass_thru" -) - -// Current value of the zone setting. -type SettingEditResponseZonesOriginErrorPagePassThruValue string - -const ( - SettingEditResponseZonesOriginErrorPagePassThruValueOn SettingEditResponseZonesOriginErrorPagePassThruValue = "on" - SettingEditResponseZonesOriginErrorPagePassThruValueOff SettingEditResponseZonesOriginErrorPagePassThruValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesOriginErrorPagePassThruEditable bool - -const ( - SettingEditResponseZonesOriginErrorPagePassThruEditableTrue SettingEditResponseZonesOriginErrorPagePassThruEditable = true - SettingEditResponseZonesOriginErrorPagePassThruEditableFalse SettingEditResponseZonesOriginErrorPagePassThruEditable = false -) - -// Removes metadata and compresses your images for faster page load times. Basic -// (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual -// quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster -// image loading. Larger JPEGs are converted to progressive images, loading a -// lower-resolution image first and ending in a higher-resolution version. Not -// recommended for hi-res photography sites. -type SettingEditResponseZonesPolish struct { - // ID of the zone setting. - ID SettingEditResponseZonesPolishID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesPolishValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesPolishEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesPolishJSON `json:"-"` -} - -// settingEditResponseZonesPolishJSON contains the JSON metadata for the struct -// [SettingEditResponseZonesPolish] -type settingEditResponseZonesPolishJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesPolish) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesPolish) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesPolishID string - -const ( - SettingEditResponseZonesPolishIDPolish SettingEditResponseZonesPolishID = "polish" -) - -// Current value of the zone setting. -type SettingEditResponseZonesPolishValue string - -const ( - SettingEditResponseZonesPolishValueOff SettingEditResponseZonesPolishValue = "off" - SettingEditResponseZonesPolishValueLossless SettingEditResponseZonesPolishValue = "lossless" - SettingEditResponseZonesPolishValueLossy SettingEditResponseZonesPolishValue = "lossy" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesPolishEditable bool - -const ( - SettingEditResponseZonesPolishEditableTrue SettingEditResponseZonesPolishEditable = true - SettingEditResponseZonesPolishEditableFalse SettingEditResponseZonesPolishEditable = false -) - -// Cloudflare will prefetch any URLs that are included in the response headers. -// This is limited to Enterprise Zones. -type SettingEditResponseZonesPrefetchPreload struct { - // ID of the zone setting. - ID SettingEditResponseZonesPrefetchPreloadID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesPrefetchPreloadValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesPrefetchPreloadEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesPrefetchPreloadJSON `json:"-"` -} - -// settingEditResponseZonesPrefetchPreloadJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesPrefetchPreload] -type settingEditResponseZonesPrefetchPreloadJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesPrefetchPreload) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesPrefetchPreload) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesPrefetchPreloadID string - -const ( - SettingEditResponseZonesPrefetchPreloadIDPrefetchPreload SettingEditResponseZonesPrefetchPreloadID = "prefetch_preload" -) - -// Current value of the zone setting. -type SettingEditResponseZonesPrefetchPreloadValue string - -const ( - SettingEditResponseZonesPrefetchPreloadValueOn SettingEditResponseZonesPrefetchPreloadValue = "on" - SettingEditResponseZonesPrefetchPreloadValueOff SettingEditResponseZonesPrefetchPreloadValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesPrefetchPreloadEditable bool - -const ( - SettingEditResponseZonesPrefetchPreloadEditableTrue SettingEditResponseZonesPrefetchPreloadEditable = true - SettingEditResponseZonesPrefetchPreloadEditableFalse SettingEditResponseZonesPrefetchPreloadEditable = false -) - -// Maximum time between two read operations from origin. -type SettingEditResponseZonesProxyReadTimeout struct { - // ID of the zone setting. - ID SettingEditResponseZonesProxyReadTimeoutID `json:"id,required"` - // Current value of the zone setting. - Value float64 `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesProxyReadTimeoutEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesProxyReadTimeoutJSON `json:"-"` -} - -// settingEditResponseZonesProxyReadTimeoutJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesProxyReadTimeout] -type settingEditResponseZonesProxyReadTimeoutJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesProxyReadTimeout) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesProxyReadTimeout) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesProxyReadTimeoutID string - -const ( - SettingEditResponseZonesProxyReadTimeoutIDProxyReadTimeout SettingEditResponseZonesProxyReadTimeoutID = "proxy_read_timeout" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesProxyReadTimeoutEditable bool - -const ( - SettingEditResponseZonesProxyReadTimeoutEditableTrue SettingEditResponseZonesProxyReadTimeoutEditable = true - SettingEditResponseZonesProxyReadTimeoutEditableFalse SettingEditResponseZonesProxyReadTimeoutEditable = false -) - -// The value set for the Pseudo IPv4 setting. -type SettingEditResponseZonesPseudoIPV4 struct { - // Value of the Pseudo IPv4 setting. - ID SettingEditResponseZonesPseudoIPV4ID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesPseudoIPV4Value `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesPseudoIPV4Editable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesPseudoIPV4JSON `json:"-"` -} - -// settingEditResponseZonesPseudoIPV4JSON contains the JSON metadata for the struct -// [SettingEditResponseZonesPseudoIPV4] -type settingEditResponseZonesPseudoIPV4JSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesPseudoIPV4) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesPseudoIPV4) implementsSettingEditResponse() {} - -// Value of the Pseudo IPv4 setting. -type SettingEditResponseZonesPseudoIPV4ID string - -const ( - SettingEditResponseZonesPseudoIPV4IDPseudoIPV4 SettingEditResponseZonesPseudoIPV4ID = "pseudo_ipv4" -) - -// Current value of the zone setting. -type SettingEditResponseZonesPseudoIPV4Value string - -const ( - SettingEditResponseZonesPseudoIPV4ValueOff SettingEditResponseZonesPseudoIPV4Value = "off" - SettingEditResponseZonesPseudoIPV4ValueAddHeader SettingEditResponseZonesPseudoIPV4Value = "add_header" - SettingEditResponseZonesPseudoIPV4ValueOverwriteHeader SettingEditResponseZonesPseudoIPV4Value = "overwrite_header" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesPseudoIPV4Editable bool - -const ( - SettingEditResponseZonesPseudoIPV4EditableTrue SettingEditResponseZonesPseudoIPV4Editable = true - SettingEditResponseZonesPseudoIPV4EditableFalse SettingEditResponseZonesPseudoIPV4Editable = false -) - -// Enables or disables buffering of responses from the proxied server. Cloudflare -// may buffer the whole payload to deliver it at once to the client versus allowing -// it to be delivered in chunks. By default, the proxied server streams directly -// and is not buffered by Cloudflare. This is limited to Enterprise Zones. -type SettingEditResponseZonesResponseBuffering struct { - // ID of the zone setting. - ID SettingEditResponseZonesResponseBufferingID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesResponseBufferingValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesResponseBufferingEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesResponseBufferingJSON `json:"-"` -} - -// settingEditResponseZonesResponseBufferingJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesResponseBuffering] -type settingEditResponseZonesResponseBufferingJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesResponseBuffering) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesResponseBuffering) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesResponseBufferingID string - -const ( - SettingEditResponseZonesResponseBufferingIDResponseBuffering SettingEditResponseZonesResponseBufferingID = "response_buffering" -) - -// Current value of the zone setting. -type SettingEditResponseZonesResponseBufferingValue string - -const ( - SettingEditResponseZonesResponseBufferingValueOn SettingEditResponseZonesResponseBufferingValue = "on" - SettingEditResponseZonesResponseBufferingValueOff SettingEditResponseZonesResponseBufferingValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesResponseBufferingEditable bool - -const ( - SettingEditResponseZonesResponseBufferingEditableTrue SettingEditResponseZonesResponseBufferingEditable = true - SettingEditResponseZonesResponseBufferingEditableFalse SettingEditResponseZonesResponseBufferingEditable = false -) - -// Rocket Loader is a general-purpose asynchronous JavaScript optimisation that -// prioritises rendering your content while loading your site's Javascript -// asynchronously. Turning on Rocket Loader will immediately improve a web page's -// rendering time sometimes measured as Time to First Paint (TTFP), and also the -// `window.onload` time (assuming there is JavaScript on the page). This can have a -// positive impact on your Google search ranking. When turned on, Rocket Loader -// will automatically defer the loading of all Javascript referenced in your HTML, -// with no configuration required. Refer to -// [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) -// for more information. -type SettingEditResponseZonesRocketLoader struct { - // ID of the zone setting. - ID SettingEditResponseZonesRocketLoaderID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesRocketLoaderValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesRocketLoaderEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesRocketLoaderJSON `json:"-"` -} - -// settingEditResponseZonesRocketLoaderJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesRocketLoader] -type settingEditResponseZonesRocketLoaderJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesRocketLoader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesRocketLoader) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesRocketLoaderID string - -const ( - SettingEditResponseZonesRocketLoaderIDRocketLoader SettingEditResponseZonesRocketLoaderID = "rocket_loader" -) - -// Current value of the zone setting. -type SettingEditResponseZonesRocketLoaderValue string - -const ( - SettingEditResponseZonesRocketLoaderValueOn SettingEditResponseZonesRocketLoaderValue = "on" - SettingEditResponseZonesRocketLoaderValueOff SettingEditResponseZonesRocketLoaderValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesRocketLoaderEditable bool - -const ( - SettingEditResponseZonesRocketLoaderEditableTrue SettingEditResponseZonesRocketLoaderEditable = true - SettingEditResponseZonesRocketLoaderEditableFalse SettingEditResponseZonesRocketLoaderEditable = false -) - -// [Automatic Platform Optimization for WordPress](https://developers.cloudflare.com/automatic-platform-optimization/) -// serves your WordPress site from Cloudflare's edge network and caches third-party -// fonts. -type SettingEditResponseZonesSchemasAutomaticPlatformOptimization struct { - // ID of the zone setting. - ID SettingEditResponseZonesSchemasAutomaticPlatformOptimizationID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesSchemasAutomaticPlatformOptimizationValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesSchemasAutomaticPlatformOptimizationEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesSchemasAutomaticPlatformOptimizationJSON `json:"-"` -} - -// settingEditResponseZonesSchemasAutomaticPlatformOptimizationJSON contains the -// JSON metadata for the struct -// [SettingEditResponseZonesSchemasAutomaticPlatformOptimization] -type settingEditResponseZonesSchemasAutomaticPlatformOptimizationJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesSchemasAutomaticPlatformOptimization) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesSchemasAutomaticPlatformOptimization) implementsSettingEditResponse() { -} - -// ID of the zone setting. -type SettingEditResponseZonesSchemasAutomaticPlatformOptimizationID string - -const ( - SettingEditResponseZonesSchemasAutomaticPlatformOptimizationIDAutomaticPlatformOptimization SettingEditResponseZonesSchemasAutomaticPlatformOptimizationID = "automatic_platform_optimization" -) - -// Current value of the zone setting. -type SettingEditResponseZonesSchemasAutomaticPlatformOptimizationValue struct { - // Indicates whether or not - // [cache by device type](https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/) - // is enabled. - CacheByDeviceType bool `json:"cache_by_device_type,required"` - // Indicates whether or not Cloudflare proxy is enabled. - Cf bool `json:"cf,required"` - // Indicates whether or not Automatic Platform Optimization is enabled. - Enabled bool `json:"enabled,required"` - // An array of hostnames where Automatic Platform Optimization for WordPress is - // activated. - Hostnames []string `json:"hostnames,required" format:"hostname"` - // Indicates whether or not site is powered by WordPress. - Wordpress bool `json:"wordpress,required"` - // Indicates whether or not - // [Cloudflare for WordPress plugin](https://wordpress.org/plugins/cloudflare/) is - // installed. - WpPlugin bool `json:"wp_plugin,required"` - JSON settingEditResponseZonesSchemasAutomaticPlatformOptimizationValueJSON `json:"-"` -} - -// settingEditResponseZonesSchemasAutomaticPlatformOptimizationValueJSON contains -// the JSON metadata for the struct -// [SettingEditResponseZonesSchemasAutomaticPlatformOptimizationValue] -type settingEditResponseZonesSchemasAutomaticPlatformOptimizationValueJSON struct { - CacheByDeviceType apijson.Field - Cf apijson.Field - Enabled apijson.Field - Hostnames apijson.Field - Wordpress apijson.Field - WpPlugin apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesSchemasAutomaticPlatformOptimizationValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesSchemasAutomaticPlatformOptimizationEditable bool - -const ( - SettingEditResponseZonesSchemasAutomaticPlatformOptimizationEditableTrue SettingEditResponseZonesSchemasAutomaticPlatformOptimizationEditable = true - SettingEditResponseZonesSchemasAutomaticPlatformOptimizationEditableFalse SettingEditResponseZonesSchemasAutomaticPlatformOptimizationEditable = false -) - -// Cloudflare security header for a zone. -type SettingEditResponseZonesSecurityHeader struct { - // ID of the zone's security header. - ID SettingEditResponseZonesSecurityHeaderID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesSecurityHeaderValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesSecurityHeaderEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesSecurityHeaderJSON `json:"-"` -} - -// settingEditResponseZonesSecurityHeaderJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesSecurityHeader] -type settingEditResponseZonesSecurityHeaderJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesSecurityHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesSecurityHeader) implementsSettingEditResponse() {} - -// ID of the zone's security header. -type SettingEditResponseZonesSecurityHeaderID string - -const ( - SettingEditResponseZonesSecurityHeaderIDSecurityHeader SettingEditResponseZonesSecurityHeaderID = "security_header" -) - -// Current value of the zone setting. -type SettingEditResponseZonesSecurityHeaderValue struct { - // Strict Transport Security. - StrictTransportSecurity SettingEditResponseZonesSecurityHeaderValueStrictTransportSecurity `json:"strict_transport_security"` - JSON settingEditResponseZonesSecurityHeaderValueJSON `json:"-"` -} - -// settingEditResponseZonesSecurityHeaderValueJSON contains the JSON metadata for -// the struct [SettingEditResponseZonesSecurityHeaderValue] -type settingEditResponseZonesSecurityHeaderValueJSON struct { - StrictTransportSecurity apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesSecurityHeaderValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Strict Transport Security. -type SettingEditResponseZonesSecurityHeaderValueStrictTransportSecurity struct { - // Whether or not strict transport security is enabled. - Enabled bool `json:"enabled"` - // Include all subdomains for strict transport security. - IncludeSubdomains bool `json:"include_subdomains"` - // Max age in seconds of the strict transport security. - MaxAge float64 `json:"max_age"` - // Whether or not to include 'X-Content-Type-Options: nosniff' header. - Nosniff bool `json:"nosniff"` - JSON settingEditResponseZonesSecurityHeaderValueStrictTransportSecurityJSON `json:"-"` -} - -// settingEditResponseZonesSecurityHeaderValueStrictTransportSecurityJSON contains -// the JSON metadata for the struct -// [SettingEditResponseZonesSecurityHeaderValueStrictTransportSecurity] -type settingEditResponseZonesSecurityHeaderValueStrictTransportSecurityJSON struct { - Enabled apijson.Field - IncludeSubdomains apijson.Field - MaxAge apijson.Field - Nosniff apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesSecurityHeaderValueStrictTransportSecurity) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesSecurityHeaderEditable bool - -const ( - SettingEditResponseZonesSecurityHeaderEditableTrue SettingEditResponseZonesSecurityHeaderEditable = true - SettingEditResponseZonesSecurityHeaderEditableFalse SettingEditResponseZonesSecurityHeaderEditable = false -) - -// Choose the appropriate security profile for your website, which will -// automatically adjust each of the security settings. If you choose to customize -// an individual security setting, the profile will become Custom. -// (https://support.cloudflare.com/hc/en-us/articles/200170056). -type SettingEditResponseZonesSecurityLevel struct { - // ID of the zone setting. - ID SettingEditResponseZonesSecurityLevelID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesSecurityLevelValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesSecurityLevelEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesSecurityLevelJSON `json:"-"` -} - -// settingEditResponseZonesSecurityLevelJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesSecurityLevel] -type settingEditResponseZonesSecurityLevelJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesSecurityLevel) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesSecurityLevel) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesSecurityLevelID string - -const ( - SettingEditResponseZonesSecurityLevelIDSecurityLevel SettingEditResponseZonesSecurityLevelID = "security_level" -) - -// Current value of the zone setting. -type SettingEditResponseZonesSecurityLevelValue string - -const ( - SettingEditResponseZonesSecurityLevelValueOff SettingEditResponseZonesSecurityLevelValue = "off" - SettingEditResponseZonesSecurityLevelValueEssentiallyOff SettingEditResponseZonesSecurityLevelValue = "essentially_off" - SettingEditResponseZonesSecurityLevelValueLow SettingEditResponseZonesSecurityLevelValue = "low" - SettingEditResponseZonesSecurityLevelValueMedium SettingEditResponseZonesSecurityLevelValue = "medium" - SettingEditResponseZonesSecurityLevelValueHigh SettingEditResponseZonesSecurityLevelValue = "high" - SettingEditResponseZonesSecurityLevelValueUnderAttack SettingEditResponseZonesSecurityLevelValue = "under_attack" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesSecurityLevelEditable bool - -const ( - SettingEditResponseZonesSecurityLevelEditableTrue SettingEditResponseZonesSecurityLevelEditable = true - SettingEditResponseZonesSecurityLevelEditableFalse SettingEditResponseZonesSecurityLevelEditable = false -) - -// If there is sensitive content on your website that you want visible to real -// visitors, but that you want to hide from suspicious visitors, all you have to do -// is wrap the content with Cloudflare SSE tags. Wrap any content that you want to -// be excluded from suspicious visitors in the following SSE tags: -// . For example: Bad visitors won't see my phone -// number, 555-555-5555 . Note: SSE only will work with HTML. If you -// have HTML minification enabled, you won't see the SSE tags in your HTML source -// when it's served through Cloudflare. SSE will still function in this case, as -// Cloudflare's HTML minification and SSE functionality occur on-the-fly as the -// resource moves through our network to the visitor's computer. -// (https://support.cloudflare.com/hc/en-us/articles/200170036). -type SettingEditResponseZonesServerSideExclude struct { - // ID of the zone setting. - ID SettingEditResponseZonesServerSideExcludeID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesServerSideExcludeValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesServerSideExcludeEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesServerSideExcludeJSON `json:"-"` -} - -// settingEditResponseZonesServerSideExcludeJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesServerSideExclude] -type settingEditResponseZonesServerSideExcludeJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesServerSideExclude) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesServerSideExclude) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesServerSideExcludeID string - -const ( - SettingEditResponseZonesServerSideExcludeIDServerSideExclude SettingEditResponseZonesServerSideExcludeID = "server_side_exclude" -) - -// Current value of the zone setting. -type SettingEditResponseZonesServerSideExcludeValue string - -const ( - SettingEditResponseZonesServerSideExcludeValueOn SettingEditResponseZonesServerSideExcludeValue = "on" - SettingEditResponseZonesServerSideExcludeValueOff SettingEditResponseZonesServerSideExcludeValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesServerSideExcludeEditable bool - -const ( - SettingEditResponseZonesServerSideExcludeEditableTrue SettingEditResponseZonesServerSideExcludeEditable = true - SettingEditResponseZonesServerSideExcludeEditableFalse SettingEditResponseZonesServerSideExcludeEditable = false -) - -// Allow SHA1 support. -type SettingEditResponseZonesSha1Support struct { - // Zone setting identifier. - ID SettingEditResponseZonesSha1SupportID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesSha1SupportValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesSha1SupportEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesSha1SupportJSON `json:"-"` -} - -// settingEditResponseZonesSha1SupportJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesSha1Support] -type settingEditResponseZonesSha1SupportJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesSha1Support) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesSha1Support) implementsSettingEditResponse() {} - -// Zone setting identifier. -type SettingEditResponseZonesSha1SupportID string - -const ( - SettingEditResponseZonesSha1SupportIDSha1Support SettingEditResponseZonesSha1SupportID = "sha1_support" -) - -// Current value of the zone setting. -type SettingEditResponseZonesSha1SupportValue string - -const ( - SettingEditResponseZonesSha1SupportValueOff SettingEditResponseZonesSha1SupportValue = "off" - SettingEditResponseZonesSha1SupportValueOn SettingEditResponseZonesSha1SupportValue = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesSha1SupportEditable bool - -const ( - SettingEditResponseZonesSha1SupportEditableTrue SettingEditResponseZonesSha1SupportEditable = true - SettingEditResponseZonesSha1SupportEditableFalse SettingEditResponseZonesSha1SupportEditable = false -) - -// Cloudflare will treat files with the same query strings as the same file in -// cache, regardless of the order of the query strings. This is limited to -// Enterprise Zones. -type SettingEditResponseZonesSortQueryStringForCache struct { - // ID of the zone setting. - ID SettingEditResponseZonesSortQueryStringForCacheID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesSortQueryStringForCacheValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesSortQueryStringForCacheEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesSortQueryStringForCacheJSON `json:"-"` -} - -// settingEditResponseZonesSortQueryStringForCacheJSON contains the JSON metadata -// for the struct [SettingEditResponseZonesSortQueryStringForCache] -type settingEditResponseZonesSortQueryStringForCacheJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesSortQueryStringForCache) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesSortQueryStringForCache) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesSortQueryStringForCacheID string - -const ( - SettingEditResponseZonesSortQueryStringForCacheIDSortQueryStringForCache SettingEditResponseZonesSortQueryStringForCacheID = "sort_query_string_for_cache" -) - -// Current value of the zone setting. -type SettingEditResponseZonesSortQueryStringForCacheValue string - -const ( - SettingEditResponseZonesSortQueryStringForCacheValueOn SettingEditResponseZonesSortQueryStringForCacheValue = "on" - SettingEditResponseZonesSortQueryStringForCacheValueOff SettingEditResponseZonesSortQueryStringForCacheValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesSortQueryStringForCacheEditable bool - -const ( - SettingEditResponseZonesSortQueryStringForCacheEditableTrue SettingEditResponseZonesSortQueryStringForCacheEditable = true - SettingEditResponseZonesSortQueryStringForCacheEditableFalse SettingEditResponseZonesSortQueryStringForCacheEditable = false -) - -// SSL encrypts your visitor's connection and safeguards credit card numbers and -// other personal data to and from your website. SSL can take up to 5 minutes to -// fully activate. Requires Cloudflare active on your root domain or www domain. -// Off: no SSL between the visitor and Cloudflare, and no SSL between Cloudflare -// and your web server (all HTTP traffic). Flexible: SSL between the visitor and -// Cloudflare -- visitor sees HTTPS on your site, but no SSL between Cloudflare and -// your web server. You don't need to have an SSL cert on your web server, but your -// vistors will still see the site as being HTTPS enabled. Full: SSL between the -// visitor and Cloudflare -- visitor sees HTTPS on your site, and SSL between -// Cloudflare and your web server. You'll need to have your own SSL cert or -// self-signed cert at the very least. Full (Strict): SSL between the visitor and -// Cloudflare -- visitor sees HTTPS on your site, and SSL between Cloudflare and -// your web server. You'll need to have a valid SSL certificate installed on your -// web server. This certificate must be signed by a certificate authority, have an -// expiration date in the future, and respond for the request domain name -// (hostname). (https://support.cloudflare.com/hc/en-us/articles/200170416). -type SettingEditResponseZonesSSL struct { - // ID of the zone setting. - ID SettingEditResponseZonesSSLID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesSSLValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesSSLEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesSSLJSON `json:"-"` -} - -// settingEditResponseZonesSSLJSON contains the JSON metadata for the struct -// [SettingEditResponseZonesSSL] -type settingEditResponseZonesSSLJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesSSL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesSSL) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesSSLID string - -const ( - SettingEditResponseZonesSSLIDSSL SettingEditResponseZonesSSLID = "ssl" -) - -// Current value of the zone setting. -type SettingEditResponseZonesSSLValue string - -const ( - SettingEditResponseZonesSSLValueOff SettingEditResponseZonesSSLValue = "off" - SettingEditResponseZonesSSLValueFlexible SettingEditResponseZonesSSLValue = "flexible" - SettingEditResponseZonesSSLValueFull SettingEditResponseZonesSSLValue = "full" - SettingEditResponseZonesSSLValueStrict SettingEditResponseZonesSSLValue = "strict" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesSSLEditable bool - -const ( - SettingEditResponseZonesSSLEditableTrue SettingEditResponseZonesSSLEditable = true - SettingEditResponseZonesSSLEditableFalse SettingEditResponseZonesSSLEditable = false -) - -// Enrollment in the SSL/TLS Recommender service which tries to detect and -// recommend (by sending periodic emails) the most secure SSL/TLS setting your -// origin servers support. -type SettingEditResponseZonesSSLRecommender struct { - // Enrollment value for SSL/TLS Recommender. - ID SettingEditResponseZonesSSLRecommenderID `json:"id"` - // ssl-recommender enrollment setting. - Enabled bool `json:"enabled"` - JSON settingEditResponseZonesSSLRecommenderJSON `json:"-"` -} - -// settingEditResponseZonesSSLRecommenderJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesSSLRecommender] -type settingEditResponseZonesSSLRecommenderJSON struct { - ID apijson.Field - Enabled apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesSSLRecommender) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesSSLRecommender) implementsSettingEditResponse() {} - -// Enrollment value for SSL/TLS Recommender. -type SettingEditResponseZonesSSLRecommenderID string - -const ( - SettingEditResponseZonesSSLRecommenderIDSSLRecommender SettingEditResponseZonesSSLRecommenderID = "ssl_recommender" -) - -// Only allows TLS1.2. -type SettingEditResponseZonesTLS1_2Only struct { - // Zone setting identifier. - ID SettingEditResponseZonesTLS1_2OnlyID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesTLS1_2OnlyValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesTLS1_2OnlyEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesTls1_2OnlyJSON `json:"-"` -} - -// settingEditResponseZonesTls1_2OnlyJSON contains the JSON metadata for the struct -// [SettingEditResponseZonesTLS1_2Only] -type settingEditResponseZonesTls1_2OnlyJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesTLS1_2Only) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesTLS1_2Only) implementsSettingEditResponse() {} - -// Zone setting identifier. -type SettingEditResponseZonesTLS1_2OnlyID string - -const ( - SettingEditResponseZonesTLS1_2OnlyIDTLS1_2Only SettingEditResponseZonesTLS1_2OnlyID = "tls_1_2_only" -) - -// Current value of the zone setting. -type SettingEditResponseZonesTLS1_2OnlyValue string - -const ( - SettingEditResponseZonesTLS1_2OnlyValueOff SettingEditResponseZonesTLS1_2OnlyValue = "off" - SettingEditResponseZonesTLS1_2OnlyValueOn SettingEditResponseZonesTLS1_2OnlyValue = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesTLS1_2OnlyEditable bool - -const ( - SettingEditResponseZonesTLS1_2OnlyEditableTrue SettingEditResponseZonesTLS1_2OnlyEditable = true - SettingEditResponseZonesTLS1_2OnlyEditableFalse SettingEditResponseZonesTLS1_2OnlyEditable = false -) - -// Enables Crypto TLS 1.3 feature for a zone. -type SettingEditResponseZonesTLS1_3 struct { - // ID of the zone setting. - ID SettingEditResponseZonesTLS1_3ID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesTLS1_3Value `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesTLS1_3Editable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesTls1_3JSON `json:"-"` -} - -// settingEditResponseZonesTls1_3JSON contains the JSON metadata for the struct -// [SettingEditResponseZonesTLS1_3] -type settingEditResponseZonesTls1_3JSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesTLS1_3) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesTLS1_3) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesTLS1_3ID string - -const ( - SettingEditResponseZonesTLS1_3IDTLS1_3 SettingEditResponseZonesTLS1_3ID = "tls_1_3" -) - -// Current value of the zone setting. -type SettingEditResponseZonesTLS1_3Value string - -const ( - SettingEditResponseZonesTLS1_3ValueOn SettingEditResponseZonesTLS1_3Value = "on" - SettingEditResponseZonesTLS1_3ValueOff SettingEditResponseZonesTLS1_3Value = "off" - SettingEditResponseZonesTLS1_3ValueZrt SettingEditResponseZonesTLS1_3Value = "zrt" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesTLS1_3Editable bool - -const ( - SettingEditResponseZonesTLS1_3EditableTrue SettingEditResponseZonesTLS1_3Editable = true - SettingEditResponseZonesTLS1_3EditableFalse SettingEditResponseZonesTLS1_3Editable = false -) - -// TLS Client Auth requires Cloudflare to connect to your origin server using a -// client certificate (Enterprise Only). -type SettingEditResponseZonesTLSClientAuth struct { - // ID of the zone setting. - ID SettingEditResponseZonesTLSClientAuthID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesTLSClientAuthValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesTLSClientAuthEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesTLSClientAuthJSON `json:"-"` -} - -// settingEditResponseZonesTLSClientAuthJSON contains the JSON metadata for the -// struct [SettingEditResponseZonesTLSClientAuth] -type settingEditResponseZonesTLSClientAuthJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesTLSClientAuth) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesTLSClientAuth) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesTLSClientAuthID string - -const ( - SettingEditResponseZonesTLSClientAuthIDTLSClientAuth SettingEditResponseZonesTLSClientAuthID = "tls_client_auth" -) - -// Current value of the zone setting. -type SettingEditResponseZonesTLSClientAuthValue string - -const ( - SettingEditResponseZonesTLSClientAuthValueOn SettingEditResponseZonesTLSClientAuthValue = "on" - SettingEditResponseZonesTLSClientAuthValueOff SettingEditResponseZonesTLSClientAuthValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesTLSClientAuthEditable bool - -const ( - SettingEditResponseZonesTLSClientAuthEditableTrue SettingEditResponseZonesTLSClientAuthEditable = true - SettingEditResponseZonesTLSClientAuthEditableFalse SettingEditResponseZonesTLSClientAuthEditable = false -) - -// Allows customer to continue to use True Client IP (Akamai feature) in the -// headers we send to the origin. This is limited to Enterprise Zones. -type SettingEditResponseZonesTrueClientIPHeader struct { - // ID of the zone setting. - ID SettingEditResponseZonesTrueClientIPHeaderID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesTrueClientIPHeaderValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesTrueClientIPHeaderEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesTrueClientIPHeaderJSON `json:"-"` -} - -// settingEditResponseZonesTrueClientIPHeaderJSON contains the JSON metadata for -// the struct [SettingEditResponseZonesTrueClientIPHeader] -type settingEditResponseZonesTrueClientIPHeaderJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesTrueClientIPHeader) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesTrueClientIPHeader) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesTrueClientIPHeaderID string - -const ( - SettingEditResponseZonesTrueClientIPHeaderIDTrueClientIPHeader SettingEditResponseZonesTrueClientIPHeaderID = "true_client_ip_header" -) - -// Current value of the zone setting. -type SettingEditResponseZonesTrueClientIPHeaderValue string - -const ( - SettingEditResponseZonesTrueClientIPHeaderValueOn SettingEditResponseZonesTrueClientIPHeaderValue = "on" - SettingEditResponseZonesTrueClientIPHeaderValueOff SettingEditResponseZonesTrueClientIPHeaderValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesTrueClientIPHeaderEditable bool - -const ( - SettingEditResponseZonesTrueClientIPHeaderEditableTrue SettingEditResponseZonesTrueClientIPHeaderEditable = true - SettingEditResponseZonesTrueClientIPHeaderEditableFalse SettingEditResponseZonesTrueClientIPHeaderEditable = false -) - -// The WAF examines HTTP requests to your website. It inspects both GET and POST -// requests and applies rules to help filter out illegitimate traffic from -// legitimate website visitors. The Cloudflare WAF inspects website addresses or -// URLs to detect anything out of the ordinary. If the Cloudflare WAF determines -// suspicious user behavior, then the WAF will 'challenge' the web visitor with a -// page that asks them to submit a CAPTCHA successfully to continue their action. -// If the challenge is failed, the action will be stopped. What this means is that -// Cloudflare's WAF will block any traffic identified as illegitimate before it -// reaches your origin web server. -// (https://support.cloudflare.com/hc/en-us/articles/200172016). -type SettingEditResponseZonesWAF struct { - // ID of the zone setting. - ID SettingEditResponseZonesWAFID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesWAFValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesWAFEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesWAFJSON `json:"-"` -} - -// settingEditResponseZonesWAFJSON contains the JSON metadata for the struct -// [SettingEditResponseZonesWAF] -type settingEditResponseZonesWAFJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesWAF) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesWAF) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesWAFID string - -const ( - SettingEditResponseZonesWAFIDWAF SettingEditResponseZonesWAFID = "waf" -) - -// Current value of the zone setting. -type SettingEditResponseZonesWAFValue string - -const ( - SettingEditResponseZonesWAFValueOn SettingEditResponseZonesWAFValue = "on" - SettingEditResponseZonesWAFValueOff SettingEditResponseZonesWAFValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesWAFEditable bool - -const ( - SettingEditResponseZonesWAFEditableTrue SettingEditResponseZonesWAFEditable = true - SettingEditResponseZonesWAFEditableFalse SettingEditResponseZonesWAFEditable = false -) - -// When the client requesting the image supports the WebP image codec, and WebP -// offers a performance advantage over the original image format, Cloudflare will -// serve a WebP version of the original image. -type SettingEditResponseZonesWebp struct { - // ID of the zone setting. - ID SettingEditResponseZonesWebpID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesWebpValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesWebpEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesWebpJSON `json:"-"` -} - -// settingEditResponseZonesWebpJSON contains the JSON metadata for the struct -// [SettingEditResponseZonesWebp] -type settingEditResponseZonesWebpJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesWebp) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesWebp) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesWebpID string - -const ( - SettingEditResponseZonesWebpIDWebp SettingEditResponseZonesWebpID = "webp" -) - -// Current value of the zone setting. -type SettingEditResponseZonesWebpValue string - -const ( - SettingEditResponseZonesWebpValueOff SettingEditResponseZonesWebpValue = "off" - SettingEditResponseZonesWebpValueOn SettingEditResponseZonesWebpValue = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesWebpEditable bool - -const ( - SettingEditResponseZonesWebpEditableTrue SettingEditResponseZonesWebpEditable = true - SettingEditResponseZonesWebpEditableFalse SettingEditResponseZonesWebpEditable = false -) - -// WebSockets are open connections sustained between the client and the origin -// server. Inside a WebSockets connection, the client and the origin can pass data -// back and forth without having to reestablish sessions. This makes exchanging -// data within a WebSockets connection fast. WebSockets are often used for -// real-time applications such as live chat and gaming. For more information refer -// to -// [Can I use Cloudflare with Websockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Can-I-use-Cloudflare-with-WebSockets-). -type SettingEditResponseZonesWebsockets struct { - // ID of the zone setting. - ID SettingEditResponseZonesWebsocketsID `json:"id,required"` - // Current value of the zone setting. - Value SettingEditResponseZonesWebsocketsValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEditResponseZonesWebsocketsEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEditResponseZonesWebsocketsJSON `json:"-"` -} - -// settingEditResponseZonesWebsocketsJSON contains the JSON metadata for the struct -// [SettingEditResponseZonesWebsockets] -type settingEditResponseZonesWebsocketsJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseZonesWebsockets) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r SettingEditResponseZonesWebsockets) implementsSettingEditResponse() {} - -// ID of the zone setting. -type SettingEditResponseZonesWebsocketsID string - -const ( - SettingEditResponseZonesWebsocketsIDWebsockets SettingEditResponseZonesWebsocketsID = "websockets" -) - -// Current value of the zone setting. -type SettingEditResponseZonesWebsocketsValue string - -const ( - SettingEditResponseZonesWebsocketsValueOff SettingEditResponseZonesWebsocketsValue = "off" - SettingEditResponseZonesWebsocketsValueOn SettingEditResponseZonesWebsocketsValue = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditResponseZonesWebsocketsEditable bool - -const ( - SettingEditResponseZonesWebsocketsEditableTrue SettingEditResponseZonesWebsocketsEditable = true - SettingEditResponseZonesWebsocketsEditableFalse SettingEditResponseZonesWebsocketsEditable = false -) - -type SettingListParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingListResponseEnvelope struct { - Errors []SettingListResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingListResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - Result []SettingListResponse `json:"result"` - JSON settingListResponseEnvelopeJSON `json:"-"` -} - -// settingListResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingListResponseEnvelope] -type settingListResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingListResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingListResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingListResponseEnvelopeErrorsJSON contains the JSON metadata for the struct -// [SettingListResponseEnvelopeErrors] -type settingListResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingListResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingListResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingListResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingListResponseEnvelopeMessages] -type settingListResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // One or more zone setting objects. Must contain an ID and a value. - Items param.Field[[]SettingEditParamsItem] `json:"items,required"` -} - -func (r SettingEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// 0-RTT session resumption enabled for this zone. -// -// Satisfied by [SettingEditParamsItemsZones0rtt], -// [SettingEditParamsItemsZonesAdvancedDDOS], -// [SettingEditParamsItemsZonesAlwaysOnline], -// [SettingEditParamsItemsZonesAlwaysUseHTTPS], -// [SettingEditParamsItemsZonesAutomaticHTTPSRewrites], -// [SettingEditParamsItemsZonesBrotli], -// [SettingEditParamsItemsZonesBrowserCacheTTL], -// [SettingEditParamsItemsZonesBrowserCheck], -// [SettingEditParamsItemsZonesCacheLevel], -// [SettingEditParamsItemsZonesChallengeTTL], [SettingEditParamsItemsZonesCiphers], -// [SettingEditParamsItemsZonesCnameFlattening], -// [SettingEditParamsItemsZonesDevelopmentMode], -// [SettingEditParamsItemsZonesEarlyHints], -// [SettingEditParamsItemsZonesEdgeCacheTTL], -// [SettingEditParamsItemsZonesEmailObfuscation], -// [SettingEditParamsItemsZonesH2Prioritization], -// [SettingEditParamsItemsZonesHotlinkProtection], -// [SettingEditParamsItemsZonesHTTP2], [SettingEditParamsItemsZonesHTTP3], -// [SettingEditParamsItemsZonesImageResizing], -// [SettingEditParamsItemsZonesIPGeolocation], [SettingEditParamsItemsZonesIPV6], -// [SettingEditParamsItemsZonesMaxUpload], -// [SettingEditParamsItemsZonesMinTLSVersion], [SettingEditParamsItemsZonesMinify], -// [SettingEditParamsItemsZonesMirage], -// [SettingEditParamsItemsZonesMobileRedirect], [SettingEditParamsItemsZonesNEL], -// [SettingEditParamsItemsZonesOpportunisticEncryption], -// [SettingEditParamsItemsZonesOpportunisticOnion], -// [SettingEditParamsItemsZonesOrangeToOrange], -// [SettingEditParamsItemsZonesOriginErrorPagePassThru], -// [SettingEditParamsItemsZonesPolish], -// [SettingEditParamsItemsZonesPrefetchPreload], -// [SettingEditParamsItemsZonesProxyReadTimeout], -// [SettingEditParamsItemsZonesPseudoIPV4], -// [SettingEditParamsItemsZonesResponseBuffering], -// [SettingEditParamsItemsZonesRocketLoader], -// [SettingEditParamsItemsZonesSchemasAutomaticPlatformOptimization], -// [SettingEditParamsItemsZonesSecurityHeader], -// [SettingEditParamsItemsZonesSecurityLevel], -// [SettingEditParamsItemsZonesServerSideExclude], -// [SettingEditParamsItemsZonesSha1Support], -// [SettingEditParamsItemsZonesSortQueryStringForCache], -// [SettingEditParamsItemsZonesSSL], [SettingEditParamsItemsZonesSSLRecommender], -// [SettingEditParamsItemsZonesTLS1_2Only], [SettingEditParamsItemsZonesTLS1_3], -// [SettingEditParamsItemsZonesTLSClientAuth], -// [SettingEditParamsItemsZonesTrueClientIPHeader], -// [SettingEditParamsItemsZonesWAF], [SettingEditParamsItemsZonesWebp], -// [SettingEditParamsItemsZonesWebsockets]. -type SettingEditParamsItem interface { - implementsSettingEditParamsItem() -} - -// 0-RTT session resumption enabled for this zone. -type SettingEditParamsItemsZones0rtt struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZones0rttID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZones0rttValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZones0rtt) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZones0rtt) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZones0rttID string - -const ( - SettingEditParamsItemsZones0rttID0rtt SettingEditParamsItemsZones0rttID = "0rtt" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZones0rttValue string - -const ( - SettingEditParamsItemsZones0rttValueOn SettingEditParamsItemsZones0rttValue = "on" - SettingEditParamsItemsZones0rttValueOff SettingEditParamsItemsZones0rttValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZones0rttEditable bool - -const ( - SettingEditParamsItemsZones0rttEditableTrue SettingEditParamsItemsZones0rttEditable = true - SettingEditParamsItemsZones0rttEditableFalse SettingEditParamsItemsZones0rttEditable = false -) - -// Advanced protection from Distributed Denial of Service (DDoS) attacks on your -// website. This is an uneditable value that is 'on' in the case of Business and -// Enterprise zones. -type SettingEditParamsItemsZonesAdvancedDDOS struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesAdvancedDDOSID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesAdvancedDDOSValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesAdvancedDDOS) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesAdvancedDDOS) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesAdvancedDDOSID string - -const ( - SettingEditParamsItemsZonesAdvancedDDOSIDAdvancedDDOS SettingEditParamsItemsZonesAdvancedDDOSID = "advanced_ddos" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesAdvancedDDOSValue string - -const ( - SettingEditParamsItemsZonesAdvancedDDOSValueOn SettingEditParamsItemsZonesAdvancedDDOSValue = "on" - SettingEditParamsItemsZonesAdvancedDDOSValueOff SettingEditParamsItemsZonesAdvancedDDOSValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesAdvancedDDOSEditable bool - -const ( - SettingEditParamsItemsZonesAdvancedDDOSEditableTrue SettingEditParamsItemsZonesAdvancedDDOSEditable = true - SettingEditParamsItemsZonesAdvancedDDOSEditableFalse SettingEditParamsItemsZonesAdvancedDDOSEditable = false -) - -// When enabled, Cloudflare serves limited copies of web pages available from the -// [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is -// offline. Refer to -// [Always Online](https://developers.cloudflare.com/cache/about/always-online) for -// more information. -type SettingEditParamsItemsZonesAlwaysOnline struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesAlwaysOnlineID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesAlwaysOnlineValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesAlwaysOnline) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesAlwaysOnline) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesAlwaysOnlineID string - -const ( - SettingEditParamsItemsZonesAlwaysOnlineIDAlwaysOnline SettingEditParamsItemsZonesAlwaysOnlineID = "always_online" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesAlwaysOnlineValue string - -const ( - SettingEditParamsItemsZonesAlwaysOnlineValueOn SettingEditParamsItemsZonesAlwaysOnlineValue = "on" - SettingEditParamsItemsZonesAlwaysOnlineValueOff SettingEditParamsItemsZonesAlwaysOnlineValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesAlwaysOnlineEditable bool - -const ( - SettingEditParamsItemsZonesAlwaysOnlineEditableTrue SettingEditParamsItemsZonesAlwaysOnlineEditable = true - SettingEditParamsItemsZonesAlwaysOnlineEditableFalse SettingEditParamsItemsZonesAlwaysOnlineEditable = false -) - -// Reply to all requests for URLs that use "http" with a 301 redirect to the -// equivalent "https" URL. If you only want to redirect for a subset of requests, -// consider creating an "Always use HTTPS" page rule. -type SettingEditParamsItemsZonesAlwaysUseHTTPS struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesAlwaysUseHTTPSID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesAlwaysUseHTTPSValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesAlwaysUseHTTPS) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesAlwaysUseHTTPS) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesAlwaysUseHTTPSID string - -const ( - SettingEditParamsItemsZonesAlwaysUseHTTPSIDAlwaysUseHTTPS SettingEditParamsItemsZonesAlwaysUseHTTPSID = "always_use_https" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesAlwaysUseHTTPSValue string - -const ( - SettingEditParamsItemsZonesAlwaysUseHTTPSValueOn SettingEditParamsItemsZonesAlwaysUseHTTPSValue = "on" - SettingEditParamsItemsZonesAlwaysUseHTTPSValueOff SettingEditParamsItemsZonesAlwaysUseHTTPSValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesAlwaysUseHTTPSEditable bool - -const ( - SettingEditParamsItemsZonesAlwaysUseHTTPSEditableTrue SettingEditParamsItemsZonesAlwaysUseHTTPSEditable = true - SettingEditParamsItemsZonesAlwaysUseHTTPSEditableFalse SettingEditParamsItemsZonesAlwaysUseHTTPSEditable = false -) - -// Enable the Automatic HTTPS Rewrites feature for this zone. -type SettingEditParamsItemsZonesAutomaticHTTPSRewrites struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesAutomaticHTTPSRewritesID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesAutomaticHTTPSRewritesValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesAutomaticHTTPSRewrites) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesAutomaticHTTPSRewrites) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesAutomaticHTTPSRewritesID string - -const ( - SettingEditParamsItemsZonesAutomaticHTTPSRewritesIDAutomaticHTTPSRewrites SettingEditParamsItemsZonesAutomaticHTTPSRewritesID = "automatic_https_rewrites" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesAutomaticHTTPSRewritesValue string - -const ( - SettingEditParamsItemsZonesAutomaticHTTPSRewritesValueOn SettingEditParamsItemsZonesAutomaticHTTPSRewritesValue = "on" - SettingEditParamsItemsZonesAutomaticHTTPSRewritesValueOff SettingEditParamsItemsZonesAutomaticHTTPSRewritesValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesAutomaticHTTPSRewritesEditable bool - -const ( - SettingEditParamsItemsZonesAutomaticHTTPSRewritesEditableTrue SettingEditParamsItemsZonesAutomaticHTTPSRewritesEditable = true - SettingEditParamsItemsZonesAutomaticHTTPSRewritesEditableFalse SettingEditParamsItemsZonesAutomaticHTTPSRewritesEditable = false -) - -// When the client requesting an asset supports the Brotli compression algorithm, -// Cloudflare will serve a Brotli compressed version of the asset. -type SettingEditParamsItemsZonesBrotli struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesBrotliID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesBrotliValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesBrotli) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesBrotli) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesBrotliID string - -const ( - SettingEditParamsItemsZonesBrotliIDBrotli SettingEditParamsItemsZonesBrotliID = "brotli" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesBrotliValue string - -const ( - SettingEditParamsItemsZonesBrotliValueOff SettingEditParamsItemsZonesBrotliValue = "off" - SettingEditParamsItemsZonesBrotliValueOn SettingEditParamsItemsZonesBrotliValue = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesBrotliEditable bool - -const ( - SettingEditParamsItemsZonesBrotliEditableTrue SettingEditParamsItemsZonesBrotliEditable = true - SettingEditParamsItemsZonesBrotliEditableFalse SettingEditParamsItemsZonesBrotliEditable = false -) - -// Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources -// will remain on your visitors' computers. Cloudflare will honor any larger times -// specified by your server. -// (https://support.cloudflare.com/hc/en-us/articles/200168276). -type SettingEditParamsItemsZonesBrowserCacheTTL struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesBrowserCacheTTLID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesBrowserCacheTTLValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesBrowserCacheTTL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesBrowserCacheTTL) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesBrowserCacheTTLID string - -const ( - SettingEditParamsItemsZonesBrowserCacheTTLIDBrowserCacheTTL SettingEditParamsItemsZonesBrowserCacheTTLID = "browser_cache_ttl" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesBrowserCacheTTLValue float64 - -const ( - SettingEditParamsItemsZonesBrowserCacheTTLValue0 SettingEditParamsItemsZonesBrowserCacheTTLValue = 0 - SettingEditParamsItemsZonesBrowserCacheTTLValue30 SettingEditParamsItemsZonesBrowserCacheTTLValue = 30 - SettingEditParamsItemsZonesBrowserCacheTTLValue60 SettingEditParamsItemsZonesBrowserCacheTTLValue = 60 - SettingEditParamsItemsZonesBrowserCacheTTLValue120 SettingEditParamsItemsZonesBrowserCacheTTLValue = 120 - SettingEditParamsItemsZonesBrowserCacheTTLValue300 SettingEditParamsItemsZonesBrowserCacheTTLValue = 300 - SettingEditParamsItemsZonesBrowserCacheTTLValue1200 SettingEditParamsItemsZonesBrowserCacheTTLValue = 1200 - SettingEditParamsItemsZonesBrowserCacheTTLValue1800 SettingEditParamsItemsZonesBrowserCacheTTLValue = 1800 - SettingEditParamsItemsZonesBrowserCacheTTLValue3600 SettingEditParamsItemsZonesBrowserCacheTTLValue = 3600 - SettingEditParamsItemsZonesBrowserCacheTTLValue7200 SettingEditParamsItemsZonesBrowserCacheTTLValue = 7200 - SettingEditParamsItemsZonesBrowserCacheTTLValue10800 SettingEditParamsItemsZonesBrowserCacheTTLValue = 10800 - SettingEditParamsItemsZonesBrowserCacheTTLValue14400 SettingEditParamsItemsZonesBrowserCacheTTLValue = 14400 - SettingEditParamsItemsZonesBrowserCacheTTLValue18000 SettingEditParamsItemsZonesBrowserCacheTTLValue = 18000 - SettingEditParamsItemsZonesBrowserCacheTTLValue28800 SettingEditParamsItemsZonesBrowserCacheTTLValue = 28800 - SettingEditParamsItemsZonesBrowserCacheTTLValue43200 SettingEditParamsItemsZonesBrowserCacheTTLValue = 43200 - SettingEditParamsItemsZonesBrowserCacheTTLValue57600 SettingEditParamsItemsZonesBrowserCacheTTLValue = 57600 - SettingEditParamsItemsZonesBrowserCacheTTLValue72000 SettingEditParamsItemsZonesBrowserCacheTTLValue = 72000 - SettingEditParamsItemsZonesBrowserCacheTTLValue86400 SettingEditParamsItemsZonesBrowserCacheTTLValue = 86400 - SettingEditParamsItemsZonesBrowserCacheTTLValue172800 SettingEditParamsItemsZonesBrowserCacheTTLValue = 172800 - SettingEditParamsItemsZonesBrowserCacheTTLValue259200 SettingEditParamsItemsZonesBrowserCacheTTLValue = 259200 - SettingEditParamsItemsZonesBrowserCacheTTLValue345600 SettingEditParamsItemsZonesBrowserCacheTTLValue = 345600 - SettingEditParamsItemsZonesBrowserCacheTTLValue432000 SettingEditParamsItemsZonesBrowserCacheTTLValue = 432000 - SettingEditParamsItemsZonesBrowserCacheTTLValue691200 SettingEditParamsItemsZonesBrowserCacheTTLValue = 691200 - SettingEditParamsItemsZonesBrowserCacheTTLValue1382400 SettingEditParamsItemsZonesBrowserCacheTTLValue = 1382400 - SettingEditParamsItemsZonesBrowserCacheTTLValue2073600 SettingEditParamsItemsZonesBrowserCacheTTLValue = 2073600 - SettingEditParamsItemsZonesBrowserCacheTTLValue2678400 SettingEditParamsItemsZonesBrowserCacheTTLValue = 2678400 - SettingEditParamsItemsZonesBrowserCacheTTLValue5356800 SettingEditParamsItemsZonesBrowserCacheTTLValue = 5356800 - SettingEditParamsItemsZonesBrowserCacheTTLValue16070400 SettingEditParamsItemsZonesBrowserCacheTTLValue = 16070400 - SettingEditParamsItemsZonesBrowserCacheTTLValue31536000 SettingEditParamsItemsZonesBrowserCacheTTLValue = 31536000 -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesBrowserCacheTTLEditable bool - -const ( - SettingEditParamsItemsZonesBrowserCacheTTLEditableTrue SettingEditParamsItemsZonesBrowserCacheTTLEditable = true - SettingEditParamsItemsZonesBrowserCacheTTLEditableFalse SettingEditParamsItemsZonesBrowserCacheTTLEditable = false -) - -// Browser Integrity Check is similar to Bad Behavior and looks for common HTTP -// headers abused most commonly by spammers and denies access to your page. It will -// also challenge visitors that do not have a user agent or a non standard user -// agent (also commonly used by abuse bots, crawlers or visitors). -// (https://support.cloudflare.com/hc/en-us/articles/200170086). -type SettingEditParamsItemsZonesBrowserCheck struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesBrowserCheckID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesBrowserCheckValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesBrowserCheck) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesBrowserCheck) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesBrowserCheckID string - -const ( - SettingEditParamsItemsZonesBrowserCheckIDBrowserCheck SettingEditParamsItemsZonesBrowserCheckID = "browser_check" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesBrowserCheckValue string - -const ( - SettingEditParamsItemsZonesBrowserCheckValueOn SettingEditParamsItemsZonesBrowserCheckValue = "on" - SettingEditParamsItemsZonesBrowserCheckValueOff SettingEditParamsItemsZonesBrowserCheckValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesBrowserCheckEditable bool - -const ( - SettingEditParamsItemsZonesBrowserCheckEditableTrue SettingEditParamsItemsZonesBrowserCheckEditable = true - SettingEditParamsItemsZonesBrowserCheckEditableFalse SettingEditParamsItemsZonesBrowserCheckEditable = false -) - -// Cache Level functions based off the setting level. The basic setting will cache -// most static resources (i.e., css, images, and JavaScript). The simplified -// setting will ignore the query string when delivering a cached resource. The -// aggressive setting will cache all static resources, including ones with a query -// string. (https://support.cloudflare.com/hc/en-us/articles/200168256). -type SettingEditParamsItemsZonesCacheLevel struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesCacheLevelID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesCacheLevelValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesCacheLevel) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesCacheLevel) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesCacheLevelID string - -const ( - SettingEditParamsItemsZonesCacheLevelIDCacheLevel SettingEditParamsItemsZonesCacheLevelID = "cache_level" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesCacheLevelValue string - -const ( - SettingEditParamsItemsZonesCacheLevelValueAggressive SettingEditParamsItemsZonesCacheLevelValue = "aggressive" - SettingEditParamsItemsZonesCacheLevelValueBasic SettingEditParamsItemsZonesCacheLevelValue = "basic" - SettingEditParamsItemsZonesCacheLevelValueSimplified SettingEditParamsItemsZonesCacheLevelValue = "simplified" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesCacheLevelEditable bool - -const ( - SettingEditParamsItemsZonesCacheLevelEditableTrue SettingEditParamsItemsZonesCacheLevelEditable = true - SettingEditParamsItemsZonesCacheLevelEditableFalse SettingEditParamsItemsZonesCacheLevelEditable = false -) - -// Specify how long a visitor is allowed access to your site after successfully -// completing a challenge (such as a CAPTCHA). After the TTL has expired the -// visitor will have to complete a new challenge. We recommend a 15 - 45 minute -// setting and will attempt to honor any setting above 45 minutes. -// (https://support.cloudflare.com/hc/en-us/articles/200170136). -type SettingEditParamsItemsZonesChallengeTTL struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesChallengeTTLID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesChallengeTTLValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesChallengeTTL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesChallengeTTL) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesChallengeTTLID string - -const ( - SettingEditParamsItemsZonesChallengeTTLIDChallengeTTL SettingEditParamsItemsZonesChallengeTTLID = "challenge_ttl" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesChallengeTTLValue float64 - -const ( - SettingEditParamsItemsZonesChallengeTTLValue300 SettingEditParamsItemsZonesChallengeTTLValue = 300 - SettingEditParamsItemsZonesChallengeTTLValue900 SettingEditParamsItemsZonesChallengeTTLValue = 900 - SettingEditParamsItemsZonesChallengeTTLValue1800 SettingEditParamsItemsZonesChallengeTTLValue = 1800 - SettingEditParamsItemsZonesChallengeTTLValue2700 SettingEditParamsItemsZonesChallengeTTLValue = 2700 - SettingEditParamsItemsZonesChallengeTTLValue3600 SettingEditParamsItemsZonesChallengeTTLValue = 3600 - SettingEditParamsItemsZonesChallengeTTLValue7200 SettingEditParamsItemsZonesChallengeTTLValue = 7200 - SettingEditParamsItemsZonesChallengeTTLValue10800 SettingEditParamsItemsZonesChallengeTTLValue = 10800 - SettingEditParamsItemsZonesChallengeTTLValue14400 SettingEditParamsItemsZonesChallengeTTLValue = 14400 - SettingEditParamsItemsZonesChallengeTTLValue28800 SettingEditParamsItemsZonesChallengeTTLValue = 28800 - SettingEditParamsItemsZonesChallengeTTLValue57600 SettingEditParamsItemsZonesChallengeTTLValue = 57600 - SettingEditParamsItemsZonesChallengeTTLValue86400 SettingEditParamsItemsZonesChallengeTTLValue = 86400 - SettingEditParamsItemsZonesChallengeTTLValue604800 SettingEditParamsItemsZonesChallengeTTLValue = 604800 - SettingEditParamsItemsZonesChallengeTTLValue2592000 SettingEditParamsItemsZonesChallengeTTLValue = 2592000 - SettingEditParamsItemsZonesChallengeTTLValue31536000 SettingEditParamsItemsZonesChallengeTTLValue = 31536000 -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesChallengeTTLEditable bool - -const ( - SettingEditParamsItemsZonesChallengeTTLEditableTrue SettingEditParamsItemsZonesChallengeTTLEditable = true - SettingEditParamsItemsZonesChallengeTTLEditableFalse SettingEditParamsItemsZonesChallengeTTLEditable = false -) - -// An allowlist of ciphers for TLS termination. These ciphers must be in the -// BoringSSL format. -type SettingEditParamsItemsZonesCiphers struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesCiphersID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[[]string] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesCiphers) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesCiphers) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesCiphersID string - -const ( - SettingEditParamsItemsZonesCiphersIDCiphers SettingEditParamsItemsZonesCiphersID = "ciphers" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesCiphersEditable bool - -const ( - SettingEditParamsItemsZonesCiphersEditableTrue SettingEditParamsItemsZonesCiphersEditable = true - SettingEditParamsItemsZonesCiphersEditableFalse SettingEditParamsItemsZonesCiphersEditable = false -) - -// Whether or not cname flattening is on. -type SettingEditParamsItemsZonesCnameFlattening struct { - // How to flatten the cname destination. - ID param.Field[SettingEditParamsItemsZonesCnameFlatteningID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesCnameFlatteningValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesCnameFlattening) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesCnameFlattening) implementsSettingEditParamsItem() {} - -// How to flatten the cname destination. -type SettingEditParamsItemsZonesCnameFlatteningID string - -const ( - SettingEditParamsItemsZonesCnameFlatteningIDCnameFlattening SettingEditParamsItemsZonesCnameFlatteningID = "cname_flattening" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesCnameFlatteningValue string - -const ( - SettingEditParamsItemsZonesCnameFlatteningValueFlattenAtRoot SettingEditParamsItemsZonesCnameFlatteningValue = "flatten_at_root" - SettingEditParamsItemsZonesCnameFlatteningValueFlattenAll SettingEditParamsItemsZonesCnameFlatteningValue = "flatten_all" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesCnameFlatteningEditable bool - -const ( - SettingEditParamsItemsZonesCnameFlatteningEditableTrue SettingEditParamsItemsZonesCnameFlatteningEditable = true - SettingEditParamsItemsZonesCnameFlatteningEditableFalse SettingEditParamsItemsZonesCnameFlatteningEditable = false -) - -// Development Mode temporarily allows you to enter development mode for your -// websites if you need to make changes to your site. This will bypass Cloudflare's -// accelerated cache and slow down your site, but is useful if you are making -// changes to cacheable content (like images, css, or JavaScript) and would like to -// see those changes right away. Once entered, development mode will last for 3 -// hours and then automatically toggle off. -type SettingEditParamsItemsZonesDevelopmentMode struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesDevelopmentModeID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesDevelopmentModeValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesDevelopmentMode) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesDevelopmentMode) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesDevelopmentModeID string - -const ( - SettingEditParamsItemsZonesDevelopmentModeIDDevelopmentMode SettingEditParamsItemsZonesDevelopmentModeID = "development_mode" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesDevelopmentModeValue string - -const ( - SettingEditParamsItemsZonesDevelopmentModeValueOn SettingEditParamsItemsZonesDevelopmentModeValue = "on" - SettingEditParamsItemsZonesDevelopmentModeValueOff SettingEditParamsItemsZonesDevelopmentModeValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesDevelopmentModeEditable bool - -const ( - SettingEditParamsItemsZonesDevelopmentModeEditableTrue SettingEditParamsItemsZonesDevelopmentModeEditable = true - SettingEditParamsItemsZonesDevelopmentModeEditableFalse SettingEditParamsItemsZonesDevelopmentModeEditable = false -) - -// When enabled, Cloudflare will attempt to speed up overall page loads by serving -// `103` responses with `Link` headers from the final response. Refer to -// [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for -// more information. -type SettingEditParamsItemsZonesEarlyHints struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesEarlyHintsID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesEarlyHintsValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesEarlyHints) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesEarlyHints) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesEarlyHintsID string - -const ( - SettingEditParamsItemsZonesEarlyHintsIDEarlyHints SettingEditParamsItemsZonesEarlyHintsID = "early_hints" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesEarlyHintsValue string - -const ( - SettingEditParamsItemsZonesEarlyHintsValueOn SettingEditParamsItemsZonesEarlyHintsValue = "on" - SettingEditParamsItemsZonesEarlyHintsValueOff SettingEditParamsItemsZonesEarlyHintsValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesEarlyHintsEditable bool - -const ( - SettingEditParamsItemsZonesEarlyHintsEditableTrue SettingEditParamsItemsZonesEarlyHintsEditable = true - SettingEditParamsItemsZonesEarlyHintsEditableFalse SettingEditParamsItemsZonesEarlyHintsEditable = false -) - -// Time (in seconds) that a resource will be ensured to remain on Cloudflare's -// cache servers. -type SettingEditParamsItemsZonesEdgeCacheTTL struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesEdgeCacheTTLID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesEdgeCacheTTLValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesEdgeCacheTTL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesEdgeCacheTTL) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesEdgeCacheTTLID string - -const ( - SettingEditParamsItemsZonesEdgeCacheTTLIDEdgeCacheTTL SettingEditParamsItemsZonesEdgeCacheTTLID = "edge_cache_ttl" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesEdgeCacheTTLValue float64 - -const ( - SettingEditParamsItemsZonesEdgeCacheTTLValue30 SettingEditParamsItemsZonesEdgeCacheTTLValue = 30 - SettingEditParamsItemsZonesEdgeCacheTTLValue60 SettingEditParamsItemsZonesEdgeCacheTTLValue = 60 - SettingEditParamsItemsZonesEdgeCacheTTLValue300 SettingEditParamsItemsZonesEdgeCacheTTLValue = 300 - SettingEditParamsItemsZonesEdgeCacheTTLValue1200 SettingEditParamsItemsZonesEdgeCacheTTLValue = 1200 - SettingEditParamsItemsZonesEdgeCacheTTLValue1800 SettingEditParamsItemsZonesEdgeCacheTTLValue = 1800 - SettingEditParamsItemsZonesEdgeCacheTTLValue3600 SettingEditParamsItemsZonesEdgeCacheTTLValue = 3600 - SettingEditParamsItemsZonesEdgeCacheTTLValue7200 SettingEditParamsItemsZonesEdgeCacheTTLValue = 7200 - SettingEditParamsItemsZonesEdgeCacheTTLValue10800 SettingEditParamsItemsZonesEdgeCacheTTLValue = 10800 - SettingEditParamsItemsZonesEdgeCacheTTLValue14400 SettingEditParamsItemsZonesEdgeCacheTTLValue = 14400 - SettingEditParamsItemsZonesEdgeCacheTTLValue18000 SettingEditParamsItemsZonesEdgeCacheTTLValue = 18000 - SettingEditParamsItemsZonesEdgeCacheTTLValue28800 SettingEditParamsItemsZonesEdgeCacheTTLValue = 28800 - SettingEditParamsItemsZonesEdgeCacheTTLValue43200 SettingEditParamsItemsZonesEdgeCacheTTLValue = 43200 - SettingEditParamsItemsZonesEdgeCacheTTLValue57600 SettingEditParamsItemsZonesEdgeCacheTTLValue = 57600 - SettingEditParamsItemsZonesEdgeCacheTTLValue72000 SettingEditParamsItemsZonesEdgeCacheTTLValue = 72000 - SettingEditParamsItemsZonesEdgeCacheTTLValue86400 SettingEditParamsItemsZonesEdgeCacheTTLValue = 86400 - SettingEditParamsItemsZonesEdgeCacheTTLValue172800 SettingEditParamsItemsZonesEdgeCacheTTLValue = 172800 - SettingEditParamsItemsZonesEdgeCacheTTLValue259200 SettingEditParamsItemsZonesEdgeCacheTTLValue = 259200 - SettingEditParamsItemsZonesEdgeCacheTTLValue345600 SettingEditParamsItemsZonesEdgeCacheTTLValue = 345600 - SettingEditParamsItemsZonesEdgeCacheTTLValue432000 SettingEditParamsItemsZonesEdgeCacheTTLValue = 432000 - SettingEditParamsItemsZonesEdgeCacheTTLValue518400 SettingEditParamsItemsZonesEdgeCacheTTLValue = 518400 - SettingEditParamsItemsZonesEdgeCacheTTLValue604800 SettingEditParamsItemsZonesEdgeCacheTTLValue = 604800 -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesEdgeCacheTTLEditable bool - -const ( - SettingEditParamsItemsZonesEdgeCacheTTLEditableTrue SettingEditParamsItemsZonesEdgeCacheTTLEditable = true - SettingEditParamsItemsZonesEdgeCacheTTLEditableFalse SettingEditParamsItemsZonesEdgeCacheTTLEditable = false -) - -// Encrypt email adresses on your web page from bots, while keeping them visible to -// humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). -type SettingEditParamsItemsZonesEmailObfuscation struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesEmailObfuscationID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesEmailObfuscationValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesEmailObfuscation) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesEmailObfuscation) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesEmailObfuscationID string - -const ( - SettingEditParamsItemsZonesEmailObfuscationIDEmailObfuscation SettingEditParamsItemsZonesEmailObfuscationID = "email_obfuscation" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesEmailObfuscationValue string - -const ( - SettingEditParamsItemsZonesEmailObfuscationValueOn SettingEditParamsItemsZonesEmailObfuscationValue = "on" - SettingEditParamsItemsZonesEmailObfuscationValueOff SettingEditParamsItemsZonesEmailObfuscationValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesEmailObfuscationEditable bool - -const ( - SettingEditParamsItemsZonesEmailObfuscationEditableTrue SettingEditParamsItemsZonesEmailObfuscationEditable = true - SettingEditParamsItemsZonesEmailObfuscationEditableFalse SettingEditParamsItemsZonesEmailObfuscationEditable = false -) - -// HTTP/2 Edge Prioritization optimises the delivery of resources served through -// HTTP/2 to improve page load performance. It also supports fine control of -// content delivery when used in conjunction with Workers. -type SettingEditParamsItemsZonesH2Prioritization struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesH2PrioritizationID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesH2PrioritizationValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesH2Prioritization) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesH2Prioritization) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesH2PrioritizationID string - -const ( - SettingEditParamsItemsZonesH2PrioritizationIDH2Prioritization SettingEditParamsItemsZonesH2PrioritizationID = "h2_prioritization" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesH2PrioritizationValue string - -const ( - SettingEditParamsItemsZonesH2PrioritizationValueOn SettingEditParamsItemsZonesH2PrioritizationValue = "on" - SettingEditParamsItemsZonesH2PrioritizationValueOff SettingEditParamsItemsZonesH2PrioritizationValue = "off" - SettingEditParamsItemsZonesH2PrioritizationValueCustom SettingEditParamsItemsZonesH2PrioritizationValue = "custom" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesH2PrioritizationEditable bool - -const ( - SettingEditParamsItemsZonesH2PrioritizationEditableTrue SettingEditParamsItemsZonesH2PrioritizationEditable = true - SettingEditParamsItemsZonesH2PrioritizationEditableFalse SettingEditParamsItemsZonesH2PrioritizationEditable = false -) - -// When enabled, the Hotlink Protection option ensures that other sites cannot suck -// up your bandwidth by building pages that use images hosted on your site. Anytime -// a request for an image on your site hits Cloudflare, we check to ensure that -// it's not another site requesting them. People will still be able to download and -// view images from your page, but other sites won't be able to steal them for use -// on their own pages. -// (https://support.cloudflare.com/hc/en-us/articles/200170026). -type SettingEditParamsItemsZonesHotlinkProtection struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesHotlinkProtectionID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesHotlinkProtectionValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesHotlinkProtection) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesHotlinkProtection) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesHotlinkProtectionID string - -const ( - SettingEditParamsItemsZonesHotlinkProtectionIDHotlinkProtection SettingEditParamsItemsZonesHotlinkProtectionID = "hotlink_protection" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesHotlinkProtectionValue string - -const ( - SettingEditParamsItemsZonesHotlinkProtectionValueOn SettingEditParamsItemsZonesHotlinkProtectionValue = "on" - SettingEditParamsItemsZonesHotlinkProtectionValueOff SettingEditParamsItemsZonesHotlinkProtectionValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesHotlinkProtectionEditable bool - -const ( - SettingEditParamsItemsZonesHotlinkProtectionEditableTrue SettingEditParamsItemsZonesHotlinkProtectionEditable = true - SettingEditParamsItemsZonesHotlinkProtectionEditableFalse SettingEditParamsItemsZonesHotlinkProtectionEditable = false -) - -// HTTP2 enabled for this zone. -type SettingEditParamsItemsZonesHTTP2 struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesHTTP2ID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesHTTP2Value] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesHTTP2) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesHTTP2) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesHTTP2ID string - -const ( - SettingEditParamsItemsZonesHTTP2IDHTTP2 SettingEditParamsItemsZonesHTTP2ID = "http2" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesHTTP2Value string - -const ( - SettingEditParamsItemsZonesHTTP2ValueOn SettingEditParamsItemsZonesHTTP2Value = "on" - SettingEditParamsItemsZonesHTTP2ValueOff SettingEditParamsItemsZonesHTTP2Value = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesHTTP2Editable bool - -const ( - SettingEditParamsItemsZonesHTTP2EditableTrue SettingEditParamsItemsZonesHTTP2Editable = true - SettingEditParamsItemsZonesHTTP2EditableFalse SettingEditParamsItemsZonesHTTP2Editable = false -) - -// HTTP3 enabled for this zone. -type SettingEditParamsItemsZonesHTTP3 struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesHTTP3ID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesHTTP3Value] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesHTTP3) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesHTTP3) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesHTTP3ID string - -const ( - SettingEditParamsItemsZonesHTTP3IDHTTP3 SettingEditParamsItemsZonesHTTP3ID = "http3" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesHTTP3Value string - -const ( - SettingEditParamsItemsZonesHTTP3ValueOn SettingEditParamsItemsZonesHTTP3Value = "on" - SettingEditParamsItemsZonesHTTP3ValueOff SettingEditParamsItemsZonesHTTP3Value = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesHTTP3Editable bool - -const ( - SettingEditParamsItemsZonesHTTP3EditableTrue SettingEditParamsItemsZonesHTTP3Editable = true - SettingEditParamsItemsZonesHTTP3EditableFalse SettingEditParamsItemsZonesHTTP3Editable = false -) - -// Image Resizing provides on-demand resizing, conversion and optimisation for -// images served through Cloudflare's network. Refer to the -// [Image Resizing documentation](https://developers.cloudflare.com/images/) for -// more information. -type SettingEditParamsItemsZonesImageResizing struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesImageResizingID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesImageResizingValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesImageResizing) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesImageResizing) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesImageResizingID string - -const ( - SettingEditParamsItemsZonesImageResizingIDImageResizing SettingEditParamsItemsZonesImageResizingID = "image_resizing" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesImageResizingValue string - -const ( - SettingEditParamsItemsZonesImageResizingValueOn SettingEditParamsItemsZonesImageResizingValue = "on" - SettingEditParamsItemsZonesImageResizingValueOff SettingEditParamsItemsZonesImageResizingValue = "off" - SettingEditParamsItemsZonesImageResizingValueOpen SettingEditParamsItemsZonesImageResizingValue = "open" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesImageResizingEditable bool - -const ( - SettingEditParamsItemsZonesImageResizingEditableTrue SettingEditParamsItemsZonesImageResizingEditable = true - SettingEditParamsItemsZonesImageResizingEditableFalse SettingEditParamsItemsZonesImageResizingEditable = false -) - -// Enable IP Geolocation to have Cloudflare geolocate visitors to your website and -// pass the country code to you. -// (https://support.cloudflare.com/hc/en-us/articles/200168236). -type SettingEditParamsItemsZonesIPGeolocation struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesIPGeolocationID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesIPGeolocationValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesIPGeolocation) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesIPGeolocation) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesIPGeolocationID string - -const ( - SettingEditParamsItemsZonesIPGeolocationIDIPGeolocation SettingEditParamsItemsZonesIPGeolocationID = "ip_geolocation" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesIPGeolocationValue string - -const ( - SettingEditParamsItemsZonesIPGeolocationValueOn SettingEditParamsItemsZonesIPGeolocationValue = "on" - SettingEditParamsItemsZonesIPGeolocationValueOff SettingEditParamsItemsZonesIPGeolocationValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesIPGeolocationEditable bool - -const ( - SettingEditParamsItemsZonesIPGeolocationEditableTrue SettingEditParamsItemsZonesIPGeolocationEditable = true - SettingEditParamsItemsZonesIPGeolocationEditableFalse SettingEditParamsItemsZonesIPGeolocationEditable = false -) - -// Enable IPv6 on all subdomains that are Cloudflare enabled. -// (https://support.cloudflare.com/hc/en-us/articles/200168586). -type SettingEditParamsItemsZonesIPV6 struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesIPV6ID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesIPV6Value] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesIPV6) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesIPV6) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesIPV6ID string - -const ( - SettingEditParamsItemsZonesIPV6IDIPV6 SettingEditParamsItemsZonesIPV6ID = "ipv6" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesIPV6Value string - -const ( - SettingEditParamsItemsZonesIPV6ValueOff SettingEditParamsItemsZonesIPV6Value = "off" - SettingEditParamsItemsZonesIPV6ValueOn SettingEditParamsItemsZonesIPV6Value = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesIPV6Editable bool - -const ( - SettingEditParamsItemsZonesIPV6EditableTrue SettingEditParamsItemsZonesIPV6Editable = true - SettingEditParamsItemsZonesIPV6EditableFalse SettingEditParamsItemsZonesIPV6Editable = false -) - -// Maximum size of an allowable upload. -type SettingEditParamsItemsZonesMaxUpload struct { - // identifier of the zone setting. - ID param.Field[SettingEditParamsItemsZonesMaxUploadID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesMaxUploadValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesMaxUpload) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesMaxUpload) implementsSettingEditParamsItem() {} - -// identifier of the zone setting. -type SettingEditParamsItemsZonesMaxUploadID string - -const ( - SettingEditParamsItemsZonesMaxUploadIDMaxUpload SettingEditParamsItemsZonesMaxUploadID = "max_upload" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesMaxUploadValue float64 - -const ( - SettingEditParamsItemsZonesMaxUploadValue100 SettingEditParamsItemsZonesMaxUploadValue = 100 - SettingEditParamsItemsZonesMaxUploadValue200 SettingEditParamsItemsZonesMaxUploadValue = 200 - SettingEditParamsItemsZonesMaxUploadValue500 SettingEditParamsItemsZonesMaxUploadValue = 500 -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesMaxUploadEditable bool - -const ( - SettingEditParamsItemsZonesMaxUploadEditableTrue SettingEditParamsItemsZonesMaxUploadEditable = true - SettingEditParamsItemsZonesMaxUploadEditableFalse SettingEditParamsItemsZonesMaxUploadEditable = false -) - -// Only accepts HTTPS requests that use at least the TLS protocol version -// specified. For example, if TLS 1.1 is selected, TLS 1.0 connections will be -// rejected, while 1.1, 1.2, and 1.3 (if enabled) will be permitted. -type SettingEditParamsItemsZonesMinTLSVersion struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesMinTLSVersionID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesMinTLSVersionValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesMinTLSVersion) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesMinTLSVersion) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesMinTLSVersionID string - -const ( - SettingEditParamsItemsZonesMinTLSVersionIDMinTLSVersion SettingEditParamsItemsZonesMinTLSVersionID = "min_tls_version" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesMinTLSVersionValue string - -const ( - SettingEditParamsItemsZonesMinTLSVersionValue1_0 SettingEditParamsItemsZonesMinTLSVersionValue = "1.0" - SettingEditParamsItemsZonesMinTLSVersionValue1_1 SettingEditParamsItemsZonesMinTLSVersionValue = "1.1" - SettingEditParamsItemsZonesMinTLSVersionValue1_2 SettingEditParamsItemsZonesMinTLSVersionValue = "1.2" - SettingEditParamsItemsZonesMinTLSVersionValue1_3 SettingEditParamsItemsZonesMinTLSVersionValue = "1.3" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesMinTLSVersionEditable bool - -const ( - SettingEditParamsItemsZonesMinTLSVersionEditableTrue SettingEditParamsItemsZonesMinTLSVersionEditable = true - SettingEditParamsItemsZonesMinTLSVersionEditableFalse SettingEditParamsItemsZonesMinTLSVersionEditable = false -) - -// Automatically minify certain assets for your website. Refer to -// [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) -// for more information. -type SettingEditParamsItemsZonesMinify struct { - // Zone setting identifier. - ID param.Field[SettingEditParamsItemsZonesMinifyID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesMinifyValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesMinify) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesMinify) implementsSettingEditParamsItem() {} - -// Zone setting identifier. -type SettingEditParamsItemsZonesMinifyID string - -const ( - SettingEditParamsItemsZonesMinifyIDMinify SettingEditParamsItemsZonesMinifyID = "minify" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesMinifyValue struct { - // Automatically minify all CSS files for your website. - Css param.Field[SettingEditParamsItemsZonesMinifyValueCss] `json:"css"` - // Automatically minify all HTML files for your website. - HTML param.Field[SettingEditParamsItemsZonesMinifyValueHTML] `json:"html"` - // Automatically minify all JavaScript files for your website. - Js param.Field[SettingEditParamsItemsZonesMinifyValueJs] `json:"js"` -} - -func (r SettingEditParamsItemsZonesMinifyValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Automatically minify all CSS files for your website. -type SettingEditParamsItemsZonesMinifyValueCss string - -const ( - SettingEditParamsItemsZonesMinifyValueCssOn SettingEditParamsItemsZonesMinifyValueCss = "on" - SettingEditParamsItemsZonesMinifyValueCssOff SettingEditParamsItemsZonesMinifyValueCss = "off" -) - -// Automatically minify all HTML files for your website. -type SettingEditParamsItemsZonesMinifyValueHTML string - -const ( - SettingEditParamsItemsZonesMinifyValueHTMLOn SettingEditParamsItemsZonesMinifyValueHTML = "on" - SettingEditParamsItemsZonesMinifyValueHTMLOff SettingEditParamsItemsZonesMinifyValueHTML = "off" -) - -// Automatically minify all JavaScript files for your website. -type SettingEditParamsItemsZonesMinifyValueJs string - -const ( - SettingEditParamsItemsZonesMinifyValueJsOn SettingEditParamsItemsZonesMinifyValueJs = "on" - SettingEditParamsItemsZonesMinifyValueJsOff SettingEditParamsItemsZonesMinifyValueJs = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesMinifyEditable bool - -const ( - SettingEditParamsItemsZonesMinifyEditableTrue SettingEditParamsItemsZonesMinifyEditable = true - SettingEditParamsItemsZonesMinifyEditableFalse SettingEditParamsItemsZonesMinifyEditable = false -) - -// Automatically optimize image loading for website visitors on mobile devices. -// Refer to -// [our blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for -// more information. -type SettingEditParamsItemsZonesMirage struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesMirageID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesMirageValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesMirage) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesMirage) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesMirageID string - -const ( - SettingEditParamsItemsZonesMirageIDMirage SettingEditParamsItemsZonesMirageID = "mirage" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesMirageValue string - -const ( - SettingEditParamsItemsZonesMirageValueOn SettingEditParamsItemsZonesMirageValue = "on" - SettingEditParamsItemsZonesMirageValueOff SettingEditParamsItemsZonesMirageValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesMirageEditable bool - -const ( - SettingEditParamsItemsZonesMirageEditableTrue SettingEditParamsItemsZonesMirageEditable = true - SettingEditParamsItemsZonesMirageEditableFalse SettingEditParamsItemsZonesMirageEditable = false -) - -// Automatically redirect visitors on mobile devices to a mobile-optimized -// subdomain. Refer to -// [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) -// for more information. -type SettingEditParamsItemsZonesMobileRedirect struct { - // Identifier of the zone setting. - ID param.Field[SettingEditParamsItemsZonesMobileRedirectID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesMobileRedirectValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesMobileRedirect) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesMobileRedirect) implementsSettingEditParamsItem() {} - -// Identifier of the zone setting. -type SettingEditParamsItemsZonesMobileRedirectID string - -const ( - SettingEditParamsItemsZonesMobileRedirectIDMobileRedirect SettingEditParamsItemsZonesMobileRedirectID = "mobile_redirect" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesMobileRedirectValue struct { - // Which subdomain prefix you wish to redirect visitors on mobile devices to - // (subdomain must already exist). - MobileSubdomain param.Field[string] `json:"mobile_subdomain"` - // Whether or not mobile redirect is enabled. - Status param.Field[SettingEditParamsItemsZonesMobileRedirectValueStatus] `json:"status"` - // Whether to drop the current page path and redirect to the mobile subdomain URL - // root, or keep the path and redirect to the same page on the mobile subdomain. - StripUri param.Field[bool] `json:"strip_uri"` -} - -func (r SettingEditParamsItemsZonesMobileRedirectValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Whether or not mobile redirect is enabled. -type SettingEditParamsItemsZonesMobileRedirectValueStatus string - -const ( - SettingEditParamsItemsZonesMobileRedirectValueStatusOn SettingEditParamsItemsZonesMobileRedirectValueStatus = "on" - SettingEditParamsItemsZonesMobileRedirectValueStatusOff SettingEditParamsItemsZonesMobileRedirectValueStatus = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesMobileRedirectEditable bool - -const ( - SettingEditParamsItemsZonesMobileRedirectEditableTrue SettingEditParamsItemsZonesMobileRedirectEditable = true - SettingEditParamsItemsZonesMobileRedirectEditableFalse SettingEditParamsItemsZonesMobileRedirectEditable = false -) - -// Enable Network Error Logging reporting on your zone. (Beta) -type SettingEditParamsItemsZonesNEL struct { - // Zone setting identifier. - ID param.Field[SettingEditParamsItemsZonesNELID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesNELValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesNEL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesNEL) implementsSettingEditParamsItem() {} - -// Zone setting identifier. -type SettingEditParamsItemsZonesNELID string - -const ( - SettingEditParamsItemsZonesNELIDNEL SettingEditParamsItemsZonesNELID = "nel" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesNELValue struct { - Enabled param.Field[bool] `json:"enabled"` -} - -func (r SettingEditParamsItemsZonesNELValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesNELEditable bool - -const ( - SettingEditParamsItemsZonesNELEditableTrue SettingEditParamsItemsZonesNELEditable = true - SettingEditParamsItemsZonesNELEditableFalse SettingEditParamsItemsZonesNELEditable = false -) - -// Enables the Opportunistic Encryption feature for a zone. -type SettingEditParamsItemsZonesOpportunisticEncryption struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesOpportunisticEncryptionID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesOpportunisticEncryptionValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesOpportunisticEncryption) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesOpportunisticEncryption) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesOpportunisticEncryptionID string - -const ( - SettingEditParamsItemsZonesOpportunisticEncryptionIDOpportunisticEncryption SettingEditParamsItemsZonesOpportunisticEncryptionID = "opportunistic_encryption" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesOpportunisticEncryptionValue string - -const ( - SettingEditParamsItemsZonesOpportunisticEncryptionValueOn SettingEditParamsItemsZonesOpportunisticEncryptionValue = "on" - SettingEditParamsItemsZonesOpportunisticEncryptionValueOff SettingEditParamsItemsZonesOpportunisticEncryptionValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesOpportunisticEncryptionEditable bool - -const ( - SettingEditParamsItemsZonesOpportunisticEncryptionEditableTrue SettingEditParamsItemsZonesOpportunisticEncryptionEditable = true - SettingEditParamsItemsZonesOpportunisticEncryptionEditableFalse SettingEditParamsItemsZonesOpportunisticEncryptionEditable = false -) - -// Add an Alt-Svc header to all legitimate requests from Tor, allowing the -// connection to use our onion services instead of exit nodes. -type SettingEditParamsItemsZonesOpportunisticOnion struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesOpportunisticOnionID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesOpportunisticOnionValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesOpportunisticOnion) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesOpportunisticOnion) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesOpportunisticOnionID string - -const ( - SettingEditParamsItemsZonesOpportunisticOnionIDOpportunisticOnion SettingEditParamsItemsZonesOpportunisticOnionID = "opportunistic_onion" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesOpportunisticOnionValue string - -const ( - SettingEditParamsItemsZonesOpportunisticOnionValueOn SettingEditParamsItemsZonesOpportunisticOnionValue = "on" - SettingEditParamsItemsZonesOpportunisticOnionValueOff SettingEditParamsItemsZonesOpportunisticOnionValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesOpportunisticOnionEditable bool - -const ( - SettingEditParamsItemsZonesOpportunisticOnionEditableTrue SettingEditParamsItemsZonesOpportunisticOnionEditable = true - SettingEditParamsItemsZonesOpportunisticOnionEditableFalse SettingEditParamsItemsZonesOpportunisticOnionEditable = false -) - -// Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also -// on Cloudflare. -type SettingEditParamsItemsZonesOrangeToOrange struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesOrangeToOrangeID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesOrangeToOrangeValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesOrangeToOrange) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesOrangeToOrange) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesOrangeToOrangeID string - -const ( - SettingEditParamsItemsZonesOrangeToOrangeIDOrangeToOrange SettingEditParamsItemsZonesOrangeToOrangeID = "orange_to_orange" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesOrangeToOrangeValue string - -const ( - SettingEditParamsItemsZonesOrangeToOrangeValueOn SettingEditParamsItemsZonesOrangeToOrangeValue = "on" - SettingEditParamsItemsZonesOrangeToOrangeValueOff SettingEditParamsItemsZonesOrangeToOrangeValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesOrangeToOrangeEditable bool - -const ( - SettingEditParamsItemsZonesOrangeToOrangeEditableTrue SettingEditParamsItemsZonesOrangeToOrangeEditable = true - SettingEditParamsItemsZonesOrangeToOrangeEditableFalse SettingEditParamsItemsZonesOrangeToOrangeEditable = false -) - -// Cloudflare will proxy customer error pages on any 502,504 errors on origin -// server instead of showing a default Cloudflare error page. This does not apply -// to 522 errors and is limited to Enterprise Zones. -type SettingEditParamsItemsZonesOriginErrorPagePassThru struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesOriginErrorPagePassThruID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesOriginErrorPagePassThruValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesOriginErrorPagePassThru) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesOriginErrorPagePassThru) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesOriginErrorPagePassThruID string - -const ( - SettingEditParamsItemsZonesOriginErrorPagePassThruIDOriginErrorPagePassThru SettingEditParamsItemsZonesOriginErrorPagePassThruID = "origin_error_page_pass_thru" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesOriginErrorPagePassThruValue string - -const ( - SettingEditParamsItemsZonesOriginErrorPagePassThruValueOn SettingEditParamsItemsZonesOriginErrorPagePassThruValue = "on" - SettingEditParamsItemsZonesOriginErrorPagePassThruValueOff SettingEditParamsItemsZonesOriginErrorPagePassThruValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesOriginErrorPagePassThruEditable bool - -const ( - SettingEditParamsItemsZonesOriginErrorPagePassThruEditableTrue SettingEditParamsItemsZonesOriginErrorPagePassThruEditable = true - SettingEditParamsItemsZonesOriginErrorPagePassThruEditableFalse SettingEditParamsItemsZonesOriginErrorPagePassThruEditable = false -) - -// Removes metadata and compresses your images for faster page load times. Basic -// (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual -// quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster -// image loading. Larger JPEGs are converted to progressive images, loading a -// lower-resolution image first and ending in a higher-resolution version. Not -// recommended for hi-res photography sites. -type SettingEditParamsItemsZonesPolish struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesPolishID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesPolishValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesPolish) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesPolish) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesPolishID string - -const ( - SettingEditParamsItemsZonesPolishIDPolish SettingEditParamsItemsZonesPolishID = "polish" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesPolishValue string - -const ( - SettingEditParamsItemsZonesPolishValueOff SettingEditParamsItemsZonesPolishValue = "off" - SettingEditParamsItemsZonesPolishValueLossless SettingEditParamsItemsZonesPolishValue = "lossless" - SettingEditParamsItemsZonesPolishValueLossy SettingEditParamsItemsZonesPolishValue = "lossy" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesPolishEditable bool - -const ( - SettingEditParamsItemsZonesPolishEditableTrue SettingEditParamsItemsZonesPolishEditable = true - SettingEditParamsItemsZonesPolishEditableFalse SettingEditParamsItemsZonesPolishEditable = false -) - -// Cloudflare will prefetch any URLs that are included in the response headers. -// This is limited to Enterprise Zones. -type SettingEditParamsItemsZonesPrefetchPreload struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesPrefetchPreloadID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesPrefetchPreloadValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesPrefetchPreload) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesPrefetchPreload) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesPrefetchPreloadID string - -const ( - SettingEditParamsItemsZonesPrefetchPreloadIDPrefetchPreload SettingEditParamsItemsZonesPrefetchPreloadID = "prefetch_preload" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesPrefetchPreloadValue string - -const ( - SettingEditParamsItemsZonesPrefetchPreloadValueOn SettingEditParamsItemsZonesPrefetchPreloadValue = "on" - SettingEditParamsItemsZonesPrefetchPreloadValueOff SettingEditParamsItemsZonesPrefetchPreloadValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesPrefetchPreloadEditable bool - -const ( - SettingEditParamsItemsZonesPrefetchPreloadEditableTrue SettingEditParamsItemsZonesPrefetchPreloadEditable = true - SettingEditParamsItemsZonesPrefetchPreloadEditableFalse SettingEditParamsItemsZonesPrefetchPreloadEditable = false -) - -// Maximum time between two read operations from origin. -type SettingEditParamsItemsZonesProxyReadTimeout struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesProxyReadTimeoutID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[float64] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesProxyReadTimeout) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesProxyReadTimeout) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesProxyReadTimeoutID string - -const ( - SettingEditParamsItemsZonesProxyReadTimeoutIDProxyReadTimeout SettingEditParamsItemsZonesProxyReadTimeoutID = "proxy_read_timeout" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesProxyReadTimeoutEditable bool - -const ( - SettingEditParamsItemsZonesProxyReadTimeoutEditableTrue SettingEditParamsItemsZonesProxyReadTimeoutEditable = true - SettingEditParamsItemsZonesProxyReadTimeoutEditableFalse SettingEditParamsItemsZonesProxyReadTimeoutEditable = false -) - -// The value set for the Pseudo IPv4 setting. -type SettingEditParamsItemsZonesPseudoIPV4 struct { - // Value of the Pseudo IPv4 setting. - ID param.Field[SettingEditParamsItemsZonesPseudoIPV4ID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesPseudoIPV4Value] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesPseudoIPV4) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesPseudoIPV4) implementsSettingEditParamsItem() {} - -// Value of the Pseudo IPv4 setting. -type SettingEditParamsItemsZonesPseudoIPV4ID string - -const ( - SettingEditParamsItemsZonesPseudoIPV4IDPseudoIPV4 SettingEditParamsItemsZonesPseudoIPV4ID = "pseudo_ipv4" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesPseudoIPV4Value string - -const ( - SettingEditParamsItemsZonesPseudoIPV4ValueOff SettingEditParamsItemsZonesPseudoIPV4Value = "off" - SettingEditParamsItemsZonesPseudoIPV4ValueAddHeader SettingEditParamsItemsZonesPseudoIPV4Value = "add_header" - SettingEditParamsItemsZonesPseudoIPV4ValueOverwriteHeader SettingEditParamsItemsZonesPseudoIPV4Value = "overwrite_header" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesPseudoIPV4Editable bool - -const ( - SettingEditParamsItemsZonesPseudoIPV4EditableTrue SettingEditParamsItemsZonesPseudoIPV4Editable = true - SettingEditParamsItemsZonesPseudoIPV4EditableFalse SettingEditParamsItemsZonesPseudoIPV4Editable = false -) - -// Enables or disables buffering of responses from the proxied server. Cloudflare -// may buffer the whole payload to deliver it at once to the client versus allowing -// it to be delivered in chunks. By default, the proxied server streams directly -// and is not buffered by Cloudflare. This is limited to Enterprise Zones. -type SettingEditParamsItemsZonesResponseBuffering struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesResponseBufferingID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesResponseBufferingValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesResponseBuffering) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesResponseBuffering) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesResponseBufferingID string - -const ( - SettingEditParamsItemsZonesResponseBufferingIDResponseBuffering SettingEditParamsItemsZonesResponseBufferingID = "response_buffering" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesResponseBufferingValue string - -const ( - SettingEditParamsItemsZonesResponseBufferingValueOn SettingEditParamsItemsZonesResponseBufferingValue = "on" - SettingEditParamsItemsZonesResponseBufferingValueOff SettingEditParamsItemsZonesResponseBufferingValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesResponseBufferingEditable bool - -const ( - SettingEditParamsItemsZonesResponseBufferingEditableTrue SettingEditParamsItemsZonesResponseBufferingEditable = true - SettingEditParamsItemsZonesResponseBufferingEditableFalse SettingEditParamsItemsZonesResponseBufferingEditable = false -) - -// Rocket Loader is a general-purpose asynchronous JavaScript optimisation that -// prioritises rendering your content while loading your site's Javascript -// asynchronously. Turning on Rocket Loader will immediately improve a web page's -// rendering time sometimes measured as Time to First Paint (TTFP), and also the -// `window.onload` time (assuming there is JavaScript on the page). This can have a -// positive impact on your Google search ranking. When turned on, Rocket Loader -// will automatically defer the loading of all Javascript referenced in your HTML, -// with no configuration required. Refer to -// [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) -// for more information. -type SettingEditParamsItemsZonesRocketLoader struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesRocketLoaderID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesRocketLoaderValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesRocketLoader) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesRocketLoader) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesRocketLoaderID string - -const ( - SettingEditParamsItemsZonesRocketLoaderIDRocketLoader SettingEditParamsItemsZonesRocketLoaderID = "rocket_loader" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesRocketLoaderValue string - -const ( - SettingEditParamsItemsZonesRocketLoaderValueOn SettingEditParamsItemsZonesRocketLoaderValue = "on" - SettingEditParamsItemsZonesRocketLoaderValueOff SettingEditParamsItemsZonesRocketLoaderValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesRocketLoaderEditable bool - -const ( - SettingEditParamsItemsZonesRocketLoaderEditableTrue SettingEditParamsItemsZonesRocketLoaderEditable = true - SettingEditParamsItemsZonesRocketLoaderEditableFalse SettingEditParamsItemsZonesRocketLoaderEditable = false -) - -// [Automatic Platform Optimization for WordPress](https://developers.cloudflare.com/automatic-platform-optimization/) -// serves your WordPress site from Cloudflare's edge network and caches third-party -// fonts. -type SettingEditParamsItemsZonesSchemasAutomaticPlatformOptimization struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesSchemasAutomaticPlatformOptimization) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesSchemasAutomaticPlatformOptimization) implementsSettingEditParamsItem() { -} - -// ID of the zone setting. -type SettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationID string - -const ( - SettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationIDAutomaticPlatformOptimization SettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationID = "automatic_platform_optimization" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationValue struct { - // Indicates whether or not - // [cache by device type](https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/) - // is enabled. - CacheByDeviceType param.Field[bool] `json:"cache_by_device_type,required"` - // Indicates whether or not Cloudflare proxy is enabled. - Cf param.Field[bool] `json:"cf,required"` - // Indicates whether or not Automatic Platform Optimization is enabled. - Enabled param.Field[bool] `json:"enabled,required"` - // An array of hostnames where Automatic Platform Optimization for WordPress is - // activated. - Hostnames param.Field[[]string] `json:"hostnames,required" format:"hostname"` - // Indicates whether or not site is powered by WordPress. - Wordpress param.Field[bool] `json:"wordpress,required"` - // Indicates whether or not - // [Cloudflare for WordPress plugin](https://wordpress.org/plugins/cloudflare/) is - // installed. - WpPlugin param.Field[bool] `json:"wp_plugin,required"` -} - -func (r SettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationEditable bool - -const ( - SettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationEditableTrue SettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationEditable = true - SettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationEditableFalse SettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationEditable = false -) - -// Cloudflare security header for a zone. -type SettingEditParamsItemsZonesSecurityHeader struct { - // ID of the zone's security header. - ID param.Field[SettingEditParamsItemsZonesSecurityHeaderID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesSecurityHeaderValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesSecurityHeader) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesSecurityHeader) implementsSettingEditParamsItem() {} - -// ID of the zone's security header. -type SettingEditParamsItemsZonesSecurityHeaderID string - -const ( - SettingEditParamsItemsZonesSecurityHeaderIDSecurityHeader SettingEditParamsItemsZonesSecurityHeaderID = "security_header" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesSecurityHeaderValue struct { - // Strict Transport Security. - StrictTransportSecurity param.Field[SettingEditParamsItemsZonesSecurityHeaderValueStrictTransportSecurity] `json:"strict_transport_security"` -} - -func (r SettingEditParamsItemsZonesSecurityHeaderValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Strict Transport Security. -type SettingEditParamsItemsZonesSecurityHeaderValueStrictTransportSecurity struct { - // Whether or not strict transport security is enabled. - Enabled param.Field[bool] `json:"enabled"` - // Include all subdomains for strict transport security. - IncludeSubdomains param.Field[bool] `json:"include_subdomains"` - // Max age in seconds of the strict transport security. - MaxAge param.Field[float64] `json:"max_age"` - // Whether or not to include 'X-Content-Type-Options: nosniff' header. - Nosniff param.Field[bool] `json:"nosniff"` -} - -func (r SettingEditParamsItemsZonesSecurityHeaderValueStrictTransportSecurity) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesSecurityHeaderEditable bool - -const ( - SettingEditParamsItemsZonesSecurityHeaderEditableTrue SettingEditParamsItemsZonesSecurityHeaderEditable = true - SettingEditParamsItemsZonesSecurityHeaderEditableFalse SettingEditParamsItemsZonesSecurityHeaderEditable = false -) - -// Choose the appropriate security profile for your website, which will -// automatically adjust each of the security settings. If you choose to customize -// an individual security setting, the profile will become Custom. -// (https://support.cloudflare.com/hc/en-us/articles/200170056). -type SettingEditParamsItemsZonesSecurityLevel struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesSecurityLevelID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesSecurityLevelValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesSecurityLevel) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesSecurityLevel) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesSecurityLevelID string - -const ( - SettingEditParamsItemsZonesSecurityLevelIDSecurityLevel SettingEditParamsItemsZonesSecurityLevelID = "security_level" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesSecurityLevelValue string - -const ( - SettingEditParamsItemsZonesSecurityLevelValueOff SettingEditParamsItemsZonesSecurityLevelValue = "off" - SettingEditParamsItemsZonesSecurityLevelValueEssentiallyOff SettingEditParamsItemsZonesSecurityLevelValue = "essentially_off" - SettingEditParamsItemsZonesSecurityLevelValueLow SettingEditParamsItemsZonesSecurityLevelValue = "low" - SettingEditParamsItemsZonesSecurityLevelValueMedium SettingEditParamsItemsZonesSecurityLevelValue = "medium" - SettingEditParamsItemsZonesSecurityLevelValueHigh SettingEditParamsItemsZonesSecurityLevelValue = "high" - SettingEditParamsItemsZonesSecurityLevelValueUnderAttack SettingEditParamsItemsZonesSecurityLevelValue = "under_attack" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesSecurityLevelEditable bool - -const ( - SettingEditParamsItemsZonesSecurityLevelEditableTrue SettingEditParamsItemsZonesSecurityLevelEditable = true - SettingEditParamsItemsZonesSecurityLevelEditableFalse SettingEditParamsItemsZonesSecurityLevelEditable = false -) - -// If there is sensitive content on your website that you want visible to real -// visitors, but that you want to hide from suspicious visitors, all you have to do -// is wrap the content with Cloudflare SSE tags. Wrap any content that you want to -// be excluded from suspicious visitors in the following SSE tags: -// . For example: Bad visitors won't see my phone -// number, 555-555-5555 . Note: SSE only will work with HTML. If you -// have HTML minification enabled, you won't see the SSE tags in your HTML source -// when it's served through Cloudflare. SSE will still function in this case, as -// Cloudflare's HTML minification and SSE functionality occur on-the-fly as the -// resource moves through our network to the visitor's computer. -// (https://support.cloudflare.com/hc/en-us/articles/200170036). -type SettingEditParamsItemsZonesServerSideExclude struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesServerSideExcludeID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesServerSideExcludeValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesServerSideExclude) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesServerSideExclude) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesServerSideExcludeID string - -const ( - SettingEditParamsItemsZonesServerSideExcludeIDServerSideExclude SettingEditParamsItemsZonesServerSideExcludeID = "server_side_exclude" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesServerSideExcludeValue string - -const ( - SettingEditParamsItemsZonesServerSideExcludeValueOn SettingEditParamsItemsZonesServerSideExcludeValue = "on" - SettingEditParamsItemsZonesServerSideExcludeValueOff SettingEditParamsItemsZonesServerSideExcludeValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesServerSideExcludeEditable bool - -const ( - SettingEditParamsItemsZonesServerSideExcludeEditableTrue SettingEditParamsItemsZonesServerSideExcludeEditable = true - SettingEditParamsItemsZonesServerSideExcludeEditableFalse SettingEditParamsItemsZonesServerSideExcludeEditable = false -) - -// Allow SHA1 support. -type SettingEditParamsItemsZonesSha1Support struct { - // Zone setting identifier. - ID param.Field[SettingEditParamsItemsZonesSha1SupportID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesSha1SupportValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesSha1Support) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesSha1Support) implementsSettingEditParamsItem() {} - -// Zone setting identifier. -type SettingEditParamsItemsZonesSha1SupportID string - -const ( - SettingEditParamsItemsZonesSha1SupportIDSha1Support SettingEditParamsItemsZonesSha1SupportID = "sha1_support" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesSha1SupportValue string - -const ( - SettingEditParamsItemsZonesSha1SupportValueOff SettingEditParamsItemsZonesSha1SupportValue = "off" - SettingEditParamsItemsZonesSha1SupportValueOn SettingEditParamsItemsZonesSha1SupportValue = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesSha1SupportEditable bool - -const ( - SettingEditParamsItemsZonesSha1SupportEditableTrue SettingEditParamsItemsZonesSha1SupportEditable = true - SettingEditParamsItemsZonesSha1SupportEditableFalse SettingEditParamsItemsZonesSha1SupportEditable = false -) - -// Cloudflare will treat files with the same query strings as the same file in -// cache, regardless of the order of the query strings. This is limited to -// Enterprise Zones. -type SettingEditParamsItemsZonesSortQueryStringForCache struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesSortQueryStringForCacheID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesSortQueryStringForCacheValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesSortQueryStringForCache) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesSortQueryStringForCache) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesSortQueryStringForCacheID string - -const ( - SettingEditParamsItemsZonesSortQueryStringForCacheIDSortQueryStringForCache SettingEditParamsItemsZonesSortQueryStringForCacheID = "sort_query_string_for_cache" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesSortQueryStringForCacheValue string - -const ( - SettingEditParamsItemsZonesSortQueryStringForCacheValueOn SettingEditParamsItemsZonesSortQueryStringForCacheValue = "on" - SettingEditParamsItemsZonesSortQueryStringForCacheValueOff SettingEditParamsItemsZonesSortQueryStringForCacheValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesSortQueryStringForCacheEditable bool - -const ( - SettingEditParamsItemsZonesSortQueryStringForCacheEditableTrue SettingEditParamsItemsZonesSortQueryStringForCacheEditable = true - SettingEditParamsItemsZonesSortQueryStringForCacheEditableFalse SettingEditParamsItemsZonesSortQueryStringForCacheEditable = false -) - -// SSL encrypts your visitor's connection and safeguards credit card numbers and -// other personal data to and from your website. SSL can take up to 5 minutes to -// fully activate. Requires Cloudflare active on your root domain or www domain. -// Off: no SSL between the visitor and Cloudflare, and no SSL between Cloudflare -// and your web server (all HTTP traffic). Flexible: SSL between the visitor and -// Cloudflare -- visitor sees HTTPS on your site, but no SSL between Cloudflare and -// your web server. You don't need to have an SSL cert on your web server, but your -// vistors will still see the site as being HTTPS enabled. Full: SSL between the -// visitor and Cloudflare -- visitor sees HTTPS on your site, and SSL between -// Cloudflare and your web server. You'll need to have your own SSL cert or -// self-signed cert at the very least. Full (Strict): SSL between the visitor and -// Cloudflare -- visitor sees HTTPS on your site, and SSL between Cloudflare and -// your web server. You'll need to have a valid SSL certificate installed on your -// web server. This certificate must be signed by a certificate authority, have an -// expiration date in the future, and respond for the request domain name -// (hostname). (https://support.cloudflare.com/hc/en-us/articles/200170416). -type SettingEditParamsItemsZonesSSL struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesSSLID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesSSLValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesSSL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesSSL) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesSSLID string - -const ( - SettingEditParamsItemsZonesSSLIDSSL SettingEditParamsItemsZonesSSLID = "ssl" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesSSLValue string - -const ( - SettingEditParamsItemsZonesSSLValueOff SettingEditParamsItemsZonesSSLValue = "off" - SettingEditParamsItemsZonesSSLValueFlexible SettingEditParamsItemsZonesSSLValue = "flexible" - SettingEditParamsItemsZonesSSLValueFull SettingEditParamsItemsZonesSSLValue = "full" - SettingEditParamsItemsZonesSSLValueStrict SettingEditParamsItemsZonesSSLValue = "strict" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesSSLEditable bool - -const ( - SettingEditParamsItemsZonesSSLEditableTrue SettingEditParamsItemsZonesSSLEditable = true - SettingEditParamsItemsZonesSSLEditableFalse SettingEditParamsItemsZonesSSLEditable = false -) - -// Enrollment in the SSL/TLS Recommender service which tries to detect and -// recommend (by sending periodic emails) the most secure SSL/TLS setting your -// origin servers support. -type SettingEditParamsItemsZonesSSLRecommender struct { - // Enrollment value for SSL/TLS Recommender. - ID param.Field[SettingEditParamsItemsZonesSSLRecommenderID] `json:"id"` - // ssl-recommender enrollment setting. - Enabled param.Field[bool] `json:"enabled"` -} - -func (r SettingEditParamsItemsZonesSSLRecommender) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesSSLRecommender) implementsSettingEditParamsItem() {} - -// Enrollment value for SSL/TLS Recommender. -type SettingEditParamsItemsZonesSSLRecommenderID string - -const ( - SettingEditParamsItemsZonesSSLRecommenderIDSSLRecommender SettingEditParamsItemsZonesSSLRecommenderID = "ssl_recommender" -) - -// Only allows TLS1.2. -type SettingEditParamsItemsZonesTLS1_2Only struct { - // Zone setting identifier. - ID param.Field[SettingEditParamsItemsZonesTLS1_2OnlyID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesTLS1_2OnlyValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesTLS1_2Only) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesTLS1_2Only) implementsSettingEditParamsItem() {} - -// Zone setting identifier. -type SettingEditParamsItemsZonesTLS1_2OnlyID string - -const ( - SettingEditParamsItemsZonesTLS1_2OnlyIDTLS1_2Only SettingEditParamsItemsZonesTLS1_2OnlyID = "tls_1_2_only" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesTLS1_2OnlyValue string - -const ( - SettingEditParamsItemsZonesTLS1_2OnlyValueOff SettingEditParamsItemsZonesTLS1_2OnlyValue = "off" - SettingEditParamsItemsZonesTLS1_2OnlyValueOn SettingEditParamsItemsZonesTLS1_2OnlyValue = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesTLS1_2OnlyEditable bool - -const ( - SettingEditParamsItemsZonesTLS1_2OnlyEditableTrue SettingEditParamsItemsZonesTLS1_2OnlyEditable = true - SettingEditParamsItemsZonesTLS1_2OnlyEditableFalse SettingEditParamsItemsZonesTLS1_2OnlyEditable = false -) - -// Enables Crypto TLS 1.3 feature for a zone. -type SettingEditParamsItemsZonesTLS1_3 struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesTLS1_3ID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesTLS1_3Value] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesTLS1_3) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesTLS1_3) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesTLS1_3ID string - -const ( - SettingEditParamsItemsZonesTLS1_3IDTLS1_3 SettingEditParamsItemsZonesTLS1_3ID = "tls_1_3" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesTLS1_3Value string - -const ( - SettingEditParamsItemsZonesTLS1_3ValueOn SettingEditParamsItemsZonesTLS1_3Value = "on" - SettingEditParamsItemsZonesTLS1_3ValueOff SettingEditParamsItemsZonesTLS1_3Value = "off" - SettingEditParamsItemsZonesTLS1_3ValueZrt SettingEditParamsItemsZonesTLS1_3Value = "zrt" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesTLS1_3Editable bool - -const ( - SettingEditParamsItemsZonesTLS1_3EditableTrue SettingEditParamsItemsZonesTLS1_3Editable = true - SettingEditParamsItemsZonesTLS1_3EditableFalse SettingEditParamsItemsZonesTLS1_3Editable = false -) - -// TLS Client Auth requires Cloudflare to connect to your origin server using a -// client certificate (Enterprise Only). -type SettingEditParamsItemsZonesTLSClientAuth struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesTLSClientAuthID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesTLSClientAuthValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesTLSClientAuth) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesTLSClientAuth) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesTLSClientAuthID string - -const ( - SettingEditParamsItemsZonesTLSClientAuthIDTLSClientAuth SettingEditParamsItemsZonesTLSClientAuthID = "tls_client_auth" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesTLSClientAuthValue string - -const ( - SettingEditParamsItemsZonesTLSClientAuthValueOn SettingEditParamsItemsZonesTLSClientAuthValue = "on" - SettingEditParamsItemsZonesTLSClientAuthValueOff SettingEditParamsItemsZonesTLSClientAuthValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesTLSClientAuthEditable bool - -const ( - SettingEditParamsItemsZonesTLSClientAuthEditableTrue SettingEditParamsItemsZonesTLSClientAuthEditable = true - SettingEditParamsItemsZonesTLSClientAuthEditableFalse SettingEditParamsItemsZonesTLSClientAuthEditable = false -) - -// Allows customer to continue to use True Client IP (Akamai feature) in the -// headers we send to the origin. This is limited to Enterprise Zones. -type SettingEditParamsItemsZonesTrueClientIPHeader struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesTrueClientIPHeaderID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesTrueClientIPHeaderValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesTrueClientIPHeader) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesTrueClientIPHeader) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesTrueClientIPHeaderID string - -const ( - SettingEditParamsItemsZonesTrueClientIPHeaderIDTrueClientIPHeader SettingEditParamsItemsZonesTrueClientIPHeaderID = "true_client_ip_header" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesTrueClientIPHeaderValue string - -const ( - SettingEditParamsItemsZonesTrueClientIPHeaderValueOn SettingEditParamsItemsZonesTrueClientIPHeaderValue = "on" - SettingEditParamsItemsZonesTrueClientIPHeaderValueOff SettingEditParamsItemsZonesTrueClientIPHeaderValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesTrueClientIPHeaderEditable bool - -const ( - SettingEditParamsItemsZonesTrueClientIPHeaderEditableTrue SettingEditParamsItemsZonesTrueClientIPHeaderEditable = true - SettingEditParamsItemsZonesTrueClientIPHeaderEditableFalse SettingEditParamsItemsZonesTrueClientIPHeaderEditable = false -) - -// The WAF examines HTTP requests to your website. It inspects both GET and POST -// requests and applies rules to help filter out illegitimate traffic from -// legitimate website visitors. The Cloudflare WAF inspects website addresses or -// URLs to detect anything out of the ordinary. If the Cloudflare WAF determines -// suspicious user behavior, then the WAF will 'challenge' the web visitor with a -// page that asks them to submit a CAPTCHA successfully to continue their action. -// If the challenge is failed, the action will be stopped. What this means is that -// Cloudflare's WAF will block any traffic identified as illegitimate before it -// reaches your origin web server. -// (https://support.cloudflare.com/hc/en-us/articles/200172016). -type SettingEditParamsItemsZonesWAF struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesWAFID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesWAFValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesWAF) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesWAF) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesWAFID string - -const ( - SettingEditParamsItemsZonesWAFIDWAF SettingEditParamsItemsZonesWAFID = "waf" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesWAFValue string - -const ( - SettingEditParamsItemsZonesWAFValueOn SettingEditParamsItemsZonesWAFValue = "on" - SettingEditParamsItemsZonesWAFValueOff SettingEditParamsItemsZonesWAFValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesWAFEditable bool - -const ( - SettingEditParamsItemsZonesWAFEditableTrue SettingEditParamsItemsZonesWAFEditable = true - SettingEditParamsItemsZonesWAFEditableFalse SettingEditParamsItemsZonesWAFEditable = false -) - -// When the client requesting the image supports the WebP image codec, and WebP -// offers a performance advantage over the original image format, Cloudflare will -// serve a WebP version of the original image. -type SettingEditParamsItemsZonesWebp struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesWebpID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesWebpValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesWebp) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesWebp) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesWebpID string - -const ( - SettingEditParamsItemsZonesWebpIDWebp SettingEditParamsItemsZonesWebpID = "webp" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesWebpValue string - -const ( - SettingEditParamsItemsZonesWebpValueOff SettingEditParamsItemsZonesWebpValue = "off" - SettingEditParamsItemsZonesWebpValueOn SettingEditParamsItemsZonesWebpValue = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesWebpEditable bool - -const ( - SettingEditParamsItemsZonesWebpEditableTrue SettingEditParamsItemsZonesWebpEditable = true - SettingEditParamsItemsZonesWebpEditableFalse SettingEditParamsItemsZonesWebpEditable = false -) - -// WebSockets are open connections sustained between the client and the origin -// server. Inside a WebSockets connection, the client and the origin can pass data -// back and forth without having to reestablish sessions. This makes exchanging -// data within a WebSockets connection fast. WebSockets are often used for -// real-time applications such as live chat and gaming. For more information refer -// to -// [Can I use Cloudflare with Websockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Can-I-use-Cloudflare-with-WebSockets-). -type SettingEditParamsItemsZonesWebsockets struct { - // ID of the zone setting. - ID param.Field[SettingEditParamsItemsZonesWebsocketsID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingEditParamsItemsZonesWebsocketsValue] `json:"value,required"` -} - -func (r SettingEditParamsItemsZonesWebsockets) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SettingEditParamsItemsZonesWebsockets) implementsSettingEditParamsItem() {} - -// ID of the zone setting. -type SettingEditParamsItemsZonesWebsocketsID string - -const ( - SettingEditParamsItemsZonesWebsocketsIDWebsockets SettingEditParamsItemsZonesWebsocketsID = "websockets" -) - -// Current value of the zone setting. -type SettingEditParamsItemsZonesWebsocketsValue string - -const ( - SettingEditParamsItemsZonesWebsocketsValueOff SettingEditParamsItemsZonesWebsocketsValue = "off" - SettingEditParamsItemsZonesWebsocketsValueOn SettingEditParamsItemsZonesWebsocketsValue = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEditParamsItemsZonesWebsocketsEditable bool - -const ( - SettingEditParamsItemsZonesWebsocketsEditableTrue SettingEditParamsItemsZonesWebsocketsEditable = true - SettingEditParamsItemsZonesWebsocketsEditableFalse SettingEditParamsItemsZonesWebsocketsEditable = false -) - -type SettingEditResponseEnvelope struct { - Errors []SettingEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - Result []SettingEditResponse `json:"result"` - JSON settingEditResponseEnvelopeJSON `json:"-"` -} - -// settingEditResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingEditResponseEnvelope] -type settingEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingEditResponseEnvelopeErrorsJSON contains the JSON metadata for the struct -// [SettingEditResponseEnvelopeErrors] -type settingEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingEditResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingEditResponseEnvelopeMessages] -type settingEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingadvancedddos.go b/settingadvancedddos.go deleted file mode 100644 index e12a14451b8..00000000000 --- a/settingadvancedddos.go +++ /dev/null @@ -1,173 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingAdvancedDDOSService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingAdvancedDDOSService] -// method instead. -type SettingAdvancedDDOSService struct { - Options []option.RequestOption -} - -// NewSettingAdvancedDDOSService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingAdvancedDDOSService(opts ...option.RequestOption) (r *SettingAdvancedDDOSService) { - r = &SettingAdvancedDDOSService{} - r.Options = opts - return -} - -// Advanced protection from Distributed Denial of Service (DDoS) attacks on your -// website. This is an uneditable value that is 'on' in the case of Business and -// Enterprise zones. -func (r *SettingAdvancedDDOSService) Get(ctx context.Context, query SettingAdvancedDDOSGetParams, opts ...option.RequestOption) (res *SettingAdvancedDDOSGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingAdvancedDDOSGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/advanced_ddos", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Advanced protection from Distributed Denial of Service (DDoS) attacks on your -// website. This is an uneditable value that is 'on' in the case of Business and -// Enterprise zones. -type SettingAdvancedDDOSGetResponse struct { - // ID of the zone setting. - ID SettingAdvancedDDOSGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingAdvancedDDOSGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingAdvancedDDOSGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingAdvancedDDOSGetResponseJSON `json:"-"` -} - -// settingAdvancedDDOSGetResponseJSON contains the JSON metadata for the struct -// [SettingAdvancedDDOSGetResponse] -type settingAdvancedDDOSGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAdvancedDDOSGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingAdvancedDDOSGetResponseID string - -const ( - SettingAdvancedDDOSGetResponseIDAdvancedDDOS SettingAdvancedDDOSGetResponseID = "advanced_ddos" -) - -// Current value of the zone setting. -type SettingAdvancedDDOSGetResponseValue string - -const ( - SettingAdvancedDDOSGetResponseValueOn SettingAdvancedDDOSGetResponseValue = "on" - SettingAdvancedDDOSGetResponseValueOff SettingAdvancedDDOSGetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingAdvancedDDOSGetResponseEditable bool - -const ( - SettingAdvancedDDOSGetResponseEditableTrue SettingAdvancedDDOSGetResponseEditable = true - SettingAdvancedDDOSGetResponseEditableFalse SettingAdvancedDDOSGetResponseEditable = false -) - -type SettingAdvancedDDOSGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingAdvancedDDOSGetResponseEnvelope struct { - Errors []SettingAdvancedDDOSGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingAdvancedDDOSGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Advanced protection from Distributed Denial of Service (DDoS) attacks on your - // website. This is an uneditable value that is 'on' in the case of Business and - // Enterprise zones. - Result SettingAdvancedDDOSGetResponse `json:"result"` - JSON settingAdvancedDDOSGetResponseEnvelopeJSON `json:"-"` -} - -// settingAdvancedDDOSGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingAdvancedDDOSGetResponseEnvelope] -type settingAdvancedDDOSGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAdvancedDDOSGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAdvancedDDOSGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingAdvancedDDOSGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingAdvancedDDOSGetResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [SettingAdvancedDDOSGetResponseEnvelopeErrors] -type settingAdvancedDDOSGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAdvancedDDOSGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAdvancedDDOSGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingAdvancedDDOSGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingAdvancedDDOSGetResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingAdvancedDDOSGetResponseEnvelopeMessages] -type settingAdvancedDDOSGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAdvancedDDOSGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingalwaysonline.go b/settingalwaysonline.go deleted file mode 100644 index ba9a326b06d..00000000000 --- a/settingalwaysonline.go +++ /dev/null @@ -1,339 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingAlwaysOnlineService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingAlwaysOnlineService] -// method instead. -type SettingAlwaysOnlineService struct { - Options []option.RequestOption -} - -// NewSettingAlwaysOnlineService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingAlwaysOnlineService(opts ...option.RequestOption) (r *SettingAlwaysOnlineService) { - r = &SettingAlwaysOnlineService{} - r.Options = opts - return -} - -// When enabled, Cloudflare serves limited copies of web pages available from the -// [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is -// offline. Refer to -// [Always Online](https://developers.cloudflare.com/cache/about/always-online) for -// more information. -func (r *SettingAlwaysOnlineService) Edit(ctx context.Context, params SettingAlwaysOnlineEditParams, opts ...option.RequestOption) (res *SettingAlwaysOnlineEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingAlwaysOnlineEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/always_online", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// When enabled, Cloudflare serves limited copies of web pages available from the -// [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is -// offline. Refer to -// [Always Online](https://developers.cloudflare.com/cache/about/always-online) for -// more information. -func (r *SettingAlwaysOnlineService) Get(ctx context.Context, query SettingAlwaysOnlineGetParams, opts ...option.RequestOption) (res *SettingAlwaysOnlineGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingAlwaysOnlineGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/always_online", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// When enabled, Cloudflare serves limited copies of web pages available from the -// [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is -// offline. Refer to -// [Always Online](https://developers.cloudflare.com/cache/about/always-online) for -// more information. -type SettingAlwaysOnlineEditResponse struct { - // ID of the zone setting. - ID SettingAlwaysOnlineEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingAlwaysOnlineEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingAlwaysOnlineEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingAlwaysOnlineEditResponseJSON `json:"-"` -} - -// settingAlwaysOnlineEditResponseJSON contains the JSON metadata for the struct -// [SettingAlwaysOnlineEditResponse] -type settingAlwaysOnlineEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAlwaysOnlineEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingAlwaysOnlineEditResponseID string - -const ( - SettingAlwaysOnlineEditResponseIDAlwaysOnline SettingAlwaysOnlineEditResponseID = "always_online" -) - -// Current value of the zone setting. -type SettingAlwaysOnlineEditResponseValue string - -const ( - SettingAlwaysOnlineEditResponseValueOn SettingAlwaysOnlineEditResponseValue = "on" - SettingAlwaysOnlineEditResponseValueOff SettingAlwaysOnlineEditResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingAlwaysOnlineEditResponseEditable bool - -const ( - SettingAlwaysOnlineEditResponseEditableTrue SettingAlwaysOnlineEditResponseEditable = true - SettingAlwaysOnlineEditResponseEditableFalse SettingAlwaysOnlineEditResponseEditable = false -) - -// When enabled, Cloudflare serves limited copies of web pages available from the -// [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is -// offline. Refer to -// [Always Online](https://developers.cloudflare.com/cache/about/always-online) for -// more information. -type SettingAlwaysOnlineGetResponse struct { - // ID of the zone setting. - ID SettingAlwaysOnlineGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingAlwaysOnlineGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingAlwaysOnlineGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingAlwaysOnlineGetResponseJSON `json:"-"` -} - -// settingAlwaysOnlineGetResponseJSON contains the JSON metadata for the struct -// [SettingAlwaysOnlineGetResponse] -type settingAlwaysOnlineGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAlwaysOnlineGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingAlwaysOnlineGetResponseID string - -const ( - SettingAlwaysOnlineGetResponseIDAlwaysOnline SettingAlwaysOnlineGetResponseID = "always_online" -) - -// Current value of the zone setting. -type SettingAlwaysOnlineGetResponseValue string - -const ( - SettingAlwaysOnlineGetResponseValueOn SettingAlwaysOnlineGetResponseValue = "on" - SettingAlwaysOnlineGetResponseValueOff SettingAlwaysOnlineGetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingAlwaysOnlineGetResponseEditable bool - -const ( - SettingAlwaysOnlineGetResponseEditableTrue SettingAlwaysOnlineGetResponseEditable = true - SettingAlwaysOnlineGetResponseEditableFalse SettingAlwaysOnlineGetResponseEditable = false -) - -type SettingAlwaysOnlineEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingAlwaysOnlineEditParamsValue] `json:"value,required"` -} - -func (r SettingAlwaysOnlineEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingAlwaysOnlineEditParamsValue string - -const ( - SettingAlwaysOnlineEditParamsValueOn SettingAlwaysOnlineEditParamsValue = "on" - SettingAlwaysOnlineEditParamsValueOff SettingAlwaysOnlineEditParamsValue = "off" -) - -type SettingAlwaysOnlineEditResponseEnvelope struct { - Errors []SettingAlwaysOnlineEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingAlwaysOnlineEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // When enabled, Cloudflare serves limited copies of web pages available from the - // [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is - // offline. Refer to - // [Always Online](https://developers.cloudflare.com/cache/about/always-online) for - // more information. - Result SettingAlwaysOnlineEditResponse `json:"result"` - JSON settingAlwaysOnlineEditResponseEnvelopeJSON `json:"-"` -} - -// settingAlwaysOnlineEditResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingAlwaysOnlineEditResponseEnvelope] -type settingAlwaysOnlineEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAlwaysOnlineEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAlwaysOnlineEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingAlwaysOnlineEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingAlwaysOnlineEditResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [SettingAlwaysOnlineEditResponseEnvelopeErrors] -type settingAlwaysOnlineEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAlwaysOnlineEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAlwaysOnlineEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingAlwaysOnlineEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingAlwaysOnlineEditResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingAlwaysOnlineEditResponseEnvelopeMessages] -type settingAlwaysOnlineEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAlwaysOnlineEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAlwaysOnlineGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingAlwaysOnlineGetResponseEnvelope struct { - Errors []SettingAlwaysOnlineGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingAlwaysOnlineGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // When enabled, Cloudflare serves limited copies of web pages available from the - // [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is - // offline. Refer to - // [Always Online](https://developers.cloudflare.com/cache/about/always-online) for - // more information. - Result SettingAlwaysOnlineGetResponse `json:"result"` - JSON settingAlwaysOnlineGetResponseEnvelopeJSON `json:"-"` -} - -// settingAlwaysOnlineGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingAlwaysOnlineGetResponseEnvelope] -type settingAlwaysOnlineGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAlwaysOnlineGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAlwaysOnlineGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingAlwaysOnlineGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingAlwaysOnlineGetResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [SettingAlwaysOnlineGetResponseEnvelopeErrors] -type settingAlwaysOnlineGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAlwaysOnlineGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAlwaysOnlineGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingAlwaysOnlineGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingAlwaysOnlineGetResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingAlwaysOnlineGetResponseEnvelopeMessages] -type settingAlwaysOnlineGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAlwaysOnlineGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingalwaysusehttps.go b/settingalwaysusehttps.go deleted file mode 100644 index f86998f9dc4..00000000000 --- a/settingalwaysusehttps.go +++ /dev/null @@ -1,327 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingAlwaysUseHTTPSService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingAlwaysUseHTTPSService] -// method instead. -type SettingAlwaysUseHTTPSService struct { - Options []option.RequestOption -} - -// NewSettingAlwaysUseHTTPSService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingAlwaysUseHTTPSService(opts ...option.RequestOption) (r *SettingAlwaysUseHTTPSService) { - r = &SettingAlwaysUseHTTPSService{} - r.Options = opts - return -} - -// Reply to all requests for URLs that use "http" with a 301 redirect to the -// equivalent "https" URL. If you only want to redirect for a subset of requests, -// consider creating an "Always use HTTPS" page rule. -func (r *SettingAlwaysUseHTTPSService) Edit(ctx context.Context, params SettingAlwaysUseHTTPSEditParams, opts ...option.RequestOption) (res *SettingAlwaysUseHTTPSEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingAlwaysUseHTTPSEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/always_use_https", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Reply to all requests for URLs that use "http" with a 301 redirect to the -// equivalent "https" URL. If you only want to redirect for a subset of requests, -// consider creating an "Always use HTTPS" page rule. -func (r *SettingAlwaysUseHTTPSService) Get(ctx context.Context, query SettingAlwaysUseHTTPSGetParams, opts ...option.RequestOption) (res *SettingAlwaysUseHTTPSGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingAlwaysUseHTTPSGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/always_use_https", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Reply to all requests for URLs that use "http" with a 301 redirect to the -// equivalent "https" URL. If you only want to redirect for a subset of requests, -// consider creating an "Always use HTTPS" page rule. -type SettingAlwaysUseHTTPSEditResponse struct { - // ID of the zone setting. - ID SettingAlwaysUseHTTPSEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingAlwaysUseHTTPSEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingAlwaysUseHTTPSEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingAlwaysUseHTTPSEditResponseJSON `json:"-"` -} - -// settingAlwaysUseHTTPSEditResponseJSON contains the JSON metadata for the struct -// [SettingAlwaysUseHTTPSEditResponse] -type settingAlwaysUseHTTPSEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAlwaysUseHTTPSEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingAlwaysUseHTTPSEditResponseID string - -const ( - SettingAlwaysUseHTTPSEditResponseIDAlwaysUseHTTPS SettingAlwaysUseHTTPSEditResponseID = "always_use_https" -) - -// Current value of the zone setting. -type SettingAlwaysUseHTTPSEditResponseValue string - -const ( - SettingAlwaysUseHTTPSEditResponseValueOn SettingAlwaysUseHTTPSEditResponseValue = "on" - SettingAlwaysUseHTTPSEditResponseValueOff SettingAlwaysUseHTTPSEditResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingAlwaysUseHTTPSEditResponseEditable bool - -const ( - SettingAlwaysUseHTTPSEditResponseEditableTrue SettingAlwaysUseHTTPSEditResponseEditable = true - SettingAlwaysUseHTTPSEditResponseEditableFalse SettingAlwaysUseHTTPSEditResponseEditable = false -) - -// Reply to all requests for URLs that use "http" with a 301 redirect to the -// equivalent "https" URL. If you only want to redirect for a subset of requests, -// consider creating an "Always use HTTPS" page rule. -type SettingAlwaysUseHTTPSGetResponse struct { - // ID of the zone setting. - ID SettingAlwaysUseHTTPSGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingAlwaysUseHTTPSGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingAlwaysUseHTTPSGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingAlwaysUseHTTPSGetResponseJSON `json:"-"` -} - -// settingAlwaysUseHTTPSGetResponseJSON contains the JSON metadata for the struct -// [SettingAlwaysUseHTTPSGetResponse] -type settingAlwaysUseHTTPSGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAlwaysUseHTTPSGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingAlwaysUseHTTPSGetResponseID string - -const ( - SettingAlwaysUseHTTPSGetResponseIDAlwaysUseHTTPS SettingAlwaysUseHTTPSGetResponseID = "always_use_https" -) - -// Current value of the zone setting. -type SettingAlwaysUseHTTPSGetResponseValue string - -const ( - SettingAlwaysUseHTTPSGetResponseValueOn SettingAlwaysUseHTTPSGetResponseValue = "on" - SettingAlwaysUseHTTPSGetResponseValueOff SettingAlwaysUseHTTPSGetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingAlwaysUseHTTPSGetResponseEditable bool - -const ( - SettingAlwaysUseHTTPSGetResponseEditableTrue SettingAlwaysUseHTTPSGetResponseEditable = true - SettingAlwaysUseHTTPSGetResponseEditableFalse SettingAlwaysUseHTTPSGetResponseEditable = false -) - -type SettingAlwaysUseHTTPSEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingAlwaysUseHTTPSEditParamsValue] `json:"value,required"` -} - -func (r SettingAlwaysUseHTTPSEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingAlwaysUseHTTPSEditParamsValue string - -const ( - SettingAlwaysUseHTTPSEditParamsValueOn SettingAlwaysUseHTTPSEditParamsValue = "on" - SettingAlwaysUseHTTPSEditParamsValueOff SettingAlwaysUseHTTPSEditParamsValue = "off" -) - -type SettingAlwaysUseHTTPSEditResponseEnvelope struct { - Errors []SettingAlwaysUseHTTPSEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingAlwaysUseHTTPSEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Reply to all requests for URLs that use "http" with a 301 redirect to the - // equivalent "https" URL. If you only want to redirect for a subset of requests, - // consider creating an "Always use HTTPS" page rule. - Result SettingAlwaysUseHTTPSEditResponse `json:"result"` - JSON settingAlwaysUseHTTPSEditResponseEnvelopeJSON `json:"-"` -} - -// settingAlwaysUseHTTPSEditResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingAlwaysUseHTTPSEditResponseEnvelope] -type settingAlwaysUseHTTPSEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAlwaysUseHTTPSEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAlwaysUseHTTPSEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingAlwaysUseHTTPSEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingAlwaysUseHTTPSEditResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingAlwaysUseHTTPSEditResponseEnvelopeErrors] -type settingAlwaysUseHTTPSEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAlwaysUseHTTPSEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAlwaysUseHTTPSEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingAlwaysUseHTTPSEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingAlwaysUseHTTPSEditResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingAlwaysUseHTTPSEditResponseEnvelopeMessages] -type settingAlwaysUseHTTPSEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAlwaysUseHTTPSEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAlwaysUseHTTPSGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingAlwaysUseHTTPSGetResponseEnvelope struct { - Errors []SettingAlwaysUseHTTPSGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingAlwaysUseHTTPSGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Reply to all requests for URLs that use "http" with a 301 redirect to the - // equivalent "https" URL. If you only want to redirect for a subset of requests, - // consider creating an "Always use HTTPS" page rule. - Result SettingAlwaysUseHTTPSGetResponse `json:"result"` - JSON settingAlwaysUseHTTPSGetResponseEnvelopeJSON `json:"-"` -} - -// settingAlwaysUseHTTPSGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingAlwaysUseHTTPSGetResponseEnvelope] -type settingAlwaysUseHTTPSGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAlwaysUseHTTPSGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAlwaysUseHTTPSGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingAlwaysUseHTTPSGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingAlwaysUseHTTPSGetResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingAlwaysUseHTTPSGetResponseEnvelopeErrors] -type settingAlwaysUseHTTPSGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAlwaysUseHTTPSGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAlwaysUseHTTPSGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingAlwaysUseHTTPSGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingAlwaysUseHTTPSGetResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingAlwaysUseHTTPSGetResponseEnvelopeMessages] -type settingAlwaysUseHTTPSGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAlwaysUseHTTPSGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingautomatichttpsrewrite.go b/settingautomatichttpsrewrite.go deleted file mode 100644 index c79d944452d..00000000000 --- a/settingautomatichttpsrewrite.go +++ /dev/null @@ -1,319 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingAutomaticHTTPSRewriteService contains methods and other services that -// help with interacting with the cloudflare API. Note, unlike clients, this -// service does not read variables from the environment automatically. You should -// not instantiate this service directly, and instead use the -// [NewSettingAutomaticHTTPSRewriteService] method instead. -type SettingAutomaticHTTPSRewriteService struct { - Options []option.RequestOption -} - -// NewSettingAutomaticHTTPSRewriteService generates a new service that applies the -// given options to each request. These options are applied after the parent -// client's options (if there is one), and before any request-specific options. -func NewSettingAutomaticHTTPSRewriteService(opts ...option.RequestOption) (r *SettingAutomaticHTTPSRewriteService) { - r = &SettingAutomaticHTTPSRewriteService{} - r.Options = opts - return -} - -// Enable the Automatic HTTPS Rewrites feature for this zone. -func (r *SettingAutomaticHTTPSRewriteService) Edit(ctx context.Context, params SettingAutomaticHTTPSRewriteEditParams, opts ...option.RequestOption) (res *SettingAutomaticHTTPSRewriteEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingAutomaticHTTPSRewriteEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/automatic_https_rewrites", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Enable the Automatic HTTPS Rewrites feature for this zone. -func (r *SettingAutomaticHTTPSRewriteService) Get(ctx context.Context, query SettingAutomaticHTTPSRewriteGetParams, opts ...option.RequestOption) (res *SettingAutomaticHTTPSRewriteGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingAutomaticHTTPSRewriteGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/automatic_https_rewrites", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Enable the Automatic HTTPS Rewrites feature for this zone. -type SettingAutomaticHTTPSRewriteEditResponse struct { - // ID of the zone setting. - ID SettingAutomaticHTTPSRewriteEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingAutomaticHTTPSRewriteEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingAutomaticHTTPSRewriteEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingAutomaticHTTPSRewriteEditResponseJSON `json:"-"` -} - -// settingAutomaticHTTPSRewriteEditResponseJSON contains the JSON metadata for the -// struct [SettingAutomaticHTTPSRewriteEditResponse] -type settingAutomaticHTTPSRewriteEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAutomaticHTTPSRewriteEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingAutomaticHTTPSRewriteEditResponseID string - -const ( - SettingAutomaticHTTPSRewriteEditResponseIDAutomaticHTTPSRewrites SettingAutomaticHTTPSRewriteEditResponseID = "automatic_https_rewrites" -) - -// Current value of the zone setting. -type SettingAutomaticHTTPSRewriteEditResponseValue string - -const ( - SettingAutomaticHTTPSRewriteEditResponseValueOn SettingAutomaticHTTPSRewriteEditResponseValue = "on" - SettingAutomaticHTTPSRewriteEditResponseValueOff SettingAutomaticHTTPSRewriteEditResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingAutomaticHTTPSRewriteEditResponseEditable bool - -const ( - SettingAutomaticHTTPSRewriteEditResponseEditableTrue SettingAutomaticHTTPSRewriteEditResponseEditable = true - SettingAutomaticHTTPSRewriteEditResponseEditableFalse SettingAutomaticHTTPSRewriteEditResponseEditable = false -) - -// Enable the Automatic HTTPS Rewrites feature for this zone. -type SettingAutomaticHTTPSRewriteGetResponse struct { - // ID of the zone setting. - ID SettingAutomaticHTTPSRewriteGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingAutomaticHTTPSRewriteGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingAutomaticHTTPSRewriteGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingAutomaticHTTPSRewriteGetResponseJSON `json:"-"` -} - -// settingAutomaticHTTPSRewriteGetResponseJSON contains the JSON metadata for the -// struct [SettingAutomaticHTTPSRewriteGetResponse] -type settingAutomaticHTTPSRewriteGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAutomaticHTTPSRewriteGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingAutomaticHTTPSRewriteGetResponseID string - -const ( - SettingAutomaticHTTPSRewriteGetResponseIDAutomaticHTTPSRewrites SettingAutomaticHTTPSRewriteGetResponseID = "automatic_https_rewrites" -) - -// Current value of the zone setting. -type SettingAutomaticHTTPSRewriteGetResponseValue string - -const ( - SettingAutomaticHTTPSRewriteGetResponseValueOn SettingAutomaticHTTPSRewriteGetResponseValue = "on" - SettingAutomaticHTTPSRewriteGetResponseValueOff SettingAutomaticHTTPSRewriteGetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingAutomaticHTTPSRewriteGetResponseEditable bool - -const ( - SettingAutomaticHTTPSRewriteGetResponseEditableTrue SettingAutomaticHTTPSRewriteGetResponseEditable = true - SettingAutomaticHTTPSRewriteGetResponseEditableFalse SettingAutomaticHTTPSRewriteGetResponseEditable = false -) - -type SettingAutomaticHTTPSRewriteEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. Notes: Default value depends on the zone's plan - // level. - Value param.Field[SettingAutomaticHTTPSRewriteEditParamsValue] `json:"value,required"` -} - -func (r SettingAutomaticHTTPSRewriteEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. Notes: Default value depends on the zone's plan -// level. -type SettingAutomaticHTTPSRewriteEditParamsValue string - -const ( - SettingAutomaticHTTPSRewriteEditParamsValueOn SettingAutomaticHTTPSRewriteEditParamsValue = "on" - SettingAutomaticHTTPSRewriteEditParamsValueOff SettingAutomaticHTTPSRewriteEditParamsValue = "off" -) - -type SettingAutomaticHTTPSRewriteEditResponseEnvelope struct { - Errors []SettingAutomaticHTTPSRewriteEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingAutomaticHTTPSRewriteEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Enable the Automatic HTTPS Rewrites feature for this zone. - Result SettingAutomaticHTTPSRewriteEditResponse `json:"result"` - JSON settingAutomaticHTTPSRewriteEditResponseEnvelopeJSON `json:"-"` -} - -// settingAutomaticHTTPSRewriteEditResponseEnvelopeJSON contains the JSON metadata -// for the struct [SettingAutomaticHTTPSRewriteEditResponseEnvelope] -type settingAutomaticHTTPSRewriteEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAutomaticHTTPSRewriteEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAutomaticHTTPSRewriteEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingAutomaticHTTPSRewriteEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingAutomaticHTTPSRewriteEditResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [SettingAutomaticHTTPSRewriteEditResponseEnvelopeErrors] -type settingAutomaticHTTPSRewriteEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAutomaticHTTPSRewriteEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAutomaticHTTPSRewriteEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingAutomaticHTTPSRewriteEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingAutomaticHTTPSRewriteEditResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct -// [SettingAutomaticHTTPSRewriteEditResponseEnvelopeMessages] -type settingAutomaticHTTPSRewriteEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAutomaticHTTPSRewriteEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAutomaticHTTPSRewriteGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingAutomaticHTTPSRewriteGetResponseEnvelope struct { - Errors []SettingAutomaticHTTPSRewriteGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingAutomaticHTTPSRewriteGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Enable the Automatic HTTPS Rewrites feature for this zone. - Result SettingAutomaticHTTPSRewriteGetResponse `json:"result"` - JSON settingAutomaticHTTPSRewriteGetResponseEnvelopeJSON `json:"-"` -} - -// settingAutomaticHTTPSRewriteGetResponseEnvelopeJSON contains the JSON metadata -// for the struct [SettingAutomaticHTTPSRewriteGetResponseEnvelope] -type settingAutomaticHTTPSRewriteGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAutomaticHTTPSRewriteGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAutomaticHTTPSRewriteGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingAutomaticHTTPSRewriteGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingAutomaticHTTPSRewriteGetResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [SettingAutomaticHTTPSRewriteGetResponseEnvelopeErrors] -type settingAutomaticHTTPSRewriteGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAutomaticHTTPSRewriteGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAutomaticHTTPSRewriteGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingAutomaticHTTPSRewriteGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingAutomaticHTTPSRewriteGetResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct -// [SettingAutomaticHTTPSRewriteGetResponseEnvelopeMessages] -type settingAutomaticHTTPSRewriteGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAutomaticHTTPSRewriteGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingautomaticplatformoptimization.go b/settingautomaticplatformoptimization.go deleted file mode 100644 index 6db6c41fbec..00000000000 --- a/settingautomaticplatformoptimization.go +++ /dev/null @@ -1,308 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingAutomaticPlatformOptimizationService contains methods and other services -// that help with interacting with the cloudflare API. Note, unlike clients, this -// service does not read variables from the environment automatically. You should -// not instantiate this service directly, and instead use the -// [NewSettingAutomaticPlatformOptimizationService] method instead. -type SettingAutomaticPlatformOptimizationService struct { - Options []option.RequestOption -} - -// NewSettingAutomaticPlatformOptimizationService generates a new service that -// applies the given options to each request. These options are applied after the -// parent client's options (if there is one), and before any request-specific -// options. -func NewSettingAutomaticPlatformOptimizationService(opts ...option.RequestOption) (r *SettingAutomaticPlatformOptimizationService) { - r = &SettingAutomaticPlatformOptimizationService{} - r.Options = opts - return -} - -// [Automatic Platform Optimization for WordPress](https://developers.cloudflare.com/automatic-platform-optimization/) -// serves your WordPress site from Cloudflare's edge network and caches third-party -// fonts. -func (r *SettingAutomaticPlatformOptimizationService) Edit(ctx context.Context, params SettingAutomaticPlatformOptimizationEditParams, opts ...option.RequestOption) (res *SettingAutomaticPlatformOptimizationEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingAutomaticPlatformOptimizationEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/automatic_platform_optimization", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// [Automatic Platform Optimization for WordPress](https://developers.cloudflare.com/automatic-platform-optimization/) -// serves your WordPress site from Cloudflare's edge network and caches third-party -// fonts. -func (r *SettingAutomaticPlatformOptimizationService) Get(ctx context.Context, query SettingAutomaticPlatformOptimizationGetParams, opts ...option.RequestOption) (res *SettingAutomaticPlatformOptimizationGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingAutomaticPlatformOptimizationGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/automatic_platform_optimization", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -type SettingAutomaticPlatformOptimizationEditResponse struct { - // Indicates whether or not - // [cache by device type](https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/) - // is enabled. - CacheByDeviceType bool `json:"cache_by_device_type,required"` - // Indicates whether or not Cloudflare proxy is enabled. - Cf bool `json:"cf,required"` - // Indicates whether or not Automatic Platform Optimization is enabled. - Enabled bool `json:"enabled,required"` - // An array of hostnames where Automatic Platform Optimization for WordPress is - // activated. - Hostnames []string `json:"hostnames,required" format:"hostname"` - // Indicates whether or not site is powered by WordPress. - Wordpress bool `json:"wordpress,required"` - // Indicates whether or not - // [Cloudflare for WordPress plugin](https://wordpress.org/plugins/cloudflare/) is - // installed. - WpPlugin bool `json:"wp_plugin,required"` - JSON settingAutomaticPlatformOptimizationEditResponseJSON `json:"-"` -} - -// settingAutomaticPlatformOptimizationEditResponseJSON contains the JSON metadata -// for the struct [SettingAutomaticPlatformOptimizationEditResponse] -type settingAutomaticPlatformOptimizationEditResponseJSON struct { - CacheByDeviceType apijson.Field - Cf apijson.Field - Enabled apijson.Field - Hostnames apijson.Field - Wordpress apijson.Field - WpPlugin apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAutomaticPlatformOptimizationEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAutomaticPlatformOptimizationGetResponse struct { - // Indicates whether or not - // [cache by device type](https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/) - // is enabled. - CacheByDeviceType bool `json:"cache_by_device_type,required"` - // Indicates whether or not Cloudflare proxy is enabled. - Cf bool `json:"cf,required"` - // Indicates whether or not Automatic Platform Optimization is enabled. - Enabled bool `json:"enabled,required"` - // An array of hostnames where Automatic Platform Optimization for WordPress is - // activated. - Hostnames []string `json:"hostnames,required" format:"hostname"` - // Indicates whether or not site is powered by WordPress. - Wordpress bool `json:"wordpress,required"` - // Indicates whether or not - // [Cloudflare for WordPress plugin](https://wordpress.org/plugins/cloudflare/) is - // installed. - WpPlugin bool `json:"wp_plugin,required"` - JSON settingAutomaticPlatformOptimizationGetResponseJSON `json:"-"` -} - -// settingAutomaticPlatformOptimizationGetResponseJSON contains the JSON metadata -// for the struct [SettingAutomaticPlatformOptimizationGetResponse] -type settingAutomaticPlatformOptimizationGetResponseJSON struct { - CacheByDeviceType apijson.Field - Cf apijson.Field - Enabled apijson.Field - Hostnames apijson.Field - Wordpress apijson.Field - WpPlugin apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAutomaticPlatformOptimizationGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAutomaticPlatformOptimizationEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Value param.Field[SettingAutomaticPlatformOptimizationEditParamsValue] `json:"value,required"` -} - -func (r SettingAutomaticPlatformOptimizationEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type SettingAutomaticPlatformOptimizationEditParamsValue struct { - // Indicates whether or not - // [cache by device type](https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/) - // is enabled. - CacheByDeviceType param.Field[bool] `json:"cache_by_device_type,required"` - // Indicates whether or not Cloudflare proxy is enabled. - Cf param.Field[bool] `json:"cf,required"` - // Indicates whether or not Automatic Platform Optimization is enabled. - Enabled param.Field[bool] `json:"enabled,required"` - // An array of hostnames where Automatic Platform Optimization for WordPress is - // activated. - Hostnames param.Field[[]string] `json:"hostnames,required" format:"hostname"` - // Indicates whether or not site is powered by WordPress. - Wordpress param.Field[bool] `json:"wordpress,required"` - // Indicates whether or not - // [Cloudflare for WordPress plugin](https://wordpress.org/plugins/cloudflare/) is - // installed. - WpPlugin param.Field[bool] `json:"wp_plugin,required"` -} - -func (r SettingAutomaticPlatformOptimizationEditParamsValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type SettingAutomaticPlatformOptimizationEditResponseEnvelope struct { - Errors []SettingAutomaticPlatformOptimizationEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingAutomaticPlatformOptimizationEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - Result SettingAutomaticPlatformOptimizationEditResponse `json:"result"` - JSON settingAutomaticPlatformOptimizationEditResponseEnvelopeJSON `json:"-"` -} - -// settingAutomaticPlatformOptimizationEditResponseEnvelopeJSON contains the JSON -// metadata for the struct -// [SettingAutomaticPlatformOptimizationEditResponseEnvelope] -type settingAutomaticPlatformOptimizationEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAutomaticPlatformOptimizationEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAutomaticPlatformOptimizationEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingAutomaticPlatformOptimizationEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingAutomaticPlatformOptimizationEditResponseEnvelopeErrorsJSON contains the -// JSON metadata for the struct -// [SettingAutomaticPlatformOptimizationEditResponseEnvelopeErrors] -type settingAutomaticPlatformOptimizationEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAutomaticPlatformOptimizationEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAutomaticPlatformOptimizationEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingAutomaticPlatformOptimizationEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingAutomaticPlatformOptimizationEditResponseEnvelopeMessagesJSON contains -// the JSON metadata for the struct -// [SettingAutomaticPlatformOptimizationEditResponseEnvelopeMessages] -type settingAutomaticPlatformOptimizationEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAutomaticPlatformOptimizationEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAutomaticPlatformOptimizationGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingAutomaticPlatformOptimizationGetResponseEnvelope struct { - Errors []SettingAutomaticPlatformOptimizationGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingAutomaticPlatformOptimizationGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - Result SettingAutomaticPlatformOptimizationGetResponse `json:"result"` - JSON settingAutomaticPlatformOptimizationGetResponseEnvelopeJSON `json:"-"` -} - -// settingAutomaticPlatformOptimizationGetResponseEnvelopeJSON contains the JSON -// metadata for the struct -// [SettingAutomaticPlatformOptimizationGetResponseEnvelope] -type settingAutomaticPlatformOptimizationGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAutomaticPlatformOptimizationGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAutomaticPlatformOptimizationGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingAutomaticPlatformOptimizationGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingAutomaticPlatformOptimizationGetResponseEnvelopeErrorsJSON contains the -// JSON metadata for the struct -// [SettingAutomaticPlatformOptimizationGetResponseEnvelopeErrors] -type settingAutomaticPlatformOptimizationGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAutomaticPlatformOptimizationGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingAutomaticPlatformOptimizationGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingAutomaticPlatformOptimizationGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingAutomaticPlatformOptimizationGetResponseEnvelopeMessagesJSON contains the -// JSON metadata for the struct -// [SettingAutomaticPlatformOptimizationGetResponseEnvelopeMessages] -type settingAutomaticPlatformOptimizationGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingAutomaticPlatformOptimizationGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingbrotli.go b/settingbrotli.go deleted file mode 100644 index 9faae453d44..00000000000 --- a/settingbrotli.go +++ /dev/null @@ -1,321 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingBrotliService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingBrotliService] method -// instead. -type SettingBrotliService struct { - Options []option.RequestOption -} - -// NewSettingBrotliService generates a new service that applies the given options -// to each request. These options are applied after the parent client's options (if -// there is one), and before any request-specific options. -func NewSettingBrotliService(opts ...option.RequestOption) (r *SettingBrotliService) { - r = &SettingBrotliService{} - r.Options = opts - return -} - -// When the client requesting an asset supports the Brotli compression algorithm, -// Cloudflare will serve a Brotli compressed version of the asset. -func (r *SettingBrotliService) Edit(ctx context.Context, params SettingBrotliEditParams, opts ...option.RequestOption) (res *SettingBrotliEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingBrotliEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/brotli", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// When the client requesting an asset supports the Brotli compression algorithm, -// Cloudflare will serve a Brotli compressed version of the asset. -func (r *SettingBrotliService) Get(ctx context.Context, query SettingBrotliGetParams, opts ...option.RequestOption) (res *SettingBrotliGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingBrotliGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/brotli", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// When the client requesting an asset supports the Brotli compression algorithm, -// Cloudflare will serve a Brotli compressed version of the asset. -type SettingBrotliEditResponse struct { - // ID of the zone setting. - ID SettingBrotliEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingBrotliEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingBrotliEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingBrotliEditResponseJSON `json:"-"` -} - -// settingBrotliEditResponseJSON contains the JSON metadata for the struct -// [SettingBrotliEditResponse] -type settingBrotliEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrotliEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingBrotliEditResponseID string - -const ( - SettingBrotliEditResponseIDBrotli SettingBrotliEditResponseID = "brotli" -) - -// Current value of the zone setting. -type SettingBrotliEditResponseValue string - -const ( - SettingBrotliEditResponseValueOff SettingBrotliEditResponseValue = "off" - SettingBrotliEditResponseValueOn SettingBrotliEditResponseValue = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingBrotliEditResponseEditable bool - -const ( - SettingBrotliEditResponseEditableTrue SettingBrotliEditResponseEditable = true - SettingBrotliEditResponseEditableFalse SettingBrotliEditResponseEditable = false -) - -// When the client requesting an asset supports the Brotli compression algorithm, -// Cloudflare will serve a Brotli compressed version of the asset. -type SettingBrotliGetResponse struct { - // ID of the zone setting. - ID SettingBrotliGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingBrotliGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingBrotliGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingBrotliGetResponseJSON `json:"-"` -} - -// settingBrotliGetResponseJSON contains the JSON metadata for the struct -// [SettingBrotliGetResponse] -type settingBrotliGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrotliGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingBrotliGetResponseID string - -const ( - SettingBrotliGetResponseIDBrotli SettingBrotliGetResponseID = "brotli" -) - -// Current value of the zone setting. -type SettingBrotliGetResponseValue string - -const ( - SettingBrotliGetResponseValueOff SettingBrotliGetResponseValue = "off" - SettingBrotliGetResponseValueOn SettingBrotliGetResponseValue = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingBrotliGetResponseEditable bool - -const ( - SettingBrotliGetResponseEditableTrue SettingBrotliGetResponseEditable = true - SettingBrotliGetResponseEditableFalse SettingBrotliGetResponseEditable = false -) - -type SettingBrotliEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingBrotliEditParamsValue] `json:"value,required"` -} - -func (r SettingBrotliEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingBrotliEditParamsValue string - -const ( - SettingBrotliEditParamsValueOff SettingBrotliEditParamsValue = "off" - SettingBrotliEditParamsValueOn SettingBrotliEditParamsValue = "on" -) - -type SettingBrotliEditResponseEnvelope struct { - Errors []SettingBrotliEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingBrotliEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // When the client requesting an asset supports the Brotli compression algorithm, - // Cloudflare will serve a Brotli compressed version of the asset. - Result SettingBrotliEditResponse `json:"result"` - JSON settingBrotliEditResponseEnvelopeJSON `json:"-"` -} - -// settingBrotliEditResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingBrotliEditResponseEnvelope] -type settingBrotliEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrotliEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingBrotliEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingBrotliEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingBrotliEditResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingBrotliEditResponseEnvelopeErrors] -type settingBrotliEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrotliEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingBrotliEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingBrotliEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingBrotliEditResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingBrotliEditResponseEnvelopeMessages] -type settingBrotliEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrotliEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingBrotliGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingBrotliGetResponseEnvelope struct { - Errors []SettingBrotliGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingBrotliGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // When the client requesting an asset supports the Brotli compression algorithm, - // Cloudflare will serve a Brotli compressed version of the asset. - Result SettingBrotliGetResponse `json:"result"` - JSON settingBrotliGetResponseEnvelopeJSON `json:"-"` -} - -// settingBrotliGetResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingBrotliGetResponseEnvelope] -type settingBrotliGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrotliGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingBrotliGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingBrotliGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingBrotliGetResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingBrotliGetResponseEnvelopeErrors] -type settingBrotliGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrotliGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingBrotliGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingBrotliGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingBrotliGetResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingBrotliGetResponseEnvelopeMessages] -type settingBrotliGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrotliGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingbrowsercachettl.go b/settingbrowsercachettl.go deleted file mode 100644 index f9b919e9719..00000000000 --- a/settingbrowsercachettl.go +++ /dev/null @@ -1,413 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingBrowserCacheTTLService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingBrowserCacheTTLService] -// method instead. -type SettingBrowserCacheTTLService struct { - Options []option.RequestOption -} - -// NewSettingBrowserCacheTTLService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingBrowserCacheTTLService(opts ...option.RequestOption) (r *SettingBrowserCacheTTLService) { - r = &SettingBrowserCacheTTLService{} - r.Options = opts - return -} - -// Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources -// will remain on your visitors' computers. Cloudflare will honor any larger times -// specified by your server. -// (https://support.cloudflare.com/hc/en-us/articles/200168276). -func (r *SettingBrowserCacheTTLService) Edit(ctx context.Context, params SettingBrowserCacheTTLEditParams, opts ...option.RequestOption) (res *SettingBrowserCacheTTLEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingBrowserCacheTTLEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/browser_cache_ttl", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources -// will remain on your visitors' computers. Cloudflare will honor any larger times -// specified by your server. -// (https://support.cloudflare.com/hc/en-us/articles/200168276). -func (r *SettingBrowserCacheTTLService) Get(ctx context.Context, query SettingBrowserCacheTTLGetParams, opts ...option.RequestOption) (res *SettingBrowserCacheTTLGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingBrowserCacheTTLGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/browser_cache_ttl", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources -// will remain on your visitors' computers. Cloudflare will honor any larger times -// specified by your server. -// (https://support.cloudflare.com/hc/en-us/articles/200168276). -type SettingBrowserCacheTTLEditResponse struct { - // ID of the zone setting. - ID SettingBrowserCacheTTLEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingBrowserCacheTTLEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingBrowserCacheTTLEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingBrowserCacheTTLEditResponseJSON `json:"-"` -} - -// settingBrowserCacheTTLEditResponseJSON contains the JSON metadata for the struct -// [SettingBrowserCacheTTLEditResponse] -type settingBrowserCacheTTLEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrowserCacheTTLEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingBrowserCacheTTLEditResponseID string - -const ( - SettingBrowserCacheTTLEditResponseIDBrowserCacheTTL SettingBrowserCacheTTLEditResponseID = "browser_cache_ttl" -) - -// Current value of the zone setting. -type SettingBrowserCacheTTLEditResponseValue float64 - -const ( - SettingBrowserCacheTTLEditResponseValue0 SettingBrowserCacheTTLEditResponseValue = 0 - SettingBrowserCacheTTLEditResponseValue30 SettingBrowserCacheTTLEditResponseValue = 30 - SettingBrowserCacheTTLEditResponseValue60 SettingBrowserCacheTTLEditResponseValue = 60 - SettingBrowserCacheTTLEditResponseValue120 SettingBrowserCacheTTLEditResponseValue = 120 - SettingBrowserCacheTTLEditResponseValue300 SettingBrowserCacheTTLEditResponseValue = 300 - SettingBrowserCacheTTLEditResponseValue1200 SettingBrowserCacheTTLEditResponseValue = 1200 - SettingBrowserCacheTTLEditResponseValue1800 SettingBrowserCacheTTLEditResponseValue = 1800 - SettingBrowserCacheTTLEditResponseValue3600 SettingBrowserCacheTTLEditResponseValue = 3600 - SettingBrowserCacheTTLEditResponseValue7200 SettingBrowserCacheTTLEditResponseValue = 7200 - SettingBrowserCacheTTLEditResponseValue10800 SettingBrowserCacheTTLEditResponseValue = 10800 - SettingBrowserCacheTTLEditResponseValue14400 SettingBrowserCacheTTLEditResponseValue = 14400 - SettingBrowserCacheTTLEditResponseValue18000 SettingBrowserCacheTTLEditResponseValue = 18000 - SettingBrowserCacheTTLEditResponseValue28800 SettingBrowserCacheTTLEditResponseValue = 28800 - SettingBrowserCacheTTLEditResponseValue43200 SettingBrowserCacheTTLEditResponseValue = 43200 - SettingBrowserCacheTTLEditResponseValue57600 SettingBrowserCacheTTLEditResponseValue = 57600 - SettingBrowserCacheTTLEditResponseValue72000 SettingBrowserCacheTTLEditResponseValue = 72000 - SettingBrowserCacheTTLEditResponseValue86400 SettingBrowserCacheTTLEditResponseValue = 86400 - SettingBrowserCacheTTLEditResponseValue172800 SettingBrowserCacheTTLEditResponseValue = 172800 - SettingBrowserCacheTTLEditResponseValue259200 SettingBrowserCacheTTLEditResponseValue = 259200 - SettingBrowserCacheTTLEditResponseValue345600 SettingBrowserCacheTTLEditResponseValue = 345600 - SettingBrowserCacheTTLEditResponseValue432000 SettingBrowserCacheTTLEditResponseValue = 432000 - SettingBrowserCacheTTLEditResponseValue691200 SettingBrowserCacheTTLEditResponseValue = 691200 - SettingBrowserCacheTTLEditResponseValue1382400 SettingBrowserCacheTTLEditResponseValue = 1382400 - SettingBrowserCacheTTLEditResponseValue2073600 SettingBrowserCacheTTLEditResponseValue = 2073600 - SettingBrowserCacheTTLEditResponseValue2678400 SettingBrowserCacheTTLEditResponseValue = 2678400 - SettingBrowserCacheTTLEditResponseValue5356800 SettingBrowserCacheTTLEditResponseValue = 5356800 - SettingBrowserCacheTTLEditResponseValue16070400 SettingBrowserCacheTTLEditResponseValue = 16070400 - SettingBrowserCacheTTLEditResponseValue31536000 SettingBrowserCacheTTLEditResponseValue = 31536000 -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingBrowserCacheTTLEditResponseEditable bool - -const ( - SettingBrowserCacheTTLEditResponseEditableTrue SettingBrowserCacheTTLEditResponseEditable = true - SettingBrowserCacheTTLEditResponseEditableFalse SettingBrowserCacheTTLEditResponseEditable = false -) - -// Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources -// will remain on your visitors' computers. Cloudflare will honor any larger times -// specified by your server. -// (https://support.cloudflare.com/hc/en-us/articles/200168276). -type SettingBrowserCacheTTLGetResponse struct { - // ID of the zone setting. - ID SettingBrowserCacheTTLGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingBrowserCacheTTLGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingBrowserCacheTTLGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingBrowserCacheTTLGetResponseJSON `json:"-"` -} - -// settingBrowserCacheTTLGetResponseJSON contains the JSON metadata for the struct -// [SettingBrowserCacheTTLGetResponse] -type settingBrowserCacheTTLGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrowserCacheTTLGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingBrowserCacheTTLGetResponseID string - -const ( - SettingBrowserCacheTTLGetResponseIDBrowserCacheTTL SettingBrowserCacheTTLGetResponseID = "browser_cache_ttl" -) - -// Current value of the zone setting. -type SettingBrowserCacheTTLGetResponseValue float64 - -const ( - SettingBrowserCacheTTLGetResponseValue0 SettingBrowserCacheTTLGetResponseValue = 0 - SettingBrowserCacheTTLGetResponseValue30 SettingBrowserCacheTTLGetResponseValue = 30 - SettingBrowserCacheTTLGetResponseValue60 SettingBrowserCacheTTLGetResponseValue = 60 - SettingBrowserCacheTTLGetResponseValue120 SettingBrowserCacheTTLGetResponseValue = 120 - SettingBrowserCacheTTLGetResponseValue300 SettingBrowserCacheTTLGetResponseValue = 300 - SettingBrowserCacheTTLGetResponseValue1200 SettingBrowserCacheTTLGetResponseValue = 1200 - SettingBrowserCacheTTLGetResponseValue1800 SettingBrowserCacheTTLGetResponseValue = 1800 - SettingBrowserCacheTTLGetResponseValue3600 SettingBrowserCacheTTLGetResponseValue = 3600 - SettingBrowserCacheTTLGetResponseValue7200 SettingBrowserCacheTTLGetResponseValue = 7200 - SettingBrowserCacheTTLGetResponseValue10800 SettingBrowserCacheTTLGetResponseValue = 10800 - SettingBrowserCacheTTLGetResponseValue14400 SettingBrowserCacheTTLGetResponseValue = 14400 - SettingBrowserCacheTTLGetResponseValue18000 SettingBrowserCacheTTLGetResponseValue = 18000 - SettingBrowserCacheTTLGetResponseValue28800 SettingBrowserCacheTTLGetResponseValue = 28800 - SettingBrowserCacheTTLGetResponseValue43200 SettingBrowserCacheTTLGetResponseValue = 43200 - SettingBrowserCacheTTLGetResponseValue57600 SettingBrowserCacheTTLGetResponseValue = 57600 - SettingBrowserCacheTTLGetResponseValue72000 SettingBrowserCacheTTLGetResponseValue = 72000 - SettingBrowserCacheTTLGetResponseValue86400 SettingBrowserCacheTTLGetResponseValue = 86400 - SettingBrowserCacheTTLGetResponseValue172800 SettingBrowserCacheTTLGetResponseValue = 172800 - SettingBrowserCacheTTLGetResponseValue259200 SettingBrowserCacheTTLGetResponseValue = 259200 - SettingBrowserCacheTTLGetResponseValue345600 SettingBrowserCacheTTLGetResponseValue = 345600 - SettingBrowserCacheTTLGetResponseValue432000 SettingBrowserCacheTTLGetResponseValue = 432000 - SettingBrowserCacheTTLGetResponseValue691200 SettingBrowserCacheTTLGetResponseValue = 691200 - SettingBrowserCacheTTLGetResponseValue1382400 SettingBrowserCacheTTLGetResponseValue = 1382400 - SettingBrowserCacheTTLGetResponseValue2073600 SettingBrowserCacheTTLGetResponseValue = 2073600 - SettingBrowserCacheTTLGetResponseValue2678400 SettingBrowserCacheTTLGetResponseValue = 2678400 - SettingBrowserCacheTTLGetResponseValue5356800 SettingBrowserCacheTTLGetResponseValue = 5356800 - SettingBrowserCacheTTLGetResponseValue16070400 SettingBrowserCacheTTLGetResponseValue = 16070400 - SettingBrowserCacheTTLGetResponseValue31536000 SettingBrowserCacheTTLGetResponseValue = 31536000 -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingBrowserCacheTTLGetResponseEditable bool - -const ( - SettingBrowserCacheTTLGetResponseEditableTrue SettingBrowserCacheTTLGetResponseEditable = true - SettingBrowserCacheTTLGetResponseEditableFalse SettingBrowserCacheTTLGetResponseEditable = false -) - -type SettingBrowserCacheTTLEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. Notes: Setting a TTL of 0 is equivalent to selecting - // `Respect Existing Headers` - Value param.Field[SettingBrowserCacheTTLEditParamsValue] `json:"value,required"` -} - -func (r SettingBrowserCacheTTLEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. Notes: Setting a TTL of 0 is equivalent to selecting -// `Respect Existing Headers` -type SettingBrowserCacheTTLEditParamsValue float64 - -const ( - SettingBrowserCacheTTLEditParamsValue0 SettingBrowserCacheTTLEditParamsValue = 0 - SettingBrowserCacheTTLEditParamsValue30 SettingBrowserCacheTTLEditParamsValue = 30 - SettingBrowserCacheTTLEditParamsValue60 SettingBrowserCacheTTLEditParamsValue = 60 - SettingBrowserCacheTTLEditParamsValue120 SettingBrowserCacheTTLEditParamsValue = 120 - SettingBrowserCacheTTLEditParamsValue300 SettingBrowserCacheTTLEditParamsValue = 300 - SettingBrowserCacheTTLEditParamsValue1200 SettingBrowserCacheTTLEditParamsValue = 1200 - SettingBrowserCacheTTLEditParamsValue1800 SettingBrowserCacheTTLEditParamsValue = 1800 - SettingBrowserCacheTTLEditParamsValue3600 SettingBrowserCacheTTLEditParamsValue = 3600 - SettingBrowserCacheTTLEditParamsValue7200 SettingBrowserCacheTTLEditParamsValue = 7200 - SettingBrowserCacheTTLEditParamsValue10800 SettingBrowserCacheTTLEditParamsValue = 10800 - SettingBrowserCacheTTLEditParamsValue14400 SettingBrowserCacheTTLEditParamsValue = 14400 - SettingBrowserCacheTTLEditParamsValue18000 SettingBrowserCacheTTLEditParamsValue = 18000 - SettingBrowserCacheTTLEditParamsValue28800 SettingBrowserCacheTTLEditParamsValue = 28800 - SettingBrowserCacheTTLEditParamsValue43200 SettingBrowserCacheTTLEditParamsValue = 43200 - SettingBrowserCacheTTLEditParamsValue57600 SettingBrowserCacheTTLEditParamsValue = 57600 - SettingBrowserCacheTTLEditParamsValue72000 SettingBrowserCacheTTLEditParamsValue = 72000 - SettingBrowserCacheTTLEditParamsValue86400 SettingBrowserCacheTTLEditParamsValue = 86400 - SettingBrowserCacheTTLEditParamsValue172800 SettingBrowserCacheTTLEditParamsValue = 172800 - SettingBrowserCacheTTLEditParamsValue259200 SettingBrowserCacheTTLEditParamsValue = 259200 - SettingBrowserCacheTTLEditParamsValue345600 SettingBrowserCacheTTLEditParamsValue = 345600 - SettingBrowserCacheTTLEditParamsValue432000 SettingBrowserCacheTTLEditParamsValue = 432000 - SettingBrowserCacheTTLEditParamsValue691200 SettingBrowserCacheTTLEditParamsValue = 691200 - SettingBrowserCacheTTLEditParamsValue1382400 SettingBrowserCacheTTLEditParamsValue = 1382400 - SettingBrowserCacheTTLEditParamsValue2073600 SettingBrowserCacheTTLEditParamsValue = 2073600 - SettingBrowserCacheTTLEditParamsValue2678400 SettingBrowserCacheTTLEditParamsValue = 2678400 - SettingBrowserCacheTTLEditParamsValue5356800 SettingBrowserCacheTTLEditParamsValue = 5356800 - SettingBrowserCacheTTLEditParamsValue16070400 SettingBrowserCacheTTLEditParamsValue = 16070400 - SettingBrowserCacheTTLEditParamsValue31536000 SettingBrowserCacheTTLEditParamsValue = 31536000 -) - -type SettingBrowserCacheTTLEditResponseEnvelope struct { - Errors []SettingBrowserCacheTTLEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingBrowserCacheTTLEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources - // will remain on your visitors' computers. Cloudflare will honor any larger times - // specified by your server. - // (https://support.cloudflare.com/hc/en-us/articles/200168276). - Result SettingBrowserCacheTTLEditResponse `json:"result"` - JSON settingBrowserCacheTTLEditResponseEnvelopeJSON `json:"-"` -} - -// settingBrowserCacheTTLEditResponseEnvelopeJSON contains the JSON metadata for -// the struct [SettingBrowserCacheTTLEditResponseEnvelope] -type settingBrowserCacheTTLEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrowserCacheTTLEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingBrowserCacheTTLEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingBrowserCacheTTLEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingBrowserCacheTTLEditResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingBrowserCacheTTLEditResponseEnvelopeErrors] -type settingBrowserCacheTTLEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrowserCacheTTLEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingBrowserCacheTTLEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingBrowserCacheTTLEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingBrowserCacheTTLEditResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [SettingBrowserCacheTTLEditResponseEnvelopeMessages] -type settingBrowserCacheTTLEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrowserCacheTTLEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingBrowserCacheTTLGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingBrowserCacheTTLGetResponseEnvelope struct { - Errors []SettingBrowserCacheTTLGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingBrowserCacheTTLGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources - // will remain on your visitors' computers. Cloudflare will honor any larger times - // specified by your server. - // (https://support.cloudflare.com/hc/en-us/articles/200168276). - Result SettingBrowserCacheTTLGetResponse `json:"result"` - JSON settingBrowserCacheTTLGetResponseEnvelopeJSON `json:"-"` -} - -// settingBrowserCacheTTLGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingBrowserCacheTTLGetResponseEnvelope] -type settingBrowserCacheTTLGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrowserCacheTTLGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingBrowserCacheTTLGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingBrowserCacheTTLGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingBrowserCacheTTLGetResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingBrowserCacheTTLGetResponseEnvelopeErrors] -type settingBrowserCacheTTLGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrowserCacheTTLGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingBrowserCacheTTLGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingBrowserCacheTTLGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingBrowserCacheTTLGetResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingBrowserCacheTTLGetResponseEnvelopeMessages] -type settingBrowserCacheTTLGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrowserCacheTTLGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingbrowsercheck.go b/settingbrowsercheck.go deleted file mode 100644 index 28840472027..00000000000 --- a/settingbrowsercheck.go +++ /dev/null @@ -1,339 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingBrowserCheckService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingBrowserCheckService] -// method instead. -type SettingBrowserCheckService struct { - Options []option.RequestOption -} - -// NewSettingBrowserCheckService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingBrowserCheckService(opts ...option.RequestOption) (r *SettingBrowserCheckService) { - r = &SettingBrowserCheckService{} - r.Options = opts - return -} - -// Browser Integrity Check is similar to Bad Behavior and looks for common HTTP -// headers abused most commonly by spammers and denies access to your page. It will -// also challenge visitors that do not have a user agent or a non standard user -// agent (also commonly used by abuse bots, crawlers or visitors). -// (https://support.cloudflare.com/hc/en-us/articles/200170086). -func (r *SettingBrowserCheckService) Edit(ctx context.Context, params SettingBrowserCheckEditParams, opts ...option.RequestOption) (res *SettingBrowserCheckEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingBrowserCheckEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/browser_check", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Browser Integrity Check is similar to Bad Behavior and looks for common HTTP -// headers abused most commonly by spammers and denies access to your page. It will -// also challenge visitors that do not have a user agent or a non standard user -// agent (also commonly used by abuse bots, crawlers or visitors). -// (https://support.cloudflare.com/hc/en-us/articles/200170086). -func (r *SettingBrowserCheckService) Get(ctx context.Context, query SettingBrowserCheckGetParams, opts ...option.RequestOption) (res *SettingBrowserCheckGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingBrowserCheckGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/browser_check", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Browser Integrity Check is similar to Bad Behavior and looks for common HTTP -// headers abused most commonly by spammers and denies access to your page. It will -// also challenge visitors that do not have a user agent or a non standard user -// agent (also commonly used by abuse bots, crawlers or visitors). -// (https://support.cloudflare.com/hc/en-us/articles/200170086). -type SettingBrowserCheckEditResponse struct { - // ID of the zone setting. - ID SettingBrowserCheckEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingBrowserCheckEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingBrowserCheckEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingBrowserCheckEditResponseJSON `json:"-"` -} - -// settingBrowserCheckEditResponseJSON contains the JSON metadata for the struct -// [SettingBrowserCheckEditResponse] -type settingBrowserCheckEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrowserCheckEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingBrowserCheckEditResponseID string - -const ( - SettingBrowserCheckEditResponseIDBrowserCheck SettingBrowserCheckEditResponseID = "browser_check" -) - -// Current value of the zone setting. -type SettingBrowserCheckEditResponseValue string - -const ( - SettingBrowserCheckEditResponseValueOn SettingBrowserCheckEditResponseValue = "on" - SettingBrowserCheckEditResponseValueOff SettingBrowserCheckEditResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingBrowserCheckEditResponseEditable bool - -const ( - SettingBrowserCheckEditResponseEditableTrue SettingBrowserCheckEditResponseEditable = true - SettingBrowserCheckEditResponseEditableFalse SettingBrowserCheckEditResponseEditable = false -) - -// Browser Integrity Check is similar to Bad Behavior and looks for common HTTP -// headers abused most commonly by spammers and denies access to your page. It will -// also challenge visitors that do not have a user agent or a non standard user -// agent (also commonly used by abuse bots, crawlers or visitors). -// (https://support.cloudflare.com/hc/en-us/articles/200170086). -type SettingBrowserCheckGetResponse struct { - // ID of the zone setting. - ID SettingBrowserCheckGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingBrowserCheckGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingBrowserCheckGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingBrowserCheckGetResponseJSON `json:"-"` -} - -// settingBrowserCheckGetResponseJSON contains the JSON metadata for the struct -// [SettingBrowserCheckGetResponse] -type settingBrowserCheckGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrowserCheckGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingBrowserCheckGetResponseID string - -const ( - SettingBrowserCheckGetResponseIDBrowserCheck SettingBrowserCheckGetResponseID = "browser_check" -) - -// Current value of the zone setting. -type SettingBrowserCheckGetResponseValue string - -const ( - SettingBrowserCheckGetResponseValueOn SettingBrowserCheckGetResponseValue = "on" - SettingBrowserCheckGetResponseValueOff SettingBrowserCheckGetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingBrowserCheckGetResponseEditable bool - -const ( - SettingBrowserCheckGetResponseEditableTrue SettingBrowserCheckGetResponseEditable = true - SettingBrowserCheckGetResponseEditableFalse SettingBrowserCheckGetResponseEditable = false -) - -type SettingBrowserCheckEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingBrowserCheckEditParamsValue] `json:"value,required"` -} - -func (r SettingBrowserCheckEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingBrowserCheckEditParamsValue string - -const ( - SettingBrowserCheckEditParamsValueOn SettingBrowserCheckEditParamsValue = "on" - SettingBrowserCheckEditParamsValueOff SettingBrowserCheckEditParamsValue = "off" -) - -type SettingBrowserCheckEditResponseEnvelope struct { - Errors []SettingBrowserCheckEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingBrowserCheckEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Browser Integrity Check is similar to Bad Behavior and looks for common HTTP - // headers abused most commonly by spammers and denies access to your page. It will - // also challenge visitors that do not have a user agent or a non standard user - // agent (also commonly used by abuse bots, crawlers or visitors). - // (https://support.cloudflare.com/hc/en-us/articles/200170086). - Result SettingBrowserCheckEditResponse `json:"result"` - JSON settingBrowserCheckEditResponseEnvelopeJSON `json:"-"` -} - -// settingBrowserCheckEditResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingBrowserCheckEditResponseEnvelope] -type settingBrowserCheckEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrowserCheckEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingBrowserCheckEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingBrowserCheckEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingBrowserCheckEditResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [SettingBrowserCheckEditResponseEnvelopeErrors] -type settingBrowserCheckEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrowserCheckEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingBrowserCheckEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingBrowserCheckEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingBrowserCheckEditResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingBrowserCheckEditResponseEnvelopeMessages] -type settingBrowserCheckEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrowserCheckEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingBrowserCheckGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingBrowserCheckGetResponseEnvelope struct { - Errors []SettingBrowserCheckGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingBrowserCheckGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Browser Integrity Check is similar to Bad Behavior and looks for common HTTP - // headers abused most commonly by spammers and denies access to your page. It will - // also challenge visitors that do not have a user agent or a non standard user - // agent (also commonly used by abuse bots, crawlers or visitors). - // (https://support.cloudflare.com/hc/en-us/articles/200170086). - Result SettingBrowserCheckGetResponse `json:"result"` - JSON settingBrowserCheckGetResponseEnvelopeJSON `json:"-"` -} - -// settingBrowserCheckGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingBrowserCheckGetResponseEnvelope] -type settingBrowserCheckGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrowserCheckGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingBrowserCheckGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingBrowserCheckGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingBrowserCheckGetResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [SettingBrowserCheckGetResponseEnvelopeErrors] -type settingBrowserCheckGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrowserCheckGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingBrowserCheckGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingBrowserCheckGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingBrowserCheckGetResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingBrowserCheckGetResponseEnvelopeMessages] -type settingBrowserCheckGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingBrowserCheckGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingcachelevel.go b/settingcachelevel.go deleted file mode 100644 index affe23fbacf..00000000000 --- a/settingcachelevel.go +++ /dev/null @@ -1,342 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingCacheLevelService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingCacheLevelService] method -// instead. -type SettingCacheLevelService struct { - Options []option.RequestOption -} - -// NewSettingCacheLevelService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingCacheLevelService(opts ...option.RequestOption) (r *SettingCacheLevelService) { - r = &SettingCacheLevelService{} - r.Options = opts - return -} - -// Cache Level functions based off the setting level. The basic setting will cache -// most static resources (i.e., css, images, and JavaScript). The simplified -// setting will ignore the query string when delivering a cached resource. The -// aggressive setting will cache all static resources, including ones with a query -// string. (https://support.cloudflare.com/hc/en-us/articles/200168256). -func (r *SettingCacheLevelService) Edit(ctx context.Context, params SettingCacheLevelEditParams, opts ...option.RequestOption) (res *SettingCacheLevelEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingCacheLevelEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/cache_level", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Cache Level functions based off the setting level. The basic setting will cache -// most static resources (i.e., css, images, and JavaScript). The simplified -// setting will ignore the query string when delivering a cached resource. The -// aggressive setting will cache all static resources, including ones with a query -// string. (https://support.cloudflare.com/hc/en-us/articles/200168256). -func (r *SettingCacheLevelService) Get(ctx context.Context, query SettingCacheLevelGetParams, opts ...option.RequestOption) (res *SettingCacheLevelGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingCacheLevelGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/cache_level", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Cache Level functions based off the setting level. The basic setting will cache -// most static resources (i.e., css, images, and JavaScript). The simplified -// setting will ignore the query string when delivering a cached resource. The -// aggressive setting will cache all static resources, including ones with a query -// string. (https://support.cloudflare.com/hc/en-us/articles/200168256). -type SettingCacheLevelEditResponse struct { - // ID of the zone setting. - ID SettingCacheLevelEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingCacheLevelEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingCacheLevelEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingCacheLevelEditResponseJSON `json:"-"` -} - -// settingCacheLevelEditResponseJSON contains the JSON metadata for the struct -// [SettingCacheLevelEditResponse] -type settingCacheLevelEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingCacheLevelEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingCacheLevelEditResponseID string - -const ( - SettingCacheLevelEditResponseIDCacheLevel SettingCacheLevelEditResponseID = "cache_level" -) - -// Current value of the zone setting. -type SettingCacheLevelEditResponseValue string - -const ( - SettingCacheLevelEditResponseValueAggressive SettingCacheLevelEditResponseValue = "aggressive" - SettingCacheLevelEditResponseValueBasic SettingCacheLevelEditResponseValue = "basic" - SettingCacheLevelEditResponseValueSimplified SettingCacheLevelEditResponseValue = "simplified" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingCacheLevelEditResponseEditable bool - -const ( - SettingCacheLevelEditResponseEditableTrue SettingCacheLevelEditResponseEditable = true - SettingCacheLevelEditResponseEditableFalse SettingCacheLevelEditResponseEditable = false -) - -// Cache Level functions based off the setting level. The basic setting will cache -// most static resources (i.e., css, images, and JavaScript). The simplified -// setting will ignore the query string when delivering a cached resource. The -// aggressive setting will cache all static resources, including ones with a query -// string. (https://support.cloudflare.com/hc/en-us/articles/200168256). -type SettingCacheLevelGetResponse struct { - // ID of the zone setting. - ID SettingCacheLevelGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingCacheLevelGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingCacheLevelGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingCacheLevelGetResponseJSON `json:"-"` -} - -// settingCacheLevelGetResponseJSON contains the JSON metadata for the struct -// [SettingCacheLevelGetResponse] -type settingCacheLevelGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingCacheLevelGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingCacheLevelGetResponseID string - -const ( - SettingCacheLevelGetResponseIDCacheLevel SettingCacheLevelGetResponseID = "cache_level" -) - -// Current value of the zone setting. -type SettingCacheLevelGetResponseValue string - -const ( - SettingCacheLevelGetResponseValueAggressive SettingCacheLevelGetResponseValue = "aggressive" - SettingCacheLevelGetResponseValueBasic SettingCacheLevelGetResponseValue = "basic" - SettingCacheLevelGetResponseValueSimplified SettingCacheLevelGetResponseValue = "simplified" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingCacheLevelGetResponseEditable bool - -const ( - SettingCacheLevelGetResponseEditableTrue SettingCacheLevelGetResponseEditable = true - SettingCacheLevelGetResponseEditableFalse SettingCacheLevelGetResponseEditable = false -) - -type SettingCacheLevelEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingCacheLevelEditParamsValue] `json:"value,required"` -} - -func (r SettingCacheLevelEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingCacheLevelEditParamsValue string - -const ( - SettingCacheLevelEditParamsValueAggressive SettingCacheLevelEditParamsValue = "aggressive" - SettingCacheLevelEditParamsValueBasic SettingCacheLevelEditParamsValue = "basic" - SettingCacheLevelEditParamsValueSimplified SettingCacheLevelEditParamsValue = "simplified" -) - -type SettingCacheLevelEditResponseEnvelope struct { - Errors []SettingCacheLevelEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingCacheLevelEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Cache Level functions based off the setting level. The basic setting will cache - // most static resources (i.e., css, images, and JavaScript). The simplified - // setting will ignore the query string when delivering a cached resource. The - // aggressive setting will cache all static resources, including ones with a query - // string. (https://support.cloudflare.com/hc/en-us/articles/200168256). - Result SettingCacheLevelEditResponse `json:"result"` - JSON settingCacheLevelEditResponseEnvelopeJSON `json:"-"` -} - -// settingCacheLevelEditResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingCacheLevelEditResponseEnvelope] -type settingCacheLevelEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingCacheLevelEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingCacheLevelEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingCacheLevelEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingCacheLevelEditResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [SettingCacheLevelEditResponseEnvelopeErrors] -type settingCacheLevelEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingCacheLevelEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingCacheLevelEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingCacheLevelEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingCacheLevelEditResponseEnvelopeMessagesJSON contains the JSON metadata for -// the struct [SettingCacheLevelEditResponseEnvelopeMessages] -type settingCacheLevelEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingCacheLevelEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingCacheLevelGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingCacheLevelGetResponseEnvelope struct { - Errors []SettingCacheLevelGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingCacheLevelGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Cache Level functions based off the setting level. The basic setting will cache - // most static resources (i.e., css, images, and JavaScript). The simplified - // setting will ignore the query string when delivering a cached resource. The - // aggressive setting will cache all static resources, including ones with a query - // string. (https://support.cloudflare.com/hc/en-us/articles/200168256). - Result SettingCacheLevelGetResponse `json:"result"` - JSON settingCacheLevelGetResponseEnvelopeJSON `json:"-"` -} - -// settingCacheLevelGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingCacheLevelGetResponseEnvelope] -type settingCacheLevelGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingCacheLevelGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingCacheLevelGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingCacheLevelGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingCacheLevelGetResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [SettingCacheLevelGetResponseEnvelopeErrors] -type settingCacheLevelGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingCacheLevelGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingCacheLevelGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingCacheLevelGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingCacheLevelGetResponseEnvelopeMessagesJSON contains the JSON metadata for -// the struct [SettingCacheLevelGetResponseEnvelopeMessages] -type settingCacheLevelGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingCacheLevelGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingcachelevel_test.go b/settingcachelevel_test.go deleted file mode 100644 index 6c45607b7d5..00000000000 --- a/settingcachelevel_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-sdk-go" - "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -func TestSettingCacheLevelEdit(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.CacheLevel.Edit(context.TODO(), cloudflare.SettingCacheLevelEditParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingCacheLevelEditParamsValueAggressive), - }) - 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 TestSettingCacheLevelGet(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.CacheLevel.Get(context.TODO(), cloudflare.SettingCacheLevelGetParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/settingchallengettl.go b/settingchallengettl.go deleted file mode 100644 index 5bd8f67046e..00000000000 --- a/settingchallengettl.go +++ /dev/null @@ -1,375 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingChallengeTTLService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingChallengeTTLService] -// method instead. -type SettingChallengeTTLService struct { - Options []option.RequestOption -} - -// NewSettingChallengeTTLService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingChallengeTTLService(opts ...option.RequestOption) (r *SettingChallengeTTLService) { - r = &SettingChallengeTTLService{} - r.Options = opts - return -} - -// Specify how long a visitor is allowed access to your site after successfully -// completing a challenge (such as a CAPTCHA). After the TTL has expired the -// visitor will have to complete a new challenge. We recommend a 15 - 45 minute -// setting and will attempt to honor any setting above 45 minutes. -// (https://support.cloudflare.com/hc/en-us/articles/200170136). -func (r *SettingChallengeTTLService) Edit(ctx context.Context, params SettingChallengeTTLEditParams, opts ...option.RequestOption) (res *SettingChallengeTTLEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingChallengeTTLEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/challenge_ttl", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Specify how long a visitor is allowed access to your site after successfully -// completing a challenge (such as a CAPTCHA). After the TTL has expired the -// visitor will have to complete a new challenge. We recommend a 15 - 45 minute -// setting and will attempt to honor any setting above 45 minutes. -// (https://support.cloudflare.com/hc/en-us/articles/200170136). -func (r *SettingChallengeTTLService) Get(ctx context.Context, query SettingChallengeTTLGetParams, opts ...option.RequestOption) (res *SettingChallengeTTLGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingChallengeTTLGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/challenge_ttl", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Specify how long a visitor is allowed access to your site after successfully -// completing a challenge (such as a CAPTCHA). After the TTL has expired the -// visitor will have to complete a new challenge. We recommend a 15 - 45 minute -// setting and will attempt to honor any setting above 45 minutes. -// (https://support.cloudflare.com/hc/en-us/articles/200170136). -type SettingChallengeTTLEditResponse struct { - // ID of the zone setting. - ID SettingChallengeTTLEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingChallengeTTLEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingChallengeTTLEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingChallengeTTLEditResponseJSON `json:"-"` -} - -// settingChallengeTTLEditResponseJSON contains the JSON metadata for the struct -// [SettingChallengeTTLEditResponse] -type settingChallengeTTLEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingChallengeTTLEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingChallengeTTLEditResponseID string - -const ( - SettingChallengeTTLEditResponseIDChallengeTTL SettingChallengeTTLEditResponseID = "challenge_ttl" -) - -// Current value of the zone setting. -type SettingChallengeTTLEditResponseValue float64 - -const ( - SettingChallengeTTLEditResponseValue300 SettingChallengeTTLEditResponseValue = 300 - SettingChallengeTTLEditResponseValue900 SettingChallengeTTLEditResponseValue = 900 - SettingChallengeTTLEditResponseValue1800 SettingChallengeTTLEditResponseValue = 1800 - SettingChallengeTTLEditResponseValue2700 SettingChallengeTTLEditResponseValue = 2700 - SettingChallengeTTLEditResponseValue3600 SettingChallengeTTLEditResponseValue = 3600 - SettingChallengeTTLEditResponseValue7200 SettingChallengeTTLEditResponseValue = 7200 - SettingChallengeTTLEditResponseValue10800 SettingChallengeTTLEditResponseValue = 10800 - SettingChallengeTTLEditResponseValue14400 SettingChallengeTTLEditResponseValue = 14400 - SettingChallengeTTLEditResponseValue28800 SettingChallengeTTLEditResponseValue = 28800 - SettingChallengeTTLEditResponseValue57600 SettingChallengeTTLEditResponseValue = 57600 - SettingChallengeTTLEditResponseValue86400 SettingChallengeTTLEditResponseValue = 86400 - SettingChallengeTTLEditResponseValue604800 SettingChallengeTTLEditResponseValue = 604800 - SettingChallengeTTLEditResponseValue2592000 SettingChallengeTTLEditResponseValue = 2592000 - SettingChallengeTTLEditResponseValue31536000 SettingChallengeTTLEditResponseValue = 31536000 -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingChallengeTTLEditResponseEditable bool - -const ( - SettingChallengeTTLEditResponseEditableTrue SettingChallengeTTLEditResponseEditable = true - SettingChallengeTTLEditResponseEditableFalse SettingChallengeTTLEditResponseEditable = false -) - -// Specify how long a visitor is allowed access to your site after successfully -// completing a challenge (such as a CAPTCHA). After the TTL has expired the -// visitor will have to complete a new challenge. We recommend a 15 - 45 minute -// setting and will attempt to honor any setting above 45 minutes. -// (https://support.cloudflare.com/hc/en-us/articles/200170136). -type SettingChallengeTTLGetResponse struct { - // ID of the zone setting. - ID SettingChallengeTTLGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingChallengeTTLGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingChallengeTTLGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingChallengeTTLGetResponseJSON `json:"-"` -} - -// settingChallengeTTLGetResponseJSON contains the JSON metadata for the struct -// [SettingChallengeTTLGetResponse] -type settingChallengeTTLGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingChallengeTTLGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingChallengeTTLGetResponseID string - -const ( - SettingChallengeTTLGetResponseIDChallengeTTL SettingChallengeTTLGetResponseID = "challenge_ttl" -) - -// Current value of the zone setting. -type SettingChallengeTTLGetResponseValue float64 - -const ( - SettingChallengeTTLGetResponseValue300 SettingChallengeTTLGetResponseValue = 300 - SettingChallengeTTLGetResponseValue900 SettingChallengeTTLGetResponseValue = 900 - SettingChallengeTTLGetResponseValue1800 SettingChallengeTTLGetResponseValue = 1800 - SettingChallengeTTLGetResponseValue2700 SettingChallengeTTLGetResponseValue = 2700 - SettingChallengeTTLGetResponseValue3600 SettingChallengeTTLGetResponseValue = 3600 - SettingChallengeTTLGetResponseValue7200 SettingChallengeTTLGetResponseValue = 7200 - SettingChallengeTTLGetResponseValue10800 SettingChallengeTTLGetResponseValue = 10800 - SettingChallengeTTLGetResponseValue14400 SettingChallengeTTLGetResponseValue = 14400 - SettingChallengeTTLGetResponseValue28800 SettingChallengeTTLGetResponseValue = 28800 - SettingChallengeTTLGetResponseValue57600 SettingChallengeTTLGetResponseValue = 57600 - SettingChallengeTTLGetResponseValue86400 SettingChallengeTTLGetResponseValue = 86400 - SettingChallengeTTLGetResponseValue604800 SettingChallengeTTLGetResponseValue = 604800 - SettingChallengeTTLGetResponseValue2592000 SettingChallengeTTLGetResponseValue = 2592000 - SettingChallengeTTLGetResponseValue31536000 SettingChallengeTTLGetResponseValue = 31536000 -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingChallengeTTLGetResponseEditable bool - -const ( - SettingChallengeTTLGetResponseEditableTrue SettingChallengeTTLGetResponseEditable = true - SettingChallengeTTLGetResponseEditableFalse SettingChallengeTTLGetResponseEditable = false -) - -type SettingChallengeTTLEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingChallengeTTLEditParamsValue] `json:"value,required"` -} - -func (r SettingChallengeTTLEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingChallengeTTLEditParamsValue float64 - -const ( - SettingChallengeTTLEditParamsValue300 SettingChallengeTTLEditParamsValue = 300 - SettingChallengeTTLEditParamsValue900 SettingChallengeTTLEditParamsValue = 900 - SettingChallengeTTLEditParamsValue1800 SettingChallengeTTLEditParamsValue = 1800 - SettingChallengeTTLEditParamsValue2700 SettingChallengeTTLEditParamsValue = 2700 - SettingChallengeTTLEditParamsValue3600 SettingChallengeTTLEditParamsValue = 3600 - SettingChallengeTTLEditParamsValue7200 SettingChallengeTTLEditParamsValue = 7200 - SettingChallengeTTLEditParamsValue10800 SettingChallengeTTLEditParamsValue = 10800 - SettingChallengeTTLEditParamsValue14400 SettingChallengeTTLEditParamsValue = 14400 - SettingChallengeTTLEditParamsValue28800 SettingChallengeTTLEditParamsValue = 28800 - SettingChallengeTTLEditParamsValue57600 SettingChallengeTTLEditParamsValue = 57600 - SettingChallengeTTLEditParamsValue86400 SettingChallengeTTLEditParamsValue = 86400 - SettingChallengeTTLEditParamsValue604800 SettingChallengeTTLEditParamsValue = 604800 - SettingChallengeTTLEditParamsValue2592000 SettingChallengeTTLEditParamsValue = 2592000 - SettingChallengeTTLEditParamsValue31536000 SettingChallengeTTLEditParamsValue = 31536000 -) - -type SettingChallengeTTLEditResponseEnvelope struct { - Errors []SettingChallengeTTLEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingChallengeTTLEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Specify how long a visitor is allowed access to your site after successfully - // completing a challenge (such as a CAPTCHA). After the TTL has expired the - // visitor will have to complete a new challenge. We recommend a 15 - 45 minute - // setting and will attempt to honor any setting above 45 minutes. - // (https://support.cloudflare.com/hc/en-us/articles/200170136). - Result SettingChallengeTTLEditResponse `json:"result"` - JSON settingChallengeTTLEditResponseEnvelopeJSON `json:"-"` -} - -// settingChallengeTTLEditResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingChallengeTTLEditResponseEnvelope] -type settingChallengeTTLEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingChallengeTTLEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingChallengeTTLEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingChallengeTTLEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingChallengeTTLEditResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [SettingChallengeTTLEditResponseEnvelopeErrors] -type settingChallengeTTLEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingChallengeTTLEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingChallengeTTLEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingChallengeTTLEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingChallengeTTLEditResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingChallengeTTLEditResponseEnvelopeMessages] -type settingChallengeTTLEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingChallengeTTLEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingChallengeTTLGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingChallengeTTLGetResponseEnvelope struct { - Errors []SettingChallengeTTLGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingChallengeTTLGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Specify how long a visitor is allowed access to your site after successfully - // completing a challenge (such as a CAPTCHA). After the TTL has expired the - // visitor will have to complete a new challenge. We recommend a 15 - 45 minute - // setting and will attempt to honor any setting above 45 minutes. - // (https://support.cloudflare.com/hc/en-us/articles/200170136). - Result SettingChallengeTTLGetResponse `json:"result"` - JSON settingChallengeTTLGetResponseEnvelopeJSON `json:"-"` -} - -// settingChallengeTTLGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingChallengeTTLGetResponseEnvelope] -type settingChallengeTTLGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingChallengeTTLGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingChallengeTTLGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingChallengeTTLGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingChallengeTTLGetResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [SettingChallengeTTLGetResponseEnvelopeErrors] -type settingChallengeTTLGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingChallengeTTLGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingChallengeTTLGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingChallengeTTLGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingChallengeTTLGetResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingChallengeTTLGetResponseEnvelopeMessages] -type settingChallengeTTLGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingChallengeTTLGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingchallengettl_test.go b/settingchallengettl_test.go deleted file mode 100644 index c8db068cbad..00000000000 --- a/settingchallengettl_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-sdk-go" - "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -func TestSettingChallengeTTLEdit(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.ChallengeTTL.Edit(context.TODO(), cloudflare.SettingChallengeTTLEditParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingChallengeTTLEditParamsValue300), - }) - 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 TestSettingChallengeTTLGet(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.ChallengeTTL.Get(context.TODO(), cloudflare.SettingChallengeTTLGetParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/settingcipher.go b/settingcipher.go deleted file mode 100644 index 1c27d1fbe3b..00000000000 --- a/settingcipher.go +++ /dev/null @@ -1,295 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingCipherService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingCipherService] method -// instead. -type SettingCipherService struct { - Options []option.RequestOption -} - -// NewSettingCipherService generates a new service that applies the given options -// to each request. These options are applied after the parent client's options (if -// there is one), and before any request-specific options. -func NewSettingCipherService(opts ...option.RequestOption) (r *SettingCipherService) { - r = &SettingCipherService{} - r.Options = opts - return -} - -// Changes ciphers setting. -func (r *SettingCipherService) Edit(ctx context.Context, params SettingCipherEditParams, opts ...option.RequestOption) (res *SettingCipherEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingCipherEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/ciphers", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Gets ciphers setting. -func (r *SettingCipherService) Get(ctx context.Context, query SettingCipherGetParams, opts ...option.RequestOption) (res *SettingCipherGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingCipherGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/ciphers", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// An allowlist of ciphers for TLS termination. These ciphers must be in the -// BoringSSL format. -type SettingCipherEditResponse struct { - // ID of the zone setting. - ID SettingCipherEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value []string `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingCipherEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingCipherEditResponseJSON `json:"-"` -} - -// settingCipherEditResponseJSON contains the JSON metadata for the struct -// [SettingCipherEditResponse] -type settingCipherEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingCipherEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingCipherEditResponseID string - -const ( - SettingCipherEditResponseIDCiphers SettingCipherEditResponseID = "ciphers" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingCipherEditResponseEditable bool - -const ( - SettingCipherEditResponseEditableTrue SettingCipherEditResponseEditable = true - SettingCipherEditResponseEditableFalse SettingCipherEditResponseEditable = false -) - -// An allowlist of ciphers for TLS termination. These ciphers must be in the -// BoringSSL format. -type SettingCipherGetResponse struct { - // ID of the zone setting. - ID SettingCipherGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value []string `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingCipherGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingCipherGetResponseJSON `json:"-"` -} - -// settingCipherGetResponseJSON contains the JSON metadata for the struct -// [SettingCipherGetResponse] -type settingCipherGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingCipherGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingCipherGetResponseID string - -const ( - SettingCipherGetResponseIDCiphers SettingCipherGetResponseID = "ciphers" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingCipherGetResponseEditable bool - -const ( - SettingCipherGetResponseEditableTrue SettingCipherGetResponseEditable = true - SettingCipherGetResponseEditableFalse SettingCipherGetResponseEditable = false -) - -type SettingCipherEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[[]string] `json:"value,required"` -} - -func (r SettingCipherEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type SettingCipherEditResponseEnvelope struct { - Errors []SettingCipherEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingCipherEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // An allowlist of ciphers for TLS termination. These ciphers must be in the - // BoringSSL format. - Result SettingCipherEditResponse `json:"result"` - JSON settingCipherEditResponseEnvelopeJSON `json:"-"` -} - -// settingCipherEditResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingCipherEditResponseEnvelope] -type settingCipherEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingCipherEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingCipherEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingCipherEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingCipherEditResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingCipherEditResponseEnvelopeErrors] -type settingCipherEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingCipherEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingCipherEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingCipherEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingCipherEditResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingCipherEditResponseEnvelopeMessages] -type settingCipherEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingCipherEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingCipherGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingCipherGetResponseEnvelope struct { - Errors []SettingCipherGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingCipherGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // An allowlist of ciphers for TLS termination. These ciphers must be in the - // BoringSSL format. - Result SettingCipherGetResponse `json:"result"` - JSON settingCipherGetResponseEnvelopeJSON `json:"-"` -} - -// settingCipherGetResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingCipherGetResponseEnvelope] -type settingCipherGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingCipherGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingCipherGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingCipherGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingCipherGetResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingCipherGetResponseEnvelopeErrors] -type settingCipherGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingCipherGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingCipherGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingCipherGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingCipherGetResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingCipherGetResponseEnvelopeMessages] -type settingCipherGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingCipherGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingdevelopmentmode.go b/settingdevelopmentmode.go deleted file mode 100644 index 33ef729020d..00000000000 --- a/settingdevelopmentmode.go +++ /dev/null @@ -1,355 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingDevelopmentModeService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingDevelopmentModeService] -// method instead. -type SettingDevelopmentModeService struct { - Options []option.RequestOption -} - -// NewSettingDevelopmentModeService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingDevelopmentModeService(opts ...option.RequestOption) (r *SettingDevelopmentModeService) { - r = &SettingDevelopmentModeService{} - r.Options = opts - return -} - -// Development Mode temporarily allows you to enter development mode for your -// websites if you need to make changes to your site. This will bypass Cloudflare's -// accelerated cache and slow down your site, but is useful if you are making -// changes to cacheable content (like images, css, or JavaScript) and would like to -// see those changes right away. Once entered, development mode will last for 3 -// hours and then automatically toggle off. -func (r *SettingDevelopmentModeService) Edit(ctx context.Context, params SettingDevelopmentModeEditParams, opts ...option.RequestOption) (res *SettingDevelopmentModeEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingDevelopmentModeEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/development_mode", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Development Mode temporarily allows you to enter development mode for your -// websites if you need to make changes to your site. This will bypass Cloudflare's -// accelerated cache and slow down your site, but is useful if you are making -// changes to cacheable content (like images, css, or JavaScript) and would like to -// see those changes right away. Once entered, development mode will last for 3 -// hours and then automatically toggle off. -func (r *SettingDevelopmentModeService) Get(ctx context.Context, query SettingDevelopmentModeGetParams, opts ...option.RequestOption) (res *SettingDevelopmentModeGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingDevelopmentModeGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/development_mode", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Development Mode temporarily allows you to enter development mode for your -// websites if you need to make changes to your site. This will bypass Cloudflare's -// accelerated cache and slow down your site, but is useful if you are making -// changes to cacheable content (like images, css, or JavaScript) and would like to -// see those changes right away. Once entered, development mode will last for 3 -// hours and then automatically toggle off. -type SettingDevelopmentModeEditResponse struct { - // ID of the zone setting. - ID SettingDevelopmentModeEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingDevelopmentModeEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingDevelopmentModeEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - // Value of the zone setting. Notes: The interval (in seconds) from when - // development mode expires (positive integer) or last expired (negative integer) - // for the domain. If development mode has never been enabled, this value is false. - TimeRemaining float64 `json:"time_remaining"` - JSON settingDevelopmentModeEditResponseJSON `json:"-"` -} - -// settingDevelopmentModeEditResponseJSON contains the JSON metadata for the struct -// [SettingDevelopmentModeEditResponse] -type settingDevelopmentModeEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - TimeRemaining apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingDevelopmentModeEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingDevelopmentModeEditResponseID string - -const ( - SettingDevelopmentModeEditResponseIDDevelopmentMode SettingDevelopmentModeEditResponseID = "development_mode" -) - -// Current value of the zone setting. -type SettingDevelopmentModeEditResponseValue string - -const ( - SettingDevelopmentModeEditResponseValueOn SettingDevelopmentModeEditResponseValue = "on" - SettingDevelopmentModeEditResponseValueOff SettingDevelopmentModeEditResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingDevelopmentModeEditResponseEditable bool - -const ( - SettingDevelopmentModeEditResponseEditableTrue SettingDevelopmentModeEditResponseEditable = true - SettingDevelopmentModeEditResponseEditableFalse SettingDevelopmentModeEditResponseEditable = false -) - -// Development Mode temporarily allows you to enter development mode for your -// websites if you need to make changes to your site. This will bypass Cloudflare's -// accelerated cache and slow down your site, but is useful if you are making -// changes to cacheable content (like images, css, or JavaScript) and would like to -// see those changes right away. Once entered, development mode will last for 3 -// hours and then automatically toggle off. -type SettingDevelopmentModeGetResponse struct { - // ID of the zone setting. - ID SettingDevelopmentModeGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingDevelopmentModeGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingDevelopmentModeGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - // Value of the zone setting. Notes: The interval (in seconds) from when - // development mode expires (positive integer) or last expired (negative integer) - // for the domain. If development mode has never been enabled, this value is false. - TimeRemaining float64 `json:"time_remaining"` - JSON settingDevelopmentModeGetResponseJSON `json:"-"` -} - -// settingDevelopmentModeGetResponseJSON contains the JSON metadata for the struct -// [SettingDevelopmentModeGetResponse] -type settingDevelopmentModeGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - TimeRemaining apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingDevelopmentModeGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingDevelopmentModeGetResponseID string - -const ( - SettingDevelopmentModeGetResponseIDDevelopmentMode SettingDevelopmentModeGetResponseID = "development_mode" -) - -// Current value of the zone setting. -type SettingDevelopmentModeGetResponseValue string - -const ( - SettingDevelopmentModeGetResponseValueOn SettingDevelopmentModeGetResponseValue = "on" - SettingDevelopmentModeGetResponseValueOff SettingDevelopmentModeGetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingDevelopmentModeGetResponseEditable bool - -const ( - SettingDevelopmentModeGetResponseEditableTrue SettingDevelopmentModeGetResponseEditable = true - SettingDevelopmentModeGetResponseEditableFalse SettingDevelopmentModeGetResponseEditable = false -) - -type SettingDevelopmentModeEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingDevelopmentModeEditParamsValue] `json:"value,required"` -} - -func (r SettingDevelopmentModeEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingDevelopmentModeEditParamsValue string - -const ( - SettingDevelopmentModeEditParamsValueOn SettingDevelopmentModeEditParamsValue = "on" - SettingDevelopmentModeEditParamsValueOff SettingDevelopmentModeEditParamsValue = "off" -) - -type SettingDevelopmentModeEditResponseEnvelope struct { - Errors []SettingDevelopmentModeEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingDevelopmentModeEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Development Mode temporarily allows you to enter development mode for your - // websites if you need to make changes to your site. This will bypass Cloudflare's - // accelerated cache and slow down your site, but is useful if you are making - // changes to cacheable content (like images, css, or JavaScript) and would like to - // see those changes right away. Once entered, development mode will last for 3 - // hours and then automatically toggle off. - Result SettingDevelopmentModeEditResponse `json:"result"` - JSON settingDevelopmentModeEditResponseEnvelopeJSON `json:"-"` -} - -// settingDevelopmentModeEditResponseEnvelopeJSON contains the JSON metadata for -// the struct [SettingDevelopmentModeEditResponseEnvelope] -type settingDevelopmentModeEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingDevelopmentModeEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingDevelopmentModeEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingDevelopmentModeEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingDevelopmentModeEditResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingDevelopmentModeEditResponseEnvelopeErrors] -type settingDevelopmentModeEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingDevelopmentModeEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingDevelopmentModeEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingDevelopmentModeEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingDevelopmentModeEditResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [SettingDevelopmentModeEditResponseEnvelopeMessages] -type settingDevelopmentModeEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingDevelopmentModeEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingDevelopmentModeGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingDevelopmentModeGetResponseEnvelope struct { - Errors []SettingDevelopmentModeGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingDevelopmentModeGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Development Mode temporarily allows you to enter development mode for your - // websites if you need to make changes to your site. This will bypass Cloudflare's - // accelerated cache and slow down your site, but is useful if you are making - // changes to cacheable content (like images, css, or JavaScript) and would like to - // see those changes right away. Once entered, development mode will last for 3 - // hours and then automatically toggle off. - Result SettingDevelopmentModeGetResponse `json:"result"` - JSON settingDevelopmentModeGetResponseEnvelopeJSON `json:"-"` -} - -// settingDevelopmentModeGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingDevelopmentModeGetResponseEnvelope] -type settingDevelopmentModeGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingDevelopmentModeGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingDevelopmentModeGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingDevelopmentModeGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingDevelopmentModeGetResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingDevelopmentModeGetResponseEnvelopeErrors] -type settingDevelopmentModeGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingDevelopmentModeGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingDevelopmentModeGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingDevelopmentModeGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingDevelopmentModeGetResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingDevelopmentModeGetResponseEnvelopeMessages] -type settingDevelopmentModeGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingDevelopmentModeGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingearlyhint.go b/settingearlyhint.go deleted file mode 100644 index 38df7fb6f68..00000000000 --- a/settingearlyhint.go +++ /dev/null @@ -1,333 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingEarlyHintService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingEarlyHintService] method -// instead. -type SettingEarlyHintService struct { - Options []option.RequestOption -} - -// NewSettingEarlyHintService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingEarlyHintService(opts ...option.RequestOption) (r *SettingEarlyHintService) { - r = &SettingEarlyHintService{} - r.Options = opts - return -} - -// When enabled, Cloudflare will attempt to speed up overall page loads by serving -// `103` responses with `Link` headers from the final response. Refer to -// [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for -// more information. -func (r *SettingEarlyHintService) Edit(ctx context.Context, params SettingEarlyHintEditParams, opts ...option.RequestOption) (res *SettingEarlyHintEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingEarlyHintEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/early_hints", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// When enabled, Cloudflare will attempt to speed up overall page loads by serving -// `103` responses with `Link` headers from the final response. Refer to -// [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for -// more information. -func (r *SettingEarlyHintService) Get(ctx context.Context, query SettingEarlyHintGetParams, opts ...option.RequestOption) (res *SettingEarlyHintGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingEarlyHintGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/early_hints", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// When enabled, Cloudflare will attempt to speed up overall page loads by serving -// `103` responses with `Link` headers from the final response. Refer to -// [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for -// more information. -type SettingEarlyHintEditResponse struct { - // ID of the zone setting. - ID SettingEarlyHintEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingEarlyHintEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEarlyHintEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEarlyHintEditResponseJSON `json:"-"` -} - -// settingEarlyHintEditResponseJSON contains the JSON metadata for the struct -// [SettingEarlyHintEditResponse] -type settingEarlyHintEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEarlyHintEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingEarlyHintEditResponseID string - -const ( - SettingEarlyHintEditResponseIDEarlyHints SettingEarlyHintEditResponseID = "early_hints" -) - -// Current value of the zone setting. -type SettingEarlyHintEditResponseValue string - -const ( - SettingEarlyHintEditResponseValueOn SettingEarlyHintEditResponseValue = "on" - SettingEarlyHintEditResponseValueOff SettingEarlyHintEditResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEarlyHintEditResponseEditable bool - -const ( - SettingEarlyHintEditResponseEditableTrue SettingEarlyHintEditResponseEditable = true - SettingEarlyHintEditResponseEditableFalse SettingEarlyHintEditResponseEditable = false -) - -// When enabled, Cloudflare will attempt to speed up overall page loads by serving -// `103` responses with `Link` headers from the final response. Refer to -// [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for -// more information. -type SettingEarlyHintGetResponse struct { - // ID of the zone setting. - ID SettingEarlyHintGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingEarlyHintGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEarlyHintGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEarlyHintGetResponseJSON `json:"-"` -} - -// settingEarlyHintGetResponseJSON contains the JSON metadata for the struct -// [SettingEarlyHintGetResponse] -type settingEarlyHintGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEarlyHintGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingEarlyHintGetResponseID string - -const ( - SettingEarlyHintGetResponseIDEarlyHints SettingEarlyHintGetResponseID = "early_hints" -) - -// Current value of the zone setting. -type SettingEarlyHintGetResponseValue string - -const ( - SettingEarlyHintGetResponseValueOn SettingEarlyHintGetResponseValue = "on" - SettingEarlyHintGetResponseValueOff SettingEarlyHintGetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEarlyHintGetResponseEditable bool - -const ( - SettingEarlyHintGetResponseEditableTrue SettingEarlyHintGetResponseEditable = true - SettingEarlyHintGetResponseEditableFalse SettingEarlyHintGetResponseEditable = false -) - -type SettingEarlyHintEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingEarlyHintEditParamsValue] `json:"value,required"` -} - -func (r SettingEarlyHintEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingEarlyHintEditParamsValue string - -const ( - SettingEarlyHintEditParamsValueOn SettingEarlyHintEditParamsValue = "on" - SettingEarlyHintEditParamsValueOff SettingEarlyHintEditParamsValue = "off" -) - -type SettingEarlyHintEditResponseEnvelope struct { - Errors []SettingEarlyHintEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingEarlyHintEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // When enabled, Cloudflare will attempt to speed up overall page loads by serving - // `103` responses with `Link` headers from the final response. Refer to - // [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for - // more information. - Result SettingEarlyHintEditResponse `json:"result"` - JSON settingEarlyHintEditResponseEnvelopeJSON `json:"-"` -} - -// settingEarlyHintEditResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingEarlyHintEditResponseEnvelope] -type settingEarlyHintEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEarlyHintEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingEarlyHintEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingEarlyHintEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingEarlyHintEditResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [SettingEarlyHintEditResponseEnvelopeErrors] -type settingEarlyHintEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEarlyHintEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingEarlyHintEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingEarlyHintEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingEarlyHintEditResponseEnvelopeMessagesJSON contains the JSON metadata for -// the struct [SettingEarlyHintEditResponseEnvelopeMessages] -type settingEarlyHintEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEarlyHintEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingEarlyHintGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingEarlyHintGetResponseEnvelope struct { - Errors []SettingEarlyHintGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingEarlyHintGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // When enabled, Cloudflare will attempt to speed up overall page loads by serving - // `103` responses with `Link` headers from the final response. Refer to - // [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for - // more information. - Result SettingEarlyHintGetResponse `json:"result"` - JSON settingEarlyHintGetResponseEnvelopeJSON `json:"-"` -} - -// settingEarlyHintGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingEarlyHintGetResponseEnvelope] -type settingEarlyHintGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEarlyHintGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingEarlyHintGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingEarlyHintGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingEarlyHintGetResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingEarlyHintGetResponseEnvelopeErrors] -type settingEarlyHintGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEarlyHintGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingEarlyHintGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingEarlyHintGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingEarlyHintGetResponseEnvelopeMessagesJSON contains the JSON metadata for -// the struct [SettingEarlyHintGetResponseEnvelopeMessages] -type settingEarlyHintGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEarlyHintGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingemailobfuscation.go b/settingemailobfuscation.go deleted file mode 100644 index 9974f4c907c..00000000000 --- a/settingemailobfuscation.go +++ /dev/null @@ -1,321 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingEmailObfuscationService contains methods and other services that help -// with interacting with the cloudflare API. Note, unlike clients, this service -// does not read variables from the environment automatically. You should not -// instantiate this service directly, and instead use the -// [NewSettingEmailObfuscationService] method instead. -type SettingEmailObfuscationService struct { - Options []option.RequestOption -} - -// NewSettingEmailObfuscationService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingEmailObfuscationService(opts ...option.RequestOption) (r *SettingEmailObfuscationService) { - r = &SettingEmailObfuscationService{} - r.Options = opts - return -} - -// Encrypt email adresses on your web page from bots, while keeping them visible to -// humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). -func (r *SettingEmailObfuscationService) Edit(ctx context.Context, params SettingEmailObfuscationEditParams, opts ...option.RequestOption) (res *SettingEmailObfuscationEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingEmailObfuscationEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/email_obfuscation", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Encrypt email adresses on your web page from bots, while keeping them visible to -// humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). -func (r *SettingEmailObfuscationService) Get(ctx context.Context, query SettingEmailObfuscationGetParams, opts ...option.RequestOption) (res *SettingEmailObfuscationGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingEmailObfuscationGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/email_obfuscation", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Encrypt email adresses on your web page from bots, while keeping them visible to -// humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). -type SettingEmailObfuscationEditResponse struct { - // ID of the zone setting. - ID SettingEmailObfuscationEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingEmailObfuscationEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEmailObfuscationEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEmailObfuscationEditResponseJSON `json:"-"` -} - -// settingEmailObfuscationEditResponseJSON contains the JSON metadata for the -// struct [SettingEmailObfuscationEditResponse] -type settingEmailObfuscationEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEmailObfuscationEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingEmailObfuscationEditResponseID string - -const ( - SettingEmailObfuscationEditResponseIDEmailObfuscation SettingEmailObfuscationEditResponseID = "email_obfuscation" -) - -// Current value of the zone setting. -type SettingEmailObfuscationEditResponseValue string - -const ( - SettingEmailObfuscationEditResponseValueOn SettingEmailObfuscationEditResponseValue = "on" - SettingEmailObfuscationEditResponseValueOff SettingEmailObfuscationEditResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEmailObfuscationEditResponseEditable bool - -const ( - SettingEmailObfuscationEditResponseEditableTrue SettingEmailObfuscationEditResponseEditable = true - SettingEmailObfuscationEditResponseEditableFalse SettingEmailObfuscationEditResponseEditable = false -) - -// Encrypt email adresses on your web page from bots, while keeping them visible to -// humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). -type SettingEmailObfuscationGetResponse struct { - // ID of the zone setting. - ID SettingEmailObfuscationGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingEmailObfuscationGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingEmailObfuscationGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingEmailObfuscationGetResponseJSON `json:"-"` -} - -// settingEmailObfuscationGetResponseJSON contains the JSON metadata for the struct -// [SettingEmailObfuscationGetResponse] -type settingEmailObfuscationGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEmailObfuscationGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingEmailObfuscationGetResponseID string - -const ( - SettingEmailObfuscationGetResponseIDEmailObfuscation SettingEmailObfuscationGetResponseID = "email_obfuscation" -) - -// Current value of the zone setting. -type SettingEmailObfuscationGetResponseValue string - -const ( - SettingEmailObfuscationGetResponseValueOn SettingEmailObfuscationGetResponseValue = "on" - SettingEmailObfuscationGetResponseValueOff SettingEmailObfuscationGetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingEmailObfuscationGetResponseEditable bool - -const ( - SettingEmailObfuscationGetResponseEditableTrue SettingEmailObfuscationGetResponseEditable = true - SettingEmailObfuscationGetResponseEditableFalse SettingEmailObfuscationGetResponseEditable = false -) - -type SettingEmailObfuscationEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingEmailObfuscationEditParamsValue] `json:"value,required"` -} - -func (r SettingEmailObfuscationEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingEmailObfuscationEditParamsValue string - -const ( - SettingEmailObfuscationEditParamsValueOn SettingEmailObfuscationEditParamsValue = "on" - SettingEmailObfuscationEditParamsValueOff SettingEmailObfuscationEditParamsValue = "off" -) - -type SettingEmailObfuscationEditResponseEnvelope struct { - Errors []SettingEmailObfuscationEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingEmailObfuscationEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Encrypt email adresses on your web page from bots, while keeping them visible to - // humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). - Result SettingEmailObfuscationEditResponse `json:"result"` - JSON settingEmailObfuscationEditResponseEnvelopeJSON `json:"-"` -} - -// settingEmailObfuscationEditResponseEnvelopeJSON contains the JSON metadata for -// the struct [SettingEmailObfuscationEditResponseEnvelope] -type settingEmailObfuscationEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEmailObfuscationEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingEmailObfuscationEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingEmailObfuscationEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingEmailObfuscationEditResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingEmailObfuscationEditResponseEnvelopeErrors] -type settingEmailObfuscationEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEmailObfuscationEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingEmailObfuscationEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingEmailObfuscationEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingEmailObfuscationEditResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [SettingEmailObfuscationEditResponseEnvelopeMessages] -type settingEmailObfuscationEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEmailObfuscationEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingEmailObfuscationGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingEmailObfuscationGetResponseEnvelope struct { - Errors []SettingEmailObfuscationGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingEmailObfuscationGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Encrypt email adresses on your web page from bots, while keeping them visible to - // humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). - Result SettingEmailObfuscationGetResponse `json:"result"` - JSON settingEmailObfuscationGetResponseEnvelopeJSON `json:"-"` -} - -// settingEmailObfuscationGetResponseEnvelopeJSON contains the JSON metadata for -// the struct [SettingEmailObfuscationGetResponseEnvelope] -type settingEmailObfuscationGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEmailObfuscationGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingEmailObfuscationGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingEmailObfuscationGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingEmailObfuscationGetResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingEmailObfuscationGetResponseEnvelopeErrors] -type settingEmailObfuscationGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEmailObfuscationGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingEmailObfuscationGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingEmailObfuscationGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingEmailObfuscationGetResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [SettingEmailObfuscationGetResponseEnvelopeMessages] -type settingEmailObfuscationGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingEmailObfuscationGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingfontsetting.go b/settingfontsetting.go deleted file mode 100644 index 9dbd200eb2c..00000000000 --- a/settingfontsetting.go +++ /dev/null @@ -1,327 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingFontSettingService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingFontSettingService] method -// instead. -type SettingFontSettingService struct { - Options []option.RequestOption -} - -// NewSettingFontSettingService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingFontSettingService(opts ...option.RequestOption) (r *SettingFontSettingService) { - r = &SettingFontSettingService{} - r.Options = opts - return -} - -// Enhance your website's font delivery with Cloudflare Fonts. Deliver Google -// Hosted fonts from your own domain, boost performance, and enhance user privacy. -// Refer to the Cloudflare Fonts documentation for more information. -func (r *SettingFontSettingService) Edit(ctx context.Context, params SettingFontSettingEditParams, opts ...option.RequestOption) (res *SettingFontSettingEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingFontSettingEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/fonts", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Enhance your website's font delivery with Cloudflare Fonts. Deliver Google -// Hosted fonts from your own domain, boost performance, and enhance user privacy. -// Refer to the Cloudflare Fonts documentation for more information. -func (r *SettingFontSettingService) Get(ctx context.Context, query SettingFontSettingGetParams, opts ...option.RequestOption) (res *SettingFontSettingGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingFontSettingGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/fonts", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Enhance your website's font delivery with Cloudflare Fonts. Deliver Google -// Hosted fonts from your own domain, boost performance, and enhance user privacy. -// Refer to the Cloudflare Fonts documentation for more information. -type SettingFontSettingEditResponse struct { - // ID of the zone setting. - ID SettingFontSettingEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingFontSettingEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingFontSettingEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingFontSettingEditResponseJSON `json:"-"` -} - -// settingFontSettingEditResponseJSON contains the JSON metadata for the struct -// [SettingFontSettingEditResponse] -type settingFontSettingEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingFontSettingEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingFontSettingEditResponseID string - -const ( - SettingFontSettingEditResponseIDFonts SettingFontSettingEditResponseID = "fonts" -) - -// Current value of the zone setting. -type SettingFontSettingEditResponseValue string - -const ( - SettingFontSettingEditResponseValueOn SettingFontSettingEditResponseValue = "on" - SettingFontSettingEditResponseValueOff SettingFontSettingEditResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingFontSettingEditResponseEditable bool - -const ( - SettingFontSettingEditResponseEditableTrue SettingFontSettingEditResponseEditable = true - SettingFontSettingEditResponseEditableFalse SettingFontSettingEditResponseEditable = false -) - -// Enhance your website's font delivery with Cloudflare Fonts. Deliver Google -// Hosted fonts from your own domain, boost performance, and enhance user privacy. -// Refer to the Cloudflare Fonts documentation for more information. -type SettingFontSettingGetResponse struct { - // ID of the zone setting. - ID SettingFontSettingGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingFontSettingGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingFontSettingGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingFontSettingGetResponseJSON `json:"-"` -} - -// settingFontSettingGetResponseJSON contains the JSON metadata for the struct -// [SettingFontSettingGetResponse] -type settingFontSettingGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingFontSettingGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingFontSettingGetResponseID string - -const ( - SettingFontSettingGetResponseIDFonts SettingFontSettingGetResponseID = "fonts" -) - -// Current value of the zone setting. -type SettingFontSettingGetResponseValue string - -const ( - SettingFontSettingGetResponseValueOn SettingFontSettingGetResponseValue = "on" - SettingFontSettingGetResponseValueOff SettingFontSettingGetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingFontSettingGetResponseEditable bool - -const ( - SettingFontSettingGetResponseEditableTrue SettingFontSettingGetResponseEditable = true - SettingFontSettingGetResponseEditableFalse SettingFontSettingGetResponseEditable = false -) - -type SettingFontSettingEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Whether the feature is enabled or disabled. - Value param.Field[SettingFontSettingEditParamsValue] `json:"value,required"` -} - -func (r SettingFontSettingEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Whether the feature is enabled or disabled. -type SettingFontSettingEditParamsValue string - -const ( - SettingFontSettingEditParamsValueOn SettingFontSettingEditParamsValue = "on" - SettingFontSettingEditParamsValueOff SettingFontSettingEditParamsValue = "off" -) - -type SettingFontSettingEditResponseEnvelope struct { - Errors []SettingFontSettingEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingFontSettingEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Enhance your website's font delivery with Cloudflare Fonts. Deliver Google - // Hosted fonts from your own domain, boost performance, and enhance user privacy. - // Refer to the Cloudflare Fonts documentation for more information. - Result SettingFontSettingEditResponse `json:"result"` - JSON settingFontSettingEditResponseEnvelopeJSON `json:"-"` -} - -// settingFontSettingEditResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingFontSettingEditResponseEnvelope] -type settingFontSettingEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingFontSettingEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingFontSettingEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingFontSettingEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingFontSettingEditResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [SettingFontSettingEditResponseEnvelopeErrors] -type settingFontSettingEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingFontSettingEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingFontSettingEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingFontSettingEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingFontSettingEditResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingFontSettingEditResponseEnvelopeMessages] -type settingFontSettingEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingFontSettingEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingFontSettingGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingFontSettingGetResponseEnvelope struct { - Errors []SettingFontSettingGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingFontSettingGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Enhance your website's font delivery with Cloudflare Fonts. Deliver Google - // Hosted fonts from your own domain, boost performance, and enhance user privacy. - // Refer to the Cloudflare Fonts documentation for more information. - Result SettingFontSettingGetResponse `json:"result"` - JSON settingFontSettingGetResponseEnvelopeJSON `json:"-"` -} - -// settingFontSettingGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingFontSettingGetResponseEnvelope] -type settingFontSettingGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingFontSettingGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingFontSettingGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingFontSettingGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingFontSettingGetResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [SettingFontSettingGetResponseEnvelopeErrors] -type settingFontSettingGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingFontSettingGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingFontSettingGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingFontSettingGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingFontSettingGetResponseEnvelopeMessagesJSON contains the JSON metadata for -// the struct [SettingFontSettingGetResponseEnvelopeMessages] -type settingFontSettingGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingFontSettingGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingh2prioritization.go b/settingh2prioritization.go deleted file mode 100644 index 635f77e11a3..00000000000 --- a/settingh2prioritization.go +++ /dev/null @@ -1,358 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingH2PrioritizationService contains methods and other services that help -// with interacting with the cloudflare API. Note, unlike clients, this service -// does not read variables from the environment automatically. You should not -// instantiate this service directly, and instead use the -// [NewSettingH2PrioritizationService] method instead. -type SettingH2PrioritizationService struct { - Options []option.RequestOption -} - -// NewSettingH2PrioritizationService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingH2PrioritizationService(opts ...option.RequestOption) (r *SettingH2PrioritizationService) { - r = &SettingH2PrioritizationService{} - r.Options = opts - return -} - -// Gets HTTP/2 Edge Prioritization setting. -func (r *SettingH2PrioritizationService) Edit(ctx context.Context, params SettingH2PrioritizationEditParams, opts ...option.RequestOption) (res *SettingH2PrioritizationEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingH2PrioritizationEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/h2_prioritization", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Gets HTTP/2 Edge Prioritization setting. -func (r *SettingH2PrioritizationService) Get(ctx context.Context, query SettingH2PrioritizationGetParams, opts ...option.RequestOption) (res *SettingH2PrioritizationGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingH2PrioritizationGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/h2_prioritization", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// HTTP/2 Edge Prioritization optimises the delivery of resources served through -// HTTP/2 to improve page load performance. It also supports fine control of -// content delivery when used in conjunction with Workers. -type SettingH2PrioritizationEditResponse struct { - // ID of the zone setting. - ID SettingH2PrioritizationEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingH2PrioritizationEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingH2PrioritizationEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingH2PrioritizationEditResponseJSON `json:"-"` -} - -// settingH2PrioritizationEditResponseJSON contains the JSON metadata for the -// struct [SettingH2PrioritizationEditResponse] -type settingH2PrioritizationEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingH2PrioritizationEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingH2PrioritizationEditResponseID string - -const ( - SettingH2PrioritizationEditResponseIDH2Prioritization SettingH2PrioritizationEditResponseID = "h2_prioritization" -) - -// Current value of the zone setting. -type SettingH2PrioritizationEditResponseValue string - -const ( - SettingH2PrioritizationEditResponseValueOn SettingH2PrioritizationEditResponseValue = "on" - SettingH2PrioritizationEditResponseValueOff SettingH2PrioritizationEditResponseValue = "off" - SettingH2PrioritizationEditResponseValueCustom SettingH2PrioritizationEditResponseValue = "custom" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingH2PrioritizationEditResponseEditable bool - -const ( - SettingH2PrioritizationEditResponseEditableTrue SettingH2PrioritizationEditResponseEditable = true - SettingH2PrioritizationEditResponseEditableFalse SettingH2PrioritizationEditResponseEditable = false -) - -// HTTP/2 Edge Prioritization optimises the delivery of resources served through -// HTTP/2 to improve page load performance. It also supports fine control of -// content delivery when used in conjunction with Workers. -type SettingH2PrioritizationGetResponse struct { - // ID of the zone setting. - ID SettingH2PrioritizationGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingH2PrioritizationGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingH2PrioritizationGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingH2PrioritizationGetResponseJSON `json:"-"` -} - -// settingH2PrioritizationGetResponseJSON contains the JSON metadata for the struct -// [SettingH2PrioritizationGetResponse] -type settingH2PrioritizationGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingH2PrioritizationGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingH2PrioritizationGetResponseID string - -const ( - SettingH2PrioritizationGetResponseIDH2Prioritization SettingH2PrioritizationGetResponseID = "h2_prioritization" -) - -// Current value of the zone setting. -type SettingH2PrioritizationGetResponseValue string - -const ( - SettingH2PrioritizationGetResponseValueOn SettingH2PrioritizationGetResponseValue = "on" - SettingH2PrioritizationGetResponseValueOff SettingH2PrioritizationGetResponseValue = "off" - SettingH2PrioritizationGetResponseValueCustom SettingH2PrioritizationGetResponseValue = "custom" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingH2PrioritizationGetResponseEditable bool - -const ( - SettingH2PrioritizationGetResponseEditableTrue SettingH2PrioritizationGetResponseEditable = true - SettingH2PrioritizationGetResponseEditableFalse SettingH2PrioritizationGetResponseEditable = false -) - -type SettingH2PrioritizationEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // HTTP/2 Edge Prioritization optimises the delivery of resources served through - // HTTP/2 to improve page load performance. It also supports fine control of - // content delivery when used in conjunction with Workers. - Value param.Field[SettingH2PrioritizationEditParamsValue] `json:"value,required"` -} - -func (r SettingH2PrioritizationEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// HTTP/2 Edge Prioritization optimises the delivery of resources served through -// HTTP/2 to improve page load performance. It also supports fine control of -// content delivery when used in conjunction with Workers. -type SettingH2PrioritizationEditParamsValue struct { - // ID of the zone setting. - ID param.Field[SettingH2PrioritizationEditParamsValueID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingH2PrioritizationEditParamsValueValue] `json:"value,required"` -} - -func (r SettingH2PrioritizationEditParamsValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// ID of the zone setting. -type SettingH2PrioritizationEditParamsValueID string - -const ( - SettingH2PrioritizationEditParamsValueIDH2Prioritization SettingH2PrioritizationEditParamsValueID = "h2_prioritization" -) - -// Current value of the zone setting. -type SettingH2PrioritizationEditParamsValueValue string - -const ( - SettingH2PrioritizationEditParamsValueValueOn SettingH2PrioritizationEditParamsValueValue = "on" - SettingH2PrioritizationEditParamsValueValueOff SettingH2PrioritizationEditParamsValueValue = "off" - SettingH2PrioritizationEditParamsValueValueCustom SettingH2PrioritizationEditParamsValueValue = "custom" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingH2PrioritizationEditParamsValueEditable bool - -const ( - SettingH2PrioritizationEditParamsValueEditableTrue SettingH2PrioritizationEditParamsValueEditable = true - SettingH2PrioritizationEditParamsValueEditableFalse SettingH2PrioritizationEditParamsValueEditable = false -) - -type SettingH2PrioritizationEditResponseEnvelope struct { - Errors []SettingH2PrioritizationEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingH2PrioritizationEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // HTTP/2 Edge Prioritization optimises the delivery of resources served through - // HTTP/2 to improve page load performance. It also supports fine control of - // content delivery when used in conjunction with Workers. - Result SettingH2PrioritizationEditResponse `json:"result"` - JSON settingH2PrioritizationEditResponseEnvelopeJSON `json:"-"` -} - -// settingH2PrioritizationEditResponseEnvelopeJSON contains the JSON metadata for -// the struct [SettingH2PrioritizationEditResponseEnvelope] -type settingH2PrioritizationEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingH2PrioritizationEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingH2PrioritizationEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingH2PrioritizationEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingH2PrioritizationEditResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingH2PrioritizationEditResponseEnvelopeErrors] -type settingH2PrioritizationEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingH2PrioritizationEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingH2PrioritizationEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingH2PrioritizationEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingH2PrioritizationEditResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [SettingH2PrioritizationEditResponseEnvelopeMessages] -type settingH2PrioritizationEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingH2PrioritizationEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingH2PrioritizationGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingH2PrioritizationGetResponseEnvelope struct { - Errors []SettingH2PrioritizationGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingH2PrioritizationGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // HTTP/2 Edge Prioritization optimises the delivery of resources served through - // HTTP/2 to improve page load performance. It also supports fine control of - // content delivery when used in conjunction with Workers. - Result SettingH2PrioritizationGetResponse `json:"result"` - JSON settingH2PrioritizationGetResponseEnvelopeJSON `json:"-"` -} - -// settingH2PrioritizationGetResponseEnvelopeJSON contains the JSON metadata for -// the struct [SettingH2PrioritizationGetResponseEnvelope] -type settingH2PrioritizationGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingH2PrioritizationGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingH2PrioritizationGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingH2PrioritizationGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingH2PrioritizationGetResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingH2PrioritizationGetResponseEnvelopeErrors] -type settingH2PrioritizationGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingH2PrioritizationGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingH2PrioritizationGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingH2PrioritizationGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingH2PrioritizationGetResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [SettingH2PrioritizationGetResponseEnvelopeMessages] -type settingH2PrioritizationGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingH2PrioritizationGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settinghotlinkprotection.go b/settinghotlinkprotection.go deleted file mode 100644 index b4066a493ec..00000000000 --- a/settinghotlinkprotection.go +++ /dev/null @@ -1,351 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingHotlinkProtectionService contains methods and other services that help -// with interacting with the cloudflare API. Note, unlike clients, this service -// does not read variables from the environment automatically. You should not -// instantiate this service directly, and instead use the -// [NewSettingHotlinkProtectionService] method instead. -type SettingHotlinkProtectionService struct { - Options []option.RequestOption -} - -// NewSettingHotlinkProtectionService generates a new service that applies the -// given options to each request. These options are applied after the parent -// client's options (if there is one), and before any request-specific options. -func NewSettingHotlinkProtectionService(opts ...option.RequestOption) (r *SettingHotlinkProtectionService) { - r = &SettingHotlinkProtectionService{} - r.Options = opts - return -} - -// When enabled, the Hotlink Protection option ensures that other sites cannot suck -// up your bandwidth by building pages that use images hosted on your site. Anytime -// a request for an image on your site hits Cloudflare, we check to ensure that -// it's not another site requesting them. People will still be able to download and -// view images from your page, but other sites won't be able to steal them for use -// on their own pages. -// (https://support.cloudflare.com/hc/en-us/articles/200170026). -func (r *SettingHotlinkProtectionService) Edit(ctx context.Context, params SettingHotlinkProtectionEditParams, opts ...option.RequestOption) (res *SettingHotlinkProtectionEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingHotlinkProtectionEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/hotlink_protection", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// When enabled, the Hotlink Protection option ensures that other sites cannot suck -// up your bandwidth by building pages that use images hosted on your site. Anytime -// a request for an image on your site hits Cloudflare, we check to ensure that -// it's not another site requesting them. People will still be able to download and -// view images from your page, but other sites won't be able to steal them for use -// on their own pages. -// (https://support.cloudflare.com/hc/en-us/articles/200170026). -func (r *SettingHotlinkProtectionService) Get(ctx context.Context, query SettingHotlinkProtectionGetParams, opts ...option.RequestOption) (res *SettingHotlinkProtectionGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingHotlinkProtectionGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/hotlink_protection", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// When enabled, the Hotlink Protection option ensures that other sites cannot suck -// up your bandwidth by building pages that use images hosted on your site. Anytime -// a request for an image on your site hits Cloudflare, we check to ensure that -// it's not another site requesting them. People will still be able to download and -// view images from your page, but other sites won't be able to steal them for use -// on their own pages. -// (https://support.cloudflare.com/hc/en-us/articles/200170026). -type SettingHotlinkProtectionEditResponse struct { - // ID of the zone setting. - ID SettingHotlinkProtectionEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingHotlinkProtectionEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingHotlinkProtectionEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingHotlinkProtectionEditResponseJSON `json:"-"` -} - -// settingHotlinkProtectionEditResponseJSON contains the JSON metadata for the -// struct [SettingHotlinkProtectionEditResponse] -type settingHotlinkProtectionEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHotlinkProtectionEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingHotlinkProtectionEditResponseID string - -const ( - SettingHotlinkProtectionEditResponseIDHotlinkProtection SettingHotlinkProtectionEditResponseID = "hotlink_protection" -) - -// Current value of the zone setting. -type SettingHotlinkProtectionEditResponseValue string - -const ( - SettingHotlinkProtectionEditResponseValueOn SettingHotlinkProtectionEditResponseValue = "on" - SettingHotlinkProtectionEditResponseValueOff SettingHotlinkProtectionEditResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingHotlinkProtectionEditResponseEditable bool - -const ( - SettingHotlinkProtectionEditResponseEditableTrue SettingHotlinkProtectionEditResponseEditable = true - SettingHotlinkProtectionEditResponseEditableFalse SettingHotlinkProtectionEditResponseEditable = false -) - -// When enabled, the Hotlink Protection option ensures that other sites cannot suck -// up your bandwidth by building pages that use images hosted on your site. Anytime -// a request for an image on your site hits Cloudflare, we check to ensure that -// it's not another site requesting them. People will still be able to download and -// view images from your page, but other sites won't be able to steal them for use -// on their own pages. -// (https://support.cloudflare.com/hc/en-us/articles/200170026). -type SettingHotlinkProtectionGetResponse struct { - // ID of the zone setting. - ID SettingHotlinkProtectionGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingHotlinkProtectionGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingHotlinkProtectionGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingHotlinkProtectionGetResponseJSON `json:"-"` -} - -// settingHotlinkProtectionGetResponseJSON contains the JSON metadata for the -// struct [SettingHotlinkProtectionGetResponse] -type settingHotlinkProtectionGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHotlinkProtectionGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingHotlinkProtectionGetResponseID string - -const ( - SettingHotlinkProtectionGetResponseIDHotlinkProtection SettingHotlinkProtectionGetResponseID = "hotlink_protection" -) - -// Current value of the zone setting. -type SettingHotlinkProtectionGetResponseValue string - -const ( - SettingHotlinkProtectionGetResponseValueOn SettingHotlinkProtectionGetResponseValue = "on" - SettingHotlinkProtectionGetResponseValueOff SettingHotlinkProtectionGetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingHotlinkProtectionGetResponseEditable bool - -const ( - SettingHotlinkProtectionGetResponseEditableTrue SettingHotlinkProtectionGetResponseEditable = true - SettingHotlinkProtectionGetResponseEditableFalse SettingHotlinkProtectionGetResponseEditable = false -) - -type SettingHotlinkProtectionEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingHotlinkProtectionEditParamsValue] `json:"value,required"` -} - -func (r SettingHotlinkProtectionEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingHotlinkProtectionEditParamsValue string - -const ( - SettingHotlinkProtectionEditParamsValueOn SettingHotlinkProtectionEditParamsValue = "on" - SettingHotlinkProtectionEditParamsValueOff SettingHotlinkProtectionEditParamsValue = "off" -) - -type SettingHotlinkProtectionEditResponseEnvelope struct { - Errors []SettingHotlinkProtectionEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingHotlinkProtectionEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // When enabled, the Hotlink Protection option ensures that other sites cannot suck - // up your bandwidth by building pages that use images hosted on your site. Anytime - // a request for an image on your site hits Cloudflare, we check to ensure that - // it's not another site requesting them. People will still be able to download and - // view images from your page, but other sites won't be able to steal them for use - // on their own pages. - // (https://support.cloudflare.com/hc/en-us/articles/200170026). - Result SettingHotlinkProtectionEditResponse `json:"result"` - JSON settingHotlinkProtectionEditResponseEnvelopeJSON `json:"-"` -} - -// settingHotlinkProtectionEditResponseEnvelopeJSON contains the JSON metadata for -// the struct [SettingHotlinkProtectionEditResponseEnvelope] -type settingHotlinkProtectionEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHotlinkProtectionEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingHotlinkProtectionEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingHotlinkProtectionEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingHotlinkProtectionEditResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [SettingHotlinkProtectionEditResponseEnvelopeErrors] -type settingHotlinkProtectionEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHotlinkProtectionEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingHotlinkProtectionEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingHotlinkProtectionEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingHotlinkProtectionEditResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [SettingHotlinkProtectionEditResponseEnvelopeMessages] -type settingHotlinkProtectionEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHotlinkProtectionEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingHotlinkProtectionGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingHotlinkProtectionGetResponseEnvelope struct { - Errors []SettingHotlinkProtectionGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingHotlinkProtectionGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // When enabled, the Hotlink Protection option ensures that other sites cannot suck - // up your bandwidth by building pages that use images hosted on your site. Anytime - // a request for an image on your site hits Cloudflare, we check to ensure that - // it's not another site requesting them. People will still be able to download and - // view images from your page, but other sites won't be able to steal them for use - // on their own pages. - // (https://support.cloudflare.com/hc/en-us/articles/200170026). - Result SettingHotlinkProtectionGetResponse `json:"result"` - JSON settingHotlinkProtectionGetResponseEnvelopeJSON `json:"-"` -} - -// settingHotlinkProtectionGetResponseEnvelopeJSON contains the JSON metadata for -// the struct [SettingHotlinkProtectionGetResponseEnvelope] -type settingHotlinkProtectionGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHotlinkProtectionGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingHotlinkProtectionGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingHotlinkProtectionGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingHotlinkProtectionGetResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingHotlinkProtectionGetResponseEnvelopeErrors] -type settingHotlinkProtectionGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHotlinkProtectionGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingHotlinkProtectionGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingHotlinkProtectionGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingHotlinkProtectionGetResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [SettingHotlinkProtectionGetResponseEnvelopeMessages] -type settingHotlinkProtectionGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHotlinkProtectionGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settinghttp2.go b/settinghttp2.go deleted file mode 100644 index 7ccd0dff05c..00000000000 --- a/settinghttp2.go +++ /dev/null @@ -1,315 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingHTTP2Service contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingHTTP2Service] method -// instead. -type SettingHTTP2Service struct { - Options []option.RequestOption -} - -// NewSettingHTTP2Service generates a new service that applies the given options to -// each request. These options are applied after the parent client's options (if -// there is one), and before any request-specific options. -func NewSettingHTTP2Service(opts ...option.RequestOption) (r *SettingHTTP2Service) { - r = &SettingHTTP2Service{} - r.Options = opts - return -} - -// Value of the HTTP2 setting. -func (r *SettingHTTP2Service) Edit(ctx context.Context, params SettingHTTP2EditParams, opts ...option.RequestOption) (res *SettingHTTP2EditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingHTTP2EditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/http2", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Value of the HTTP2 setting. -func (r *SettingHTTP2Service) Get(ctx context.Context, query SettingHTTP2GetParams, opts ...option.RequestOption) (res *SettingHTTP2GetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingHTTP2GetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/http2", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// HTTP2 enabled for this zone. -type SettingHTTP2EditResponse struct { - // ID of the zone setting. - ID SettingHTTP2EditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingHTTP2EditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingHTTP2EditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingHTTP2EditResponseJSON `json:"-"` -} - -// settingHTTP2EditResponseJSON contains the JSON metadata for the struct -// [SettingHTTP2EditResponse] -type settingHTTP2EditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHTTP2EditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingHTTP2EditResponseID string - -const ( - SettingHTTP2EditResponseIDHTTP2 SettingHTTP2EditResponseID = "http2" -) - -// Current value of the zone setting. -type SettingHTTP2EditResponseValue string - -const ( - SettingHTTP2EditResponseValueOn SettingHTTP2EditResponseValue = "on" - SettingHTTP2EditResponseValueOff SettingHTTP2EditResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingHTTP2EditResponseEditable bool - -const ( - SettingHTTP2EditResponseEditableTrue SettingHTTP2EditResponseEditable = true - SettingHTTP2EditResponseEditableFalse SettingHTTP2EditResponseEditable = false -) - -// HTTP2 enabled for this zone. -type SettingHTTP2GetResponse struct { - // ID of the zone setting. - ID SettingHTTP2GetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingHTTP2GetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingHTTP2GetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingHTTP2GetResponseJSON `json:"-"` -} - -// settingHTTP2GetResponseJSON contains the JSON metadata for the struct -// [SettingHTTP2GetResponse] -type settingHTTP2GetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHTTP2GetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingHTTP2GetResponseID string - -const ( - SettingHTTP2GetResponseIDHTTP2 SettingHTTP2GetResponseID = "http2" -) - -// Current value of the zone setting. -type SettingHTTP2GetResponseValue string - -const ( - SettingHTTP2GetResponseValueOn SettingHTTP2GetResponseValue = "on" - SettingHTTP2GetResponseValueOff SettingHTTP2GetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingHTTP2GetResponseEditable bool - -const ( - SettingHTTP2GetResponseEditableTrue SettingHTTP2GetResponseEditable = true - SettingHTTP2GetResponseEditableFalse SettingHTTP2GetResponseEditable = false -) - -type SettingHTTP2EditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the HTTP2 setting. - Value param.Field[SettingHTTP2EditParamsValue] `json:"value,required"` -} - -func (r SettingHTTP2EditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the HTTP2 setting. -type SettingHTTP2EditParamsValue string - -const ( - SettingHTTP2EditParamsValueOn SettingHTTP2EditParamsValue = "on" - SettingHTTP2EditParamsValueOff SettingHTTP2EditParamsValue = "off" -) - -type SettingHTTP2EditResponseEnvelope struct { - Errors []SettingHTTP2EditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingHTTP2EditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // HTTP2 enabled for this zone. - Result SettingHTTP2EditResponse `json:"result"` - JSON settingHTTP2EditResponseEnvelopeJSON `json:"-"` -} - -// settingHTTP2EditResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingHTTP2EditResponseEnvelope] -type settingHTTP2EditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHTTP2EditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingHTTP2EditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingHTTP2EditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingHTTP2EditResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingHTTP2EditResponseEnvelopeErrors] -type settingHTTP2EditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHTTP2EditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingHTTP2EditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingHTTP2EditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingHTTP2EditResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingHTTP2EditResponseEnvelopeMessages] -type settingHTTP2EditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHTTP2EditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingHTTP2GetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingHTTP2GetResponseEnvelope struct { - Errors []SettingHTTP2GetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingHTTP2GetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // HTTP2 enabled for this zone. - Result SettingHTTP2GetResponse `json:"result"` - JSON settingHTTP2GetResponseEnvelopeJSON `json:"-"` -} - -// settingHTTP2GetResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingHTTP2GetResponseEnvelope] -type settingHTTP2GetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHTTP2GetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingHTTP2GetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingHTTP2GetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingHTTP2GetResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingHTTP2GetResponseEnvelopeErrors] -type settingHTTP2GetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHTTP2GetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingHTTP2GetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingHTTP2GetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingHTTP2GetResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingHTTP2GetResponseEnvelopeMessages] -type settingHTTP2GetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHTTP2GetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settinghttp3.go b/settinghttp3.go deleted file mode 100644 index 343910ad9dc..00000000000 --- a/settinghttp3.go +++ /dev/null @@ -1,315 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingHTTP3Service contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingHTTP3Service] method -// instead. -type SettingHTTP3Service struct { - Options []option.RequestOption -} - -// NewSettingHTTP3Service generates a new service that applies the given options to -// each request. These options are applied after the parent client's options (if -// there is one), and before any request-specific options. -func NewSettingHTTP3Service(opts ...option.RequestOption) (r *SettingHTTP3Service) { - r = &SettingHTTP3Service{} - r.Options = opts - return -} - -// Value of the HTTP3 setting. -func (r *SettingHTTP3Service) Edit(ctx context.Context, params SettingHTTP3EditParams, opts ...option.RequestOption) (res *SettingHTTP3EditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingHTTP3EditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/http3", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Value of the HTTP3 setting. -func (r *SettingHTTP3Service) Get(ctx context.Context, query SettingHTTP3GetParams, opts ...option.RequestOption) (res *SettingHTTP3GetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingHTTP3GetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/http3", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// HTTP3 enabled for this zone. -type SettingHTTP3EditResponse struct { - // ID of the zone setting. - ID SettingHTTP3EditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingHTTP3EditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingHTTP3EditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingHTTP3EditResponseJSON `json:"-"` -} - -// settingHTTP3EditResponseJSON contains the JSON metadata for the struct -// [SettingHTTP3EditResponse] -type settingHTTP3EditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHTTP3EditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingHTTP3EditResponseID string - -const ( - SettingHTTP3EditResponseIDHTTP3 SettingHTTP3EditResponseID = "http3" -) - -// Current value of the zone setting. -type SettingHTTP3EditResponseValue string - -const ( - SettingHTTP3EditResponseValueOn SettingHTTP3EditResponseValue = "on" - SettingHTTP3EditResponseValueOff SettingHTTP3EditResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingHTTP3EditResponseEditable bool - -const ( - SettingHTTP3EditResponseEditableTrue SettingHTTP3EditResponseEditable = true - SettingHTTP3EditResponseEditableFalse SettingHTTP3EditResponseEditable = false -) - -// HTTP3 enabled for this zone. -type SettingHTTP3GetResponse struct { - // ID of the zone setting. - ID SettingHTTP3GetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingHTTP3GetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingHTTP3GetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingHTTP3GetResponseJSON `json:"-"` -} - -// settingHTTP3GetResponseJSON contains the JSON metadata for the struct -// [SettingHTTP3GetResponse] -type settingHTTP3GetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHTTP3GetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingHTTP3GetResponseID string - -const ( - SettingHTTP3GetResponseIDHTTP3 SettingHTTP3GetResponseID = "http3" -) - -// Current value of the zone setting. -type SettingHTTP3GetResponseValue string - -const ( - SettingHTTP3GetResponseValueOn SettingHTTP3GetResponseValue = "on" - SettingHTTP3GetResponseValueOff SettingHTTP3GetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingHTTP3GetResponseEditable bool - -const ( - SettingHTTP3GetResponseEditableTrue SettingHTTP3GetResponseEditable = true - SettingHTTP3GetResponseEditableFalse SettingHTTP3GetResponseEditable = false -) - -type SettingHTTP3EditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the HTTP3 setting. - Value param.Field[SettingHTTP3EditParamsValue] `json:"value,required"` -} - -func (r SettingHTTP3EditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the HTTP3 setting. -type SettingHTTP3EditParamsValue string - -const ( - SettingHTTP3EditParamsValueOn SettingHTTP3EditParamsValue = "on" - SettingHTTP3EditParamsValueOff SettingHTTP3EditParamsValue = "off" -) - -type SettingHTTP3EditResponseEnvelope struct { - Errors []SettingHTTP3EditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingHTTP3EditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // HTTP3 enabled for this zone. - Result SettingHTTP3EditResponse `json:"result"` - JSON settingHTTP3EditResponseEnvelopeJSON `json:"-"` -} - -// settingHTTP3EditResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingHTTP3EditResponseEnvelope] -type settingHTTP3EditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHTTP3EditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingHTTP3EditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingHTTP3EditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingHTTP3EditResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingHTTP3EditResponseEnvelopeErrors] -type settingHTTP3EditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHTTP3EditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingHTTP3EditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingHTTP3EditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingHTTP3EditResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingHTTP3EditResponseEnvelopeMessages] -type settingHTTP3EditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHTTP3EditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingHTTP3GetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingHTTP3GetResponseEnvelope struct { - Errors []SettingHTTP3GetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingHTTP3GetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // HTTP3 enabled for this zone. - Result SettingHTTP3GetResponse `json:"result"` - JSON settingHTTP3GetResponseEnvelopeJSON `json:"-"` -} - -// settingHTTP3GetResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingHTTP3GetResponseEnvelope] -type settingHTTP3GetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHTTP3GetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingHTTP3GetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingHTTP3GetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingHTTP3GetResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingHTTP3GetResponseEnvelopeErrors] -type settingHTTP3GetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHTTP3GetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingHTTP3GetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingHTTP3GetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingHTTP3GetResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingHTTP3GetResponseEnvelopeMessages] -type settingHTTP3GetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingHTTP3GetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingimageresizing.go b/settingimageresizing.go deleted file mode 100644 index 9437c1714f0..00000000000 --- a/settingimageresizing.go +++ /dev/null @@ -1,370 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingImageResizingService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingImageResizingService] -// method instead. -type SettingImageResizingService struct { - Options []option.RequestOption -} - -// NewSettingImageResizingService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingImageResizingService(opts ...option.RequestOption) (r *SettingImageResizingService) { - r = &SettingImageResizingService{} - r.Options = opts - return -} - -// Image Resizing provides on-demand resizing, conversion and optimisation for -// images served through Cloudflare's network. Refer to the -// [Image Resizing documentation](https://developers.cloudflare.com/images/) for -// more information. -func (r *SettingImageResizingService) Edit(ctx context.Context, params SettingImageResizingEditParams, opts ...option.RequestOption) (res *SettingImageResizingEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingImageResizingEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/image_resizing", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Image Resizing provides on-demand resizing, conversion and optimisation for -// images served through Cloudflare's network. Refer to the -// [Image Resizing documentation](https://developers.cloudflare.com/images/) for -// more information. -func (r *SettingImageResizingService) Get(ctx context.Context, query SettingImageResizingGetParams, opts ...option.RequestOption) (res *SettingImageResizingGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingImageResizingGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/image_resizing", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Image Resizing provides on-demand resizing, conversion and optimisation for -// images served through Cloudflare's network. Refer to the -// [Image Resizing documentation](https://developers.cloudflare.com/images/) for -// more information. -type SettingImageResizingEditResponse struct { - // ID of the zone setting. - ID SettingImageResizingEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingImageResizingEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingImageResizingEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingImageResizingEditResponseJSON `json:"-"` -} - -// settingImageResizingEditResponseJSON contains the JSON metadata for the struct -// [SettingImageResizingEditResponse] -type settingImageResizingEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingImageResizingEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingImageResizingEditResponseID string - -const ( - SettingImageResizingEditResponseIDImageResizing SettingImageResizingEditResponseID = "image_resizing" -) - -// Current value of the zone setting. -type SettingImageResizingEditResponseValue string - -const ( - SettingImageResizingEditResponseValueOn SettingImageResizingEditResponseValue = "on" - SettingImageResizingEditResponseValueOff SettingImageResizingEditResponseValue = "off" - SettingImageResizingEditResponseValueOpen SettingImageResizingEditResponseValue = "open" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingImageResizingEditResponseEditable bool - -const ( - SettingImageResizingEditResponseEditableTrue SettingImageResizingEditResponseEditable = true - SettingImageResizingEditResponseEditableFalse SettingImageResizingEditResponseEditable = false -) - -// Image Resizing provides on-demand resizing, conversion and optimisation for -// images served through Cloudflare's network. Refer to the -// [Image Resizing documentation](https://developers.cloudflare.com/images/) for -// more information. -type SettingImageResizingGetResponse struct { - // ID of the zone setting. - ID SettingImageResizingGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingImageResizingGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingImageResizingGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingImageResizingGetResponseJSON `json:"-"` -} - -// settingImageResizingGetResponseJSON contains the JSON metadata for the struct -// [SettingImageResizingGetResponse] -type settingImageResizingGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingImageResizingGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingImageResizingGetResponseID string - -const ( - SettingImageResizingGetResponseIDImageResizing SettingImageResizingGetResponseID = "image_resizing" -) - -// Current value of the zone setting. -type SettingImageResizingGetResponseValue string - -const ( - SettingImageResizingGetResponseValueOn SettingImageResizingGetResponseValue = "on" - SettingImageResizingGetResponseValueOff SettingImageResizingGetResponseValue = "off" - SettingImageResizingGetResponseValueOpen SettingImageResizingGetResponseValue = "open" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingImageResizingGetResponseEditable bool - -const ( - SettingImageResizingGetResponseEditableTrue SettingImageResizingGetResponseEditable = true - SettingImageResizingGetResponseEditableFalse SettingImageResizingGetResponseEditable = false -) - -type SettingImageResizingEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Image Resizing provides on-demand resizing, conversion and optimisation for - // images served through Cloudflare's network. Refer to the - // [Image Resizing documentation](https://developers.cloudflare.com/images/) for - // more information. - Value param.Field[SettingImageResizingEditParamsValue] `json:"value,required"` -} - -func (r SettingImageResizingEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Image Resizing provides on-demand resizing, conversion and optimisation for -// images served through Cloudflare's network. Refer to the -// [Image Resizing documentation](https://developers.cloudflare.com/images/) for -// more information. -type SettingImageResizingEditParamsValue struct { - // ID of the zone setting. - ID param.Field[SettingImageResizingEditParamsValueID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingImageResizingEditParamsValueValue] `json:"value,required"` -} - -func (r SettingImageResizingEditParamsValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// ID of the zone setting. -type SettingImageResizingEditParamsValueID string - -const ( - SettingImageResizingEditParamsValueIDImageResizing SettingImageResizingEditParamsValueID = "image_resizing" -) - -// Current value of the zone setting. -type SettingImageResizingEditParamsValueValue string - -const ( - SettingImageResizingEditParamsValueValueOn SettingImageResizingEditParamsValueValue = "on" - SettingImageResizingEditParamsValueValueOff SettingImageResizingEditParamsValueValue = "off" - SettingImageResizingEditParamsValueValueOpen SettingImageResizingEditParamsValueValue = "open" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingImageResizingEditParamsValueEditable bool - -const ( - SettingImageResizingEditParamsValueEditableTrue SettingImageResizingEditParamsValueEditable = true - SettingImageResizingEditParamsValueEditableFalse SettingImageResizingEditParamsValueEditable = false -) - -type SettingImageResizingEditResponseEnvelope struct { - Errors []SettingImageResizingEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingImageResizingEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Image Resizing provides on-demand resizing, conversion and optimisation for - // images served through Cloudflare's network. Refer to the - // [Image Resizing documentation](https://developers.cloudflare.com/images/) for - // more information. - Result SettingImageResizingEditResponse `json:"result"` - JSON settingImageResizingEditResponseEnvelopeJSON `json:"-"` -} - -// settingImageResizingEditResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingImageResizingEditResponseEnvelope] -type settingImageResizingEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingImageResizingEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingImageResizingEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingImageResizingEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingImageResizingEditResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingImageResizingEditResponseEnvelopeErrors] -type settingImageResizingEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingImageResizingEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingImageResizingEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingImageResizingEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingImageResizingEditResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingImageResizingEditResponseEnvelopeMessages] -type settingImageResizingEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingImageResizingEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingImageResizingGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingImageResizingGetResponseEnvelope struct { - Errors []SettingImageResizingGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingImageResizingGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Image Resizing provides on-demand resizing, conversion and optimisation for - // images served through Cloudflare's network. Refer to the - // [Image Resizing documentation](https://developers.cloudflare.com/images/) for - // more information. - Result SettingImageResizingGetResponse `json:"result"` - JSON settingImageResizingGetResponseEnvelopeJSON `json:"-"` -} - -// settingImageResizingGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingImageResizingGetResponseEnvelope] -type settingImageResizingGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingImageResizingGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingImageResizingGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingImageResizingGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingImageResizingGetResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [SettingImageResizingGetResponseEnvelopeErrors] -type settingImageResizingGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingImageResizingGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingImageResizingGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingImageResizingGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingImageResizingGetResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingImageResizingGetResponseEnvelopeMessages] -type settingImageResizingGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingImageResizingGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingipgeolocation.go b/settingipgeolocation.go deleted file mode 100644 index 803fd5b8acf..00000000000 --- a/settingipgeolocation.go +++ /dev/null @@ -1,327 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingIPGeolocationService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingIPGeolocationService] -// method instead. -type SettingIPGeolocationService struct { - Options []option.RequestOption -} - -// NewSettingIPGeolocationService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingIPGeolocationService(opts ...option.RequestOption) (r *SettingIPGeolocationService) { - r = &SettingIPGeolocationService{} - r.Options = opts - return -} - -// Enable IP Geolocation to have Cloudflare geolocate visitors to your website and -// pass the country code to you. -// (https://support.cloudflare.com/hc/en-us/articles/200168236). -func (r *SettingIPGeolocationService) Edit(ctx context.Context, params SettingIPGeolocationEditParams, opts ...option.RequestOption) (res *SettingIPGeolocationEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingIPGeolocationEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/ip_geolocation", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Enable IP Geolocation to have Cloudflare geolocate visitors to your website and -// pass the country code to you. -// (https://support.cloudflare.com/hc/en-us/articles/200168236). -func (r *SettingIPGeolocationService) Get(ctx context.Context, query SettingIPGeolocationGetParams, opts ...option.RequestOption) (res *SettingIPGeolocationGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingIPGeolocationGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/ip_geolocation", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Enable IP Geolocation to have Cloudflare geolocate visitors to your website and -// pass the country code to you. -// (https://support.cloudflare.com/hc/en-us/articles/200168236). -type SettingIPGeolocationEditResponse struct { - // ID of the zone setting. - ID SettingIPGeolocationEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingIPGeolocationEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingIPGeolocationEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingIPGeolocationEditResponseJSON `json:"-"` -} - -// settingIPGeolocationEditResponseJSON contains the JSON metadata for the struct -// [SettingIPGeolocationEditResponse] -type settingIPGeolocationEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingIPGeolocationEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingIPGeolocationEditResponseID string - -const ( - SettingIPGeolocationEditResponseIDIPGeolocation SettingIPGeolocationEditResponseID = "ip_geolocation" -) - -// Current value of the zone setting. -type SettingIPGeolocationEditResponseValue string - -const ( - SettingIPGeolocationEditResponseValueOn SettingIPGeolocationEditResponseValue = "on" - SettingIPGeolocationEditResponseValueOff SettingIPGeolocationEditResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingIPGeolocationEditResponseEditable bool - -const ( - SettingIPGeolocationEditResponseEditableTrue SettingIPGeolocationEditResponseEditable = true - SettingIPGeolocationEditResponseEditableFalse SettingIPGeolocationEditResponseEditable = false -) - -// Enable IP Geolocation to have Cloudflare geolocate visitors to your website and -// pass the country code to you. -// (https://support.cloudflare.com/hc/en-us/articles/200168236). -type SettingIPGeolocationGetResponse struct { - // ID of the zone setting. - ID SettingIPGeolocationGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingIPGeolocationGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingIPGeolocationGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingIPGeolocationGetResponseJSON `json:"-"` -} - -// settingIPGeolocationGetResponseJSON contains the JSON metadata for the struct -// [SettingIPGeolocationGetResponse] -type settingIPGeolocationGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingIPGeolocationGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingIPGeolocationGetResponseID string - -const ( - SettingIPGeolocationGetResponseIDIPGeolocation SettingIPGeolocationGetResponseID = "ip_geolocation" -) - -// Current value of the zone setting. -type SettingIPGeolocationGetResponseValue string - -const ( - SettingIPGeolocationGetResponseValueOn SettingIPGeolocationGetResponseValue = "on" - SettingIPGeolocationGetResponseValueOff SettingIPGeolocationGetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingIPGeolocationGetResponseEditable bool - -const ( - SettingIPGeolocationGetResponseEditableTrue SettingIPGeolocationGetResponseEditable = true - SettingIPGeolocationGetResponseEditableFalse SettingIPGeolocationGetResponseEditable = false -) - -type SettingIPGeolocationEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingIPGeolocationEditParamsValue] `json:"value,required"` -} - -func (r SettingIPGeolocationEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingIPGeolocationEditParamsValue string - -const ( - SettingIPGeolocationEditParamsValueOn SettingIPGeolocationEditParamsValue = "on" - SettingIPGeolocationEditParamsValueOff SettingIPGeolocationEditParamsValue = "off" -) - -type SettingIPGeolocationEditResponseEnvelope struct { - Errors []SettingIPGeolocationEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingIPGeolocationEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Enable IP Geolocation to have Cloudflare geolocate visitors to your website and - // pass the country code to you. - // (https://support.cloudflare.com/hc/en-us/articles/200168236). - Result SettingIPGeolocationEditResponse `json:"result"` - JSON settingIPGeolocationEditResponseEnvelopeJSON `json:"-"` -} - -// settingIPGeolocationEditResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingIPGeolocationEditResponseEnvelope] -type settingIPGeolocationEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingIPGeolocationEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingIPGeolocationEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingIPGeolocationEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingIPGeolocationEditResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingIPGeolocationEditResponseEnvelopeErrors] -type settingIPGeolocationEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingIPGeolocationEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingIPGeolocationEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingIPGeolocationEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingIPGeolocationEditResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingIPGeolocationEditResponseEnvelopeMessages] -type settingIPGeolocationEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingIPGeolocationEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingIPGeolocationGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingIPGeolocationGetResponseEnvelope struct { - Errors []SettingIPGeolocationGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingIPGeolocationGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Enable IP Geolocation to have Cloudflare geolocate visitors to your website and - // pass the country code to you. - // (https://support.cloudflare.com/hc/en-us/articles/200168236). - Result SettingIPGeolocationGetResponse `json:"result"` - JSON settingIPGeolocationGetResponseEnvelopeJSON `json:"-"` -} - -// settingIPGeolocationGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingIPGeolocationGetResponseEnvelope] -type settingIPGeolocationGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingIPGeolocationGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingIPGeolocationGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingIPGeolocationGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingIPGeolocationGetResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [SettingIPGeolocationGetResponseEnvelopeErrors] -type settingIPGeolocationGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingIPGeolocationGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingIPGeolocationGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingIPGeolocationGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingIPGeolocationGetResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingIPGeolocationGetResponseEnvelopeMessages] -type settingIPGeolocationGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingIPGeolocationGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingipv6.go b/settingipv6.go deleted file mode 100644 index 7a930c71866..00000000000 --- a/settingipv6.go +++ /dev/null @@ -1,321 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingIPV6Service contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingIPV6Service] method -// instead. -type SettingIPV6Service struct { - Options []option.RequestOption -} - -// NewSettingIPV6Service generates a new service that applies the given options to -// each request. These options are applied after the parent client's options (if -// there is one), and before any request-specific options. -func NewSettingIPV6Service(opts ...option.RequestOption) (r *SettingIPV6Service) { - r = &SettingIPV6Service{} - r.Options = opts - return -} - -// Enable IPv6 on all subdomains that are Cloudflare enabled. -// (https://support.cloudflare.com/hc/en-us/articles/200168586). -func (r *SettingIPV6Service) Edit(ctx context.Context, params SettingIPV6EditParams, opts ...option.RequestOption) (res *SettingIPV6EditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingIPV6EditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/ipv6", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Enable IPv6 on all subdomains that are Cloudflare enabled. -// (https://support.cloudflare.com/hc/en-us/articles/200168586). -func (r *SettingIPV6Service) Get(ctx context.Context, query SettingIPV6GetParams, opts ...option.RequestOption) (res *SettingIPV6GetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingIPV6GetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/ipv6", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Enable IPv6 on all subdomains that are Cloudflare enabled. -// (https://support.cloudflare.com/hc/en-us/articles/200168586). -type SettingIPV6EditResponse struct { - // ID of the zone setting. - ID SettingIPV6EditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingIPV6EditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingIPV6EditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingIPV6EditResponseJSON `json:"-"` -} - -// settingIPV6EditResponseJSON contains the JSON metadata for the struct -// [SettingIPV6EditResponse] -type settingIPV6EditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingIPV6EditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingIPV6EditResponseID string - -const ( - SettingIPV6EditResponseIDIPV6 SettingIPV6EditResponseID = "ipv6" -) - -// Current value of the zone setting. -type SettingIPV6EditResponseValue string - -const ( - SettingIPV6EditResponseValueOff SettingIPV6EditResponseValue = "off" - SettingIPV6EditResponseValueOn SettingIPV6EditResponseValue = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingIPV6EditResponseEditable bool - -const ( - SettingIPV6EditResponseEditableTrue SettingIPV6EditResponseEditable = true - SettingIPV6EditResponseEditableFalse SettingIPV6EditResponseEditable = false -) - -// Enable IPv6 on all subdomains that are Cloudflare enabled. -// (https://support.cloudflare.com/hc/en-us/articles/200168586). -type SettingIPV6GetResponse struct { - // ID of the zone setting. - ID SettingIPV6GetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingIPV6GetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingIPV6GetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingIPV6GetResponseJSON `json:"-"` -} - -// settingIPV6GetResponseJSON contains the JSON metadata for the struct -// [SettingIPV6GetResponse] -type settingIPV6GetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingIPV6GetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingIPV6GetResponseID string - -const ( - SettingIPV6GetResponseIDIPV6 SettingIPV6GetResponseID = "ipv6" -) - -// Current value of the zone setting. -type SettingIPV6GetResponseValue string - -const ( - SettingIPV6GetResponseValueOff SettingIPV6GetResponseValue = "off" - SettingIPV6GetResponseValueOn SettingIPV6GetResponseValue = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingIPV6GetResponseEditable bool - -const ( - SettingIPV6GetResponseEditableTrue SettingIPV6GetResponseEditable = true - SettingIPV6GetResponseEditableFalse SettingIPV6GetResponseEditable = false -) - -type SettingIPV6EditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingIPV6EditParamsValue] `json:"value,required"` -} - -func (r SettingIPV6EditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingIPV6EditParamsValue string - -const ( - SettingIPV6EditParamsValueOff SettingIPV6EditParamsValue = "off" - SettingIPV6EditParamsValueOn SettingIPV6EditParamsValue = "on" -) - -type SettingIPV6EditResponseEnvelope struct { - Errors []SettingIPV6EditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingIPV6EditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Enable IPv6 on all subdomains that are Cloudflare enabled. - // (https://support.cloudflare.com/hc/en-us/articles/200168586). - Result SettingIPV6EditResponse `json:"result"` - JSON settingIPV6EditResponseEnvelopeJSON `json:"-"` -} - -// settingIPV6EditResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingIPV6EditResponseEnvelope] -type settingIPV6EditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingIPV6EditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingIPV6EditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingIPV6EditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingIPV6EditResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingIPV6EditResponseEnvelopeErrors] -type settingIPV6EditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingIPV6EditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingIPV6EditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingIPV6EditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingIPV6EditResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingIPV6EditResponseEnvelopeMessages] -type settingIPV6EditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingIPV6EditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingIPV6GetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingIPV6GetResponseEnvelope struct { - Errors []SettingIPV6GetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingIPV6GetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Enable IPv6 on all subdomains that are Cloudflare enabled. - // (https://support.cloudflare.com/hc/en-us/articles/200168586). - Result SettingIPV6GetResponse `json:"result"` - JSON settingIPV6GetResponseEnvelopeJSON `json:"-"` -} - -// settingIPV6GetResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingIPV6GetResponseEnvelope] -type settingIPV6GetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingIPV6GetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingIPV6GetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingIPV6GetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingIPV6GetResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingIPV6GetResponseEnvelopeErrors] -type settingIPV6GetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingIPV6GetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingIPV6GetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingIPV6GetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingIPV6GetResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingIPV6GetResponseEnvelopeMessages] -type settingIPV6GetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingIPV6GetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingminify.go b/settingminify.go deleted file mode 100644 index a5c895c152f..00000000000 --- a/settingminify.go +++ /dev/null @@ -1,439 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingMinifyService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingMinifyService] method -// instead. -type SettingMinifyService struct { - Options []option.RequestOption -} - -// NewSettingMinifyService generates a new service that applies the given options -// to each request. These options are applied after the parent client's options (if -// there is one), and before any request-specific options. -func NewSettingMinifyService(opts ...option.RequestOption) (r *SettingMinifyService) { - r = &SettingMinifyService{} - r.Options = opts - return -} - -// Automatically minify certain assets for your website. Refer to -// [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) -// for more information. -func (r *SettingMinifyService) Edit(ctx context.Context, params SettingMinifyEditParams, opts ...option.RequestOption) (res *SettingMinifyEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingMinifyEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/minify", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Automatically minify certain assets for your website. Refer to -// [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) -// for more information. -func (r *SettingMinifyService) Get(ctx context.Context, query SettingMinifyGetParams, opts ...option.RequestOption) (res *SettingMinifyGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingMinifyGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/minify", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Automatically minify certain assets for your website. Refer to -// [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) -// for more information. -type SettingMinifyEditResponse struct { - // Zone setting identifier. - ID SettingMinifyEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingMinifyEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingMinifyEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingMinifyEditResponseJSON `json:"-"` -} - -// settingMinifyEditResponseJSON contains the JSON metadata for the struct -// [SettingMinifyEditResponse] -type settingMinifyEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMinifyEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Zone setting identifier. -type SettingMinifyEditResponseID string - -const ( - SettingMinifyEditResponseIDMinify SettingMinifyEditResponseID = "minify" -) - -// Current value of the zone setting. -type SettingMinifyEditResponseValue struct { - // Automatically minify all CSS files for your website. - Css SettingMinifyEditResponseValueCss `json:"css"` - // Automatically minify all HTML files for your website. - HTML SettingMinifyEditResponseValueHTML `json:"html"` - // Automatically minify all JavaScript files for your website. - Js SettingMinifyEditResponseValueJs `json:"js"` - JSON settingMinifyEditResponseValueJSON `json:"-"` -} - -// settingMinifyEditResponseValueJSON contains the JSON metadata for the struct -// [SettingMinifyEditResponseValue] -type settingMinifyEditResponseValueJSON struct { - Css apijson.Field - HTML apijson.Field - Js apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMinifyEditResponseValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Automatically minify all CSS files for your website. -type SettingMinifyEditResponseValueCss string - -const ( - SettingMinifyEditResponseValueCssOn SettingMinifyEditResponseValueCss = "on" - SettingMinifyEditResponseValueCssOff SettingMinifyEditResponseValueCss = "off" -) - -// Automatically minify all HTML files for your website. -type SettingMinifyEditResponseValueHTML string - -const ( - SettingMinifyEditResponseValueHTMLOn SettingMinifyEditResponseValueHTML = "on" - SettingMinifyEditResponseValueHTMLOff SettingMinifyEditResponseValueHTML = "off" -) - -// Automatically minify all JavaScript files for your website. -type SettingMinifyEditResponseValueJs string - -const ( - SettingMinifyEditResponseValueJsOn SettingMinifyEditResponseValueJs = "on" - SettingMinifyEditResponseValueJsOff SettingMinifyEditResponseValueJs = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingMinifyEditResponseEditable bool - -const ( - SettingMinifyEditResponseEditableTrue SettingMinifyEditResponseEditable = true - SettingMinifyEditResponseEditableFalse SettingMinifyEditResponseEditable = false -) - -// Automatically minify certain assets for your website. Refer to -// [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) -// for more information. -type SettingMinifyGetResponse struct { - // Zone setting identifier. - ID SettingMinifyGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingMinifyGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingMinifyGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingMinifyGetResponseJSON `json:"-"` -} - -// settingMinifyGetResponseJSON contains the JSON metadata for the struct -// [SettingMinifyGetResponse] -type settingMinifyGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMinifyGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Zone setting identifier. -type SettingMinifyGetResponseID string - -const ( - SettingMinifyGetResponseIDMinify SettingMinifyGetResponseID = "minify" -) - -// Current value of the zone setting. -type SettingMinifyGetResponseValue struct { - // Automatically minify all CSS files for your website. - Css SettingMinifyGetResponseValueCss `json:"css"` - // Automatically minify all HTML files for your website. - HTML SettingMinifyGetResponseValueHTML `json:"html"` - // Automatically minify all JavaScript files for your website. - Js SettingMinifyGetResponseValueJs `json:"js"` - JSON settingMinifyGetResponseValueJSON `json:"-"` -} - -// settingMinifyGetResponseValueJSON contains the JSON metadata for the struct -// [SettingMinifyGetResponseValue] -type settingMinifyGetResponseValueJSON struct { - Css apijson.Field - HTML apijson.Field - Js apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMinifyGetResponseValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Automatically minify all CSS files for your website. -type SettingMinifyGetResponseValueCss string - -const ( - SettingMinifyGetResponseValueCssOn SettingMinifyGetResponseValueCss = "on" - SettingMinifyGetResponseValueCssOff SettingMinifyGetResponseValueCss = "off" -) - -// Automatically minify all HTML files for your website. -type SettingMinifyGetResponseValueHTML string - -const ( - SettingMinifyGetResponseValueHTMLOn SettingMinifyGetResponseValueHTML = "on" - SettingMinifyGetResponseValueHTMLOff SettingMinifyGetResponseValueHTML = "off" -) - -// Automatically minify all JavaScript files for your website. -type SettingMinifyGetResponseValueJs string - -const ( - SettingMinifyGetResponseValueJsOn SettingMinifyGetResponseValueJs = "on" - SettingMinifyGetResponseValueJsOff SettingMinifyGetResponseValueJs = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingMinifyGetResponseEditable bool - -const ( - SettingMinifyGetResponseEditableTrue SettingMinifyGetResponseEditable = true - SettingMinifyGetResponseEditableFalse SettingMinifyGetResponseEditable = false -) - -type SettingMinifyEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingMinifyEditParamsValue] `json:"value,required"` -} - -func (r SettingMinifyEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingMinifyEditParamsValue struct { - // Automatically minify all CSS files for your website. - Css param.Field[SettingMinifyEditParamsValueCss] `json:"css"` - // Automatically minify all HTML files for your website. - HTML param.Field[SettingMinifyEditParamsValueHTML] `json:"html"` - // Automatically minify all JavaScript files for your website. - Js param.Field[SettingMinifyEditParamsValueJs] `json:"js"` -} - -func (r SettingMinifyEditParamsValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Automatically minify all CSS files for your website. -type SettingMinifyEditParamsValueCss string - -const ( - SettingMinifyEditParamsValueCssOn SettingMinifyEditParamsValueCss = "on" - SettingMinifyEditParamsValueCssOff SettingMinifyEditParamsValueCss = "off" -) - -// Automatically minify all HTML files for your website. -type SettingMinifyEditParamsValueHTML string - -const ( - SettingMinifyEditParamsValueHTMLOn SettingMinifyEditParamsValueHTML = "on" - SettingMinifyEditParamsValueHTMLOff SettingMinifyEditParamsValueHTML = "off" -) - -// Automatically minify all JavaScript files for your website. -type SettingMinifyEditParamsValueJs string - -const ( - SettingMinifyEditParamsValueJsOn SettingMinifyEditParamsValueJs = "on" - SettingMinifyEditParamsValueJsOff SettingMinifyEditParamsValueJs = "off" -) - -type SettingMinifyEditResponseEnvelope struct { - Errors []SettingMinifyEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingMinifyEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Automatically minify certain assets for your website. Refer to - // [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) - // for more information. - Result SettingMinifyEditResponse `json:"result"` - JSON settingMinifyEditResponseEnvelopeJSON `json:"-"` -} - -// settingMinifyEditResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingMinifyEditResponseEnvelope] -type settingMinifyEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMinifyEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingMinifyEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingMinifyEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingMinifyEditResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingMinifyEditResponseEnvelopeErrors] -type settingMinifyEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMinifyEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingMinifyEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingMinifyEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingMinifyEditResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingMinifyEditResponseEnvelopeMessages] -type settingMinifyEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMinifyEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingMinifyGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingMinifyGetResponseEnvelope struct { - Errors []SettingMinifyGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingMinifyGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Automatically minify certain assets for your website. Refer to - // [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) - // for more information. - Result SettingMinifyGetResponse `json:"result"` - JSON settingMinifyGetResponseEnvelopeJSON `json:"-"` -} - -// settingMinifyGetResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingMinifyGetResponseEnvelope] -type settingMinifyGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMinifyGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingMinifyGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingMinifyGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingMinifyGetResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingMinifyGetResponseEnvelopeErrors] -type settingMinifyGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMinifyGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingMinifyGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingMinifyGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingMinifyGetResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingMinifyGetResponseEnvelopeMessages] -type settingMinifyGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMinifyGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingmintlsversion.go b/settingmintlsversion.go deleted file mode 100644 index 20706fdeea4..00000000000 --- a/settingmintlsversion.go +++ /dev/null @@ -1,329 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingMinTLSVersionService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingMinTLSVersionService] -// method instead. -type SettingMinTLSVersionService struct { - Options []option.RequestOption -} - -// NewSettingMinTLSVersionService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingMinTLSVersionService(opts ...option.RequestOption) (r *SettingMinTLSVersionService) { - r = &SettingMinTLSVersionService{} - r.Options = opts - return -} - -// Changes Minimum TLS Version setting. -func (r *SettingMinTLSVersionService) Edit(ctx context.Context, params SettingMinTLSVersionEditParams, opts ...option.RequestOption) (res *SettingMinTLSVersionEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingMinTLSVersionEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/min_tls_version", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Gets Minimum TLS Version setting. -func (r *SettingMinTLSVersionService) Get(ctx context.Context, query SettingMinTLSVersionGetParams, opts ...option.RequestOption) (res *SettingMinTLSVersionGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingMinTLSVersionGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/min_tls_version", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Only accepts HTTPS requests that use at least the TLS protocol version -// specified. For example, if TLS 1.1 is selected, TLS 1.0 connections will be -// rejected, while 1.1, 1.2, and 1.3 (if enabled) will be permitted. -type SettingMinTLSVersionEditResponse struct { - // ID of the zone setting. - ID SettingMinTLSVersionEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingMinTLSVersionEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingMinTLSVersionEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingMinTLSVersionEditResponseJSON `json:"-"` -} - -// settingMinTLSVersionEditResponseJSON contains the JSON metadata for the struct -// [SettingMinTLSVersionEditResponse] -type settingMinTLSVersionEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMinTLSVersionEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingMinTLSVersionEditResponseID string - -const ( - SettingMinTLSVersionEditResponseIDMinTLSVersion SettingMinTLSVersionEditResponseID = "min_tls_version" -) - -// Current value of the zone setting. -type SettingMinTLSVersionEditResponseValue string - -const ( - SettingMinTLSVersionEditResponseValue1_0 SettingMinTLSVersionEditResponseValue = "1.0" - SettingMinTLSVersionEditResponseValue1_1 SettingMinTLSVersionEditResponseValue = "1.1" - SettingMinTLSVersionEditResponseValue1_2 SettingMinTLSVersionEditResponseValue = "1.2" - SettingMinTLSVersionEditResponseValue1_3 SettingMinTLSVersionEditResponseValue = "1.3" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingMinTLSVersionEditResponseEditable bool - -const ( - SettingMinTLSVersionEditResponseEditableTrue SettingMinTLSVersionEditResponseEditable = true - SettingMinTLSVersionEditResponseEditableFalse SettingMinTLSVersionEditResponseEditable = false -) - -// Only accepts HTTPS requests that use at least the TLS protocol version -// specified. For example, if TLS 1.1 is selected, TLS 1.0 connections will be -// rejected, while 1.1, 1.2, and 1.3 (if enabled) will be permitted. -type SettingMinTLSVersionGetResponse struct { - // ID of the zone setting. - ID SettingMinTLSVersionGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingMinTLSVersionGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingMinTLSVersionGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingMinTLSVersionGetResponseJSON `json:"-"` -} - -// settingMinTLSVersionGetResponseJSON contains the JSON metadata for the struct -// [SettingMinTLSVersionGetResponse] -type settingMinTLSVersionGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMinTLSVersionGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingMinTLSVersionGetResponseID string - -const ( - SettingMinTLSVersionGetResponseIDMinTLSVersion SettingMinTLSVersionGetResponseID = "min_tls_version" -) - -// Current value of the zone setting. -type SettingMinTLSVersionGetResponseValue string - -const ( - SettingMinTLSVersionGetResponseValue1_0 SettingMinTLSVersionGetResponseValue = "1.0" - SettingMinTLSVersionGetResponseValue1_1 SettingMinTLSVersionGetResponseValue = "1.1" - SettingMinTLSVersionGetResponseValue1_2 SettingMinTLSVersionGetResponseValue = "1.2" - SettingMinTLSVersionGetResponseValue1_3 SettingMinTLSVersionGetResponseValue = "1.3" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingMinTLSVersionGetResponseEditable bool - -const ( - SettingMinTLSVersionGetResponseEditableTrue SettingMinTLSVersionGetResponseEditable = true - SettingMinTLSVersionGetResponseEditableFalse SettingMinTLSVersionGetResponseEditable = false -) - -type SettingMinTLSVersionEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingMinTLSVersionEditParamsValue] `json:"value,required"` -} - -func (r SettingMinTLSVersionEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingMinTLSVersionEditParamsValue string - -const ( - SettingMinTLSVersionEditParamsValue1_0 SettingMinTLSVersionEditParamsValue = "1.0" - SettingMinTLSVersionEditParamsValue1_1 SettingMinTLSVersionEditParamsValue = "1.1" - SettingMinTLSVersionEditParamsValue1_2 SettingMinTLSVersionEditParamsValue = "1.2" - SettingMinTLSVersionEditParamsValue1_3 SettingMinTLSVersionEditParamsValue = "1.3" -) - -type SettingMinTLSVersionEditResponseEnvelope struct { - Errors []SettingMinTLSVersionEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingMinTLSVersionEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Only accepts HTTPS requests that use at least the TLS protocol version - // specified. For example, if TLS 1.1 is selected, TLS 1.0 connections will be - // rejected, while 1.1, 1.2, and 1.3 (if enabled) will be permitted. - Result SettingMinTLSVersionEditResponse `json:"result"` - JSON settingMinTLSVersionEditResponseEnvelopeJSON `json:"-"` -} - -// settingMinTLSVersionEditResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingMinTLSVersionEditResponseEnvelope] -type settingMinTLSVersionEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMinTLSVersionEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingMinTLSVersionEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingMinTLSVersionEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingMinTLSVersionEditResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingMinTLSVersionEditResponseEnvelopeErrors] -type settingMinTLSVersionEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMinTLSVersionEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingMinTLSVersionEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingMinTLSVersionEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingMinTLSVersionEditResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingMinTLSVersionEditResponseEnvelopeMessages] -type settingMinTLSVersionEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMinTLSVersionEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingMinTLSVersionGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingMinTLSVersionGetResponseEnvelope struct { - Errors []SettingMinTLSVersionGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingMinTLSVersionGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Only accepts HTTPS requests that use at least the TLS protocol version - // specified. For example, if TLS 1.1 is selected, TLS 1.0 connections will be - // rejected, while 1.1, 1.2, and 1.3 (if enabled) will be permitted. - Result SettingMinTLSVersionGetResponse `json:"result"` - JSON settingMinTLSVersionGetResponseEnvelopeJSON `json:"-"` -} - -// settingMinTLSVersionGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingMinTLSVersionGetResponseEnvelope] -type settingMinTLSVersionGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMinTLSVersionGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingMinTLSVersionGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingMinTLSVersionGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingMinTLSVersionGetResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [SettingMinTLSVersionGetResponseEnvelopeErrors] -type settingMinTLSVersionGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMinTLSVersionGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingMinTLSVersionGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingMinTLSVersionGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingMinTLSVersionGetResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingMinTLSVersionGetResponseEnvelopeMessages] -type settingMinTLSVersionGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMinTLSVersionGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingmintlsversion_test.go b/settingmintlsversion_test.go deleted file mode 100644 index 68e29c204b4..00000000000 --- a/settingmintlsversion_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-sdk-go" - "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -func TestSettingMinTLSVersionEdit(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.MinTLSVersion.Edit(context.TODO(), cloudflare.SettingMinTLSVersionEditParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingMinTLSVersionEditParamsValue1_0), - }) - 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 TestSettingMinTLSVersionGet(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.MinTLSVersion.Get(context.TODO(), cloudflare.SettingMinTLSVersionGetParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/settingmirage.go b/settingmirage.go deleted file mode 100644 index 365f5af9fa6..00000000000 --- a/settingmirage.go +++ /dev/null @@ -1,333 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingMirageService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingMirageService] method -// instead. -type SettingMirageService struct { - Options []option.RequestOption -} - -// NewSettingMirageService generates a new service that applies the given options -// to each request. These options are applied after the parent client's options (if -// there is one), and before any request-specific options. -func NewSettingMirageService(opts ...option.RequestOption) (r *SettingMirageService) { - r = &SettingMirageService{} - r.Options = opts - return -} - -// Automatically optimize image loading for website visitors on mobile devices. -// Refer to our -// [blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for more -// information. -func (r *SettingMirageService) Edit(ctx context.Context, params SettingMirageEditParams, opts ...option.RequestOption) (res *SettingMirageEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingMirageEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/mirage", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Automatically optimize image loading for website visitors on mobile devices. -// Refer to our -// [blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for more -// information. -func (r *SettingMirageService) Get(ctx context.Context, query SettingMirageGetParams, opts ...option.RequestOption) (res *SettingMirageGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingMirageGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/mirage", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Automatically optimize image loading for website visitors on mobile devices. -// Refer to -// [our blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for -// more information. -type SettingMirageEditResponse struct { - // ID of the zone setting. - ID SettingMirageEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingMirageEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingMirageEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingMirageEditResponseJSON `json:"-"` -} - -// settingMirageEditResponseJSON contains the JSON metadata for the struct -// [SettingMirageEditResponse] -type settingMirageEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMirageEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingMirageEditResponseID string - -const ( - SettingMirageEditResponseIDMirage SettingMirageEditResponseID = "mirage" -) - -// Current value of the zone setting. -type SettingMirageEditResponseValue string - -const ( - SettingMirageEditResponseValueOn SettingMirageEditResponseValue = "on" - SettingMirageEditResponseValueOff SettingMirageEditResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingMirageEditResponseEditable bool - -const ( - SettingMirageEditResponseEditableTrue SettingMirageEditResponseEditable = true - SettingMirageEditResponseEditableFalse SettingMirageEditResponseEditable = false -) - -// Automatically optimize image loading for website visitors on mobile devices. -// Refer to -// [our blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for -// more information. -type SettingMirageGetResponse struct { - // ID of the zone setting. - ID SettingMirageGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingMirageGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingMirageGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingMirageGetResponseJSON `json:"-"` -} - -// settingMirageGetResponseJSON contains the JSON metadata for the struct -// [SettingMirageGetResponse] -type settingMirageGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMirageGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingMirageGetResponseID string - -const ( - SettingMirageGetResponseIDMirage SettingMirageGetResponseID = "mirage" -) - -// Current value of the zone setting. -type SettingMirageGetResponseValue string - -const ( - SettingMirageGetResponseValueOn SettingMirageGetResponseValue = "on" - SettingMirageGetResponseValueOff SettingMirageGetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingMirageGetResponseEditable bool - -const ( - SettingMirageGetResponseEditableTrue SettingMirageGetResponseEditable = true - SettingMirageGetResponseEditableFalse SettingMirageGetResponseEditable = false -) - -type SettingMirageEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingMirageEditParamsValue] `json:"value,required"` -} - -func (r SettingMirageEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingMirageEditParamsValue string - -const ( - SettingMirageEditParamsValueOn SettingMirageEditParamsValue = "on" - SettingMirageEditParamsValueOff SettingMirageEditParamsValue = "off" -) - -type SettingMirageEditResponseEnvelope struct { - Errors []SettingMirageEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingMirageEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Automatically optimize image loading for website visitors on mobile devices. - // Refer to - // [our blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for - // more information. - Result SettingMirageEditResponse `json:"result"` - JSON settingMirageEditResponseEnvelopeJSON `json:"-"` -} - -// settingMirageEditResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingMirageEditResponseEnvelope] -type settingMirageEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMirageEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingMirageEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingMirageEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingMirageEditResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingMirageEditResponseEnvelopeErrors] -type settingMirageEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMirageEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingMirageEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingMirageEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingMirageEditResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingMirageEditResponseEnvelopeMessages] -type settingMirageEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMirageEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingMirageGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingMirageGetResponseEnvelope struct { - Errors []SettingMirageGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingMirageGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Automatically optimize image loading for website visitors on mobile devices. - // Refer to - // [our blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for - // more information. - Result SettingMirageGetResponse `json:"result"` - JSON settingMirageGetResponseEnvelopeJSON `json:"-"` -} - -// settingMirageGetResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingMirageGetResponseEnvelope] -type settingMirageGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMirageGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingMirageGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingMirageGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingMirageGetResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingMirageGetResponseEnvelopeErrors] -type settingMirageGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMirageGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingMirageGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingMirageGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingMirageGetResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingMirageGetResponseEnvelopeMessages] -type settingMirageGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMirageGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingmirage_test.go b/settingmirage_test.go deleted file mode 100644 index bb2e3c250e0..00000000000 --- a/settingmirage_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-sdk-go" - "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -func TestSettingMirageEdit(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.Mirage.Edit(context.TODO(), cloudflare.SettingMirageEditParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingMirageEditParamsValueOn), - }) - 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 TestSettingMirageGet(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.Mirage.Get(context.TODO(), cloudflare.SettingMirageGetParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/settingmobileredirect.go b/settingmobileredirect.go deleted file mode 100644 index 00bfeb8acf6..00000000000 --- a/settingmobileredirect.go +++ /dev/null @@ -1,403 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingMobileRedirectService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingMobileRedirectService] -// method instead. -type SettingMobileRedirectService struct { - Options []option.RequestOption -} - -// NewSettingMobileRedirectService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingMobileRedirectService(opts ...option.RequestOption) (r *SettingMobileRedirectService) { - r = &SettingMobileRedirectService{} - r.Options = opts - return -} - -// Automatically redirect visitors on mobile devices to a mobile-optimized -// subdomain. Refer to -// [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) -// for more information. -func (r *SettingMobileRedirectService) Edit(ctx context.Context, params SettingMobileRedirectEditParams, opts ...option.RequestOption) (res *SettingMobileRedirectEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingMobileRedirectEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/mobile_redirect", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Automatically redirect visitors on mobile devices to a mobile-optimized -// subdomain. Refer to -// [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) -// for more information. -func (r *SettingMobileRedirectService) Get(ctx context.Context, query SettingMobileRedirectGetParams, opts ...option.RequestOption) (res *SettingMobileRedirectGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingMobileRedirectGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/mobile_redirect", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Automatically redirect visitors on mobile devices to a mobile-optimized -// subdomain. Refer to -// [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) -// for more information. -type SettingMobileRedirectEditResponse struct { - // Identifier of the zone setting. - ID SettingMobileRedirectEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingMobileRedirectEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingMobileRedirectEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingMobileRedirectEditResponseJSON `json:"-"` -} - -// settingMobileRedirectEditResponseJSON contains the JSON metadata for the struct -// [SettingMobileRedirectEditResponse] -type settingMobileRedirectEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMobileRedirectEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Identifier of the zone setting. -type SettingMobileRedirectEditResponseID string - -const ( - SettingMobileRedirectEditResponseIDMobileRedirect SettingMobileRedirectEditResponseID = "mobile_redirect" -) - -// Current value of the zone setting. -type SettingMobileRedirectEditResponseValue struct { - // Which subdomain prefix you wish to redirect visitors on mobile devices to - // (subdomain must already exist). - MobileSubdomain string `json:"mobile_subdomain,nullable"` - // Whether or not mobile redirect is enabled. - Status SettingMobileRedirectEditResponseValueStatus `json:"status"` - // Whether to drop the current page path and redirect to the mobile subdomain URL - // root, or keep the path and redirect to the same page on the mobile subdomain. - StripUri bool `json:"strip_uri"` - JSON settingMobileRedirectEditResponseValueJSON `json:"-"` -} - -// settingMobileRedirectEditResponseValueJSON contains the JSON metadata for the -// struct [SettingMobileRedirectEditResponseValue] -type settingMobileRedirectEditResponseValueJSON struct { - MobileSubdomain apijson.Field - Status apijson.Field - StripUri apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMobileRedirectEditResponseValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether or not mobile redirect is enabled. -type SettingMobileRedirectEditResponseValueStatus string - -const ( - SettingMobileRedirectEditResponseValueStatusOn SettingMobileRedirectEditResponseValueStatus = "on" - SettingMobileRedirectEditResponseValueStatusOff SettingMobileRedirectEditResponseValueStatus = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingMobileRedirectEditResponseEditable bool - -const ( - SettingMobileRedirectEditResponseEditableTrue SettingMobileRedirectEditResponseEditable = true - SettingMobileRedirectEditResponseEditableFalse SettingMobileRedirectEditResponseEditable = false -) - -// Automatically redirect visitors on mobile devices to a mobile-optimized -// subdomain. Refer to -// [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) -// for more information. -type SettingMobileRedirectGetResponse struct { - // Identifier of the zone setting. - ID SettingMobileRedirectGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingMobileRedirectGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingMobileRedirectGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingMobileRedirectGetResponseJSON `json:"-"` -} - -// settingMobileRedirectGetResponseJSON contains the JSON metadata for the struct -// [SettingMobileRedirectGetResponse] -type settingMobileRedirectGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMobileRedirectGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Identifier of the zone setting. -type SettingMobileRedirectGetResponseID string - -const ( - SettingMobileRedirectGetResponseIDMobileRedirect SettingMobileRedirectGetResponseID = "mobile_redirect" -) - -// Current value of the zone setting. -type SettingMobileRedirectGetResponseValue struct { - // Which subdomain prefix you wish to redirect visitors on mobile devices to - // (subdomain must already exist). - MobileSubdomain string `json:"mobile_subdomain,nullable"` - // Whether or not mobile redirect is enabled. - Status SettingMobileRedirectGetResponseValueStatus `json:"status"` - // Whether to drop the current page path and redirect to the mobile subdomain URL - // root, or keep the path and redirect to the same page on the mobile subdomain. - StripUri bool `json:"strip_uri"` - JSON settingMobileRedirectGetResponseValueJSON `json:"-"` -} - -// settingMobileRedirectGetResponseValueJSON contains the JSON metadata for the -// struct [SettingMobileRedirectGetResponseValue] -type settingMobileRedirectGetResponseValueJSON struct { - MobileSubdomain apijson.Field - Status apijson.Field - StripUri apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMobileRedirectGetResponseValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether or not mobile redirect is enabled. -type SettingMobileRedirectGetResponseValueStatus string - -const ( - SettingMobileRedirectGetResponseValueStatusOn SettingMobileRedirectGetResponseValueStatus = "on" - SettingMobileRedirectGetResponseValueStatusOff SettingMobileRedirectGetResponseValueStatus = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingMobileRedirectGetResponseEditable bool - -const ( - SettingMobileRedirectGetResponseEditableTrue SettingMobileRedirectGetResponseEditable = true - SettingMobileRedirectGetResponseEditableFalse SettingMobileRedirectGetResponseEditable = false -) - -type SettingMobileRedirectEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingMobileRedirectEditParamsValue] `json:"value,required"` -} - -func (r SettingMobileRedirectEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingMobileRedirectEditParamsValue struct { - // Which subdomain prefix you wish to redirect visitors on mobile devices to - // (subdomain must already exist). - MobileSubdomain param.Field[string] `json:"mobile_subdomain"` - // Whether or not mobile redirect is enabled. - Status param.Field[SettingMobileRedirectEditParamsValueStatus] `json:"status"` - // Whether to drop the current page path and redirect to the mobile subdomain URL - // root, or keep the path and redirect to the same page on the mobile subdomain. - StripUri param.Field[bool] `json:"strip_uri"` -} - -func (r SettingMobileRedirectEditParamsValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Whether or not mobile redirect is enabled. -type SettingMobileRedirectEditParamsValueStatus string - -const ( - SettingMobileRedirectEditParamsValueStatusOn SettingMobileRedirectEditParamsValueStatus = "on" - SettingMobileRedirectEditParamsValueStatusOff SettingMobileRedirectEditParamsValueStatus = "off" -) - -type SettingMobileRedirectEditResponseEnvelope struct { - Errors []SettingMobileRedirectEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingMobileRedirectEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Automatically redirect visitors on mobile devices to a mobile-optimized - // subdomain. Refer to - // [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) - // for more information. - Result SettingMobileRedirectEditResponse `json:"result"` - JSON settingMobileRedirectEditResponseEnvelopeJSON `json:"-"` -} - -// settingMobileRedirectEditResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingMobileRedirectEditResponseEnvelope] -type settingMobileRedirectEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMobileRedirectEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingMobileRedirectEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingMobileRedirectEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingMobileRedirectEditResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingMobileRedirectEditResponseEnvelopeErrors] -type settingMobileRedirectEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMobileRedirectEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingMobileRedirectEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingMobileRedirectEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingMobileRedirectEditResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingMobileRedirectEditResponseEnvelopeMessages] -type settingMobileRedirectEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMobileRedirectEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingMobileRedirectGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingMobileRedirectGetResponseEnvelope struct { - Errors []SettingMobileRedirectGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingMobileRedirectGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Automatically redirect visitors on mobile devices to a mobile-optimized - // subdomain. Refer to - // [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) - // for more information. - Result SettingMobileRedirectGetResponse `json:"result"` - JSON settingMobileRedirectGetResponseEnvelopeJSON `json:"-"` -} - -// settingMobileRedirectGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingMobileRedirectGetResponseEnvelope] -type settingMobileRedirectGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMobileRedirectGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingMobileRedirectGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingMobileRedirectGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingMobileRedirectGetResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingMobileRedirectGetResponseEnvelopeErrors] -type settingMobileRedirectGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMobileRedirectGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingMobileRedirectGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingMobileRedirectGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingMobileRedirectGetResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingMobileRedirectGetResponseEnvelopeMessages] -type settingMobileRedirectGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingMobileRedirectGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingnel.go b/settingnel.go deleted file mode 100644 index 8275d526bf2..00000000000 --- a/settingnel.go +++ /dev/null @@ -1,365 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingNELService contains methods and other services that help with interacting -// with the cloudflare API. Note, unlike clients, this service does not read -// variables from the environment automatically. You should not instantiate this -// service directly, and instead use the [NewSettingNELService] method instead. -type SettingNELService struct { - Options []option.RequestOption -} - -// NewSettingNELService generates a new service that applies the given options to -// each request. These options are applied after the parent client's options (if -// there is one), and before any request-specific options. -func NewSettingNELService(opts ...option.RequestOption) (r *SettingNELService) { - r = &SettingNELService{} - r.Options = opts - return -} - -// Automatically optimize image loading for website visitors on mobile devices. -// Refer to our [blog post](http://blog.cloudflare.com/nel-solving-mobile-speed) -// for more information. -func (r *SettingNELService) Edit(ctx context.Context, params SettingNELEditParams, opts ...option.RequestOption) (res *SettingNELEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingNELEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/nel", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Enable Network Error Logging reporting on your zone. (Beta) -func (r *SettingNELService) Get(ctx context.Context, query SettingNELGetParams, opts ...option.RequestOption) (res *SettingNELGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingNELGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/nel", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Enable Network Error Logging reporting on your zone. (Beta) -type SettingNELEditResponse struct { - // Zone setting identifier. - ID SettingNELEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingNELEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingNELEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingNELEditResponseJSON `json:"-"` -} - -// settingNELEditResponseJSON contains the JSON metadata for the struct -// [SettingNELEditResponse] -type settingNELEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingNELEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Zone setting identifier. -type SettingNELEditResponseID string - -const ( - SettingNELEditResponseIDNEL SettingNELEditResponseID = "nel" -) - -// Current value of the zone setting. -type SettingNELEditResponseValue struct { - Enabled bool `json:"enabled"` - JSON settingNELEditResponseValueJSON `json:"-"` -} - -// settingNELEditResponseValueJSON contains the JSON metadata for the struct -// [SettingNELEditResponseValue] -type settingNELEditResponseValueJSON struct { - Enabled apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingNELEditResponseValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingNELEditResponseEditable bool - -const ( - SettingNELEditResponseEditableTrue SettingNELEditResponseEditable = true - SettingNELEditResponseEditableFalse SettingNELEditResponseEditable = false -) - -// Enable Network Error Logging reporting on your zone. (Beta) -type SettingNELGetResponse struct { - // Zone setting identifier. - ID SettingNELGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingNELGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingNELGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingNELGetResponseJSON `json:"-"` -} - -// settingNELGetResponseJSON contains the JSON metadata for the struct -// [SettingNELGetResponse] -type settingNELGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingNELGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Zone setting identifier. -type SettingNELGetResponseID string - -const ( - SettingNELGetResponseIDNEL SettingNELGetResponseID = "nel" -) - -// Current value of the zone setting. -type SettingNELGetResponseValue struct { - Enabled bool `json:"enabled"` - JSON settingNELGetResponseValueJSON `json:"-"` -} - -// settingNELGetResponseValueJSON contains the JSON metadata for the struct -// [SettingNELGetResponseValue] -type settingNELGetResponseValueJSON struct { - Enabled apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingNELGetResponseValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingNELGetResponseEditable bool - -const ( - SettingNELGetResponseEditableTrue SettingNELGetResponseEditable = true - SettingNELGetResponseEditableFalse SettingNELGetResponseEditable = false -) - -type SettingNELEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Enable Network Error Logging reporting on your zone. (Beta) - Value param.Field[SettingNELEditParamsValue] `json:"value,required"` -} - -func (r SettingNELEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Enable Network Error Logging reporting on your zone. (Beta) -type SettingNELEditParamsValue struct { - // Zone setting identifier. - ID param.Field[SettingNELEditParamsValueID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingNELEditParamsValueValue] `json:"value,required"` -} - -func (r SettingNELEditParamsValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Zone setting identifier. -type SettingNELEditParamsValueID string - -const ( - SettingNELEditParamsValueIDNEL SettingNELEditParamsValueID = "nel" -) - -// Current value of the zone setting. -type SettingNELEditParamsValueValue struct { - Enabled param.Field[bool] `json:"enabled"` -} - -func (r SettingNELEditParamsValueValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingNELEditParamsValueEditable bool - -const ( - SettingNELEditParamsValueEditableTrue SettingNELEditParamsValueEditable = true - SettingNELEditParamsValueEditableFalse SettingNELEditParamsValueEditable = false -) - -type SettingNELEditResponseEnvelope struct { - Errors []SettingNELEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingNELEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Enable Network Error Logging reporting on your zone. (Beta) - Result SettingNELEditResponse `json:"result"` - JSON settingNELEditResponseEnvelopeJSON `json:"-"` -} - -// settingNELEditResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingNELEditResponseEnvelope] -type settingNELEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingNELEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingNELEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingNELEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingNELEditResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingNELEditResponseEnvelopeErrors] -type settingNELEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingNELEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingNELEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingNELEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingNELEditResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingNELEditResponseEnvelopeMessages] -type settingNELEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingNELEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingNELGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingNELGetResponseEnvelope struct { - Errors []SettingNELGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingNELGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Enable Network Error Logging reporting on your zone. (Beta) - Result SettingNELGetResponse `json:"result"` - JSON settingNELGetResponseEnvelopeJSON `json:"-"` -} - -// settingNELGetResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingNELGetResponseEnvelope] -type settingNELGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingNELGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingNELGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingNELGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingNELGetResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingNELGetResponseEnvelopeErrors] -type settingNELGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingNELGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingNELGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingNELGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingNELGetResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingNELGetResponseEnvelopeMessages] -type settingNELGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingNELGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingopportunisticencryption.go b/settingopportunisticencryption.go deleted file mode 100644 index 489be758c19..00000000000 --- a/settingopportunisticencryption.go +++ /dev/null @@ -1,321 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingOpportunisticEncryptionService contains methods and other services that -// help with interacting with the cloudflare API. Note, unlike clients, this -// service does not read variables from the environment automatically. You should -// not instantiate this service directly, and instead use the -// [NewSettingOpportunisticEncryptionService] method instead. -type SettingOpportunisticEncryptionService struct { - Options []option.RequestOption -} - -// NewSettingOpportunisticEncryptionService generates a new service that applies -// the given options to each request. These options are applied after the parent -// client's options (if there is one), and before any request-specific options. -func NewSettingOpportunisticEncryptionService(opts ...option.RequestOption) (r *SettingOpportunisticEncryptionService) { - r = &SettingOpportunisticEncryptionService{} - r.Options = opts - return -} - -// Changes Opportunistic Encryption setting. -func (r *SettingOpportunisticEncryptionService) Edit(ctx context.Context, params SettingOpportunisticEncryptionEditParams, opts ...option.RequestOption) (res *SettingOpportunisticEncryptionEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingOpportunisticEncryptionEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/opportunistic_encryption", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Gets Opportunistic Encryption setting. -func (r *SettingOpportunisticEncryptionService) Get(ctx context.Context, query SettingOpportunisticEncryptionGetParams, opts ...option.RequestOption) (res *SettingOpportunisticEncryptionGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingOpportunisticEncryptionGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/opportunistic_encryption", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Enables the Opportunistic Encryption feature for a zone. -type SettingOpportunisticEncryptionEditResponse struct { - // ID of the zone setting. - ID SettingOpportunisticEncryptionEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingOpportunisticEncryptionEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingOpportunisticEncryptionEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingOpportunisticEncryptionEditResponseJSON `json:"-"` -} - -// settingOpportunisticEncryptionEditResponseJSON contains the JSON metadata for -// the struct [SettingOpportunisticEncryptionEditResponse] -type settingOpportunisticEncryptionEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOpportunisticEncryptionEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingOpportunisticEncryptionEditResponseID string - -const ( - SettingOpportunisticEncryptionEditResponseIDOpportunisticEncryption SettingOpportunisticEncryptionEditResponseID = "opportunistic_encryption" -) - -// Current value of the zone setting. -type SettingOpportunisticEncryptionEditResponseValue string - -const ( - SettingOpportunisticEncryptionEditResponseValueOn SettingOpportunisticEncryptionEditResponseValue = "on" - SettingOpportunisticEncryptionEditResponseValueOff SettingOpportunisticEncryptionEditResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingOpportunisticEncryptionEditResponseEditable bool - -const ( - SettingOpportunisticEncryptionEditResponseEditableTrue SettingOpportunisticEncryptionEditResponseEditable = true - SettingOpportunisticEncryptionEditResponseEditableFalse SettingOpportunisticEncryptionEditResponseEditable = false -) - -// Enables the Opportunistic Encryption feature for a zone. -type SettingOpportunisticEncryptionGetResponse struct { - // ID of the zone setting. - ID SettingOpportunisticEncryptionGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingOpportunisticEncryptionGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingOpportunisticEncryptionGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingOpportunisticEncryptionGetResponseJSON `json:"-"` -} - -// settingOpportunisticEncryptionGetResponseJSON contains the JSON metadata for the -// struct [SettingOpportunisticEncryptionGetResponse] -type settingOpportunisticEncryptionGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOpportunisticEncryptionGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingOpportunisticEncryptionGetResponseID string - -const ( - SettingOpportunisticEncryptionGetResponseIDOpportunisticEncryption SettingOpportunisticEncryptionGetResponseID = "opportunistic_encryption" -) - -// Current value of the zone setting. -type SettingOpportunisticEncryptionGetResponseValue string - -const ( - SettingOpportunisticEncryptionGetResponseValueOn SettingOpportunisticEncryptionGetResponseValue = "on" - SettingOpportunisticEncryptionGetResponseValueOff SettingOpportunisticEncryptionGetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingOpportunisticEncryptionGetResponseEditable bool - -const ( - SettingOpportunisticEncryptionGetResponseEditableTrue SettingOpportunisticEncryptionGetResponseEditable = true - SettingOpportunisticEncryptionGetResponseEditableFalse SettingOpportunisticEncryptionGetResponseEditable = false -) - -type SettingOpportunisticEncryptionEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. Notes: Default value depends on the zone's plan - // level. - Value param.Field[SettingOpportunisticEncryptionEditParamsValue] `json:"value,required"` -} - -func (r SettingOpportunisticEncryptionEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. Notes: Default value depends on the zone's plan -// level. -type SettingOpportunisticEncryptionEditParamsValue string - -const ( - SettingOpportunisticEncryptionEditParamsValueOn SettingOpportunisticEncryptionEditParamsValue = "on" - SettingOpportunisticEncryptionEditParamsValueOff SettingOpportunisticEncryptionEditParamsValue = "off" -) - -type SettingOpportunisticEncryptionEditResponseEnvelope struct { - Errors []SettingOpportunisticEncryptionEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingOpportunisticEncryptionEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Enables the Opportunistic Encryption feature for a zone. - Result SettingOpportunisticEncryptionEditResponse `json:"result"` - JSON settingOpportunisticEncryptionEditResponseEnvelopeJSON `json:"-"` -} - -// settingOpportunisticEncryptionEditResponseEnvelopeJSON contains the JSON -// metadata for the struct [SettingOpportunisticEncryptionEditResponseEnvelope] -type settingOpportunisticEncryptionEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOpportunisticEncryptionEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOpportunisticEncryptionEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingOpportunisticEncryptionEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingOpportunisticEncryptionEditResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct -// [SettingOpportunisticEncryptionEditResponseEnvelopeErrors] -type settingOpportunisticEncryptionEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOpportunisticEncryptionEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOpportunisticEncryptionEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingOpportunisticEncryptionEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingOpportunisticEncryptionEditResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct -// [SettingOpportunisticEncryptionEditResponseEnvelopeMessages] -type settingOpportunisticEncryptionEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOpportunisticEncryptionEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOpportunisticEncryptionGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingOpportunisticEncryptionGetResponseEnvelope struct { - Errors []SettingOpportunisticEncryptionGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingOpportunisticEncryptionGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Enables the Opportunistic Encryption feature for a zone. - Result SettingOpportunisticEncryptionGetResponse `json:"result"` - JSON settingOpportunisticEncryptionGetResponseEnvelopeJSON `json:"-"` -} - -// settingOpportunisticEncryptionGetResponseEnvelopeJSON contains the JSON metadata -// for the struct [SettingOpportunisticEncryptionGetResponseEnvelope] -type settingOpportunisticEncryptionGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOpportunisticEncryptionGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOpportunisticEncryptionGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingOpportunisticEncryptionGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingOpportunisticEncryptionGetResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct -// [SettingOpportunisticEncryptionGetResponseEnvelopeErrors] -type settingOpportunisticEncryptionGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOpportunisticEncryptionGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOpportunisticEncryptionGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingOpportunisticEncryptionGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingOpportunisticEncryptionGetResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct -// [SettingOpportunisticEncryptionGetResponseEnvelopeMessages] -type settingOpportunisticEncryptionGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOpportunisticEncryptionGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingopportunisticencryption_test.go b/settingopportunisticencryption_test.go deleted file mode 100644 index 7845ef285aa..00000000000 --- a/settingopportunisticencryption_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-sdk-go" - "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -func TestSettingOpportunisticEncryptionEdit(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.OpportunisticEncryption.Edit(context.TODO(), cloudflare.SettingOpportunisticEncryptionEditParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingOpportunisticEncryptionEditParamsValueOn), - }) - 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 TestSettingOpportunisticEncryptionGet(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.OpportunisticEncryption.Get(context.TODO(), cloudflare.SettingOpportunisticEncryptionGetParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/settingopportunisticonion.go b/settingopportunisticonion.go deleted file mode 100644 index 73a76e32a97..00000000000 --- a/settingopportunisticonion.go +++ /dev/null @@ -1,323 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingOpportunisticOnionService contains methods and other services that help -// with interacting with the cloudflare API. Note, unlike clients, this service -// does not read variables from the environment automatically. You should not -// instantiate this service directly, and instead use the -// [NewSettingOpportunisticOnionService] method instead. -type SettingOpportunisticOnionService struct { - Options []option.RequestOption -} - -// NewSettingOpportunisticOnionService generates a new service that applies the -// given options to each request. These options are applied after the parent -// client's options (if there is one), and before any request-specific options. -func NewSettingOpportunisticOnionService(opts ...option.RequestOption) (r *SettingOpportunisticOnionService) { - r = &SettingOpportunisticOnionService{} - r.Options = opts - return -} - -// Add an Alt-Svc header to all legitimate requests from Tor, allowing the -// connection to use our onion services instead of exit nodes. -func (r *SettingOpportunisticOnionService) Edit(ctx context.Context, params SettingOpportunisticOnionEditParams, opts ...option.RequestOption) (res *SettingOpportunisticOnionEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingOpportunisticOnionEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/opportunistic_onion", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Add an Alt-Svc header to all legitimate requests from Tor, allowing the -// connection to use our onion services instead of exit nodes. -func (r *SettingOpportunisticOnionService) Get(ctx context.Context, query SettingOpportunisticOnionGetParams, opts ...option.RequestOption) (res *SettingOpportunisticOnionGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingOpportunisticOnionGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/opportunistic_onion", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Add an Alt-Svc header to all legitimate requests from Tor, allowing the -// connection to use our onion services instead of exit nodes. -type SettingOpportunisticOnionEditResponse struct { - // ID of the zone setting. - ID SettingOpportunisticOnionEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingOpportunisticOnionEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingOpportunisticOnionEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingOpportunisticOnionEditResponseJSON `json:"-"` -} - -// settingOpportunisticOnionEditResponseJSON contains the JSON metadata for the -// struct [SettingOpportunisticOnionEditResponse] -type settingOpportunisticOnionEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOpportunisticOnionEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingOpportunisticOnionEditResponseID string - -const ( - SettingOpportunisticOnionEditResponseIDOpportunisticOnion SettingOpportunisticOnionEditResponseID = "opportunistic_onion" -) - -// Current value of the zone setting. -type SettingOpportunisticOnionEditResponseValue string - -const ( - SettingOpportunisticOnionEditResponseValueOn SettingOpportunisticOnionEditResponseValue = "on" - SettingOpportunisticOnionEditResponseValueOff SettingOpportunisticOnionEditResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingOpportunisticOnionEditResponseEditable bool - -const ( - SettingOpportunisticOnionEditResponseEditableTrue SettingOpportunisticOnionEditResponseEditable = true - SettingOpportunisticOnionEditResponseEditableFalse SettingOpportunisticOnionEditResponseEditable = false -) - -// Add an Alt-Svc header to all legitimate requests from Tor, allowing the -// connection to use our onion services instead of exit nodes. -type SettingOpportunisticOnionGetResponse struct { - // ID of the zone setting. - ID SettingOpportunisticOnionGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingOpportunisticOnionGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingOpportunisticOnionGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingOpportunisticOnionGetResponseJSON `json:"-"` -} - -// settingOpportunisticOnionGetResponseJSON contains the JSON metadata for the -// struct [SettingOpportunisticOnionGetResponse] -type settingOpportunisticOnionGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOpportunisticOnionGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingOpportunisticOnionGetResponseID string - -const ( - SettingOpportunisticOnionGetResponseIDOpportunisticOnion SettingOpportunisticOnionGetResponseID = "opportunistic_onion" -) - -// Current value of the zone setting. -type SettingOpportunisticOnionGetResponseValue string - -const ( - SettingOpportunisticOnionGetResponseValueOn SettingOpportunisticOnionGetResponseValue = "on" - SettingOpportunisticOnionGetResponseValueOff SettingOpportunisticOnionGetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingOpportunisticOnionGetResponseEditable bool - -const ( - SettingOpportunisticOnionGetResponseEditableTrue SettingOpportunisticOnionGetResponseEditable = true - SettingOpportunisticOnionGetResponseEditableFalse SettingOpportunisticOnionGetResponseEditable = false -) - -type SettingOpportunisticOnionEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. Notes: Default value depends on the zone's plan - // level. - Value param.Field[SettingOpportunisticOnionEditParamsValue] `json:"value,required"` -} - -func (r SettingOpportunisticOnionEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. Notes: Default value depends on the zone's plan -// level. -type SettingOpportunisticOnionEditParamsValue string - -const ( - SettingOpportunisticOnionEditParamsValueOn SettingOpportunisticOnionEditParamsValue = "on" - SettingOpportunisticOnionEditParamsValueOff SettingOpportunisticOnionEditParamsValue = "off" -) - -type SettingOpportunisticOnionEditResponseEnvelope struct { - Errors []SettingOpportunisticOnionEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingOpportunisticOnionEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Add an Alt-Svc header to all legitimate requests from Tor, allowing the - // connection to use our onion services instead of exit nodes. - Result SettingOpportunisticOnionEditResponse `json:"result"` - JSON settingOpportunisticOnionEditResponseEnvelopeJSON `json:"-"` -} - -// settingOpportunisticOnionEditResponseEnvelopeJSON contains the JSON metadata for -// the struct [SettingOpportunisticOnionEditResponseEnvelope] -type settingOpportunisticOnionEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOpportunisticOnionEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOpportunisticOnionEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingOpportunisticOnionEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingOpportunisticOnionEditResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [SettingOpportunisticOnionEditResponseEnvelopeErrors] -type settingOpportunisticOnionEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOpportunisticOnionEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOpportunisticOnionEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingOpportunisticOnionEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingOpportunisticOnionEditResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [SettingOpportunisticOnionEditResponseEnvelopeMessages] -type settingOpportunisticOnionEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOpportunisticOnionEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOpportunisticOnionGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingOpportunisticOnionGetResponseEnvelope struct { - Errors []SettingOpportunisticOnionGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingOpportunisticOnionGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Add an Alt-Svc header to all legitimate requests from Tor, allowing the - // connection to use our onion services instead of exit nodes. - Result SettingOpportunisticOnionGetResponse `json:"result"` - JSON settingOpportunisticOnionGetResponseEnvelopeJSON `json:"-"` -} - -// settingOpportunisticOnionGetResponseEnvelopeJSON contains the JSON metadata for -// the struct [SettingOpportunisticOnionGetResponseEnvelope] -type settingOpportunisticOnionGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOpportunisticOnionGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOpportunisticOnionGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingOpportunisticOnionGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingOpportunisticOnionGetResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [SettingOpportunisticOnionGetResponseEnvelopeErrors] -type settingOpportunisticOnionGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOpportunisticOnionGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOpportunisticOnionGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingOpportunisticOnionGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingOpportunisticOnionGetResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [SettingOpportunisticOnionGetResponseEnvelopeMessages] -type settingOpportunisticOnionGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOpportunisticOnionGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingorangetoorange.go b/settingorangetoorange.go deleted file mode 100644 index d8397bec8b7..00000000000 --- a/settingorangetoorange.go +++ /dev/null @@ -1,351 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingOrangeToOrangeService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingOrangeToOrangeService] -// method instead. -type SettingOrangeToOrangeService struct { - Options []option.RequestOption -} - -// NewSettingOrangeToOrangeService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingOrangeToOrangeService(opts ...option.RequestOption) (r *SettingOrangeToOrangeService) { - r = &SettingOrangeToOrangeService{} - r.Options = opts - return -} - -// Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also -// on Cloudflare. -func (r *SettingOrangeToOrangeService) Edit(ctx context.Context, params SettingOrangeToOrangeEditParams, opts ...option.RequestOption) (res *SettingOrangeToOrangeEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingOrangeToOrangeEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/orange_to_orange", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also -// on Cloudflare. -func (r *SettingOrangeToOrangeService) Get(ctx context.Context, query SettingOrangeToOrangeGetParams, opts ...option.RequestOption) (res *SettingOrangeToOrangeGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingOrangeToOrangeGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/orange_to_orange", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also -// on Cloudflare. -type SettingOrangeToOrangeEditResponse struct { - // ID of the zone setting. - ID SettingOrangeToOrangeEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingOrangeToOrangeEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingOrangeToOrangeEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingOrangeToOrangeEditResponseJSON `json:"-"` -} - -// settingOrangeToOrangeEditResponseJSON contains the JSON metadata for the struct -// [SettingOrangeToOrangeEditResponse] -type settingOrangeToOrangeEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOrangeToOrangeEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingOrangeToOrangeEditResponseID string - -const ( - SettingOrangeToOrangeEditResponseIDOrangeToOrange SettingOrangeToOrangeEditResponseID = "orange_to_orange" -) - -// Current value of the zone setting. -type SettingOrangeToOrangeEditResponseValue string - -const ( - SettingOrangeToOrangeEditResponseValueOn SettingOrangeToOrangeEditResponseValue = "on" - SettingOrangeToOrangeEditResponseValueOff SettingOrangeToOrangeEditResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingOrangeToOrangeEditResponseEditable bool - -const ( - SettingOrangeToOrangeEditResponseEditableTrue SettingOrangeToOrangeEditResponseEditable = true - SettingOrangeToOrangeEditResponseEditableFalse SettingOrangeToOrangeEditResponseEditable = false -) - -// Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also -// on Cloudflare. -type SettingOrangeToOrangeGetResponse struct { - // ID of the zone setting. - ID SettingOrangeToOrangeGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingOrangeToOrangeGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingOrangeToOrangeGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingOrangeToOrangeGetResponseJSON `json:"-"` -} - -// settingOrangeToOrangeGetResponseJSON contains the JSON metadata for the struct -// [SettingOrangeToOrangeGetResponse] -type settingOrangeToOrangeGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOrangeToOrangeGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingOrangeToOrangeGetResponseID string - -const ( - SettingOrangeToOrangeGetResponseIDOrangeToOrange SettingOrangeToOrangeGetResponseID = "orange_to_orange" -) - -// Current value of the zone setting. -type SettingOrangeToOrangeGetResponseValue string - -const ( - SettingOrangeToOrangeGetResponseValueOn SettingOrangeToOrangeGetResponseValue = "on" - SettingOrangeToOrangeGetResponseValueOff SettingOrangeToOrangeGetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingOrangeToOrangeGetResponseEditable bool - -const ( - SettingOrangeToOrangeGetResponseEditableTrue SettingOrangeToOrangeGetResponseEditable = true - SettingOrangeToOrangeGetResponseEditableFalse SettingOrangeToOrangeGetResponseEditable = false -) - -type SettingOrangeToOrangeEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also - // on Cloudflare. - Value param.Field[SettingOrangeToOrangeEditParamsValue] `json:"value,required"` -} - -func (r SettingOrangeToOrangeEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also -// on Cloudflare. -type SettingOrangeToOrangeEditParamsValue struct { - // ID of the zone setting. - ID param.Field[SettingOrangeToOrangeEditParamsValueID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingOrangeToOrangeEditParamsValueValue] `json:"value,required"` -} - -func (r SettingOrangeToOrangeEditParamsValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// ID of the zone setting. -type SettingOrangeToOrangeEditParamsValueID string - -const ( - SettingOrangeToOrangeEditParamsValueIDOrangeToOrange SettingOrangeToOrangeEditParamsValueID = "orange_to_orange" -) - -// Current value of the zone setting. -type SettingOrangeToOrangeEditParamsValueValue string - -const ( - SettingOrangeToOrangeEditParamsValueValueOn SettingOrangeToOrangeEditParamsValueValue = "on" - SettingOrangeToOrangeEditParamsValueValueOff SettingOrangeToOrangeEditParamsValueValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingOrangeToOrangeEditParamsValueEditable bool - -const ( - SettingOrangeToOrangeEditParamsValueEditableTrue SettingOrangeToOrangeEditParamsValueEditable = true - SettingOrangeToOrangeEditParamsValueEditableFalse SettingOrangeToOrangeEditParamsValueEditable = false -) - -type SettingOrangeToOrangeEditResponseEnvelope struct { - Errors []SettingOrangeToOrangeEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingOrangeToOrangeEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also - // on Cloudflare. - Result SettingOrangeToOrangeEditResponse `json:"result"` - JSON settingOrangeToOrangeEditResponseEnvelopeJSON `json:"-"` -} - -// settingOrangeToOrangeEditResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingOrangeToOrangeEditResponseEnvelope] -type settingOrangeToOrangeEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOrangeToOrangeEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOrangeToOrangeEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingOrangeToOrangeEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingOrangeToOrangeEditResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingOrangeToOrangeEditResponseEnvelopeErrors] -type settingOrangeToOrangeEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOrangeToOrangeEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOrangeToOrangeEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingOrangeToOrangeEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingOrangeToOrangeEditResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingOrangeToOrangeEditResponseEnvelopeMessages] -type settingOrangeToOrangeEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOrangeToOrangeEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOrangeToOrangeGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingOrangeToOrangeGetResponseEnvelope struct { - Errors []SettingOrangeToOrangeGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingOrangeToOrangeGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also - // on Cloudflare. - Result SettingOrangeToOrangeGetResponse `json:"result"` - JSON settingOrangeToOrangeGetResponseEnvelopeJSON `json:"-"` -} - -// settingOrangeToOrangeGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingOrangeToOrangeGetResponseEnvelope] -type settingOrangeToOrangeGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOrangeToOrangeGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOrangeToOrangeGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingOrangeToOrangeGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingOrangeToOrangeGetResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingOrangeToOrangeGetResponseEnvelopeErrors] -type settingOrangeToOrangeGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOrangeToOrangeGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOrangeToOrangeGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingOrangeToOrangeGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingOrangeToOrangeGetResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingOrangeToOrangeGetResponseEnvelopeMessages] -type settingOrangeToOrangeGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOrangeToOrangeGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingorangetoorange_test.go b/settingorangetoorange_test.go deleted file mode 100644 index 7c429fbaeb1..00000000000 --- a/settingorangetoorange_test.go +++ /dev/null @@ -1,74 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-sdk-go" - "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -func TestSettingOrangeToOrangeEditWithOptionalParams(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.OrangeToOrange.Edit(context.TODO(), cloudflare.SettingOrangeToOrangeEditParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingOrangeToOrangeEditParamsValue{ - ID: cloudflare.F(cloudflare.SettingOrangeToOrangeEditParamsValueIDOrangeToOrange), - Value: cloudflare.F(cloudflare.SettingOrangeToOrangeEditParamsValueValueOn), - }), - }) - 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 TestSettingOrangeToOrangeGet(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.OrangeToOrange.Get(context.TODO(), cloudflare.SettingOrangeToOrangeGetParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/settingoriginerrorpagepassthru.go b/settingoriginerrorpagepassthru.go deleted file mode 100644 index 4c0d496406a..00000000000 --- a/settingoriginerrorpagepassthru.go +++ /dev/null @@ -1,331 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingOriginErrorPagePassThruService contains methods and other services that -// help with interacting with the cloudflare API. Note, unlike clients, this -// service does not read variables from the environment automatically. You should -// not instantiate this service directly, and instead use the -// [NewSettingOriginErrorPagePassThruService] method instead. -type SettingOriginErrorPagePassThruService struct { - Options []option.RequestOption -} - -// NewSettingOriginErrorPagePassThruService generates a new service that applies -// the given options to each request. These options are applied after the parent -// client's options (if there is one), and before any request-specific options. -func NewSettingOriginErrorPagePassThruService(opts ...option.RequestOption) (r *SettingOriginErrorPagePassThruService) { - r = &SettingOriginErrorPagePassThruService{} - r.Options = opts - return -} - -// Cloudflare will proxy customer error pages on any 502,504 errors on origin -// server instead of showing a default Cloudflare error page. This does not apply -// to 522 errors and is limited to Enterprise Zones. -func (r *SettingOriginErrorPagePassThruService) Edit(ctx context.Context, params SettingOriginErrorPagePassThruEditParams, opts ...option.RequestOption) (res *SettingOriginErrorPagePassThruEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingOriginErrorPagePassThruEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/origin_error_page_pass_thru", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Cloudflare will proxy customer error pages on any 502,504 errors on origin -// server instead of showing a default Cloudflare error page. This does not apply -// to 522 errors and is limited to Enterprise Zones. -func (r *SettingOriginErrorPagePassThruService) Get(ctx context.Context, query SettingOriginErrorPagePassThruGetParams, opts ...option.RequestOption) (res *SettingOriginErrorPagePassThruGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingOriginErrorPagePassThruGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/origin_error_page_pass_thru", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Cloudflare will proxy customer error pages on any 502,504 errors on origin -// server instead of showing a default Cloudflare error page. This does not apply -// to 522 errors and is limited to Enterprise Zones. -type SettingOriginErrorPagePassThruEditResponse struct { - // ID of the zone setting. - ID SettingOriginErrorPagePassThruEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingOriginErrorPagePassThruEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingOriginErrorPagePassThruEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingOriginErrorPagePassThruEditResponseJSON `json:"-"` -} - -// settingOriginErrorPagePassThruEditResponseJSON contains the JSON metadata for -// the struct [SettingOriginErrorPagePassThruEditResponse] -type settingOriginErrorPagePassThruEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOriginErrorPagePassThruEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingOriginErrorPagePassThruEditResponseID string - -const ( - SettingOriginErrorPagePassThruEditResponseIDOriginErrorPagePassThru SettingOriginErrorPagePassThruEditResponseID = "origin_error_page_pass_thru" -) - -// Current value of the zone setting. -type SettingOriginErrorPagePassThruEditResponseValue string - -const ( - SettingOriginErrorPagePassThruEditResponseValueOn SettingOriginErrorPagePassThruEditResponseValue = "on" - SettingOriginErrorPagePassThruEditResponseValueOff SettingOriginErrorPagePassThruEditResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingOriginErrorPagePassThruEditResponseEditable bool - -const ( - SettingOriginErrorPagePassThruEditResponseEditableTrue SettingOriginErrorPagePassThruEditResponseEditable = true - SettingOriginErrorPagePassThruEditResponseEditableFalse SettingOriginErrorPagePassThruEditResponseEditable = false -) - -// Cloudflare will proxy customer error pages on any 502,504 errors on origin -// server instead of showing a default Cloudflare error page. This does not apply -// to 522 errors and is limited to Enterprise Zones. -type SettingOriginErrorPagePassThruGetResponse struct { - // ID of the zone setting. - ID SettingOriginErrorPagePassThruGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingOriginErrorPagePassThruGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingOriginErrorPagePassThruGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingOriginErrorPagePassThruGetResponseJSON `json:"-"` -} - -// settingOriginErrorPagePassThruGetResponseJSON contains the JSON metadata for the -// struct [SettingOriginErrorPagePassThruGetResponse] -type settingOriginErrorPagePassThruGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOriginErrorPagePassThruGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingOriginErrorPagePassThruGetResponseID string - -const ( - SettingOriginErrorPagePassThruGetResponseIDOriginErrorPagePassThru SettingOriginErrorPagePassThruGetResponseID = "origin_error_page_pass_thru" -) - -// Current value of the zone setting. -type SettingOriginErrorPagePassThruGetResponseValue string - -const ( - SettingOriginErrorPagePassThruGetResponseValueOn SettingOriginErrorPagePassThruGetResponseValue = "on" - SettingOriginErrorPagePassThruGetResponseValueOff SettingOriginErrorPagePassThruGetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingOriginErrorPagePassThruGetResponseEditable bool - -const ( - SettingOriginErrorPagePassThruGetResponseEditableTrue SettingOriginErrorPagePassThruGetResponseEditable = true - SettingOriginErrorPagePassThruGetResponseEditableFalse SettingOriginErrorPagePassThruGetResponseEditable = false -) - -type SettingOriginErrorPagePassThruEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingOriginErrorPagePassThruEditParamsValue] `json:"value,required"` -} - -func (r SettingOriginErrorPagePassThruEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingOriginErrorPagePassThruEditParamsValue string - -const ( - SettingOriginErrorPagePassThruEditParamsValueOn SettingOriginErrorPagePassThruEditParamsValue = "on" - SettingOriginErrorPagePassThruEditParamsValueOff SettingOriginErrorPagePassThruEditParamsValue = "off" -) - -type SettingOriginErrorPagePassThruEditResponseEnvelope struct { - Errors []SettingOriginErrorPagePassThruEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingOriginErrorPagePassThruEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Cloudflare will proxy customer error pages on any 502,504 errors on origin - // server instead of showing a default Cloudflare error page. This does not apply - // to 522 errors and is limited to Enterprise Zones. - Result SettingOriginErrorPagePassThruEditResponse `json:"result"` - JSON settingOriginErrorPagePassThruEditResponseEnvelopeJSON `json:"-"` -} - -// settingOriginErrorPagePassThruEditResponseEnvelopeJSON contains the JSON -// metadata for the struct [SettingOriginErrorPagePassThruEditResponseEnvelope] -type settingOriginErrorPagePassThruEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOriginErrorPagePassThruEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOriginErrorPagePassThruEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingOriginErrorPagePassThruEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingOriginErrorPagePassThruEditResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct -// [SettingOriginErrorPagePassThruEditResponseEnvelopeErrors] -type settingOriginErrorPagePassThruEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOriginErrorPagePassThruEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOriginErrorPagePassThruEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingOriginErrorPagePassThruEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingOriginErrorPagePassThruEditResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct -// [SettingOriginErrorPagePassThruEditResponseEnvelopeMessages] -type settingOriginErrorPagePassThruEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOriginErrorPagePassThruEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOriginErrorPagePassThruGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingOriginErrorPagePassThruGetResponseEnvelope struct { - Errors []SettingOriginErrorPagePassThruGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingOriginErrorPagePassThruGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Cloudflare will proxy customer error pages on any 502,504 errors on origin - // server instead of showing a default Cloudflare error page. This does not apply - // to 522 errors and is limited to Enterprise Zones. - Result SettingOriginErrorPagePassThruGetResponse `json:"result"` - JSON settingOriginErrorPagePassThruGetResponseEnvelopeJSON `json:"-"` -} - -// settingOriginErrorPagePassThruGetResponseEnvelopeJSON contains the JSON metadata -// for the struct [SettingOriginErrorPagePassThruGetResponseEnvelope] -type settingOriginErrorPagePassThruGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOriginErrorPagePassThruGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOriginErrorPagePassThruGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingOriginErrorPagePassThruGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingOriginErrorPagePassThruGetResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct -// [SettingOriginErrorPagePassThruGetResponseEnvelopeErrors] -type settingOriginErrorPagePassThruGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOriginErrorPagePassThruGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOriginErrorPagePassThruGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingOriginErrorPagePassThruGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingOriginErrorPagePassThruGetResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct -// [SettingOriginErrorPagePassThruGetResponseEnvelopeMessages] -type settingOriginErrorPagePassThruGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOriginErrorPagePassThruGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingoriginerrorpagepassthru_test.go b/settingoriginerrorpagepassthru_test.go deleted file mode 100644 index c4d181fe68a..00000000000 --- a/settingoriginerrorpagepassthru_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-sdk-go" - "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -func TestSettingOriginErrorPagePassThruEdit(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.OriginErrorPagePassThru.Edit(context.TODO(), cloudflare.SettingOriginErrorPagePassThruEditParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingOriginErrorPagePassThruEditParamsValueOn), - }) - 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 TestSettingOriginErrorPagePassThruGet(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.OriginErrorPagePassThru.Get(context.TODO(), cloudflare.SettingOriginErrorPagePassThruGetParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/settingoriginmaxhttpversion.go b/settingoriginmaxhttpversion.go deleted file mode 100644 index 6f5a87935a9..00000000000 --- a/settingoriginmaxhttpversion.go +++ /dev/null @@ -1,334 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingOriginMaxHTTPVersionService contains methods and other services that help -// with interacting with the cloudflare API. Note, unlike clients, this service -// does not read variables from the environment automatically. You should not -// instantiate this service directly, and instead use the -// [NewSettingOriginMaxHTTPVersionService] method instead. -type SettingOriginMaxHTTPVersionService struct { - Options []option.RequestOption -} - -// NewSettingOriginMaxHTTPVersionService generates a new service that applies the -// given options to each request. These options are applied after the parent -// client's options (if there is one), and before any request-specific options. -func NewSettingOriginMaxHTTPVersionService(opts ...option.RequestOption) (r *SettingOriginMaxHTTPVersionService) { - r = &SettingOriginMaxHTTPVersionService{} - r.Options = opts - return -} - -// Origin Max HTTP Setting Version sets the highest HTTP version Cloudflare will -// attempt to use with your origin. This setting allows Cloudflare to make HTTP/2 -// requests to your origin. (Refer to -// [Enable HTTP/2 to Origin](https://developers.cloudflare.com/cache/how-to/enable-http2-to-origin/), -// for more information.). The default value is "2" for all plan types except ENT -// where it is "1" -func (r *SettingOriginMaxHTTPVersionService) Edit(ctx context.Context, params SettingOriginMaxHTTPVersionEditParams, opts ...option.RequestOption) (res *SettingOriginMaxHTTPVersionEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingOriginMaxHTTPVersionEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/origin_max_http_version", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Origin Max HTTP Setting Version sets the highest HTTP version Cloudflare will -// attempt to use with your origin. This setting allows Cloudflare to make HTTP/2 -// requests to your origin. (Refer to -// [Enable HTTP/2 to Origin](https://developers.cloudflare.com/cache/how-to/enable-http2-to-origin/), -// for more information.). The default value is "2" for all plan types except ENT -// where it is "1" -func (r *SettingOriginMaxHTTPVersionService) Get(ctx context.Context, query SettingOriginMaxHTTPVersionGetParams, opts ...option.RequestOption) (res *SettingOriginMaxHTTPVersionGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingOriginMaxHTTPVersionGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/origin_max_http_version", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Origin Max HTTP Setting Version sets the highest HTTP version Cloudflare will -// attempt to use with your origin. This setting allows Cloudflare to make HTTP/2 -// requests to your origin. (Refer to -// [Enable HTTP/2 to Origin](https://developers.cloudflare.com/cache/how-to/enable-http2-to-origin/), -// for more information.). The default value is "2" for all plan types except ENT -// where it is "1" -type SettingOriginMaxHTTPVersionEditResponse struct { - // Value of the zone setting. - ID SettingOriginMaxHTTPVersionEditResponseID `json:"id,required"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,required,nullable" format:"date-time"` - // Value of the Origin Max HTTP Version Setting. - Value SettingOriginMaxHTTPVersionEditResponseValue `json:"value,required"` - JSON settingOriginMaxHTTPVersionEditResponseJSON `json:"-"` -} - -// settingOriginMaxHTTPVersionEditResponseJSON contains the JSON metadata for the -// struct [SettingOriginMaxHTTPVersionEditResponse] -type settingOriginMaxHTTPVersionEditResponseJSON struct { - ID apijson.Field - ModifiedOn apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOriginMaxHTTPVersionEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Value of the zone setting. -type SettingOriginMaxHTTPVersionEditResponseID string - -const ( - SettingOriginMaxHTTPVersionEditResponseIDOriginMaxHTTPVersion SettingOriginMaxHTTPVersionEditResponseID = "origin_max_http_version" -) - -// Value of the Origin Max HTTP Version Setting. -type SettingOriginMaxHTTPVersionEditResponseValue string - -const ( - SettingOriginMaxHTTPVersionEditResponseValue2 SettingOriginMaxHTTPVersionEditResponseValue = "2" - SettingOriginMaxHTTPVersionEditResponseValue1 SettingOriginMaxHTTPVersionEditResponseValue = "1" -) - -// Origin Max HTTP Setting Version sets the highest HTTP version Cloudflare will -// attempt to use with your origin. This setting allows Cloudflare to make HTTP/2 -// requests to your origin. (Refer to -// [Enable HTTP/2 to Origin](https://developers.cloudflare.com/cache/how-to/enable-http2-to-origin/), -// for more information.). The default value is "2" for all plan types except ENT -// where it is "1" -type SettingOriginMaxHTTPVersionGetResponse struct { - // Value of the zone setting. - ID SettingOriginMaxHTTPVersionGetResponseID `json:"id,required"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,required,nullable" format:"date-time"` - // Value of the Origin Max HTTP Version Setting. - Value SettingOriginMaxHTTPVersionGetResponseValue `json:"value,required"` - JSON settingOriginMaxHTTPVersionGetResponseJSON `json:"-"` -} - -// settingOriginMaxHTTPVersionGetResponseJSON contains the JSON metadata for the -// struct [SettingOriginMaxHTTPVersionGetResponse] -type settingOriginMaxHTTPVersionGetResponseJSON struct { - ID apijson.Field - ModifiedOn apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOriginMaxHTTPVersionGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Value of the zone setting. -type SettingOriginMaxHTTPVersionGetResponseID string - -const ( - SettingOriginMaxHTTPVersionGetResponseIDOriginMaxHTTPVersion SettingOriginMaxHTTPVersionGetResponseID = "origin_max_http_version" -) - -// Value of the Origin Max HTTP Version Setting. -type SettingOriginMaxHTTPVersionGetResponseValue string - -const ( - SettingOriginMaxHTTPVersionGetResponseValue2 SettingOriginMaxHTTPVersionGetResponseValue = "2" - SettingOriginMaxHTTPVersionGetResponseValue1 SettingOriginMaxHTTPVersionGetResponseValue = "1" -) - -type SettingOriginMaxHTTPVersionEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the Origin Max HTTP Version Setting. - Value param.Field[SettingOriginMaxHTTPVersionEditParamsValue] `json:"value,required"` -} - -func (r SettingOriginMaxHTTPVersionEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the Origin Max HTTP Version Setting. -type SettingOriginMaxHTTPVersionEditParamsValue string - -const ( - SettingOriginMaxHTTPVersionEditParamsValue2 SettingOriginMaxHTTPVersionEditParamsValue = "2" - SettingOriginMaxHTTPVersionEditParamsValue1 SettingOriginMaxHTTPVersionEditParamsValue = "1" -) - -type SettingOriginMaxHTTPVersionEditResponseEnvelope struct { - Errors []SettingOriginMaxHTTPVersionEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingOriginMaxHTTPVersionEditResponseEnvelopeMessages `json:"messages,required"` - // Origin Max HTTP Setting Version sets the highest HTTP version Cloudflare will - // attempt to use with your origin. This setting allows Cloudflare to make HTTP/2 - // requests to your origin. (Refer to - // [Enable HTTP/2 to Origin](https://developers.cloudflare.com/cache/how-to/enable-http2-to-origin/), - // for more information.). The default value is "2" for all plan types except ENT - // where it is "1" - Result SettingOriginMaxHTTPVersionEditResponse `json:"result,required"` - // Whether the API call was successful - Success SettingOriginMaxHTTPVersionEditResponseEnvelopeSuccess `json:"success,required"` - JSON settingOriginMaxHTTPVersionEditResponseEnvelopeJSON `json:"-"` -} - -// settingOriginMaxHTTPVersionEditResponseEnvelopeJSON contains the JSON metadata -// for the struct [SettingOriginMaxHTTPVersionEditResponseEnvelope] -type settingOriginMaxHTTPVersionEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOriginMaxHTTPVersionEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOriginMaxHTTPVersionEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingOriginMaxHTTPVersionEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingOriginMaxHTTPVersionEditResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [SettingOriginMaxHTTPVersionEditResponseEnvelopeErrors] -type settingOriginMaxHTTPVersionEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOriginMaxHTTPVersionEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOriginMaxHTTPVersionEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingOriginMaxHTTPVersionEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingOriginMaxHTTPVersionEditResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct -// [SettingOriginMaxHTTPVersionEditResponseEnvelopeMessages] -type settingOriginMaxHTTPVersionEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOriginMaxHTTPVersionEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type SettingOriginMaxHTTPVersionEditResponseEnvelopeSuccess bool - -const ( - SettingOriginMaxHTTPVersionEditResponseEnvelopeSuccessTrue SettingOriginMaxHTTPVersionEditResponseEnvelopeSuccess = true -) - -type SettingOriginMaxHTTPVersionGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingOriginMaxHTTPVersionGetResponseEnvelope struct { - Errors []SettingOriginMaxHTTPVersionGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingOriginMaxHTTPVersionGetResponseEnvelopeMessages `json:"messages,required"` - // Origin Max HTTP Setting Version sets the highest HTTP version Cloudflare will - // attempt to use with your origin. This setting allows Cloudflare to make HTTP/2 - // requests to your origin. (Refer to - // [Enable HTTP/2 to Origin](https://developers.cloudflare.com/cache/how-to/enable-http2-to-origin/), - // for more information.). The default value is "2" for all plan types except ENT - // where it is "1" - Result SettingOriginMaxHTTPVersionGetResponse `json:"result,required"` - // Whether the API call was successful - Success SettingOriginMaxHTTPVersionGetResponseEnvelopeSuccess `json:"success,required"` - JSON settingOriginMaxHTTPVersionGetResponseEnvelopeJSON `json:"-"` -} - -// settingOriginMaxHTTPVersionGetResponseEnvelopeJSON contains the JSON metadata -// for the struct [SettingOriginMaxHTTPVersionGetResponseEnvelope] -type settingOriginMaxHTTPVersionGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOriginMaxHTTPVersionGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOriginMaxHTTPVersionGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingOriginMaxHTTPVersionGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingOriginMaxHTTPVersionGetResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [SettingOriginMaxHTTPVersionGetResponseEnvelopeErrors] -type settingOriginMaxHTTPVersionGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOriginMaxHTTPVersionGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingOriginMaxHTTPVersionGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingOriginMaxHTTPVersionGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingOriginMaxHTTPVersionGetResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [SettingOriginMaxHTTPVersionGetResponseEnvelopeMessages] -type settingOriginMaxHTTPVersionGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingOriginMaxHTTPVersionGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type SettingOriginMaxHTTPVersionGetResponseEnvelopeSuccess bool - -const ( - SettingOriginMaxHTTPVersionGetResponseEnvelopeSuccessTrue SettingOriginMaxHTTPVersionGetResponseEnvelopeSuccess = true -) diff --git a/settingoriginmaxhttpversion_test.go b/settingoriginmaxhttpversion_test.go deleted file mode 100644 index 6abe74134e2..00000000000 --- a/settingoriginmaxhttpversion_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-sdk-go" - "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -func TestSettingOriginMaxHTTPVersionEdit(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.OriginMaxHTTPVersion.Edit(context.TODO(), cloudflare.SettingOriginMaxHTTPVersionEditParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingOriginMaxHTTPVersionEditParamsValue2), - }) - 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 TestSettingOriginMaxHTTPVersionGet(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.OriginMaxHTTPVersion.Get(context.TODO(), cloudflare.SettingOriginMaxHTTPVersionGetParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/settingpolish.go b/settingpolish.go deleted file mode 100644 index 5ff8b232323..00000000000 --- a/settingpolish.go +++ /dev/null @@ -1,380 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingPolishService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingPolishService] method -// instead. -type SettingPolishService struct { - Options []option.RequestOption -} - -// NewSettingPolishService generates a new service that applies the given options -// to each request. These options are applied after the parent client's options (if -// there is one), and before any request-specific options. -func NewSettingPolishService(opts ...option.RequestOption) (r *SettingPolishService) { - r = &SettingPolishService{} - r.Options = opts - return -} - -// Automatically optimize image loading for website visitors on mobile devices. -// Refer to our [blog post](http://blog.cloudflare.com/polish-solving-mobile-speed) -// for more information. -func (r *SettingPolishService) Edit(ctx context.Context, params SettingPolishEditParams, opts ...option.RequestOption) (res *SettingPolishEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingPolishEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/polish", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Automatically optimize image loading for website visitors on mobile devices. -// Refer to our [blog post](http://blog.cloudflare.com/polish-solving-mobile-speed) -// for more information. -func (r *SettingPolishService) Get(ctx context.Context, query SettingPolishGetParams, opts ...option.RequestOption) (res *SettingPolishGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingPolishGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/polish", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Removes metadata and compresses your images for faster page load times. Basic -// (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual -// quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster -// image loading. Larger JPEGs are converted to progressive images, loading a -// lower-resolution image first and ending in a higher-resolution version. Not -// recommended for hi-res photography sites. -type SettingPolishEditResponse struct { - // ID of the zone setting. - ID SettingPolishEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingPolishEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingPolishEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingPolishEditResponseJSON `json:"-"` -} - -// settingPolishEditResponseJSON contains the JSON metadata for the struct -// [SettingPolishEditResponse] -type settingPolishEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPolishEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingPolishEditResponseID string - -const ( - SettingPolishEditResponseIDPolish SettingPolishEditResponseID = "polish" -) - -// Current value of the zone setting. -type SettingPolishEditResponseValue string - -const ( - SettingPolishEditResponseValueOff SettingPolishEditResponseValue = "off" - SettingPolishEditResponseValueLossless SettingPolishEditResponseValue = "lossless" - SettingPolishEditResponseValueLossy SettingPolishEditResponseValue = "lossy" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingPolishEditResponseEditable bool - -const ( - SettingPolishEditResponseEditableTrue SettingPolishEditResponseEditable = true - SettingPolishEditResponseEditableFalse SettingPolishEditResponseEditable = false -) - -// Removes metadata and compresses your images for faster page load times. Basic -// (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual -// quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster -// image loading. Larger JPEGs are converted to progressive images, loading a -// lower-resolution image first and ending in a higher-resolution version. Not -// recommended for hi-res photography sites. -type SettingPolishGetResponse struct { - // ID of the zone setting. - ID SettingPolishGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingPolishGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingPolishGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingPolishGetResponseJSON `json:"-"` -} - -// settingPolishGetResponseJSON contains the JSON metadata for the struct -// [SettingPolishGetResponse] -type settingPolishGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPolishGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingPolishGetResponseID string - -const ( - SettingPolishGetResponseIDPolish SettingPolishGetResponseID = "polish" -) - -// Current value of the zone setting. -type SettingPolishGetResponseValue string - -const ( - SettingPolishGetResponseValueOff SettingPolishGetResponseValue = "off" - SettingPolishGetResponseValueLossless SettingPolishGetResponseValue = "lossless" - SettingPolishGetResponseValueLossy SettingPolishGetResponseValue = "lossy" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingPolishGetResponseEditable bool - -const ( - SettingPolishGetResponseEditableTrue SettingPolishGetResponseEditable = true - SettingPolishGetResponseEditableFalse SettingPolishGetResponseEditable = false -) - -type SettingPolishEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Removes metadata and compresses your images for faster page load times. Basic - // (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual - // quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster - // image loading. Larger JPEGs are converted to progressive images, loading a - // lower-resolution image first and ending in a higher-resolution version. Not - // recommended for hi-res photography sites. - Value param.Field[SettingPolishEditParamsValue] `json:"value,required"` -} - -func (r SettingPolishEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Removes metadata and compresses your images for faster page load times. Basic -// (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual -// quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster -// image loading. Larger JPEGs are converted to progressive images, loading a -// lower-resolution image first and ending in a higher-resolution version. Not -// recommended for hi-res photography sites. -type SettingPolishEditParamsValue struct { - // ID of the zone setting. - ID param.Field[SettingPolishEditParamsValueID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[SettingPolishEditParamsValueValue] `json:"value,required"` -} - -func (r SettingPolishEditParamsValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// ID of the zone setting. -type SettingPolishEditParamsValueID string - -const ( - SettingPolishEditParamsValueIDPolish SettingPolishEditParamsValueID = "polish" -) - -// Current value of the zone setting. -type SettingPolishEditParamsValueValue string - -const ( - SettingPolishEditParamsValueValueOff SettingPolishEditParamsValueValue = "off" - SettingPolishEditParamsValueValueLossless SettingPolishEditParamsValueValue = "lossless" - SettingPolishEditParamsValueValueLossy SettingPolishEditParamsValueValue = "lossy" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingPolishEditParamsValueEditable bool - -const ( - SettingPolishEditParamsValueEditableTrue SettingPolishEditParamsValueEditable = true - SettingPolishEditParamsValueEditableFalse SettingPolishEditParamsValueEditable = false -) - -type SettingPolishEditResponseEnvelope struct { - Errors []SettingPolishEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingPolishEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Removes metadata and compresses your images for faster page load times. Basic - // (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual - // quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster - // image loading. Larger JPEGs are converted to progressive images, loading a - // lower-resolution image first and ending in a higher-resolution version. Not - // recommended for hi-res photography sites. - Result SettingPolishEditResponse `json:"result"` - JSON settingPolishEditResponseEnvelopeJSON `json:"-"` -} - -// settingPolishEditResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingPolishEditResponseEnvelope] -type settingPolishEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPolishEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingPolishEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingPolishEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingPolishEditResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingPolishEditResponseEnvelopeErrors] -type settingPolishEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPolishEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingPolishEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingPolishEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingPolishEditResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingPolishEditResponseEnvelopeMessages] -type settingPolishEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPolishEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingPolishGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingPolishGetResponseEnvelope struct { - Errors []SettingPolishGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingPolishGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Removes metadata and compresses your images for faster page load times. Basic - // (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual - // quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster - // image loading. Larger JPEGs are converted to progressive images, loading a - // lower-resolution image first and ending in a higher-resolution version. Not - // recommended for hi-res photography sites. - Result SettingPolishGetResponse `json:"result"` - JSON settingPolishGetResponseEnvelopeJSON `json:"-"` -} - -// settingPolishGetResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingPolishGetResponseEnvelope] -type settingPolishGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPolishGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingPolishGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingPolishGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingPolishGetResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingPolishGetResponseEnvelopeErrors] -type settingPolishGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPolishGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingPolishGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingPolishGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingPolishGetResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingPolishGetResponseEnvelopeMessages] -type settingPolishGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPolishGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingprefetchpreload.go b/settingprefetchpreload.go deleted file mode 100644 index 788b15ad057..00000000000 --- a/settingprefetchpreload.go +++ /dev/null @@ -1,321 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingPrefetchPreloadService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingPrefetchPreloadService] -// method instead. -type SettingPrefetchPreloadService struct { - Options []option.RequestOption -} - -// NewSettingPrefetchPreloadService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingPrefetchPreloadService(opts ...option.RequestOption) (r *SettingPrefetchPreloadService) { - r = &SettingPrefetchPreloadService{} - r.Options = opts - return -} - -// Cloudflare will prefetch any URLs that are included in the response headers. -// This is limited to Enterprise Zones. -func (r *SettingPrefetchPreloadService) Edit(ctx context.Context, params SettingPrefetchPreloadEditParams, opts ...option.RequestOption) (res *SettingPrefetchPreloadEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingPrefetchPreloadEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/prefetch_preload", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Cloudflare will prefetch any URLs that are included in the response headers. -// This is limited to Enterprise Zones. -func (r *SettingPrefetchPreloadService) Get(ctx context.Context, query SettingPrefetchPreloadGetParams, opts ...option.RequestOption) (res *SettingPrefetchPreloadGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingPrefetchPreloadGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/prefetch_preload", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Cloudflare will prefetch any URLs that are included in the response headers. -// This is limited to Enterprise Zones. -type SettingPrefetchPreloadEditResponse struct { - // ID of the zone setting. - ID SettingPrefetchPreloadEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingPrefetchPreloadEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingPrefetchPreloadEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingPrefetchPreloadEditResponseJSON `json:"-"` -} - -// settingPrefetchPreloadEditResponseJSON contains the JSON metadata for the struct -// [SettingPrefetchPreloadEditResponse] -type settingPrefetchPreloadEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPrefetchPreloadEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingPrefetchPreloadEditResponseID string - -const ( - SettingPrefetchPreloadEditResponseIDPrefetchPreload SettingPrefetchPreloadEditResponseID = "prefetch_preload" -) - -// Current value of the zone setting. -type SettingPrefetchPreloadEditResponseValue string - -const ( - SettingPrefetchPreloadEditResponseValueOn SettingPrefetchPreloadEditResponseValue = "on" - SettingPrefetchPreloadEditResponseValueOff SettingPrefetchPreloadEditResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingPrefetchPreloadEditResponseEditable bool - -const ( - SettingPrefetchPreloadEditResponseEditableTrue SettingPrefetchPreloadEditResponseEditable = true - SettingPrefetchPreloadEditResponseEditableFalse SettingPrefetchPreloadEditResponseEditable = false -) - -// Cloudflare will prefetch any URLs that are included in the response headers. -// This is limited to Enterprise Zones. -type SettingPrefetchPreloadGetResponse struct { - // ID of the zone setting. - ID SettingPrefetchPreloadGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingPrefetchPreloadGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingPrefetchPreloadGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingPrefetchPreloadGetResponseJSON `json:"-"` -} - -// settingPrefetchPreloadGetResponseJSON contains the JSON metadata for the struct -// [SettingPrefetchPreloadGetResponse] -type settingPrefetchPreloadGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPrefetchPreloadGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingPrefetchPreloadGetResponseID string - -const ( - SettingPrefetchPreloadGetResponseIDPrefetchPreload SettingPrefetchPreloadGetResponseID = "prefetch_preload" -) - -// Current value of the zone setting. -type SettingPrefetchPreloadGetResponseValue string - -const ( - SettingPrefetchPreloadGetResponseValueOn SettingPrefetchPreloadGetResponseValue = "on" - SettingPrefetchPreloadGetResponseValueOff SettingPrefetchPreloadGetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingPrefetchPreloadGetResponseEditable bool - -const ( - SettingPrefetchPreloadGetResponseEditableTrue SettingPrefetchPreloadGetResponseEditable = true - SettingPrefetchPreloadGetResponseEditableFalse SettingPrefetchPreloadGetResponseEditable = false -) - -type SettingPrefetchPreloadEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingPrefetchPreloadEditParamsValue] `json:"value,required"` -} - -func (r SettingPrefetchPreloadEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingPrefetchPreloadEditParamsValue string - -const ( - SettingPrefetchPreloadEditParamsValueOn SettingPrefetchPreloadEditParamsValue = "on" - SettingPrefetchPreloadEditParamsValueOff SettingPrefetchPreloadEditParamsValue = "off" -) - -type SettingPrefetchPreloadEditResponseEnvelope struct { - Errors []SettingPrefetchPreloadEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingPrefetchPreloadEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Cloudflare will prefetch any URLs that are included in the response headers. - // This is limited to Enterprise Zones. - Result SettingPrefetchPreloadEditResponse `json:"result"` - JSON settingPrefetchPreloadEditResponseEnvelopeJSON `json:"-"` -} - -// settingPrefetchPreloadEditResponseEnvelopeJSON contains the JSON metadata for -// the struct [SettingPrefetchPreloadEditResponseEnvelope] -type settingPrefetchPreloadEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPrefetchPreloadEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingPrefetchPreloadEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingPrefetchPreloadEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingPrefetchPreloadEditResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingPrefetchPreloadEditResponseEnvelopeErrors] -type settingPrefetchPreloadEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPrefetchPreloadEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingPrefetchPreloadEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingPrefetchPreloadEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingPrefetchPreloadEditResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [SettingPrefetchPreloadEditResponseEnvelopeMessages] -type settingPrefetchPreloadEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPrefetchPreloadEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingPrefetchPreloadGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingPrefetchPreloadGetResponseEnvelope struct { - Errors []SettingPrefetchPreloadGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingPrefetchPreloadGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Cloudflare will prefetch any URLs that are included in the response headers. - // This is limited to Enterprise Zones. - Result SettingPrefetchPreloadGetResponse `json:"result"` - JSON settingPrefetchPreloadGetResponseEnvelopeJSON `json:"-"` -} - -// settingPrefetchPreloadGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingPrefetchPreloadGetResponseEnvelope] -type settingPrefetchPreloadGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPrefetchPreloadGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingPrefetchPreloadGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingPrefetchPreloadGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingPrefetchPreloadGetResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingPrefetchPreloadGetResponseEnvelopeErrors] -type settingPrefetchPreloadGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPrefetchPreloadGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingPrefetchPreloadGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingPrefetchPreloadGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingPrefetchPreloadGetResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingPrefetchPreloadGetResponseEnvelopeMessages] -type settingPrefetchPreloadGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPrefetchPreloadGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingprefetchpreload_test.go b/settingprefetchpreload_test.go deleted file mode 100644 index 00ac1b0f30f..00000000000 --- a/settingprefetchpreload_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-sdk-go" - "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -func TestSettingPrefetchPreloadEdit(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.PrefetchPreload.Edit(context.TODO(), cloudflare.SettingPrefetchPreloadEditParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingPrefetchPreloadEditParamsValueOn), - }) - 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 TestSettingPrefetchPreloadGet(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.PrefetchPreload.Get(context.TODO(), cloudflare.SettingPrefetchPreloadGetParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/settingproxyreadtimeout.go b/settingproxyreadtimeout.go deleted file mode 100644 index 2e99522fddf..00000000000 --- a/settingproxyreadtimeout.go +++ /dev/null @@ -1,319 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingProxyReadTimeoutService contains methods and other services that help -// with interacting with the cloudflare API. Note, unlike clients, this service -// does not read variables from the environment automatically. You should not -// instantiate this service directly, and instead use the -// [NewSettingProxyReadTimeoutService] method instead. -type SettingProxyReadTimeoutService struct { - Options []option.RequestOption -} - -// NewSettingProxyReadTimeoutService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingProxyReadTimeoutService(opts ...option.RequestOption) (r *SettingProxyReadTimeoutService) { - r = &SettingProxyReadTimeoutService{} - r.Options = opts - return -} - -// Maximum time between two read operations from origin. -func (r *SettingProxyReadTimeoutService) Edit(ctx context.Context, params SettingProxyReadTimeoutEditParams, opts ...option.RequestOption) (res *SettingProxyReadTimeoutEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingProxyReadTimeoutEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/proxy_read_timeout", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Maximum time between two read operations from origin. -func (r *SettingProxyReadTimeoutService) Get(ctx context.Context, query SettingProxyReadTimeoutGetParams, opts ...option.RequestOption) (res *SettingProxyReadTimeoutGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingProxyReadTimeoutGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/proxy_read_timeout", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Maximum time between two read operations from origin. -type SettingProxyReadTimeoutEditResponse struct { - // ID of the zone setting. - ID SettingProxyReadTimeoutEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value float64 `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingProxyReadTimeoutEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingProxyReadTimeoutEditResponseJSON `json:"-"` -} - -// settingProxyReadTimeoutEditResponseJSON contains the JSON metadata for the -// struct [SettingProxyReadTimeoutEditResponse] -type settingProxyReadTimeoutEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingProxyReadTimeoutEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingProxyReadTimeoutEditResponseID string - -const ( - SettingProxyReadTimeoutEditResponseIDProxyReadTimeout SettingProxyReadTimeoutEditResponseID = "proxy_read_timeout" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingProxyReadTimeoutEditResponseEditable bool - -const ( - SettingProxyReadTimeoutEditResponseEditableTrue SettingProxyReadTimeoutEditResponseEditable = true - SettingProxyReadTimeoutEditResponseEditableFalse SettingProxyReadTimeoutEditResponseEditable = false -) - -// Maximum time between two read operations from origin. -type SettingProxyReadTimeoutGetResponse struct { - // ID of the zone setting. - ID SettingProxyReadTimeoutGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value float64 `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingProxyReadTimeoutGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingProxyReadTimeoutGetResponseJSON `json:"-"` -} - -// settingProxyReadTimeoutGetResponseJSON contains the JSON metadata for the struct -// [SettingProxyReadTimeoutGetResponse] -type settingProxyReadTimeoutGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingProxyReadTimeoutGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingProxyReadTimeoutGetResponseID string - -const ( - SettingProxyReadTimeoutGetResponseIDProxyReadTimeout SettingProxyReadTimeoutGetResponseID = "proxy_read_timeout" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingProxyReadTimeoutGetResponseEditable bool - -const ( - SettingProxyReadTimeoutGetResponseEditableTrue SettingProxyReadTimeoutGetResponseEditable = true - SettingProxyReadTimeoutGetResponseEditableFalse SettingProxyReadTimeoutGetResponseEditable = false -) - -type SettingProxyReadTimeoutEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Maximum time between two read operations from origin. - Value param.Field[SettingProxyReadTimeoutEditParamsValue] `json:"value,required"` -} - -func (r SettingProxyReadTimeoutEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Maximum time between two read operations from origin. -type SettingProxyReadTimeoutEditParamsValue struct { - // ID of the zone setting. - ID param.Field[SettingProxyReadTimeoutEditParamsValueID] `json:"id,required"` - // Current value of the zone setting. - Value param.Field[float64] `json:"value,required"` -} - -func (r SettingProxyReadTimeoutEditParamsValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// ID of the zone setting. -type SettingProxyReadTimeoutEditParamsValueID string - -const ( - SettingProxyReadTimeoutEditParamsValueIDProxyReadTimeout SettingProxyReadTimeoutEditParamsValueID = "proxy_read_timeout" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingProxyReadTimeoutEditParamsValueEditable bool - -const ( - SettingProxyReadTimeoutEditParamsValueEditableTrue SettingProxyReadTimeoutEditParamsValueEditable = true - SettingProxyReadTimeoutEditParamsValueEditableFalse SettingProxyReadTimeoutEditParamsValueEditable = false -) - -type SettingProxyReadTimeoutEditResponseEnvelope struct { - Errors []SettingProxyReadTimeoutEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingProxyReadTimeoutEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Maximum time between two read operations from origin. - Result SettingProxyReadTimeoutEditResponse `json:"result"` - JSON settingProxyReadTimeoutEditResponseEnvelopeJSON `json:"-"` -} - -// settingProxyReadTimeoutEditResponseEnvelopeJSON contains the JSON metadata for -// the struct [SettingProxyReadTimeoutEditResponseEnvelope] -type settingProxyReadTimeoutEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingProxyReadTimeoutEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingProxyReadTimeoutEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingProxyReadTimeoutEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingProxyReadTimeoutEditResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingProxyReadTimeoutEditResponseEnvelopeErrors] -type settingProxyReadTimeoutEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingProxyReadTimeoutEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingProxyReadTimeoutEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingProxyReadTimeoutEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingProxyReadTimeoutEditResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [SettingProxyReadTimeoutEditResponseEnvelopeMessages] -type settingProxyReadTimeoutEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingProxyReadTimeoutEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingProxyReadTimeoutGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingProxyReadTimeoutGetResponseEnvelope struct { - Errors []SettingProxyReadTimeoutGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingProxyReadTimeoutGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Maximum time between two read operations from origin. - Result SettingProxyReadTimeoutGetResponse `json:"result"` - JSON settingProxyReadTimeoutGetResponseEnvelopeJSON `json:"-"` -} - -// settingProxyReadTimeoutGetResponseEnvelopeJSON contains the JSON metadata for -// the struct [SettingProxyReadTimeoutGetResponseEnvelope] -type settingProxyReadTimeoutGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingProxyReadTimeoutGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingProxyReadTimeoutGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingProxyReadTimeoutGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingProxyReadTimeoutGetResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingProxyReadTimeoutGetResponseEnvelopeErrors] -type settingProxyReadTimeoutGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingProxyReadTimeoutGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingProxyReadTimeoutGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingProxyReadTimeoutGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingProxyReadTimeoutGetResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [SettingProxyReadTimeoutGetResponseEnvelopeMessages] -type settingProxyReadTimeoutGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingProxyReadTimeoutGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingpseudoipv4.go b/settingpseudoipv4.go deleted file mode 100644 index b4bb5e64998..00000000000 --- a/settingpseudoipv4.go +++ /dev/null @@ -1,318 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingPseudoIPV4Service contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingPseudoIPV4Service] method -// instead. -type SettingPseudoIPV4Service struct { - Options []option.RequestOption -} - -// NewSettingPseudoIPV4Service generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingPseudoIPV4Service(opts ...option.RequestOption) (r *SettingPseudoIPV4Service) { - r = &SettingPseudoIPV4Service{} - r.Options = opts - return -} - -// Value of the Pseudo IPv4 setting. -func (r *SettingPseudoIPV4Service) Edit(ctx context.Context, params SettingPseudoIPV4EditParams, opts ...option.RequestOption) (res *SettingPseudoIPV4EditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingPseudoIPV4EditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/pseudo_ipv4", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Value of the Pseudo IPv4 setting. -func (r *SettingPseudoIPV4Service) Get(ctx context.Context, query SettingPseudoIPV4GetParams, opts ...option.RequestOption) (res *SettingPseudoIPV4GetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingPseudoIPV4GetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/pseudo_ipv4", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// The value set for the Pseudo IPv4 setting. -type SettingPseudoIPV4EditResponse struct { - // Value of the Pseudo IPv4 setting. - ID SettingPseudoIPV4EditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingPseudoIPV4EditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingPseudoIPV4EditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingPseudoIPV4EditResponseJSON `json:"-"` -} - -// settingPseudoIPV4EditResponseJSON contains the JSON metadata for the struct -// [SettingPseudoIPV4EditResponse] -type settingPseudoIPV4EditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPseudoIPV4EditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Value of the Pseudo IPv4 setting. -type SettingPseudoIPV4EditResponseID string - -const ( - SettingPseudoIPV4EditResponseIDPseudoIPV4 SettingPseudoIPV4EditResponseID = "pseudo_ipv4" -) - -// Current value of the zone setting. -type SettingPseudoIPV4EditResponseValue string - -const ( - SettingPseudoIPV4EditResponseValueOff SettingPseudoIPV4EditResponseValue = "off" - SettingPseudoIPV4EditResponseValueAddHeader SettingPseudoIPV4EditResponseValue = "add_header" - SettingPseudoIPV4EditResponseValueOverwriteHeader SettingPseudoIPV4EditResponseValue = "overwrite_header" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingPseudoIPV4EditResponseEditable bool - -const ( - SettingPseudoIPV4EditResponseEditableTrue SettingPseudoIPV4EditResponseEditable = true - SettingPseudoIPV4EditResponseEditableFalse SettingPseudoIPV4EditResponseEditable = false -) - -// The value set for the Pseudo IPv4 setting. -type SettingPseudoIPV4GetResponse struct { - // Value of the Pseudo IPv4 setting. - ID SettingPseudoIPV4GetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingPseudoIPV4GetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingPseudoIPV4GetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingPseudoIPV4GetResponseJSON `json:"-"` -} - -// settingPseudoIPV4GetResponseJSON contains the JSON metadata for the struct -// [SettingPseudoIPV4GetResponse] -type settingPseudoIPV4GetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPseudoIPV4GetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Value of the Pseudo IPv4 setting. -type SettingPseudoIPV4GetResponseID string - -const ( - SettingPseudoIPV4GetResponseIDPseudoIPV4 SettingPseudoIPV4GetResponseID = "pseudo_ipv4" -) - -// Current value of the zone setting. -type SettingPseudoIPV4GetResponseValue string - -const ( - SettingPseudoIPV4GetResponseValueOff SettingPseudoIPV4GetResponseValue = "off" - SettingPseudoIPV4GetResponseValueAddHeader SettingPseudoIPV4GetResponseValue = "add_header" - SettingPseudoIPV4GetResponseValueOverwriteHeader SettingPseudoIPV4GetResponseValue = "overwrite_header" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingPseudoIPV4GetResponseEditable bool - -const ( - SettingPseudoIPV4GetResponseEditableTrue SettingPseudoIPV4GetResponseEditable = true - SettingPseudoIPV4GetResponseEditableFalse SettingPseudoIPV4GetResponseEditable = false -) - -type SettingPseudoIPV4EditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the Pseudo IPv4 setting. - Value param.Field[SettingPseudoIPV4EditParamsValue] `json:"value,required"` -} - -func (r SettingPseudoIPV4EditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the Pseudo IPv4 setting. -type SettingPseudoIPV4EditParamsValue string - -const ( - SettingPseudoIPV4EditParamsValueOff SettingPseudoIPV4EditParamsValue = "off" - SettingPseudoIPV4EditParamsValueAddHeader SettingPseudoIPV4EditParamsValue = "add_header" - SettingPseudoIPV4EditParamsValueOverwriteHeader SettingPseudoIPV4EditParamsValue = "overwrite_header" -) - -type SettingPseudoIPV4EditResponseEnvelope struct { - Errors []SettingPseudoIPV4EditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingPseudoIPV4EditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // The value set for the Pseudo IPv4 setting. - Result SettingPseudoIPV4EditResponse `json:"result"` - JSON settingPseudoIPV4EditResponseEnvelopeJSON `json:"-"` -} - -// settingPseudoIPV4EditResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingPseudoIPV4EditResponseEnvelope] -type settingPseudoIPV4EditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPseudoIPV4EditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingPseudoIPV4EditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingPseudoIPV4EditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingPseudoIPV4EditResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [SettingPseudoIPV4EditResponseEnvelopeErrors] -type settingPseudoIPV4EditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPseudoIPV4EditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingPseudoIPV4EditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingPseudoIPV4EditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingPseudoIPV4EditResponseEnvelopeMessagesJSON contains the JSON metadata for -// the struct [SettingPseudoIPV4EditResponseEnvelopeMessages] -type settingPseudoIPV4EditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPseudoIPV4EditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingPseudoIPV4GetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingPseudoIPV4GetResponseEnvelope struct { - Errors []SettingPseudoIPV4GetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingPseudoIPV4GetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // The value set for the Pseudo IPv4 setting. - Result SettingPseudoIPV4GetResponse `json:"result"` - JSON settingPseudoIPV4GetResponseEnvelopeJSON `json:"-"` -} - -// settingPseudoIPV4GetResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingPseudoIPV4GetResponseEnvelope] -type settingPseudoIPV4GetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPseudoIPV4GetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingPseudoIPV4GetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingPseudoIPV4GetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingPseudoIPV4GetResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [SettingPseudoIPV4GetResponseEnvelopeErrors] -type settingPseudoIPV4GetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPseudoIPV4GetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingPseudoIPV4GetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingPseudoIPV4GetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingPseudoIPV4GetResponseEnvelopeMessagesJSON contains the JSON metadata for -// the struct [SettingPseudoIPV4GetResponseEnvelopeMessages] -type settingPseudoIPV4GetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingPseudoIPV4GetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingresponsebuffering.go b/settingresponsebuffering.go deleted file mode 100644 index 3c8e6656d56..00000000000 --- a/settingresponsebuffering.go +++ /dev/null @@ -1,333 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingResponseBufferingService contains methods and other services that help -// with interacting with the cloudflare API. Note, unlike clients, this service -// does not read variables from the environment automatically. You should not -// instantiate this service directly, and instead use the -// [NewSettingResponseBufferingService] method instead. -type SettingResponseBufferingService struct { - Options []option.RequestOption -} - -// NewSettingResponseBufferingService generates a new service that applies the -// given options to each request. These options are applied after the parent -// client's options (if there is one), and before any request-specific options. -func NewSettingResponseBufferingService(opts ...option.RequestOption) (r *SettingResponseBufferingService) { - r = &SettingResponseBufferingService{} - r.Options = opts - return -} - -// Enables or disables buffering of responses from the proxied server. Cloudflare -// may buffer the whole payload to deliver it at once to the client versus allowing -// it to be delivered in chunks. By default, the proxied server streams directly -// and is not buffered by Cloudflare. This is limited to Enterprise Zones. -func (r *SettingResponseBufferingService) Edit(ctx context.Context, params SettingResponseBufferingEditParams, opts ...option.RequestOption) (res *SettingResponseBufferingEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingResponseBufferingEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/response_buffering", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Enables or disables buffering of responses from the proxied server. Cloudflare -// may buffer the whole payload to deliver it at once to the client versus allowing -// it to be delivered in chunks. By default, the proxied server streams directly -// and is not buffered by Cloudflare. This is limited to Enterprise Zones. -func (r *SettingResponseBufferingService) Get(ctx context.Context, query SettingResponseBufferingGetParams, opts ...option.RequestOption) (res *SettingResponseBufferingGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingResponseBufferingGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/response_buffering", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Enables or disables buffering of responses from the proxied server. Cloudflare -// may buffer the whole payload to deliver it at once to the client versus allowing -// it to be delivered in chunks. By default, the proxied server streams directly -// and is not buffered by Cloudflare. This is limited to Enterprise Zones. -type SettingResponseBufferingEditResponse struct { - // ID of the zone setting. - ID SettingResponseBufferingEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingResponseBufferingEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingResponseBufferingEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingResponseBufferingEditResponseJSON `json:"-"` -} - -// settingResponseBufferingEditResponseJSON contains the JSON metadata for the -// struct [SettingResponseBufferingEditResponse] -type settingResponseBufferingEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingResponseBufferingEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingResponseBufferingEditResponseID string - -const ( - SettingResponseBufferingEditResponseIDResponseBuffering SettingResponseBufferingEditResponseID = "response_buffering" -) - -// Current value of the zone setting. -type SettingResponseBufferingEditResponseValue string - -const ( - SettingResponseBufferingEditResponseValueOn SettingResponseBufferingEditResponseValue = "on" - SettingResponseBufferingEditResponseValueOff SettingResponseBufferingEditResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingResponseBufferingEditResponseEditable bool - -const ( - SettingResponseBufferingEditResponseEditableTrue SettingResponseBufferingEditResponseEditable = true - SettingResponseBufferingEditResponseEditableFalse SettingResponseBufferingEditResponseEditable = false -) - -// Enables or disables buffering of responses from the proxied server. Cloudflare -// may buffer the whole payload to deliver it at once to the client versus allowing -// it to be delivered in chunks. By default, the proxied server streams directly -// and is not buffered by Cloudflare. This is limited to Enterprise Zones. -type SettingResponseBufferingGetResponse struct { - // ID of the zone setting. - ID SettingResponseBufferingGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingResponseBufferingGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingResponseBufferingGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingResponseBufferingGetResponseJSON `json:"-"` -} - -// settingResponseBufferingGetResponseJSON contains the JSON metadata for the -// struct [SettingResponseBufferingGetResponse] -type settingResponseBufferingGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingResponseBufferingGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingResponseBufferingGetResponseID string - -const ( - SettingResponseBufferingGetResponseIDResponseBuffering SettingResponseBufferingGetResponseID = "response_buffering" -) - -// Current value of the zone setting. -type SettingResponseBufferingGetResponseValue string - -const ( - SettingResponseBufferingGetResponseValueOn SettingResponseBufferingGetResponseValue = "on" - SettingResponseBufferingGetResponseValueOff SettingResponseBufferingGetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingResponseBufferingGetResponseEditable bool - -const ( - SettingResponseBufferingGetResponseEditableTrue SettingResponseBufferingGetResponseEditable = true - SettingResponseBufferingGetResponseEditableFalse SettingResponseBufferingGetResponseEditable = false -) - -type SettingResponseBufferingEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingResponseBufferingEditParamsValue] `json:"value,required"` -} - -func (r SettingResponseBufferingEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingResponseBufferingEditParamsValue string - -const ( - SettingResponseBufferingEditParamsValueOn SettingResponseBufferingEditParamsValue = "on" - SettingResponseBufferingEditParamsValueOff SettingResponseBufferingEditParamsValue = "off" -) - -type SettingResponseBufferingEditResponseEnvelope struct { - Errors []SettingResponseBufferingEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingResponseBufferingEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Enables or disables buffering of responses from the proxied server. Cloudflare - // may buffer the whole payload to deliver it at once to the client versus allowing - // it to be delivered in chunks. By default, the proxied server streams directly - // and is not buffered by Cloudflare. This is limited to Enterprise Zones. - Result SettingResponseBufferingEditResponse `json:"result"` - JSON settingResponseBufferingEditResponseEnvelopeJSON `json:"-"` -} - -// settingResponseBufferingEditResponseEnvelopeJSON contains the JSON metadata for -// the struct [SettingResponseBufferingEditResponseEnvelope] -type settingResponseBufferingEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingResponseBufferingEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingResponseBufferingEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingResponseBufferingEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingResponseBufferingEditResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [SettingResponseBufferingEditResponseEnvelopeErrors] -type settingResponseBufferingEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingResponseBufferingEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingResponseBufferingEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingResponseBufferingEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingResponseBufferingEditResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [SettingResponseBufferingEditResponseEnvelopeMessages] -type settingResponseBufferingEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingResponseBufferingEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingResponseBufferingGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingResponseBufferingGetResponseEnvelope struct { - Errors []SettingResponseBufferingGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingResponseBufferingGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Enables or disables buffering of responses from the proxied server. Cloudflare - // may buffer the whole payload to deliver it at once to the client versus allowing - // it to be delivered in chunks. By default, the proxied server streams directly - // and is not buffered by Cloudflare. This is limited to Enterprise Zones. - Result SettingResponseBufferingGetResponse `json:"result"` - JSON settingResponseBufferingGetResponseEnvelopeJSON `json:"-"` -} - -// settingResponseBufferingGetResponseEnvelopeJSON contains the JSON metadata for -// the struct [SettingResponseBufferingGetResponseEnvelope] -type settingResponseBufferingGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingResponseBufferingGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingResponseBufferingGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingResponseBufferingGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingResponseBufferingGetResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingResponseBufferingGetResponseEnvelopeErrors] -type settingResponseBufferingGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingResponseBufferingGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingResponseBufferingGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingResponseBufferingGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingResponseBufferingGetResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [SettingResponseBufferingGetResponseEnvelopeMessages] -type settingResponseBufferingGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingResponseBufferingGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingrocketloader_test.go b/settingrocketloader_test.go deleted file mode 100644 index 7ce6bda467c..00000000000 --- a/settingrocketloader_test.go +++ /dev/null @@ -1,74 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-sdk-go" - "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -func TestSettingRocketLoaderEditWithOptionalParams(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.RocketLoader.Edit(context.TODO(), cloudflare.SettingRocketLoaderEditParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingRocketLoaderEditParamsValue{ - ID: cloudflare.F(cloudflare.SettingRocketLoaderEditParamsValueIDRocketLoader), - Value: cloudflare.F(cloudflare.SettingRocketLoaderEditParamsValueValueOn), - }), - }) - 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 TestSettingRocketLoaderGet(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.RocketLoader.Get(context.TODO(), cloudflare.SettingRocketLoaderGetParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/settingsecurityheader.go b/settingsecurityheader.go deleted file mode 100644 index 6dd94e07465..00000000000 --- a/settingsecurityheader.go +++ /dev/null @@ -1,411 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingSecurityHeaderService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingSecurityHeaderService] -// method instead. -type SettingSecurityHeaderService struct { - Options []option.RequestOption -} - -// NewSettingSecurityHeaderService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingSecurityHeaderService(opts ...option.RequestOption) (r *SettingSecurityHeaderService) { - r = &SettingSecurityHeaderService{} - r.Options = opts - return -} - -// Cloudflare security header for a zone. -func (r *SettingSecurityHeaderService) Edit(ctx context.Context, params SettingSecurityHeaderEditParams, opts ...option.RequestOption) (res *SettingSecurityHeaderEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingSecurityHeaderEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/security_header", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Cloudflare security header for a zone. -func (r *SettingSecurityHeaderService) Get(ctx context.Context, query SettingSecurityHeaderGetParams, opts ...option.RequestOption) (res *SettingSecurityHeaderGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingSecurityHeaderGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/security_header", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Cloudflare security header for a zone. -type SettingSecurityHeaderEditResponse struct { - // ID of the zone's security header. - ID SettingSecurityHeaderEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingSecurityHeaderEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingSecurityHeaderEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingSecurityHeaderEditResponseJSON `json:"-"` -} - -// settingSecurityHeaderEditResponseJSON contains the JSON metadata for the struct -// [SettingSecurityHeaderEditResponse] -type settingSecurityHeaderEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSecurityHeaderEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone's security header. -type SettingSecurityHeaderEditResponseID string - -const ( - SettingSecurityHeaderEditResponseIDSecurityHeader SettingSecurityHeaderEditResponseID = "security_header" -) - -// Current value of the zone setting. -type SettingSecurityHeaderEditResponseValue struct { - // Strict Transport Security. - StrictTransportSecurity SettingSecurityHeaderEditResponseValueStrictTransportSecurity `json:"strict_transport_security"` - JSON settingSecurityHeaderEditResponseValueJSON `json:"-"` -} - -// settingSecurityHeaderEditResponseValueJSON contains the JSON metadata for the -// struct [SettingSecurityHeaderEditResponseValue] -type settingSecurityHeaderEditResponseValueJSON struct { - StrictTransportSecurity apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSecurityHeaderEditResponseValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Strict Transport Security. -type SettingSecurityHeaderEditResponseValueStrictTransportSecurity struct { - // Whether or not strict transport security is enabled. - Enabled bool `json:"enabled"` - // Include all subdomains for strict transport security. - IncludeSubdomains bool `json:"include_subdomains"` - // Max age in seconds of the strict transport security. - MaxAge float64 `json:"max_age"` - // Whether or not to include 'X-Content-Type-Options: nosniff' header. - Nosniff bool `json:"nosniff"` - JSON settingSecurityHeaderEditResponseValueStrictTransportSecurityJSON `json:"-"` -} - -// settingSecurityHeaderEditResponseValueStrictTransportSecurityJSON contains the -// JSON metadata for the struct -// [SettingSecurityHeaderEditResponseValueStrictTransportSecurity] -type settingSecurityHeaderEditResponseValueStrictTransportSecurityJSON struct { - Enabled apijson.Field - IncludeSubdomains apijson.Field - MaxAge apijson.Field - Nosniff apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSecurityHeaderEditResponseValueStrictTransportSecurity) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingSecurityHeaderEditResponseEditable bool - -const ( - SettingSecurityHeaderEditResponseEditableTrue SettingSecurityHeaderEditResponseEditable = true - SettingSecurityHeaderEditResponseEditableFalse SettingSecurityHeaderEditResponseEditable = false -) - -// Cloudflare security header for a zone. -type SettingSecurityHeaderGetResponse struct { - // ID of the zone's security header. - ID SettingSecurityHeaderGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingSecurityHeaderGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingSecurityHeaderGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingSecurityHeaderGetResponseJSON `json:"-"` -} - -// settingSecurityHeaderGetResponseJSON contains the JSON metadata for the struct -// [SettingSecurityHeaderGetResponse] -type settingSecurityHeaderGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSecurityHeaderGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone's security header. -type SettingSecurityHeaderGetResponseID string - -const ( - SettingSecurityHeaderGetResponseIDSecurityHeader SettingSecurityHeaderGetResponseID = "security_header" -) - -// Current value of the zone setting. -type SettingSecurityHeaderGetResponseValue struct { - // Strict Transport Security. - StrictTransportSecurity SettingSecurityHeaderGetResponseValueStrictTransportSecurity `json:"strict_transport_security"` - JSON settingSecurityHeaderGetResponseValueJSON `json:"-"` -} - -// settingSecurityHeaderGetResponseValueJSON contains the JSON metadata for the -// struct [SettingSecurityHeaderGetResponseValue] -type settingSecurityHeaderGetResponseValueJSON struct { - StrictTransportSecurity apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSecurityHeaderGetResponseValue) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Strict Transport Security. -type SettingSecurityHeaderGetResponseValueStrictTransportSecurity struct { - // Whether or not strict transport security is enabled. - Enabled bool `json:"enabled"` - // Include all subdomains for strict transport security. - IncludeSubdomains bool `json:"include_subdomains"` - // Max age in seconds of the strict transport security. - MaxAge float64 `json:"max_age"` - // Whether or not to include 'X-Content-Type-Options: nosniff' header. - Nosniff bool `json:"nosniff"` - JSON settingSecurityHeaderGetResponseValueStrictTransportSecurityJSON `json:"-"` -} - -// settingSecurityHeaderGetResponseValueStrictTransportSecurityJSON contains the -// JSON metadata for the struct -// [SettingSecurityHeaderGetResponseValueStrictTransportSecurity] -type settingSecurityHeaderGetResponseValueStrictTransportSecurityJSON struct { - Enabled apijson.Field - IncludeSubdomains apijson.Field - MaxAge apijson.Field - Nosniff apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSecurityHeaderGetResponseValueStrictTransportSecurity) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingSecurityHeaderGetResponseEditable bool - -const ( - SettingSecurityHeaderGetResponseEditableTrue SettingSecurityHeaderGetResponseEditable = true - SettingSecurityHeaderGetResponseEditableFalse SettingSecurityHeaderGetResponseEditable = false -) - -type SettingSecurityHeaderEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Value param.Field[SettingSecurityHeaderEditParamsValue] `json:"value,required"` -} - -func (r SettingSecurityHeaderEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type SettingSecurityHeaderEditParamsValue struct { - // Strict Transport Security. - StrictTransportSecurity param.Field[SettingSecurityHeaderEditParamsValueStrictTransportSecurity] `json:"strict_transport_security"` -} - -func (r SettingSecurityHeaderEditParamsValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Strict Transport Security. -type SettingSecurityHeaderEditParamsValueStrictTransportSecurity struct { - // Whether or not strict transport security is enabled. - Enabled param.Field[bool] `json:"enabled"` - // Include all subdomains for strict transport security. - IncludeSubdomains param.Field[bool] `json:"include_subdomains"` - // Max age in seconds of the strict transport security. - MaxAge param.Field[float64] `json:"max_age"` - // Whether or not to include 'X-Content-Type-Options: nosniff' header. - Nosniff param.Field[bool] `json:"nosniff"` -} - -func (r SettingSecurityHeaderEditParamsValueStrictTransportSecurity) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type SettingSecurityHeaderEditResponseEnvelope struct { - Errors []SettingSecurityHeaderEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingSecurityHeaderEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Cloudflare security header for a zone. - Result SettingSecurityHeaderEditResponse `json:"result"` - JSON settingSecurityHeaderEditResponseEnvelopeJSON `json:"-"` -} - -// settingSecurityHeaderEditResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingSecurityHeaderEditResponseEnvelope] -type settingSecurityHeaderEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSecurityHeaderEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingSecurityHeaderEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingSecurityHeaderEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingSecurityHeaderEditResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingSecurityHeaderEditResponseEnvelopeErrors] -type settingSecurityHeaderEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSecurityHeaderEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingSecurityHeaderEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingSecurityHeaderEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingSecurityHeaderEditResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingSecurityHeaderEditResponseEnvelopeMessages] -type settingSecurityHeaderEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSecurityHeaderEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingSecurityHeaderGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingSecurityHeaderGetResponseEnvelope struct { - Errors []SettingSecurityHeaderGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingSecurityHeaderGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Cloudflare security header for a zone. - Result SettingSecurityHeaderGetResponse `json:"result"` - JSON settingSecurityHeaderGetResponseEnvelopeJSON `json:"-"` -} - -// settingSecurityHeaderGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingSecurityHeaderGetResponseEnvelope] -type settingSecurityHeaderGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSecurityHeaderGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingSecurityHeaderGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingSecurityHeaderGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingSecurityHeaderGetResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingSecurityHeaderGetResponseEnvelopeErrors] -type settingSecurityHeaderGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSecurityHeaderGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingSecurityHeaderGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingSecurityHeaderGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingSecurityHeaderGetResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingSecurityHeaderGetResponseEnvelopeMessages] -type settingSecurityHeaderGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSecurityHeaderGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingsecuritylevel.go b/settingsecuritylevel.go deleted file mode 100644 index 4a26069d763..00000000000 --- a/settingsecuritylevel.go +++ /dev/null @@ -1,345 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingSecurityLevelService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingSecurityLevelService] -// method instead. -type SettingSecurityLevelService struct { - Options []option.RequestOption -} - -// NewSettingSecurityLevelService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingSecurityLevelService(opts ...option.RequestOption) (r *SettingSecurityLevelService) { - r = &SettingSecurityLevelService{} - r.Options = opts - return -} - -// Choose the appropriate security profile for your website, which will -// automatically adjust each of the security settings. If you choose to customize -// an individual security setting, the profile will become Custom. -// (https://support.cloudflare.com/hc/en-us/articles/200170056). -func (r *SettingSecurityLevelService) Edit(ctx context.Context, params SettingSecurityLevelEditParams, opts ...option.RequestOption) (res *SettingSecurityLevelEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingSecurityLevelEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/security_level", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Choose the appropriate security profile for your website, which will -// automatically adjust each of the security settings. If you choose to customize -// an individual security setting, the profile will become Custom. -// (https://support.cloudflare.com/hc/en-us/articles/200170056). -func (r *SettingSecurityLevelService) Get(ctx context.Context, query SettingSecurityLevelGetParams, opts ...option.RequestOption) (res *SettingSecurityLevelGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingSecurityLevelGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/security_level", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Choose the appropriate security profile for your website, which will -// automatically adjust each of the security settings. If you choose to customize -// an individual security setting, the profile will become Custom. -// (https://support.cloudflare.com/hc/en-us/articles/200170056). -type SettingSecurityLevelEditResponse struct { - // ID of the zone setting. - ID SettingSecurityLevelEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingSecurityLevelEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingSecurityLevelEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingSecurityLevelEditResponseJSON `json:"-"` -} - -// settingSecurityLevelEditResponseJSON contains the JSON metadata for the struct -// [SettingSecurityLevelEditResponse] -type settingSecurityLevelEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSecurityLevelEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingSecurityLevelEditResponseID string - -const ( - SettingSecurityLevelEditResponseIDSecurityLevel SettingSecurityLevelEditResponseID = "security_level" -) - -// Current value of the zone setting. -type SettingSecurityLevelEditResponseValue string - -const ( - SettingSecurityLevelEditResponseValueOff SettingSecurityLevelEditResponseValue = "off" - SettingSecurityLevelEditResponseValueEssentiallyOff SettingSecurityLevelEditResponseValue = "essentially_off" - SettingSecurityLevelEditResponseValueLow SettingSecurityLevelEditResponseValue = "low" - SettingSecurityLevelEditResponseValueMedium SettingSecurityLevelEditResponseValue = "medium" - SettingSecurityLevelEditResponseValueHigh SettingSecurityLevelEditResponseValue = "high" - SettingSecurityLevelEditResponseValueUnderAttack SettingSecurityLevelEditResponseValue = "under_attack" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingSecurityLevelEditResponseEditable bool - -const ( - SettingSecurityLevelEditResponseEditableTrue SettingSecurityLevelEditResponseEditable = true - SettingSecurityLevelEditResponseEditableFalse SettingSecurityLevelEditResponseEditable = false -) - -// Choose the appropriate security profile for your website, which will -// automatically adjust each of the security settings. If you choose to customize -// an individual security setting, the profile will become Custom. -// (https://support.cloudflare.com/hc/en-us/articles/200170056). -type SettingSecurityLevelGetResponse struct { - // ID of the zone setting. - ID SettingSecurityLevelGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingSecurityLevelGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingSecurityLevelGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingSecurityLevelGetResponseJSON `json:"-"` -} - -// settingSecurityLevelGetResponseJSON contains the JSON metadata for the struct -// [SettingSecurityLevelGetResponse] -type settingSecurityLevelGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSecurityLevelGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingSecurityLevelGetResponseID string - -const ( - SettingSecurityLevelGetResponseIDSecurityLevel SettingSecurityLevelGetResponseID = "security_level" -) - -// Current value of the zone setting. -type SettingSecurityLevelGetResponseValue string - -const ( - SettingSecurityLevelGetResponseValueOff SettingSecurityLevelGetResponseValue = "off" - SettingSecurityLevelGetResponseValueEssentiallyOff SettingSecurityLevelGetResponseValue = "essentially_off" - SettingSecurityLevelGetResponseValueLow SettingSecurityLevelGetResponseValue = "low" - SettingSecurityLevelGetResponseValueMedium SettingSecurityLevelGetResponseValue = "medium" - SettingSecurityLevelGetResponseValueHigh SettingSecurityLevelGetResponseValue = "high" - SettingSecurityLevelGetResponseValueUnderAttack SettingSecurityLevelGetResponseValue = "under_attack" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingSecurityLevelGetResponseEditable bool - -const ( - SettingSecurityLevelGetResponseEditableTrue SettingSecurityLevelGetResponseEditable = true - SettingSecurityLevelGetResponseEditableFalse SettingSecurityLevelGetResponseEditable = false -) - -type SettingSecurityLevelEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingSecurityLevelEditParamsValue] `json:"value,required"` -} - -func (r SettingSecurityLevelEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingSecurityLevelEditParamsValue string - -const ( - SettingSecurityLevelEditParamsValueOff SettingSecurityLevelEditParamsValue = "off" - SettingSecurityLevelEditParamsValueEssentiallyOff SettingSecurityLevelEditParamsValue = "essentially_off" - SettingSecurityLevelEditParamsValueLow SettingSecurityLevelEditParamsValue = "low" - SettingSecurityLevelEditParamsValueMedium SettingSecurityLevelEditParamsValue = "medium" - SettingSecurityLevelEditParamsValueHigh SettingSecurityLevelEditParamsValue = "high" - SettingSecurityLevelEditParamsValueUnderAttack SettingSecurityLevelEditParamsValue = "under_attack" -) - -type SettingSecurityLevelEditResponseEnvelope struct { - Errors []SettingSecurityLevelEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingSecurityLevelEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Choose the appropriate security profile for your website, which will - // automatically adjust each of the security settings. If you choose to customize - // an individual security setting, the profile will become Custom. - // (https://support.cloudflare.com/hc/en-us/articles/200170056). - Result SettingSecurityLevelEditResponse `json:"result"` - JSON settingSecurityLevelEditResponseEnvelopeJSON `json:"-"` -} - -// settingSecurityLevelEditResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingSecurityLevelEditResponseEnvelope] -type settingSecurityLevelEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSecurityLevelEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingSecurityLevelEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingSecurityLevelEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingSecurityLevelEditResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingSecurityLevelEditResponseEnvelopeErrors] -type settingSecurityLevelEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSecurityLevelEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingSecurityLevelEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingSecurityLevelEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingSecurityLevelEditResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingSecurityLevelEditResponseEnvelopeMessages] -type settingSecurityLevelEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSecurityLevelEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingSecurityLevelGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingSecurityLevelGetResponseEnvelope struct { - Errors []SettingSecurityLevelGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingSecurityLevelGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Choose the appropriate security profile for your website, which will - // automatically adjust each of the security settings. If you choose to customize - // an individual security setting, the profile will become Custom. - // (https://support.cloudflare.com/hc/en-us/articles/200170056). - Result SettingSecurityLevelGetResponse `json:"result"` - JSON settingSecurityLevelGetResponseEnvelopeJSON `json:"-"` -} - -// settingSecurityLevelGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingSecurityLevelGetResponseEnvelope] -type settingSecurityLevelGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSecurityLevelGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingSecurityLevelGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingSecurityLevelGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingSecurityLevelGetResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [SettingSecurityLevelGetResponseEnvelopeErrors] -type settingSecurityLevelGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSecurityLevelGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingSecurityLevelGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingSecurityLevelGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingSecurityLevelGetResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingSecurityLevelGetResponseEnvelopeMessages] -type settingSecurityLevelGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSecurityLevelGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingserversideexclude_test.go b/settingserversideexclude_test.go deleted file mode 100644 index b12a9f73706..00000000000 --- a/settingserversideexclude_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-sdk-go" - "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -func TestSettingServerSideExcludeEdit(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.ServerSideExcludes.Edit(context.TODO(), cloudflare.SettingServerSideExcludeEditParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingServerSideExcludeEditParamsValueOn), - }) - 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 TestSettingServerSideExcludeGet(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.ServerSideExcludes.Get(context.TODO(), cloudflare.SettingServerSideExcludeGetParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/settingsortquerystringforcache.go b/settingsortquerystringforcache.go deleted file mode 100644 index 05513480b00..00000000000 --- a/settingsortquerystringforcache.go +++ /dev/null @@ -1,331 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingSortQueryStringForCacheService contains methods and other services that -// help with interacting with the cloudflare API. Note, unlike clients, this -// service does not read variables from the environment automatically. You should -// not instantiate this service directly, and instead use the -// [NewSettingSortQueryStringForCacheService] method instead. -type SettingSortQueryStringForCacheService struct { - Options []option.RequestOption -} - -// NewSettingSortQueryStringForCacheService generates a new service that applies -// the given options to each request. These options are applied after the parent -// client's options (if there is one), and before any request-specific options. -func NewSettingSortQueryStringForCacheService(opts ...option.RequestOption) (r *SettingSortQueryStringForCacheService) { - r = &SettingSortQueryStringForCacheService{} - r.Options = opts - return -} - -// Cloudflare will treat files with the same query strings as the same file in -// cache, regardless of the order of the query strings. This is limited to -// Enterprise Zones. -func (r *SettingSortQueryStringForCacheService) Edit(ctx context.Context, params SettingSortQueryStringForCacheEditParams, opts ...option.RequestOption) (res *SettingSortQueryStringForCacheEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingSortQueryStringForCacheEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/sort_query_string_for_cache", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Cloudflare will treat files with the same query strings as the same file in -// cache, regardless of the order of the query strings. This is limited to -// Enterprise Zones. -func (r *SettingSortQueryStringForCacheService) Get(ctx context.Context, query SettingSortQueryStringForCacheGetParams, opts ...option.RequestOption) (res *SettingSortQueryStringForCacheGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingSortQueryStringForCacheGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/sort_query_string_for_cache", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Cloudflare will treat files with the same query strings as the same file in -// cache, regardless of the order of the query strings. This is limited to -// Enterprise Zones. -type SettingSortQueryStringForCacheEditResponse struct { - // ID of the zone setting. - ID SettingSortQueryStringForCacheEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingSortQueryStringForCacheEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingSortQueryStringForCacheEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingSortQueryStringForCacheEditResponseJSON `json:"-"` -} - -// settingSortQueryStringForCacheEditResponseJSON contains the JSON metadata for -// the struct [SettingSortQueryStringForCacheEditResponse] -type settingSortQueryStringForCacheEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSortQueryStringForCacheEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingSortQueryStringForCacheEditResponseID string - -const ( - SettingSortQueryStringForCacheEditResponseIDSortQueryStringForCache SettingSortQueryStringForCacheEditResponseID = "sort_query_string_for_cache" -) - -// Current value of the zone setting. -type SettingSortQueryStringForCacheEditResponseValue string - -const ( - SettingSortQueryStringForCacheEditResponseValueOn SettingSortQueryStringForCacheEditResponseValue = "on" - SettingSortQueryStringForCacheEditResponseValueOff SettingSortQueryStringForCacheEditResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingSortQueryStringForCacheEditResponseEditable bool - -const ( - SettingSortQueryStringForCacheEditResponseEditableTrue SettingSortQueryStringForCacheEditResponseEditable = true - SettingSortQueryStringForCacheEditResponseEditableFalse SettingSortQueryStringForCacheEditResponseEditable = false -) - -// Cloudflare will treat files with the same query strings as the same file in -// cache, regardless of the order of the query strings. This is limited to -// Enterprise Zones. -type SettingSortQueryStringForCacheGetResponse struct { - // ID of the zone setting. - ID SettingSortQueryStringForCacheGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingSortQueryStringForCacheGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingSortQueryStringForCacheGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingSortQueryStringForCacheGetResponseJSON `json:"-"` -} - -// settingSortQueryStringForCacheGetResponseJSON contains the JSON metadata for the -// struct [SettingSortQueryStringForCacheGetResponse] -type settingSortQueryStringForCacheGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSortQueryStringForCacheGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingSortQueryStringForCacheGetResponseID string - -const ( - SettingSortQueryStringForCacheGetResponseIDSortQueryStringForCache SettingSortQueryStringForCacheGetResponseID = "sort_query_string_for_cache" -) - -// Current value of the zone setting. -type SettingSortQueryStringForCacheGetResponseValue string - -const ( - SettingSortQueryStringForCacheGetResponseValueOn SettingSortQueryStringForCacheGetResponseValue = "on" - SettingSortQueryStringForCacheGetResponseValueOff SettingSortQueryStringForCacheGetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingSortQueryStringForCacheGetResponseEditable bool - -const ( - SettingSortQueryStringForCacheGetResponseEditableTrue SettingSortQueryStringForCacheGetResponseEditable = true - SettingSortQueryStringForCacheGetResponseEditableFalse SettingSortQueryStringForCacheGetResponseEditable = false -) - -type SettingSortQueryStringForCacheEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingSortQueryStringForCacheEditParamsValue] `json:"value,required"` -} - -func (r SettingSortQueryStringForCacheEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingSortQueryStringForCacheEditParamsValue string - -const ( - SettingSortQueryStringForCacheEditParamsValueOn SettingSortQueryStringForCacheEditParamsValue = "on" - SettingSortQueryStringForCacheEditParamsValueOff SettingSortQueryStringForCacheEditParamsValue = "off" -) - -type SettingSortQueryStringForCacheEditResponseEnvelope struct { - Errors []SettingSortQueryStringForCacheEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingSortQueryStringForCacheEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Cloudflare will treat files with the same query strings as the same file in - // cache, regardless of the order of the query strings. This is limited to - // Enterprise Zones. - Result SettingSortQueryStringForCacheEditResponse `json:"result"` - JSON settingSortQueryStringForCacheEditResponseEnvelopeJSON `json:"-"` -} - -// settingSortQueryStringForCacheEditResponseEnvelopeJSON contains the JSON -// metadata for the struct [SettingSortQueryStringForCacheEditResponseEnvelope] -type settingSortQueryStringForCacheEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSortQueryStringForCacheEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingSortQueryStringForCacheEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingSortQueryStringForCacheEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingSortQueryStringForCacheEditResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct -// [SettingSortQueryStringForCacheEditResponseEnvelopeErrors] -type settingSortQueryStringForCacheEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSortQueryStringForCacheEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingSortQueryStringForCacheEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingSortQueryStringForCacheEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingSortQueryStringForCacheEditResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct -// [SettingSortQueryStringForCacheEditResponseEnvelopeMessages] -type settingSortQueryStringForCacheEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSortQueryStringForCacheEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingSortQueryStringForCacheGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingSortQueryStringForCacheGetResponseEnvelope struct { - Errors []SettingSortQueryStringForCacheGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingSortQueryStringForCacheGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Cloudflare will treat files with the same query strings as the same file in - // cache, regardless of the order of the query strings. This is limited to - // Enterprise Zones. - Result SettingSortQueryStringForCacheGetResponse `json:"result"` - JSON settingSortQueryStringForCacheGetResponseEnvelopeJSON `json:"-"` -} - -// settingSortQueryStringForCacheGetResponseEnvelopeJSON contains the JSON metadata -// for the struct [SettingSortQueryStringForCacheGetResponseEnvelope] -type settingSortQueryStringForCacheGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSortQueryStringForCacheGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingSortQueryStringForCacheGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingSortQueryStringForCacheGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingSortQueryStringForCacheGetResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct -// [SettingSortQueryStringForCacheGetResponseEnvelopeErrors] -type settingSortQueryStringForCacheGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSortQueryStringForCacheGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingSortQueryStringForCacheGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingSortQueryStringForCacheGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingSortQueryStringForCacheGetResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct -// [SettingSortQueryStringForCacheGetResponseEnvelopeMessages] -type settingSortQueryStringForCacheGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSortQueryStringForCacheGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingsortquerystringforcache_test.go b/settingsortquerystringforcache_test.go deleted file mode 100644 index e4f0b8a773f..00000000000 --- a/settingsortquerystringforcache_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-sdk-go" - "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -func TestSettingSortQueryStringForCacheEdit(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.SortQueryStringForCache.Edit(context.TODO(), cloudflare.SettingSortQueryStringForCacheEditParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingSortQueryStringForCacheEditParamsValueOn), - }) - 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 TestSettingSortQueryStringForCacheGet(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.SortQueryStringForCache.Get(context.TODO(), cloudflare.SettingSortQueryStringForCacheGetParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/settingsslrecommender.go b/settingsslrecommender.go deleted file mode 100644 index b83d8ad4ddc..00000000000 --- a/settingsslrecommender.go +++ /dev/null @@ -1,293 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingSSLRecommenderService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingSSLRecommenderService] -// method instead. -type SettingSSLRecommenderService struct { - Options []option.RequestOption -} - -// NewSettingSSLRecommenderService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingSSLRecommenderService(opts ...option.RequestOption) (r *SettingSSLRecommenderService) { - r = &SettingSSLRecommenderService{} - r.Options = opts - return -} - -// Enrollment in the SSL/TLS Recommender service which tries to detect and -// recommend (by sending periodic emails) the most secure SSL/TLS setting your -// origin servers support. -func (r *SettingSSLRecommenderService) Edit(ctx context.Context, params SettingSSLRecommenderEditParams, opts ...option.RequestOption) (res *SettingSSLRecommenderEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingSSLRecommenderEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/ssl_recommender", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Enrollment in the SSL/TLS Recommender service which tries to detect and -// recommend (by sending periodic emails) the most secure SSL/TLS setting your -// origin servers support. -func (r *SettingSSLRecommenderService) Get(ctx context.Context, query SettingSSLRecommenderGetParams, opts ...option.RequestOption) (res *SettingSSLRecommenderGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingSSLRecommenderGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/ssl_recommender", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Enrollment in the SSL/TLS Recommender service which tries to detect and -// recommend (by sending periodic emails) the most secure SSL/TLS setting your -// origin servers support. -type SettingSSLRecommenderEditResponse struct { - // Enrollment value for SSL/TLS Recommender. - ID SettingSSLRecommenderEditResponseID `json:"id"` - // ssl-recommender enrollment setting. - Enabled bool `json:"enabled"` - JSON settingSSLRecommenderEditResponseJSON `json:"-"` -} - -// settingSSLRecommenderEditResponseJSON contains the JSON metadata for the struct -// [SettingSSLRecommenderEditResponse] -type settingSSLRecommenderEditResponseJSON struct { - ID apijson.Field - Enabled apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSSLRecommenderEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Enrollment value for SSL/TLS Recommender. -type SettingSSLRecommenderEditResponseID string - -const ( - SettingSSLRecommenderEditResponseIDSSLRecommender SettingSSLRecommenderEditResponseID = "ssl_recommender" -) - -// Enrollment in the SSL/TLS Recommender service which tries to detect and -// recommend (by sending periodic emails) the most secure SSL/TLS setting your -// origin servers support. -type SettingSSLRecommenderGetResponse struct { - // Enrollment value for SSL/TLS Recommender. - ID SettingSSLRecommenderGetResponseID `json:"id"` - // ssl-recommender enrollment setting. - Enabled bool `json:"enabled"` - JSON settingSSLRecommenderGetResponseJSON `json:"-"` -} - -// settingSSLRecommenderGetResponseJSON contains the JSON metadata for the struct -// [SettingSSLRecommenderGetResponse] -type settingSSLRecommenderGetResponseJSON struct { - ID apijson.Field - Enabled apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSSLRecommenderGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Enrollment value for SSL/TLS Recommender. -type SettingSSLRecommenderGetResponseID string - -const ( - SettingSSLRecommenderGetResponseIDSSLRecommender SettingSSLRecommenderGetResponseID = "ssl_recommender" -) - -type SettingSSLRecommenderEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Enrollment in the SSL/TLS Recommender service which tries to detect and - // recommend (by sending periodic emails) the most secure SSL/TLS setting your - // origin servers support. - Value param.Field[SettingSSLRecommenderEditParamsValue] `json:"value,required"` -} - -func (r SettingSSLRecommenderEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Enrollment in the SSL/TLS Recommender service which tries to detect and -// recommend (by sending periodic emails) the most secure SSL/TLS setting your -// origin servers support. -type SettingSSLRecommenderEditParamsValue struct { - // Enrollment value for SSL/TLS Recommender. - ID param.Field[SettingSSLRecommenderEditParamsValueID] `json:"id"` - // ssl-recommender enrollment setting. - Enabled param.Field[bool] `json:"enabled"` -} - -func (r SettingSSLRecommenderEditParamsValue) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Enrollment value for SSL/TLS Recommender. -type SettingSSLRecommenderEditParamsValueID string - -const ( - SettingSSLRecommenderEditParamsValueIDSSLRecommender SettingSSLRecommenderEditParamsValueID = "ssl_recommender" -) - -type SettingSSLRecommenderEditResponseEnvelope struct { - Errors []SettingSSLRecommenderEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingSSLRecommenderEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Enrollment in the SSL/TLS Recommender service which tries to detect and - // recommend (by sending periodic emails) the most secure SSL/TLS setting your - // origin servers support. - Result SettingSSLRecommenderEditResponse `json:"result"` - JSON settingSSLRecommenderEditResponseEnvelopeJSON `json:"-"` -} - -// settingSSLRecommenderEditResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingSSLRecommenderEditResponseEnvelope] -type settingSSLRecommenderEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSSLRecommenderEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingSSLRecommenderEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingSSLRecommenderEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingSSLRecommenderEditResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingSSLRecommenderEditResponseEnvelopeErrors] -type settingSSLRecommenderEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSSLRecommenderEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingSSLRecommenderEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingSSLRecommenderEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingSSLRecommenderEditResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingSSLRecommenderEditResponseEnvelopeMessages] -type settingSSLRecommenderEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSSLRecommenderEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingSSLRecommenderGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingSSLRecommenderGetResponseEnvelope struct { - Errors []SettingSSLRecommenderGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingSSLRecommenderGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Enrollment in the SSL/TLS Recommender service which tries to detect and - // recommend (by sending periodic emails) the most secure SSL/TLS setting your - // origin servers support. - Result SettingSSLRecommenderGetResponse `json:"result"` - JSON settingSSLRecommenderGetResponseEnvelopeJSON `json:"-"` -} - -// settingSSLRecommenderGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingSSLRecommenderGetResponseEnvelope] -type settingSSLRecommenderGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSSLRecommenderGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingSSLRecommenderGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingSSLRecommenderGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingSSLRecommenderGetResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingSSLRecommenderGetResponseEnvelopeErrors] -type settingSSLRecommenderGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSSLRecommenderGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingSSLRecommenderGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingSSLRecommenderGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingSSLRecommenderGetResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingSSLRecommenderGetResponseEnvelopeMessages] -type settingSSLRecommenderGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingSSLRecommenderGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingtls13.go b/settingtls13.go deleted file mode 100644 index 915d683739a..00000000000 --- a/settingtls13.go +++ /dev/null @@ -1,320 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingTLS1_3Service contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingTLS1_3Service] method -// instead. -type SettingTLS1_3Service struct { - Options []option.RequestOption -} - -// NewSettingTLS1_3Service generates a new service that applies the given options -// to each request. These options are applied after the parent client's options (if -// there is one), and before any request-specific options. -func NewSettingTLS1_3Service(opts ...option.RequestOption) (r *SettingTLS1_3Service) { - r = &SettingTLS1_3Service{} - r.Options = opts - return -} - -// Changes TLS 1.3 setting. -func (r *SettingTLS1_3Service) Edit(ctx context.Context, params SettingTLS1_3EditParams, opts ...option.RequestOption) (res *SettingTls1_3EditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingTls1_3EditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/tls_1_3", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Gets TLS 1.3 setting enabled for a zone. -func (r *SettingTLS1_3Service) Get(ctx context.Context, query SettingTLS1_3GetParams, opts ...option.RequestOption) (res *SettingTls1_3GetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingTls1_3GetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/tls_1_3", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Enables Crypto TLS 1.3 feature for a zone. -type SettingTls1_3EditResponse struct { - // ID of the zone setting. - ID SettingTls1_3EditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingTls1_3EditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingTls1_3EditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingTls1_3EditResponseJSON `json:"-"` -} - -// settingTls1_3EditResponseJSON contains the JSON metadata for the struct -// [SettingTls1_3EditResponse] -type settingTls1_3EditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTls1_3EditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingTls1_3EditResponseID string - -const ( - SettingTls1_3EditResponseIDTLS1_3 SettingTls1_3EditResponseID = "tls_1_3" -) - -// Current value of the zone setting. -type SettingTls1_3EditResponseValue string - -const ( - SettingTls1_3EditResponseValueOn SettingTls1_3EditResponseValue = "on" - SettingTls1_3EditResponseValueOff SettingTls1_3EditResponseValue = "off" - SettingTls1_3EditResponseValueZrt SettingTls1_3EditResponseValue = "zrt" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingTls1_3EditResponseEditable bool - -const ( - SettingTls1_3EditResponseEditableTrue SettingTls1_3EditResponseEditable = true - SettingTls1_3EditResponseEditableFalse SettingTls1_3EditResponseEditable = false -) - -// Enables Crypto TLS 1.3 feature for a zone. -type SettingTls1_3GetResponse struct { - // ID of the zone setting. - ID SettingTls1_3GetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingTls1_3GetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingTls1_3GetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingTls1_3GetResponseJSON `json:"-"` -} - -// settingTls1_3GetResponseJSON contains the JSON metadata for the struct -// [SettingTls1_3GetResponse] -type settingTls1_3GetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTls1_3GetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingTls1_3GetResponseID string - -const ( - SettingTls1_3GetResponseIDTLS1_3 SettingTls1_3GetResponseID = "tls_1_3" -) - -// Current value of the zone setting. -type SettingTls1_3GetResponseValue string - -const ( - SettingTls1_3GetResponseValueOn SettingTls1_3GetResponseValue = "on" - SettingTls1_3GetResponseValueOff SettingTls1_3GetResponseValue = "off" - SettingTls1_3GetResponseValueZrt SettingTls1_3GetResponseValue = "zrt" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingTls1_3GetResponseEditable bool - -const ( - SettingTls1_3GetResponseEditableTrue SettingTls1_3GetResponseEditable = true - SettingTls1_3GetResponseEditableFalse SettingTls1_3GetResponseEditable = false -) - -type SettingTLS1_3EditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. Notes: Default value depends on the zone's plan - // level. - Value param.Field[SettingTls1_3EditParamsValue] `json:"value,required"` -} - -func (r SettingTLS1_3EditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. Notes: Default value depends on the zone's plan -// level. -type SettingTls1_3EditParamsValue string - -const ( - SettingTls1_3EditParamsValueOn SettingTls1_3EditParamsValue = "on" - SettingTls1_3EditParamsValueOff SettingTls1_3EditParamsValue = "off" - SettingTls1_3EditParamsValueZrt SettingTls1_3EditParamsValue = "zrt" -) - -type SettingTls1_3EditResponseEnvelope struct { - Errors []SettingTls1_3EditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingTls1_3EditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Enables Crypto TLS 1.3 feature for a zone. - Result SettingTls1_3EditResponse `json:"result"` - JSON settingTls1_3EditResponseEnvelopeJSON `json:"-"` -} - -// settingTls1_3EditResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingTls1_3EditResponseEnvelope] -type settingTls1_3EditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTls1_3EditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingTls1_3EditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingTls1_3EditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingTls1_3EditResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingTls1_3EditResponseEnvelopeErrors] -type settingTls1_3EditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTls1_3EditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingTls1_3EditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingTls1_3EditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingTls1_3EditResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingTls1_3EditResponseEnvelopeMessages] -type settingTls1_3EditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTls1_3EditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingTLS1_3GetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingTls1_3GetResponseEnvelope struct { - Errors []SettingTls1_3GetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingTls1_3GetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Enables Crypto TLS 1.3 feature for a zone. - Result SettingTls1_3GetResponse `json:"result"` - JSON settingTls1_3GetResponseEnvelopeJSON `json:"-"` -} - -// settingTls1_3GetResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingTls1_3GetResponseEnvelope] -type settingTls1_3GetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTls1_3GetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingTls1_3GetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingTls1_3GetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingTls1_3GetResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingTls1_3GetResponseEnvelopeErrors] -type settingTls1_3GetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTls1_3GetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingTls1_3GetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingTls1_3GetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingTls1_3GetResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingTls1_3GetResponseEnvelopeMessages] -type settingTls1_3GetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTls1_3GetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingtls13_test.go b/settingtls13_test.go deleted file mode 100644 index ef06467cff1..00000000000 --- a/settingtls13_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-sdk-go" - "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -func TestSettingTLS1_3Edit(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.TLS1_3.Edit(context.TODO(), cloudflare.SettingTLS1_3EditParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingTls1_3EditParamsValueOn), - }) - 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 TestSettingTLS1_3Get(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.TLS1_3.Get(context.TODO(), cloudflare.SettingTLS1_3GetParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/settingtlsclientauth.go b/settingtlsclientauth.go deleted file mode 100644 index 16aec82c538..00000000000 --- a/settingtlsclientauth.go +++ /dev/null @@ -1,321 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingTLSClientAuthService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingTLSClientAuthService] -// method instead. -type SettingTLSClientAuthService struct { - Options []option.RequestOption -} - -// NewSettingTLSClientAuthService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingTLSClientAuthService(opts ...option.RequestOption) (r *SettingTLSClientAuthService) { - r = &SettingTLSClientAuthService{} - r.Options = opts - return -} - -// TLS Client Auth requires Cloudflare to connect to your origin server using a -// client certificate (Enterprise Only). -func (r *SettingTLSClientAuthService) Edit(ctx context.Context, params SettingTLSClientAuthEditParams, opts ...option.RequestOption) (res *SettingTLSClientAuthEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingTLSClientAuthEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/tls_client_auth", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// TLS Client Auth requires Cloudflare to connect to your origin server using a -// client certificate (Enterprise Only). -func (r *SettingTLSClientAuthService) Get(ctx context.Context, query SettingTLSClientAuthGetParams, opts ...option.RequestOption) (res *SettingTLSClientAuthGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingTLSClientAuthGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/tls_client_auth", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// TLS Client Auth requires Cloudflare to connect to your origin server using a -// client certificate (Enterprise Only). -type SettingTLSClientAuthEditResponse struct { - // ID of the zone setting. - ID SettingTLSClientAuthEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingTLSClientAuthEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingTLSClientAuthEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingTLSClientAuthEditResponseJSON `json:"-"` -} - -// settingTLSClientAuthEditResponseJSON contains the JSON metadata for the struct -// [SettingTLSClientAuthEditResponse] -type settingTLSClientAuthEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTLSClientAuthEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingTLSClientAuthEditResponseID string - -const ( - SettingTLSClientAuthEditResponseIDTLSClientAuth SettingTLSClientAuthEditResponseID = "tls_client_auth" -) - -// Current value of the zone setting. -type SettingTLSClientAuthEditResponseValue string - -const ( - SettingTLSClientAuthEditResponseValueOn SettingTLSClientAuthEditResponseValue = "on" - SettingTLSClientAuthEditResponseValueOff SettingTLSClientAuthEditResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingTLSClientAuthEditResponseEditable bool - -const ( - SettingTLSClientAuthEditResponseEditableTrue SettingTLSClientAuthEditResponseEditable = true - SettingTLSClientAuthEditResponseEditableFalse SettingTLSClientAuthEditResponseEditable = false -) - -// TLS Client Auth requires Cloudflare to connect to your origin server using a -// client certificate (Enterprise Only). -type SettingTLSClientAuthGetResponse struct { - // ID of the zone setting. - ID SettingTLSClientAuthGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingTLSClientAuthGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingTLSClientAuthGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingTLSClientAuthGetResponseJSON `json:"-"` -} - -// settingTLSClientAuthGetResponseJSON contains the JSON metadata for the struct -// [SettingTLSClientAuthGetResponse] -type settingTLSClientAuthGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTLSClientAuthGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingTLSClientAuthGetResponseID string - -const ( - SettingTLSClientAuthGetResponseIDTLSClientAuth SettingTLSClientAuthGetResponseID = "tls_client_auth" -) - -// Current value of the zone setting. -type SettingTLSClientAuthGetResponseValue string - -const ( - SettingTLSClientAuthGetResponseValueOn SettingTLSClientAuthGetResponseValue = "on" - SettingTLSClientAuthGetResponseValueOff SettingTLSClientAuthGetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingTLSClientAuthGetResponseEditable bool - -const ( - SettingTLSClientAuthGetResponseEditableTrue SettingTLSClientAuthGetResponseEditable = true - SettingTLSClientAuthGetResponseEditableFalse SettingTLSClientAuthGetResponseEditable = false -) - -type SettingTLSClientAuthEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // value of the zone setting. - Value param.Field[SettingTLSClientAuthEditParamsValue] `json:"value,required"` -} - -func (r SettingTLSClientAuthEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// value of the zone setting. -type SettingTLSClientAuthEditParamsValue string - -const ( - SettingTLSClientAuthEditParamsValueOn SettingTLSClientAuthEditParamsValue = "on" - SettingTLSClientAuthEditParamsValueOff SettingTLSClientAuthEditParamsValue = "off" -) - -type SettingTLSClientAuthEditResponseEnvelope struct { - Errors []SettingTLSClientAuthEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingTLSClientAuthEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // TLS Client Auth requires Cloudflare to connect to your origin server using a - // client certificate (Enterprise Only). - Result SettingTLSClientAuthEditResponse `json:"result"` - JSON settingTLSClientAuthEditResponseEnvelopeJSON `json:"-"` -} - -// settingTLSClientAuthEditResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingTLSClientAuthEditResponseEnvelope] -type settingTLSClientAuthEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTLSClientAuthEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingTLSClientAuthEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingTLSClientAuthEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingTLSClientAuthEditResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingTLSClientAuthEditResponseEnvelopeErrors] -type settingTLSClientAuthEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTLSClientAuthEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingTLSClientAuthEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingTLSClientAuthEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingTLSClientAuthEditResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingTLSClientAuthEditResponseEnvelopeMessages] -type settingTLSClientAuthEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTLSClientAuthEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingTLSClientAuthGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingTLSClientAuthGetResponseEnvelope struct { - Errors []SettingTLSClientAuthGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingTLSClientAuthGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // TLS Client Auth requires Cloudflare to connect to your origin server using a - // client certificate (Enterprise Only). - Result SettingTLSClientAuthGetResponse `json:"result"` - JSON settingTLSClientAuthGetResponseEnvelopeJSON `json:"-"` -} - -// settingTLSClientAuthGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingTLSClientAuthGetResponseEnvelope] -type settingTLSClientAuthGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTLSClientAuthGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingTLSClientAuthGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingTLSClientAuthGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingTLSClientAuthGetResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [SettingTLSClientAuthGetResponseEnvelopeErrors] -type settingTLSClientAuthGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTLSClientAuthGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingTLSClientAuthGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingTLSClientAuthGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingTLSClientAuthGetResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingTLSClientAuthGetResponseEnvelopeMessages] -type settingTLSClientAuthGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTLSClientAuthGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingtlsclientauth_test.go b/settingtlsclientauth_test.go deleted file mode 100644 index f127546764d..00000000000 --- a/settingtlsclientauth_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-sdk-go" - "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -func TestSettingTLSClientAuthEdit(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.TLSClientAuth.Edit(context.TODO(), cloudflare.SettingTLSClientAuthEditParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingTLSClientAuthEditParamsValueOn), - }) - 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 TestSettingTLSClientAuthGet(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.TLSClientAuth.Get(context.TODO(), cloudflare.SettingTLSClientAuthGetParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/settingtrueclientipheader.go b/settingtrueclientipheader.go deleted file mode 100644 index bbb41628e96..00000000000 --- a/settingtrueclientipheader.go +++ /dev/null @@ -1,321 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingTrueClientIPHeaderService contains methods and other services that help -// with interacting with the cloudflare API. Note, unlike clients, this service -// does not read variables from the environment automatically. You should not -// instantiate this service directly, and instead use the -// [NewSettingTrueClientIPHeaderService] method instead. -type SettingTrueClientIPHeaderService struct { - Options []option.RequestOption -} - -// NewSettingTrueClientIPHeaderService generates a new service that applies the -// given options to each request. These options are applied after the parent -// client's options (if there is one), and before any request-specific options. -func NewSettingTrueClientIPHeaderService(opts ...option.RequestOption) (r *SettingTrueClientIPHeaderService) { - r = &SettingTrueClientIPHeaderService{} - r.Options = opts - return -} - -// Allows customer to continue to use True Client IP (Akamai feature) in the -// headers we send to the origin. This is limited to Enterprise Zones. -func (r *SettingTrueClientIPHeaderService) Edit(ctx context.Context, params SettingTrueClientIPHeaderEditParams, opts ...option.RequestOption) (res *SettingTrueClientIPHeaderEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingTrueClientIPHeaderEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/true_client_ip_header", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Allows customer to continue to use True Client IP (Akamai feature) in the -// headers we send to the origin. This is limited to Enterprise Zones. -func (r *SettingTrueClientIPHeaderService) Get(ctx context.Context, query SettingTrueClientIPHeaderGetParams, opts ...option.RequestOption) (res *SettingTrueClientIPHeaderGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingTrueClientIPHeaderGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/true_client_ip_header", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Allows customer to continue to use True Client IP (Akamai feature) in the -// headers we send to the origin. This is limited to Enterprise Zones. -type SettingTrueClientIPHeaderEditResponse struct { - // ID of the zone setting. - ID SettingTrueClientIPHeaderEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingTrueClientIPHeaderEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingTrueClientIPHeaderEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingTrueClientIPHeaderEditResponseJSON `json:"-"` -} - -// settingTrueClientIPHeaderEditResponseJSON contains the JSON metadata for the -// struct [SettingTrueClientIPHeaderEditResponse] -type settingTrueClientIPHeaderEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTrueClientIPHeaderEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingTrueClientIPHeaderEditResponseID string - -const ( - SettingTrueClientIPHeaderEditResponseIDTrueClientIPHeader SettingTrueClientIPHeaderEditResponseID = "true_client_ip_header" -) - -// Current value of the zone setting. -type SettingTrueClientIPHeaderEditResponseValue string - -const ( - SettingTrueClientIPHeaderEditResponseValueOn SettingTrueClientIPHeaderEditResponseValue = "on" - SettingTrueClientIPHeaderEditResponseValueOff SettingTrueClientIPHeaderEditResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingTrueClientIPHeaderEditResponseEditable bool - -const ( - SettingTrueClientIPHeaderEditResponseEditableTrue SettingTrueClientIPHeaderEditResponseEditable = true - SettingTrueClientIPHeaderEditResponseEditableFalse SettingTrueClientIPHeaderEditResponseEditable = false -) - -// Allows customer to continue to use True Client IP (Akamai feature) in the -// headers we send to the origin. This is limited to Enterprise Zones. -type SettingTrueClientIPHeaderGetResponse struct { - // ID of the zone setting. - ID SettingTrueClientIPHeaderGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingTrueClientIPHeaderGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingTrueClientIPHeaderGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingTrueClientIPHeaderGetResponseJSON `json:"-"` -} - -// settingTrueClientIPHeaderGetResponseJSON contains the JSON metadata for the -// struct [SettingTrueClientIPHeaderGetResponse] -type settingTrueClientIPHeaderGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTrueClientIPHeaderGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingTrueClientIPHeaderGetResponseID string - -const ( - SettingTrueClientIPHeaderGetResponseIDTrueClientIPHeader SettingTrueClientIPHeaderGetResponseID = "true_client_ip_header" -) - -// Current value of the zone setting. -type SettingTrueClientIPHeaderGetResponseValue string - -const ( - SettingTrueClientIPHeaderGetResponseValueOn SettingTrueClientIPHeaderGetResponseValue = "on" - SettingTrueClientIPHeaderGetResponseValueOff SettingTrueClientIPHeaderGetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingTrueClientIPHeaderGetResponseEditable bool - -const ( - SettingTrueClientIPHeaderGetResponseEditableTrue SettingTrueClientIPHeaderGetResponseEditable = true - SettingTrueClientIPHeaderGetResponseEditableFalse SettingTrueClientIPHeaderGetResponseEditable = false -) - -type SettingTrueClientIPHeaderEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingTrueClientIPHeaderEditParamsValue] `json:"value,required"` -} - -func (r SettingTrueClientIPHeaderEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingTrueClientIPHeaderEditParamsValue string - -const ( - SettingTrueClientIPHeaderEditParamsValueOn SettingTrueClientIPHeaderEditParamsValue = "on" - SettingTrueClientIPHeaderEditParamsValueOff SettingTrueClientIPHeaderEditParamsValue = "off" -) - -type SettingTrueClientIPHeaderEditResponseEnvelope struct { - Errors []SettingTrueClientIPHeaderEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingTrueClientIPHeaderEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Allows customer to continue to use True Client IP (Akamai feature) in the - // headers we send to the origin. This is limited to Enterprise Zones. - Result SettingTrueClientIPHeaderEditResponse `json:"result"` - JSON settingTrueClientIPHeaderEditResponseEnvelopeJSON `json:"-"` -} - -// settingTrueClientIPHeaderEditResponseEnvelopeJSON contains the JSON metadata for -// the struct [SettingTrueClientIPHeaderEditResponseEnvelope] -type settingTrueClientIPHeaderEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTrueClientIPHeaderEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingTrueClientIPHeaderEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingTrueClientIPHeaderEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingTrueClientIPHeaderEditResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [SettingTrueClientIPHeaderEditResponseEnvelopeErrors] -type settingTrueClientIPHeaderEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTrueClientIPHeaderEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingTrueClientIPHeaderEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingTrueClientIPHeaderEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingTrueClientIPHeaderEditResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [SettingTrueClientIPHeaderEditResponseEnvelopeMessages] -type settingTrueClientIPHeaderEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTrueClientIPHeaderEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingTrueClientIPHeaderGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingTrueClientIPHeaderGetResponseEnvelope struct { - Errors []SettingTrueClientIPHeaderGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingTrueClientIPHeaderGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // Allows customer to continue to use True Client IP (Akamai feature) in the - // headers we send to the origin. This is limited to Enterprise Zones. - Result SettingTrueClientIPHeaderGetResponse `json:"result"` - JSON settingTrueClientIPHeaderGetResponseEnvelopeJSON `json:"-"` -} - -// settingTrueClientIPHeaderGetResponseEnvelopeJSON contains the JSON metadata for -// the struct [SettingTrueClientIPHeaderGetResponseEnvelope] -type settingTrueClientIPHeaderGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTrueClientIPHeaderGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingTrueClientIPHeaderGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingTrueClientIPHeaderGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingTrueClientIPHeaderGetResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [SettingTrueClientIPHeaderGetResponseEnvelopeErrors] -type settingTrueClientIPHeaderGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTrueClientIPHeaderGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingTrueClientIPHeaderGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingTrueClientIPHeaderGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingTrueClientIPHeaderGetResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [SettingTrueClientIPHeaderGetResponseEnvelopeMessages] -type settingTrueClientIPHeaderGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingTrueClientIPHeaderGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingtrueclientipheader_test.go b/settingtrueclientipheader_test.go deleted file mode 100644 index a76f36fbabe..00000000000 --- a/settingtrueclientipheader_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-sdk-go" - "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -func TestSettingTrueClientIPHeaderEdit(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.TrueClientIPHeader.Edit(context.TODO(), cloudflare.SettingTrueClientIPHeaderEditParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingTrueClientIPHeaderEditParamsValueOn), - }) - 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 TestSettingTrueClientIPHeaderGet(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.TrueClientIPHeader.Get(context.TODO(), cloudflare.SettingTrueClientIPHeaderGetParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/settingwaf_test.go b/settingwaf_test.go deleted file mode 100644 index 3efa168df3c..00000000000 --- a/settingwaf_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-sdk-go" - "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -func TestSettingWAFEdit(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.WAF.Edit(context.TODO(), cloudflare.SettingWAFEditParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingWAFEditParamsValueOn), - }) - 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 TestSettingWAFGet(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.WAF.Get(context.TODO(), cloudflare.SettingWAFGetParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/settingwebp.go b/settingwebp.go deleted file mode 100644 index 1121863e620..00000000000 --- a/settingwebp.go +++ /dev/null @@ -1,327 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingWebpService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingWebpService] method -// instead. -type SettingWebpService struct { - Options []option.RequestOption -} - -// NewSettingWebpService generates a new service that applies the given options to -// each request. These options are applied after the parent client's options (if -// there is one), and before any request-specific options. -func NewSettingWebpService(opts ...option.RequestOption) (r *SettingWebpService) { - r = &SettingWebpService{} - r.Options = opts - return -} - -// When the client requesting the image supports the WebP image codec, and WebP -// offers a performance advantage over the original image format, Cloudflare will -// serve a WebP version of the original image. -func (r *SettingWebpService) Edit(ctx context.Context, params SettingWebpEditParams, opts ...option.RequestOption) (res *SettingWebpEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingWebpEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/webp", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// When the client requesting the image supports the WebP image codec, and WebP -// offers a performance advantage over the original image format, Cloudflare will -// serve a WebP version of the original image. -func (r *SettingWebpService) Get(ctx context.Context, query SettingWebpGetParams, opts ...option.RequestOption) (res *SettingWebpGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingWebpGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/webp", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// When the client requesting the image supports the WebP image codec, and WebP -// offers a performance advantage over the original image format, Cloudflare will -// serve a WebP version of the original image. -type SettingWebpEditResponse struct { - // ID of the zone setting. - ID SettingWebpEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingWebpEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingWebpEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingWebpEditResponseJSON `json:"-"` -} - -// settingWebpEditResponseJSON contains the JSON metadata for the struct -// [SettingWebpEditResponse] -type settingWebpEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingWebpEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingWebpEditResponseID string - -const ( - SettingWebpEditResponseIDWebp SettingWebpEditResponseID = "webp" -) - -// Current value of the zone setting. -type SettingWebpEditResponseValue string - -const ( - SettingWebpEditResponseValueOff SettingWebpEditResponseValue = "off" - SettingWebpEditResponseValueOn SettingWebpEditResponseValue = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingWebpEditResponseEditable bool - -const ( - SettingWebpEditResponseEditableTrue SettingWebpEditResponseEditable = true - SettingWebpEditResponseEditableFalse SettingWebpEditResponseEditable = false -) - -// When the client requesting the image supports the WebP image codec, and WebP -// offers a performance advantage over the original image format, Cloudflare will -// serve a WebP version of the original image. -type SettingWebpGetResponse struct { - // ID of the zone setting. - ID SettingWebpGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingWebpGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingWebpGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingWebpGetResponseJSON `json:"-"` -} - -// settingWebpGetResponseJSON contains the JSON metadata for the struct -// [SettingWebpGetResponse] -type settingWebpGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingWebpGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingWebpGetResponseID string - -const ( - SettingWebpGetResponseIDWebp SettingWebpGetResponseID = "webp" -) - -// Current value of the zone setting. -type SettingWebpGetResponseValue string - -const ( - SettingWebpGetResponseValueOff SettingWebpGetResponseValue = "off" - SettingWebpGetResponseValueOn SettingWebpGetResponseValue = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingWebpGetResponseEditable bool - -const ( - SettingWebpGetResponseEditableTrue SettingWebpGetResponseEditable = true - SettingWebpGetResponseEditableFalse SettingWebpGetResponseEditable = false -) - -type SettingWebpEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingWebpEditParamsValue] `json:"value,required"` -} - -func (r SettingWebpEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingWebpEditParamsValue string - -const ( - SettingWebpEditParamsValueOff SettingWebpEditParamsValue = "off" - SettingWebpEditParamsValueOn SettingWebpEditParamsValue = "on" -) - -type SettingWebpEditResponseEnvelope struct { - Errors []SettingWebpEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingWebpEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // When the client requesting the image supports the WebP image codec, and WebP - // offers a performance advantage over the original image format, Cloudflare will - // serve a WebP version of the original image. - Result SettingWebpEditResponse `json:"result"` - JSON settingWebpEditResponseEnvelopeJSON `json:"-"` -} - -// settingWebpEditResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingWebpEditResponseEnvelope] -type settingWebpEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingWebpEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingWebpEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingWebpEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingWebpEditResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingWebpEditResponseEnvelopeErrors] -type settingWebpEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingWebpEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingWebpEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingWebpEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingWebpEditResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingWebpEditResponseEnvelopeMessages] -type settingWebpEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingWebpEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingWebpGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingWebpGetResponseEnvelope struct { - Errors []SettingWebpGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingWebpGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // When the client requesting the image supports the WebP image codec, and WebP - // offers a performance advantage over the original image format, Cloudflare will - // serve a WebP version of the original image. - Result SettingWebpGetResponse `json:"result"` - JSON settingWebpGetResponseEnvelopeJSON `json:"-"` -} - -// settingWebpGetResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingWebpGetResponseEnvelope] -type settingWebpGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingWebpGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingWebpGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingWebpGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingWebpGetResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingWebpGetResponseEnvelopeErrors] -type settingWebpGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingWebpGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingWebpGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingWebpGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingWebpGetResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingWebpGetResponseEnvelopeMessages] -type settingWebpGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingWebpGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingwebp_test.go b/settingwebp_test.go deleted file mode 100644 index 21fbd22d66a..00000000000 --- a/settingwebp_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-sdk-go" - "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -func TestSettingWebpEdit(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.Webp.Edit(context.TODO(), cloudflare.SettingWebpEditParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingWebpEditParamsValueOff), - }) - 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 TestSettingWebpGet(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.Webp.Get(context.TODO(), cloudflare.SettingWebpGetParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/settingwebsocket.go b/settingwebsocket.go deleted file mode 100644 index 81bf3d6a784..00000000000 --- a/settingwebsocket.go +++ /dev/null @@ -1,342 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingWebsocketService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingWebsocketService] method -// instead. -type SettingWebsocketService struct { - Options []option.RequestOption -} - -// NewSettingWebsocketService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewSettingWebsocketService(opts ...option.RequestOption) (r *SettingWebsocketService) { - r = &SettingWebsocketService{} - r.Options = opts - return -} - -// Changes Websockets setting. For more information about Websockets, please refer -// to -// [Using Cloudflare with WebSockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Using-Cloudflare-with-WebSockets). -func (r *SettingWebsocketService) Edit(ctx context.Context, params SettingWebsocketEditParams, opts ...option.RequestOption) (res *SettingWebsocketEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingWebsocketEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/websockets", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Gets Websockets setting. For more information about Websockets, please refer to -// [Using Cloudflare with WebSockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Using-Cloudflare-with-WebSockets). -func (r *SettingWebsocketService) Get(ctx context.Context, query SettingWebsocketGetParams, opts ...option.RequestOption) (res *SettingWebsocketGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingWebsocketGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/websockets", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// WebSockets are open connections sustained between the client and the origin -// server. Inside a WebSockets connection, the client and the origin can pass data -// back and forth without having to reestablish sessions. This makes exchanging -// data within a WebSockets connection fast. WebSockets are often used for -// real-time applications such as live chat and gaming. For more information refer -// to -// [Can I use Cloudflare with Websockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Can-I-use-Cloudflare-with-WebSockets-). -type SettingWebsocketEditResponse struct { - // ID of the zone setting. - ID SettingWebsocketEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingWebsocketEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingWebsocketEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingWebsocketEditResponseJSON `json:"-"` -} - -// settingWebsocketEditResponseJSON contains the JSON metadata for the struct -// [SettingWebsocketEditResponse] -type settingWebsocketEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingWebsocketEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingWebsocketEditResponseID string - -const ( - SettingWebsocketEditResponseIDWebsockets SettingWebsocketEditResponseID = "websockets" -) - -// Current value of the zone setting. -type SettingWebsocketEditResponseValue string - -const ( - SettingWebsocketEditResponseValueOff SettingWebsocketEditResponseValue = "off" - SettingWebsocketEditResponseValueOn SettingWebsocketEditResponseValue = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingWebsocketEditResponseEditable bool - -const ( - SettingWebsocketEditResponseEditableTrue SettingWebsocketEditResponseEditable = true - SettingWebsocketEditResponseEditableFalse SettingWebsocketEditResponseEditable = false -) - -// WebSockets are open connections sustained between the client and the origin -// server. Inside a WebSockets connection, the client and the origin can pass data -// back and forth without having to reestablish sessions. This makes exchanging -// data within a WebSockets connection fast. WebSockets are often used for -// real-time applications such as live chat and gaming. For more information refer -// to -// [Can I use Cloudflare with Websockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Can-I-use-Cloudflare-with-WebSockets-). -type SettingWebsocketGetResponse struct { - // ID of the zone setting. - ID SettingWebsocketGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingWebsocketGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingWebsocketGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingWebsocketGetResponseJSON `json:"-"` -} - -// settingWebsocketGetResponseJSON contains the JSON metadata for the struct -// [SettingWebsocketGetResponse] -type settingWebsocketGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingWebsocketGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingWebsocketGetResponseID string - -const ( - SettingWebsocketGetResponseIDWebsockets SettingWebsocketGetResponseID = "websockets" -) - -// Current value of the zone setting. -type SettingWebsocketGetResponseValue string - -const ( - SettingWebsocketGetResponseValueOff SettingWebsocketGetResponseValue = "off" - SettingWebsocketGetResponseValueOn SettingWebsocketGetResponseValue = "on" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingWebsocketGetResponseEditable bool - -const ( - SettingWebsocketGetResponseEditableTrue SettingWebsocketGetResponseEditable = true - SettingWebsocketGetResponseEditableFalse SettingWebsocketGetResponseEditable = false -) - -type SettingWebsocketEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the zone setting. - Value param.Field[SettingWebsocketEditParamsValue] `json:"value,required"` -} - -func (r SettingWebsocketEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the zone setting. -type SettingWebsocketEditParamsValue string - -const ( - SettingWebsocketEditParamsValueOff SettingWebsocketEditParamsValue = "off" - SettingWebsocketEditParamsValueOn SettingWebsocketEditParamsValue = "on" -) - -type SettingWebsocketEditResponseEnvelope struct { - Errors []SettingWebsocketEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingWebsocketEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // WebSockets are open connections sustained between the client and the origin - // server. Inside a WebSockets connection, the client and the origin can pass data - // back and forth without having to reestablish sessions. This makes exchanging - // data within a WebSockets connection fast. WebSockets are often used for - // real-time applications such as live chat and gaming. For more information refer - // to - // [Can I use Cloudflare with Websockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Can-I-use-Cloudflare-with-WebSockets-). - Result SettingWebsocketEditResponse `json:"result"` - JSON settingWebsocketEditResponseEnvelopeJSON `json:"-"` -} - -// settingWebsocketEditResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingWebsocketEditResponseEnvelope] -type settingWebsocketEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingWebsocketEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingWebsocketEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingWebsocketEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingWebsocketEditResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [SettingWebsocketEditResponseEnvelopeErrors] -type settingWebsocketEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingWebsocketEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingWebsocketEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingWebsocketEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingWebsocketEditResponseEnvelopeMessagesJSON contains the JSON metadata for -// the struct [SettingWebsocketEditResponseEnvelopeMessages] -type settingWebsocketEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingWebsocketEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingWebsocketGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingWebsocketGetResponseEnvelope struct { - Errors []SettingWebsocketGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingWebsocketGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // WebSockets are open connections sustained between the client and the origin - // server. Inside a WebSockets connection, the client and the origin can pass data - // back and forth without having to reestablish sessions. This makes exchanging - // data within a WebSockets connection fast. WebSockets are often used for - // real-time applications such as live chat and gaming. For more information refer - // to - // [Can I use Cloudflare with Websockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Can-I-use-Cloudflare-with-WebSockets-). - Result SettingWebsocketGetResponse `json:"result"` - JSON settingWebsocketGetResponseEnvelopeJSON `json:"-"` -} - -// settingWebsocketGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingWebsocketGetResponseEnvelope] -type settingWebsocketGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingWebsocketGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingWebsocketGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingWebsocketGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingWebsocketGetResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingWebsocketGetResponseEnvelopeErrors] -type settingWebsocketGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingWebsocketGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingWebsocketGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingWebsocketGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingWebsocketGetResponseEnvelopeMessagesJSON contains the JSON metadata for -// the struct [SettingWebsocketGetResponseEnvelopeMessages] -type settingWebsocketGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingWebsocketGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/settingwebsocket_test.go b/settingwebsocket_test.go deleted file mode 100644 index 4f961720fd9..00000000000 --- a/settingwebsocket_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-sdk-go" - "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -func TestSettingWebsocketEdit(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.Websocket.Edit(context.TODO(), cloudflare.SettingWebsocketEditParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingWebsocketEditParamsValueOff), - }) - 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 TestSettingWebsocketGet(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Settings.Websocket.Get(context.TODO(), cloudflare.SettingWebsocketGetParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/settingzerortt.go b/settingzerortt.go deleted file mode 100644 index e3e416c04c5..00000000000 --- a/settingzerortt.go +++ /dev/null @@ -1,315 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// SettingZeroRTTService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingZeroRTTService] method -// instead. -type SettingZeroRTTService struct { - Options []option.RequestOption -} - -// NewSettingZeroRTTService generates a new service that applies the given options -// to each request. These options are applied after the parent client's options (if -// there is one), and before any request-specific options. -func NewSettingZeroRTTService(opts ...option.RequestOption) (r *SettingZeroRTTService) { - r = &SettingZeroRTTService{} - r.Options = opts - return -} - -// Changes the 0-RTT session resumption setting. -func (r *SettingZeroRTTService) Edit(ctx context.Context, params SettingZeroRTTEditParams, opts ...option.RequestOption) (res *SettingZeroRTTEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingZeroRTTEditResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/0rtt", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Gets 0-RTT session resumption setting. -func (r *SettingZeroRTTService) Get(ctx context.Context, query SettingZeroRTTGetParams, opts ...option.RequestOption) (res *SettingZeroRTTGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env SettingZeroRTTGetResponseEnvelope - path := fmt.Sprintf("zones/%s/settings/0rtt", query.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// 0-RTT session resumption enabled for this zone. -type SettingZeroRTTEditResponse struct { - // ID of the zone setting. - ID SettingZeroRTTEditResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingZeroRTTEditResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingZeroRTTEditResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingZeroRTTEditResponseJSON `json:"-"` -} - -// settingZeroRTTEditResponseJSON contains the JSON metadata for the struct -// [SettingZeroRTTEditResponse] -type settingZeroRTTEditResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingZeroRTTEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingZeroRTTEditResponseID string - -const ( - SettingZeroRTTEditResponseID0rtt SettingZeroRTTEditResponseID = "0rtt" -) - -// Current value of the zone setting. -type SettingZeroRTTEditResponseValue string - -const ( - SettingZeroRTTEditResponseValueOn SettingZeroRTTEditResponseValue = "on" - SettingZeroRTTEditResponseValueOff SettingZeroRTTEditResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingZeroRTTEditResponseEditable bool - -const ( - SettingZeroRTTEditResponseEditableTrue SettingZeroRTTEditResponseEditable = true - SettingZeroRTTEditResponseEditableFalse SettingZeroRTTEditResponseEditable = false -) - -// 0-RTT session resumption enabled for this zone. -type SettingZeroRTTGetResponse struct { - // ID of the zone setting. - ID SettingZeroRTTGetResponseID `json:"id,required"` - // Current value of the zone setting. - Value SettingZeroRTTGetResponseValue `json:"value,required"` - // Whether or not this setting can be modified for this zone (based on your - // Cloudflare plan level). - Editable SettingZeroRTTGetResponseEditable `json:"editable"` - // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingZeroRTTGetResponseJSON `json:"-"` -} - -// settingZeroRTTGetResponseJSON contains the JSON metadata for the struct -// [SettingZeroRTTGetResponse] -type settingZeroRTTGetResponseJSON struct { - ID apijson.Field - Value apijson.Field - Editable apijson.Field - ModifiedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingZeroRTTGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// ID of the zone setting. -type SettingZeroRTTGetResponseID string - -const ( - SettingZeroRTTGetResponseID0rtt SettingZeroRTTGetResponseID = "0rtt" -) - -// Current value of the zone setting. -type SettingZeroRTTGetResponseValue string - -const ( - SettingZeroRTTGetResponseValueOn SettingZeroRTTGetResponseValue = "on" - SettingZeroRTTGetResponseValueOff SettingZeroRTTGetResponseValue = "off" -) - -// Whether or not this setting can be modified for this zone (based on your -// Cloudflare plan level). -type SettingZeroRTTGetResponseEditable bool - -const ( - SettingZeroRTTGetResponseEditableTrue SettingZeroRTTGetResponseEditable = true - SettingZeroRTTGetResponseEditableFalse SettingZeroRTTGetResponseEditable = false -) - -type SettingZeroRTTEditParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // Value of the 0-RTT setting. - Value param.Field[SettingZeroRTTEditParamsValue] `json:"value,required"` -} - -func (r SettingZeroRTTEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Value of the 0-RTT setting. -type SettingZeroRTTEditParamsValue string - -const ( - SettingZeroRTTEditParamsValueOn SettingZeroRTTEditParamsValue = "on" - SettingZeroRTTEditParamsValueOff SettingZeroRTTEditParamsValue = "off" -) - -type SettingZeroRTTEditResponseEnvelope struct { - Errors []SettingZeroRTTEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingZeroRTTEditResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // 0-RTT session resumption enabled for this zone. - Result SettingZeroRTTEditResponse `json:"result"` - JSON settingZeroRTTEditResponseEnvelopeJSON `json:"-"` -} - -// settingZeroRTTEditResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingZeroRTTEditResponseEnvelope] -type settingZeroRTTEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingZeroRTTEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingZeroRTTEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingZeroRTTEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingZeroRTTEditResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingZeroRTTEditResponseEnvelopeErrors] -type settingZeroRTTEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingZeroRTTEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingZeroRTTEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingZeroRTTEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingZeroRTTEditResponseEnvelopeMessagesJSON contains the JSON metadata for -// the struct [SettingZeroRTTEditResponseEnvelopeMessages] -type settingZeroRTTEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingZeroRTTEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingZeroRTTGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type SettingZeroRTTGetResponseEnvelope struct { - Errors []SettingZeroRTTGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingZeroRTTGetResponseEnvelopeMessages `json:"messages,required"` - // Whether the API call was successful - Success bool `json:"success,required"` - // 0-RTT session resumption enabled for this zone. - Result SettingZeroRTTGetResponse `json:"result"` - JSON settingZeroRTTGetResponseEnvelopeJSON `json:"-"` -} - -// settingZeroRTTGetResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingZeroRTTGetResponseEnvelope] -type settingZeroRTTGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingZeroRTTGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingZeroRTTGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingZeroRTTGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// settingZeroRTTGetResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingZeroRTTGetResponseEnvelopeErrors] -type settingZeroRTTGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingZeroRTTGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type SettingZeroRTTGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingZeroRTTGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// settingZeroRTTGetResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingZeroRTTGetResponseEnvelopeMessages] -type settingZeroRTTGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SettingZeroRTTGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/storage.go b/storage.go index 86259276295..8cb09a914be 100644 --- a/storage.go +++ b/storage.go @@ -13,7 +13,6 @@ import ( type StorageService struct { Options []option.RequestOption Analytics *StorageAnalyticsService - KV *StorageKVService } // NewStorageService generates a new service that applies the given options to each @@ -23,6 +22,5 @@ func NewStorageService(opts ...option.RequestOption) (r *StorageService) { r = &StorageService{} r.Options = opts r.Analytics = NewStorageAnalyticsService(opts...) - r.KV = NewStorageKVService(opts...) return } diff --git a/storagekv.go b/storagekv.go deleted file mode 100644 index a7590e51ca6..00000000000 --- a/storagekv.go +++ /dev/null @@ -1,26 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// StorageKVService contains methods and other services that help with interacting -// with the cloudflare API. Note, unlike clients, this service does not read -// variables from the environment automatically. You should not instantiate this -// service directly, and instead use the [NewStorageKVService] method instead. -type StorageKVService struct { - Options []option.RequestOption - Namespaces *StorageKVNamespaceService -} - -// NewStorageKVService generates a new service that applies the given options to -// each request. These options are applied after the parent client's options (if -// there is one), and before any request-specific options. -func NewStorageKVService(opts ...option.RequestOption) (r *StorageKVService) { - r = &StorageKVService{} - r.Options = opts - r.Namespaces = NewStorageKVNamespaceService(opts...) - return -} diff --git a/storagekvnamespace.go b/storagekvnamespace.go deleted file mode 100644 index dc819feb3ed..00000000000 --- a/storagekvnamespace.go +++ /dev/null @@ -1,465 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "net/url" - "reflect" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/internal/shared" - "github.com/cloudflare/cloudflare-sdk-go/option" - "github.com/tidwall/gjson" -) - -// StorageKVNamespaceService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewStorageKVNamespaceService] method -// instead. -type StorageKVNamespaceService struct { - Options []option.RequestOption - Bulk *StorageKVNamespaceBulkService - Keys *StorageKVNamespaceKeyService - Metadata *StorageKVNamespaceMetadataService - Values *StorageKVNamespaceValueService -} - -// NewStorageKVNamespaceService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewStorageKVNamespaceService(opts ...option.RequestOption) (r *StorageKVNamespaceService) { - r = &StorageKVNamespaceService{} - r.Options = opts - r.Bulk = NewStorageKVNamespaceBulkService(opts...) - r.Keys = NewStorageKVNamespaceKeyService(opts...) - r.Metadata = NewStorageKVNamespaceMetadataService(opts...) - r.Values = NewStorageKVNamespaceValueService(opts...) - return -} - -// Creates a namespace under the given title. A `400` is returned if the account -// already owns a namespace with this title. A namespace must be explicitly deleted -// to be replaced. -func (r *StorageKVNamespaceService) New(ctx context.Context, params StorageKVNamespaceNewParams, opts ...option.RequestOption) (res *StorageKVNamespaceNewResponse, err error) { - opts = append(r.Options[:], opts...) - var env StorageKVNamespaceNewResponseEnvelope - path := fmt.Sprintf("accounts/%s/storage/kv/namespaces", params.AccountID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Modifies a namespace's title. -func (r *StorageKVNamespaceService) Update(ctx context.Context, namespaceID string, params StorageKVNamespaceUpdateParams, opts ...option.RequestOption) (res *StorageKVNamespaceUpdateResponse, err error) { - opts = append(r.Options[:], opts...) - var env StorageKVNamespaceUpdateResponseEnvelope - path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s", params.AccountID, namespaceID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Returns the namespaces owned by an account. -func (r *StorageKVNamespaceService) List(ctx context.Context, params StorageKVNamespaceListParams, opts ...option.RequestOption) (res *shared.V4PagePaginationArray[StorageKVNamespaceListResponse], err error) { - var raw *http.Response - opts = append(r.Options, opts...) - opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) - path := fmt.Sprintf("accounts/%s/storage/kv/namespaces", params.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, params, &res, opts...) - if err != nil { - return nil, err - } - err = cfg.Execute() - if err != nil { - return nil, err - } - res.SetPageConfig(cfg, raw) - return res, nil -} - -// Returns the namespaces owned by an account. -func (r *StorageKVNamespaceService) ListAutoPaging(ctx context.Context, params StorageKVNamespaceListParams, opts ...option.RequestOption) *shared.V4PagePaginationArrayAutoPager[StorageKVNamespaceListResponse] { - return shared.NewV4PagePaginationArrayAutoPager(r.List(ctx, params, opts...)) -} - -// Deletes the namespace corresponding to the given ID. -func (r *StorageKVNamespaceService) Delete(ctx context.Context, namespaceID string, body StorageKVNamespaceDeleteParams, opts ...option.RequestOption) (res *StorageKVNamespaceDeleteResponse, err error) { - opts = append(r.Options[:], opts...) - var env StorageKVNamespaceDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s", body.AccountID, namespaceID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -type StorageKVNamespaceNewResponse struct { - // Namespace identifier tag. - ID string `json:"id,required"` - // A human-readable string name for a Namespace. - Title string `json:"title,required"` - // True if keys written on the URL will be URL-decoded before storing. For example, - // if set to "true", a key written on the URL as "%3F" will be stored as "?". - SupportsURLEncoding bool `json:"supports_url_encoding"` - JSON storageKVNamespaceNewResponseJSON `json:"-"` -} - -// storageKVNamespaceNewResponseJSON contains the JSON metadata for the struct -// [StorageKVNamespaceNewResponse] -type storageKVNamespaceNewResponseJSON struct { - ID apijson.Field - Title apijson.Field - SupportsURLEncoding apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceNewResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Union satisfied by [StorageKVNamespaceUpdateResponseUnknown] or -// [shared.UnionString]. -type StorageKVNamespaceUpdateResponse interface { - ImplementsStorageKVNamespaceUpdateResponse() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*StorageKVNamespaceUpdateResponse)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.String, - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) -} - -type StorageKVNamespaceListResponse struct { - // Namespace identifier tag. - ID string `json:"id,required"` - // A human-readable string name for a Namespace. - Title string `json:"title,required"` - // True if keys written on the URL will be URL-decoded before storing. For example, - // if set to "true", a key written on the URL as "%3F" will be stored as "?". - SupportsURLEncoding bool `json:"supports_url_encoding"` - JSON storageKVNamespaceListResponseJSON `json:"-"` -} - -// storageKVNamespaceListResponseJSON contains the JSON metadata for the struct -// [StorageKVNamespaceListResponse] -type storageKVNamespaceListResponseJSON struct { - ID apijson.Field - Title apijson.Field - SupportsURLEncoding apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Union satisfied by [StorageKVNamespaceDeleteResponseUnknown] or -// [shared.UnionString]. -type StorageKVNamespaceDeleteResponse interface { - ImplementsStorageKVNamespaceDeleteResponse() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*StorageKVNamespaceDeleteResponse)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.String, - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) -} - -type StorageKVNamespaceNewParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` - // A human-readable string name for a Namespace. - Title param.Field[string] `json:"title,required"` -} - -func (r StorageKVNamespaceNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type StorageKVNamespaceNewResponseEnvelope struct { - Errors []StorageKVNamespaceNewResponseEnvelopeErrors `json:"errors,required"` - Messages []StorageKVNamespaceNewResponseEnvelopeMessages `json:"messages,required"` - Result StorageKVNamespaceNewResponse `json:"result,required"` - // Whether the API call was successful - Success StorageKVNamespaceNewResponseEnvelopeSuccess `json:"success,required"` - JSON storageKVNamespaceNewResponseEnvelopeJSON `json:"-"` -} - -// storageKVNamespaceNewResponseEnvelopeJSON contains the JSON metadata for the -// struct [StorageKVNamespaceNewResponseEnvelope] -type storageKVNamespaceNewResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type StorageKVNamespaceNewResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON storageKVNamespaceNewResponseEnvelopeErrorsJSON `json:"-"` -} - -// storageKVNamespaceNewResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [StorageKVNamespaceNewResponseEnvelopeErrors] -type storageKVNamespaceNewResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type StorageKVNamespaceNewResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON storageKVNamespaceNewResponseEnvelopeMessagesJSON `json:"-"` -} - -// storageKVNamespaceNewResponseEnvelopeMessagesJSON contains the JSON metadata for -// the struct [StorageKVNamespaceNewResponseEnvelopeMessages] -type storageKVNamespaceNewResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type StorageKVNamespaceNewResponseEnvelopeSuccess bool - -const ( - StorageKVNamespaceNewResponseEnvelopeSuccessTrue StorageKVNamespaceNewResponseEnvelopeSuccess = true -) - -type StorageKVNamespaceUpdateParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` - // A human-readable string name for a Namespace. - Title param.Field[string] `json:"title,required"` -} - -func (r StorageKVNamespaceUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type StorageKVNamespaceUpdateResponseEnvelope struct { - Errors []StorageKVNamespaceUpdateResponseEnvelopeErrors `json:"errors,required"` - Messages []StorageKVNamespaceUpdateResponseEnvelopeMessages `json:"messages,required"` - Result StorageKVNamespaceUpdateResponse `json:"result,required"` - // Whether the API call was successful - Success StorageKVNamespaceUpdateResponseEnvelopeSuccess `json:"success,required"` - JSON storageKVNamespaceUpdateResponseEnvelopeJSON `json:"-"` -} - -// storageKVNamespaceUpdateResponseEnvelopeJSON contains the JSON metadata for the -// struct [StorageKVNamespaceUpdateResponseEnvelope] -type storageKVNamespaceUpdateResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type StorageKVNamespaceUpdateResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON storageKVNamespaceUpdateResponseEnvelopeErrorsJSON `json:"-"` -} - -// storageKVNamespaceUpdateResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [StorageKVNamespaceUpdateResponseEnvelopeErrors] -type storageKVNamespaceUpdateResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type StorageKVNamespaceUpdateResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON storageKVNamespaceUpdateResponseEnvelopeMessagesJSON `json:"-"` -} - -// storageKVNamespaceUpdateResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [StorageKVNamespaceUpdateResponseEnvelopeMessages] -type storageKVNamespaceUpdateResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type StorageKVNamespaceUpdateResponseEnvelopeSuccess bool - -const ( - StorageKVNamespaceUpdateResponseEnvelopeSuccessTrue StorageKVNamespaceUpdateResponseEnvelopeSuccess = true -) - -type StorageKVNamespaceListParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` - // Direction to order namespaces. - Direction param.Field[StorageKVNamespaceListParamsDirection] `query:"direction"` - // Field to order results by. - Order param.Field[StorageKVNamespaceListParamsOrder] `query:"order"` - // Page number of paginated results. - Page param.Field[float64] `query:"page"` - // Maximum number of results per page. - PerPage param.Field[float64] `query:"per_page"` -} - -// URLQuery serializes [StorageKVNamespaceListParams]'s query parameters as -// `url.Values`. -func (r StorageKVNamespaceListParams) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatComma, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} - -// Direction to order namespaces. -type StorageKVNamespaceListParamsDirection string - -const ( - StorageKVNamespaceListParamsDirectionAsc StorageKVNamespaceListParamsDirection = "asc" - StorageKVNamespaceListParamsDirectionDesc StorageKVNamespaceListParamsDirection = "desc" -) - -// Field to order results by. -type StorageKVNamespaceListParamsOrder string - -const ( - StorageKVNamespaceListParamsOrderID StorageKVNamespaceListParamsOrder = "id" - StorageKVNamespaceListParamsOrderTitle StorageKVNamespaceListParamsOrder = "title" -) - -type StorageKVNamespaceDeleteParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` -} - -type StorageKVNamespaceDeleteResponseEnvelope struct { - Errors []StorageKVNamespaceDeleteResponseEnvelopeErrors `json:"errors,required"` - Messages []StorageKVNamespaceDeleteResponseEnvelopeMessages `json:"messages,required"` - Result StorageKVNamespaceDeleteResponse `json:"result,required"` - // Whether the API call was successful - Success StorageKVNamespaceDeleteResponseEnvelopeSuccess `json:"success,required"` - JSON storageKVNamespaceDeleteResponseEnvelopeJSON `json:"-"` -} - -// storageKVNamespaceDeleteResponseEnvelopeJSON contains the JSON metadata for the -// struct [StorageKVNamespaceDeleteResponseEnvelope] -type storageKVNamespaceDeleteResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type StorageKVNamespaceDeleteResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON storageKVNamespaceDeleteResponseEnvelopeErrorsJSON `json:"-"` -} - -// storageKVNamespaceDeleteResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [StorageKVNamespaceDeleteResponseEnvelopeErrors] -type storageKVNamespaceDeleteResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type StorageKVNamespaceDeleteResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON storageKVNamespaceDeleteResponseEnvelopeMessagesJSON `json:"-"` -} - -// storageKVNamespaceDeleteResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [StorageKVNamespaceDeleteResponseEnvelopeMessages] -type storageKVNamespaceDeleteResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type StorageKVNamespaceDeleteResponseEnvelopeSuccess bool - -const ( - StorageKVNamespaceDeleteResponseEnvelopeSuccessTrue StorageKVNamespaceDeleteResponseEnvelopeSuccess = true -) diff --git a/storagekvnamespacebulk.go b/storagekvnamespacebulk.go deleted file mode 100644 index 744bc088261..00000000000 --- a/storagekvnamespacebulk.go +++ /dev/null @@ -1,283 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "reflect" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/internal/shared" - "github.com/cloudflare/cloudflare-sdk-go/option" - "github.com/tidwall/gjson" -) - -// StorageKVNamespaceBulkService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewStorageKVNamespaceBulkService] -// method instead. -type StorageKVNamespaceBulkService struct { - Options []option.RequestOption -} - -// NewStorageKVNamespaceBulkService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewStorageKVNamespaceBulkService(opts ...option.RequestOption) (r *StorageKVNamespaceBulkService) { - r = &StorageKVNamespaceBulkService{} - r.Options = opts - return -} - -// Write multiple keys and values at once. Body should be an array of up to 10,000 -// key-value pairs to be stored, along with optional expiration information. -// Existing values and expirations will be overwritten. If neither `expiration` nor -// `expiration_ttl` is specified, the key-value pair will never expire. If both are -// set, `expiration_ttl` is used and `expiration` is ignored. The entire request -// size must be 100 megabytes or less. -func (r *StorageKVNamespaceBulkService) Update(ctx context.Context, namespaceID string, params StorageKVNamespaceBulkUpdateParams, opts ...option.RequestOption) (res *StorageKVNamespaceBulkUpdateResponse, err error) { - opts = append(r.Options[:], opts...) - var env StorageKVNamespaceBulkUpdateResponseEnvelope - path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/bulk", params.AccountID, namespaceID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Remove multiple KV pairs from the namespace. Body should be an array of up to -// 10,000 keys to be removed. -func (r *StorageKVNamespaceBulkService) Delete(ctx context.Context, namespaceID string, params StorageKVNamespaceBulkDeleteParams, opts ...option.RequestOption) (res *StorageKVNamespaceBulkDeleteResponse, err error) { - opts = append(r.Options[:], opts...) - var env StorageKVNamespaceBulkDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/bulk", params.AccountID, namespaceID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Union satisfied by [StorageKVNamespaceBulkUpdateResponseUnknown] or -// [shared.UnionString]. -type StorageKVNamespaceBulkUpdateResponse interface { - ImplementsStorageKVNamespaceBulkUpdateResponse() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*StorageKVNamespaceBulkUpdateResponse)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.String, - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) -} - -// Union satisfied by [StorageKVNamespaceBulkDeleteResponseUnknown] or -// [shared.UnionString]. -type StorageKVNamespaceBulkDeleteResponse interface { - ImplementsStorageKVNamespaceBulkDeleteResponse() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*StorageKVNamespaceBulkDeleteResponse)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.String, - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) -} - -type StorageKVNamespaceBulkUpdateParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[[]StorageKVNamespaceBulkUpdateParamsBody] `json:"body,required"` -} - -func (r StorageKVNamespaceBulkUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - -type StorageKVNamespaceBulkUpdateParamsBody struct { - // Whether or not the server should base64 decode the value before storing it. - // Useful for writing values that wouldn't otherwise be valid JSON strings, such as - // images. - Base64 param.Field[bool] `json:"base64"` - // The time, measured in number of seconds since the UNIX epoch, at which the key - // should expire. - Expiration param.Field[float64] `json:"expiration"` - // The number of seconds for which the key should be visible before it expires. At - // least 60. - ExpirationTTL param.Field[float64] `json:"expiration_ttl"` - // A key's name. The name may be at most 512 bytes. All printable, non-whitespace - // characters are valid. - Key param.Field[string] `json:"key"` - // Arbitrary JSON that is associated with a key. - Metadata param.Field[interface{}] `json:"metadata"` - // A UTF-8 encoded string to be stored, up to 25 MiB in length. - Value param.Field[string] `json:"value"` -} - -func (r StorageKVNamespaceBulkUpdateParamsBody) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type StorageKVNamespaceBulkUpdateResponseEnvelope struct { - Errors []StorageKVNamespaceBulkUpdateResponseEnvelopeErrors `json:"errors,required"` - Messages []StorageKVNamespaceBulkUpdateResponseEnvelopeMessages `json:"messages,required"` - Result StorageKVNamespaceBulkUpdateResponse `json:"result,required"` - // Whether the API call was successful - Success StorageKVNamespaceBulkUpdateResponseEnvelopeSuccess `json:"success,required"` - JSON storageKVNamespaceBulkUpdateResponseEnvelopeJSON `json:"-"` -} - -// storageKVNamespaceBulkUpdateResponseEnvelopeJSON contains the JSON metadata for -// the struct [StorageKVNamespaceBulkUpdateResponseEnvelope] -type storageKVNamespaceBulkUpdateResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceBulkUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type StorageKVNamespaceBulkUpdateResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON storageKVNamespaceBulkUpdateResponseEnvelopeErrorsJSON `json:"-"` -} - -// storageKVNamespaceBulkUpdateResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [StorageKVNamespaceBulkUpdateResponseEnvelopeErrors] -type storageKVNamespaceBulkUpdateResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceBulkUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type StorageKVNamespaceBulkUpdateResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON storageKVNamespaceBulkUpdateResponseEnvelopeMessagesJSON `json:"-"` -} - -// storageKVNamespaceBulkUpdateResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [StorageKVNamespaceBulkUpdateResponseEnvelopeMessages] -type storageKVNamespaceBulkUpdateResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceBulkUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type StorageKVNamespaceBulkUpdateResponseEnvelopeSuccess bool - -const ( - StorageKVNamespaceBulkUpdateResponseEnvelopeSuccessTrue StorageKVNamespaceBulkUpdateResponseEnvelopeSuccess = true -) - -type StorageKVNamespaceBulkDeleteParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Body param.Field[[]string] `json:"body,required"` -} - -func (r StorageKVNamespaceBulkDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - -type StorageKVNamespaceBulkDeleteResponseEnvelope struct { - Errors []StorageKVNamespaceBulkDeleteResponseEnvelopeErrors `json:"errors,required"` - Messages []StorageKVNamespaceBulkDeleteResponseEnvelopeMessages `json:"messages,required"` - Result StorageKVNamespaceBulkDeleteResponse `json:"result,required"` - // Whether the API call was successful - Success StorageKVNamespaceBulkDeleteResponseEnvelopeSuccess `json:"success,required"` - JSON storageKVNamespaceBulkDeleteResponseEnvelopeJSON `json:"-"` -} - -// storageKVNamespaceBulkDeleteResponseEnvelopeJSON contains the JSON metadata for -// the struct [StorageKVNamespaceBulkDeleteResponseEnvelope] -type storageKVNamespaceBulkDeleteResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceBulkDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type StorageKVNamespaceBulkDeleteResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON storageKVNamespaceBulkDeleteResponseEnvelopeErrorsJSON `json:"-"` -} - -// storageKVNamespaceBulkDeleteResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [StorageKVNamespaceBulkDeleteResponseEnvelopeErrors] -type storageKVNamespaceBulkDeleteResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceBulkDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type StorageKVNamespaceBulkDeleteResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON storageKVNamespaceBulkDeleteResponseEnvelopeMessagesJSON `json:"-"` -} - -// storageKVNamespaceBulkDeleteResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [StorageKVNamespaceBulkDeleteResponseEnvelopeMessages] -type storageKVNamespaceBulkDeleteResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceBulkDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type StorageKVNamespaceBulkDeleteResponseEnvelopeSuccess bool - -const ( - StorageKVNamespaceBulkDeleteResponseEnvelopeSuccessTrue StorageKVNamespaceBulkDeleteResponseEnvelopeSuccess = true -) diff --git a/storagekvnamespacekey.go b/storagekvnamespacekey.go deleted file mode 100644 index f5eb0659d65..00000000000 --- a/storagekvnamespacekey.go +++ /dev/null @@ -1,195 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// StorageKVNamespaceKeyService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewStorageKVNamespaceKeyService] -// method instead. -type StorageKVNamespaceKeyService struct { - Options []option.RequestOption -} - -// NewStorageKVNamespaceKeyService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewStorageKVNamespaceKeyService(opts ...option.RequestOption) (r *StorageKVNamespaceKeyService) { - r = &StorageKVNamespaceKeyService{} - r.Options = opts - return -} - -// Lists a namespace's keys. -func (r *StorageKVNamespaceKeyService) List(ctx context.Context, namespaceID string, params StorageKVNamespaceKeyListParams, opts ...option.RequestOption) (res *[]StorageKVNamespaceKeyListResponse, err error) { - opts = append(r.Options[:], opts...) - var env StorageKVNamespaceKeyListResponseEnvelope - path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/keys", params.AccountID, namespaceID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// A name for a value. A value stored under a given key may be retrieved via the -// same key. -type StorageKVNamespaceKeyListResponse struct { - // A key's name. The name may be at most 512 bytes. All printable, non-whitespace - // characters are valid. Use percent-encoding to define key names as part of a URL. - Name string `json:"name,required"` - // The time, measured in number of seconds since the UNIX epoch, at which the key - // will expire. This property is omitted for keys that will not expire. - Expiration float64 `json:"expiration"` - // Arbitrary JSON that is associated with a key. - Metadata interface{} `json:"metadata"` - JSON storageKVNamespaceKeyListResponseJSON `json:"-"` -} - -// storageKVNamespaceKeyListResponseJSON contains the JSON metadata for the struct -// [StorageKVNamespaceKeyListResponse] -type storageKVNamespaceKeyListResponseJSON struct { - Name apijson.Field - Expiration apijson.Field - Metadata apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceKeyListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type StorageKVNamespaceKeyListParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` - // Opaque token indicating the position from which to continue when requesting the - // next set of records if the amount of list results was limited by the limit - // parameter. A valid value for the cursor can be obtained from the `cursors` - // object in the `result_info` structure. - Cursor param.Field[string] `query:"cursor"` - // The number of keys to return. The cursor attribute may be used to iterate over - // the next batch of keys if there are more than the limit. - Limit param.Field[float64] `query:"limit"` - // A string prefix used to filter down which keys will be returned. Exact matches - // and any key names that begin with the prefix will be returned. - Prefix param.Field[string] `query:"prefix"` -} - -// URLQuery serializes [StorageKVNamespaceKeyListParams]'s query parameters as -// `url.Values`. -func (r StorageKVNamespaceKeyListParams) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatComma, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} - -type StorageKVNamespaceKeyListResponseEnvelope struct { - Errors []StorageKVNamespaceKeyListResponseEnvelopeErrors `json:"errors,required"` - Messages []StorageKVNamespaceKeyListResponseEnvelopeMessages `json:"messages,required"` - Result []StorageKVNamespaceKeyListResponse `json:"result,required"` - // Whether the API call was successful - Success StorageKVNamespaceKeyListResponseEnvelopeSuccess `json:"success,required"` - ResultInfo StorageKVNamespaceKeyListResponseEnvelopeResultInfo `json:"result_info"` - JSON storageKVNamespaceKeyListResponseEnvelopeJSON `json:"-"` -} - -// storageKVNamespaceKeyListResponseEnvelopeJSON contains the JSON metadata for the -// struct [StorageKVNamespaceKeyListResponseEnvelope] -type storageKVNamespaceKeyListResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - ResultInfo apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceKeyListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type StorageKVNamespaceKeyListResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON storageKVNamespaceKeyListResponseEnvelopeErrorsJSON `json:"-"` -} - -// storageKVNamespaceKeyListResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [StorageKVNamespaceKeyListResponseEnvelopeErrors] -type storageKVNamespaceKeyListResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceKeyListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type StorageKVNamespaceKeyListResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON storageKVNamespaceKeyListResponseEnvelopeMessagesJSON `json:"-"` -} - -// storageKVNamespaceKeyListResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [StorageKVNamespaceKeyListResponseEnvelopeMessages] -type storageKVNamespaceKeyListResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceKeyListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type StorageKVNamespaceKeyListResponseEnvelopeSuccess bool - -const ( - StorageKVNamespaceKeyListResponseEnvelopeSuccessTrue StorageKVNamespaceKeyListResponseEnvelopeSuccess = true -) - -type StorageKVNamespaceKeyListResponseEnvelopeResultInfo struct { - // Total results returned based on your list parameters. - Count float64 `json:"count"` - // Opaque token indicating the position from which to continue when requesting the - // next set of records if the amount of list results was limited by the limit - // parameter. A valid value for the cursor can be obtained from the cursors object - // in the result_info structure. - Cursor string `json:"cursor"` - JSON storageKVNamespaceKeyListResponseEnvelopeResultInfoJSON `json:"-"` -} - -// storageKVNamespaceKeyListResponseEnvelopeResultInfoJSON contains the JSON -// metadata for the struct [StorageKVNamespaceKeyListResponseEnvelopeResultInfo] -type storageKVNamespaceKeyListResponseEnvelopeResultInfoJSON struct { - Count apijson.Field - Cursor apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceKeyListResponseEnvelopeResultInfo) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} diff --git a/storagekvnamespacemetadata.go b/storagekvnamespacemetadata.go deleted file mode 100644 index 33522f1bf0f..00000000000 --- a/storagekvnamespacemetadata.go +++ /dev/null @@ -1,124 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// StorageKVNamespaceMetadataService contains methods and other services that help -// with interacting with the cloudflare API. Note, unlike clients, this service -// does not read variables from the environment automatically. You should not -// instantiate this service directly, and instead use the -// [NewStorageKVNamespaceMetadataService] method instead. -type StorageKVNamespaceMetadataService struct { - Options []option.RequestOption -} - -// NewStorageKVNamespaceMetadataService generates a new service that applies the -// given options to each request. These options are applied after the parent -// client's options (if there is one), and before any request-specific options. -func NewStorageKVNamespaceMetadataService(opts ...option.RequestOption) (r *StorageKVNamespaceMetadataService) { - r = &StorageKVNamespaceMetadataService{} - r.Options = opts - return -} - -// Returns the metadata associated with the given key in the given namespace. Use -// URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key -// name. -func (r *StorageKVNamespaceMetadataService) Get(ctx context.Context, namespaceID string, keyName string, query StorageKVNamespaceMetadataGetParams, opts ...option.RequestOption) (res *StorageKVNamespaceMetadataGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env StorageKVNamespaceMetadataGetResponseEnvelope - path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/metadata/%s", query.AccountID, namespaceID, keyName) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -type StorageKVNamespaceMetadataGetResponse = interface{} - -type StorageKVNamespaceMetadataGetParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` -} - -type StorageKVNamespaceMetadataGetResponseEnvelope struct { - Errors []StorageKVNamespaceMetadataGetResponseEnvelopeErrors `json:"errors,required"` - Messages []StorageKVNamespaceMetadataGetResponseEnvelopeMessages `json:"messages,required"` - // Arbitrary JSON that is associated with a key. - Result StorageKVNamespaceMetadataGetResponse `json:"result,required"` - // Whether the API call was successful - Success StorageKVNamespaceMetadataGetResponseEnvelopeSuccess `json:"success,required"` - JSON storageKVNamespaceMetadataGetResponseEnvelopeJSON `json:"-"` -} - -// storageKVNamespaceMetadataGetResponseEnvelopeJSON contains the JSON metadata for -// the struct [StorageKVNamespaceMetadataGetResponseEnvelope] -type storageKVNamespaceMetadataGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceMetadataGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type StorageKVNamespaceMetadataGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON storageKVNamespaceMetadataGetResponseEnvelopeErrorsJSON `json:"-"` -} - -// storageKVNamespaceMetadataGetResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [StorageKVNamespaceMetadataGetResponseEnvelopeErrors] -type storageKVNamespaceMetadataGetResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceMetadataGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type StorageKVNamespaceMetadataGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON storageKVNamespaceMetadataGetResponseEnvelopeMessagesJSON `json:"-"` -} - -// storageKVNamespaceMetadataGetResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [StorageKVNamespaceMetadataGetResponseEnvelopeMessages] -type storageKVNamespaceMetadataGetResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceMetadataGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type StorageKVNamespaceMetadataGetResponseEnvelopeSuccess bool - -const ( - StorageKVNamespaceMetadataGetResponseEnvelopeSuccessTrue StorageKVNamespaceMetadataGetResponseEnvelopeSuccess = true -) diff --git a/storagekvnamespacevalue.go b/storagekvnamespacevalue.go deleted file mode 100644 index 0134a884a99..00000000000 --- a/storagekvnamespacevalue.go +++ /dev/null @@ -1,274 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "reflect" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/internal/shared" - "github.com/cloudflare/cloudflare-sdk-go/option" - "github.com/tidwall/gjson" -) - -// StorageKVNamespaceValueService contains methods and other services that help -// with interacting with the cloudflare API. Note, unlike clients, this service -// does not read variables from the environment automatically. You should not -// instantiate this service directly, and instead use the -// [NewStorageKVNamespaceValueService] method instead. -type StorageKVNamespaceValueService struct { - Options []option.RequestOption -} - -// NewStorageKVNamespaceValueService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewStorageKVNamespaceValueService(opts ...option.RequestOption) (r *StorageKVNamespaceValueService) { - r = &StorageKVNamespaceValueService{} - r.Options = opts - return -} - -// Write a value identified by a key. Use URL-encoding to use special characters -// (for example, `:`, `!`, `%`) in the key name. Body should be the value to be -// stored along with JSON metadata to be associated with the key/value pair. -// Existing values, expirations, and metadata will be overwritten. If neither -// `expiration` nor `expiration_ttl` is specified, the key-value pair will never -// expire. If both are set, `expiration_ttl` is used and `expiration` is ignored. -func (r *StorageKVNamespaceValueService) Update(ctx context.Context, namespaceID string, keyName string, params StorageKVNamespaceValueUpdateParams, opts ...option.RequestOption) (res *StorageKVNamespaceValueUpdateResponse, err error) { - opts = append(r.Options[:], opts...) - var env StorageKVNamespaceValueUpdateResponseEnvelope - path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/values/%s", params.AccountID, namespaceID, keyName) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Remove a KV pair from the namespace. Use URL-encoding to use special characters -// (for example, `:`, `!`, `%`) in the key name. -func (r *StorageKVNamespaceValueService) Delete(ctx context.Context, namespaceID string, keyName string, body StorageKVNamespaceValueDeleteParams, opts ...option.RequestOption) (res *StorageKVNamespaceValueDeleteResponse, err error) { - opts = append(r.Options[:], opts...) - var env StorageKVNamespaceValueDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/values/%s", body.AccountID, namespaceID, keyName) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Returns the value associated with the given key in the given namespace. Use -// URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key -// name. If the KV-pair is set to expire at some point, the expiration time as -// measured in seconds since the UNIX epoch will be returned in the `expiration` -// response header. -func (r *StorageKVNamespaceValueService) Get(ctx context.Context, namespaceID string, keyName string, query StorageKVNamespaceValueGetParams, opts ...option.RequestOption) (res *string, err error) { - opts = append(r.Options[:], opts...) - path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/values/%s", query.AccountID, namespaceID, keyName) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) - return -} - -// Union satisfied by [StorageKVNamespaceValueUpdateResponseUnknown] or -// [shared.UnionString]. -type StorageKVNamespaceValueUpdateResponse interface { - ImplementsStorageKVNamespaceValueUpdateResponse() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*StorageKVNamespaceValueUpdateResponse)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.String, - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) -} - -// Union satisfied by [StorageKVNamespaceValueDeleteResponseUnknown] or -// [shared.UnionString]. -type StorageKVNamespaceValueDeleteResponse interface { - ImplementsStorageKVNamespaceValueDeleteResponse() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*StorageKVNamespaceValueDeleteResponse)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.String, - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) -} - -type StorageKVNamespaceValueUpdateParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` - // Arbitrary JSON to be associated with a key/value pair. - Metadata param.Field[string] `json:"metadata,required"` - // A byte sequence to be stored, up to 25 MiB in length. - Value param.Field[string] `json:"value,required"` -} - -func (r StorageKVNamespaceValueUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type StorageKVNamespaceValueUpdateResponseEnvelope struct { - Errors []StorageKVNamespaceValueUpdateResponseEnvelopeErrors `json:"errors,required"` - Messages []StorageKVNamespaceValueUpdateResponseEnvelopeMessages `json:"messages,required"` - Result StorageKVNamespaceValueUpdateResponse `json:"result,required"` - // Whether the API call was successful - Success StorageKVNamespaceValueUpdateResponseEnvelopeSuccess `json:"success,required"` - JSON storageKVNamespaceValueUpdateResponseEnvelopeJSON `json:"-"` -} - -// storageKVNamespaceValueUpdateResponseEnvelopeJSON contains the JSON metadata for -// the struct [StorageKVNamespaceValueUpdateResponseEnvelope] -type storageKVNamespaceValueUpdateResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceValueUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type StorageKVNamespaceValueUpdateResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON storageKVNamespaceValueUpdateResponseEnvelopeErrorsJSON `json:"-"` -} - -// storageKVNamespaceValueUpdateResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [StorageKVNamespaceValueUpdateResponseEnvelopeErrors] -type storageKVNamespaceValueUpdateResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceValueUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type StorageKVNamespaceValueUpdateResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON storageKVNamespaceValueUpdateResponseEnvelopeMessagesJSON `json:"-"` -} - -// storageKVNamespaceValueUpdateResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [StorageKVNamespaceValueUpdateResponseEnvelopeMessages] -type storageKVNamespaceValueUpdateResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceValueUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type StorageKVNamespaceValueUpdateResponseEnvelopeSuccess bool - -const ( - StorageKVNamespaceValueUpdateResponseEnvelopeSuccessTrue StorageKVNamespaceValueUpdateResponseEnvelopeSuccess = true -) - -type StorageKVNamespaceValueDeleteParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` -} - -type StorageKVNamespaceValueDeleteResponseEnvelope struct { - Errors []StorageKVNamespaceValueDeleteResponseEnvelopeErrors `json:"errors,required"` - Messages []StorageKVNamespaceValueDeleteResponseEnvelopeMessages `json:"messages,required"` - Result StorageKVNamespaceValueDeleteResponse `json:"result,required"` - // Whether the API call was successful - Success StorageKVNamespaceValueDeleteResponseEnvelopeSuccess `json:"success,required"` - JSON storageKVNamespaceValueDeleteResponseEnvelopeJSON `json:"-"` -} - -// storageKVNamespaceValueDeleteResponseEnvelopeJSON contains the JSON metadata for -// the struct [StorageKVNamespaceValueDeleteResponseEnvelope] -type storageKVNamespaceValueDeleteResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceValueDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type StorageKVNamespaceValueDeleteResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON storageKVNamespaceValueDeleteResponseEnvelopeErrorsJSON `json:"-"` -} - -// storageKVNamespaceValueDeleteResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [StorageKVNamespaceValueDeleteResponseEnvelopeErrors] -type storageKVNamespaceValueDeleteResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceValueDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type StorageKVNamespaceValueDeleteResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON storageKVNamespaceValueDeleteResponseEnvelopeMessagesJSON `json:"-"` -} - -// storageKVNamespaceValueDeleteResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [StorageKVNamespaceValueDeleteResponseEnvelopeMessages] -type storageKVNamespaceValueDeleteResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *StorageKVNamespaceValueDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type StorageKVNamespaceValueDeleteResponseEnvelopeSuccess bool - -const ( - StorageKVNamespaceValueDeleteResponseEnvelopeSuccessTrue StorageKVNamespaceValueDeleteResponseEnvelopeSuccess = true -) - -type StorageKVNamespaceValueGetParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` -} diff --git a/teamnetroute.go b/teamnetroute.go index 5e1b09b5911..c721ad54c35 100644 --- a/teamnetroute.go +++ b/teamnetroute.go @@ -39,6 +39,19 @@ func NewTeamnetRouteService(opts ...option.RequestOption) (r *TeamnetRouteServic return } +// Routes a private network through a Cloudflare Tunnel. +func (r *TeamnetRouteService) New(ctx context.Context, params TeamnetRouteNewParams, opts ...option.RequestOption) (res *TeamnetRouteNewResponse, err error) { + opts = append(r.Options[:], opts...) + var env TeamnetRouteNewResponseEnvelope + path := fmt.Sprintf("accounts/%s/teamnet/routes", params.AccountID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + // Lists and filters private network routes in an account. func (r *TeamnetRouteService) List(ctx context.Context, params TeamnetRouteListParams, opts ...option.RequestOption) (res *shared.V4PagePaginationArray[TeamnetRouteListResponse], err error) { var raw *http.Response @@ -62,6 +75,72 @@ func (r *TeamnetRouteService) ListAutoPaging(ctx context.Context, params Teamnet return shared.NewV4PagePaginationArrayAutoPager(r.List(ctx, params, opts...)) } +// Deletes a private network route from an account. +func (r *TeamnetRouteService) Delete(ctx context.Context, routeID string, body TeamnetRouteDeleteParams, opts ...option.RequestOption) (res *TeamnetRouteDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + var env TeamnetRouteDeleteResponseEnvelope + path := fmt.Sprintf("accounts/%s/teamnet/routes/%s", body.AccountID, routeID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Updates an existing private network route in an account. The fields that are +// meant to be updated should be provided in the body of the request. +func (r *TeamnetRouteService) Edit(ctx context.Context, routeID string, params TeamnetRouteEditParams, opts ...option.RequestOption) (res *TeamnetRouteEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env TeamnetRouteEditResponseEnvelope + path := fmt.Sprintf("accounts/%s/teamnet/routes/%s", params.AccountID, routeID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +type TeamnetRouteNewResponse struct { + // UUID of the route. + ID string `json:"id"` + // Optional remark describing the route. + Comment string `json:"comment"` + // Timestamp of when the route was created. + CreatedAt interface{} `json:"created_at"` + // Timestamp of when the route was deleted. If `null`, the route has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // The private IPv4 or IPv6 range connected by the route, in CIDR notation. + Network string `json:"network"` + // UUID of the Cloudflare Tunnel serving the route. + TunnelID interface{} `json:"tunnel_id"` + // UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks + // are configured, the route is assigned to the default virtual network of the + // account. + VirtualNetworkID interface{} `json:"virtual_network_id"` + JSON teamnetRouteNewResponseJSON `json:"-"` +} + +// teamnetRouteNewResponseJSON contains the JSON metadata for the struct +// [TeamnetRouteNewResponse] +type teamnetRouteNewResponseJSON struct { + ID apijson.Field + Comment apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Network apijson.Field + TunnelID apijson.Field + VirtualNetworkID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *TeamnetRouteNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + type TeamnetRouteListResponse struct { // UUID of the route. ID string `json:"id"` @@ -121,6 +200,170 @@ const ( TeamnetRouteListResponseTunTypeCni TeamnetRouteListResponseTunType = "cni" ) +type TeamnetRouteDeleteResponse struct { + // UUID of the route. + ID string `json:"id"` + // Optional remark describing the route. + Comment string `json:"comment"` + // Timestamp of when the route was created. + CreatedAt interface{} `json:"created_at"` + // Timestamp of when the route was deleted. If `null`, the route has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // The private IPv4 or IPv6 range connected by the route, in CIDR notation. + Network string `json:"network"` + // UUID of the Cloudflare Tunnel serving the route. + TunnelID interface{} `json:"tunnel_id"` + // UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks + // are configured, the route is assigned to the default virtual network of the + // account. + VirtualNetworkID interface{} `json:"virtual_network_id"` + JSON teamnetRouteDeleteResponseJSON `json:"-"` +} + +// teamnetRouteDeleteResponseJSON contains the JSON metadata for the struct +// [TeamnetRouteDeleteResponse] +type teamnetRouteDeleteResponseJSON struct { + ID apijson.Field + Comment apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Network apijson.Field + TunnelID apijson.Field + VirtualNetworkID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *TeamnetRouteDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type TeamnetRouteEditResponse struct { + // UUID of the route. + ID string `json:"id"` + // Optional remark describing the route. + Comment string `json:"comment"` + // Timestamp of when the route was created. + CreatedAt interface{} `json:"created_at"` + // Timestamp of when the route was deleted. If `null`, the route has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // The private IPv4 or IPv6 range connected by the route, in CIDR notation. + Network string `json:"network"` + // UUID of the Cloudflare Tunnel serving the route. + TunnelID interface{} `json:"tunnel_id"` + // UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks + // are configured, the route is assigned to the default virtual network of the + // account. + VirtualNetworkID interface{} `json:"virtual_network_id"` + JSON teamnetRouteEditResponseJSON `json:"-"` +} + +// teamnetRouteEditResponseJSON contains the JSON metadata for the struct +// [TeamnetRouteEditResponse] +type teamnetRouteEditResponseJSON struct { + ID apijson.Field + Comment apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Network apijson.Field + TunnelID apijson.Field + VirtualNetworkID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *TeamnetRouteEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type TeamnetRouteNewParams struct { + // Cloudflare account ID + AccountID param.Field[string] `path:"account_id,required"` + // The private IPv4 or IPv6 range connected by the route, in CIDR notation. + IPNetwork param.Field[string] `json:"ip_network,required"` + // Optional remark describing the route. + Comment param.Field[string] `json:"comment"` + // UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks + // are configured, the route is assigned to the default virtual network of the + // account. + VirtualNetworkID param.Field[interface{}] `json:"virtual_network_id"` +} + +func (r TeamnetRouteNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type TeamnetRouteNewResponseEnvelope struct { + Errors []TeamnetRouteNewResponseEnvelopeErrors `json:"errors,required"` + Messages []TeamnetRouteNewResponseEnvelopeMessages `json:"messages,required"` + Result TeamnetRouteNewResponse `json:"result,required"` + // Whether the API call was successful + Success TeamnetRouteNewResponseEnvelopeSuccess `json:"success,required"` + JSON teamnetRouteNewResponseEnvelopeJSON `json:"-"` +} + +// teamnetRouteNewResponseEnvelopeJSON contains the JSON metadata for the struct +// [TeamnetRouteNewResponseEnvelope] +type teamnetRouteNewResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *TeamnetRouteNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type TeamnetRouteNewResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON teamnetRouteNewResponseEnvelopeErrorsJSON `json:"-"` +} + +// teamnetRouteNewResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [TeamnetRouteNewResponseEnvelopeErrors] +type teamnetRouteNewResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *TeamnetRouteNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type TeamnetRouteNewResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON teamnetRouteNewResponseEnvelopeMessagesJSON `json:"-"` +} + +// teamnetRouteNewResponseEnvelopeMessagesJSON contains the JSON metadata for the +// struct [TeamnetRouteNewResponseEnvelopeMessages] +type teamnetRouteNewResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *TeamnetRouteNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type TeamnetRouteNewResponseEnvelopeSuccess bool + +const ( + TeamnetRouteNewResponseEnvelopeSuccessTrue TeamnetRouteNewResponseEnvelopeSuccess = true +) + type TeamnetRouteListParams struct { // Cloudflare account ID AccountID param.Field[string] `path:"account_id,required"` @@ -157,3 +400,178 @@ func (r TeamnetRouteListParams) URLQuery() (v url.Values) { NestedFormat: apiquery.NestedQueryFormatBrackets, }) } + +type TeamnetRouteDeleteParams struct { + // Cloudflare account ID + AccountID param.Field[string] `path:"account_id,required"` +} + +type TeamnetRouteDeleteResponseEnvelope struct { + Errors []TeamnetRouteDeleteResponseEnvelopeErrors `json:"errors,required"` + Messages []TeamnetRouteDeleteResponseEnvelopeMessages `json:"messages,required"` + Result TeamnetRouteDeleteResponse `json:"result,required"` + // Whether the API call was successful + Success TeamnetRouteDeleteResponseEnvelopeSuccess `json:"success,required"` + JSON teamnetRouteDeleteResponseEnvelopeJSON `json:"-"` +} + +// teamnetRouteDeleteResponseEnvelopeJSON contains the JSON metadata for the struct +// [TeamnetRouteDeleteResponseEnvelope] +type teamnetRouteDeleteResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *TeamnetRouteDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type TeamnetRouteDeleteResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON teamnetRouteDeleteResponseEnvelopeErrorsJSON `json:"-"` +} + +// teamnetRouteDeleteResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [TeamnetRouteDeleteResponseEnvelopeErrors] +type teamnetRouteDeleteResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *TeamnetRouteDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type TeamnetRouteDeleteResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON teamnetRouteDeleteResponseEnvelopeMessagesJSON `json:"-"` +} + +// teamnetRouteDeleteResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [TeamnetRouteDeleteResponseEnvelopeMessages] +type teamnetRouteDeleteResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *TeamnetRouteDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type TeamnetRouteDeleteResponseEnvelopeSuccess bool + +const ( + TeamnetRouteDeleteResponseEnvelopeSuccessTrue TeamnetRouteDeleteResponseEnvelopeSuccess = true +) + +type TeamnetRouteEditParams struct { + // Cloudflare account ID + AccountID param.Field[string] `path:"account_id,required"` + // Optional remark describing the route. + Comment param.Field[string] `json:"comment"` + // The private IPv4 or IPv6 range connected by the route, in CIDR notation. + Network param.Field[string] `json:"network"` + // The type of tunnel. + TunType param.Field[TeamnetRouteEditParamsTunType] `json:"tun_type"` + // UUID of the Cloudflare Tunnel serving the route. + TunnelID param.Field[interface{}] `json:"tunnel_id"` + // UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks + // are configured, the route is assigned to the default virtual network of the + // account. + VirtualNetworkID param.Field[interface{}] `json:"virtual_network_id"` +} + +func (r TeamnetRouteEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The type of tunnel. +type TeamnetRouteEditParamsTunType string + +const ( + TeamnetRouteEditParamsTunTypeCfdTunnel TeamnetRouteEditParamsTunType = "cfd_tunnel" + TeamnetRouteEditParamsTunTypeWARPConnector TeamnetRouteEditParamsTunType = "warp_connector" + TeamnetRouteEditParamsTunTypeIPSec TeamnetRouteEditParamsTunType = "ip_sec" + TeamnetRouteEditParamsTunTypeGRE TeamnetRouteEditParamsTunType = "gre" + TeamnetRouteEditParamsTunTypeCni TeamnetRouteEditParamsTunType = "cni" +) + +type TeamnetRouteEditResponseEnvelope struct { + Errors []TeamnetRouteEditResponseEnvelopeErrors `json:"errors,required"` + Messages []TeamnetRouteEditResponseEnvelopeMessages `json:"messages,required"` + Result TeamnetRouteEditResponse `json:"result,required"` + // Whether the API call was successful + Success TeamnetRouteEditResponseEnvelopeSuccess `json:"success,required"` + JSON teamnetRouteEditResponseEnvelopeJSON `json:"-"` +} + +// teamnetRouteEditResponseEnvelopeJSON contains the JSON metadata for the struct +// [TeamnetRouteEditResponseEnvelope] +type teamnetRouteEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *TeamnetRouteEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type TeamnetRouteEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON teamnetRouteEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// teamnetRouteEditResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [TeamnetRouteEditResponseEnvelopeErrors] +type teamnetRouteEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *TeamnetRouteEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type TeamnetRouteEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON teamnetRouteEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// teamnetRouteEditResponseEnvelopeMessagesJSON contains the JSON metadata for the +// struct [TeamnetRouteEditResponseEnvelopeMessages] +type teamnetRouteEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *TeamnetRouteEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type TeamnetRouteEditResponseEnvelopeSuccess bool + +const ( + TeamnetRouteEditResponseEnvelopeSuccessTrue TeamnetRouteEditResponseEnvelopeSuccess = true +) diff --git a/teamnetroute_test.go b/teamnetroute_test.go index d3aa664842b..96f377c2526 100644 --- a/teamnetroute_test.go +++ b/teamnetroute_test.go @@ -13,6 +13,37 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) +func TestTeamnetRouteNewWithOptionalParams(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Teamnet.Routes.New(context.TODO(), cloudflare.TeamnetRouteNewParams{ + AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), + IPNetwork: cloudflare.F("172.16.0.0/16"), + Comment: cloudflare.F("Example comment for this route."), + VirtualNetworkID: cloudflare.F[any](map[string]interface{}{}), + }) + 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 TestTeamnetRouteListWithOptionalParams(t *testing.T) { t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" @@ -29,7 +60,7 @@ func TestTeamnetRouteListWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Teamnets.Routes.List(context.TODO(), cloudflare.TeamnetRouteListParams{ + _, err := client.Teamnet.Routes.List(context.TODO(), cloudflare.TeamnetRouteListParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), Comment: cloudflare.F("Example comment for this route."), ExistedAt: cloudflare.F[any](map[string]interface{}{}), @@ -50,3 +81,72 @@ func TestTeamnetRouteListWithOptionalParams(t *testing.T) { t.Fatalf("err should be nil: %s", err.Error()) } } + +func TestTeamnetRouteDelete(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Teamnet.Routes.Delete( + context.TODO(), + "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + cloudflare.TeamnetRouteDeleteParams{ + AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), + }, + ) + 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 TestTeamnetRouteEditWithOptionalParams(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Teamnet.Routes.Edit( + context.TODO(), + "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + cloudflare.TeamnetRouteEditParams{ + AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), + Comment: cloudflare.F("Example comment for this route."), + Network: cloudflare.F("172.16.0.0/16"), + TunType: cloudflare.F(cloudflare.TeamnetRouteEditParamsTunTypeCfdTunnel), + TunnelID: cloudflare.F[any](map[string]interface{}{}), + VirtualNetworkID: cloudflare.F[any](map[string]interface{}{}), + }, + ) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/teamnetrouteip_test.go b/teamnetrouteip_test.go index 4848d5b62fe..81f3e9d7949 100644 --- a/teamnetrouteip_test.go +++ b/teamnetrouteip_test.go @@ -29,7 +29,7 @@ func TestTeamnetRouteIPGetWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Teamnets.Routes.IPs.Get( + _, err := client.Teamnet.Routes.IPs.Get( context.TODO(), "10.1.0.137", cloudflare.TeamnetRouteIPGetParams{ diff --git a/teamnetroutenetwork_test.go b/teamnetroutenetwork_test.go index d7e6a09ef2e..bf0c749e92c 100644 --- a/teamnetroutenetwork_test.go +++ b/teamnetroutenetwork_test.go @@ -29,7 +29,7 @@ func TestTeamnetRouteNetworkNewWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Teamnets.Routes.Networks.New( + _, err := client.Teamnet.Routes.Networks.New( context.TODO(), "172.16.0.0%2F16", cloudflare.TeamnetRouteNetworkNewParams{ @@ -63,7 +63,7 @@ func TestTeamnetRouteNetworkDeleteWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Teamnets.Routes.Networks.Delete( + _, err := client.Teamnet.Routes.Networks.Delete( context.TODO(), "172.16.0.0%2F16", cloudflare.TeamnetRouteNetworkDeleteParams{ @@ -96,7 +96,7 @@ func TestTeamnetRouteNetworkEdit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Teamnets.Routes.Networks.Edit( + _, err := client.Teamnet.Routes.Networks.Edit( context.TODO(), "172.16.0.0%2F16", cloudflare.TeamnetRouteNetworkEditParams{ diff --git a/teamnetvirtualnetwork_test.go b/teamnetvirtualnetwork_test.go index fde7007986b..f7cd3d09a47 100644 --- a/teamnetvirtualnetwork_test.go +++ b/teamnetvirtualnetwork_test.go @@ -29,7 +29,7 @@ func TestTeamnetVirtualNetworkNewWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Teamnets.VirtualNetworks.New(context.TODO(), cloudflare.TeamnetVirtualNetworkNewParams{ + _, err := client.Teamnet.VirtualNetworks.New(context.TODO(), cloudflare.TeamnetVirtualNetworkNewParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), Name: cloudflare.F("us-east-1-vpc"), Comment: cloudflare.F("Staging VPC for data science"), @@ -60,7 +60,7 @@ func TestTeamnetVirtualNetworkListWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Teamnets.VirtualNetworks.List(context.TODO(), cloudflare.TeamnetVirtualNetworkListParams{ + _, err := client.Teamnet.VirtualNetworks.List(context.TODO(), cloudflare.TeamnetVirtualNetworkListParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), IsDefault: cloudflare.F[any](map[string]interface{}{}), IsDeleted: cloudflare.F[any](map[string]interface{}{}), @@ -92,7 +92,7 @@ func TestTeamnetVirtualNetworkDelete(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Teamnets.VirtualNetworks.Delete( + _, err := client.Teamnet.VirtualNetworks.Delete( context.TODO(), "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", cloudflare.TeamnetVirtualNetworkDeleteParams{ @@ -124,7 +124,7 @@ func TestTeamnetVirtualNetworkEditWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Teamnets.VirtualNetworks.Edit( + _, err := client.Teamnet.VirtualNetworks.Edit( context.TODO(), "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", cloudflare.TeamnetVirtualNetworkEditParams{ diff --git a/tunnel.go b/tunnel.go index 0a8520f869f..ea91ec4e65d 100644 --- a/tunnel.go +++ b/tunnel.go @@ -26,7 +26,7 @@ type TunnelService struct { Options []option.RequestOption Configurations *TunnelConfigurationService Connections *TunnelConnectionService - Tokens *TunnelTokenService + Token *TunnelTokenService Connectors *TunnelConnectorService Management *TunnelManagementService } @@ -39,7 +39,7 @@ func NewTunnelService(opts ...option.RequestOption) (r *TunnelService) { r.Options = opts r.Configurations = NewTunnelConfigurationService(opts...) r.Connections = NewTunnelConnectionService(opts...) - r.Tokens = NewTunnelTokenService(opts...) + r.Token = NewTunnelTokenService(opts...) r.Connectors = NewTunnelConnectorService(opts...) r.Management = NewTunnelManagementService(opts...) return diff --git a/tunneltoken_test.go b/tunneltoken_test.go index 85e6706010c..90f85a32495 100644 --- a/tunneltoken_test.go +++ b/tunneltoken_test.go @@ -29,7 +29,7 @@ func TestTunnelTokenGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Tunnels.Tokens.Get( + _, err := client.Tunnels.Token.Get( context.TODO(), "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", cloudflare.TunnelTokenGetParams{ diff --git a/user.go b/user.go index eacd6adf6e4..226adfe1027 100644 --- a/user.go +++ b/user.go @@ -20,16 +20,15 @@ import ( // from the environment automatically. You should not instantiate this service // directly, and instead use the [NewUserService] method instead. type UserService struct { - Options []option.RequestOption - AuditLogs *UserAuditLogService - Billing *UserBillingService - Firewall *UserFirewallService - Invites *UserInviteService - LoadBalancers *UserLoadBalancerService - LoadBalancingAnalytics *UserLoadBalancingAnalyticService - Organizations *UserOrganizationService - Subscriptions *UserSubscriptionService - Tokens *UserTokenService + Options []option.RequestOption + AuditLogs *UserAuditLogService + Billing *UserBillingService + Firewall *UserFirewallService + Invites *UserInviteService + LoadBalancers *UserLoadBalancerService + Organizations *UserOrganizationService + Subscriptions *UserSubscriptionService + Tokens *UserTokenService } // NewUserService generates a new service that applies the given options to each @@ -43,7 +42,6 @@ func NewUserService(opts ...option.RequestOption) (r *UserService) { r.Firewall = NewUserFirewallService(opts...) r.Invites = NewUserInviteService(opts...) r.LoadBalancers = NewUserLoadBalancerService(opts...) - r.LoadBalancingAnalytics = NewUserLoadBalancingAnalyticService(opts...) r.Organizations = NewUserOrganizationService(opts...) r.Subscriptions = NewUserSubscriptionService(opts...) r.Tokens = NewUserTokenService(opts...) diff --git a/userfirewallaccessrule.go b/userfirewallaccessrule.go index 3edaccb9653..031b3ecf024 100644 --- a/userfirewallaccessrule.go +++ b/userfirewallaccessrule.go @@ -3,6 +3,18 @@ package cloudflare import ( + "context" + "fmt" + "net/http" + "net/url" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" "github.com/cloudflare/cloudflare-sdk-go/option" ) @@ -13,7 +25,6 @@ import ( // method instead. type UserFirewallAccessRuleService struct { Options []option.RequestOption - Rules *UserFirewallAccessRuleRuleService } // NewUserFirewallAccessRuleService generates a new service that applies the given @@ -22,6 +33,1344 @@ type UserFirewallAccessRuleService struct { func NewUserFirewallAccessRuleService(opts ...option.RequestOption) (r *UserFirewallAccessRuleService) { r = &UserFirewallAccessRuleService{} r.Options = opts - r.Rules = NewUserFirewallAccessRuleRuleService(opts...) return } + +// Creates a new IP Access rule for all zones owned by the current user. +// +// Note: To create an IP Access rule that applies to a specific zone, refer to the +// [IP Access rules for a zone](#ip-access-rules-for-a-zone) endpoints. +func (r *UserFirewallAccessRuleService) New(ctx context.Context, body UserFirewallAccessRuleNewParams, opts ...option.RequestOption) (res *UserFirewallAccessRuleNewResponse, err error) { + opts = append(r.Options[:], opts...) + var env UserFirewallAccessRuleNewResponseEnvelope + path := "user/firewall/access_rules/rules" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Fetches IP Access rules of the user. You can filter the results using several +// optional parameters. +func (r *UserFirewallAccessRuleService) List(ctx context.Context, query UserFirewallAccessRuleListParams, opts ...option.RequestOption) (res *shared.V4PagePaginationArray[UserFirewallAccessRuleListResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := "user/firewall/access_rules/rules" + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +// Fetches IP Access rules of the user. You can filter the results using several +// optional parameters. +func (r *UserFirewallAccessRuleService) ListAutoPaging(ctx context.Context, query UserFirewallAccessRuleListParams, opts ...option.RequestOption) *shared.V4PagePaginationArrayAutoPager[UserFirewallAccessRuleListResponse] { + return shared.NewV4PagePaginationArrayAutoPager(r.List(ctx, query, opts...)) +} + +// Deletes an IP Access rule at the user level. +// +// Note: Deleting a user-level rule will affect all zones owned by the user. +func (r *UserFirewallAccessRuleService) Delete(ctx context.Context, identifier string, opts ...option.RequestOption) (res *UserFirewallAccessRuleDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + var env UserFirewallAccessRuleDeleteResponseEnvelope + path := fmt.Sprintf("user/firewall/access_rules/rules/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Updates an IP Access rule defined at the user level. You can only update the +// rule action (`mode` parameter) and notes. +func (r *UserFirewallAccessRuleService) Edit(ctx context.Context, identifier string, body UserFirewallAccessRuleEditParams, opts ...option.RequestOption) (res *UserFirewallAccessRuleEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env UserFirewallAccessRuleEditResponseEnvelope + path := fmt.Sprintf("user/firewall/access_rules/rules/%s", identifier) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +type UserFirewallAccessRuleNewResponse struct { + // The unique identifier of the IP Access rule. + ID string `json:"id,required"` + // The available actions that a rule can apply to a matched request. + AllowedModes []UserFirewallAccessRuleNewResponseAllowedMode `json:"allowed_modes,required"` + // The rule configuration. + Configuration UserFirewallAccessRuleNewResponseConfiguration `json:"configuration,required"` + // The action to apply to a matched request. + Mode UserFirewallAccessRuleNewResponseMode `json:"mode,required"` + // The timestamp of when the rule was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // The timestamp of when the rule was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // An informative summary of the rule, typically used as a reminder or explanation. + Notes string `json:"notes"` + JSON userFirewallAccessRuleNewResponseJSON `json:"-"` +} + +// userFirewallAccessRuleNewResponseJSON contains the JSON metadata for the struct +// [UserFirewallAccessRuleNewResponse] +type userFirewallAccessRuleNewResponseJSON struct { + ID apijson.Field + AllowedModes apijson.Field + Configuration apijson.Field + Mode apijson.Field + CreatedOn apijson.Field + ModifiedOn apijson.Field + Notes apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to apply to a matched request. +type UserFirewallAccessRuleNewResponseAllowedMode string + +const ( + UserFirewallAccessRuleNewResponseAllowedModeBlock UserFirewallAccessRuleNewResponseAllowedMode = "block" + UserFirewallAccessRuleNewResponseAllowedModeChallenge UserFirewallAccessRuleNewResponseAllowedMode = "challenge" + UserFirewallAccessRuleNewResponseAllowedModeWhitelist UserFirewallAccessRuleNewResponseAllowedMode = "whitelist" + UserFirewallAccessRuleNewResponseAllowedModeJsChallenge UserFirewallAccessRuleNewResponseAllowedMode = "js_challenge" + UserFirewallAccessRuleNewResponseAllowedModeManagedChallenge UserFirewallAccessRuleNewResponseAllowedMode = "managed_challenge" +) + +// The rule configuration. +// +// Union satisfied by +// [UserFirewallAccessRuleNewResponseConfigurationLegacyJhsIPConfiguration], +// [UserFirewallAccessRuleNewResponseConfigurationLegacyJhsIPV6Configuration], +// [UserFirewallAccessRuleNewResponseConfigurationLegacyJhsCidrConfiguration], +// [UserFirewallAccessRuleNewResponseConfigurationLegacyJhsASNConfiguration] or +// [UserFirewallAccessRuleNewResponseConfigurationLegacyJhsCountryConfiguration]. +type UserFirewallAccessRuleNewResponseConfiguration interface { + implementsUserFirewallAccessRuleNewResponseConfiguration() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*UserFirewallAccessRuleNewResponseConfiguration)(nil)).Elem(), "") +} + +type UserFirewallAccessRuleNewResponseConfigurationLegacyJhsIPConfiguration struct { + // The configuration target. You must set the target to `ip` when specifying an IP + // address in the rule. + Target UserFirewallAccessRuleNewResponseConfigurationLegacyJhsIPConfigurationTarget `json:"target"` + // The IP address to match. This address will be compared to the IP address of + // incoming requests. + Value string `json:"value"` + JSON userFirewallAccessRuleNewResponseConfigurationLegacyJhsIPConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleNewResponseConfigurationLegacyJhsIPConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleNewResponseConfigurationLegacyJhsIPConfiguration] +type userFirewallAccessRuleNewResponseConfigurationLegacyJhsIPConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleNewResponseConfigurationLegacyJhsIPConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleNewResponseConfigurationLegacyJhsIPConfiguration) implementsUserFirewallAccessRuleNewResponseConfiguration() { +} + +// The configuration target. You must set the target to `ip` when specifying an IP +// address in the rule. +type UserFirewallAccessRuleNewResponseConfigurationLegacyJhsIPConfigurationTarget string + +const ( + UserFirewallAccessRuleNewResponseConfigurationLegacyJhsIPConfigurationTargetIP UserFirewallAccessRuleNewResponseConfigurationLegacyJhsIPConfigurationTarget = "ip" +) + +type UserFirewallAccessRuleNewResponseConfigurationLegacyJhsIPV6Configuration struct { + // The configuration target. You must set the target to `ip6` when specifying an + // IPv6 address in the rule. + Target UserFirewallAccessRuleNewResponseConfigurationLegacyJhsIPV6ConfigurationTarget `json:"target"` + // The IPv6 address to match. + Value string `json:"value"` + JSON userFirewallAccessRuleNewResponseConfigurationLegacyJhsIPV6ConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleNewResponseConfigurationLegacyJhsIPV6ConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleNewResponseConfigurationLegacyJhsIPV6Configuration] +type userFirewallAccessRuleNewResponseConfigurationLegacyJhsIPV6ConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleNewResponseConfigurationLegacyJhsIPV6Configuration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleNewResponseConfigurationLegacyJhsIPV6Configuration) implementsUserFirewallAccessRuleNewResponseConfiguration() { +} + +// The configuration target. You must set the target to `ip6` when specifying an +// IPv6 address in the rule. +type UserFirewallAccessRuleNewResponseConfigurationLegacyJhsIPV6ConfigurationTarget string + +const ( + UserFirewallAccessRuleNewResponseConfigurationLegacyJhsIPV6ConfigurationTargetIp6 UserFirewallAccessRuleNewResponseConfigurationLegacyJhsIPV6ConfigurationTarget = "ip6" +) + +type UserFirewallAccessRuleNewResponseConfigurationLegacyJhsCidrConfiguration struct { + // The configuration target. You must set the target to `ip_range` when specifying + // an IP address range in the rule. + Target UserFirewallAccessRuleNewResponseConfigurationLegacyJhsCidrConfigurationTarget `json:"target"` + // The IP address range to match. You can only use prefix lengths `/16` and `/24` + // for IPv4 ranges, and prefix lengths `/32`, `/48`, and `/64` for IPv6 ranges. + Value string `json:"value"` + JSON userFirewallAccessRuleNewResponseConfigurationLegacyJhsCidrConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleNewResponseConfigurationLegacyJhsCidrConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleNewResponseConfigurationLegacyJhsCidrConfiguration] +type userFirewallAccessRuleNewResponseConfigurationLegacyJhsCidrConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleNewResponseConfigurationLegacyJhsCidrConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleNewResponseConfigurationLegacyJhsCidrConfiguration) implementsUserFirewallAccessRuleNewResponseConfiguration() { +} + +// The configuration target. You must set the target to `ip_range` when specifying +// an IP address range in the rule. +type UserFirewallAccessRuleNewResponseConfigurationLegacyJhsCidrConfigurationTarget string + +const ( + UserFirewallAccessRuleNewResponseConfigurationLegacyJhsCidrConfigurationTargetIPRange UserFirewallAccessRuleNewResponseConfigurationLegacyJhsCidrConfigurationTarget = "ip_range" +) + +type UserFirewallAccessRuleNewResponseConfigurationLegacyJhsASNConfiguration struct { + // The configuration target. You must set the target to `asn` when specifying an + // Autonomous System Number (ASN) in the rule. + Target UserFirewallAccessRuleNewResponseConfigurationLegacyJhsASNConfigurationTarget `json:"target"` + // The AS number to match. + Value string `json:"value"` + JSON userFirewallAccessRuleNewResponseConfigurationLegacyJhsASNConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleNewResponseConfigurationLegacyJhsASNConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleNewResponseConfigurationLegacyJhsASNConfiguration] +type userFirewallAccessRuleNewResponseConfigurationLegacyJhsASNConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleNewResponseConfigurationLegacyJhsASNConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleNewResponseConfigurationLegacyJhsASNConfiguration) implementsUserFirewallAccessRuleNewResponseConfiguration() { +} + +// The configuration target. You must set the target to `asn` when specifying an +// Autonomous System Number (ASN) in the rule. +type UserFirewallAccessRuleNewResponseConfigurationLegacyJhsASNConfigurationTarget string + +const ( + UserFirewallAccessRuleNewResponseConfigurationLegacyJhsASNConfigurationTargetASN UserFirewallAccessRuleNewResponseConfigurationLegacyJhsASNConfigurationTarget = "asn" +) + +type UserFirewallAccessRuleNewResponseConfigurationLegacyJhsCountryConfiguration struct { + // The configuration target. You must set the target to `country` when specifying a + // country code in the rule. + Target UserFirewallAccessRuleNewResponseConfigurationLegacyJhsCountryConfigurationTarget `json:"target"` + // The two-letter ISO-3166-1 alpha-2 code to match. For more information, refer to + // [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country). + Value string `json:"value"` + JSON userFirewallAccessRuleNewResponseConfigurationLegacyJhsCountryConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleNewResponseConfigurationLegacyJhsCountryConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleNewResponseConfigurationLegacyJhsCountryConfiguration] +type userFirewallAccessRuleNewResponseConfigurationLegacyJhsCountryConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleNewResponseConfigurationLegacyJhsCountryConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleNewResponseConfigurationLegacyJhsCountryConfiguration) implementsUserFirewallAccessRuleNewResponseConfiguration() { +} + +// The configuration target. You must set the target to `country` when specifying a +// country code in the rule. +type UserFirewallAccessRuleNewResponseConfigurationLegacyJhsCountryConfigurationTarget string + +const ( + UserFirewallAccessRuleNewResponseConfigurationLegacyJhsCountryConfigurationTargetCountry UserFirewallAccessRuleNewResponseConfigurationLegacyJhsCountryConfigurationTarget = "country" +) + +// The action to apply to a matched request. +type UserFirewallAccessRuleNewResponseMode string + +const ( + UserFirewallAccessRuleNewResponseModeBlock UserFirewallAccessRuleNewResponseMode = "block" + UserFirewallAccessRuleNewResponseModeChallenge UserFirewallAccessRuleNewResponseMode = "challenge" + UserFirewallAccessRuleNewResponseModeWhitelist UserFirewallAccessRuleNewResponseMode = "whitelist" + UserFirewallAccessRuleNewResponseModeJsChallenge UserFirewallAccessRuleNewResponseMode = "js_challenge" + UserFirewallAccessRuleNewResponseModeManagedChallenge UserFirewallAccessRuleNewResponseMode = "managed_challenge" +) + +type UserFirewallAccessRuleListResponse struct { + // The unique identifier of the IP Access rule. + ID string `json:"id,required"` + // The available actions that a rule can apply to a matched request. + AllowedModes []UserFirewallAccessRuleListResponseAllowedMode `json:"allowed_modes,required"` + // The rule configuration. + Configuration UserFirewallAccessRuleListResponseConfiguration `json:"configuration,required"` + // The action to apply to a matched request. + Mode UserFirewallAccessRuleListResponseMode `json:"mode,required"` + // The timestamp of when the rule was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // The timestamp of when the rule was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // An informative summary of the rule, typically used as a reminder or explanation. + Notes string `json:"notes"` + JSON userFirewallAccessRuleListResponseJSON `json:"-"` +} + +// userFirewallAccessRuleListResponseJSON contains the JSON metadata for the struct +// [UserFirewallAccessRuleListResponse] +type userFirewallAccessRuleListResponseJSON struct { + ID apijson.Field + AllowedModes apijson.Field + Configuration apijson.Field + Mode apijson.Field + CreatedOn apijson.Field + ModifiedOn apijson.Field + Notes apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to apply to a matched request. +type UserFirewallAccessRuleListResponseAllowedMode string + +const ( + UserFirewallAccessRuleListResponseAllowedModeBlock UserFirewallAccessRuleListResponseAllowedMode = "block" + UserFirewallAccessRuleListResponseAllowedModeChallenge UserFirewallAccessRuleListResponseAllowedMode = "challenge" + UserFirewallAccessRuleListResponseAllowedModeWhitelist UserFirewallAccessRuleListResponseAllowedMode = "whitelist" + UserFirewallAccessRuleListResponseAllowedModeJsChallenge UserFirewallAccessRuleListResponseAllowedMode = "js_challenge" + UserFirewallAccessRuleListResponseAllowedModeManagedChallenge UserFirewallAccessRuleListResponseAllowedMode = "managed_challenge" +) + +// The rule configuration. +// +// Union satisfied by +// [UserFirewallAccessRuleListResponseConfigurationLegacyJhsIPConfiguration], +// [UserFirewallAccessRuleListResponseConfigurationLegacyJhsIPV6Configuration], +// [UserFirewallAccessRuleListResponseConfigurationLegacyJhsCidrConfiguration], +// [UserFirewallAccessRuleListResponseConfigurationLegacyJhsASNConfiguration] or +// [UserFirewallAccessRuleListResponseConfigurationLegacyJhsCountryConfiguration]. +type UserFirewallAccessRuleListResponseConfiguration interface { + implementsUserFirewallAccessRuleListResponseConfiguration() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*UserFirewallAccessRuleListResponseConfiguration)(nil)).Elem(), "") +} + +type UserFirewallAccessRuleListResponseConfigurationLegacyJhsIPConfiguration struct { + // The configuration target. You must set the target to `ip` when specifying an IP + // address in the rule. + Target UserFirewallAccessRuleListResponseConfigurationLegacyJhsIPConfigurationTarget `json:"target"` + // The IP address to match. This address will be compared to the IP address of + // incoming requests. + Value string `json:"value"` + JSON userFirewallAccessRuleListResponseConfigurationLegacyJhsIPConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleListResponseConfigurationLegacyJhsIPConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleListResponseConfigurationLegacyJhsIPConfiguration] +type userFirewallAccessRuleListResponseConfigurationLegacyJhsIPConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleListResponseConfigurationLegacyJhsIPConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleListResponseConfigurationLegacyJhsIPConfiguration) implementsUserFirewallAccessRuleListResponseConfiguration() { +} + +// The configuration target. You must set the target to `ip` when specifying an IP +// address in the rule. +type UserFirewallAccessRuleListResponseConfigurationLegacyJhsIPConfigurationTarget string + +const ( + UserFirewallAccessRuleListResponseConfigurationLegacyJhsIPConfigurationTargetIP UserFirewallAccessRuleListResponseConfigurationLegacyJhsIPConfigurationTarget = "ip" +) + +type UserFirewallAccessRuleListResponseConfigurationLegacyJhsIPV6Configuration struct { + // The configuration target. You must set the target to `ip6` when specifying an + // IPv6 address in the rule. + Target UserFirewallAccessRuleListResponseConfigurationLegacyJhsIPV6ConfigurationTarget `json:"target"` + // The IPv6 address to match. + Value string `json:"value"` + JSON userFirewallAccessRuleListResponseConfigurationLegacyJhsIPV6ConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleListResponseConfigurationLegacyJhsIPV6ConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleListResponseConfigurationLegacyJhsIPV6Configuration] +type userFirewallAccessRuleListResponseConfigurationLegacyJhsIPV6ConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleListResponseConfigurationLegacyJhsIPV6Configuration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleListResponseConfigurationLegacyJhsIPV6Configuration) implementsUserFirewallAccessRuleListResponseConfiguration() { +} + +// The configuration target. You must set the target to `ip6` when specifying an +// IPv6 address in the rule. +type UserFirewallAccessRuleListResponseConfigurationLegacyJhsIPV6ConfigurationTarget string + +const ( + UserFirewallAccessRuleListResponseConfigurationLegacyJhsIPV6ConfigurationTargetIp6 UserFirewallAccessRuleListResponseConfigurationLegacyJhsIPV6ConfigurationTarget = "ip6" +) + +type UserFirewallAccessRuleListResponseConfigurationLegacyJhsCidrConfiguration struct { + // The configuration target. You must set the target to `ip_range` when specifying + // an IP address range in the rule. + Target UserFirewallAccessRuleListResponseConfigurationLegacyJhsCidrConfigurationTarget `json:"target"` + // The IP address range to match. You can only use prefix lengths `/16` and `/24` + // for IPv4 ranges, and prefix lengths `/32`, `/48`, and `/64` for IPv6 ranges. + Value string `json:"value"` + JSON userFirewallAccessRuleListResponseConfigurationLegacyJhsCidrConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleListResponseConfigurationLegacyJhsCidrConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleListResponseConfigurationLegacyJhsCidrConfiguration] +type userFirewallAccessRuleListResponseConfigurationLegacyJhsCidrConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleListResponseConfigurationLegacyJhsCidrConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleListResponseConfigurationLegacyJhsCidrConfiguration) implementsUserFirewallAccessRuleListResponseConfiguration() { +} + +// The configuration target. You must set the target to `ip_range` when specifying +// an IP address range in the rule. +type UserFirewallAccessRuleListResponseConfigurationLegacyJhsCidrConfigurationTarget string + +const ( + UserFirewallAccessRuleListResponseConfigurationLegacyJhsCidrConfigurationTargetIPRange UserFirewallAccessRuleListResponseConfigurationLegacyJhsCidrConfigurationTarget = "ip_range" +) + +type UserFirewallAccessRuleListResponseConfigurationLegacyJhsASNConfiguration struct { + // The configuration target. You must set the target to `asn` when specifying an + // Autonomous System Number (ASN) in the rule. + Target UserFirewallAccessRuleListResponseConfigurationLegacyJhsASNConfigurationTarget `json:"target"` + // The AS number to match. + Value string `json:"value"` + JSON userFirewallAccessRuleListResponseConfigurationLegacyJhsASNConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleListResponseConfigurationLegacyJhsASNConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleListResponseConfigurationLegacyJhsASNConfiguration] +type userFirewallAccessRuleListResponseConfigurationLegacyJhsASNConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleListResponseConfigurationLegacyJhsASNConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleListResponseConfigurationLegacyJhsASNConfiguration) implementsUserFirewallAccessRuleListResponseConfiguration() { +} + +// The configuration target. You must set the target to `asn` when specifying an +// Autonomous System Number (ASN) in the rule. +type UserFirewallAccessRuleListResponseConfigurationLegacyJhsASNConfigurationTarget string + +const ( + UserFirewallAccessRuleListResponseConfigurationLegacyJhsASNConfigurationTargetASN UserFirewallAccessRuleListResponseConfigurationLegacyJhsASNConfigurationTarget = "asn" +) + +type UserFirewallAccessRuleListResponseConfigurationLegacyJhsCountryConfiguration struct { + // The configuration target. You must set the target to `country` when specifying a + // country code in the rule. + Target UserFirewallAccessRuleListResponseConfigurationLegacyJhsCountryConfigurationTarget `json:"target"` + // The two-letter ISO-3166-1 alpha-2 code to match. For more information, refer to + // [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country). + Value string `json:"value"` + JSON userFirewallAccessRuleListResponseConfigurationLegacyJhsCountryConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleListResponseConfigurationLegacyJhsCountryConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleListResponseConfigurationLegacyJhsCountryConfiguration] +type userFirewallAccessRuleListResponseConfigurationLegacyJhsCountryConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleListResponseConfigurationLegacyJhsCountryConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleListResponseConfigurationLegacyJhsCountryConfiguration) implementsUserFirewallAccessRuleListResponseConfiguration() { +} + +// The configuration target. You must set the target to `country` when specifying a +// country code in the rule. +type UserFirewallAccessRuleListResponseConfigurationLegacyJhsCountryConfigurationTarget string + +const ( + UserFirewallAccessRuleListResponseConfigurationLegacyJhsCountryConfigurationTargetCountry UserFirewallAccessRuleListResponseConfigurationLegacyJhsCountryConfigurationTarget = "country" +) + +// The action to apply to a matched request. +type UserFirewallAccessRuleListResponseMode string + +const ( + UserFirewallAccessRuleListResponseModeBlock UserFirewallAccessRuleListResponseMode = "block" + UserFirewallAccessRuleListResponseModeChallenge UserFirewallAccessRuleListResponseMode = "challenge" + UserFirewallAccessRuleListResponseModeWhitelist UserFirewallAccessRuleListResponseMode = "whitelist" + UserFirewallAccessRuleListResponseModeJsChallenge UserFirewallAccessRuleListResponseMode = "js_challenge" + UserFirewallAccessRuleListResponseModeManagedChallenge UserFirewallAccessRuleListResponseMode = "managed_challenge" +) + +type UserFirewallAccessRuleDeleteResponse struct { + // The unique identifier of the IP Access rule. + ID string `json:"id"` + JSON userFirewallAccessRuleDeleteResponseJSON `json:"-"` +} + +// userFirewallAccessRuleDeleteResponseJSON contains the JSON metadata for the +// struct [UserFirewallAccessRuleDeleteResponse] +type userFirewallAccessRuleDeleteResponseJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserFirewallAccessRuleEditResponse struct { + // The unique identifier of the IP Access rule. + ID string `json:"id,required"` + // The available actions that a rule can apply to a matched request. + AllowedModes []UserFirewallAccessRuleEditResponseAllowedMode `json:"allowed_modes,required"` + // The rule configuration. + Configuration UserFirewallAccessRuleEditResponseConfiguration `json:"configuration,required"` + // The action to apply to a matched request. + Mode UserFirewallAccessRuleEditResponseMode `json:"mode,required"` + // The timestamp of when the rule was created. + CreatedOn time.Time `json:"created_on" format:"date-time"` + // The timestamp of when the rule was last modified. + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // An informative summary of the rule, typically used as a reminder or explanation. + Notes string `json:"notes"` + JSON userFirewallAccessRuleEditResponseJSON `json:"-"` +} + +// userFirewallAccessRuleEditResponseJSON contains the JSON metadata for the struct +// [UserFirewallAccessRuleEditResponse] +type userFirewallAccessRuleEditResponseJSON struct { + ID apijson.Field + AllowedModes apijson.Field + Configuration apijson.Field + Mode apijson.Field + CreatedOn apijson.Field + ModifiedOn apijson.Field + Notes apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// The action to apply to a matched request. +type UserFirewallAccessRuleEditResponseAllowedMode string + +const ( + UserFirewallAccessRuleEditResponseAllowedModeBlock UserFirewallAccessRuleEditResponseAllowedMode = "block" + UserFirewallAccessRuleEditResponseAllowedModeChallenge UserFirewallAccessRuleEditResponseAllowedMode = "challenge" + UserFirewallAccessRuleEditResponseAllowedModeWhitelist UserFirewallAccessRuleEditResponseAllowedMode = "whitelist" + UserFirewallAccessRuleEditResponseAllowedModeJsChallenge UserFirewallAccessRuleEditResponseAllowedMode = "js_challenge" + UserFirewallAccessRuleEditResponseAllowedModeManagedChallenge UserFirewallAccessRuleEditResponseAllowedMode = "managed_challenge" +) + +// The rule configuration. +// +// Union satisfied by +// [UserFirewallAccessRuleEditResponseConfigurationLegacyJhsIPConfiguration], +// [UserFirewallAccessRuleEditResponseConfigurationLegacyJhsIPV6Configuration], +// [UserFirewallAccessRuleEditResponseConfigurationLegacyJhsCidrConfiguration], +// [UserFirewallAccessRuleEditResponseConfigurationLegacyJhsASNConfiguration] or +// [UserFirewallAccessRuleEditResponseConfigurationLegacyJhsCountryConfiguration]. +type UserFirewallAccessRuleEditResponseConfiguration interface { + implementsUserFirewallAccessRuleEditResponseConfiguration() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*UserFirewallAccessRuleEditResponseConfiguration)(nil)).Elem(), "") +} + +type UserFirewallAccessRuleEditResponseConfigurationLegacyJhsIPConfiguration struct { + // The configuration target. You must set the target to `ip` when specifying an IP + // address in the rule. + Target UserFirewallAccessRuleEditResponseConfigurationLegacyJhsIPConfigurationTarget `json:"target"` + // The IP address to match. This address will be compared to the IP address of + // incoming requests. + Value string `json:"value"` + JSON userFirewallAccessRuleEditResponseConfigurationLegacyJhsIPConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleEditResponseConfigurationLegacyJhsIPConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleEditResponseConfigurationLegacyJhsIPConfiguration] +type userFirewallAccessRuleEditResponseConfigurationLegacyJhsIPConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleEditResponseConfigurationLegacyJhsIPConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleEditResponseConfigurationLegacyJhsIPConfiguration) implementsUserFirewallAccessRuleEditResponseConfiguration() { +} + +// The configuration target. You must set the target to `ip` when specifying an IP +// address in the rule. +type UserFirewallAccessRuleEditResponseConfigurationLegacyJhsIPConfigurationTarget string + +const ( + UserFirewallAccessRuleEditResponseConfigurationLegacyJhsIPConfigurationTargetIP UserFirewallAccessRuleEditResponseConfigurationLegacyJhsIPConfigurationTarget = "ip" +) + +type UserFirewallAccessRuleEditResponseConfigurationLegacyJhsIPV6Configuration struct { + // The configuration target. You must set the target to `ip6` when specifying an + // IPv6 address in the rule. + Target UserFirewallAccessRuleEditResponseConfigurationLegacyJhsIPV6ConfigurationTarget `json:"target"` + // The IPv6 address to match. + Value string `json:"value"` + JSON userFirewallAccessRuleEditResponseConfigurationLegacyJhsIPV6ConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleEditResponseConfigurationLegacyJhsIPV6ConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleEditResponseConfigurationLegacyJhsIPV6Configuration] +type userFirewallAccessRuleEditResponseConfigurationLegacyJhsIPV6ConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleEditResponseConfigurationLegacyJhsIPV6Configuration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleEditResponseConfigurationLegacyJhsIPV6Configuration) implementsUserFirewallAccessRuleEditResponseConfiguration() { +} + +// The configuration target. You must set the target to `ip6` when specifying an +// IPv6 address in the rule. +type UserFirewallAccessRuleEditResponseConfigurationLegacyJhsIPV6ConfigurationTarget string + +const ( + UserFirewallAccessRuleEditResponseConfigurationLegacyJhsIPV6ConfigurationTargetIp6 UserFirewallAccessRuleEditResponseConfigurationLegacyJhsIPV6ConfigurationTarget = "ip6" +) + +type UserFirewallAccessRuleEditResponseConfigurationLegacyJhsCidrConfiguration struct { + // The configuration target. You must set the target to `ip_range` when specifying + // an IP address range in the rule. + Target UserFirewallAccessRuleEditResponseConfigurationLegacyJhsCidrConfigurationTarget `json:"target"` + // The IP address range to match. You can only use prefix lengths `/16` and `/24` + // for IPv4 ranges, and prefix lengths `/32`, `/48`, and `/64` for IPv6 ranges. + Value string `json:"value"` + JSON userFirewallAccessRuleEditResponseConfigurationLegacyJhsCidrConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleEditResponseConfigurationLegacyJhsCidrConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleEditResponseConfigurationLegacyJhsCidrConfiguration] +type userFirewallAccessRuleEditResponseConfigurationLegacyJhsCidrConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleEditResponseConfigurationLegacyJhsCidrConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleEditResponseConfigurationLegacyJhsCidrConfiguration) implementsUserFirewallAccessRuleEditResponseConfiguration() { +} + +// The configuration target. You must set the target to `ip_range` when specifying +// an IP address range in the rule. +type UserFirewallAccessRuleEditResponseConfigurationLegacyJhsCidrConfigurationTarget string + +const ( + UserFirewallAccessRuleEditResponseConfigurationLegacyJhsCidrConfigurationTargetIPRange UserFirewallAccessRuleEditResponseConfigurationLegacyJhsCidrConfigurationTarget = "ip_range" +) + +type UserFirewallAccessRuleEditResponseConfigurationLegacyJhsASNConfiguration struct { + // The configuration target. You must set the target to `asn` when specifying an + // Autonomous System Number (ASN) in the rule. + Target UserFirewallAccessRuleEditResponseConfigurationLegacyJhsASNConfigurationTarget `json:"target"` + // The AS number to match. + Value string `json:"value"` + JSON userFirewallAccessRuleEditResponseConfigurationLegacyJhsASNConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleEditResponseConfigurationLegacyJhsASNConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleEditResponseConfigurationLegacyJhsASNConfiguration] +type userFirewallAccessRuleEditResponseConfigurationLegacyJhsASNConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleEditResponseConfigurationLegacyJhsASNConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleEditResponseConfigurationLegacyJhsASNConfiguration) implementsUserFirewallAccessRuleEditResponseConfiguration() { +} + +// The configuration target. You must set the target to `asn` when specifying an +// Autonomous System Number (ASN) in the rule. +type UserFirewallAccessRuleEditResponseConfigurationLegacyJhsASNConfigurationTarget string + +const ( + UserFirewallAccessRuleEditResponseConfigurationLegacyJhsASNConfigurationTargetASN UserFirewallAccessRuleEditResponseConfigurationLegacyJhsASNConfigurationTarget = "asn" +) + +type UserFirewallAccessRuleEditResponseConfigurationLegacyJhsCountryConfiguration struct { + // The configuration target. You must set the target to `country` when specifying a + // country code in the rule. + Target UserFirewallAccessRuleEditResponseConfigurationLegacyJhsCountryConfigurationTarget `json:"target"` + // The two-letter ISO-3166-1 alpha-2 code to match. For more information, refer to + // [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country). + Value string `json:"value"` + JSON userFirewallAccessRuleEditResponseConfigurationLegacyJhsCountryConfigurationJSON `json:"-"` +} + +// userFirewallAccessRuleEditResponseConfigurationLegacyJhsCountryConfigurationJSON +// contains the JSON metadata for the struct +// [UserFirewallAccessRuleEditResponseConfigurationLegacyJhsCountryConfiguration] +type userFirewallAccessRuleEditResponseConfigurationLegacyJhsCountryConfigurationJSON struct { + Target apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleEditResponseConfigurationLegacyJhsCountryConfiguration) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r UserFirewallAccessRuleEditResponseConfigurationLegacyJhsCountryConfiguration) implementsUserFirewallAccessRuleEditResponseConfiguration() { +} + +// The configuration target. You must set the target to `country` when specifying a +// country code in the rule. +type UserFirewallAccessRuleEditResponseConfigurationLegacyJhsCountryConfigurationTarget string + +const ( + UserFirewallAccessRuleEditResponseConfigurationLegacyJhsCountryConfigurationTargetCountry UserFirewallAccessRuleEditResponseConfigurationLegacyJhsCountryConfigurationTarget = "country" +) + +// The action to apply to a matched request. +type UserFirewallAccessRuleEditResponseMode string + +const ( + UserFirewallAccessRuleEditResponseModeBlock UserFirewallAccessRuleEditResponseMode = "block" + UserFirewallAccessRuleEditResponseModeChallenge UserFirewallAccessRuleEditResponseMode = "challenge" + UserFirewallAccessRuleEditResponseModeWhitelist UserFirewallAccessRuleEditResponseMode = "whitelist" + UserFirewallAccessRuleEditResponseModeJsChallenge UserFirewallAccessRuleEditResponseMode = "js_challenge" + UserFirewallAccessRuleEditResponseModeManagedChallenge UserFirewallAccessRuleEditResponseMode = "managed_challenge" +) + +type UserFirewallAccessRuleNewParams struct { + // The rule configuration. + Configuration param.Field[UserFirewallAccessRuleNewParamsConfiguration] `json:"configuration,required"` + // The action to apply to a matched request. + Mode param.Field[UserFirewallAccessRuleNewParamsMode] `json:"mode,required"` + // An informative summary of the rule, typically used as a reminder or explanation. + Notes param.Field[string] `json:"notes"` +} + +func (r UserFirewallAccessRuleNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The rule configuration. +// +// Satisfied by +// [UserFirewallAccessRuleNewParamsConfigurationLegacyJhsIPConfiguration], +// [UserFirewallAccessRuleNewParamsConfigurationLegacyJhsIPV6Configuration], +// [UserFirewallAccessRuleNewParamsConfigurationLegacyJhsCidrConfiguration], +// [UserFirewallAccessRuleNewParamsConfigurationLegacyJhsASNConfiguration], +// [UserFirewallAccessRuleNewParamsConfigurationLegacyJhsCountryConfiguration]. +type UserFirewallAccessRuleNewParamsConfiguration interface { + implementsUserFirewallAccessRuleNewParamsConfiguration() +} + +type UserFirewallAccessRuleNewParamsConfigurationLegacyJhsIPConfiguration struct { + // The configuration target. You must set the target to `ip` when specifying an IP + // address in the rule. + Target param.Field[UserFirewallAccessRuleNewParamsConfigurationLegacyJhsIPConfigurationTarget] `json:"target"` + // The IP address to match. This address will be compared to the IP address of + // incoming requests. + Value param.Field[string] `json:"value"` +} + +func (r UserFirewallAccessRuleNewParamsConfigurationLegacyJhsIPConfiguration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r UserFirewallAccessRuleNewParamsConfigurationLegacyJhsIPConfiguration) implementsUserFirewallAccessRuleNewParamsConfiguration() { +} + +// The configuration target. You must set the target to `ip` when specifying an IP +// address in the rule. +type UserFirewallAccessRuleNewParamsConfigurationLegacyJhsIPConfigurationTarget string + +const ( + UserFirewallAccessRuleNewParamsConfigurationLegacyJhsIPConfigurationTargetIP UserFirewallAccessRuleNewParamsConfigurationLegacyJhsIPConfigurationTarget = "ip" +) + +type UserFirewallAccessRuleNewParamsConfigurationLegacyJhsIPV6Configuration struct { + // The configuration target. You must set the target to `ip6` when specifying an + // IPv6 address in the rule. + Target param.Field[UserFirewallAccessRuleNewParamsConfigurationLegacyJhsIPV6ConfigurationTarget] `json:"target"` + // The IPv6 address to match. + Value param.Field[string] `json:"value"` +} + +func (r UserFirewallAccessRuleNewParamsConfigurationLegacyJhsIPV6Configuration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r UserFirewallAccessRuleNewParamsConfigurationLegacyJhsIPV6Configuration) implementsUserFirewallAccessRuleNewParamsConfiguration() { +} + +// The configuration target. You must set the target to `ip6` when specifying an +// IPv6 address in the rule. +type UserFirewallAccessRuleNewParamsConfigurationLegacyJhsIPV6ConfigurationTarget string + +const ( + UserFirewallAccessRuleNewParamsConfigurationLegacyJhsIPV6ConfigurationTargetIp6 UserFirewallAccessRuleNewParamsConfigurationLegacyJhsIPV6ConfigurationTarget = "ip6" +) + +type UserFirewallAccessRuleNewParamsConfigurationLegacyJhsCidrConfiguration struct { + // The configuration target. You must set the target to `ip_range` when specifying + // an IP address range in the rule. + Target param.Field[UserFirewallAccessRuleNewParamsConfigurationLegacyJhsCidrConfigurationTarget] `json:"target"` + // The IP address range to match. You can only use prefix lengths `/16` and `/24` + // for IPv4 ranges, and prefix lengths `/32`, `/48`, and `/64` for IPv6 ranges. + Value param.Field[string] `json:"value"` +} + +func (r UserFirewallAccessRuleNewParamsConfigurationLegacyJhsCidrConfiguration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r UserFirewallAccessRuleNewParamsConfigurationLegacyJhsCidrConfiguration) implementsUserFirewallAccessRuleNewParamsConfiguration() { +} + +// The configuration target. You must set the target to `ip_range` when specifying +// an IP address range in the rule. +type UserFirewallAccessRuleNewParamsConfigurationLegacyJhsCidrConfigurationTarget string + +const ( + UserFirewallAccessRuleNewParamsConfigurationLegacyJhsCidrConfigurationTargetIPRange UserFirewallAccessRuleNewParamsConfigurationLegacyJhsCidrConfigurationTarget = "ip_range" +) + +type UserFirewallAccessRuleNewParamsConfigurationLegacyJhsASNConfiguration struct { + // The configuration target. You must set the target to `asn` when specifying an + // Autonomous System Number (ASN) in the rule. + Target param.Field[UserFirewallAccessRuleNewParamsConfigurationLegacyJhsASNConfigurationTarget] `json:"target"` + // The AS number to match. + Value param.Field[string] `json:"value"` +} + +func (r UserFirewallAccessRuleNewParamsConfigurationLegacyJhsASNConfiguration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r UserFirewallAccessRuleNewParamsConfigurationLegacyJhsASNConfiguration) implementsUserFirewallAccessRuleNewParamsConfiguration() { +} + +// The configuration target. You must set the target to `asn` when specifying an +// Autonomous System Number (ASN) in the rule. +type UserFirewallAccessRuleNewParamsConfigurationLegacyJhsASNConfigurationTarget string + +const ( + UserFirewallAccessRuleNewParamsConfigurationLegacyJhsASNConfigurationTargetASN UserFirewallAccessRuleNewParamsConfigurationLegacyJhsASNConfigurationTarget = "asn" +) + +type UserFirewallAccessRuleNewParamsConfigurationLegacyJhsCountryConfiguration struct { + // The configuration target. You must set the target to `country` when specifying a + // country code in the rule. + Target param.Field[UserFirewallAccessRuleNewParamsConfigurationLegacyJhsCountryConfigurationTarget] `json:"target"` + // The two-letter ISO-3166-1 alpha-2 code to match. For more information, refer to + // [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country). + Value param.Field[string] `json:"value"` +} + +func (r UserFirewallAccessRuleNewParamsConfigurationLegacyJhsCountryConfiguration) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r UserFirewallAccessRuleNewParamsConfigurationLegacyJhsCountryConfiguration) implementsUserFirewallAccessRuleNewParamsConfiguration() { +} + +// The configuration target. You must set the target to `country` when specifying a +// country code in the rule. +type UserFirewallAccessRuleNewParamsConfigurationLegacyJhsCountryConfigurationTarget string + +const ( + UserFirewallAccessRuleNewParamsConfigurationLegacyJhsCountryConfigurationTargetCountry UserFirewallAccessRuleNewParamsConfigurationLegacyJhsCountryConfigurationTarget = "country" +) + +// The action to apply to a matched request. +type UserFirewallAccessRuleNewParamsMode string + +const ( + UserFirewallAccessRuleNewParamsModeBlock UserFirewallAccessRuleNewParamsMode = "block" + UserFirewallAccessRuleNewParamsModeChallenge UserFirewallAccessRuleNewParamsMode = "challenge" + UserFirewallAccessRuleNewParamsModeWhitelist UserFirewallAccessRuleNewParamsMode = "whitelist" + UserFirewallAccessRuleNewParamsModeJsChallenge UserFirewallAccessRuleNewParamsMode = "js_challenge" + UserFirewallAccessRuleNewParamsModeManagedChallenge UserFirewallAccessRuleNewParamsMode = "managed_challenge" +) + +type UserFirewallAccessRuleNewResponseEnvelope struct { + Errors []UserFirewallAccessRuleNewResponseEnvelopeErrors `json:"errors,required"` + Messages []UserFirewallAccessRuleNewResponseEnvelopeMessages `json:"messages,required"` + Result UserFirewallAccessRuleNewResponse `json:"result,required,nullable"` + // Whether the API call was successful + Success UserFirewallAccessRuleNewResponseEnvelopeSuccess `json:"success,required"` + JSON userFirewallAccessRuleNewResponseEnvelopeJSON `json:"-"` +} + +// userFirewallAccessRuleNewResponseEnvelopeJSON contains the JSON metadata for the +// struct [UserFirewallAccessRuleNewResponseEnvelope] +type userFirewallAccessRuleNewResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserFirewallAccessRuleNewResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userFirewallAccessRuleNewResponseEnvelopeErrorsJSON `json:"-"` +} + +// userFirewallAccessRuleNewResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [UserFirewallAccessRuleNewResponseEnvelopeErrors] +type userFirewallAccessRuleNewResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserFirewallAccessRuleNewResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userFirewallAccessRuleNewResponseEnvelopeMessagesJSON `json:"-"` +} + +// userFirewallAccessRuleNewResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [UserFirewallAccessRuleNewResponseEnvelopeMessages] +type userFirewallAccessRuleNewResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserFirewallAccessRuleNewResponseEnvelopeSuccess bool + +const ( + UserFirewallAccessRuleNewResponseEnvelopeSuccessTrue UserFirewallAccessRuleNewResponseEnvelopeSuccess = true +) + +type UserFirewallAccessRuleListParams struct { + // The direction used to sort returned rules. + Direction param.Field[UserFirewallAccessRuleListParamsDirection] `query:"direction"` + EgsPagination param.Field[UserFirewallAccessRuleListParamsEgsPagination] `query:"egs-pagination"` + Filters param.Field[UserFirewallAccessRuleListParamsFilters] `query:"filters"` + // The field used to sort returned rules. + Order param.Field[UserFirewallAccessRuleListParamsOrder] `query:"order"` + // Requested page within paginated list of results. + Page param.Field[float64] `query:"page"` + // Maximum number of results requested. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes [UserFirewallAccessRuleListParams]'s query parameters as +// `url.Values`. +func (r UserFirewallAccessRuleListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// The direction used to sort returned rules. +type UserFirewallAccessRuleListParamsDirection string + +const ( + UserFirewallAccessRuleListParamsDirectionAsc UserFirewallAccessRuleListParamsDirection = "asc" + UserFirewallAccessRuleListParamsDirectionDesc UserFirewallAccessRuleListParamsDirection = "desc" +) + +type UserFirewallAccessRuleListParamsEgsPagination struct { + Json param.Field[UserFirewallAccessRuleListParamsEgsPaginationJson] `query:"json"` +} + +// URLQuery serializes [UserFirewallAccessRuleListParamsEgsPagination]'s query +// parameters as `url.Values`. +func (r UserFirewallAccessRuleListParamsEgsPagination) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type UserFirewallAccessRuleListParamsEgsPaginationJson struct { + // The page number of paginated results. + Page param.Field[float64] `query:"page"` + // The maximum number of results per page. You can only set the value to `1` or to + // a multiple of 5 such as `5`, `10`, `15`, or `20`. + PerPage param.Field[float64] `query:"per_page"` +} + +// URLQuery serializes [UserFirewallAccessRuleListParamsEgsPaginationJson]'s query +// parameters as `url.Values`. +func (r UserFirewallAccessRuleListParamsEgsPaginationJson) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type UserFirewallAccessRuleListParamsFilters struct { + // The target to search in existing rules. + ConfigurationTarget param.Field[UserFirewallAccessRuleListParamsFiltersConfigurationTarget] `query:"configuration.target"` + // The target value to search for in existing rules: an IP address, an IP address + // range, or a country code, depending on the provided `configuration.target`. + // Notes: You can search for a single IPv4 address, an IP address range with a + // subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code. + ConfigurationValue param.Field[string] `query:"configuration.value"` + // When set to `all`, all the search requirements must match. When set to `any`, + // only one of the search requirements has to match. + Match param.Field[UserFirewallAccessRuleListParamsFiltersMatch] `query:"match"` + // The action to apply to a matched request. + Mode param.Field[UserFirewallAccessRuleListParamsFiltersMode] `query:"mode"` + // The string to search for in the notes of existing IP Access rules. Notes: For + // example, the string 'attack' would match IP Access rules with notes 'Attack + // 26/02' and 'Attack 27/02'. The search is case insensitive. + Notes param.Field[string] `query:"notes"` +} + +// URLQuery serializes [UserFirewallAccessRuleListParamsFilters]'s query parameters +// as `url.Values`. +func (r UserFirewallAccessRuleListParamsFilters) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// The target to search in existing rules. +type UserFirewallAccessRuleListParamsFiltersConfigurationTarget string + +const ( + UserFirewallAccessRuleListParamsFiltersConfigurationTargetIP UserFirewallAccessRuleListParamsFiltersConfigurationTarget = "ip" + UserFirewallAccessRuleListParamsFiltersConfigurationTargetIPRange UserFirewallAccessRuleListParamsFiltersConfigurationTarget = "ip_range" + UserFirewallAccessRuleListParamsFiltersConfigurationTargetASN UserFirewallAccessRuleListParamsFiltersConfigurationTarget = "asn" + UserFirewallAccessRuleListParamsFiltersConfigurationTargetCountry UserFirewallAccessRuleListParamsFiltersConfigurationTarget = "country" +) + +// When set to `all`, all the search requirements must match. When set to `any`, +// only one of the search requirements has to match. +type UserFirewallAccessRuleListParamsFiltersMatch string + +const ( + UserFirewallAccessRuleListParamsFiltersMatchAny UserFirewallAccessRuleListParamsFiltersMatch = "any" + UserFirewallAccessRuleListParamsFiltersMatchAll UserFirewallAccessRuleListParamsFiltersMatch = "all" +) + +// The action to apply to a matched request. +type UserFirewallAccessRuleListParamsFiltersMode string + +const ( + UserFirewallAccessRuleListParamsFiltersModeBlock UserFirewallAccessRuleListParamsFiltersMode = "block" + UserFirewallAccessRuleListParamsFiltersModeChallenge UserFirewallAccessRuleListParamsFiltersMode = "challenge" + UserFirewallAccessRuleListParamsFiltersModeWhitelist UserFirewallAccessRuleListParamsFiltersMode = "whitelist" + UserFirewallAccessRuleListParamsFiltersModeJsChallenge UserFirewallAccessRuleListParamsFiltersMode = "js_challenge" + UserFirewallAccessRuleListParamsFiltersModeManagedChallenge UserFirewallAccessRuleListParamsFiltersMode = "managed_challenge" +) + +// The field used to sort returned rules. +type UserFirewallAccessRuleListParamsOrder string + +const ( + UserFirewallAccessRuleListParamsOrderConfigurationTarget UserFirewallAccessRuleListParamsOrder = "configuration.target" + UserFirewallAccessRuleListParamsOrderConfigurationValue UserFirewallAccessRuleListParamsOrder = "configuration.value" + UserFirewallAccessRuleListParamsOrderMode UserFirewallAccessRuleListParamsOrder = "mode" +) + +type UserFirewallAccessRuleDeleteResponseEnvelope struct { + Errors []UserFirewallAccessRuleDeleteResponseEnvelopeErrors `json:"errors,required"` + Messages []UserFirewallAccessRuleDeleteResponseEnvelopeMessages `json:"messages,required"` + Result UserFirewallAccessRuleDeleteResponse `json:"result,required,nullable"` + // Whether the API call was successful + Success UserFirewallAccessRuleDeleteResponseEnvelopeSuccess `json:"success,required"` + JSON userFirewallAccessRuleDeleteResponseEnvelopeJSON `json:"-"` +} + +// userFirewallAccessRuleDeleteResponseEnvelopeJSON contains the JSON metadata for +// the struct [UserFirewallAccessRuleDeleteResponseEnvelope] +type userFirewallAccessRuleDeleteResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserFirewallAccessRuleDeleteResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userFirewallAccessRuleDeleteResponseEnvelopeErrorsJSON `json:"-"` +} + +// userFirewallAccessRuleDeleteResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [UserFirewallAccessRuleDeleteResponseEnvelopeErrors] +type userFirewallAccessRuleDeleteResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserFirewallAccessRuleDeleteResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userFirewallAccessRuleDeleteResponseEnvelopeMessagesJSON `json:"-"` +} + +// userFirewallAccessRuleDeleteResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [UserFirewallAccessRuleDeleteResponseEnvelopeMessages] +type userFirewallAccessRuleDeleteResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserFirewallAccessRuleDeleteResponseEnvelopeSuccess bool + +const ( + UserFirewallAccessRuleDeleteResponseEnvelopeSuccessTrue UserFirewallAccessRuleDeleteResponseEnvelopeSuccess = true +) + +type UserFirewallAccessRuleEditParams struct { + // The action to apply to a matched request. + Mode param.Field[UserFirewallAccessRuleEditParamsMode] `json:"mode"` + // An informative summary of the rule, typically used as a reminder or explanation. + Notes param.Field[string] `json:"notes"` +} + +func (r UserFirewallAccessRuleEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The action to apply to a matched request. +type UserFirewallAccessRuleEditParamsMode string + +const ( + UserFirewallAccessRuleEditParamsModeBlock UserFirewallAccessRuleEditParamsMode = "block" + UserFirewallAccessRuleEditParamsModeChallenge UserFirewallAccessRuleEditParamsMode = "challenge" + UserFirewallAccessRuleEditParamsModeWhitelist UserFirewallAccessRuleEditParamsMode = "whitelist" + UserFirewallAccessRuleEditParamsModeJsChallenge UserFirewallAccessRuleEditParamsMode = "js_challenge" + UserFirewallAccessRuleEditParamsModeManagedChallenge UserFirewallAccessRuleEditParamsMode = "managed_challenge" +) + +type UserFirewallAccessRuleEditResponseEnvelope struct { + Errors []UserFirewallAccessRuleEditResponseEnvelopeErrors `json:"errors,required"` + Messages []UserFirewallAccessRuleEditResponseEnvelopeMessages `json:"messages,required"` + Result UserFirewallAccessRuleEditResponse `json:"result,required,nullable"` + // Whether the API call was successful + Success UserFirewallAccessRuleEditResponseEnvelopeSuccess `json:"success,required"` + JSON userFirewallAccessRuleEditResponseEnvelopeJSON `json:"-"` +} + +// userFirewallAccessRuleEditResponseEnvelopeJSON contains the JSON metadata for +// the struct [UserFirewallAccessRuleEditResponseEnvelope] +type userFirewallAccessRuleEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserFirewallAccessRuleEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userFirewallAccessRuleEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// userFirewallAccessRuleEditResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [UserFirewallAccessRuleEditResponseEnvelopeErrors] +type userFirewallAccessRuleEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type UserFirewallAccessRuleEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON userFirewallAccessRuleEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// userFirewallAccessRuleEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [UserFirewallAccessRuleEditResponseEnvelopeMessages] +type userFirewallAccessRuleEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *UserFirewallAccessRuleEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type UserFirewallAccessRuleEditResponseEnvelopeSuccess bool + +const ( + UserFirewallAccessRuleEditResponseEnvelopeSuccessTrue UserFirewallAccessRuleEditResponseEnvelopeSuccess = true +) diff --git a/userfirewallaccessrulerule_test.go b/userfirewallaccessrule_test.go similarity index 70% rename from userfirewallaccessrulerule_test.go rename to userfirewallaccessrule_test.go index 3e666a10e2b..e0316d7176a 100644 --- a/userfirewallaccessrulerule_test.go +++ b/userfirewallaccessrule_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestUserFirewallAccessRuleRuleNewWithOptionalParams(t *testing.T) { +func TestUserFirewallAccessRuleNewWithOptionalParams(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 { @@ -29,12 +29,12 @@ func TestUserFirewallAccessRuleRuleNewWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.User.Firewall.AccessRules.Rules.New(context.TODO(), cloudflare.UserFirewallAccessRuleRuleNewParams{ - Configuration: cloudflare.F[cloudflare.UserFirewallAccessRuleRuleNewParamsConfiguration](cloudflare.UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsIPConfiguration(cloudflare.UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsIPConfiguration{ - Target: cloudflare.F(cloudflare.UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsIPConfigurationTargetIP), + _, err := client.User.Firewall.AccessRules.New(context.TODO(), cloudflare.UserFirewallAccessRuleNewParams{ + Configuration: cloudflare.F[cloudflare.UserFirewallAccessRuleNewParamsConfiguration](cloudflare.UserFirewallAccessRuleNewParamsConfigurationLegacyJhsIPConfiguration(cloudflare.UserFirewallAccessRuleNewParamsConfigurationLegacyJhsIPConfiguration{ + Target: cloudflare.F(cloudflare.UserFirewallAccessRuleNewParamsConfigurationLegacyJhsIPConfigurationTargetIP), Value: cloudflare.F("198.51.100.4"), })), - Mode: cloudflare.F(cloudflare.UserFirewallAccessRuleRuleNewParamsModeChallenge), + Mode: cloudflare.F(cloudflare.UserFirewallAccessRuleNewParamsModeChallenge), Notes: cloudflare.F("This rule is enabled because of an event that occurred on date X."), }) if err != nil { @@ -46,7 +46,7 @@ func TestUserFirewallAccessRuleRuleNewWithOptionalParams(t *testing.T) { } } -func TestUserFirewallAccessRuleRuleListWithOptionalParams(t *testing.T) { +func TestUserFirewallAccessRuleListWithOptionalParams(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 { @@ -62,22 +62,22 @@ func TestUserFirewallAccessRuleRuleListWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.User.Firewall.AccessRules.Rules.List(context.TODO(), cloudflare.UserFirewallAccessRuleRuleListParams{ - Direction: cloudflare.F(cloudflare.UserFirewallAccessRuleRuleListParamsDirectionDesc), - EgsPagination: cloudflare.F(cloudflare.UserFirewallAccessRuleRuleListParamsEgsPagination{ - Json: cloudflare.F(cloudflare.UserFirewallAccessRuleRuleListParamsEgsPaginationJson{ + _, err := client.User.Firewall.AccessRules.List(context.TODO(), cloudflare.UserFirewallAccessRuleListParams{ + Direction: cloudflare.F(cloudflare.UserFirewallAccessRuleListParamsDirectionDesc), + EgsPagination: cloudflare.F(cloudflare.UserFirewallAccessRuleListParamsEgsPagination{ + Json: cloudflare.F(cloudflare.UserFirewallAccessRuleListParamsEgsPaginationJson{ Page: cloudflare.F(1.000000), PerPage: cloudflare.F(1.000000), }), }), - Filters: cloudflare.F(cloudflare.UserFirewallAccessRuleRuleListParamsFilters{ - ConfigurationTarget: cloudflare.F(cloudflare.UserFirewallAccessRuleRuleListParamsFiltersConfigurationTargetIP), + Filters: cloudflare.F(cloudflare.UserFirewallAccessRuleListParamsFilters{ + ConfigurationTarget: cloudflare.F(cloudflare.UserFirewallAccessRuleListParamsFiltersConfigurationTargetIP), ConfigurationValue: cloudflare.F("198.51.100.4"), - Match: cloudflare.F(cloudflare.UserFirewallAccessRuleRuleListParamsFiltersMatchAny), - Mode: cloudflare.F(cloudflare.UserFirewallAccessRuleRuleListParamsFiltersModeChallenge), + Match: cloudflare.F(cloudflare.UserFirewallAccessRuleListParamsFiltersMatchAny), + Mode: cloudflare.F(cloudflare.UserFirewallAccessRuleListParamsFiltersModeChallenge), Notes: cloudflare.F("my note"), }), - Order: cloudflare.F(cloudflare.UserFirewallAccessRuleRuleListParamsOrderMode), + Order: cloudflare.F(cloudflare.UserFirewallAccessRuleListParamsOrderMode), Page: cloudflare.F(1.000000), PerPage: cloudflare.F(20.000000), }) @@ -90,7 +90,7 @@ func TestUserFirewallAccessRuleRuleListWithOptionalParams(t *testing.T) { } } -func TestUserFirewallAccessRuleRuleDelete(t *testing.T) { +func TestUserFirewallAccessRuleDelete(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 { @@ -106,7 +106,7 @@ func TestUserFirewallAccessRuleRuleDelete(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.User.Firewall.AccessRules.Rules.Delete(context.TODO(), "92f17202ed8bd63d69a66b86a49a8f6b") + _, err := client.User.Firewall.AccessRules.Delete(context.TODO(), "92f17202ed8bd63d69a66b86a49a8f6b") if err != nil { var apierr *cloudflare.Error if errors.As(err, &apierr) { @@ -116,7 +116,7 @@ func TestUserFirewallAccessRuleRuleDelete(t *testing.T) { } } -func TestUserFirewallAccessRuleRuleEditWithOptionalParams(t *testing.T) { +func TestUserFirewallAccessRuleEditWithOptionalParams(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 { @@ -132,11 +132,11 @@ func TestUserFirewallAccessRuleRuleEditWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.User.Firewall.AccessRules.Rules.Edit( + _, err := client.User.Firewall.AccessRules.Edit( context.TODO(), "92f17202ed8bd63d69a66b86a49a8f6b", - cloudflare.UserFirewallAccessRuleRuleEditParams{ - Mode: cloudflare.F(cloudflare.UserFirewallAccessRuleRuleEditParamsModeChallenge), + cloudflare.UserFirewallAccessRuleEditParams{ + Mode: cloudflare.F(cloudflare.UserFirewallAccessRuleEditParamsModeChallenge), Notes: cloudflare.F("This rule is enabled because of an event that occurred on date X."), }, ) diff --git a/userfirewallaccessrulerule.go b/userfirewallaccessrulerule.go deleted file mode 100644 index 7e8450ba0f8..00000000000 --- a/userfirewallaccessrulerule.go +++ /dev/null @@ -1,1379 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - "net/url" - "reflect" - "time" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/apiquery" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/internal/shared" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// UserFirewallAccessRuleRuleService contains methods and other services that help -// with interacting with the cloudflare API. Note, unlike clients, this service -// does not read variables from the environment automatically. You should not -// instantiate this service directly, and instead use the -// [NewUserFirewallAccessRuleRuleService] method instead. -type UserFirewallAccessRuleRuleService struct { - Options []option.RequestOption -} - -// NewUserFirewallAccessRuleRuleService generates a new service that applies the -// given options to each request. These options are applied after the parent -// client's options (if there is one), and before any request-specific options. -func NewUserFirewallAccessRuleRuleService(opts ...option.RequestOption) (r *UserFirewallAccessRuleRuleService) { - r = &UserFirewallAccessRuleRuleService{} - r.Options = opts - return -} - -// Creates a new IP Access rule for all zones owned by the current user. -// -// Note: To create an IP Access rule that applies to a specific zone, refer to the -// [IP Access rules for a zone](#ip-access-rules-for-a-zone) endpoints. -func (r *UserFirewallAccessRuleRuleService) New(ctx context.Context, body UserFirewallAccessRuleRuleNewParams, opts ...option.RequestOption) (res *UserFirewallAccessRuleRuleNewResponse, err error) { - opts = append(r.Options[:], opts...) - var env UserFirewallAccessRuleRuleNewResponseEnvelope - path := "user/firewall/access_rules/rules" - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Fetches IP Access rules of the user. You can filter the results using several -// optional parameters. -func (r *UserFirewallAccessRuleRuleService) List(ctx context.Context, query UserFirewallAccessRuleRuleListParams, opts ...option.RequestOption) (res *shared.V4PagePaginationArray[UserFirewallAccessRuleRuleListResponse], err error) { - var raw *http.Response - opts = append(r.Options, opts...) - opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) - path := "user/firewall/access_rules/rules" - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) - if err != nil { - return nil, err - } - err = cfg.Execute() - if err != nil { - return nil, err - } - res.SetPageConfig(cfg, raw) - return res, nil -} - -// Fetches IP Access rules of the user. You can filter the results using several -// optional parameters. -func (r *UserFirewallAccessRuleRuleService) ListAutoPaging(ctx context.Context, query UserFirewallAccessRuleRuleListParams, opts ...option.RequestOption) *shared.V4PagePaginationArrayAutoPager[UserFirewallAccessRuleRuleListResponse] { - return shared.NewV4PagePaginationArrayAutoPager(r.List(ctx, query, opts...)) -} - -// Deletes an IP Access rule at the user level. -// -// Note: Deleting a user-level rule will affect all zones owned by the user. -func (r *UserFirewallAccessRuleRuleService) Delete(ctx context.Context, identifier string, opts ...option.RequestOption) (res *UserFirewallAccessRuleRuleDeleteResponse, err error) { - opts = append(r.Options[:], opts...) - var env UserFirewallAccessRuleRuleDeleteResponseEnvelope - path := fmt.Sprintf("user/firewall/access_rules/rules/%s", identifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Updates an IP Access rule defined at the user level. You can only update the -// rule action (`mode` parameter) and notes. -func (r *UserFirewallAccessRuleRuleService) Edit(ctx context.Context, identifier string, body UserFirewallAccessRuleRuleEditParams, opts ...option.RequestOption) (res *UserFirewallAccessRuleRuleEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env UserFirewallAccessRuleRuleEditResponseEnvelope - path := fmt.Sprintf("user/firewall/access_rules/rules/%s", identifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -type UserFirewallAccessRuleRuleNewResponse struct { - // The unique identifier of the IP Access rule. - ID string `json:"id,required"` - // The available actions that a rule can apply to a matched request. - AllowedModes []UserFirewallAccessRuleRuleNewResponseAllowedMode `json:"allowed_modes,required"` - // The rule configuration. - Configuration UserFirewallAccessRuleRuleNewResponseConfiguration `json:"configuration,required"` - // The action to apply to a matched request. - Mode UserFirewallAccessRuleRuleNewResponseMode `json:"mode,required"` - // The timestamp of when the rule was created. - CreatedOn time.Time `json:"created_on" format:"date-time"` - // The timestamp of when the rule was last modified. - ModifiedOn time.Time `json:"modified_on" format:"date-time"` - // An informative summary of the rule, typically used as a reminder or explanation. - Notes string `json:"notes"` - JSON userFirewallAccessRuleRuleNewResponseJSON `json:"-"` -} - -// userFirewallAccessRuleRuleNewResponseJSON contains the JSON metadata for the -// struct [UserFirewallAccessRuleRuleNewResponse] -type userFirewallAccessRuleRuleNewResponseJSON struct { - ID apijson.Field - AllowedModes apijson.Field - Configuration apijson.Field - Mode apijson.Field - CreatedOn apijson.Field - ModifiedOn apijson.Field - Notes apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleNewResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// The action to apply to a matched request. -type UserFirewallAccessRuleRuleNewResponseAllowedMode string - -const ( - UserFirewallAccessRuleRuleNewResponseAllowedModeBlock UserFirewallAccessRuleRuleNewResponseAllowedMode = "block" - UserFirewallAccessRuleRuleNewResponseAllowedModeChallenge UserFirewallAccessRuleRuleNewResponseAllowedMode = "challenge" - UserFirewallAccessRuleRuleNewResponseAllowedModeWhitelist UserFirewallAccessRuleRuleNewResponseAllowedMode = "whitelist" - UserFirewallAccessRuleRuleNewResponseAllowedModeJsChallenge UserFirewallAccessRuleRuleNewResponseAllowedMode = "js_challenge" - UserFirewallAccessRuleRuleNewResponseAllowedModeManagedChallenge UserFirewallAccessRuleRuleNewResponseAllowedMode = "managed_challenge" -) - -// The rule configuration. -// -// Union satisfied by -// [UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPConfiguration], -// [UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPV6Configuration], -// [UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCidrConfiguration], -// [UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsASNConfiguration] or -// [UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCountryConfiguration]. -type UserFirewallAccessRuleRuleNewResponseConfiguration interface { - implementsUserFirewallAccessRuleRuleNewResponseConfiguration() -} - -func init() { - apijson.RegisterUnion(reflect.TypeOf((*UserFirewallAccessRuleRuleNewResponseConfiguration)(nil)).Elem(), "") -} - -type UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPConfiguration struct { - // The configuration target. You must set the target to `ip` when specifying an IP - // address in the rule. - Target UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPConfigurationTarget `json:"target"` - // The IP address to match. This address will be compared to the IP address of - // incoming requests. - Value string `json:"value"` - JSON userFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPConfigurationJSON `json:"-"` -} - -// userFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPConfigurationJSON -// contains the JSON metadata for the struct -// [UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPConfiguration] -type userFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPConfigurationJSON struct { - Target apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPConfiguration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPConfiguration) implementsUserFirewallAccessRuleRuleNewResponseConfiguration() { -} - -// The configuration target. You must set the target to `ip` when specifying an IP -// address in the rule. -type UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPConfigurationTarget string - -const ( - UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPConfigurationTargetIP UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPConfigurationTarget = "ip" -) - -type UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPV6Configuration struct { - // The configuration target. You must set the target to `ip6` when specifying an - // IPv6 address in the rule. - Target UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPV6ConfigurationTarget `json:"target"` - // The IPv6 address to match. - Value string `json:"value"` - JSON userFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPV6ConfigurationJSON `json:"-"` -} - -// userFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPV6ConfigurationJSON -// contains the JSON metadata for the struct -// [UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPV6Configuration] -type userFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPV6ConfigurationJSON struct { - Target apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPV6Configuration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPV6Configuration) implementsUserFirewallAccessRuleRuleNewResponseConfiguration() { -} - -// The configuration target. You must set the target to `ip6` when specifying an -// IPv6 address in the rule. -type UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPV6ConfigurationTarget string - -const ( - UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPV6ConfigurationTargetIp6 UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsIPV6ConfigurationTarget = "ip6" -) - -type UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCidrConfiguration struct { - // The configuration target. You must set the target to `ip_range` when specifying - // an IP address range in the rule. - Target UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCidrConfigurationTarget `json:"target"` - // The IP address range to match. You can only use prefix lengths `/16` and `/24` - // for IPv4 ranges, and prefix lengths `/32`, `/48`, and `/64` for IPv6 ranges. - Value string `json:"value"` - JSON userFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCidrConfigurationJSON `json:"-"` -} - -// userFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCidrConfigurationJSON -// contains the JSON metadata for the struct -// [UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCidrConfiguration] -type userFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCidrConfigurationJSON struct { - Target apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCidrConfiguration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCidrConfiguration) implementsUserFirewallAccessRuleRuleNewResponseConfiguration() { -} - -// The configuration target. You must set the target to `ip_range` when specifying -// an IP address range in the rule. -type UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCidrConfigurationTarget string - -const ( - UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCidrConfigurationTargetIPRange UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCidrConfigurationTarget = "ip_range" -) - -type UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsASNConfiguration struct { - // The configuration target. You must set the target to `asn` when specifying an - // Autonomous System Number (ASN) in the rule. - Target UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsASNConfigurationTarget `json:"target"` - // The AS number to match. - Value string `json:"value"` - JSON userFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsASNConfigurationJSON `json:"-"` -} - -// userFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsASNConfigurationJSON -// contains the JSON metadata for the struct -// [UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsASNConfiguration] -type userFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsASNConfigurationJSON struct { - Target apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsASNConfiguration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsASNConfiguration) implementsUserFirewallAccessRuleRuleNewResponseConfiguration() { -} - -// The configuration target. You must set the target to `asn` when specifying an -// Autonomous System Number (ASN) in the rule. -type UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsASNConfigurationTarget string - -const ( - UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsASNConfigurationTargetASN UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsASNConfigurationTarget = "asn" -) - -type UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCountryConfiguration struct { - // The configuration target. You must set the target to `country` when specifying a - // country code in the rule. - Target UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCountryConfigurationTarget `json:"target"` - // The two-letter ISO-3166-1 alpha-2 code to match. For more information, refer to - // [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country). - Value string `json:"value"` - JSON userFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCountryConfigurationJSON `json:"-"` -} - -// userFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCountryConfigurationJSON -// contains the JSON metadata for the struct -// [UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCountryConfiguration] -type userFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCountryConfigurationJSON struct { - Target apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCountryConfiguration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCountryConfiguration) implementsUserFirewallAccessRuleRuleNewResponseConfiguration() { -} - -// The configuration target. You must set the target to `country` when specifying a -// country code in the rule. -type UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCountryConfigurationTarget string - -const ( - UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCountryConfigurationTargetCountry UserFirewallAccessRuleRuleNewResponseConfigurationLegacyJhsCountryConfigurationTarget = "country" -) - -// The action to apply to a matched request. -type UserFirewallAccessRuleRuleNewResponseMode string - -const ( - UserFirewallAccessRuleRuleNewResponseModeBlock UserFirewallAccessRuleRuleNewResponseMode = "block" - UserFirewallAccessRuleRuleNewResponseModeChallenge UserFirewallAccessRuleRuleNewResponseMode = "challenge" - UserFirewallAccessRuleRuleNewResponseModeWhitelist UserFirewallAccessRuleRuleNewResponseMode = "whitelist" - UserFirewallAccessRuleRuleNewResponseModeJsChallenge UserFirewallAccessRuleRuleNewResponseMode = "js_challenge" - UserFirewallAccessRuleRuleNewResponseModeManagedChallenge UserFirewallAccessRuleRuleNewResponseMode = "managed_challenge" -) - -type UserFirewallAccessRuleRuleListResponse struct { - // The unique identifier of the IP Access rule. - ID string `json:"id,required"` - // The available actions that a rule can apply to a matched request. - AllowedModes []UserFirewallAccessRuleRuleListResponseAllowedMode `json:"allowed_modes,required"` - // The rule configuration. - Configuration UserFirewallAccessRuleRuleListResponseConfiguration `json:"configuration,required"` - // The action to apply to a matched request. - Mode UserFirewallAccessRuleRuleListResponseMode `json:"mode,required"` - // The timestamp of when the rule was created. - CreatedOn time.Time `json:"created_on" format:"date-time"` - // The timestamp of when the rule was last modified. - ModifiedOn time.Time `json:"modified_on" format:"date-time"` - // An informative summary of the rule, typically used as a reminder or explanation. - Notes string `json:"notes"` - JSON userFirewallAccessRuleRuleListResponseJSON `json:"-"` -} - -// userFirewallAccessRuleRuleListResponseJSON contains the JSON metadata for the -// struct [UserFirewallAccessRuleRuleListResponse] -type userFirewallAccessRuleRuleListResponseJSON struct { - ID apijson.Field - AllowedModes apijson.Field - Configuration apijson.Field - Mode apijson.Field - CreatedOn apijson.Field - ModifiedOn apijson.Field - Notes apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// The action to apply to a matched request. -type UserFirewallAccessRuleRuleListResponseAllowedMode string - -const ( - UserFirewallAccessRuleRuleListResponseAllowedModeBlock UserFirewallAccessRuleRuleListResponseAllowedMode = "block" - UserFirewallAccessRuleRuleListResponseAllowedModeChallenge UserFirewallAccessRuleRuleListResponseAllowedMode = "challenge" - UserFirewallAccessRuleRuleListResponseAllowedModeWhitelist UserFirewallAccessRuleRuleListResponseAllowedMode = "whitelist" - UserFirewallAccessRuleRuleListResponseAllowedModeJsChallenge UserFirewallAccessRuleRuleListResponseAllowedMode = "js_challenge" - UserFirewallAccessRuleRuleListResponseAllowedModeManagedChallenge UserFirewallAccessRuleRuleListResponseAllowedMode = "managed_challenge" -) - -// The rule configuration. -// -// Union satisfied by -// [UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPConfiguration], -// [UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPV6Configuration], -// [UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCidrConfiguration], -// [UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsASNConfiguration] -// or -// [UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCountryConfiguration]. -type UserFirewallAccessRuleRuleListResponseConfiguration interface { - implementsUserFirewallAccessRuleRuleListResponseConfiguration() -} - -func init() { - apijson.RegisterUnion(reflect.TypeOf((*UserFirewallAccessRuleRuleListResponseConfiguration)(nil)).Elem(), "") -} - -type UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPConfiguration struct { - // The configuration target. You must set the target to `ip` when specifying an IP - // address in the rule. - Target UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPConfigurationTarget `json:"target"` - // The IP address to match. This address will be compared to the IP address of - // incoming requests. - Value string `json:"value"` - JSON userFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPConfigurationJSON `json:"-"` -} - -// userFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPConfigurationJSON -// contains the JSON metadata for the struct -// [UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPConfiguration] -type userFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPConfigurationJSON struct { - Target apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPConfiguration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPConfiguration) implementsUserFirewallAccessRuleRuleListResponseConfiguration() { -} - -// The configuration target. You must set the target to `ip` when specifying an IP -// address in the rule. -type UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPConfigurationTarget string - -const ( - UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPConfigurationTargetIP UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPConfigurationTarget = "ip" -) - -type UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPV6Configuration struct { - // The configuration target. You must set the target to `ip6` when specifying an - // IPv6 address in the rule. - Target UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPV6ConfigurationTarget `json:"target"` - // The IPv6 address to match. - Value string `json:"value"` - JSON userFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPV6ConfigurationJSON `json:"-"` -} - -// userFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPV6ConfigurationJSON -// contains the JSON metadata for the struct -// [UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPV6Configuration] -type userFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPV6ConfigurationJSON struct { - Target apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPV6Configuration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPV6Configuration) implementsUserFirewallAccessRuleRuleListResponseConfiguration() { -} - -// The configuration target. You must set the target to `ip6` when specifying an -// IPv6 address in the rule. -type UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPV6ConfigurationTarget string - -const ( - UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPV6ConfigurationTargetIp6 UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsIPV6ConfigurationTarget = "ip6" -) - -type UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCidrConfiguration struct { - // The configuration target. You must set the target to `ip_range` when specifying - // an IP address range in the rule. - Target UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCidrConfigurationTarget `json:"target"` - // The IP address range to match. You can only use prefix lengths `/16` and `/24` - // for IPv4 ranges, and prefix lengths `/32`, `/48`, and `/64` for IPv6 ranges. - Value string `json:"value"` - JSON userFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCidrConfigurationJSON `json:"-"` -} - -// userFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCidrConfigurationJSON -// contains the JSON metadata for the struct -// [UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCidrConfiguration] -type userFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCidrConfigurationJSON struct { - Target apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCidrConfiguration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCidrConfiguration) implementsUserFirewallAccessRuleRuleListResponseConfiguration() { -} - -// The configuration target. You must set the target to `ip_range` when specifying -// an IP address range in the rule. -type UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCidrConfigurationTarget string - -const ( - UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCidrConfigurationTargetIPRange UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCidrConfigurationTarget = "ip_range" -) - -type UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsASNConfiguration struct { - // The configuration target. You must set the target to `asn` when specifying an - // Autonomous System Number (ASN) in the rule. - Target UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsASNConfigurationTarget `json:"target"` - // The AS number to match. - Value string `json:"value"` - JSON userFirewallAccessRuleRuleListResponseConfigurationLegacyJhsASNConfigurationJSON `json:"-"` -} - -// userFirewallAccessRuleRuleListResponseConfigurationLegacyJhsASNConfigurationJSON -// contains the JSON metadata for the struct -// [UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsASNConfiguration] -type userFirewallAccessRuleRuleListResponseConfigurationLegacyJhsASNConfigurationJSON struct { - Target apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsASNConfiguration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsASNConfiguration) implementsUserFirewallAccessRuleRuleListResponseConfiguration() { -} - -// The configuration target. You must set the target to `asn` when specifying an -// Autonomous System Number (ASN) in the rule. -type UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsASNConfigurationTarget string - -const ( - UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsASNConfigurationTargetASN UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsASNConfigurationTarget = "asn" -) - -type UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCountryConfiguration struct { - // The configuration target. You must set the target to `country` when specifying a - // country code in the rule. - Target UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCountryConfigurationTarget `json:"target"` - // The two-letter ISO-3166-1 alpha-2 code to match. For more information, refer to - // [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country). - Value string `json:"value"` - JSON userFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCountryConfigurationJSON `json:"-"` -} - -// userFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCountryConfigurationJSON -// contains the JSON metadata for the struct -// [UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCountryConfiguration] -type userFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCountryConfigurationJSON struct { - Target apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCountryConfiguration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCountryConfiguration) implementsUserFirewallAccessRuleRuleListResponseConfiguration() { -} - -// The configuration target. You must set the target to `country` when specifying a -// country code in the rule. -type UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCountryConfigurationTarget string - -const ( - UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCountryConfigurationTargetCountry UserFirewallAccessRuleRuleListResponseConfigurationLegacyJhsCountryConfigurationTarget = "country" -) - -// The action to apply to a matched request. -type UserFirewallAccessRuleRuleListResponseMode string - -const ( - UserFirewallAccessRuleRuleListResponseModeBlock UserFirewallAccessRuleRuleListResponseMode = "block" - UserFirewallAccessRuleRuleListResponseModeChallenge UserFirewallAccessRuleRuleListResponseMode = "challenge" - UserFirewallAccessRuleRuleListResponseModeWhitelist UserFirewallAccessRuleRuleListResponseMode = "whitelist" - UserFirewallAccessRuleRuleListResponseModeJsChallenge UserFirewallAccessRuleRuleListResponseMode = "js_challenge" - UserFirewallAccessRuleRuleListResponseModeManagedChallenge UserFirewallAccessRuleRuleListResponseMode = "managed_challenge" -) - -type UserFirewallAccessRuleRuleDeleteResponse struct { - // The unique identifier of the IP Access rule. - ID string `json:"id"` - JSON userFirewallAccessRuleRuleDeleteResponseJSON `json:"-"` -} - -// userFirewallAccessRuleRuleDeleteResponseJSON contains the JSON metadata for the -// struct [UserFirewallAccessRuleRuleDeleteResponse] -type userFirewallAccessRuleRuleDeleteResponseJSON struct { - ID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleDeleteResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type UserFirewallAccessRuleRuleEditResponse struct { - // The unique identifier of the IP Access rule. - ID string `json:"id,required"` - // The available actions that a rule can apply to a matched request. - AllowedModes []UserFirewallAccessRuleRuleEditResponseAllowedMode `json:"allowed_modes,required"` - // The rule configuration. - Configuration UserFirewallAccessRuleRuleEditResponseConfiguration `json:"configuration,required"` - // The action to apply to a matched request. - Mode UserFirewallAccessRuleRuleEditResponseMode `json:"mode,required"` - // The timestamp of when the rule was created. - CreatedOn time.Time `json:"created_on" format:"date-time"` - // The timestamp of when the rule was last modified. - ModifiedOn time.Time `json:"modified_on" format:"date-time"` - // An informative summary of the rule, typically used as a reminder or explanation. - Notes string `json:"notes"` - JSON userFirewallAccessRuleRuleEditResponseJSON `json:"-"` -} - -// userFirewallAccessRuleRuleEditResponseJSON contains the JSON metadata for the -// struct [UserFirewallAccessRuleRuleEditResponse] -type userFirewallAccessRuleRuleEditResponseJSON struct { - ID apijson.Field - AllowedModes apijson.Field - Configuration apijson.Field - Mode apijson.Field - CreatedOn apijson.Field - ModifiedOn apijson.Field - Notes apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleEditResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// The action to apply to a matched request. -type UserFirewallAccessRuleRuleEditResponseAllowedMode string - -const ( - UserFirewallAccessRuleRuleEditResponseAllowedModeBlock UserFirewallAccessRuleRuleEditResponseAllowedMode = "block" - UserFirewallAccessRuleRuleEditResponseAllowedModeChallenge UserFirewallAccessRuleRuleEditResponseAllowedMode = "challenge" - UserFirewallAccessRuleRuleEditResponseAllowedModeWhitelist UserFirewallAccessRuleRuleEditResponseAllowedMode = "whitelist" - UserFirewallAccessRuleRuleEditResponseAllowedModeJsChallenge UserFirewallAccessRuleRuleEditResponseAllowedMode = "js_challenge" - UserFirewallAccessRuleRuleEditResponseAllowedModeManagedChallenge UserFirewallAccessRuleRuleEditResponseAllowedMode = "managed_challenge" -) - -// The rule configuration. -// -// Union satisfied by -// [UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPConfiguration], -// [UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPV6Configuration], -// [UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCidrConfiguration], -// [UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsASNConfiguration] -// or -// [UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCountryConfiguration]. -type UserFirewallAccessRuleRuleEditResponseConfiguration interface { - implementsUserFirewallAccessRuleRuleEditResponseConfiguration() -} - -func init() { - apijson.RegisterUnion(reflect.TypeOf((*UserFirewallAccessRuleRuleEditResponseConfiguration)(nil)).Elem(), "") -} - -type UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPConfiguration struct { - // The configuration target. You must set the target to `ip` when specifying an IP - // address in the rule. - Target UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPConfigurationTarget `json:"target"` - // The IP address to match. This address will be compared to the IP address of - // incoming requests. - Value string `json:"value"` - JSON userFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPConfigurationJSON `json:"-"` -} - -// userFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPConfigurationJSON -// contains the JSON metadata for the struct -// [UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPConfiguration] -type userFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPConfigurationJSON struct { - Target apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPConfiguration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPConfiguration) implementsUserFirewallAccessRuleRuleEditResponseConfiguration() { -} - -// The configuration target. You must set the target to `ip` when specifying an IP -// address in the rule. -type UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPConfigurationTarget string - -const ( - UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPConfigurationTargetIP UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPConfigurationTarget = "ip" -) - -type UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPV6Configuration struct { - // The configuration target. You must set the target to `ip6` when specifying an - // IPv6 address in the rule. - Target UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPV6ConfigurationTarget `json:"target"` - // The IPv6 address to match. - Value string `json:"value"` - JSON userFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPV6ConfigurationJSON `json:"-"` -} - -// userFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPV6ConfigurationJSON -// contains the JSON metadata for the struct -// [UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPV6Configuration] -type userFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPV6ConfigurationJSON struct { - Target apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPV6Configuration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPV6Configuration) implementsUserFirewallAccessRuleRuleEditResponseConfiguration() { -} - -// The configuration target. You must set the target to `ip6` when specifying an -// IPv6 address in the rule. -type UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPV6ConfigurationTarget string - -const ( - UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPV6ConfigurationTargetIp6 UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsIPV6ConfigurationTarget = "ip6" -) - -type UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCidrConfiguration struct { - // The configuration target. You must set the target to `ip_range` when specifying - // an IP address range in the rule. - Target UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCidrConfigurationTarget `json:"target"` - // The IP address range to match. You can only use prefix lengths `/16` and `/24` - // for IPv4 ranges, and prefix lengths `/32`, `/48`, and `/64` for IPv6 ranges. - Value string `json:"value"` - JSON userFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCidrConfigurationJSON `json:"-"` -} - -// userFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCidrConfigurationJSON -// contains the JSON metadata for the struct -// [UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCidrConfiguration] -type userFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCidrConfigurationJSON struct { - Target apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCidrConfiguration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCidrConfiguration) implementsUserFirewallAccessRuleRuleEditResponseConfiguration() { -} - -// The configuration target. You must set the target to `ip_range` when specifying -// an IP address range in the rule. -type UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCidrConfigurationTarget string - -const ( - UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCidrConfigurationTargetIPRange UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCidrConfigurationTarget = "ip_range" -) - -type UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsASNConfiguration struct { - // The configuration target. You must set the target to `asn` when specifying an - // Autonomous System Number (ASN) in the rule. - Target UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsASNConfigurationTarget `json:"target"` - // The AS number to match. - Value string `json:"value"` - JSON userFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsASNConfigurationJSON `json:"-"` -} - -// userFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsASNConfigurationJSON -// contains the JSON metadata for the struct -// [UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsASNConfiguration] -type userFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsASNConfigurationJSON struct { - Target apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsASNConfiguration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsASNConfiguration) implementsUserFirewallAccessRuleRuleEditResponseConfiguration() { -} - -// The configuration target. You must set the target to `asn` when specifying an -// Autonomous System Number (ASN) in the rule. -type UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsASNConfigurationTarget string - -const ( - UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsASNConfigurationTargetASN UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsASNConfigurationTarget = "asn" -) - -type UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCountryConfiguration struct { - // The configuration target. You must set the target to `country` when specifying a - // country code in the rule. - Target UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCountryConfigurationTarget `json:"target"` - // The two-letter ISO-3166-1 alpha-2 code to match. For more information, refer to - // [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country). - Value string `json:"value"` - JSON userFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCountryConfigurationJSON `json:"-"` -} - -// userFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCountryConfigurationJSON -// contains the JSON metadata for the struct -// [UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCountryConfiguration] -type userFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCountryConfigurationJSON struct { - Target apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCountryConfiguration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCountryConfiguration) implementsUserFirewallAccessRuleRuleEditResponseConfiguration() { -} - -// The configuration target. You must set the target to `country` when specifying a -// country code in the rule. -type UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCountryConfigurationTarget string - -const ( - UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCountryConfigurationTargetCountry UserFirewallAccessRuleRuleEditResponseConfigurationLegacyJhsCountryConfigurationTarget = "country" -) - -// The action to apply to a matched request. -type UserFirewallAccessRuleRuleEditResponseMode string - -const ( - UserFirewallAccessRuleRuleEditResponseModeBlock UserFirewallAccessRuleRuleEditResponseMode = "block" - UserFirewallAccessRuleRuleEditResponseModeChallenge UserFirewallAccessRuleRuleEditResponseMode = "challenge" - UserFirewallAccessRuleRuleEditResponseModeWhitelist UserFirewallAccessRuleRuleEditResponseMode = "whitelist" - UserFirewallAccessRuleRuleEditResponseModeJsChallenge UserFirewallAccessRuleRuleEditResponseMode = "js_challenge" - UserFirewallAccessRuleRuleEditResponseModeManagedChallenge UserFirewallAccessRuleRuleEditResponseMode = "managed_challenge" -) - -type UserFirewallAccessRuleRuleNewParams struct { - // The rule configuration. - Configuration param.Field[UserFirewallAccessRuleRuleNewParamsConfiguration] `json:"configuration,required"` - // The action to apply to a matched request. - Mode param.Field[UserFirewallAccessRuleRuleNewParamsMode] `json:"mode,required"` - // An informative summary of the rule, typically used as a reminder or explanation. - Notes param.Field[string] `json:"notes"` -} - -func (r UserFirewallAccessRuleRuleNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The rule configuration. -// -// Satisfied by -// [UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsIPConfiguration], -// [UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsIPV6Configuration], -// [UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsCidrConfiguration], -// [UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsASNConfiguration], -// [UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsCountryConfiguration]. -type UserFirewallAccessRuleRuleNewParamsConfiguration interface { - implementsUserFirewallAccessRuleRuleNewParamsConfiguration() -} - -type UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsIPConfiguration struct { - // The configuration target. You must set the target to `ip` when specifying an IP - // address in the rule. - Target param.Field[UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsIPConfigurationTarget] `json:"target"` - // The IP address to match. This address will be compared to the IP address of - // incoming requests. - Value param.Field[string] `json:"value"` -} - -func (r UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsIPConfiguration) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsIPConfiguration) implementsUserFirewallAccessRuleRuleNewParamsConfiguration() { -} - -// The configuration target. You must set the target to `ip` when specifying an IP -// address in the rule. -type UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsIPConfigurationTarget string - -const ( - UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsIPConfigurationTargetIP UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsIPConfigurationTarget = "ip" -) - -type UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsIPV6Configuration struct { - // The configuration target. You must set the target to `ip6` when specifying an - // IPv6 address in the rule. - Target param.Field[UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsIPV6ConfigurationTarget] `json:"target"` - // The IPv6 address to match. - Value param.Field[string] `json:"value"` -} - -func (r UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsIPV6Configuration) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsIPV6Configuration) implementsUserFirewallAccessRuleRuleNewParamsConfiguration() { -} - -// The configuration target. You must set the target to `ip6` when specifying an -// IPv6 address in the rule. -type UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsIPV6ConfigurationTarget string - -const ( - UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsIPV6ConfigurationTargetIp6 UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsIPV6ConfigurationTarget = "ip6" -) - -type UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsCidrConfiguration struct { - // The configuration target. You must set the target to `ip_range` when specifying - // an IP address range in the rule. - Target param.Field[UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsCidrConfigurationTarget] `json:"target"` - // The IP address range to match. You can only use prefix lengths `/16` and `/24` - // for IPv4 ranges, and prefix lengths `/32`, `/48`, and `/64` for IPv6 ranges. - Value param.Field[string] `json:"value"` -} - -func (r UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsCidrConfiguration) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsCidrConfiguration) implementsUserFirewallAccessRuleRuleNewParamsConfiguration() { -} - -// The configuration target. You must set the target to `ip_range` when specifying -// an IP address range in the rule. -type UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsCidrConfigurationTarget string - -const ( - UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsCidrConfigurationTargetIPRange UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsCidrConfigurationTarget = "ip_range" -) - -type UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsASNConfiguration struct { - // The configuration target. You must set the target to `asn` when specifying an - // Autonomous System Number (ASN) in the rule. - Target param.Field[UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsASNConfigurationTarget] `json:"target"` - // The AS number to match. - Value param.Field[string] `json:"value"` -} - -func (r UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsASNConfiguration) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsASNConfiguration) implementsUserFirewallAccessRuleRuleNewParamsConfiguration() { -} - -// The configuration target. You must set the target to `asn` when specifying an -// Autonomous System Number (ASN) in the rule. -type UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsASNConfigurationTarget string - -const ( - UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsASNConfigurationTargetASN UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsASNConfigurationTarget = "asn" -) - -type UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsCountryConfiguration struct { - // The configuration target. You must set the target to `country` when specifying a - // country code in the rule. - Target param.Field[UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsCountryConfigurationTarget] `json:"target"` - // The two-letter ISO-3166-1 alpha-2 code to match. For more information, refer to - // [IP Access rules: Parameters](https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country). - Value param.Field[string] `json:"value"` -} - -func (r UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsCountryConfiguration) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsCountryConfiguration) implementsUserFirewallAccessRuleRuleNewParamsConfiguration() { -} - -// The configuration target. You must set the target to `country` when specifying a -// country code in the rule. -type UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsCountryConfigurationTarget string - -const ( - UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsCountryConfigurationTargetCountry UserFirewallAccessRuleRuleNewParamsConfigurationLegacyJhsCountryConfigurationTarget = "country" -) - -// The action to apply to a matched request. -type UserFirewallAccessRuleRuleNewParamsMode string - -const ( - UserFirewallAccessRuleRuleNewParamsModeBlock UserFirewallAccessRuleRuleNewParamsMode = "block" - UserFirewallAccessRuleRuleNewParamsModeChallenge UserFirewallAccessRuleRuleNewParamsMode = "challenge" - UserFirewallAccessRuleRuleNewParamsModeWhitelist UserFirewallAccessRuleRuleNewParamsMode = "whitelist" - UserFirewallAccessRuleRuleNewParamsModeJsChallenge UserFirewallAccessRuleRuleNewParamsMode = "js_challenge" - UserFirewallAccessRuleRuleNewParamsModeManagedChallenge UserFirewallAccessRuleRuleNewParamsMode = "managed_challenge" -) - -type UserFirewallAccessRuleRuleNewResponseEnvelope struct { - Errors []UserFirewallAccessRuleRuleNewResponseEnvelopeErrors `json:"errors,required"` - Messages []UserFirewallAccessRuleRuleNewResponseEnvelopeMessages `json:"messages,required"` - Result UserFirewallAccessRuleRuleNewResponse `json:"result,required,nullable"` - // Whether the API call was successful - Success UserFirewallAccessRuleRuleNewResponseEnvelopeSuccess `json:"success,required"` - JSON userFirewallAccessRuleRuleNewResponseEnvelopeJSON `json:"-"` -} - -// userFirewallAccessRuleRuleNewResponseEnvelopeJSON contains the JSON metadata for -// the struct [UserFirewallAccessRuleRuleNewResponseEnvelope] -type userFirewallAccessRuleRuleNewResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type UserFirewallAccessRuleRuleNewResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON userFirewallAccessRuleRuleNewResponseEnvelopeErrorsJSON `json:"-"` -} - -// userFirewallAccessRuleRuleNewResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [UserFirewallAccessRuleRuleNewResponseEnvelopeErrors] -type userFirewallAccessRuleRuleNewResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type UserFirewallAccessRuleRuleNewResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON userFirewallAccessRuleRuleNewResponseEnvelopeMessagesJSON `json:"-"` -} - -// userFirewallAccessRuleRuleNewResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [UserFirewallAccessRuleRuleNewResponseEnvelopeMessages] -type userFirewallAccessRuleRuleNewResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type UserFirewallAccessRuleRuleNewResponseEnvelopeSuccess bool - -const ( - UserFirewallAccessRuleRuleNewResponseEnvelopeSuccessTrue UserFirewallAccessRuleRuleNewResponseEnvelopeSuccess = true -) - -type UserFirewallAccessRuleRuleListParams struct { - // The direction used to sort returned rules. - Direction param.Field[UserFirewallAccessRuleRuleListParamsDirection] `query:"direction"` - EgsPagination param.Field[UserFirewallAccessRuleRuleListParamsEgsPagination] `query:"egs-pagination"` - Filters param.Field[UserFirewallAccessRuleRuleListParamsFilters] `query:"filters"` - // The field used to sort returned rules. - Order param.Field[UserFirewallAccessRuleRuleListParamsOrder] `query:"order"` - // Requested page within paginated list of results. - Page param.Field[float64] `query:"page"` - // Maximum number of results requested. - PerPage param.Field[float64] `query:"per_page"` -} - -// URLQuery serializes [UserFirewallAccessRuleRuleListParams]'s query parameters as -// `url.Values`. -func (r UserFirewallAccessRuleRuleListParams) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatComma, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} - -// The direction used to sort returned rules. -type UserFirewallAccessRuleRuleListParamsDirection string - -const ( - UserFirewallAccessRuleRuleListParamsDirectionAsc UserFirewallAccessRuleRuleListParamsDirection = "asc" - UserFirewallAccessRuleRuleListParamsDirectionDesc UserFirewallAccessRuleRuleListParamsDirection = "desc" -) - -type UserFirewallAccessRuleRuleListParamsEgsPagination struct { - Json param.Field[UserFirewallAccessRuleRuleListParamsEgsPaginationJson] `query:"json"` -} - -// URLQuery serializes [UserFirewallAccessRuleRuleListParamsEgsPagination]'s query -// parameters as `url.Values`. -func (r UserFirewallAccessRuleRuleListParamsEgsPagination) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatComma, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} - -type UserFirewallAccessRuleRuleListParamsEgsPaginationJson struct { - // The page number of paginated results. - Page param.Field[float64] `query:"page"` - // The maximum number of results per page. You can only set the value to `1` or to - // a multiple of 5 such as `5`, `10`, `15`, or `20`. - PerPage param.Field[float64] `query:"per_page"` -} - -// URLQuery serializes [UserFirewallAccessRuleRuleListParamsEgsPaginationJson]'s -// query parameters as `url.Values`. -func (r UserFirewallAccessRuleRuleListParamsEgsPaginationJson) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatComma, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} - -type UserFirewallAccessRuleRuleListParamsFilters struct { - // The target to search in existing rules. - ConfigurationTarget param.Field[UserFirewallAccessRuleRuleListParamsFiltersConfigurationTarget] `query:"configuration.target"` - // The target value to search for in existing rules: an IP address, an IP address - // range, or a country code, depending on the provided `configuration.target`. - // Notes: You can search for a single IPv4 address, an IP address range with a - // subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code. - ConfigurationValue param.Field[string] `query:"configuration.value"` - // When set to `all`, all the search requirements must match. When set to `any`, - // only one of the search requirements has to match. - Match param.Field[UserFirewallAccessRuleRuleListParamsFiltersMatch] `query:"match"` - // The action to apply to a matched request. - Mode param.Field[UserFirewallAccessRuleRuleListParamsFiltersMode] `query:"mode"` - // The string to search for in the notes of existing IP Access rules. Notes: For - // example, the string 'attack' would match IP Access rules with notes 'Attack - // 26/02' and 'Attack 27/02'. The search is case insensitive. - Notes param.Field[string] `query:"notes"` -} - -// URLQuery serializes [UserFirewallAccessRuleRuleListParamsFilters]'s query -// parameters as `url.Values`. -func (r UserFirewallAccessRuleRuleListParamsFilters) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatComma, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} - -// The target to search in existing rules. -type UserFirewallAccessRuleRuleListParamsFiltersConfigurationTarget string - -const ( - UserFirewallAccessRuleRuleListParamsFiltersConfigurationTargetIP UserFirewallAccessRuleRuleListParamsFiltersConfigurationTarget = "ip" - UserFirewallAccessRuleRuleListParamsFiltersConfigurationTargetIPRange UserFirewallAccessRuleRuleListParamsFiltersConfigurationTarget = "ip_range" - UserFirewallAccessRuleRuleListParamsFiltersConfigurationTargetASN UserFirewallAccessRuleRuleListParamsFiltersConfigurationTarget = "asn" - UserFirewallAccessRuleRuleListParamsFiltersConfigurationTargetCountry UserFirewallAccessRuleRuleListParamsFiltersConfigurationTarget = "country" -) - -// When set to `all`, all the search requirements must match. When set to `any`, -// only one of the search requirements has to match. -type UserFirewallAccessRuleRuleListParamsFiltersMatch string - -const ( - UserFirewallAccessRuleRuleListParamsFiltersMatchAny UserFirewallAccessRuleRuleListParamsFiltersMatch = "any" - UserFirewallAccessRuleRuleListParamsFiltersMatchAll UserFirewallAccessRuleRuleListParamsFiltersMatch = "all" -) - -// The action to apply to a matched request. -type UserFirewallAccessRuleRuleListParamsFiltersMode string - -const ( - UserFirewallAccessRuleRuleListParamsFiltersModeBlock UserFirewallAccessRuleRuleListParamsFiltersMode = "block" - UserFirewallAccessRuleRuleListParamsFiltersModeChallenge UserFirewallAccessRuleRuleListParamsFiltersMode = "challenge" - UserFirewallAccessRuleRuleListParamsFiltersModeWhitelist UserFirewallAccessRuleRuleListParamsFiltersMode = "whitelist" - UserFirewallAccessRuleRuleListParamsFiltersModeJsChallenge UserFirewallAccessRuleRuleListParamsFiltersMode = "js_challenge" - UserFirewallAccessRuleRuleListParamsFiltersModeManagedChallenge UserFirewallAccessRuleRuleListParamsFiltersMode = "managed_challenge" -) - -// The field used to sort returned rules. -type UserFirewallAccessRuleRuleListParamsOrder string - -const ( - UserFirewallAccessRuleRuleListParamsOrderConfigurationTarget UserFirewallAccessRuleRuleListParamsOrder = "configuration.target" - UserFirewallAccessRuleRuleListParamsOrderConfigurationValue UserFirewallAccessRuleRuleListParamsOrder = "configuration.value" - UserFirewallAccessRuleRuleListParamsOrderMode UserFirewallAccessRuleRuleListParamsOrder = "mode" -) - -type UserFirewallAccessRuleRuleDeleteResponseEnvelope struct { - Errors []UserFirewallAccessRuleRuleDeleteResponseEnvelopeErrors `json:"errors,required"` - Messages []UserFirewallAccessRuleRuleDeleteResponseEnvelopeMessages `json:"messages,required"` - Result UserFirewallAccessRuleRuleDeleteResponse `json:"result,required,nullable"` - // Whether the API call was successful - Success UserFirewallAccessRuleRuleDeleteResponseEnvelopeSuccess `json:"success,required"` - JSON userFirewallAccessRuleRuleDeleteResponseEnvelopeJSON `json:"-"` -} - -// userFirewallAccessRuleRuleDeleteResponseEnvelopeJSON contains the JSON metadata -// for the struct [UserFirewallAccessRuleRuleDeleteResponseEnvelope] -type userFirewallAccessRuleRuleDeleteResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type UserFirewallAccessRuleRuleDeleteResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON userFirewallAccessRuleRuleDeleteResponseEnvelopeErrorsJSON `json:"-"` -} - -// userFirewallAccessRuleRuleDeleteResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [UserFirewallAccessRuleRuleDeleteResponseEnvelopeErrors] -type userFirewallAccessRuleRuleDeleteResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type UserFirewallAccessRuleRuleDeleteResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON userFirewallAccessRuleRuleDeleteResponseEnvelopeMessagesJSON `json:"-"` -} - -// userFirewallAccessRuleRuleDeleteResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct -// [UserFirewallAccessRuleRuleDeleteResponseEnvelopeMessages] -type userFirewallAccessRuleRuleDeleteResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type UserFirewallAccessRuleRuleDeleteResponseEnvelopeSuccess bool - -const ( - UserFirewallAccessRuleRuleDeleteResponseEnvelopeSuccessTrue UserFirewallAccessRuleRuleDeleteResponseEnvelopeSuccess = true -) - -type UserFirewallAccessRuleRuleEditParams struct { - // The action to apply to a matched request. - Mode param.Field[UserFirewallAccessRuleRuleEditParamsMode] `json:"mode"` - // An informative summary of the rule, typically used as a reminder or explanation. - Notes param.Field[string] `json:"notes"` -} - -func (r UserFirewallAccessRuleRuleEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The action to apply to a matched request. -type UserFirewallAccessRuleRuleEditParamsMode string - -const ( - UserFirewallAccessRuleRuleEditParamsModeBlock UserFirewallAccessRuleRuleEditParamsMode = "block" - UserFirewallAccessRuleRuleEditParamsModeChallenge UserFirewallAccessRuleRuleEditParamsMode = "challenge" - UserFirewallAccessRuleRuleEditParamsModeWhitelist UserFirewallAccessRuleRuleEditParamsMode = "whitelist" - UserFirewallAccessRuleRuleEditParamsModeJsChallenge UserFirewallAccessRuleRuleEditParamsMode = "js_challenge" - UserFirewallAccessRuleRuleEditParamsModeManagedChallenge UserFirewallAccessRuleRuleEditParamsMode = "managed_challenge" -) - -type UserFirewallAccessRuleRuleEditResponseEnvelope struct { - Errors []UserFirewallAccessRuleRuleEditResponseEnvelopeErrors `json:"errors,required"` - Messages []UserFirewallAccessRuleRuleEditResponseEnvelopeMessages `json:"messages,required"` - Result UserFirewallAccessRuleRuleEditResponse `json:"result,required,nullable"` - // Whether the API call was successful - Success UserFirewallAccessRuleRuleEditResponseEnvelopeSuccess `json:"success,required"` - JSON userFirewallAccessRuleRuleEditResponseEnvelopeJSON `json:"-"` -} - -// userFirewallAccessRuleRuleEditResponseEnvelopeJSON contains the JSON metadata -// for the struct [UserFirewallAccessRuleRuleEditResponseEnvelope] -type userFirewallAccessRuleRuleEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type UserFirewallAccessRuleRuleEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON userFirewallAccessRuleRuleEditResponseEnvelopeErrorsJSON `json:"-"` -} - -// userFirewallAccessRuleRuleEditResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [UserFirewallAccessRuleRuleEditResponseEnvelopeErrors] -type userFirewallAccessRuleRuleEditResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type UserFirewallAccessRuleRuleEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON userFirewallAccessRuleRuleEditResponseEnvelopeMessagesJSON `json:"-"` -} - -// userFirewallAccessRuleRuleEditResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [UserFirewallAccessRuleRuleEditResponseEnvelopeMessages] -type userFirewallAccessRuleRuleEditResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserFirewallAccessRuleRuleEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type UserFirewallAccessRuleRuleEditResponseEnvelopeSuccess bool - -const ( - UserFirewallAccessRuleRuleEditResponseEnvelopeSuccessTrue UserFirewallAccessRuleRuleEditResponseEnvelopeSuccess = true -) diff --git a/userloadbalancer.go b/userloadbalancer.go index c8d96e84666..623c012a4e8 100644 --- a/userloadbalancer.go +++ b/userloadbalancer.go @@ -12,10 +12,11 @@ import ( // this service directly, and instead use the [NewUserLoadBalancerService] method // instead. type UserLoadBalancerService struct { - Options []option.RequestOption - Monitors *UserLoadBalancerMonitorService - Pools *UserLoadBalancerPoolService - Preview *UserLoadBalancerPreviewService + Options []option.RequestOption + Monitors *UserLoadBalancerMonitorService + Pools *UserLoadBalancerPoolService + Preview *UserLoadBalancerPreviewService + Analytics *UserLoadBalancerAnalyticsService } // NewUserLoadBalancerService generates a new service that applies the given @@ -27,5 +28,6 @@ func NewUserLoadBalancerService(opts ...option.RequestOption) (r *UserLoadBalanc r.Monitors = NewUserLoadBalancerMonitorService(opts...) r.Pools = NewUserLoadBalancerPoolService(opts...) r.Preview = NewUserLoadBalancerPreviewService(opts...) + r.Analytics = NewUserLoadBalancerAnalyticsService(opts...) return } diff --git a/userloadbalancinganalytic.go b/userloadbalanceranalytics.go similarity index 55% rename from userloadbalancinganalytic.go rename to userloadbalanceranalytics.go index ea3787371a9..244bbb26f4e 100644 --- a/userloadbalancinganalytic.go +++ b/userloadbalanceranalytics.go @@ -6,22 +6,22 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -// UserLoadBalancingAnalyticService contains methods and other services that help +// UserLoadBalancerAnalyticsService contains methods and other services that help // with interacting with the cloudflare API. Note, unlike clients, this service // does not read variables from the environment automatically. You should not // instantiate this service directly, and instead use the -// [NewUserLoadBalancingAnalyticService] method instead. -type UserLoadBalancingAnalyticService struct { +// [NewUserLoadBalancerAnalyticsService] method instead. +type UserLoadBalancerAnalyticsService struct { Options []option.RequestOption - Events *UserLoadBalancingAnalyticEventService + Events *UserLoadBalancerAnalyticsEventService } -// NewUserLoadBalancingAnalyticService generates a new service that applies the +// NewUserLoadBalancerAnalyticsService generates a new service that applies the // given options to each request. These options are applied after the parent // client's options (if there is one), and before any request-specific options. -func NewUserLoadBalancingAnalyticService(opts ...option.RequestOption) (r *UserLoadBalancingAnalyticService) { - r = &UserLoadBalancingAnalyticService{} +func NewUserLoadBalancerAnalyticsService(opts ...option.RequestOption) (r *UserLoadBalancerAnalyticsService) { + r = &UserLoadBalancerAnalyticsService{} r.Options = opts - r.Events = NewUserLoadBalancingAnalyticEventService(opts...) + r.Events = NewUserLoadBalancerAnalyticsEventService(opts...) return } diff --git a/userloadbalancinganalyticevent.go b/userloadbalanceranalyticsevent.go similarity index 61% rename from userloadbalancinganalyticevent.go rename to userloadbalanceranalyticsevent.go index 9b776b6af83..bc31069f721 100644 --- a/userloadbalancinganalyticevent.go +++ b/userloadbalanceranalyticsevent.go @@ -15,28 +15,28 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -// UserLoadBalancingAnalyticEventService contains methods and other services that +// UserLoadBalancerAnalyticsEventService contains methods and other services that // help with interacting with the cloudflare API. Note, unlike clients, this // service does not read variables from the environment automatically. You should // not instantiate this service directly, and instead use the -// [NewUserLoadBalancingAnalyticEventService] method instead. -type UserLoadBalancingAnalyticEventService struct { +// [NewUserLoadBalancerAnalyticsEventService] method instead. +type UserLoadBalancerAnalyticsEventService struct { Options []option.RequestOption } -// NewUserLoadBalancingAnalyticEventService generates a new service that applies +// NewUserLoadBalancerAnalyticsEventService generates a new service that applies // the given options to each request. These options are applied after the parent // client's options (if there is one), and before any request-specific options. -func NewUserLoadBalancingAnalyticEventService(opts ...option.RequestOption) (r *UserLoadBalancingAnalyticEventService) { - r = &UserLoadBalancingAnalyticEventService{} +func NewUserLoadBalancerAnalyticsEventService(opts ...option.RequestOption) (r *UserLoadBalancerAnalyticsEventService) { + r = &UserLoadBalancerAnalyticsEventService{} r.Options = opts return } // List origin health changes. -func (r *UserLoadBalancingAnalyticEventService) List(ctx context.Context, query UserLoadBalancingAnalyticEventListParams, opts ...option.RequestOption) (res *[]UserLoadBalancingAnalyticEventListResponse, err error) { +func (r *UserLoadBalancerAnalyticsEventService) List(ctx context.Context, query UserLoadBalancerAnalyticsEventListParams, opts ...option.RequestOption) (res *[]UserLoadBalancerAnalyticsEventListResponse, err error) { opts = append(r.Options[:], opts...) - var env UserLoadBalancingAnalyticEventListResponseEnvelope + var env UserLoadBalancerAnalyticsEventListResponseEnvelope path := "user/load_balancing_analytics/events" err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) if err != nil { @@ -46,17 +46,17 @@ func (r *UserLoadBalancingAnalyticEventService) List(ctx context.Context, query return } -type UserLoadBalancingAnalyticEventListResponse struct { +type UserLoadBalancerAnalyticsEventListResponse struct { ID int64 `json:"id"` Origins []interface{} `json:"origins"` Pool interface{} `json:"pool"` Timestamp time.Time `json:"timestamp" format:"date-time"` - JSON userLoadBalancingAnalyticEventListResponseJSON `json:"-"` + JSON userLoadBalancerAnalyticsEventListResponseJSON `json:"-"` } -// userLoadBalancingAnalyticEventListResponseJSON contains the JSON metadata for -// the struct [UserLoadBalancingAnalyticEventListResponse] -type userLoadBalancingAnalyticEventListResponseJSON struct { +// userLoadBalancerAnalyticsEventListResponseJSON contains the JSON metadata for +// the struct [UserLoadBalancerAnalyticsEventListResponse] +type userLoadBalancerAnalyticsEventListResponseJSON struct { ID apijson.Field Origins apijson.Field Pool apijson.Field @@ -65,11 +65,11 @@ type userLoadBalancingAnalyticEventListResponseJSON struct { ExtraFields map[string]apijson.Field } -func (r *UserLoadBalancingAnalyticEventListResponse) UnmarshalJSON(data []byte) (err error) { +func (r *UserLoadBalancerAnalyticsEventListResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type UserLoadBalancingAnalyticEventListParams struct { +type UserLoadBalancerAnalyticsEventListParams struct { // If true, filter events where the origin status is healthy. If false, filter // events where the origin status is unhealthy. OriginHealthy param.Field[bool] `query:"origin_healthy"` @@ -87,28 +87,28 @@ type UserLoadBalancingAnalyticEventListParams struct { Until param.Field[time.Time] `query:"until" format:"date-time"` } -// URLQuery serializes [UserLoadBalancingAnalyticEventListParams]'s query +// URLQuery serializes [UserLoadBalancerAnalyticsEventListParams]'s query // parameters as `url.Values`. -func (r UserLoadBalancingAnalyticEventListParams) URLQuery() (v url.Values) { +func (r UserLoadBalancerAnalyticsEventListParams) URLQuery() (v url.Values) { return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ ArrayFormat: apiquery.ArrayQueryFormatComma, NestedFormat: apiquery.NestedQueryFormatBrackets, }) } -type UserLoadBalancingAnalyticEventListResponseEnvelope struct { - Errors []UserLoadBalancingAnalyticEventListResponseEnvelopeErrors `json:"errors,required"` - Messages []UserLoadBalancingAnalyticEventListResponseEnvelopeMessages `json:"messages,required"` - Result []UserLoadBalancingAnalyticEventListResponse `json:"result,required,nullable"` +type UserLoadBalancerAnalyticsEventListResponseEnvelope struct { + Errors []UserLoadBalancerAnalyticsEventListResponseEnvelopeErrors `json:"errors,required"` + Messages []UserLoadBalancerAnalyticsEventListResponseEnvelopeMessages `json:"messages,required"` + Result []UserLoadBalancerAnalyticsEventListResponse `json:"result,required,nullable"` // Whether the API call was successful - Success UserLoadBalancingAnalyticEventListResponseEnvelopeSuccess `json:"success,required"` - ResultInfo UserLoadBalancingAnalyticEventListResponseEnvelopeResultInfo `json:"result_info"` - JSON userLoadBalancingAnalyticEventListResponseEnvelopeJSON `json:"-"` + Success UserLoadBalancerAnalyticsEventListResponseEnvelopeSuccess `json:"success,required"` + ResultInfo UserLoadBalancerAnalyticsEventListResponseEnvelopeResultInfo `json:"result_info"` + JSON userLoadBalancerAnalyticsEventListResponseEnvelopeJSON `json:"-"` } -// userLoadBalancingAnalyticEventListResponseEnvelopeJSON contains the JSON -// metadata for the struct [UserLoadBalancingAnalyticEventListResponseEnvelope] -type userLoadBalancingAnalyticEventListResponseEnvelopeJSON struct { +// userLoadBalancerAnalyticsEventListResponseEnvelopeJSON contains the JSON +// metadata for the struct [UserLoadBalancerAnalyticsEventListResponseEnvelope] +type userLoadBalancerAnalyticsEventListResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field Result apijson.Field @@ -118,58 +118,58 @@ type userLoadBalancingAnalyticEventListResponseEnvelopeJSON struct { ExtraFields map[string]apijson.Field } -func (r *UserLoadBalancingAnalyticEventListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { +func (r *UserLoadBalancerAnalyticsEventListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type UserLoadBalancingAnalyticEventListResponseEnvelopeErrors struct { +type UserLoadBalancerAnalyticsEventListResponseEnvelopeErrors struct { Code int64 `json:"code,required"` Message string `json:"message,required"` - JSON userLoadBalancingAnalyticEventListResponseEnvelopeErrorsJSON `json:"-"` + JSON userLoadBalancerAnalyticsEventListResponseEnvelopeErrorsJSON `json:"-"` } -// userLoadBalancingAnalyticEventListResponseEnvelopeErrorsJSON contains the JSON +// userLoadBalancerAnalyticsEventListResponseEnvelopeErrorsJSON contains the JSON // metadata for the struct -// [UserLoadBalancingAnalyticEventListResponseEnvelopeErrors] -type userLoadBalancingAnalyticEventListResponseEnvelopeErrorsJSON struct { +// [UserLoadBalancerAnalyticsEventListResponseEnvelopeErrors] +type userLoadBalancerAnalyticsEventListResponseEnvelopeErrorsJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *UserLoadBalancingAnalyticEventListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { +func (r *UserLoadBalancerAnalyticsEventListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type UserLoadBalancingAnalyticEventListResponseEnvelopeMessages struct { +type UserLoadBalancerAnalyticsEventListResponseEnvelopeMessages struct { Code int64 `json:"code,required"` Message string `json:"message,required"` - JSON userLoadBalancingAnalyticEventListResponseEnvelopeMessagesJSON `json:"-"` + JSON userLoadBalancerAnalyticsEventListResponseEnvelopeMessagesJSON `json:"-"` } -// userLoadBalancingAnalyticEventListResponseEnvelopeMessagesJSON contains the JSON +// userLoadBalancerAnalyticsEventListResponseEnvelopeMessagesJSON contains the JSON // metadata for the struct -// [UserLoadBalancingAnalyticEventListResponseEnvelopeMessages] -type userLoadBalancingAnalyticEventListResponseEnvelopeMessagesJSON struct { +// [UserLoadBalancerAnalyticsEventListResponseEnvelopeMessages] +type userLoadBalancerAnalyticsEventListResponseEnvelopeMessagesJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *UserLoadBalancingAnalyticEventListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { +func (r *UserLoadBalancerAnalyticsEventListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // Whether the API call was successful -type UserLoadBalancingAnalyticEventListResponseEnvelopeSuccess bool +type UserLoadBalancerAnalyticsEventListResponseEnvelopeSuccess bool const ( - UserLoadBalancingAnalyticEventListResponseEnvelopeSuccessTrue UserLoadBalancingAnalyticEventListResponseEnvelopeSuccess = true + UserLoadBalancerAnalyticsEventListResponseEnvelopeSuccessTrue UserLoadBalancerAnalyticsEventListResponseEnvelopeSuccess = true ) -type UserLoadBalancingAnalyticEventListResponseEnvelopeResultInfo struct { +type UserLoadBalancerAnalyticsEventListResponseEnvelopeResultInfo struct { // Total number of results for the requested service Count float64 `json:"count"` // Current page within paginated list of results @@ -178,13 +178,13 @@ type UserLoadBalancingAnalyticEventListResponseEnvelopeResultInfo struct { PerPage float64 `json:"per_page"` // Total results available without any search parameters TotalCount float64 `json:"total_count"` - JSON userLoadBalancingAnalyticEventListResponseEnvelopeResultInfoJSON `json:"-"` + JSON userLoadBalancerAnalyticsEventListResponseEnvelopeResultInfoJSON `json:"-"` } -// userLoadBalancingAnalyticEventListResponseEnvelopeResultInfoJSON contains the +// userLoadBalancerAnalyticsEventListResponseEnvelopeResultInfoJSON contains the // JSON metadata for the struct -// [UserLoadBalancingAnalyticEventListResponseEnvelopeResultInfo] -type userLoadBalancingAnalyticEventListResponseEnvelopeResultInfoJSON struct { +// [UserLoadBalancerAnalyticsEventListResponseEnvelopeResultInfo] +type userLoadBalancerAnalyticsEventListResponseEnvelopeResultInfoJSON struct { Count apijson.Field Page apijson.Field PerPage apijson.Field @@ -193,6 +193,6 @@ type userLoadBalancingAnalyticEventListResponseEnvelopeResultInfoJSON struct { ExtraFields map[string]apijson.Field } -func (r *UserLoadBalancingAnalyticEventListResponseEnvelopeResultInfo) UnmarshalJSON(data []byte) (err error) { +func (r *UserLoadBalancerAnalyticsEventListResponseEnvelopeResultInfo) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } diff --git a/userloadbalancinganalyticevent_test.go b/userloadbalanceranalyticsevent_test.go similarity index 88% rename from userloadbalancinganalyticevent_test.go rename to userloadbalanceranalyticsevent_test.go index 9b21026b9cc..8a9929466bd 100644 --- a/userloadbalancinganalyticevent_test.go +++ b/userloadbalanceranalyticsevent_test.go @@ -14,7 +14,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestUserLoadBalancingAnalyticEventListWithOptionalParams(t *testing.T) { +func TestUserLoadBalancerAnalyticsEventListWithOptionalParams(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 { @@ -30,7 +30,7 @@ func TestUserLoadBalancingAnalyticEventListWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.User.LoadBalancingAnalytics.Events.List(context.TODO(), cloudflare.UserLoadBalancingAnalyticEventListParams{ + _, err := client.User.LoadBalancers.Analytics.Events.List(context.TODO(), cloudflare.UserLoadBalancerAnalyticsEventListParams{ OriginHealthy: cloudflare.F(true), OriginName: cloudflare.F("primary-dc-1"), PoolHealthy: cloudflare.F(true), diff --git a/usertoken.go b/usertoken.go index 0faa2716c10..2f9ca06a15e 100644 --- a/usertoken.go +++ b/usertoken.go @@ -26,7 +26,7 @@ import ( type UserTokenService struct { Options []option.RequestOption PermissionGroups *UserTokenPermissionGroupService - Values *UserTokenValueService + Value *UserTokenValueService } // NewUserTokenService generates a new service that applies the given options to @@ -36,7 +36,7 @@ func NewUserTokenService(opts ...option.RequestOption) (r *UserTokenService) { r = &UserTokenService{} r.Options = opts r.PermissionGroups = NewUserTokenPermissionGroupService(opts...) - r.Values = NewUserTokenValueService(opts...) + r.Value = NewUserTokenValueService(opts...) return } diff --git a/usertokenvalue_test.go b/usertokenvalue_test.go index 66719cbc5b6..d7d3876a9e9 100644 --- a/usertokenvalue_test.go +++ b/usertokenvalue_test.go @@ -29,7 +29,7 @@ func TestUserTokenValueUpdate(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.User.Tokens.Values.Update( + _, err := client.User.Tokens.Value.Update( context.TODO(), map[string]interface{}{}, cloudflare.UserTokenValueUpdateParams{ diff --git a/worker.go b/worker.go index 7fa7a7bcf76..a3d82802b26 100644 --- a/worker.go +++ b/worker.go @@ -11,20 +11,18 @@ import ( // variables from the environment automatically. You should not instantiate this // service directly, and instead use the [NewWorkerService] method instead. type WorkerService struct { - Options []option.RequestOption - AI *WorkerAIService - Scripts *WorkerScriptService - Filters *WorkerFilterService - Routes *WorkerRouteService - AccountSettings *WorkerAccountSettingService - Deployments *WorkerDeploymentService - Domains *WorkerDomainService - DurableObjects *WorkerDurableObjectService - Queues *WorkerQueueService - Subdomains *WorkerSubdomainService - DeploymentsByScript *WorkerDeploymentsByScriptService - Services *WorkerServiceService - Script *WorkerScriptService + Options []option.RequestOption + AI *WorkerAIService + Scripts *WorkerScriptService + Filters *WorkerFilterService + Routes *WorkerRouteService + AccountSettings *WorkerAccountSettingService + Deployments *WorkerDeploymentService + Domains *WorkerDomainService + DurableObjects *WorkerDurableObjectService + Queues *WorkerQueueService + Subdomains *WorkerSubdomainService + Services *WorkerServiceService } // NewWorkerService generates a new service that applies the given options to each @@ -43,8 +41,6 @@ func NewWorkerService(opts ...option.RequestOption) (r *WorkerService) { r.DurableObjects = NewWorkerDurableObjectService(opts...) r.Queues = NewWorkerQueueService(opts...) r.Subdomains = NewWorkerSubdomainService(opts...) - r.DeploymentsByScript = NewWorkerDeploymentsByScriptService(opts...) r.Services = NewWorkerServiceService(opts...) - r.Script = NewWorkerScriptService(opts...) return } diff --git a/workerdeploymentsbyscript.go b/workerdeploymentsbyscript.go deleted file mode 100644 index a0d50777478..00000000000 --- a/workerdeploymentsbyscript.go +++ /dev/null @@ -1,249 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare - -import ( - "context" - "fmt" - "net/http" - - "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" - "github.com/cloudflare/cloudflare-sdk-go/internal/param" - "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -// WorkerDeploymentsByScriptService contains methods and other services that help -// with interacting with the cloudflare API. Note, unlike clients, this service -// does not read variables from the environment automatically. You should not -// instantiate this service directly, and instead use the -// [NewWorkerDeploymentsByScriptService] method instead. -type WorkerDeploymentsByScriptService struct { - Options []option.RequestOption -} - -// NewWorkerDeploymentsByScriptService generates a new service that applies the -// given options to each request. These options are applied after the parent -// client's options (if there is one), and before any request-specific options. -func NewWorkerDeploymentsByScriptService(opts ...option.RequestOption) (r *WorkerDeploymentsByScriptService) { - r = &WorkerDeploymentsByScriptService{} - r.Options = opts - return -} - -// List Deployments -func (r *WorkerDeploymentsByScriptService) List(ctx context.Context, scriptID string, query WorkerDeploymentsByScriptListParams, opts ...option.RequestOption) (res *WorkerDeploymentsByScriptListResponse, err error) { - opts = append(r.Options[:], opts...) - var env WorkerDeploymentsByScriptListResponseEnvelope - path := fmt.Sprintf("accounts/%s/workers/deployments/by-script/%s", query.AccountID, scriptID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Get Deployment Detail -func (r *WorkerDeploymentsByScriptService) Detail(ctx context.Context, scriptID string, deploymentID string, query WorkerDeploymentsByScriptDetailParams, opts ...option.RequestOption) (res *WorkerDeploymentsByScriptDetailResponse, err error) { - opts = append(r.Options[:], opts...) - var env WorkerDeploymentsByScriptDetailResponseEnvelope - path := fmt.Sprintf("accounts/%s/workers/deployments/by-script/%s/detail/%s", query.AccountID, scriptID, deploymentID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -type WorkerDeploymentsByScriptListResponse struct { - Items []interface{} `json:"items"` - Latest interface{} `json:"latest"` - JSON workerDeploymentsByScriptListResponseJSON `json:"-"` -} - -// workerDeploymentsByScriptListResponseJSON contains the JSON metadata for the -// struct [WorkerDeploymentsByScriptListResponse] -type workerDeploymentsByScriptListResponseJSON struct { - Items apijson.Field - Latest apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *WorkerDeploymentsByScriptListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type WorkerDeploymentsByScriptDetailResponse struct { - ID string `json:"id"` - Metadata interface{} `json:"metadata"` - Number float64 `json:"number"` - Resources interface{} `json:"resources"` - JSON workerDeploymentsByScriptDetailResponseJSON `json:"-"` -} - -// workerDeploymentsByScriptDetailResponseJSON contains the JSON metadata for the -// struct [WorkerDeploymentsByScriptDetailResponse] -type workerDeploymentsByScriptDetailResponseJSON struct { - ID apijson.Field - Metadata apijson.Field - Number apijson.Field - Resources apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *WorkerDeploymentsByScriptDetailResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type WorkerDeploymentsByScriptListParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` -} - -type WorkerDeploymentsByScriptListResponseEnvelope struct { - Errors []WorkerDeploymentsByScriptListResponseEnvelopeErrors `json:"errors,required"` - Messages []WorkerDeploymentsByScriptListResponseEnvelopeMessages `json:"messages,required"` - Result WorkerDeploymentsByScriptListResponse `json:"result,required"` - // Whether the API call was successful - Success WorkerDeploymentsByScriptListResponseEnvelopeSuccess `json:"success,required"` - JSON workerDeploymentsByScriptListResponseEnvelopeJSON `json:"-"` -} - -// workerDeploymentsByScriptListResponseEnvelopeJSON contains the JSON metadata for -// the struct [WorkerDeploymentsByScriptListResponseEnvelope] -type workerDeploymentsByScriptListResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *WorkerDeploymentsByScriptListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type WorkerDeploymentsByScriptListResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON workerDeploymentsByScriptListResponseEnvelopeErrorsJSON `json:"-"` -} - -// workerDeploymentsByScriptListResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [WorkerDeploymentsByScriptListResponseEnvelopeErrors] -type workerDeploymentsByScriptListResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *WorkerDeploymentsByScriptListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type WorkerDeploymentsByScriptListResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON workerDeploymentsByScriptListResponseEnvelopeMessagesJSON `json:"-"` -} - -// workerDeploymentsByScriptListResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [WorkerDeploymentsByScriptListResponseEnvelopeMessages] -type workerDeploymentsByScriptListResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *WorkerDeploymentsByScriptListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type WorkerDeploymentsByScriptListResponseEnvelopeSuccess bool - -const ( - WorkerDeploymentsByScriptListResponseEnvelopeSuccessTrue WorkerDeploymentsByScriptListResponseEnvelopeSuccess = true -) - -type WorkerDeploymentsByScriptDetailParams struct { - // Identifier - AccountID param.Field[string] `path:"account_id,required"` -} - -type WorkerDeploymentsByScriptDetailResponseEnvelope struct { - Errors []WorkerDeploymentsByScriptDetailResponseEnvelopeErrors `json:"errors,required"` - Messages []WorkerDeploymentsByScriptDetailResponseEnvelopeMessages `json:"messages,required"` - Result WorkerDeploymentsByScriptDetailResponse `json:"result,required"` - // Whether the API call was successful - Success WorkerDeploymentsByScriptDetailResponseEnvelopeSuccess `json:"success,required"` - JSON workerDeploymentsByScriptDetailResponseEnvelopeJSON `json:"-"` -} - -// workerDeploymentsByScriptDetailResponseEnvelopeJSON contains the JSON metadata -// for the struct [WorkerDeploymentsByScriptDetailResponseEnvelope] -type workerDeploymentsByScriptDetailResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *WorkerDeploymentsByScriptDetailResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type WorkerDeploymentsByScriptDetailResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON workerDeploymentsByScriptDetailResponseEnvelopeErrorsJSON `json:"-"` -} - -// workerDeploymentsByScriptDetailResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [WorkerDeploymentsByScriptDetailResponseEnvelopeErrors] -type workerDeploymentsByScriptDetailResponseEnvelopeErrorsJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *WorkerDeploymentsByScriptDetailResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -type WorkerDeploymentsByScriptDetailResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON workerDeploymentsByScriptDetailResponseEnvelopeMessagesJSON `json:"-"` -} - -// workerDeploymentsByScriptDetailResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct -// [WorkerDeploymentsByScriptDetailResponseEnvelopeMessages] -type workerDeploymentsByScriptDetailResponseEnvelopeMessagesJSON struct { - Code apijson.Field - Message apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *WorkerDeploymentsByScriptDetailResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -// Whether the API call was successful -type WorkerDeploymentsByScriptDetailResponseEnvelopeSuccess bool - -const ( - WorkerDeploymentsByScriptDetailResponseEnvelopeSuccessTrue WorkerDeploymentsByScriptDetailResponseEnvelopeSuccess = true -) diff --git a/workerdeploymentsbyscript_test.go b/workerdeploymentsbyscript_test.go deleted file mode 100644 index 7cb5e476681..00000000000 --- a/workerdeploymentsbyscript_test.go +++ /dev/null @@ -1,79 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package cloudflare_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-sdk-go" - "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" - "github.com/cloudflare/cloudflare-sdk-go/option" -) - -func TestWorkerDeploymentsByScriptList(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Workers.DeploymentsByScript.List( - context.TODO(), - "8ee82b3a2c0f42928b8f14dae4a97121", - cloudflare.WorkerDeploymentsByScriptListParams{ - AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }, - ) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} - -func TestWorkerDeploymentsByScriptDetail(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"), - option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), - option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), - ) - _, err := client.Workers.DeploymentsByScript.Detail( - context.TODO(), - "8ee82b3a2c0f42928b8f14dae4a97121", - "bcf48806-b317-4351-9ee7-36e7d557d4de", - cloudflare.WorkerDeploymentsByScriptDetailParams{ - AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - }, - ) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/workerscript.go b/workerscript.go index df3a49b6939..a23a45bda5d 100644 --- a/workerscript.go +++ b/workerscript.go @@ -31,6 +31,9 @@ type WorkerScriptService struct { Schedules *WorkerScriptScheduleService Tail *WorkerScriptTailService UsageModel *WorkerScriptUsageModelService + Content *WorkerScriptContentService + ContentV2 *WorkerScriptContentV2Service + Settings *WorkerScriptSettingService } // NewWorkerScriptService generates a new service that applies the given options to @@ -43,6 +46,9 @@ func NewWorkerScriptService(opts ...option.RequestOption) (r *WorkerScriptServic r.Schedules = NewWorkerScriptScheduleService(opts...) r.Tail = NewWorkerScriptTailService(opts...) r.UsageModel = NewWorkerScriptUsageModelService(opts...) + r.Content = NewWorkerScriptContentService(opts...) + r.ContentV2 = NewWorkerScriptContentV2Service(opts...) + r.Settings = NewWorkerScriptSettingService(opts...) return } diff --git a/workerscriptcontent_test.go b/workerscriptcontent_test.go index df39d04517b..6e3966686a2 100644 --- a/workerscriptcontent_test.go +++ b/workerscriptcontent_test.go @@ -31,7 +31,7 @@ func TestWorkerScriptContentUpdateWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.WorkerScripts.Content.Update( + _, err := client.Workers.Scripts.Content.Update( context.TODO(), "this-is_my_script-01", cloudflare.WorkerScriptContentUpdateParams{ diff --git a/workerscriptcontentv2_test.go b/workerscriptcontentv2_test.go index b967545975b..7abe4a90337 100644 --- a/workerscriptcontentv2_test.go +++ b/workerscriptcontentv2_test.go @@ -30,7 +30,7 @@ func TestWorkerScriptContentV2Get(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - resp, err := client.WorkerScripts.ContentV2.Get( + resp, err := client.Workers.Scripts.ContentV2.Get( context.TODO(), "this-is_my_script-01", cloudflare.WorkerScriptContentV2GetParams{ diff --git a/workerscriptsetting_test.go b/workerscriptsetting_test.go index dd92ed42fb0..d83a8cedd33 100644 --- a/workerscriptsetting_test.go +++ b/workerscriptsetting_test.go @@ -29,7 +29,7 @@ func TestWorkerScriptSettingEditWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.WorkerScripts.Settings.Edit( + _, err := client.Workers.Scripts.Settings.Edit( context.TODO(), "this-is_my_script-01", cloudflare.WorkerScriptSettingEditParams{ @@ -143,7 +143,7 @@ func TestWorkerScriptSettingGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.WorkerScripts.Settings.Get( + _, err := client.Workers.Scripts.Settings.Get( context.TODO(), "this-is_my_script-01", cloudflare.WorkerScriptSettingGetParams{ diff --git a/zerotrust.go b/zerotrust.go index e1a4c442150..17c16909c56 100644 --- a/zerotrust.go +++ b/zerotrust.go @@ -6,21 +6,21 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -// ZerotrustService contains methods and other services that help with interacting +// ZeroTrustService contains methods and other services that help with interacting // with the cloudflare API. Note, unlike clients, this service does not read // variables from the environment automatically. You should not instantiate this -// service directly, and instead use the [NewZerotrustService] method instead. -type ZerotrustService struct { +// service directly, and instead use the [NewZeroTrustService] method instead. +type ZeroTrustService struct { Options []option.RequestOption - ConnectivitySettings *ZerotrustConnectivitySettingService + ConnectivitySettings *ZeroTrustConnectivitySettingService } -// NewZerotrustService generates a new service that applies the given options to +// NewZeroTrustService generates a new service that applies the given options to // each request. These options are applied after the parent client's options (if // there is one), and before any request-specific options. -func NewZerotrustService(opts ...option.RequestOption) (r *ZerotrustService) { - r = &ZerotrustService{} +func NewZeroTrustService(opts ...option.RequestOption) (r *ZeroTrustService) { + r = &ZeroTrustService{} r.Options = opts - r.ConnectivitySettings = NewZerotrustConnectivitySettingService(opts...) + r.ConnectivitySettings = NewZeroTrustConnectivitySettingService(opts...) return } diff --git a/zerotrustconnectivitysetting.go b/zerotrustconnectivitysetting.go index 2e9b76037c2..4e4ee551634 100644 --- a/zerotrustconnectivitysetting.go +++ b/zerotrustconnectivitysetting.go @@ -13,28 +13,28 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -// ZerotrustConnectivitySettingService contains methods and other services that +// ZeroTrustConnectivitySettingService contains methods and other services that // help with interacting with the cloudflare API. Note, unlike clients, this // service does not read variables from the environment automatically. You should // not instantiate this service directly, and instead use the -// [NewZerotrustConnectivitySettingService] method instead. -type ZerotrustConnectivitySettingService struct { +// [NewZeroTrustConnectivitySettingService] method instead. +type ZeroTrustConnectivitySettingService struct { Options []option.RequestOption } -// NewZerotrustConnectivitySettingService generates a new service that applies the +// NewZeroTrustConnectivitySettingService generates a new service that applies the // given options to each request. These options are applied after the parent // client's options (if there is one), and before any request-specific options. -func NewZerotrustConnectivitySettingService(opts ...option.RequestOption) (r *ZerotrustConnectivitySettingService) { - r = &ZerotrustConnectivitySettingService{} +func NewZeroTrustConnectivitySettingService(opts ...option.RequestOption) (r *ZeroTrustConnectivitySettingService) { + r = &ZeroTrustConnectivitySettingService{} r.Options = opts return } // Updates the Zero Trust Connectivity Settings for the given account. -func (r *ZerotrustConnectivitySettingService) Edit(ctx context.Context, params ZerotrustConnectivitySettingEditParams, opts ...option.RequestOption) (res *ZerotrustConnectivitySettingEditResponse, err error) { +func (r *ZeroTrustConnectivitySettingService) Edit(ctx context.Context, params ZeroTrustConnectivitySettingEditParams, opts ...option.RequestOption) (res *ZeroTrustConnectivitySettingEditResponse, err error) { opts = append(r.Options[:], opts...) - var env ZerotrustConnectivitySettingEditResponseEnvelope + var env ZeroTrustConnectivitySettingEditResponseEnvelope path := fmt.Sprintf("accounts/%s/zerotrust/connectivity_settings", params.AccountID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) if err != nil { @@ -45,9 +45,9 @@ func (r *ZerotrustConnectivitySettingService) Edit(ctx context.Context, params Z } // Gets the Zero Trust Connectivity Settings for the given account. -func (r *ZerotrustConnectivitySettingService) Get(ctx context.Context, query ZerotrustConnectivitySettingGetParams, opts ...option.RequestOption) (res *ZerotrustConnectivitySettingGetResponse, err error) { +func (r *ZeroTrustConnectivitySettingService) Get(ctx context.Context, query ZeroTrustConnectivitySettingGetParams, opts ...option.RequestOption) (res *ZeroTrustConnectivitySettingGetResponse, err error) { opts = append(r.Options[:], opts...) - var env ZerotrustConnectivitySettingGetResponseEnvelope + var env ZeroTrustConnectivitySettingGetResponseEnvelope path := fmt.Sprintf("accounts/%s/zerotrust/connectivity_settings", query.AccountID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) if err != nil { @@ -57,49 +57,49 @@ func (r *ZerotrustConnectivitySettingService) Get(ctx context.Context, query Zer return } -type ZerotrustConnectivitySettingEditResponse struct { +type ZeroTrustConnectivitySettingEditResponse struct { // A flag to enable the ICMP proxy for the account network. IcmpProxyEnabled bool `json:"icmp_proxy_enabled"` // A flag to enable WARP to WARP traffic. OfframpWARPEnabled bool `json:"offramp_warp_enabled"` - JSON zerotrustConnectivitySettingEditResponseJSON `json:"-"` + JSON zeroTrustConnectivitySettingEditResponseJSON `json:"-"` } -// zerotrustConnectivitySettingEditResponseJSON contains the JSON metadata for the -// struct [ZerotrustConnectivitySettingEditResponse] -type zerotrustConnectivitySettingEditResponseJSON struct { +// zeroTrustConnectivitySettingEditResponseJSON contains the JSON metadata for the +// struct [ZeroTrustConnectivitySettingEditResponse] +type zeroTrustConnectivitySettingEditResponseJSON struct { IcmpProxyEnabled apijson.Field OfframpWARPEnabled apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ZerotrustConnectivitySettingEditResponse) UnmarshalJSON(data []byte) (err error) { +func (r *ZeroTrustConnectivitySettingEditResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type ZerotrustConnectivitySettingGetResponse struct { +type ZeroTrustConnectivitySettingGetResponse struct { // A flag to enable the ICMP proxy for the account network. IcmpProxyEnabled bool `json:"icmp_proxy_enabled"` // A flag to enable WARP to WARP traffic. OfframpWARPEnabled bool `json:"offramp_warp_enabled"` - JSON zerotrustConnectivitySettingGetResponseJSON `json:"-"` + JSON zeroTrustConnectivitySettingGetResponseJSON `json:"-"` } -// zerotrustConnectivitySettingGetResponseJSON contains the JSON metadata for the -// struct [ZerotrustConnectivitySettingGetResponse] -type zerotrustConnectivitySettingGetResponseJSON struct { +// zeroTrustConnectivitySettingGetResponseJSON contains the JSON metadata for the +// struct [ZeroTrustConnectivitySettingGetResponse] +type zeroTrustConnectivitySettingGetResponseJSON struct { IcmpProxyEnabled apijson.Field OfframpWARPEnabled apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ZerotrustConnectivitySettingGetResponse) UnmarshalJSON(data []byte) (err error) { +func (r *ZeroTrustConnectivitySettingGetResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type ZerotrustConnectivitySettingEditParams struct { +type ZeroTrustConnectivitySettingEditParams struct { // Cloudflare account ID AccountID param.Field[string] `path:"account_id,required"` // A flag to enable the ICMP proxy for the account network. @@ -108,22 +108,22 @@ type ZerotrustConnectivitySettingEditParams struct { OfframpWARPEnabled param.Field[bool] `json:"offramp_warp_enabled"` } -func (r ZerotrustConnectivitySettingEditParams) MarshalJSON() (data []byte, err error) { +func (r ZeroTrustConnectivitySettingEditParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type ZerotrustConnectivitySettingEditResponseEnvelope struct { - Errors []ZerotrustConnectivitySettingEditResponseEnvelopeErrors `json:"errors,required"` - Messages []ZerotrustConnectivitySettingEditResponseEnvelopeMessages `json:"messages,required"` - Result ZerotrustConnectivitySettingEditResponse `json:"result,required"` +type ZeroTrustConnectivitySettingEditResponseEnvelope struct { + Errors []ZeroTrustConnectivitySettingEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZeroTrustConnectivitySettingEditResponseEnvelopeMessages `json:"messages,required"` + Result ZeroTrustConnectivitySettingEditResponse `json:"result,required"` // Whether the API call was successful - Success ZerotrustConnectivitySettingEditResponseEnvelopeSuccess `json:"success,required"` - JSON zerotrustConnectivitySettingEditResponseEnvelopeJSON `json:"-"` + Success ZeroTrustConnectivitySettingEditResponseEnvelopeSuccess `json:"success,required"` + JSON zeroTrustConnectivitySettingEditResponseEnvelopeJSON `json:"-"` } -// zerotrustConnectivitySettingEditResponseEnvelopeJSON contains the JSON metadata -// for the struct [ZerotrustConnectivitySettingEditResponseEnvelope] -type zerotrustConnectivitySettingEditResponseEnvelopeJSON struct { +// zeroTrustConnectivitySettingEditResponseEnvelopeJSON contains the JSON metadata +// for the struct [ZeroTrustConnectivitySettingEditResponseEnvelope] +type zeroTrustConnectivitySettingEditResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field Result apijson.Field @@ -132,73 +132,73 @@ type zerotrustConnectivitySettingEditResponseEnvelopeJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZerotrustConnectivitySettingEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { +func (r *ZeroTrustConnectivitySettingEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type ZerotrustConnectivitySettingEditResponseEnvelopeErrors struct { +type ZeroTrustConnectivitySettingEditResponseEnvelopeErrors struct { Code int64 `json:"code,required"` Message string `json:"message,required"` - JSON zerotrustConnectivitySettingEditResponseEnvelopeErrorsJSON `json:"-"` + JSON zeroTrustConnectivitySettingEditResponseEnvelopeErrorsJSON `json:"-"` } -// zerotrustConnectivitySettingEditResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [ZerotrustConnectivitySettingEditResponseEnvelopeErrors] -type zerotrustConnectivitySettingEditResponseEnvelopeErrorsJSON struct { +// zeroTrustConnectivitySettingEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZeroTrustConnectivitySettingEditResponseEnvelopeErrors] +type zeroTrustConnectivitySettingEditResponseEnvelopeErrorsJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ZerotrustConnectivitySettingEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { +func (r *ZeroTrustConnectivitySettingEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type ZerotrustConnectivitySettingEditResponseEnvelopeMessages struct { +type ZeroTrustConnectivitySettingEditResponseEnvelopeMessages struct { Code int64 `json:"code,required"` Message string `json:"message,required"` - JSON zerotrustConnectivitySettingEditResponseEnvelopeMessagesJSON `json:"-"` + JSON zeroTrustConnectivitySettingEditResponseEnvelopeMessagesJSON `json:"-"` } -// zerotrustConnectivitySettingEditResponseEnvelopeMessagesJSON contains the JSON +// zeroTrustConnectivitySettingEditResponseEnvelopeMessagesJSON contains the JSON // metadata for the struct -// [ZerotrustConnectivitySettingEditResponseEnvelopeMessages] -type zerotrustConnectivitySettingEditResponseEnvelopeMessagesJSON struct { +// [ZeroTrustConnectivitySettingEditResponseEnvelopeMessages] +type zeroTrustConnectivitySettingEditResponseEnvelopeMessagesJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ZerotrustConnectivitySettingEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { +func (r *ZeroTrustConnectivitySettingEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // Whether the API call was successful -type ZerotrustConnectivitySettingEditResponseEnvelopeSuccess bool +type ZeroTrustConnectivitySettingEditResponseEnvelopeSuccess bool const ( - ZerotrustConnectivitySettingEditResponseEnvelopeSuccessTrue ZerotrustConnectivitySettingEditResponseEnvelopeSuccess = true + ZeroTrustConnectivitySettingEditResponseEnvelopeSuccessTrue ZeroTrustConnectivitySettingEditResponseEnvelopeSuccess = true ) -type ZerotrustConnectivitySettingGetParams struct { +type ZeroTrustConnectivitySettingGetParams struct { // Cloudflare account ID AccountID param.Field[string] `path:"account_id,required"` } -type ZerotrustConnectivitySettingGetResponseEnvelope struct { - Errors []ZerotrustConnectivitySettingGetResponseEnvelopeErrors `json:"errors,required"` - Messages []ZerotrustConnectivitySettingGetResponseEnvelopeMessages `json:"messages,required"` - Result ZerotrustConnectivitySettingGetResponse `json:"result,required"` +type ZeroTrustConnectivitySettingGetResponseEnvelope struct { + Errors []ZeroTrustConnectivitySettingGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZeroTrustConnectivitySettingGetResponseEnvelopeMessages `json:"messages,required"` + Result ZeroTrustConnectivitySettingGetResponse `json:"result,required"` // Whether the API call was successful - Success ZerotrustConnectivitySettingGetResponseEnvelopeSuccess `json:"success,required"` - JSON zerotrustConnectivitySettingGetResponseEnvelopeJSON `json:"-"` + Success ZeroTrustConnectivitySettingGetResponseEnvelopeSuccess `json:"success,required"` + JSON zeroTrustConnectivitySettingGetResponseEnvelopeJSON `json:"-"` } -// zerotrustConnectivitySettingGetResponseEnvelopeJSON contains the JSON metadata -// for the struct [ZerotrustConnectivitySettingGetResponseEnvelope] -type zerotrustConnectivitySettingGetResponseEnvelopeJSON struct { +// zeroTrustConnectivitySettingGetResponseEnvelopeJSON contains the JSON metadata +// for the struct [ZeroTrustConnectivitySettingGetResponseEnvelope] +type zeroTrustConnectivitySettingGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field Result apijson.Field @@ -207,52 +207,52 @@ type zerotrustConnectivitySettingGetResponseEnvelopeJSON struct { ExtraFields map[string]apijson.Field } -func (r *ZerotrustConnectivitySettingGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { +func (r *ZeroTrustConnectivitySettingGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type ZerotrustConnectivitySettingGetResponseEnvelopeErrors struct { +type ZeroTrustConnectivitySettingGetResponseEnvelopeErrors struct { Code int64 `json:"code,required"` Message string `json:"message,required"` - JSON zerotrustConnectivitySettingGetResponseEnvelopeErrorsJSON `json:"-"` + JSON zeroTrustConnectivitySettingGetResponseEnvelopeErrorsJSON `json:"-"` } -// zerotrustConnectivitySettingGetResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [ZerotrustConnectivitySettingGetResponseEnvelopeErrors] -type zerotrustConnectivitySettingGetResponseEnvelopeErrorsJSON struct { +// zeroTrustConnectivitySettingGetResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZeroTrustConnectivitySettingGetResponseEnvelopeErrors] +type zeroTrustConnectivitySettingGetResponseEnvelopeErrorsJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ZerotrustConnectivitySettingGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { +func (r *ZeroTrustConnectivitySettingGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type ZerotrustConnectivitySettingGetResponseEnvelopeMessages struct { +type ZeroTrustConnectivitySettingGetResponseEnvelopeMessages struct { Code int64 `json:"code,required"` Message string `json:"message,required"` - JSON zerotrustConnectivitySettingGetResponseEnvelopeMessagesJSON `json:"-"` + JSON zeroTrustConnectivitySettingGetResponseEnvelopeMessagesJSON `json:"-"` } -// zerotrustConnectivitySettingGetResponseEnvelopeMessagesJSON contains the JSON +// zeroTrustConnectivitySettingGetResponseEnvelopeMessagesJSON contains the JSON // metadata for the struct -// [ZerotrustConnectivitySettingGetResponseEnvelopeMessages] -type zerotrustConnectivitySettingGetResponseEnvelopeMessagesJSON struct { +// [ZeroTrustConnectivitySettingGetResponseEnvelopeMessages] +type zeroTrustConnectivitySettingGetResponseEnvelopeMessagesJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ZerotrustConnectivitySettingGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { +func (r *ZeroTrustConnectivitySettingGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // Whether the API call was successful -type ZerotrustConnectivitySettingGetResponseEnvelopeSuccess bool +type ZeroTrustConnectivitySettingGetResponseEnvelopeSuccess bool const ( - ZerotrustConnectivitySettingGetResponseEnvelopeSuccessTrue ZerotrustConnectivitySettingGetResponseEnvelopeSuccess = true + ZeroTrustConnectivitySettingGetResponseEnvelopeSuccessTrue ZeroTrustConnectivitySettingGetResponseEnvelopeSuccess = true ) diff --git a/zerotrustconnectivitysetting_test.go b/zerotrustconnectivitysetting_test.go index abc4013f304..6b3637509a4 100644 --- a/zerotrustconnectivitysetting_test.go +++ b/zerotrustconnectivitysetting_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestZerotrustConnectivitySettingEditWithOptionalParams(t *testing.T) { +func TestZeroTrustConnectivitySettingEditWithOptionalParams(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 { @@ -29,7 +29,7 @@ func TestZerotrustConnectivitySettingEditWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Zerotrust.ConnectivitySettings.Edit(context.TODO(), cloudflare.ZerotrustConnectivitySettingEditParams{ + _, err := client.ZeroTrust.ConnectivitySettings.Edit(context.TODO(), cloudflare.ZeroTrustConnectivitySettingEditParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), IcmpProxyEnabled: cloudflare.F(true), OfframpWARPEnabled: cloudflare.F(true), @@ -43,7 +43,7 @@ func TestZerotrustConnectivitySettingEditWithOptionalParams(t *testing.T) { } } -func TestZerotrustConnectivitySettingGet(t *testing.T) { +func TestZeroTrustConnectivitySettingGet(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 { @@ -59,7 +59,7 @@ func TestZerotrustConnectivitySettingGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Zerotrust.ConnectivitySettings.Get(context.TODO(), cloudflare.ZerotrustConnectivitySettingGetParams{ + _, err := client.ZeroTrust.ConnectivitySettings.Get(context.TODO(), cloudflare.ZeroTrustConnectivitySettingGetParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), }) if err != nil { diff --git a/zone.go b/zone.go index 633212e4629..4fa50179edc 100644 --- a/zone.go +++ b/zone.go @@ -23,8 +23,11 @@ import ( // directly, and instead use the [NewZoneService] method instead. type ZoneService struct { Options []option.RequestOption + ActivationCheck *ZoneActivationCheckService + Settings *ZoneSettingService CustomNameservers *ZoneCustomNameserverService Holds *ZoneHoldService + Workers *ZoneWorkerService } // NewZoneService generates a new service that applies the given options to each @@ -33,8 +36,11 @@ type ZoneService struct { func NewZoneService(opts ...option.RequestOption) (r *ZoneService) { r = &ZoneService{} r.Options = opts + r.ActivationCheck = NewZoneActivationCheckService(opts...) + r.Settings = NewZoneSettingService(opts...) r.CustomNameservers = NewZoneCustomNameserverService(opts...) r.Holds = NewZoneHoldService(opts...) + r.Workers = NewZoneWorkerService(opts...) return } diff --git a/zoneactivationcheck.go b/zoneactivationcheck.go new file mode 100644 index 00000000000..b29aed17c46 --- /dev/null +++ b/zoneactivationcheck.go @@ -0,0 +1,138 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneActivationCheckService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewZoneActivationCheckService] +// method instead. +type ZoneActivationCheckService struct { + Options []option.RequestOption +} + +// NewZoneActivationCheckService generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewZoneActivationCheckService(opts ...option.RequestOption) (r *ZoneActivationCheckService) { + r = &ZoneActivationCheckService{} + r.Options = opts + return +} + +// Triggeres a new activation check for a PENDING Zone. This can be triggered every +// 5 min for paygo/ent customers, every hour for FREE Zones. +func (r *ZoneActivationCheckService) Trigger(ctx context.Context, body ZoneActivationCheckTriggerParams, opts ...option.RequestOption) (res *ZoneActivationCheckTriggerResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneActivationCheckTriggerResponseEnvelope + path := fmt.Sprintf("zones/%s/activation_check", body.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +type ZoneActivationCheckTriggerResponse struct { + // Identifier + ID string `json:"id"` + JSON zoneActivationCheckTriggerResponseJSON `json:"-"` +} + +// zoneActivationCheckTriggerResponseJSON contains the JSON metadata for the struct +// [ZoneActivationCheckTriggerResponse] +type zoneActivationCheckTriggerResponseJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneActivationCheckTriggerResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneActivationCheckTriggerParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneActivationCheckTriggerResponseEnvelope struct { + Errors []ZoneActivationCheckTriggerResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneActivationCheckTriggerResponseEnvelopeMessages `json:"messages,required"` + Result ZoneActivationCheckTriggerResponse `json:"result,required"` + // Whether the API call was successful + Success ZoneActivationCheckTriggerResponseEnvelopeSuccess `json:"success,required"` + JSON zoneActivationCheckTriggerResponseEnvelopeJSON `json:"-"` +} + +// zoneActivationCheckTriggerResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneActivationCheckTriggerResponseEnvelope] +type zoneActivationCheckTriggerResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneActivationCheckTriggerResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneActivationCheckTriggerResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneActivationCheckTriggerResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneActivationCheckTriggerResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [ZoneActivationCheckTriggerResponseEnvelopeErrors] +type zoneActivationCheckTriggerResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneActivationCheckTriggerResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneActivationCheckTriggerResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneActivationCheckTriggerResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneActivationCheckTriggerResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneActivationCheckTriggerResponseEnvelopeMessages] +type zoneActivationCheckTriggerResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneActivationCheckTriggerResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneActivationCheckTriggerResponseEnvelopeSuccess bool + +const ( + ZoneActivationCheckTriggerResponseEnvelopeSuccessTrue ZoneActivationCheckTriggerResponseEnvelopeSuccess = true +) diff --git a/activationcheck_test.go b/zoneactivationcheck_test.go similarity index 88% rename from activationcheck_test.go rename to zoneactivationcheck_test.go index 872b118504d..9df8a09c9f2 100644 --- a/activationcheck_test.go +++ b/zoneactivationcheck_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestActivationCheckUpdate(t *testing.T) { +func TestZoneActivationCheckTrigger(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 { @@ -29,7 +29,7 @@ func TestActivationCheckUpdate(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.ActivationChecks.Update(context.TODO(), cloudflare.ActivationCheckUpdateParams{ + _, err := client.Zones.ActivationCheck.Trigger(context.TODO(), cloudflare.ZoneActivationCheckTriggerParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesetting.go b/zonesetting.go new file mode 100644 index 00000000000..1c7bf85be21 --- /dev/null +++ b/zonesetting.go @@ -0,0 +1,9372 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewZoneSettingService] method +// instead. +type ZoneSettingService struct { + Options []option.RequestOption + ZeroRTT *ZoneSettingZeroRTTService + AdvancedDDOS *ZoneSettingAdvancedDDOSService + AlwaysOnline *ZoneSettingAlwaysOnlineService + AlwaysUseHTTPS *ZoneSettingAlwaysUseHTTPSService + AutomaticHTTPSRewrites *ZoneSettingAutomaticHTTPSRewriteService + AutomaticPlatformOptimization *ZoneSettingAutomaticPlatformOptimizationService + Brotli *ZoneSettingBrotliService + BrowserCacheTTL *ZoneSettingBrowserCacheTTLService + BrowserCheck *ZoneSettingBrowserCheckService + CacheLevel *ZoneSettingCacheLevelService + ChallengeTTL *ZoneSettingChallengeTTLService + Ciphers *ZoneSettingCipherService + DevelopmentMode *ZoneSettingDevelopmentModeService + EarlyHints *ZoneSettingEarlyHintService + EmailObfuscation *ZoneSettingEmailObfuscationService + H2Prioritization *ZoneSettingH2PrioritizationService + HotlinkProtection *ZoneSettingHotlinkProtectionService + HTTP2 *ZoneSettingHTTP2Service + HTTP3 *ZoneSettingHTTP3Service + ImageResizing *ZoneSettingImageResizingService + IPGeolocation *ZoneSettingIPGeolocationService + IPV6 *ZoneSettingIPV6Service + MinTLSVersion *ZoneSettingMinTLSVersionService + Minify *ZoneSettingMinifyService + Mirage *ZoneSettingMirageService + MobileRedirect *ZoneSettingMobileRedirectService + NEL *ZoneSettingNELService + OpportunisticEncryption *ZoneSettingOpportunisticEncryptionService + OpportunisticOnion *ZoneSettingOpportunisticOnionService + OrangeToOrange *ZoneSettingOrangeToOrangeService + OriginErrorPagePassThru *ZoneSettingOriginErrorPagePassThruService + OriginMaxHTTPVersion *ZoneSettingOriginMaxHTTPVersionService + Polish *ZoneSettingPolishService + PrefetchPreload *ZoneSettingPrefetchPreloadService + ProxyReadTimeout *ZoneSettingProxyReadTimeoutService + PseudoIPV4 *ZoneSettingPseudoIPV4Service + ResponseBuffering *ZoneSettingResponseBufferingService + RocketLoader *ZoneSettingRocketLoaderService + SecurityHeaders *ZoneSettingSecurityHeaderService + SecurityLevel *ZoneSettingSecurityLevelService + ServerSideExcludes *ZoneSettingServerSideExcludeService + SortQueryStringForCache *ZoneSettingSortQueryStringForCacheService + SSL *ZoneSettingSSLService + SSLRecommender *ZoneSettingSSLRecommenderService + TLS1_3 *ZoneSettingTLS1_3Service + TLSClientAuth *ZoneSettingTLSClientAuthService + TrueClientIPHeader *ZoneSettingTrueClientIPHeaderService + WAF *ZoneSettingWAFService + Webp *ZoneSettingWebpService + Websocket *ZoneSettingWebsocketService + FontSettings *ZoneSettingFontSettingService +} + +// NewZoneSettingService generates a new service that applies the given options to +// each request. These options are applied after the parent client's options (if +// there is one), and before any request-specific options. +func NewZoneSettingService(opts ...option.RequestOption) (r *ZoneSettingService) { + r = &ZoneSettingService{} + r.Options = opts + r.ZeroRTT = NewZoneSettingZeroRTTService(opts...) + r.AdvancedDDOS = NewZoneSettingAdvancedDDOSService(opts...) + r.AlwaysOnline = NewZoneSettingAlwaysOnlineService(opts...) + r.AlwaysUseHTTPS = NewZoneSettingAlwaysUseHTTPSService(opts...) + r.AutomaticHTTPSRewrites = NewZoneSettingAutomaticHTTPSRewriteService(opts...) + r.AutomaticPlatformOptimization = NewZoneSettingAutomaticPlatformOptimizationService(opts...) + r.Brotli = NewZoneSettingBrotliService(opts...) + r.BrowserCacheTTL = NewZoneSettingBrowserCacheTTLService(opts...) + r.BrowserCheck = NewZoneSettingBrowserCheckService(opts...) + r.CacheLevel = NewZoneSettingCacheLevelService(opts...) + r.ChallengeTTL = NewZoneSettingChallengeTTLService(opts...) + r.Ciphers = NewZoneSettingCipherService(opts...) + r.DevelopmentMode = NewZoneSettingDevelopmentModeService(opts...) + r.EarlyHints = NewZoneSettingEarlyHintService(opts...) + r.EmailObfuscation = NewZoneSettingEmailObfuscationService(opts...) + r.H2Prioritization = NewZoneSettingH2PrioritizationService(opts...) + r.HotlinkProtection = NewZoneSettingHotlinkProtectionService(opts...) + r.HTTP2 = NewZoneSettingHTTP2Service(opts...) + r.HTTP3 = NewZoneSettingHTTP3Service(opts...) + r.ImageResizing = NewZoneSettingImageResizingService(opts...) + r.IPGeolocation = NewZoneSettingIPGeolocationService(opts...) + r.IPV6 = NewZoneSettingIPV6Service(opts...) + r.MinTLSVersion = NewZoneSettingMinTLSVersionService(opts...) + r.Minify = NewZoneSettingMinifyService(opts...) + r.Mirage = NewZoneSettingMirageService(opts...) + r.MobileRedirect = NewZoneSettingMobileRedirectService(opts...) + r.NEL = NewZoneSettingNELService(opts...) + r.OpportunisticEncryption = NewZoneSettingOpportunisticEncryptionService(opts...) + r.OpportunisticOnion = NewZoneSettingOpportunisticOnionService(opts...) + r.OrangeToOrange = NewZoneSettingOrangeToOrangeService(opts...) + r.OriginErrorPagePassThru = NewZoneSettingOriginErrorPagePassThruService(opts...) + r.OriginMaxHTTPVersion = NewZoneSettingOriginMaxHTTPVersionService(opts...) + r.Polish = NewZoneSettingPolishService(opts...) + r.PrefetchPreload = NewZoneSettingPrefetchPreloadService(opts...) + r.ProxyReadTimeout = NewZoneSettingProxyReadTimeoutService(opts...) + r.PseudoIPV4 = NewZoneSettingPseudoIPV4Service(opts...) + r.ResponseBuffering = NewZoneSettingResponseBufferingService(opts...) + r.RocketLoader = NewZoneSettingRocketLoaderService(opts...) + r.SecurityHeaders = NewZoneSettingSecurityHeaderService(opts...) + r.SecurityLevel = NewZoneSettingSecurityLevelService(opts...) + r.ServerSideExcludes = NewZoneSettingServerSideExcludeService(opts...) + r.SortQueryStringForCache = NewZoneSettingSortQueryStringForCacheService(opts...) + r.SSL = NewZoneSettingSSLService(opts...) + r.SSLRecommender = NewZoneSettingSSLRecommenderService(opts...) + r.TLS1_3 = NewZoneSettingTLS1_3Service(opts...) + r.TLSClientAuth = NewZoneSettingTLSClientAuthService(opts...) + r.TrueClientIPHeader = NewZoneSettingTrueClientIPHeaderService(opts...) + r.WAF = NewZoneSettingWAFService(opts...) + r.Webp = NewZoneSettingWebpService(opts...) + r.Websocket = NewZoneSettingWebsocketService(opts...) + r.FontSettings = NewZoneSettingFontSettingService(opts...) + return +} + +// Available settings for your user in relation to a zone. +func (r *ZoneSettingService) List(ctx context.Context, query ZoneSettingListParams, opts ...option.RequestOption) (res *[]ZoneSettingListResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingListResponseEnvelope + path := fmt.Sprintf("zones/%s/settings", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Edit settings for a zone. +func (r *ZoneSettingService) Edit(ctx context.Context, params ZoneSettingEditParams, opts ...option.RequestOption) (res *[]ZoneSettingEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// 0-RTT session resumption enabled for this zone. +// +// Union satisfied by [ZoneSettingListResponseZones0rtt], +// [ZoneSettingListResponseZonesAdvancedDDOS], +// [ZoneSettingListResponseZonesAlwaysOnline], +// [ZoneSettingListResponseZonesAlwaysUseHTTPS], +// [ZoneSettingListResponseZonesAutomaticHTTPSRewrites], +// [ZoneSettingListResponseZonesBrotli], +// [ZoneSettingListResponseZonesBrowserCacheTTL], +// [ZoneSettingListResponseZonesBrowserCheck], +// [ZoneSettingListResponseZonesCacheLevel], +// [ZoneSettingListResponseZonesChallengeTTL], +// [ZoneSettingListResponseZonesCiphers], +// [ZoneSettingListResponseZonesCnameFlattening], +// [ZoneSettingListResponseZonesDevelopmentMode], +// [ZoneSettingListResponseZonesEarlyHints], +// [ZoneSettingListResponseZonesEdgeCacheTTL], +// [ZoneSettingListResponseZonesEmailObfuscation], +// [ZoneSettingListResponseZonesH2Prioritization], +// [ZoneSettingListResponseZonesHotlinkProtection], +// [ZoneSettingListResponseZonesHTTP2], [ZoneSettingListResponseZonesHTTP3], +// [ZoneSettingListResponseZonesImageResizing], +// [ZoneSettingListResponseZonesIPGeolocation], [ZoneSettingListResponseZonesIPV6], +// [ZoneSettingListResponseZonesMaxUpload], +// [ZoneSettingListResponseZonesMinTLSVersion], +// [ZoneSettingListResponseZonesMinify], [ZoneSettingListResponseZonesMirage], +// [ZoneSettingListResponseZonesMobileRedirect], [ZoneSettingListResponseZonesNEL], +// [ZoneSettingListResponseZonesOpportunisticEncryption], +// [ZoneSettingListResponseZonesOpportunisticOnion], +// [ZoneSettingListResponseZonesOrangeToOrange], +// [ZoneSettingListResponseZonesOriginErrorPagePassThru], +// [ZoneSettingListResponseZonesPolish], +// [ZoneSettingListResponseZonesPrefetchPreload], +// [ZoneSettingListResponseZonesProxyReadTimeout], +// [ZoneSettingListResponseZonesPseudoIPV4], +// [ZoneSettingListResponseZonesResponseBuffering], +// [ZoneSettingListResponseZonesRocketLoader], +// [ZoneSettingListResponseZonesSchemasAutomaticPlatformOptimization], +// [ZoneSettingListResponseZonesSecurityHeader], +// [ZoneSettingListResponseZonesSecurityLevel], +// [ZoneSettingListResponseZonesServerSideExclude], +// [ZoneSettingListResponseZonesSha1Support], +// [ZoneSettingListResponseZonesSortQueryStringForCache], +// [ZoneSettingListResponseZonesSSL], [ZoneSettingListResponseZonesSSLRecommender], +// [ZoneSettingListResponseZonesTLS1_2Only], [ZoneSettingListResponseZonesTLS1_3], +// [ZoneSettingListResponseZonesTLSClientAuth], +// [ZoneSettingListResponseZonesTrueClientIPHeader], +// [ZoneSettingListResponseZonesWAF], [ZoneSettingListResponseZonesWebp] or +// [ZoneSettingListResponseZonesWebsockets]. +type ZoneSettingListResponse interface { + implementsZoneSettingListResponse() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneSettingListResponse)(nil)).Elem(), "") +} + +// 0-RTT session resumption enabled for this zone. +type ZoneSettingListResponseZones0rtt struct { + // ID of the zone setting. + ID ZoneSettingListResponseZones0rttID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZones0rttValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZones0rttEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZones0rttJSON `json:"-"` +} + +// zoneSettingListResponseZones0rttJSON contains the JSON metadata for the struct +// [ZoneSettingListResponseZones0rtt] +type zoneSettingListResponseZones0rttJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZones0rtt) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZones0rtt) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZones0rttID string + +const ( + ZoneSettingListResponseZones0rttID0rtt ZoneSettingListResponseZones0rttID = "0rtt" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZones0rttValue string + +const ( + ZoneSettingListResponseZones0rttValueOn ZoneSettingListResponseZones0rttValue = "on" + ZoneSettingListResponseZones0rttValueOff ZoneSettingListResponseZones0rttValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZones0rttEditable bool + +const ( + ZoneSettingListResponseZones0rttEditableTrue ZoneSettingListResponseZones0rttEditable = true + ZoneSettingListResponseZones0rttEditableFalse ZoneSettingListResponseZones0rttEditable = false +) + +// Advanced protection from Distributed Denial of Service (DDoS) attacks on your +// website. This is an uneditable value that is 'on' in the case of Business and +// Enterprise zones. +type ZoneSettingListResponseZonesAdvancedDDOS struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesAdvancedDDOSID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesAdvancedDDOSValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesAdvancedDDOSEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesAdvancedDDOSJSON `json:"-"` +} + +// zoneSettingListResponseZonesAdvancedDDOSJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseZonesAdvancedDDOS] +type zoneSettingListResponseZonesAdvancedDDOSJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesAdvancedDDOS) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesAdvancedDDOS) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesAdvancedDDOSID string + +const ( + ZoneSettingListResponseZonesAdvancedDDOSIDAdvancedDDOS ZoneSettingListResponseZonesAdvancedDDOSID = "advanced_ddos" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesAdvancedDDOSValue string + +const ( + ZoneSettingListResponseZonesAdvancedDDOSValueOn ZoneSettingListResponseZonesAdvancedDDOSValue = "on" + ZoneSettingListResponseZonesAdvancedDDOSValueOff ZoneSettingListResponseZonesAdvancedDDOSValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesAdvancedDDOSEditable bool + +const ( + ZoneSettingListResponseZonesAdvancedDDOSEditableTrue ZoneSettingListResponseZonesAdvancedDDOSEditable = true + ZoneSettingListResponseZonesAdvancedDDOSEditableFalse ZoneSettingListResponseZonesAdvancedDDOSEditable = false +) + +// When enabled, Cloudflare serves limited copies of web pages available from the +// [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is +// offline. Refer to +// [Always Online](https://developers.cloudflare.com/cache/about/always-online) for +// more information. +type ZoneSettingListResponseZonesAlwaysOnline struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesAlwaysOnlineID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesAlwaysOnlineValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesAlwaysOnlineEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesAlwaysOnlineJSON `json:"-"` +} + +// zoneSettingListResponseZonesAlwaysOnlineJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseZonesAlwaysOnline] +type zoneSettingListResponseZonesAlwaysOnlineJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesAlwaysOnline) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesAlwaysOnline) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesAlwaysOnlineID string + +const ( + ZoneSettingListResponseZonesAlwaysOnlineIDAlwaysOnline ZoneSettingListResponseZonesAlwaysOnlineID = "always_online" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesAlwaysOnlineValue string + +const ( + ZoneSettingListResponseZonesAlwaysOnlineValueOn ZoneSettingListResponseZonesAlwaysOnlineValue = "on" + ZoneSettingListResponseZonesAlwaysOnlineValueOff ZoneSettingListResponseZonesAlwaysOnlineValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesAlwaysOnlineEditable bool + +const ( + ZoneSettingListResponseZonesAlwaysOnlineEditableTrue ZoneSettingListResponseZonesAlwaysOnlineEditable = true + ZoneSettingListResponseZonesAlwaysOnlineEditableFalse ZoneSettingListResponseZonesAlwaysOnlineEditable = false +) + +// Reply to all requests for URLs that use "http" with a 301 redirect to the +// equivalent "https" URL. If you only want to redirect for a subset of requests, +// consider creating an "Always use HTTPS" page rule. +type ZoneSettingListResponseZonesAlwaysUseHTTPS struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesAlwaysUseHTTPSID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesAlwaysUseHTTPSValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesAlwaysUseHTTPSEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesAlwaysUseHTTPSJSON `json:"-"` +} + +// zoneSettingListResponseZonesAlwaysUseHTTPSJSON contains the JSON metadata for +// the struct [ZoneSettingListResponseZonesAlwaysUseHTTPS] +type zoneSettingListResponseZonesAlwaysUseHTTPSJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesAlwaysUseHTTPS) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesAlwaysUseHTTPS) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesAlwaysUseHTTPSID string + +const ( + ZoneSettingListResponseZonesAlwaysUseHTTPSIDAlwaysUseHTTPS ZoneSettingListResponseZonesAlwaysUseHTTPSID = "always_use_https" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesAlwaysUseHTTPSValue string + +const ( + ZoneSettingListResponseZonesAlwaysUseHTTPSValueOn ZoneSettingListResponseZonesAlwaysUseHTTPSValue = "on" + ZoneSettingListResponseZonesAlwaysUseHTTPSValueOff ZoneSettingListResponseZonesAlwaysUseHTTPSValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesAlwaysUseHTTPSEditable bool + +const ( + ZoneSettingListResponseZonesAlwaysUseHTTPSEditableTrue ZoneSettingListResponseZonesAlwaysUseHTTPSEditable = true + ZoneSettingListResponseZonesAlwaysUseHTTPSEditableFalse ZoneSettingListResponseZonesAlwaysUseHTTPSEditable = false +) + +// Enable the Automatic HTTPS Rewrites feature for this zone. +type ZoneSettingListResponseZonesAutomaticHTTPSRewrites struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesAutomaticHTTPSRewritesID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesAutomaticHTTPSRewritesValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesAutomaticHTTPSRewritesEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesAutomaticHTTPSRewritesJSON `json:"-"` +} + +// zoneSettingListResponseZonesAutomaticHTTPSRewritesJSON contains the JSON +// metadata for the struct [ZoneSettingListResponseZonesAutomaticHTTPSRewrites] +type zoneSettingListResponseZonesAutomaticHTTPSRewritesJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesAutomaticHTTPSRewrites) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesAutomaticHTTPSRewrites) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesAutomaticHTTPSRewritesID string + +const ( + ZoneSettingListResponseZonesAutomaticHTTPSRewritesIDAutomaticHTTPSRewrites ZoneSettingListResponseZonesAutomaticHTTPSRewritesID = "automatic_https_rewrites" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesAutomaticHTTPSRewritesValue string + +const ( + ZoneSettingListResponseZonesAutomaticHTTPSRewritesValueOn ZoneSettingListResponseZonesAutomaticHTTPSRewritesValue = "on" + ZoneSettingListResponseZonesAutomaticHTTPSRewritesValueOff ZoneSettingListResponseZonesAutomaticHTTPSRewritesValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesAutomaticHTTPSRewritesEditable bool + +const ( + ZoneSettingListResponseZonesAutomaticHTTPSRewritesEditableTrue ZoneSettingListResponseZonesAutomaticHTTPSRewritesEditable = true + ZoneSettingListResponseZonesAutomaticHTTPSRewritesEditableFalse ZoneSettingListResponseZonesAutomaticHTTPSRewritesEditable = false +) + +// When the client requesting an asset supports the Brotli compression algorithm, +// Cloudflare will serve a Brotli compressed version of the asset. +type ZoneSettingListResponseZonesBrotli struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesBrotliID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesBrotliValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesBrotliEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesBrotliJSON `json:"-"` +} + +// zoneSettingListResponseZonesBrotliJSON contains the JSON metadata for the struct +// [ZoneSettingListResponseZonesBrotli] +type zoneSettingListResponseZonesBrotliJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesBrotli) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesBrotli) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesBrotliID string + +const ( + ZoneSettingListResponseZonesBrotliIDBrotli ZoneSettingListResponseZonesBrotliID = "brotli" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesBrotliValue string + +const ( + ZoneSettingListResponseZonesBrotliValueOff ZoneSettingListResponseZonesBrotliValue = "off" + ZoneSettingListResponseZonesBrotliValueOn ZoneSettingListResponseZonesBrotliValue = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesBrotliEditable bool + +const ( + ZoneSettingListResponseZonesBrotliEditableTrue ZoneSettingListResponseZonesBrotliEditable = true + ZoneSettingListResponseZonesBrotliEditableFalse ZoneSettingListResponseZonesBrotliEditable = false +) + +// Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources +// will remain on your visitors' computers. Cloudflare will honor any larger times +// specified by your server. +// (https://support.cloudflare.com/hc/en-us/articles/200168276). +type ZoneSettingListResponseZonesBrowserCacheTTL struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesBrowserCacheTTLID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesBrowserCacheTTLValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesBrowserCacheTTLEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesBrowserCacheTTLJSON `json:"-"` +} + +// zoneSettingListResponseZonesBrowserCacheTTLJSON contains the JSON metadata for +// the struct [ZoneSettingListResponseZonesBrowserCacheTTL] +type zoneSettingListResponseZonesBrowserCacheTTLJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesBrowserCacheTTL) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesBrowserCacheTTL) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesBrowserCacheTTLID string + +const ( + ZoneSettingListResponseZonesBrowserCacheTTLIDBrowserCacheTTL ZoneSettingListResponseZonesBrowserCacheTTLID = "browser_cache_ttl" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesBrowserCacheTTLValue float64 + +const ( + ZoneSettingListResponseZonesBrowserCacheTTLValue0 ZoneSettingListResponseZonesBrowserCacheTTLValue = 0 + ZoneSettingListResponseZonesBrowserCacheTTLValue30 ZoneSettingListResponseZonesBrowserCacheTTLValue = 30 + ZoneSettingListResponseZonesBrowserCacheTTLValue60 ZoneSettingListResponseZonesBrowserCacheTTLValue = 60 + ZoneSettingListResponseZonesBrowserCacheTTLValue120 ZoneSettingListResponseZonesBrowserCacheTTLValue = 120 + ZoneSettingListResponseZonesBrowserCacheTTLValue300 ZoneSettingListResponseZonesBrowserCacheTTLValue = 300 + ZoneSettingListResponseZonesBrowserCacheTTLValue1200 ZoneSettingListResponseZonesBrowserCacheTTLValue = 1200 + ZoneSettingListResponseZonesBrowserCacheTTLValue1800 ZoneSettingListResponseZonesBrowserCacheTTLValue = 1800 + ZoneSettingListResponseZonesBrowserCacheTTLValue3600 ZoneSettingListResponseZonesBrowserCacheTTLValue = 3600 + ZoneSettingListResponseZonesBrowserCacheTTLValue7200 ZoneSettingListResponseZonesBrowserCacheTTLValue = 7200 + ZoneSettingListResponseZonesBrowserCacheTTLValue10800 ZoneSettingListResponseZonesBrowserCacheTTLValue = 10800 + ZoneSettingListResponseZonesBrowserCacheTTLValue14400 ZoneSettingListResponseZonesBrowserCacheTTLValue = 14400 + ZoneSettingListResponseZonesBrowserCacheTTLValue18000 ZoneSettingListResponseZonesBrowserCacheTTLValue = 18000 + ZoneSettingListResponseZonesBrowserCacheTTLValue28800 ZoneSettingListResponseZonesBrowserCacheTTLValue = 28800 + ZoneSettingListResponseZonesBrowserCacheTTLValue43200 ZoneSettingListResponseZonesBrowserCacheTTLValue = 43200 + ZoneSettingListResponseZonesBrowserCacheTTLValue57600 ZoneSettingListResponseZonesBrowserCacheTTLValue = 57600 + ZoneSettingListResponseZonesBrowserCacheTTLValue72000 ZoneSettingListResponseZonesBrowserCacheTTLValue = 72000 + ZoneSettingListResponseZonesBrowserCacheTTLValue86400 ZoneSettingListResponseZonesBrowserCacheTTLValue = 86400 + ZoneSettingListResponseZonesBrowserCacheTTLValue172800 ZoneSettingListResponseZonesBrowserCacheTTLValue = 172800 + ZoneSettingListResponseZonesBrowserCacheTTLValue259200 ZoneSettingListResponseZonesBrowserCacheTTLValue = 259200 + ZoneSettingListResponseZonesBrowserCacheTTLValue345600 ZoneSettingListResponseZonesBrowserCacheTTLValue = 345600 + ZoneSettingListResponseZonesBrowserCacheTTLValue432000 ZoneSettingListResponseZonesBrowserCacheTTLValue = 432000 + ZoneSettingListResponseZonesBrowserCacheTTLValue691200 ZoneSettingListResponseZonesBrowserCacheTTLValue = 691200 + ZoneSettingListResponseZonesBrowserCacheTTLValue1382400 ZoneSettingListResponseZonesBrowserCacheTTLValue = 1382400 + ZoneSettingListResponseZonesBrowserCacheTTLValue2073600 ZoneSettingListResponseZonesBrowserCacheTTLValue = 2073600 + ZoneSettingListResponseZonesBrowserCacheTTLValue2678400 ZoneSettingListResponseZonesBrowserCacheTTLValue = 2678400 + ZoneSettingListResponseZonesBrowserCacheTTLValue5356800 ZoneSettingListResponseZonesBrowserCacheTTLValue = 5356800 + ZoneSettingListResponseZonesBrowserCacheTTLValue16070400 ZoneSettingListResponseZonesBrowserCacheTTLValue = 16070400 + ZoneSettingListResponseZonesBrowserCacheTTLValue31536000 ZoneSettingListResponseZonesBrowserCacheTTLValue = 31536000 +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesBrowserCacheTTLEditable bool + +const ( + ZoneSettingListResponseZonesBrowserCacheTTLEditableTrue ZoneSettingListResponseZonesBrowserCacheTTLEditable = true + ZoneSettingListResponseZonesBrowserCacheTTLEditableFalse ZoneSettingListResponseZonesBrowserCacheTTLEditable = false +) + +// Browser Integrity Check is similar to Bad Behavior and looks for common HTTP +// headers abused most commonly by spammers and denies access to your page. It will +// also challenge visitors that do not have a user agent or a non standard user +// agent (also commonly used by abuse bots, crawlers or visitors). +// (https://support.cloudflare.com/hc/en-us/articles/200170086). +type ZoneSettingListResponseZonesBrowserCheck struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesBrowserCheckID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesBrowserCheckValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesBrowserCheckEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesBrowserCheckJSON `json:"-"` +} + +// zoneSettingListResponseZonesBrowserCheckJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseZonesBrowserCheck] +type zoneSettingListResponseZonesBrowserCheckJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesBrowserCheck) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesBrowserCheck) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesBrowserCheckID string + +const ( + ZoneSettingListResponseZonesBrowserCheckIDBrowserCheck ZoneSettingListResponseZonesBrowserCheckID = "browser_check" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesBrowserCheckValue string + +const ( + ZoneSettingListResponseZonesBrowserCheckValueOn ZoneSettingListResponseZonesBrowserCheckValue = "on" + ZoneSettingListResponseZonesBrowserCheckValueOff ZoneSettingListResponseZonesBrowserCheckValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesBrowserCheckEditable bool + +const ( + ZoneSettingListResponseZonesBrowserCheckEditableTrue ZoneSettingListResponseZonesBrowserCheckEditable = true + ZoneSettingListResponseZonesBrowserCheckEditableFalse ZoneSettingListResponseZonesBrowserCheckEditable = false +) + +// Cache Level functions based off the setting level. The basic setting will cache +// most static resources (i.e., css, images, and JavaScript). The simplified +// setting will ignore the query string when delivering a cached resource. The +// aggressive setting will cache all static resources, including ones with a query +// string. (https://support.cloudflare.com/hc/en-us/articles/200168256). +type ZoneSettingListResponseZonesCacheLevel struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesCacheLevelID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesCacheLevelValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesCacheLevelEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesCacheLevelJSON `json:"-"` +} + +// zoneSettingListResponseZonesCacheLevelJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseZonesCacheLevel] +type zoneSettingListResponseZonesCacheLevelJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesCacheLevel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesCacheLevel) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesCacheLevelID string + +const ( + ZoneSettingListResponseZonesCacheLevelIDCacheLevel ZoneSettingListResponseZonesCacheLevelID = "cache_level" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesCacheLevelValue string + +const ( + ZoneSettingListResponseZonesCacheLevelValueAggressive ZoneSettingListResponseZonesCacheLevelValue = "aggressive" + ZoneSettingListResponseZonesCacheLevelValueBasic ZoneSettingListResponseZonesCacheLevelValue = "basic" + ZoneSettingListResponseZonesCacheLevelValueSimplified ZoneSettingListResponseZonesCacheLevelValue = "simplified" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesCacheLevelEditable bool + +const ( + ZoneSettingListResponseZonesCacheLevelEditableTrue ZoneSettingListResponseZonesCacheLevelEditable = true + ZoneSettingListResponseZonesCacheLevelEditableFalse ZoneSettingListResponseZonesCacheLevelEditable = false +) + +// Specify how long a visitor is allowed access to your site after successfully +// completing a challenge (such as a CAPTCHA). After the TTL has expired the +// visitor will have to complete a new challenge. We recommend a 15 - 45 minute +// setting and will attempt to honor any setting above 45 minutes. +// (https://support.cloudflare.com/hc/en-us/articles/200170136). +type ZoneSettingListResponseZonesChallengeTTL struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesChallengeTTLID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesChallengeTTLValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesChallengeTTLEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesChallengeTTLJSON `json:"-"` +} + +// zoneSettingListResponseZonesChallengeTTLJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseZonesChallengeTTL] +type zoneSettingListResponseZonesChallengeTTLJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesChallengeTTL) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesChallengeTTL) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesChallengeTTLID string + +const ( + ZoneSettingListResponseZonesChallengeTTLIDChallengeTTL ZoneSettingListResponseZonesChallengeTTLID = "challenge_ttl" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesChallengeTTLValue float64 + +const ( + ZoneSettingListResponseZonesChallengeTTLValue300 ZoneSettingListResponseZonesChallengeTTLValue = 300 + ZoneSettingListResponseZonesChallengeTTLValue900 ZoneSettingListResponseZonesChallengeTTLValue = 900 + ZoneSettingListResponseZonesChallengeTTLValue1800 ZoneSettingListResponseZonesChallengeTTLValue = 1800 + ZoneSettingListResponseZonesChallengeTTLValue2700 ZoneSettingListResponseZonesChallengeTTLValue = 2700 + ZoneSettingListResponseZonesChallengeTTLValue3600 ZoneSettingListResponseZonesChallengeTTLValue = 3600 + ZoneSettingListResponseZonesChallengeTTLValue7200 ZoneSettingListResponseZonesChallengeTTLValue = 7200 + ZoneSettingListResponseZonesChallengeTTLValue10800 ZoneSettingListResponseZonesChallengeTTLValue = 10800 + ZoneSettingListResponseZonesChallengeTTLValue14400 ZoneSettingListResponseZonesChallengeTTLValue = 14400 + ZoneSettingListResponseZonesChallengeTTLValue28800 ZoneSettingListResponseZonesChallengeTTLValue = 28800 + ZoneSettingListResponseZonesChallengeTTLValue57600 ZoneSettingListResponseZonesChallengeTTLValue = 57600 + ZoneSettingListResponseZonesChallengeTTLValue86400 ZoneSettingListResponseZonesChallengeTTLValue = 86400 + ZoneSettingListResponseZonesChallengeTTLValue604800 ZoneSettingListResponseZonesChallengeTTLValue = 604800 + ZoneSettingListResponseZonesChallengeTTLValue2592000 ZoneSettingListResponseZonesChallengeTTLValue = 2592000 + ZoneSettingListResponseZonesChallengeTTLValue31536000 ZoneSettingListResponseZonesChallengeTTLValue = 31536000 +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesChallengeTTLEditable bool + +const ( + ZoneSettingListResponseZonesChallengeTTLEditableTrue ZoneSettingListResponseZonesChallengeTTLEditable = true + ZoneSettingListResponseZonesChallengeTTLEditableFalse ZoneSettingListResponseZonesChallengeTTLEditable = false +) + +// An allowlist of ciphers for TLS termination. These ciphers must be in the +// BoringSSL format. +type ZoneSettingListResponseZonesCiphers struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesCiphersID `json:"id,required"` + // Current value of the zone setting. + Value []string `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesCiphersEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesCiphersJSON `json:"-"` +} + +// zoneSettingListResponseZonesCiphersJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseZonesCiphers] +type zoneSettingListResponseZonesCiphersJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesCiphers) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesCiphers) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesCiphersID string + +const ( + ZoneSettingListResponseZonesCiphersIDCiphers ZoneSettingListResponseZonesCiphersID = "ciphers" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesCiphersEditable bool + +const ( + ZoneSettingListResponseZonesCiphersEditableTrue ZoneSettingListResponseZonesCiphersEditable = true + ZoneSettingListResponseZonesCiphersEditableFalse ZoneSettingListResponseZonesCiphersEditable = false +) + +// Whether or not cname flattening is on. +type ZoneSettingListResponseZonesCnameFlattening struct { + // How to flatten the cname destination. + ID ZoneSettingListResponseZonesCnameFlatteningID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesCnameFlatteningValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesCnameFlatteningEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesCnameFlatteningJSON `json:"-"` +} + +// zoneSettingListResponseZonesCnameFlatteningJSON contains the JSON metadata for +// the struct [ZoneSettingListResponseZonesCnameFlattening] +type zoneSettingListResponseZonesCnameFlatteningJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesCnameFlattening) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesCnameFlattening) implementsZoneSettingListResponse() {} + +// How to flatten the cname destination. +type ZoneSettingListResponseZonesCnameFlatteningID string + +const ( + ZoneSettingListResponseZonesCnameFlatteningIDCnameFlattening ZoneSettingListResponseZonesCnameFlatteningID = "cname_flattening" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesCnameFlatteningValue string + +const ( + ZoneSettingListResponseZonesCnameFlatteningValueFlattenAtRoot ZoneSettingListResponseZonesCnameFlatteningValue = "flatten_at_root" + ZoneSettingListResponseZonesCnameFlatteningValueFlattenAll ZoneSettingListResponseZonesCnameFlatteningValue = "flatten_all" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesCnameFlatteningEditable bool + +const ( + ZoneSettingListResponseZonesCnameFlatteningEditableTrue ZoneSettingListResponseZonesCnameFlatteningEditable = true + ZoneSettingListResponseZonesCnameFlatteningEditableFalse ZoneSettingListResponseZonesCnameFlatteningEditable = false +) + +// Development Mode temporarily allows you to enter development mode for your +// websites if you need to make changes to your site. This will bypass Cloudflare's +// accelerated cache and slow down your site, but is useful if you are making +// changes to cacheable content (like images, css, or JavaScript) and would like to +// see those changes right away. Once entered, development mode will last for 3 +// hours and then automatically toggle off. +type ZoneSettingListResponseZonesDevelopmentMode struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesDevelopmentModeID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesDevelopmentModeValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesDevelopmentModeEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. Notes: The interval (in seconds) from when + // development mode expires (positive integer) or last expired (negative integer) + // for the domain. If development mode has never been enabled, this value is false. + TimeRemaining float64 `json:"time_remaining"` + JSON zoneSettingListResponseZonesDevelopmentModeJSON `json:"-"` +} + +// zoneSettingListResponseZonesDevelopmentModeJSON contains the JSON metadata for +// the struct [ZoneSettingListResponseZonesDevelopmentMode] +type zoneSettingListResponseZonesDevelopmentModeJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + TimeRemaining apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesDevelopmentMode) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesDevelopmentMode) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesDevelopmentModeID string + +const ( + ZoneSettingListResponseZonesDevelopmentModeIDDevelopmentMode ZoneSettingListResponseZonesDevelopmentModeID = "development_mode" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesDevelopmentModeValue string + +const ( + ZoneSettingListResponseZonesDevelopmentModeValueOn ZoneSettingListResponseZonesDevelopmentModeValue = "on" + ZoneSettingListResponseZonesDevelopmentModeValueOff ZoneSettingListResponseZonesDevelopmentModeValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesDevelopmentModeEditable bool + +const ( + ZoneSettingListResponseZonesDevelopmentModeEditableTrue ZoneSettingListResponseZonesDevelopmentModeEditable = true + ZoneSettingListResponseZonesDevelopmentModeEditableFalse ZoneSettingListResponseZonesDevelopmentModeEditable = false +) + +// When enabled, Cloudflare will attempt to speed up overall page loads by serving +// `103` responses with `Link` headers from the final response. Refer to +// [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for +// more information. +type ZoneSettingListResponseZonesEarlyHints struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesEarlyHintsID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesEarlyHintsValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesEarlyHintsEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesEarlyHintsJSON `json:"-"` +} + +// zoneSettingListResponseZonesEarlyHintsJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseZonesEarlyHints] +type zoneSettingListResponseZonesEarlyHintsJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesEarlyHints) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesEarlyHints) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesEarlyHintsID string + +const ( + ZoneSettingListResponseZonesEarlyHintsIDEarlyHints ZoneSettingListResponseZonesEarlyHintsID = "early_hints" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesEarlyHintsValue string + +const ( + ZoneSettingListResponseZonesEarlyHintsValueOn ZoneSettingListResponseZonesEarlyHintsValue = "on" + ZoneSettingListResponseZonesEarlyHintsValueOff ZoneSettingListResponseZonesEarlyHintsValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesEarlyHintsEditable bool + +const ( + ZoneSettingListResponseZonesEarlyHintsEditableTrue ZoneSettingListResponseZonesEarlyHintsEditable = true + ZoneSettingListResponseZonesEarlyHintsEditableFalse ZoneSettingListResponseZonesEarlyHintsEditable = false +) + +// Time (in seconds) that a resource will be ensured to remain on Cloudflare's +// cache servers. +type ZoneSettingListResponseZonesEdgeCacheTTL struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesEdgeCacheTTLID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesEdgeCacheTTLValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesEdgeCacheTTLEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesEdgeCacheTTLJSON `json:"-"` +} + +// zoneSettingListResponseZonesEdgeCacheTTLJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseZonesEdgeCacheTTL] +type zoneSettingListResponseZonesEdgeCacheTTLJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesEdgeCacheTTL) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesEdgeCacheTTL) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesEdgeCacheTTLID string + +const ( + ZoneSettingListResponseZonesEdgeCacheTTLIDEdgeCacheTTL ZoneSettingListResponseZonesEdgeCacheTTLID = "edge_cache_ttl" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesEdgeCacheTTLValue float64 + +const ( + ZoneSettingListResponseZonesEdgeCacheTTLValue30 ZoneSettingListResponseZonesEdgeCacheTTLValue = 30 + ZoneSettingListResponseZonesEdgeCacheTTLValue60 ZoneSettingListResponseZonesEdgeCacheTTLValue = 60 + ZoneSettingListResponseZonesEdgeCacheTTLValue300 ZoneSettingListResponseZonesEdgeCacheTTLValue = 300 + ZoneSettingListResponseZonesEdgeCacheTTLValue1200 ZoneSettingListResponseZonesEdgeCacheTTLValue = 1200 + ZoneSettingListResponseZonesEdgeCacheTTLValue1800 ZoneSettingListResponseZonesEdgeCacheTTLValue = 1800 + ZoneSettingListResponseZonesEdgeCacheTTLValue3600 ZoneSettingListResponseZonesEdgeCacheTTLValue = 3600 + ZoneSettingListResponseZonesEdgeCacheTTLValue7200 ZoneSettingListResponseZonesEdgeCacheTTLValue = 7200 + ZoneSettingListResponseZonesEdgeCacheTTLValue10800 ZoneSettingListResponseZonesEdgeCacheTTLValue = 10800 + ZoneSettingListResponseZonesEdgeCacheTTLValue14400 ZoneSettingListResponseZonesEdgeCacheTTLValue = 14400 + ZoneSettingListResponseZonesEdgeCacheTTLValue18000 ZoneSettingListResponseZonesEdgeCacheTTLValue = 18000 + ZoneSettingListResponseZonesEdgeCacheTTLValue28800 ZoneSettingListResponseZonesEdgeCacheTTLValue = 28800 + ZoneSettingListResponseZonesEdgeCacheTTLValue43200 ZoneSettingListResponseZonesEdgeCacheTTLValue = 43200 + ZoneSettingListResponseZonesEdgeCacheTTLValue57600 ZoneSettingListResponseZonesEdgeCacheTTLValue = 57600 + ZoneSettingListResponseZonesEdgeCacheTTLValue72000 ZoneSettingListResponseZonesEdgeCacheTTLValue = 72000 + ZoneSettingListResponseZonesEdgeCacheTTLValue86400 ZoneSettingListResponseZonesEdgeCacheTTLValue = 86400 + ZoneSettingListResponseZonesEdgeCacheTTLValue172800 ZoneSettingListResponseZonesEdgeCacheTTLValue = 172800 + ZoneSettingListResponseZonesEdgeCacheTTLValue259200 ZoneSettingListResponseZonesEdgeCacheTTLValue = 259200 + ZoneSettingListResponseZonesEdgeCacheTTLValue345600 ZoneSettingListResponseZonesEdgeCacheTTLValue = 345600 + ZoneSettingListResponseZonesEdgeCacheTTLValue432000 ZoneSettingListResponseZonesEdgeCacheTTLValue = 432000 + ZoneSettingListResponseZonesEdgeCacheTTLValue518400 ZoneSettingListResponseZonesEdgeCacheTTLValue = 518400 + ZoneSettingListResponseZonesEdgeCacheTTLValue604800 ZoneSettingListResponseZonesEdgeCacheTTLValue = 604800 +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesEdgeCacheTTLEditable bool + +const ( + ZoneSettingListResponseZonesEdgeCacheTTLEditableTrue ZoneSettingListResponseZonesEdgeCacheTTLEditable = true + ZoneSettingListResponseZonesEdgeCacheTTLEditableFalse ZoneSettingListResponseZonesEdgeCacheTTLEditable = false +) + +// Encrypt email adresses on your web page from bots, while keeping them visible to +// humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). +type ZoneSettingListResponseZonesEmailObfuscation struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesEmailObfuscationID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesEmailObfuscationValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesEmailObfuscationEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesEmailObfuscationJSON `json:"-"` +} + +// zoneSettingListResponseZonesEmailObfuscationJSON contains the JSON metadata for +// the struct [ZoneSettingListResponseZonesEmailObfuscation] +type zoneSettingListResponseZonesEmailObfuscationJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesEmailObfuscation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesEmailObfuscation) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesEmailObfuscationID string + +const ( + ZoneSettingListResponseZonesEmailObfuscationIDEmailObfuscation ZoneSettingListResponseZonesEmailObfuscationID = "email_obfuscation" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesEmailObfuscationValue string + +const ( + ZoneSettingListResponseZonesEmailObfuscationValueOn ZoneSettingListResponseZonesEmailObfuscationValue = "on" + ZoneSettingListResponseZonesEmailObfuscationValueOff ZoneSettingListResponseZonesEmailObfuscationValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesEmailObfuscationEditable bool + +const ( + ZoneSettingListResponseZonesEmailObfuscationEditableTrue ZoneSettingListResponseZonesEmailObfuscationEditable = true + ZoneSettingListResponseZonesEmailObfuscationEditableFalse ZoneSettingListResponseZonesEmailObfuscationEditable = false +) + +// HTTP/2 Edge Prioritization optimises the delivery of resources served through +// HTTP/2 to improve page load performance. It also supports fine control of +// content delivery when used in conjunction with Workers. +type ZoneSettingListResponseZonesH2Prioritization struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesH2PrioritizationID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesH2PrioritizationValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesH2PrioritizationEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesH2PrioritizationJSON `json:"-"` +} + +// zoneSettingListResponseZonesH2PrioritizationJSON contains the JSON metadata for +// the struct [ZoneSettingListResponseZonesH2Prioritization] +type zoneSettingListResponseZonesH2PrioritizationJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesH2Prioritization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesH2Prioritization) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesH2PrioritizationID string + +const ( + ZoneSettingListResponseZonesH2PrioritizationIDH2Prioritization ZoneSettingListResponseZonesH2PrioritizationID = "h2_prioritization" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesH2PrioritizationValue string + +const ( + ZoneSettingListResponseZonesH2PrioritizationValueOn ZoneSettingListResponseZonesH2PrioritizationValue = "on" + ZoneSettingListResponseZonesH2PrioritizationValueOff ZoneSettingListResponseZonesH2PrioritizationValue = "off" + ZoneSettingListResponseZonesH2PrioritizationValueCustom ZoneSettingListResponseZonesH2PrioritizationValue = "custom" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesH2PrioritizationEditable bool + +const ( + ZoneSettingListResponseZonesH2PrioritizationEditableTrue ZoneSettingListResponseZonesH2PrioritizationEditable = true + ZoneSettingListResponseZonesH2PrioritizationEditableFalse ZoneSettingListResponseZonesH2PrioritizationEditable = false +) + +// When enabled, the Hotlink Protection option ensures that other sites cannot suck +// up your bandwidth by building pages that use images hosted on your site. Anytime +// a request for an image on your site hits Cloudflare, we check to ensure that +// it's not another site requesting them. People will still be able to download and +// view images from your page, but other sites won't be able to steal them for use +// on their own pages. +// (https://support.cloudflare.com/hc/en-us/articles/200170026). +type ZoneSettingListResponseZonesHotlinkProtection struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesHotlinkProtectionID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesHotlinkProtectionValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesHotlinkProtectionEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesHotlinkProtectionJSON `json:"-"` +} + +// zoneSettingListResponseZonesHotlinkProtectionJSON contains the JSON metadata for +// the struct [ZoneSettingListResponseZonesHotlinkProtection] +type zoneSettingListResponseZonesHotlinkProtectionJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesHotlinkProtection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesHotlinkProtection) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesHotlinkProtectionID string + +const ( + ZoneSettingListResponseZonesHotlinkProtectionIDHotlinkProtection ZoneSettingListResponseZonesHotlinkProtectionID = "hotlink_protection" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesHotlinkProtectionValue string + +const ( + ZoneSettingListResponseZonesHotlinkProtectionValueOn ZoneSettingListResponseZonesHotlinkProtectionValue = "on" + ZoneSettingListResponseZonesHotlinkProtectionValueOff ZoneSettingListResponseZonesHotlinkProtectionValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesHotlinkProtectionEditable bool + +const ( + ZoneSettingListResponseZonesHotlinkProtectionEditableTrue ZoneSettingListResponseZonesHotlinkProtectionEditable = true + ZoneSettingListResponseZonesHotlinkProtectionEditableFalse ZoneSettingListResponseZonesHotlinkProtectionEditable = false +) + +// HTTP2 enabled for this zone. +type ZoneSettingListResponseZonesHTTP2 struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesHTTP2ID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesHTTP2Value `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesHTTP2Editable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesHTTP2JSON `json:"-"` +} + +// zoneSettingListResponseZonesHTTP2JSON contains the JSON metadata for the struct +// [ZoneSettingListResponseZonesHTTP2] +type zoneSettingListResponseZonesHTTP2JSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesHTTP2) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesHTTP2) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesHTTP2ID string + +const ( + ZoneSettingListResponseZonesHTTP2IDHTTP2 ZoneSettingListResponseZonesHTTP2ID = "http2" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesHTTP2Value string + +const ( + ZoneSettingListResponseZonesHTTP2ValueOn ZoneSettingListResponseZonesHTTP2Value = "on" + ZoneSettingListResponseZonesHTTP2ValueOff ZoneSettingListResponseZonesHTTP2Value = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesHTTP2Editable bool + +const ( + ZoneSettingListResponseZonesHTTP2EditableTrue ZoneSettingListResponseZonesHTTP2Editable = true + ZoneSettingListResponseZonesHTTP2EditableFalse ZoneSettingListResponseZonesHTTP2Editable = false +) + +// HTTP3 enabled for this zone. +type ZoneSettingListResponseZonesHTTP3 struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesHTTP3ID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesHTTP3Value `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesHTTP3Editable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesHTTP3JSON `json:"-"` +} + +// zoneSettingListResponseZonesHTTP3JSON contains the JSON metadata for the struct +// [ZoneSettingListResponseZonesHTTP3] +type zoneSettingListResponseZonesHTTP3JSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesHTTP3) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesHTTP3) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesHTTP3ID string + +const ( + ZoneSettingListResponseZonesHTTP3IDHTTP3 ZoneSettingListResponseZonesHTTP3ID = "http3" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesHTTP3Value string + +const ( + ZoneSettingListResponseZonesHTTP3ValueOn ZoneSettingListResponseZonesHTTP3Value = "on" + ZoneSettingListResponseZonesHTTP3ValueOff ZoneSettingListResponseZonesHTTP3Value = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesHTTP3Editable bool + +const ( + ZoneSettingListResponseZonesHTTP3EditableTrue ZoneSettingListResponseZonesHTTP3Editable = true + ZoneSettingListResponseZonesHTTP3EditableFalse ZoneSettingListResponseZonesHTTP3Editable = false +) + +// Image Resizing provides on-demand resizing, conversion and optimisation for +// images served through Cloudflare's network. Refer to the +// [Image Resizing documentation](https://developers.cloudflare.com/images/) for +// more information. +type ZoneSettingListResponseZonesImageResizing struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesImageResizingID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesImageResizingValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesImageResizingEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesImageResizingJSON `json:"-"` +} + +// zoneSettingListResponseZonesImageResizingJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseZonesImageResizing] +type zoneSettingListResponseZonesImageResizingJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesImageResizing) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesImageResizing) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesImageResizingID string + +const ( + ZoneSettingListResponseZonesImageResizingIDImageResizing ZoneSettingListResponseZonesImageResizingID = "image_resizing" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesImageResizingValue string + +const ( + ZoneSettingListResponseZonesImageResizingValueOn ZoneSettingListResponseZonesImageResizingValue = "on" + ZoneSettingListResponseZonesImageResizingValueOff ZoneSettingListResponseZonesImageResizingValue = "off" + ZoneSettingListResponseZonesImageResizingValueOpen ZoneSettingListResponseZonesImageResizingValue = "open" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesImageResizingEditable bool + +const ( + ZoneSettingListResponseZonesImageResizingEditableTrue ZoneSettingListResponseZonesImageResizingEditable = true + ZoneSettingListResponseZonesImageResizingEditableFalse ZoneSettingListResponseZonesImageResizingEditable = false +) + +// Enable IP Geolocation to have Cloudflare geolocate visitors to your website and +// pass the country code to you. +// (https://support.cloudflare.com/hc/en-us/articles/200168236). +type ZoneSettingListResponseZonesIPGeolocation struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesIPGeolocationID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesIPGeolocationValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesIPGeolocationEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesIPGeolocationJSON `json:"-"` +} + +// zoneSettingListResponseZonesIPGeolocationJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseZonesIPGeolocation] +type zoneSettingListResponseZonesIPGeolocationJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesIPGeolocation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesIPGeolocation) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesIPGeolocationID string + +const ( + ZoneSettingListResponseZonesIPGeolocationIDIPGeolocation ZoneSettingListResponseZonesIPGeolocationID = "ip_geolocation" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesIPGeolocationValue string + +const ( + ZoneSettingListResponseZonesIPGeolocationValueOn ZoneSettingListResponseZonesIPGeolocationValue = "on" + ZoneSettingListResponseZonesIPGeolocationValueOff ZoneSettingListResponseZonesIPGeolocationValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesIPGeolocationEditable bool + +const ( + ZoneSettingListResponseZonesIPGeolocationEditableTrue ZoneSettingListResponseZonesIPGeolocationEditable = true + ZoneSettingListResponseZonesIPGeolocationEditableFalse ZoneSettingListResponseZonesIPGeolocationEditable = false +) + +// Enable IPv6 on all subdomains that are Cloudflare enabled. +// (https://support.cloudflare.com/hc/en-us/articles/200168586). +type ZoneSettingListResponseZonesIPV6 struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesIPV6ID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesIPV6Value `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesIPV6Editable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesIPV6JSON `json:"-"` +} + +// zoneSettingListResponseZonesIPV6JSON contains the JSON metadata for the struct +// [ZoneSettingListResponseZonesIPV6] +type zoneSettingListResponseZonesIPV6JSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesIPV6) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesIPV6) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesIPV6ID string + +const ( + ZoneSettingListResponseZonesIPV6IDIPV6 ZoneSettingListResponseZonesIPV6ID = "ipv6" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesIPV6Value string + +const ( + ZoneSettingListResponseZonesIPV6ValueOff ZoneSettingListResponseZonesIPV6Value = "off" + ZoneSettingListResponseZonesIPV6ValueOn ZoneSettingListResponseZonesIPV6Value = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesIPV6Editable bool + +const ( + ZoneSettingListResponseZonesIPV6EditableTrue ZoneSettingListResponseZonesIPV6Editable = true + ZoneSettingListResponseZonesIPV6EditableFalse ZoneSettingListResponseZonesIPV6Editable = false +) + +// Maximum size of an allowable upload. +type ZoneSettingListResponseZonesMaxUpload struct { + // identifier of the zone setting. + ID ZoneSettingListResponseZonesMaxUploadID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesMaxUploadValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesMaxUploadEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesMaxUploadJSON `json:"-"` +} + +// zoneSettingListResponseZonesMaxUploadJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseZonesMaxUpload] +type zoneSettingListResponseZonesMaxUploadJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesMaxUpload) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesMaxUpload) implementsZoneSettingListResponse() {} + +// identifier of the zone setting. +type ZoneSettingListResponseZonesMaxUploadID string + +const ( + ZoneSettingListResponseZonesMaxUploadIDMaxUpload ZoneSettingListResponseZonesMaxUploadID = "max_upload" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesMaxUploadValue float64 + +const ( + ZoneSettingListResponseZonesMaxUploadValue100 ZoneSettingListResponseZonesMaxUploadValue = 100 + ZoneSettingListResponseZonesMaxUploadValue200 ZoneSettingListResponseZonesMaxUploadValue = 200 + ZoneSettingListResponseZonesMaxUploadValue500 ZoneSettingListResponseZonesMaxUploadValue = 500 +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesMaxUploadEditable bool + +const ( + ZoneSettingListResponseZonesMaxUploadEditableTrue ZoneSettingListResponseZonesMaxUploadEditable = true + ZoneSettingListResponseZonesMaxUploadEditableFalse ZoneSettingListResponseZonesMaxUploadEditable = false +) + +// Only accepts HTTPS requests that use at least the TLS protocol version +// specified. For example, if TLS 1.1 is selected, TLS 1.0 connections will be +// rejected, while 1.1, 1.2, and 1.3 (if enabled) will be permitted. +type ZoneSettingListResponseZonesMinTLSVersion struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesMinTLSVersionID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesMinTLSVersionValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesMinTLSVersionEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesMinTLSVersionJSON `json:"-"` +} + +// zoneSettingListResponseZonesMinTLSVersionJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseZonesMinTLSVersion] +type zoneSettingListResponseZonesMinTLSVersionJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesMinTLSVersion) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesMinTLSVersion) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesMinTLSVersionID string + +const ( + ZoneSettingListResponseZonesMinTLSVersionIDMinTLSVersion ZoneSettingListResponseZonesMinTLSVersionID = "min_tls_version" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesMinTLSVersionValue string + +const ( + ZoneSettingListResponseZonesMinTLSVersionValue1_0 ZoneSettingListResponseZonesMinTLSVersionValue = "1.0" + ZoneSettingListResponseZonesMinTLSVersionValue1_1 ZoneSettingListResponseZonesMinTLSVersionValue = "1.1" + ZoneSettingListResponseZonesMinTLSVersionValue1_2 ZoneSettingListResponseZonesMinTLSVersionValue = "1.2" + ZoneSettingListResponseZonesMinTLSVersionValue1_3 ZoneSettingListResponseZonesMinTLSVersionValue = "1.3" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesMinTLSVersionEditable bool + +const ( + ZoneSettingListResponseZonesMinTLSVersionEditableTrue ZoneSettingListResponseZonesMinTLSVersionEditable = true + ZoneSettingListResponseZonesMinTLSVersionEditableFalse ZoneSettingListResponseZonesMinTLSVersionEditable = false +) + +// Automatically minify certain assets for your website. Refer to +// [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) +// for more information. +type ZoneSettingListResponseZonesMinify struct { + // Zone setting identifier. + ID ZoneSettingListResponseZonesMinifyID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesMinifyValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesMinifyEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesMinifyJSON `json:"-"` +} + +// zoneSettingListResponseZonesMinifyJSON contains the JSON metadata for the struct +// [ZoneSettingListResponseZonesMinify] +type zoneSettingListResponseZonesMinifyJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesMinify) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesMinify) implementsZoneSettingListResponse() {} + +// Zone setting identifier. +type ZoneSettingListResponseZonesMinifyID string + +const ( + ZoneSettingListResponseZonesMinifyIDMinify ZoneSettingListResponseZonesMinifyID = "minify" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesMinifyValue struct { + // Automatically minify all CSS files for your website. + Css ZoneSettingListResponseZonesMinifyValueCss `json:"css"` + // Automatically minify all HTML files for your website. + HTML ZoneSettingListResponseZonesMinifyValueHTML `json:"html"` + // Automatically minify all JavaScript files for your website. + Js ZoneSettingListResponseZonesMinifyValueJs `json:"js"` + JSON zoneSettingListResponseZonesMinifyValueJSON `json:"-"` +} + +// zoneSettingListResponseZonesMinifyValueJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseZonesMinifyValue] +type zoneSettingListResponseZonesMinifyValueJSON struct { + Css apijson.Field + HTML apijson.Field + Js apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesMinifyValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Automatically minify all CSS files for your website. +type ZoneSettingListResponseZonesMinifyValueCss string + +const ( + ZoneSettingListResponseZonesMinifyValueCssOn ZoneSettingListResponseZonesMinifyValueCss = "on" + ZoneSettingListResponseZonesMinifyValueCssOff ZoneSettingListResponseZonesMinifyValueCss = "off" +) + +// Automatically minify all HTML files for your website. +type ZoneSettingListResponseZonesMinifyValueHTML string + +const ( + ZoneSettingListResponseZonesMinifyValueHTMLOn ZoneSettingListResponseZonesMinifyValueHTML = "on" + ZoneSettingListResponseZonesMinifyValueHTMLOff ZoneSettingListResponseZonesMinifyValueHTML = "off" +) + +// Automatically minify all JavaScript files for your website. +type ZoneSettingListResponseZonesMinifyValueJs string + +const ( + ZoneSettingListResponseZonesMinifyValueJsOn ZoneSettingListResponseZonesMinifyValueJs = "on" + ZoneSettingListResponseZonesMinifyValueJsOff ZoneSettingListResponseZonesMinifyValueJs = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesMinifyEditable bool + +const ( + ZoneSettingListResponseZonesMinifyEditableTrue ZoneSettingListResponseZonesMinifyEditable = true + ZoneSettingListResponseZonesMinifyEditableFalse ZoneSettingListResponseZonesMinifyEditable = false +) + +// Automatically optimize image loading for website visitors on mobile devices. +// Refer to +// [our blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for +// more information. +type ZoneSettingListResponseZonesMirage struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesMirageID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesMirageValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesMirageEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesMirageJSON `json:"-"` +} + +// zoneSettingListResponseZonesMirageJSON contains the JSON metadata for the struct +// [ZoneSettingListResponseZonesMirage] +type zoneSettingListResponseZonesMirageJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesMirage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesMirage) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesMirageID string + +const ( + ZoneSettingListResponseZonesMirageIDMirage ZoneSettingListResponseZonesMirageID = "mirage" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesMirageValue string + +const ( + ZoneSettingListResponseZonesMirageValueOn ZoneSettingListResponseZonesMirageValue = "on" + ZoneSettingListResponseZonesMirageValueOff ZoneSettingListResponseZonesMirageValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesMirageEditable bool + +const ( + ZoneSettingListResponseZonesMirageEditableTrue ZoneSettingListResponseZonesMirageEditable = true + ZoneSettingListResponseZonesMirageEditableFalse ZoneSettingListResponseZonesMirageEditable = false +) + +// Automatically redirect visitors on mobile devices to a mobile-optimized +// subdomain. Refer to +// [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) +// for more information. +type ZoneSettingListResponseZonesMobileRedirect struct { + // Identifier of the zone setting. + ID ZoneSettingListResponseZonesMobileRedirectID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesMobileRedirectValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesMobileRedirectEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesMobileRedirectJSON `json:"-"` +} + +// zoneSettingListResponseZonesMobileRedirectJSON contains the JSON metadata for +// the struct [ZoneSettingListResponseZonesMobileRedirect] +type zoneSettingListResponseZonesMobileRedirectJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesMobileRedirect) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesMobileRedirect) implementsZoneSettingListResponse() {} + +// Identifier of the zone setting. +type ZoneSettingListResponseZonesMobileRedirectID string + +const ( + ZoneSettingListResponseZonesMobileRedirectIDMobileRedirect ZoneSettingListResponseZonesMobileRedirectID = "mobile_redirect" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesMobileRedirectValue struct { + // Which subdomain prefix you wish to redirect visitors on mobile devices to + // (subdomain must already exist). + MobileSubdomain string `json:"mobile_subdomain,nullable"` + // Whether or not mobile redirect is enabled. + Status ZoneSettingListResponseZonesMobileRedirectValueStatus `json:"status"` + // Whether to drop the current page path and redirect to the mobile subdomain URL + // root, or keep the path and redirect to the same page on the mobile subdomain. + StripUri bool `json:"strip_uri"` + JSON zoneSettingListResponseZonesMobileRedirectValueJSON `json:"-"` +} + +// zoneSettingListResponseZonesMobileRedirectValueJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseZonesMobileRedirectValue] +type zoneSettingListResponseZonesMobileRedirectValueJSON struct { + MobileSubdomain apijson.Field + Status apijson.Field + StripUri apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesMobileRedirectValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether or not mobile redirect is enabled. +type ZoneSettingListResponseZonesMobileRedirectValueStatus string + +const ( + ZoneSettingListResponseZonesMobileRedirectValueStatusOn ZoneSettingListResponseZonesMobileRedirectValueStatus = "on" + ZoneSettingListResponseZonesMobileRedirectValueStatusOff ZoneSettingListResponseZonesMobileRedirectValueStatus = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesMobileRedirectEditable bool + +const ( + ZoneSettingListResponseZonesMobileRedirectEditableTrue ZoneSettingListResponseZonesMobileRedirectEditable = true + ZoneSettingListResponseZonesMobileRedirectEditableFalse ZoneSettingListResponseZonesMobileRedirectEditable = false +) + +// Enable Network Error Logging reporting on your zone. (Beta) +type ZoneSettingListResponseZonesNEL struct { + // Zone setting identifier. + ID ZoneSettingListResponseZonesNELID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesNELValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesNELEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesNELJSON `json:"-"` +} + +// zoneSettingListResponseZonesNELJSON contains the JSON metadata for the struct +// [ZoneSettingListResponseZonesNEL] +type zoneSettingListResponseZonesNELJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesNEL) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesNEL) implementsZoneSettingListResponse() {} + +// Zone setting identifier. +type ZoneSettingListResponseZonesNELID string + +const ( + ZoneSettingListResponseZonesNELIDNEL ZoneSettingListResponseZonesNELID = "nel" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesNELValue struct { + Enabled bool `json:"enabled"` + JSON zoneSettingListResponseZonesNELValueJSON `json:"-"` +} + +// zoneSettingListResponseZonesNELValueJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseZonesNELValue] +type zoneSettingListResponseZonesNELValueJSON struct { + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesNELValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesNELEditable bool + +const ( + ZoneSettingListResponseZonesNELEditableTrue ZoneSettingListResponseZonesNELEditable = true + ZoneSettingListResponseZonesNELEditableFalse ZoneSettingListResponseZonesNELEditable = false +) + +// Enables the Opportunistic Encryption feature for a zone. +type ZoneSettingListResponseZonesOpportunisticEncryption struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesOpportunisticEncryptionID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesOpportunisticEncryptionValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesOpportunisticEncryptionEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesOpportunisticEncryptionJSON `json:"-"` +} + +// zoneSettingListResponseZonesOpportunisticEncryptionJSON contains the JSON +// metadata for the struct [ZoneSettingListResponseZonesOpportunisticEncryption] +type zoneSettingListResponseZonesOpportunisticEncryptionJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesOpportunisticEncryption) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesOpportunisticEncryption) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesOpportunisticEncryptionID string + +const ( + ZoneSettingListResponseZonesOpportunisticEncryptionIDOpportunisticEncryption ZoneSettingListResponseZonesOpportunisticEncryptionID = "opportunistic_encryption" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesOpportunisticEncryptionValue string + +const ( + ZoneSettingListResponseZonesOpportunisticEncryptionValueOn ZoneSettingListResponseZonesOpportunisticEncryptionValue = "on" + ZoneSettingListResponseZonesOpportunisticEncryptionValueOff ZoneSettingListResponseZonesOpportunisticEncryptionValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesOpportunisticEncryptionEditable bool + +const ( + ZoneSettingListResponseZonesOpportunisticEncryptionEditableTrue ZoneSettingListResponseZonesOpportunisticEncryptionEditable = true + ZoneSettingListResponseZonesOpportunisticEncryptionEditableFalse ZoneSettingListResponseZonesOpportunisticEncryptionEditable = false +) + +// Add an Alt-Svc header to all legitimate requests from Tor, allowing the +// connection to use our onion services instead of exit nodes. +type ZoneSettingListResponseZonesOpportunisticOnion struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesOpportunisticOnionID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesOpportunisticOnionValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesOpportunisticOnionEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesOpportunisticOnionJSON `json:"-"` +} + +// zoneSettingListResponseZonesOpportunisticOnionJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseZonesOpportunisticOnion] +type zoneSettingListResponseZonesOpportunisticOnionJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesOpportunisticOnion) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesOpportunisticOnion) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesOpportunisticOnionID string + +const ( + ZoneSettingListResponseZonesOpportunisticOnionIDOpportunisticOnion ZoneSettingListResponseZonesOpportunisticOnionID = "opportunistic_onion" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesOpportunisticOnionValue string + +const ( + ZoneSettingListResponseZonesOpportunisticOnionValueOn ZoneSettingListResponseZonesOpportunisticOnionValue = "on" + ZoneSettingListResponseZonesOpportunisticOnionValueOff ZoneSettingListResponseZonesOpportunisticOnionValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesOpportunisticOnionEditable bool + +const ( + ZoneSettingListResponseZonesOpportunisticOnionEditableTrue ZoneSettingListResponseZonesOpportunisticOnionEditable = true + ZoneSettingListResponseZonesOpportunisticOnionEditableFalse ZoneSettingListResponseZonesOpportunisticOnionEditable = false +) + +// Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also +// on Cloudflare. +type ZoneSettingListResponseZonesOrangeToOrange struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesOrangeToOrangeID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesOrangeToOrangeValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesOrangeToOrangeEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesOrangeToOrangeJSON `json:"-"` +} + +// zoneSettingListResponseZonesOrangeToOrangeJSON contains the JSON metadata for +// the struct [ZoneSettingListResponseZonesOrangeToOrange] +type zoneSettingListResponseZonesOrangeToOrangeJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesOrangeToOrange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesOrangeToOrange) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesOrangeToOrangeID string + +const ( + ZoneSettingListResponseZonesOrangeToOrangeIDOrangeToOrange ZoneSettingListResponseZonesOrangeToOrangeID = "orange_to_orange" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesOrangeToOrangeValue string + +const ( + ZoneSettingListResponseZonesOrangeToOrangeValueOn ZoneSettingListResponseZonesOrangeToOrangeValue = "on" + ZoneSettingListResponseZonesOrangeToOrangeValueOff ZoneSettingListResponseZonesOrangeToOrangeValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesOrangeToOrangeEditable bool + +const ( + ZoneSettingListResponseZonesOrangeToOrangeEditableTrue ZoneSettingListResponseZonesOrangeToOrangeEditable = true + ZoneSettingListResponseZonesOrangeToOrangeEditableFalse ZoneSettingListResponseZonesOrangeToOrangeEditable = false +) + +// Cloudflare will proxy customer error pages on any 502,504 errors on origin +// server instead of showing a default Cloudflare error page. This does not apply +// to 522 errors and is limited to Enterprise Zones. +type ZoneSettingListResponseZonesOriginErrorPagePassThru struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesOriginErrorPagePassThruID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesOriginErrorPagePassThruValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesOriginErrorPagePassThruEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesOriginErrorPagePassThruJSON `json:"-"` +} + +// zoneSettingListResponseZonesOriginErrorPagePassThruJSON contains the JSON +// metadata for the struct [ZoneSettingListResponseZonesOriginErrorPagePassThru] +type zoneSettingListResponseZonesOriginErrorPagePassThruJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesOriginErrorPagePassThru) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesOriginErrorPagePassThru) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesOriginErrorPagePassThruID string + +const ( + ZoneSettingListResponseZonesOriginErrorPagePassThruIDOriginErrorPagePassThru ZoneSettingListResponseZonesOriginErrorPagePassThruID = "origin_error_page_pass_thru" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesOriginErrorPagePassThruValue string + +const ( + ZoneSettingListResponseZonesOriginErrorPagePassThruValueOn ZoneSettingListResponseZonesOriginErrorPagePassThruValue = "on" + ZoneSettingListResponseZonesOriginErrorPagePassThruValueOff ZoneSettingListResponseZonesOriginErrorPagePassThruValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesOriginErrorPagePassThruEditable bool + +const ( + ZoneSettingListResponseZonesOriginErrorPagePassThruEditableTrue ZoneSettingListResponseZonesOriginErrorPagePassThruEditable = true + ZoneSettingListResponseZonesOriginErrorPagePassThruEditableFalse ZoneSettingListResponseZonesOriginErrorPagePassThruEditable = false +) + +// Removes metadata and compresses your images for faster page load times. Basic +// (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual +// quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster +// image loading. Larger JPEGs are converted to progressive images, loading a +// lower-resolution image first and ending in a higher-resolution version. Not +// recommended for hi-res photography sites. +type ZoneSettingListResponseZonesPolish struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesPolishID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesPolishValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesPolishEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesPolishJSON `json:"-"` +} + +// zoneSettingListResponseZonesPolishJSON contains the JSON metadata for the struct +// [ZoneSettingListResponseZonesPolish] +type zoneSettingListResponseZonesPolishJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesPolish) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesPolish) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesPolishID string + +const ( + ZoneSettingListResponseZonesPolishIDPolish ZoneSettingListResponseZonesPolishID = "polish" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesPolishValue string + +const ( + ZoneSettingListResponseZonesPolishValueOff ZoneSettingListResponseZonesPolishValue = "off" + ZoneSettingListResponseZonesPolishValueLossless ZoneSettingListResponseZonesPolishValue = "lossless" + ZoneSettingListResponseZonesPolishValueLossy ZoneSettingListResponseZonesPolishValue = "lossy" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesPolishEditable bool + +const ( + ZoneSettingListResponseZonesPolishEditableTrue ZoneSettingListResponseZonesPolishEditable = true + ZoneSettingListResponseZonesPolishEditableFalse ZoneSettingListResponseZonesPolishEditable = false +) + +// Cloudflare will prefetch any URLs that are included in the response headers. +// This is limited to Enterprise Zones. +type ZoneSettingListResponseZonesPrefetchPreload struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesPrefetchPreloadID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesPrefetchPreloadValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesPrefetchPreloadEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesPrefetchPreloadJSON `json:"-"` +} + +// zoneSettingListResponseZonesPrefetchPreloadJSON contains the JSON metadata for +// the struct [ZoneSettingListResponseZonesPrefetchPreload] +type zoneSettingListResponseZonesPrefetchPreloadJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesPrefetchPreload) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesPrefetchPreload) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesPrefetchPreloadID string + +const ( + ZoneSettingListResponseZonesPrefetchPreloadIDPrefetchPreload ZoneSettingListResponseZonesPrefetchPreloadID = "prefetch_preload" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesPrefetchPreloadValue string + +const ( + ZoneSettingListResponseZonesPrefetchPreloadValueOn ZoneSettingListResponseZonesPrefetchPreloadValue = "on" + ZoneSettingListResponseZonesPrefetchPreloadValueOff ZoneSettingListResponseZonesPrefetchPreloadValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesPrefetchPreloadEditable bool + +const ( + ZoneSettingListResponseZonesPrefetchPreloadEditableTrue ZoneSettingListResponseZonesPrefetchPreloadEditable = true + ZoneSettingListResponseZonesPrefetchPreloadEditableFalse ZoneSettingListResponseZonesPrefetchPreloadEditable = false +) + +// Maximum time between two read operations from origin. +type ZoneSettingListResponseZonesProxyReadTimeout struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesProxyReadTimeoutID `json:"id,required"` + // Current value of the zone setting. + Value float64 `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesProxyReadTimeoutEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesProxyReadTimeoutJSON `json:"-"` +} + +// zoneSettingListResponseZonesProxyReadTimeoutJSON contains the JSON metadata for +// the struct [ZoneSettingListResponseZonesProxyReadTimeout] +type zoneSettingListResponseZonesProxyReadTimeoutJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesProxyReadTimeout) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesProxyReadTimeout) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesProxyReadTimeoutID string + +const ( + ZoneSettingListResponseZonesProxyReadTimeoutIDProxyReadTimeout ZoneSettingListResponseZonesProxyReadTimeoutID = "proxy_read_timeout" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesProxyReadTimeoutEditable bool + +const ( + ZoneSettingListResponseZonesProxyReadTimeoutEditableTrue ZoneSettingListResponseZonesProxyReadTimeoutEditable = true + ZoneSettingListResponseZonesProxyReadTimeoutEditableFalse ZoneSettingListResponseZonesProxyReadTimeoutEditable = false +) + +// The value set for the Pseudo IPv4 setting. +type ZoneSettingListResponseZonesPseudoIPV4 struct { + // Value of the Pseudo IPv4 setting. + ID ZoneSettingListResponseZonesPseudoIPV4ID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesPseudoIPV4Value `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesPseudoIPV4Editable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesPseudoIPV4JSON `json:"-"` +} + +// zoneSettingListResponseZonesPseudoIPV4JSON contains the JSON metadata for the +// struct [ZoneSettingListResponseZonesPseudoIPV4] +type zoneSettingListResponseZonesPseudoIPV4JSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesPseudoIPV4) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesPseudoIPV4) implementsZoneSettingListResponse() {} + +// Value of the Pseudo IPv4 setting. +type ZoneSettingListResponseZonesPseudoIPV4ID string + +const ( + ZoneSettingListResponseZonesPseudoIPV4IDPseudoIPV4 ZoneSettingListResponseZonesPseudoIPV4ID = "pseudo_ipv4" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesPseudoIPV4Value string + +const ( + ZoneSettingListResponseZonesPseudoIPV4ValueOff ZoneSettingListResponseZonesPseudoIPV4Value = "off" + ZoneSettingListResponseZonesPseudoIPV4ValueAddHeader ZoneSettingListResponseZonesPseudoIPV4Value = "add_header" + ZoneSettingListResponseZonesPseudoIPV4ValueOverwriteHeader ZoneSettingListResponseZonesPseudoIPV4Value = "overwrite_header" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesPseudoIPV4Editable bool + +const ( + ZoneSettingListResponseZonesPseudoIPV4EditableTrue ZoneSettingListResponseZonesPseudoIPV4Editable = true + ZoneSettingListResponseZonesPseudoIPV4EditableFalse ZoneSettingListResponseZonesPseudoIPV4Editable = false +) + +// Enables or disables buffering of responses from the proxied server. Cloudflare +// may buffer the whole payload to deliver it at once to the client versus allowing +// it to be delivered in chunks. By default, the proxied server streams directly +// and is not buffered by Cloudflare. This is limited to Enterprise Zones. +type ZoneSettingListResponseZonesResponseBuffering struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesResponseBufferingID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesResponseBufferingValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesResponseBufferingEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesResponseBufferingJSON `json:"-"` +} + +// zoneSettingListResponseZonesResponseBufferingJSON contains the JSON metadata for +// the struct [ZoneSettingListResponseZonesResponseBuffering] +type zoneSettingListResponseZonesResponseBufferingJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesResponseBuffering) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesResponseBuffering) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesResponseBufferingID string + +const ( + ZoneSettingListResponseZonesResponseBufferingIDResponseBuffering ZoneSettingListResponseZonesResponseBufferingID = "response_buffering" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesResponseBufferingValue string + +const ( + ZoneSettingListResponseZonesResponseBufferingValueOn ZoneSettingListResponseZonesResponseBufferingValue = "on" + ZoneSettingListResponseZonesResponseBufferingValueOff ZoneSettingListResponseZonesResponseBufferingValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesResponseBufferingEditable bool + +const ( + ZoneSettingListResponseZonesResponseBufferingEditableTrue ZoneSettingListResponseZonesResponseBufferingEditable = true + ZoneSettingListResponseZonesResponseBufferingEditableFalse ZoneSettingListResponseZonesResponseBufferingEditable = false +) + +// Rocket Loader is a general-purpose asynchronous JavaScript optimisation that +// prioritises rendering your content while loading your site's Javascript +// asynchronously. Turning on Rocket Loader will immediately improve a web page's +// rendering time sometimes measured as Time to First Paint (TTFP), and also the +// `window.onload` time (assuming there is JavaScript on the page). This can have a +// positive impact on your Google search ranking. When turned on, Rocket Loader +// will automatically defer the loading of all Javascript referenced in your HTML, +// with no configuration required. Refer to +// [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) +// for more information. +type ZoneSettingListResponseZonesRocketLoader struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesRocketLoaderID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesRocketLoaderValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesRocketLoaderEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesRocketLoaderJSON `json:"-"` +} + +// zoneSettingListResponseZonesRocketLoaderJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseZonesRocketLoader] +type zoneSettingListResponseZonesRocketLoaderJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesRocketLoader) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesRocketLoader) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesRocketLoaderID string + +const ( + ZoneSettingListResponseZonesRocketLoaderIDRocketLoader ZoneSettingListResponseZonesRocketLoaderID = "rocket_loader" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesRocketLoaderValue string + +const ( + ZoneSettingListResponseZonesRocketLoaderValueOn ZoneSettingListResponseZonesRocketLoaderValue = "on" + ZoneSettingListResponseZonesRocketLoaderValueOff ZoneSettingListResponseZonesRocketLoaderValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesRocketLoaderEditable bool + +const ( + ZoneSettingListResponseZonesRocketLoaderEditableTrue ZoneSettingListResponseZonesRocketLoaderEditable = true + ZoneSettingListResponseZonesRocketLoaderEditableFalse ZoneSettingListResponseZonesRocketLoaderEditable = false +) + +// [Automatic Platform Optimization for WordPress](https://developers.cloudflare.com/automatic-platform-optimization/) +// serves your WordPress site from Cloudflare's edge network and caches third-party +// fonts. +type ZoneSettingListResponseZonesSchemasAutomaticPlatformOptimization struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesSchemasAutomaticPlatformOptimizationID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesSchemasAutomaticPlatformOptimizationValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesSchemasAutomaticPlatformOptimizationEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesSchemasAutomaticPlatformOptimizationJSON `json:"-"` +} + +// zoneSettingListResponseZonesSchemasAutomaticPlatformOptimizationJSON contains +// the JSON metadata for the struct +// [ZoneSettingListResponseZonesSchemasAutomaticPlatformOptimization] +type zoneSettingListResponseZonesSchemasAutomaticPlatformOptimizationJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesSchemasAutomaticPlatformOptimization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesSchemasAutomaticPlatformOptimization) implementsZoneSettingListResponse() { +} + +// ID of the zone setting. +type ZoneSettingListResponseZonesSchemasAutomaticPlatformOptimizationID string + +const ( + ZoneSettingListResponseZonesSchemasAutomaticPlatformOptimizationIDAutomaticPlatformOptimization ZoneSettingListResponseZonesSchemasAutomaticPlatformOptimizationID = "automatic_platform_optimization" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesSchemasAutomaticPlatformOptimizationValue struct { + // Indicates whether or not + // [cache by device type](https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/) + // is enabled. + CacheByDeviceType bool `json:"cache_by_device_type,required"` + // Indicates whether or not Cloudflare proxy is enabled. + Cf bool `json:"cf,required"` + // Indicates whether or not Automatic Platform Optimization is enabled. + Enabled bool `json:"enabled,required"` + // An array of hostnames where Automatic Platform Optimization for WordPress is + // activated. + Hostnames []string `json:"hostnames,required" format:"hostname"` + // Indicates whether or not site is powered by WordPress. + Wordpress bool `json:"wordpress,required"` + // Indicates whether or not + // [Cloudflare for WordPress plugin](https://wordpress.org/plugins/cloudflare/) is + // installed. + WpPlugin bool `json:"wp_plugin,required"` + JSON zoneSettingListResponseZonesSchemasAutomaticPlatformOptimizationValueJSON `json:"-"` +} + +// zoneSettingListResponseZonesSchemasAutomaticPlatformOptimizationValueJSON +// contains the JSON metadata for the struct +// [ZoneSettingListResponseZonesSchemasAutomaticPlatformOptimizationValue] +type zoneSettingListResponseZonesSchemasAutomaticPlatformOptimizationValueJSON struct { + CacheByDeviceType apijson.Field + Cf apijson.Field + Enabled apijson.Field + Hostnames apijson.Field + Wordpress apijson.Field + WpPlugin apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesSchemasAutomaticPlatformOptimizationValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesSchemasAutomaticPlatformOptimizationEditable bool + +const ( + ZoneSettingListResponseZonesSchemasAutomaticPlatformOptimizationEditableTrue ZoneSettingListResponseZonesSchemasAutomaticPlatformOptimizationEditable = true + ZoneSettingListResponseZonesSchemasAutomaticPlatformOptimizationEditableFalse ZoneSettingListResponseZonesSchemasAutomaticPlatformOptimizationEditable = false +) + +// Cloudflare security header for a zone. +type ZoneSettingListResponseZonesSecurityHeader struct { + // ID of the zone's security header. + ID ZoneSettingListResponseZonesSecurityHeaderID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesSecurityHeaderValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesSecurityHeaderEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesSecurityHeaderJSON `json:"-"` +} + +// zoneSettingListResponseZonesSecurityHeaderJSON contains the JSON metadata for +// the struct [ZoneSettingListResponseZonesSecurityHeader] +type zoneSettingListResponseZonesSecurityHeaderJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesSecurityHeader) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesSecurityHeader) implementsZoneSettingListResponse() {} + +// ID of the zone's security header. +type ZoneSettingListResponseZonesSecurityHeaderID string + +const ( + ZoneSettingListResponseZonesSecurityHeaderIDSecurityHeader ZoneSettingListResponseZonesSecurityHeaderID = "security_header" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesSecurityHeaderValue struct { + // Strict Transport Security. + StrictTransportSecurity ZoneSettingListResponseZonesSecurityHeaderValueStrictTransportSecurity `json:"strict_transport_security"` + JSON zoneSettingListResponseZonesSecurityHeaderValueJSON `json:"-"` +} + +// zoneSettingListResponseZonesSecurityHeaderValueJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseZonesSecurityHeaderValue] +type zoneSettingListResponseZonesSecurityHeaderValueJSON struct { + StrictTransportSecurity apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesSecurityHeaderValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Strict Transport Security. +type ZoneSettingListResponseZonesSecurityHeaderValueStrictTransportSecurity struct { + // Whether or not strict transport security is enabled. + Enabled bool `json:"enabled"` + // Include all subdomains for strict transport security. + IncludeSubdomains bool `json:"include_subdomains"` + // Max age in seconds of the strict transport security. + MaxAge float64 `json:"max_age"` + // Whether or not to include 'X-Content-Type-Options: nosniff' header. + Nosniff bool `json:"nosniff"` + JSON zoneSettingListResponseZonesSecurityHeaderValueStrictTransportSecurityJSON `json:"-"` +} + +// zoneSettingListResponseZonesSecurityHeaderValueStrictTransportSecurityJSON +// contains the JSON metadata for the struct +// [ZoneSettingListResponseZonesSecurityHeaderValueStrictTransportSecurity] +type zoneSettingListResponseZonesSecurityHeaderValueStrictTransportSecurityJSON struct { + Enabled apijson.Field + IncludeSubdomains apijson.Field + MaxAge apijson.Field + Nosniff apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesSecurityHeaderValueStrictTransportSecurity) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesSecurityHeaderEditable bool + +const ( + ZoneSettingListResponseZonesSecurityHeaderEditableTrue ZoneSettingListResponseZonesSecurityHeaderEditable = true + ZoneSettingListResponseZonesSecurityHeaderEditableFalse ZoneSettingListResponseZonesSecurityHeaderEditable = false +) + +// Choose the appropriate security profile for your website, which will +// automatically adjust each of the security settings. If you choose to customize +// an individual security setting, the profile will become Custom. +// (https://support.cloudflare.com/hc/en-us/articles/200170056). +type ZoneSettingListResponseZonesSecurityLevel struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesSecurityLevelID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesSecurityLevelValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesSecurityLevelEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesSecurityLevelJSON `json:"-"` +} + +// zoneSettingListResponseZonesSecurityLevelJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseZonesSecurityLevel] +type zoneSettingListResponseZonesSecurityLevelJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesSecurityLevel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesSecurityLevel) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesSecurityLevelID string + +const ( + ZoneSettingListResponseZonesSecurityLevelIDSecurityLevel ZoneSettingListResponseZonesSecurityLevelID = "security_level" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesSecurityLevelValue string + +const ( + ZoneSettingListResponseZonesSecurityLevelValueOff ZoneSettingListResponseZonesSecurityLevelValue = "off" + ZoneSettingListResponseZonesSecurityLevelValueEssentiallyOff ZoneSettingListResponseZonesSecurityLevelValue = "essentially_off" + ZoneSettingListResponseZonesSecurityLevelValueLow ZoneSettingListResponseZonesSecurityLevelValue = "low" + ZoneSettingListResponseZonesSecurityLevelValueMedium ZoneSettingListResponseZonesSecurityLevelValue = "medium" + ZoneSettingListResponseZonesSecurityLevelValueHigh ZoneSettingListResponseZonesSecurityLevelValue = "high" + ZoneSettingListResponseZonesSecurityLevelValueUnderAttack ZoneSettingListResponseZonesSecurityLevelValue = "under_attack" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesSecurityLevelEditable bool + +const ( + ZoneSettingListResponseZonesSecurityLevelEditableTrue ZoneSettingListResponseZonesSecurityLevelEditable = true + ZoneSettingListResponseZonesSecurityLevelEditableFalse ZoneSettingListResponseZonesSecurityLevelEditable = false +) + +// If there is sensitive content on your website that you want visible to real +// visitors, but that you want to hide from suspicious visitors, all you have to do +// is wrap the content with Cloudflare SSE tags. Wrap any content that you want to +// be excluded from suspicious visitors in the following SSE tags: +// . For example: Bad visitors won't see my phone +// number, 555-555-5555 . Note: SSE only will work with HTML. If you +// have HTML minification enabled, you won't see the SSE tags in your HTML source +// when it's served through Cloudflare. SSE will still function in this case, as +// Cloudflare's HTML minification and SSE functionality occur on-the-fly as the +// resource moves through our network to the visitor's computer. +// (https://support.cloudflare.com/hc/en-us/articles/200170036). +type ZoneSettingListResponseZonesServerSideExclude struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesServerSideExcludeID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesServerSideExcludeValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesServerSideExcludeEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesServerSideExcludeJSON `json:"-"` +} + +// zoneSettingListResponseZonesServerSideExcludeJSON contains the JSON metadata for +// the struct [ZoneSettingListResponseZonesServerSideExclude] +type zoneSettingListResponseZonesServerSideExcludeJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesServerSideExclude) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesServerSideExclude) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesServerSideExcludeID string + +const ( + ZoneSettingListResponseZonesServerSideExcludeIDServerSideExclude ZoneSettingListResponseZonesServerSideExcludeID = "server_side_exclude" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesServerSideExcludeValue string + +const ( + ZoneSettingListResponseZonesServerSideExcludeValueOn ZoneSettingListResponseZonesServerSideExcludeValue = "on" + ZoneSettingListResponseZonesServerSideExcludeValueOff ZoneSettingListResponseZonesServerSideExcludeValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesServerSideExcludeEditable bool + +const ( + ZoneSettingListResponseZonesServerSideExcludeEditableTrue ZoneSettingListResponseZonesServerSideExcludeEditable = true + ZoneSettingListResponseZonesServerSideExcludeEditableFalse ZoneSettingListResponseZonesServerSideExcludeEditable = false +) + +// Allow SHA1 support. +type ZoneSettingListResponseZonesSha1Support struct { + // Zone setting identifier. + ID ZoneSettingListResponseZonesSha1SupportID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesSha1SupportValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesSha1SupportEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesSha1SupportJSON `json:"-"` +} + +// zoneSettingListResponseZonesSha1SupportJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseZonesSha1Support] +type zoneSettingListResponseZonesSha1SupportJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesSha1Support) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesSha1Support) implementsZoneSettingListResponse() {} + +// Zone setting identifier. +type ZoneSettingListResponseZonesSha1SupportID string + +const ( + ZoneSettingListResponseZonesSha1SupportIDSha1Support ZoneSettingListResponseZonesSha1SupportID = "sha1_support" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesSha1SupportValue string + +const ( + ZoneSettingListResponseZonesSha1SupportValueOff ZoneSettingListResponseZonesSha1SupportValue = "off" + ZoneSettingListResponseZonesSha1SupportValueOn ZoneSettingListResponseZonesSha1SupportValue = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesSha1SupportEditable bool + +const ( + ZoneSettingListResponseZonesSha1SupportEditableTrue ZoneSettingListResponseZonesSha1SupportEditable = true + ZoneSettingListResponseZonesSha1SupportEditableFalse ZoneSettingListResponseZonesSha1SupportEditable = false +) + +// Cloudflare will treat files with the same query strings as the same file in +// cache, regardless of the order of the query strings. This is limited to +// Enterprise Zones. +type ZoneSettingListResponseZonesSortQueryStringForCache struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesSortQueryStringForCacheID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesSortQueryStringForCacheValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesSortQueryStringForCacheEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesSortQueryStringForCacheJSON `json:"-"` +} + +// zoneSettingListResponseZonesSortQueryStringForCacheJSON contains the JSON +// metadata for the struct [ZoneSettingListResponseZonesSortQueryStringForCache] +type zoneSettingListResponseZonesSortQueryStringForCacheJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesSortQueryStringForCache) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesSortQueryStringForCache) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesSortQueryStringForCacheID string + +const ( + ZoneSettingListResponseZonesSortQueryStringForCacheIDSortQueryStringForCache ZoneSettingListResponseZonesSortQueryStringForCacheID = "sort_query_string_for_cache" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesSortQueryStringForCacheValue string + +const ( + ZoneSettingListResponseZonesSortQueryStringForCacheValueOn ZoneSettingListResponseZonesSortQueryStringForCacheValue = "on" + ZoneSettingListResponseZonesSortQueryStringForCacheValueOff ZoneSettingListResponseZonesSortQueryStringForCacheValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesSortQueryStringForCacheEditable bool + +const ( + ZoneSettingListResponseZonesSortQueryStringForCacheEditableTrue ZoneSettingListResponseZonesSortQueryStringForCacheEditable = true + ZoneSettingListResponseZonesSortQueryStringForCacheEditableFalse ZoneSettingListResponseZonesSortQueryStringForCacheEditable = false +) + +// SSL encrypts your visitor's connection and safeguards credit card numbers and +// other personal data to and from your website. SSL can take up to 5 minutes to +// fully activate. Requires Cloudflare active on your root domain or www domain. +// Off: no SSL between the visitor and Cloudflare, and no SSL between Cloudflare +// and your web server (all HTTP traffic). Flexible: SSL between the visitor and +// Cloudflare -- visitor sees HTTPS on your site, but no SSL between Cloudflare and +// your web server. You don't need to have an SSL cert on your web server, but your +// vistors will still see the site as being HTTPS enabled. Full: SSL between the +// visitor and Cloudflare -- visitor sees HTTPS on your site, and SSL between +// Cloudflare and your web server. You'll need to have your own SSL cert or +// self-signed cert at the very least. Full (Strict): SSL between the visitor and +// Cloudflare -- visitor sees HTTPS on your site, and SSL between Cloudflare and +// your web server. You'll need to have a valid SSL certificate installed on your +// web server. This certificate must be signed by a certificate authority, have an +// expiration date in the future, and respond for the request domain name +// (hostname). (https://support.cloudflare.com/hc/en-us/articles/200170416). +type ZoneSettingListResponseZonesSSL struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesSSLID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesSSLValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesSSLEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesSSLJSON `json:"-"` +} + +// zoneSettingListResponseZonesSSLJSON contains the JSON metadata for the struct +// [ZoneSettingListResponseZonesSSL] +type zoneSettingListResponseZonesSSLJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesSSL) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesSSL) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesSSLID string + +const ( + ZoneSettingListResponseZonesSSLIDSSL ZoneSettingListResponseZonesSSLID = "ssl" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesSSLValue string + +const ( + ZoneSettingListResponseZonesSSLValueOff ZoneSettingListResponseZonesSSLValue = "off" + ZoneSettingListResponseZonesSSLValueFlexible ZoneSettingListResponseZonesSSLValue = "flexible" + ZoneSettingListResponseZonesSSLValueFull ZoneSettingListResponseZonesSSLValue = "full" + ZoneSettingListResponseZonesSSLValueStrict ZoneSettingListResponseZonesSSLValue = "strict" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesSSLEditable bool + +const ( + ZoneSettingListResponseZonesSSLEditableTrue ZoneSettingListResponseZonesSSLEditable = true + ZoneSettingListResponseZonesSSLEditableFalse ZoneSettingListResponseZonesSSLEditable = false +) + +// Enrollment in the SSL/TLS Recommender service which tries to detect and +// recommend (by sending periodic emails) the most secure SSL/TLS setting your +// origin servers support. +type ZoneSettingListResponseZonesSSLRecommender struct { + // Enrollment value for SSL/TLS Recommender. + ID ZoneSettingListResponseZonesSSLRecommenderID `json:"id"` + // ssl-recommender enrollment setting. + Enabled bool `json:"enabled"` + JSON zoneSettingListResponseZonesSSLRecommenderJSON `json:"-"` +} + +// zoneSettingListResponseZonesSSLRecommenderJSON contains the JSON metadata for +// the struct [ZoneSettingListResponseZonesSSLRecommender] +type zoneSettingListResponseZonesSSLRecommenderJSON struct { + ID apijson.Field + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesSSLRecommender) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesSSLRecommender) implementsZoneSettingListResponse() {} + +// Enrollment value for SSL/TLS Recommender. +type ZoneSettingListResponseZonesSSLRecommenderID string + +const ( + ZoneSettingListResponseZonesSSLRecommenderIDSSLRecommender ZoneSettingListResponseZonesSSLRecommenderID = "ssl_recommender" +) + +// Only allows TLS1.2. +type ZoneSettingListResponseZonesTLS1_2Only struct { + // Zone setting identifier. + ID ZoneSettingListResponseZonesTLS1_2OnlyID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesTLS1_2OnlyValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesTLS1_2OnlyEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesTls1_2OnlyJSON `json:"-"` +} + +// zoneSettingListResponseZonesTls1_2OnlyJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseZonesTLS1_2Only] +type zoneSettingListResponseZonesTls1_2OnlyJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesTLS1_2Only) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesTLS1_2Only) implementsZoneSettingListResponse() {} + +// Zone setting identifier. +type ZoneSettingListResponseZonesTLS1_2OnlyID string + +const ( + ZoneSettingListResponseZonesTLS1_2OnlyIDTLS1_2Only ZoneSettingListResponseZonesTLS1_2OnlyID = "tls_1_2_only" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesTLS1_2OnlyValue string + +const ( + ZoneSettingListResponseZonesTLS1_2OnlyValueOff ZoneSettingListResponseZonesTLS1_2OnlyValue = "off" + ZoneSettingListResponseZonesTLS1_2OnlyValueOn ZoneSettingListResponseZonesTLS1_2OnlyValue = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesTLS1_2OnlyEditable bool + +const ( + ZoneSettingListResponseZonesTLS1_2OnlyEditableTrue ZoneSettingListResponseZonesTLS1_2OnlyEditable = true + ZoneSettingListResponseZonesTLS1_2OnlyEditableFalse ZoneSettingListResponseZonesTLS1_2OnlyEditable = false +) + +// Enables Crypto TLS 1.3 feature for a zone. +type ZoneSettingListResponseZonesTLS1_3 struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesTLS1_3ID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesTLS1_3Value `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesTLS1_3Editable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesTls1_3JSON `json:"-"` +} + +// zoneSettingListResponseZonesTls1_3JSON contains the JSON metadata for the struct +// [ZoneSettingListResponseZonesTLS1_3] +type zoneSettingListResponseZonesTls1_3JSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesTLS1_3) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesTLS1_3) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesTLS1_3ID string + +const ( + ZoneSettingListResponseZonesTLS1_3IDTLS1_3 ZoneSettingListResponseZonesTLS1_3ID = "tls_1_3" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesTLS1_3Value string + +const ( + ZoneSettingListResponseZonesTLS1_3ValueOn ZoneSettingListResponseZonesTLS1_3Value = "on" + ZoneSettingListResponseZonesTLS1_3ValueOff ZoneSettingListResponseZonesTLS1_3Value = "off" + ZoneSettingListResponseZonesTLS1_3ValueZrt ZoneSettingListResponseZonesTLS1_3Value = "zrt" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesTLS1_3Editable bool + +const ( + ZoneSettingListResponseZonesTLS1_3EditableTrue ZoneSettingListResponseZonesTLS1_3Editable = true + ZoneSettingListResponseZonesTLS1_3EditableFalse ZoneSettingListResponseZonesTLS1_3Editable = false +) + +// TLS Client Auth requires Cloudflare to connect to your origin server using a +// client certificate (Enterprise Only). +type ZoneSettingListResponseZonesTLSClientAuth struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesTLSClientAuthID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesTLSClientAuthValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesTLSClientAuthEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesTLSClientAuthJSON `json:"-"` +} + +// zoneSettingListResponseZonesTLSClientAuthJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseZonesTLSClientAuth] +type zoneSettingListResponseZonesTLSClientAuthJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesTLSClientAuth) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesTLSClientAuth) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesTLSClientAuthID string + +const ( + ZoneSettingListResponseZonesTLSClientAuthIDTLSClientAuth ZoneSettingListResponseZonesTLSClientAuthID = "tls_client_auth" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesTLSClientAuthValue string + +const ( + ZoneSettingListResponseZonesTLSClientAuthValueOn ZoneSettingListResponseZonesTLSClientAuthValue = "on" + ZoneSettingListResponseZonesTLSClientAuthValueOff ZoneSettingListResponseZonesTLSClientAuthValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesTLSClientAuthEditable bool + +const ( + ZoneSettingListResponseZonesTLSClientAuthEditableTrue ZoneSettingListResponseZonesTLSClientAuthEditable = true + ZoneSettingListResponseZonesTLSClientAuthEditableFalse ZoneSettingListResponseZonesTLSClientAuthEditable = false +) + +// Allows customer to continue to use True Client IP (Akamai feature) in the +// headers we send to the origin. This is limited to Enterprise Zones. +type ZoneSettingListResponseZonesTrueClientIPHeader struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesTrueClientIPHeaderID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesTrueClientIPHeaderValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesTrueClientIPHeaderEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesTrueClientIPHeaderJSON `json:"-"` +} + +// zoneSettingListResponseZonesTrueClientIPHeaderJSON contains the JSON metadata +// for the struct [ZoneSettingListResponseZonesTrueClientIPHeader] +type zoneSettingListResponseZonesTrueClientIPHeaderJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesTrueClientIPHeader) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesTrueClientIPHeader) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesTrueClientIPHeaderID string + +const ( + ZoneSettingListResponseZonesTrueClientIPHeaderIDTrueClientIPHeader ZoneSettingListResponseZonesTrueClientIPHeaderID = "true_client_ip_header" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesTrueClientIPHeaderValue string + +const ( + ZoneSettingListResponseZonesTrueClientIPHeaderValueOn ZoneSettingListResponseZonesTrueClientIPHeaderValue = "on" + ZoneSettingListResponseZonesTrueClientIPHeaderValueOff ZoneSettingListResponseZonesTrueClientIPHeaderValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesTrueClientIPHeaderEditable bool + +const ( + ZoneSettingListResponseZonesTrueClientIPHeaderEditableTrue ZoneSettingListResponseZonesTrueClientIPHeaderEditable = true + ZoneSettingListResponseZonesTrueClientIPHeaderEditableFalse ZoneSettingListResponseZonesTrueClientIPHeaderEditable = false +) + +// The WAF examines HTTP requests to your website. It inspects both GET and POST +// requests and applies rules to help filter out illegitimate traffic from +// legitimate website visitors. The Cloudflare WAF inspects website addresses or +// URLs to detect anything out of the ordinary. If the Cloudflare WAF determines +// suspicious user behavior, then the WAF will 'challenge' the web visitor with a +// page that asks them to submit a CAPTCHA successfully to continue their action. +// If the challenge is failed, the action will be stopped. What this means is that +// Cloudflare's WAF will block any traffic identified as illegitimate before it +// reaches your origin web server. +// (https://support.cloudflare.com/hc/en-us/articles/200172016). +type ZoneSettingListResponseZonesWAF struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesWAFID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesWAFValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesWAFEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesWAFJSON `json:"-"` +} + +// zoneSettingListResponseZonesWAFJSON contains the JSON metadata for the struct +// [ZoneSettingListResponseZonesWAF] +type zoneSettingListResponseZonesWAFJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesWAF) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesWAF) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesWAFID string + +const ( + ZoneSettingListResponseZonesWAFIDWAF ZoneSettingListResponseZonesWAFID = "waf" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesWAFValue string + +const ( + ZoneSettingListResponseZonesWAFValueOn ZoneSettingListResponseZonesWAFValue = "on" + ZoneSettingListResponseZonesWAFValueOff ZoneSettingListResponseZonesWAFValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesWAFEditable bool + +const ( + ZoneSettingListResponseZonesWAFEditableTrue ZoneSettingListResponseZonesWAFEditable = true + ZoneSettingListResponseZonesWAFEditableFalse ZoneSettingListResponseZonesWAFEditable = false +) + +// When the client requesting the image supports the WebP image codec, and WebP +// offers a performance advantage over the original image format, Cloudflare will +// serve a WebP version of the original image. +type ZoneSettingListResponseZonesWebp struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesWebpID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesWebpValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesWebpEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesWebpJSON `json:"-"` +} + +// zoneSettingListResponseZonesWebpJSON contains the JSON metadata for the struct +// [ZoneSettingListResponseZonesWebp] +type zoneSettingListResponseZonesWebpJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesWebp) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesWebp) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesWebpID string + +const ( + ZoneSettingListResponseZonesWebpIDWebp ZoneSettingListResponseZonesWebpID = "webp" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesWebpValue string + +const ( + ZoneSettingListResponseZonesWebpValueOff ZoneSettingListResponseZonesWebpValue = "off" + ZoneSettingListResponseZonesWebpValueOn ZoneSettingListResponseZonesWebpValue = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesWebpEditable bool + +const ( + ZoneSettingListResponseZonesWebpEditableTrue ZoneSettingListResponseZonesWebpEditable = true + ZoneSettingListResponseZonesWebpEditableFalse ZoneSettingListResponseZonesWebpEditable = false +) + +// WebSockets are open connections sustained between the client and the origin +// server. Inside a WebSockets connection, the client and the origin can pass data +// back and forth without having to reestablish sessions. This makes exchanging +// data within a WebSockets connection fast. WebSockets are often used for +// real-time applications such as live chat and gaming. For more information refer +// to +// [Can I use Cloudflare with Websockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Can-I-use-Cloudflare-with-WebSockets-). +type ZoneSettingListResponseZonesWebsockets struct { + // ID of the zone setting. + ID ZoneSettingListResponseZonesWebsocketsID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingListResponseZonesWebsocketsValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingListResponseZonesWebsocketsEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingListResponseZonesWebsocketsJSON `json:"-"` +} + +// zoneSettingListResponseZonesWebsocketsJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseZonesWebsockets] +type zoneSettingListResponseZonesWebsocketsJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseZonesWebsockets) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingListResponseZonesWebsockets) implementsZoneSettingListResponse() {} + +// ID of the zone setting. +type ZoneSettingListResponseZonesWebsocketsID string + +const ( + ZoneSettingListResponseZonesWebsocketsIDWebsockets ZoneSettingListResponseZonesWebsocketsID = "websockets" +) + +// Current value of the zone setting. +type ZoneSettingListResponseZonesWebsocketsValue string + +const ( + ZoneSettingListResponseZonesWebsocketsValueOff ZoneSettingListResponseZonesWebsocketsValue = "off" + ZoneSettingListResponseZonesWebsocketsValueOn ZoneSettingListResponseZonesWebsocketsValue = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingListResponseZonesWebsocketsEditable bool + +const ( + ZoneSettingListResponseZonesWebsocketsEditableTrue ZoneSettingListResponseZonesWebsocketsEditable = true + ZoneSettingListResponseZonesWebsocketsEditableFalse ZoneSettingListResponseZonesWebsocketsEditable = false +) + +// 0-RTT session resumption enabled for this zone. +// +// Union satisfied by [ZoneSettingEditResponseZones0rtt], +// [ZoneSettingEditResponseZonesAdvancedDDOS], +// [ZoneSettingEditResponseZonesAlwaysOnline], +// [ZoneSettingEditResponseZonesAlwaysUseHTTPS], +// [ZoneSettingEditResponseZonesAutomaticHTTPSRewrites], +// [ZoneSettingEditResponseZonesBrotli], +// [ZoneSettingEditResponseZonesBrowserCacheTTL], +// [ZoneSettingEditResponseZonesBrowserCheck], +// [ZoneSettingEditResponseZonesCacheLevel], +// [ZoneSettingEditResponseZonesChallengeTTL], +// [ZoneSettingEditResponseZonesCiphers], +// [ZoneSettingEditResponseZonesCnameFlattening], +// [ZoneSettingEditResponseZonesDevelopmentMode], +// [ZoneSettingEditResponseZonesEarlyHints], +// [ZoneSettingEditResponseZonesEdgeCacheTTL], +// [ZoneSettingEditResponseZonesEmailObfuscation], +// [ZoneSettingEditResponseZonesH2Prioritization], +// [ZoneSettingEditResponseZonesHotlinkProtection], +// [ZoneSettingEditResponseZonesHTTP2], [ZoneSettingEditResponseZonesHTTP3], +// [ZoneSettingEditResponseZonesImageResizing], +// [ZoneSettingEditResponseZonesIPGeolocation], [ZoneSettingEditResponseZonesIPV6], +// [ZoneSettingEditResponseZonesMaxUpload], +// [ZoneSettingEditResponseZonesMinTLSVersion], +// [ZoneSettingEditResponseZonesMinify], [ZoneSettingEditResponseZonesMirage], +// [ZoneSettingEditResponseZonesMobileRedirect], [ZoneSettingEditResponseZonesNEL], +// [ZoneSettingEditResponseZonesOpportunisticEncryption], +// [ZoneSettingEditResponseZonesOpportunisticOnion], +// [ZoneSettingEditResponseZonesOrangeToOrange], +// [ZoneSettingEditResponseZonesOriginErrorPagePassThru], +// [ZoneSettingEditResponseZonesPolish], +// [ZoneSettingEditResponseZonesPrefetchPreload], +// [ZoneSettingEditResponseZonesProxyReadTimeout], +// [ZoneSettingEditResponseZonesPseudoIPV4], +// [ZoneSettingEditResponseZonesResponseBuffering], +// [ZoneSettingEditResponseZonesRocketLoader], +// [ZoneSettingEditResponseZonesSchemasAutomaticPlatformOptimization], +// [ZoneSettingEditResponseZonesSecurityHeader], +// [ZoneSettingEditResponseZonesSecurityLevel], +// [ZoneSettingEditResponseZonesServerSideExclude], +// [ZoneSettingEditResponseZonesSha1Support], +// [ZoneSettingEditResponseZonesSortQueryStringForCache], +// [ZoneSettingEditResponseZonesSSL], [ZoneSettingEditResponseZonesSSLRecommender], +// [ZoneSettingEditResponseZonesTLS1_2Only], [ZoneSettingEditResponseZonesTLS1_3], +// [ZoneSettingEditResponseZonesTLSClientAuth], +// [ZoneSettingEditResponseZonesTrueClientIPHeader], +// [ZoneSettingEditResponseZonesWAF], [ZoneSettingEditResponseZonesWebp] or +// [ZoneSettingEditResponseZonesWebsockets]. +type ZoneSettingEditResponse interface { + implementsZoneSettingEditResponse() +} + +func init() { + apijson.RegisterUnion(reflect.TypeOf((*ZoneSettingEditResponse)(nil)).Elem(), "") +} + +// 0-RTT session resumption enabled for this zone. +type ZoneSettingEditResponseZones0rtt struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZones0rttID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZones0rttValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZones0rttEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZones0rttJSON `json:"-"` +} + +// zoneSettingEditResponseZones0rttJSON contains the JSON metadata for the struct +// [ZoneSettingEditResponseZones0rtt] +type zoneSettingEditResponseZones0rttJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZones0rtt) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZones0rtt) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZones0rttID string + +const ( + ZoneSettingEditResponseZones0rttID0rtt ZoneSettingEditResponseZones0rttID = "0rtt" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZones0rttValue string + +const ( + ZoneSettingEditResponseZones0rttValueOn ZoneSettingEditResponseZones0rttValue = "on" + ZoneSettingEditResponseZones0rttValueOff ZoneSettingEditResponseZones0rttValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZones0rttEditable bool + +const ( + ZoneSettingEditResponseZones0rttEditableTrue ZoneSettingEditResponseZones0rttEditable = true + ZoneSettingEditResponseZones0rttEditableFalse ZoneSettingEditResponseZones0rttEditable = false +) + +// Advanced protection from Distributed Denial of Service (DDoS) attacks on your +// website. This is an uneditable value that is 'on' in the case of Business and +// Enterprise zones. +type ZoneSettingEditResponseZonesAdvancedDDOS struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesAdvancedDDOSID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesAdvancedDDOSValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesAdvancedDDOSEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesAdvancedDDOSJSON `json:"-"` +} + +// zoneSettingEditResponseZonesAdvancedDDOSJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseZonesAdvancedDDOS] +type zoneSettingEditResponseZonesAdvancedDDOSJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesAdvancedDDOS) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesAdvancedDDOS) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesAdvancedDDOSID string + +const ( + ZoneSettingEditResponseZonesAdvancedDDOSIDAdvancedDDOS ZoneSettingEditResponseZonesAdvancedDDOSID = "advanced_ddos" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesAdvancedDDOSValue string + +const ( + ZoneSettingEditResponseZonesAdvancedDDOSValueOn ZoneSettingEditResponseZonesAdvancedDDOSValue = "on" + ZoneSettingEditResponseZonesAdvancedDDOSValueOff ZoneSettingEditResponseZonesAdvancedDDOSValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesAdvancedDDOSEditable bool + +const ( + ZoneSettingEditResponseZonesAdvancedDDOSEditableTrue ZoneSettingEditResponseZonesAdvancedDDOSEditable = true + ZoneSettingEditResponseZonesAdvancedDDOSEditableFalse ZoneSettingEditResponseZonesAdvancedDDOSEditable = false +) + +// When enabled, Cloudflare serves limited copies of web pages available from the +// [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is +// offline. Refer to +// [Always Online](https://developers.cloudflare.com/cache/about/always-online) for +// more information. +type ZoneSettingEditResponseZonesAlwaysOnline struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesAlwaysOnlineID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesAlwaysOnlineValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesAlwaysOnlineEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesAlwaysOnlineJSON `json:"-"` +} + +// zoneSettingEditResponseZonesAlwaysOnlineJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseZonesAlwaysOnline] +type zoneSettingEditResponseZonesAlwaysOnlineJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesAlwaysOnline) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesAlwaysOnline) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesAlwaysOnlineID string + +const ( + ZoneSettingEditResponseZonesAlwaysOnlineIDAlwaysOnline ZoneSettingEditResponseZonesAlwaysOnlineID = "always_online" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesAlwaysOnlineValue string + +const ( + ZoneSettingEditResponseZonesAlwaysOnlineValueOn ZoneSettingEditResponseZonesAlwaysOnlineValue = "on" + ZoneSettingEditResponseZonesAlwaysOnlineValueOff ZoneSettingEditResponseZonesAlwaysOnlineValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesAlwaysOnlineEditable bool + +const ( + ZoneSettingEditResponseZonesAlwaysOnlineEditableTrue ZoneSettingEditResponseZonesAlwaysOnlineEditable = true + ZoneSettingEditResponseZonesAlwaysOnlineEditableFalse ZoneSettingEditResponseZonesAlwaysOnlineEditable = false +) + +// Reply to all requests for URLs that use "http" with a 301 redirect to the +// equivalent "https" URL. If you only want to redirect for a subset of requests, +// consider creating an "Always use HTTPS" page rule. +type ZoneSettingEditResponseZonesAlwaysUseHTTPS struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesAlwaysUseHTTPSID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesAlwaysUseHTTPSValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesAlwaysUseHTTPSEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesAlwaysUseHTTPSJSON `json:"-"` +} + +// zoneSettingEditResponseZonesAlwaysUseHTTPSJSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseZonesAlwaysUseHTTPS] +type zoneSettingEditResponseZonesAlwaysUseHTTPSJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesAlwaysUseHTTPS) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesAlwaysUseHTTPS) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesAlwaysUseHTTPSID string + +const ( + ZoneSettingEditResponseZonesAlwaysUseHTTPSIDAlwaysUseHTTPS ZoneSettingEditResponseZonesAlwaysUseHTTPSID = "always_use_https" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesAlwaysUseHTTPSValue string + +const ( + ZoneSettingEditResponseZonesAlwaysUseHTTPSValueOn ZoneSettingEditResponseZonesAlwaysUseHTTPSValue = "on" + ZoneSettingEditResponseZonesAlwaysUseHTTPSValueOff ZoneSettingEditResponseZonesAlwaysUseHTTPSValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesAlwaysUseHTTPSEditable bool + +const ( + ZoneSettingEditResponseZonesAlwaysUseHTTPSEditableTrue ZoneSettingEditResponseZonesAlwaysUseHTTPSEditable = true + ZoneSettingEditResponseZonesAlwaysUseHTTPSEditableFalse ZoneSettingEditResponseZonesAlwaysUseHTTPSEditable = false +) + +// Enable the Automatic HTTPS Rewrites feature for this zone. +type ZoneSettingEditResponseZonesAutomaticHTTPSRewrites struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesAutomaticHTTPSRewritesID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesAutomaticHTTPSRewritesValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesAutomaticHTTPSRewritesEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesAutomaticHTTPSRewritesJSON `json:"-"` +} + +// zoneSettingEditResponseZonesAutomaticHTTPSRewritesJSON contains the JSON +// metadata for the struct [ZoneSettingEditResponseZonesAutomaticHTTPSRewrites] +type zoneSettingEditResponseZonesAutomaticHTTPSRewritesJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesAutomaticHTTPSRewrites) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesAutomaticHTTPSRewrites) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesAutomaticHTTPSRewritesID string + +const ( + ZoneSettingEditResponseZonesAutomaticHTTPSRewritesIDAutomaticHTTPSRewrites ZoneSettingEditResponseZonesAutomaticHTTPSRewritesID = "automatic_https_rewrites" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesAutomaticHTTPSRewritesValue string + +const ( + ZoneSettingEditResponseZonesAutomaticHTTPSRewritesValueOn ZoneSettingEditResponseZonesAutomaticHTTPSRewritesValue = "on" + ZoneSettingEditResponseZonesAutomaticHTTPSRewritesValueOff ZoneSettingEditResponseZonesAutomaticHTTPSRewritesValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesAutomaticHTTPSRewritesEditable bool + +const ( + ZoneSettingEditResponseZonesAutomaticHTTPSRewritesEditableTrue ZoneSettingEditResponseZonesAutomaticHTTPSRewritesEditable = true + ZoneSettingEditResponseZonesAutomaticHTTPSRewritesEditableFalse ZoneSettingEditResponseZonesAutomaticHTTPSRewritesEditable = false +) + +// When the client requesting an asset supports the Brotli compression algorithm, +// Cloudflare will serve a Brotli compressed version of the asset. +type ZoneSettingEditResponseZonesBrotli struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesBrotliID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesBrotliValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesBrotliEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesBrotliJSON `json:"-"` +} + +// zoneSettingEditResponseZonesBrotliJSON contains the JSON metadata for the struct +// [ZoneSettingEditResponseZonesBrotli] +type zoneSettingEditResponseZonesBrotliJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesBrotli) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesBrotli) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesBrotliID string + +const ( + ZoneSettingEditResponseZonesBrotliIDBrotli ZoneSettingEditResponseZonesBrotliID = "brotli" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesBrotliValue string + +const ( + ZoneSettingEditResponseZonesBrotliValueOff ZoneSettingEditResponseZonesBrotliValue = "off" + ZoneSettingEditResponseZonesBrotliValueOn ZoneSettingEditResponseZonesBrotliValue = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesBrotliEditable bool + +const ( + ZoneSettingEditResponseZonesBrotliEditableTrue ZoneSettingEditResponseZonesBrotliEditable = true + ZoneSettingEditResponseZonesBrotliEditableFalse ZoneSettingEditResponseZonesBrotliEditable = false +) + +// Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources +// will remain on your visitors' computers. Cloudflare will honor any larger times +// specified by your server. +// (https://support.cloudflare.com/hc/en-us/articles/200168276). +type ZoneSettingEditResponseZonesBrowserCacheTTL struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesBrowserCacheTTLID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesBrowserCacheTTLValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesBrowserCacheTTLEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesBrowserCacheTTLJSON `json:"-"` +} + +// zoneSettingEditResponseZonesBrowserCacheTTLJSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseZonesBrowserCacheTTL] +type zoneSettingEditResponseZonesBrowserCacheTTLJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesBrowserCacheTTL) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesBrowserCacheTTL) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesBrowserCacheTTLID string + +const ( + ZoneSettingEditResponseZonesBrowserCacheTTLIDBrowserCacheTTL ZoneSettingEditResponseZonesBrowserCacheTTLID = "browser_cache_ttl" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesBrowserCacheTTLValue float64 + +const ( + ZoneSettingEditResponseZonesBrowserCacheTTLValue0 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 0 + ZoneSettingEditResponseZonesBrowserCacheTTLValue30 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 30 + ZoneSettingEditResponseZonesBrowserCacheTTLValue60 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 60 + ZoneSettingEditResponseZonesBrowserCacheTTLValue120 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 120 + ZoneSettingEditResponseZonesBrowserCacheTTLValue300 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 300 + ZoneSettingEditResponseZonesBrowserCacheTTLValue1200 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 1200 + ZoneSettingEditResponseZonesBrowserCacheTTLValue1800 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 1800 + ZoneSettingEditResponseZonesBrowserCacheTTLValue3600 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 3600 + ZoneSettingEditResponseZonesBrowserCacheTTLValue7200 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 7200 + ZoneSettingEditResponseZonesBrowserCacheTTLValue10800 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 10800 + ZoneSettingEditResponseZonesBrowserCacheTTLValue14400 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 14400 + ZoneSettingEditResponseZonesBrowserCacheTTLValue18000 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 18000 + ZoneSettingEditResponseZonesBrowserCacheTTLValue28800 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 28800 + ZoneSettingEditResponseZonesBrowserCacheTTLValue43200 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 43200 + ZoneSettingEditResponseZonesBrowserCacheTTLValue57600 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 57600 + ZoneSettingEditResponseZonesBrowserCacheTTLValue72000 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 72000 + ZoneSettingEditResponseZonesBrowserCacheTTLValue86400 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 86400 + ZoneSettingEditResponseZonesBrowserCacheTTLValue172800 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 172800 + ZoneSettingEditResponseZonesBrowserCacheTTLValue259200 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 259200 + ZoneSettingEditResponseZonesBrowserCacheTTLValue345600 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 345600 + ZoneSettingEditResponseZonesBrowserCacheTTLValue432000 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 432000 + ZoneSettingEditResponseZonesBrowserCacheTTLValue691200 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 691200 + ZoneSettingEditResponseZonesBrowserCacheTTLValue1382400 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 1382400 + ZoneSettingEditResponseZonesBrowserCacheTTLValue2073600 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 2073600 + ZoneSettingEditResponseZonesBrowserCacheTTLValue2678400 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 2678400 + ZoneSettingEditResponseZonesBrowserCacheTTLValue5356800 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 5356800 + ZoneSettingEditResponseZonesBrowserCacheTTLValue16070400 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 16070400 + ZoneSettingEditResponseZonesBrowserCacheTTLValue31536000 ZoneSettingEditResponseZonesBrowserCacheTTLValue = 31536000 +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesBrowserCacheTTLEditable bool + +const ( + ZoneSettingEditResponseZonesBrowserCacheTTLEditableTrue ZoneSettingEditResponseZonesBrowserCacheTTLEditable = true + ZoneSettingEditResponseZonesBrowserCacheTTLEditableFalse ZoneSettingEditResponseZonesBrowserCacheTTLEditable = false +) + +// Browser Integrity Check is similar to Bad Behavior and looks for common HTTP +// headers abused most commonly by spammers and denies access to your page. It will +// also challenge visitors that do not have a user agent or a non standard user +// agent (also commonly used by abuse bots, crawlers or visitors). +// (https://support.cloudflare.com/hc/en-us/articles/200170086). +type ZoneSettingEditResponseZonesBrowserCheck struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesBrowserCheckID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesBrowserCheckValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesBrowserCheckEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesBrowserCheckJSON `json:"-"` +} + +// zoneSettingEditResponseZonesBrowserCheckJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseZonesBrowserCheck] +type zoneSettingEditResponseZonesBrowserCheckJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesBrowserCheck) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesBrowserCheck) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesBrowserCheckID string + +const ( + ZoneSettingEditResponseZonesBrowserCheckIDBrowserCheck ZoneSettingEditResponseZonesBrowserCheckID = "browser_check" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesBrowserCheckValue string + +const ( + ZoneSettingEditResponseZonesBrowserCheckValueOn ZoneSettingEditResponseZonesBrowserCheckValue = "on" + ZoneSettingEditResponseZonesBrowserCheckValueOff ZoneSettingEditResponseZonesBrowserCheckValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesBrowserCheckEditable bool + +const ( + ZoneSettingEditResponseZonesBrowserCheckEditableTrue ZoneSettingEditResponseZonesBrowserCheckEditable = true + ZoneSettingEditResponseZonesBrowserCheckEditableFalse ZoneSettingEditResponseZonesBrowserCheckEditable = false +) + +// Cache Level functions based off the setting level. The basic setting will cache +// most static resources (i.e., css, images, and JavaScript). The simplified +// setting will ignore the query string when delivering a cached resource. The +// aggressive setting will cache all static resources, including ones with a query +// string. (https://support.cloudflare.com/hc/en-us/articles/200168256). +type ZoneSettingEditResponseZonesCacheLevel struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesCacheLevelID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesCacheLevelValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesCacheLevelEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesCacheLevelJSON `json:"-"` +} + +// zoneSettingEditResponseZonesCacheLevelJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseZonesCacheLevel] +type zoneSettingEditResponseZonesCacheLevelJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesCacheLevel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesCacheLevel) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesCacheLevelID string + +const ( + ZoneSettingEditResponseZonesCacheLevelIDCacheLevel ZoneSettingEditResponseZonesCacheLevelID = "cache_level" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesCacheLevelValue string + +const ( + ZoneSettingEditResponseZonesCacheLevelValueAggressive ZoneSettingEditResponseZonesCacheLevelValue = "aggressive" + ZoneSettingEditResponseZonesCacheLevelValueBasic ZoneSettingEditResponseZonesCacheLevelValue = "basic" + ZoneSettingEditResponseZonesCacheLevelValueSimplified ZoneSettingEditResponseZonesCacheLevelValue = "simplified" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesCacheLevelEditable bool + +const ( + ZoneSettingEditResponseZonesCacheLevelEditableTrue ZoneSettingEditResponseZonesCacheLevelEditable = true + ZoneSettingEditResponseZonesCacheLevelEditableFalse ZoneSettingEditResponseZonesCacheLevelEditable = false +) + +// Specify how long a visitor is allowed access to your site after successfully +// completing a challenge (such as a CAPTCHA). After the TTL has expired the +// visitor will have to complete a new challenge. We recommend a 15 - 45 minute +// setting and will attempt to honor any setting above 45 minutes. +// (https://support.cloudflare.com/hc/en-us/articles/200170136). +type ZoneSettingEditResponseZonesChallengeTTL struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesChallengeTTLID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesChallengeTTLValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesChallengeTTLEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesChallengeTTLJSON `json:"-"` +} + +// zoneSettingEditResponseZonesChallengeTTLJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseZonesChallengeTTL] +type zoneSettingEditResponseZonesChallengeTTLJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesChallengeTTL) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesChallengeTTL) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesChallengeTTLID string + +const ( + ZoneSettingEditResponseZonesChallengeTTLIDChallengeTTL ZoneSettingEditResponseZonesChallengeTTLID = "challenge_ttl" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesChallengeTTLValue float64 + +const ( + ZoneSettingEditResponseZonesChallengeTTLValue300 ZoneSettingEditResponseZonesChallengeTTLValue = 300 + ZoneSettingEditResponseZonesChallengeTTLValue900 ZoneSettingEditResponseZonesChallengeTTLValue = 900 + ZoneSettingEditResponseZonesChallengeTTLValue1800 ZoneSettingEditResponseZonesChallengeTTLValue = 1800 + ZoneSettingEditResponseZonesChallengeTTLValue2700 ZoneSettingEditResponseZonesChallengeTTLValue = 2700 + ZoneSettingEditResponseZonesChallengeTTLValue3600 ZoneSettingEditResponseZonesChallengeTTLValue = 3600 + ZoneSettingEditResponseZonesChallengeTTLValue7200 ZoneSettingEditResponseZonesChallengeTTLValue = 7200 + ZoneSettingEditResponseZonesChallengeTTLValue10800 ZoneSettingEditResponseZonesChallengeTTLValue = 10800 + ZoneSettingEditResponseZonesChallengeTTLValue14400 ZoneSettingEditResponseZonesChallengeTTLValue = 14400 + ZoneSettingEditResponseZonesChallengeTTLValue28800 ZoneSettingEditResponseZonesChallengeTTLValue = 28800 + ZoneSettingEditResponseZonesChallengeTTLValue57600 ZoneSettingEditResponseZonesChallengeTTLValue = 57600 + ZoneSettingEditResponseZonesChallengeTTLValue86400 ZoneSettingEditResponseZonesChallengeTTLValue = 86400 + ZoneSettingEditResponseZonesChallengeTTLValue604800 ZoneSettingEditResponseZonesChallengeTTLValue = 604800 + ZoneSettingEditResponseZonesChallengeTTLValue2592000 ZoneSettingEditResponseZonesChallengeTTLValue = 2592000 + ZoneSettingEditResponseZonesChallengeTTLValue31536000 ZoneSettingEditResponseZonesChallengeTTLValue = 31536000 +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesChallengeTTLEditable bool + +const ( + ZoneSettingEditResponseZonesChallengeTTLEditableTrue ZoneSettingEditResponseZonesChallengeTTLEditable = true + ZoneSettingEditResponseZonesChallengeTTLEditableFalse ZoneSettingEditResponseZonesChallengeTTLEditable = false +) + +// An allowlist of ciphers for TLS termination. These ciphers must be in the +// BoringSSL format. +type ZoneSettingEditResponseZonesCiphers struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesCiphersID `json:"id,required"` + // Current value of the zone setting. + Value []string `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesCiphersEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesCiphersJSON `json:"-"` +} + +// zoneSettingEditResponseZonesCiphersJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseZonesCiphers] +type zoneSettingEditResponseZonesCiphersJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesCiphers) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesCiphers) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesCiphersID string + +const ( + ZoneSettingEditResponseZonesCiphersIDCiphers ZoneSettingEditResponseZonesCiphersID = "ciphers" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesCiphersEditable bool + +const ( + ZoneSettingEditResponseZonesCiphersEditableTrue ZoneSettingEditResponseZonesCiphersEditable = true + ZoneSettingEditResponseZonesCiphersEditableFalse ZoneSettingEditResponseZonesCiphersEditable = false +) + +// Whether or not cname flattening is on. +type ZoneSettingEditResponseZonesCnameFlattening struct { + // How to flatten the cname destination. + ID ZoneSettingEditResponseZonesCnameFlatteningID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesCnameFlatteningValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesCnameFlatteningEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesCnameFlatteningJSON `json:"-"` +} + +// zoneSettingEditResponseZonesCnameFlatteningJSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseZonesCnameFlattening] +type zoneSettingEditResponseZonesCnameFlatteningJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesCnameFlattening) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesCnameFlattening) implementsZoneSettingEditResponse() {} + +// How to flatten the cname destination. +type ZoneSettingEditResponseZonesCnameFlatteningID string + +const ( + ZoneSettingEditResponseZonesCnameFlatteningIDCnameFlattening ZoneSettingEditResponseZonesCnameFlatteningID = "cname_flattening" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesCnameFlatteningValue string + +const ( + ZoneSettingEditResponseZonesCnameFlatteningValueFlattenAtRoot ZoneSettingEditResponseZonesCnameFlatteningValue = "flatten_at_root" + ZoneSettingEditResponseZonesCnameFlatteningValueFlattenAll ZoneSettingEditResponseZonesCnameFlatteningValue = "flatten_all" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesCnameFlatteningEditable bool + +const ( + ZoneSettingEditResponseZonesCnameFlatteningEditableTrue ZoneSettingEditResponseZonesCnameFlatteningEditable = true + ZoneSettingEditResponseZonesCnameFlatteningEditableFalse ZoneSettingEditResponseZonesCnameFlatteningEditable = false +) + +// Development Mode temporarily allows you to enter development mode for your +// websites if you need to make changes to your site. This will bypass Cloudflare's +// accelerated cache and slow down your site, but is useful if you are making +// changes to cacheable content (like images, css, or JavaScript) and would like to +// see those changes right away. Once entered, development mode will last for 3 +// hours and then automatically toggle off. +type ZoneSettingEditResponseZonesDevelopmentMode struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesDevelopmentModeID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesDevelopmentModeValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesDevelopmentModeEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. Notes: The interval (in seconds) from when + // development mode expires (positive integer) or last expired (negative integer) + // for the domain. If development mode has never been enabled, this value is false. + TimeRemaining float64 `json:"time_remaining"` + JSON zoneSettingEditResponseZonesDevelopmentModeJSON `json:"-"` +} + +// zoneSettingEditResponseZonesDevelopmentModeJSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseZonesDevelopmentMode] +type zoneSettingEditResponseZonesDevelopmentModeJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + TimeRemaining apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesDevelopmentMode) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesDevelopmentMode) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesDevelopmentModeID string + +const ( + ZoneSettingEditResponseZonesDevelopmentModeIDDevelopmentMode ZoneSettingEditResponseZonesDevelopmentModeID = "development_mode" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesDevelopmentModeValue string + +const ( + ZoneSettingEditResponseZonesDevelopmentModeValueOn ZoneSettingEditResponseZonesDevelopmentModeValue = "on" + ZoneSettingEditResponseZonesDevelopmentModeValueOff ZoneSettingEditResponseZonesDevelopmentModeValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesDevelopmentModeEditable bool + +const ( + ZoneSettingEditResponseZonesDevelopmentModeEditableTrue ZoneSettingEditResponseZonesDevelopmentModeEditable = true + ZoneSettingEditResponseZonesDevelopmentModeEditableFalse ZoneSettingEditResponseZonesDevelopmentModeEditable = false +) + +// When enabled, Cloudflare will attempt to speed up overall page loads by serving +// `103` responses with `Link` headers from the final response. Refer to +// [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for +// more information. +type ZoneSettingEditResponseZonesEarlyHints struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesEarlyHintsID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesEarlyHintsValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesEarlyHintsEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesEarlyHintsJSON `json:"-"` +} + +// zoneSettingEditResponseZonesEarlyHintsJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseZonesEarlyHints] +type zoneSettingEditResponseZonesEarlyHintsJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesEarlyHints) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesEarlyHints) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesEarlyHintsID string + +const ( + ZoneSettingEditResponseZonesEarlyHintsIDEarlyHints ZoneSettingEditResponseZonesEarlyHintsID = "early_hints" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesEarlyHintsValue string + +const ( + ZoneSettingEditResponseZonesEarlyHintsValueOn ZoneSettingEditResponseZonesEarlyHintsValue = "on" + ZoneSettingEditResponseZonesEarlyHintsValueOff ZoneSettingEditResponseZonesEarlyHintsValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesEarlyHintsEditable bool + +const ( + ZoneSettingEditResponseZonesEarlyHintsEditableTrue ZoneSettingEditResponseZonesEarlyHintsEditable = true + ZoneSettingEditResponseZonesEarlyHintsEditableFalse ZoneSettingEditResponseZonesEarlyHintsEditable = false +) + +// Time (in seconds) that a resource will be ensured to remain on Cloudflare's +// cache servers. +type ZoneSettingEditResponseZonesEdgeCacheTTL struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesEdgeCacheTTLID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesEdgeCacheTTLValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesEdgeCacheTTLEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesEdgeCacheTTLJSON `json:"-"` +} + +// zoneSettingEditResponseZonesEdgeCacheTTLJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseZonesEdgeCacheTTL] +type zoneSettingEditResponseZonesEdgeCacheTTLJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesEdgeCacheTTL) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesEdgeCacheTTL) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesEdgeCacheTTLID string + +const ( + ZoneSettingEditResponseZonesEdgeCacheTTLIDEdgeCacheTTL ZoneSettingEditResponseZonesEdgeCacheTTLID = "edge_cache_ttl" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesEdgeCacheTTLValue float64 + +const ( + ZoneSettingEditResponseZonesEdgeCacheTTLValue30 ZoneSettingEditResponseZonesEdgeCacheTTLValue = 30 + ZoneSettingEditResponseZonesEdgeCacheTTLValue60 ZoneSettingEditResponseZonesEdgeCacheTTLValue = 60 + ZoneSettingEditResponseZonesEdgeCacheTTLValue300 ZoneSettingEditResponseZonesEdgeCacheTTLValue = 300 + ZoneSettingEditResponseZonesEdgeCacheTTLValue1200 ZoneSettingEditResponseZonesEdgeCacheTTLValue = 1200 + ZoneSettingEditResponseZonesEdgeCacheTTLValue1800 ZoneSettingEditResponseZonesEdgeCacheTTLValue = 1800 + ZoneSettingEditResponseZonesEdgeCacheTTLValue3600 ZoneSettingEditResponseZonesEdgeCacheTTLValue = 3600 + ZoneSettingEditResponseZonesEdgeCacheTTLValue7200 ZoneSettingEditResponseZonesEdgeCacheTTLValue = 7200 + ZoneSettingEditResponseZonesEdgeCacheTTLValue10800 ZoneSettingEditResponseZonesEdgeCacheTTLValue = 10800 + ZoneSettingEditResponseZonesEdgeCacheTTLValue14400 ZoneSettingEditResponseZonesEdgeCacheTTLValue = 14400 + ZoneSettingEditResponseZonesEdgeCacheTTLValue18000 ZoneSettingEditResponseZonesEdgeCacheTTLValue = 18000 + ZoneSettingEditResponseZonesEdgeCacheTTLValue28800 ZoneSettingEditResponseZonesEdgeCacheTTLValue = 28800 + ZoneSettingEditResponseZonesEdgeCacheTTLValue43200 ZoneSettingEditResponseZonesEdgeCacheTTLValue = 43200 + ZoneSettingEditResponseZonesEdgeCacheTTLValue57600 ZoneSettingEditResponseZonesEdgeCacheTTLValue = 57600 + ZoneSettingEditResponseZonesEdgeCacheTTLValue72000 ZoneSettingEditResponseZonesEdgeCacheTTLValue = 72000 + ZoneSettingEditResponseZonesEdgeCacheTTLValue86400 ZoneSettingEditResponseZonesEdgeCacheTTLValue = 86400 + ZoneSettingEditResponseZonesEdgeCacheTTLValue172800 ZoneSettingEditResponseZonesEdgeCacheTTLValue = 172800 + ZoneSettingEditResponseZonesEdgeCacheTTLValue259200 ZoneSettingEditResponseZonesEdgeCacheTTLValue = 259200 + ZoneSettingEditResponseZonesEdgeCacheTTLValue345600 ZoneSettingEditResponseZonesEdgeCacheTTLValue = 345600 + ZoneSettingEditResponseZonesEdgeCacheTTLValue432000 ZoneSettingEditResponseZonesEdgeCacheTTLValue = 432000 + ZoneSettingEditResponseZonesEdgeCacheTTLValue518400 ZoneSettingEditResponseZonesEdgeCacheTTLValue = 518400 + ZoneSettingEditResponseZonesEdgeCacheTTLValue604800 ZoneSettingEditResponseZonesEdgeCacheTTLValue = 604800 +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesEdgeCacheTTLEditable bool + +const ( + ZoneSettingEditResponseZonesEdgeCacheTTLEditableTrue ZoneSettingEditResponseZonesEdgeCacheTTLEditable = true + ZoneSettingEditResponseZonesEdgeCacheTTLEditableFalse ZoneSettingEditResponseZonesEdgeCacheTTLEditable = false +) + +// Encrypt email adresses on your web page from bots, while keeping them visible to +// humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). +type ZoneSettingEditResponseZonesEmailObfuscation struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesEmailObfuscationID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesEmailObfuscationValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesEmailObfuscationEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesEmailObfuscationJSON `json:"-"` +} + +// zoneSettingEditResponseZonesEmailObfuscationJSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseZonesEmailObfuscation] +type zoneSettingEditResponseZonesEmailObfuscationJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesEmailObfuscation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesEmailObfuscation) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesEmailObfuscationID string + +const ( + ZoneSettingEditResponseZonesEmailObfuscationIDEmailObfuscation ZoneSettingEditResponseZonesEmailObfuscationID = "email_obfuscation" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesEmailObfuscationValue string + +const ( + ZoneSettingEditResponseZonesEmailObfuscationValueOn ZoneSettingEditResponseZonesEmailObfuscationValue = "on" + ZoneSettingEditResponseZonesEmailObfuscationValueOff ZoneSettingEditResponseZonesEmailObfuscationValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesEmailObfuscationEditable bool + +const ( + ZoneSettingEditResponseZonesEmailObfuscationEditableTrue ZoneSettingEditResponseZonesEmailObfuscationEditable = true + ZoneSettingEditResponseZonesEmailObfuscationEditableFalse ZoneSettingEditResponseZonesEmailObfuscationEditable = false +) + +// HTTP/2 Edge Prioritization optimises the delivery of resources served through +// HTTP/2 to improve page load performance. It also supports fine control of +// content delivery when used in conjunction with Workers. +type ZoneSettingEditResponseZonesH2Prioritization struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesH2PrioritizationID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesH2PrioritizationValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesH2PrioritizationEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesH2PrioritizationJSON `json:"-"` +} + +// zoneSettingEditResponseZonesH2PrioritizationJSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseZonesH2Prioritization] +type zoneSettingEditResponseZonesH2PrioritizationJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesH2Prioritization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesH2Prioritization) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesH2PrioritizationID string + +const ( + ZoneSettingEditResponseZonesH2PrioritizationIDH2Prioritization ZoneSettingEditResponseZonesH2PrioritizationID = "h2_prioritization" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesH2PrioritizationValue string + +const ( + ZoneSettingEditResponseZonesH2PrioritizationValueOn ZoneSettingEditResponseZonesH2PrioritizationValue = "on" + ZoneSettingEditResponseZonesH2PrioritizationValueOff ZoneSettingEditResponseZonesH2PrioritizationValue = "off" + ZoneSettingEditResponseZonesH2PrioritizationValueCustom ZoneSettingEditResponseZonesH2PrioritizationValue = "custom" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesH2PrioritizationEditable bool + +const ( + ZoneSettingEditResponseZonesH2PrioritizationEditableTrue ZoneSettingEditResponseZonesH2PrioritizationEditable = true + ZoneSettingEditResponseZonesH2PrioritizationEditableFalse ZoneSettingEditResponseZonesH2PrioritizationEditable = false +) + +// When enabled, the Hotlink Protection option ensures that other sites cannot suck +// up your bandwidth by building pages that use images hosted on your site. Anytime +// a request for an image on your site hits Cloudflare, we check to ensure that +// it's not another site requesting them. People will still be able to download and +// view images from your page, but other sites won't be able to steal them for use +// on their own pages. +// (https://support.cloudflare.com/hc/en-us/articles/200170026). +type ZoneSettingEditResponseZonesHotlinkProtection struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesHotlinkProtectionID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesHotlinkProtectionValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesHotlinkProtectionEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesHotlinkProtectionJSON `json:"-"` +} + +// zoneSettingEditResponseZonesHotlinkProtectionJSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseZonesHotlinkProtection] +type zoneSettingEditResponseZonesHotlinkProtectionJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesHotlinkProtection) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesHotlinkProtection) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesHotlinkProtectionID string + +const ( + ZoneSettingEditResponseZonesHotlinkProtectionIDHotlinkProtection ZoneSettingEditResponseZonesHotlinkProtectionID = "hotlink_protection" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesHotlinkProtectionValue string + +const ( + ZoneSettingEditResponseZonesHotlinkProtectionValueOn ZoneSettingEditResponseZonesHotlinkProtectionValue = "on" + ZoneSettingEditResponseZonesHotlinkProtectionValueOff ZoneSettingEditResponseZonesHotlinkProtectionValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesHotlinkProtectionEditable bool + +const ( + ZoneSettingEditResponseZonesHotlinkProtectionEditableTrue ZoneSettingEditResponseZonesHotlinkProtectionEditable = true + ZoneSettingEditResponseZonesHotlinkProtectionEditableFalse ZoneSettingEditResponseZonesHotlinkProtectionEditable = false +) + +// HTTP2 enabled for this zone. +type ZoneSettingEditResponseZonesHTTP2 struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesHTTP2ID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesHTTP2Value `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesHTTP2Editable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesHTTP2JSON `json:"-"` +} + +// zoneSettingEditResponseZonesHTTP2JSON contains the JSON metadata for the struct +// [ZoneSettingEditResponseZonesHTTP2] +type zoneSettingEditResponseZonesHTTP2JSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesHTTP2) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesHTTP2) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesHTTP2ID string + +const ( + ZoneSettingEditResponseZonesHTTP2IDHTTP2 ZoneSettingEditResponseZonesHTTP2ID = "http2" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesHTTP2Value string + +const ( + ZoneSettingEditResponseZonesHTTP2ValueOn ZoneSettingEditResponseZonesHTTP2Value = "on" + ZoneSettingEditResponseZonesHTTP2ValueOff ZoneSettingEditResponseZonesHTTP2Value = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesHTTP2Editable bool + +const ( + ZoneSettingEditResponseZonesHTTP2EditableTrue ZoneSettingEditResponseZonesHTTP2Editable = true + ZoneSettingEditResponseZonesHTTP2EditableFalse ZoneSettingEditResponseZonesHTTP2Editable = false +) + +// HTTP3 enabled for this zone. +type ZoneSettingEditResponseZonesHTTP3 struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesHTTP3ID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesHTTP3Value `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesHTTP3Editable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesHTTP3JSON `json:"-"` +} + +// zoneSettingEditResponseZonesHTTP3JSON contains the JSON metadata for the struct +// [ZoneSettingEditResponseZonesHTTP3] +type zoneSettingEditResponseZonesHTTP3JSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesHTTP3) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesHTTP3) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesHTTP3ID string + +const ( + ZoneSettingEditResponseZonesHTTP3IDHTTP3 ZoneSettingEditResponseZonesHTTP3ID = "http3" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesHTTP3Value string + +const ( + ZoneSettingEditResponseZonesHTTP3ValueOn ZoneSettingEditResponseZonesHTTP3Value = "on" + ZoneSettingEditResponseZonesHTTP3ValueOff ZoneSettingEditResponseZonesHTTP3Value = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesHTTP3Editable bool + +const ( + ZoneSettingEditResponseZonesHTTP3EditableTrue ZoneSettingEditResponseZonesHTTP3Editable = true + ZoneSettingEditResponseZonesHTTP3EditableFalse ZoneSettingEditResponseZonesHTTP3Editable = false +) + +// Image Resizing provides on-demand resizing, conversion and optimisation for +// images served through Cloudflare's network. Refer to the +// [Image Resizing documentation](https://developers.cloudflare.com/images/) for +// more information. +type ZoneSettingEditResponseZonesImageResizing struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesImageResizingID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesImageResizingValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesImageResizingEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesImageResizingJSON `json:"-"` +} + +// zoneSettingEditResponseZonesImageResizingJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseZonesImageResizing] +type zoneSettingEditResponseZonesImageResizingJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesImageResizing) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesImageResizing) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesImageResizingID string + +const ( + ZoneSettingEditResponseZonesImageResizingIDImageResizing ZoneSettingEditResponseZonesImageResizingID = "image_resizing" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesImageResizingValue string + +const ( + ZoneSettingEditResponseZonesImageResizingValueOn ZoneSettingEditResponseZonesImageResizingValue = "on" + ZoneSettingEditResponseZonesImageResizingValueOff ZoneSettingEditResponseZonesImageResizingValue = "off" + ZoneSettingEditResponseZonesImageResizingValueOpen ZoneSettingEditResponseZonesImageResizingValue = "open" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesImageResizingEditable bool + +const ( + ZoneSettingEditResponseZonesImageResizingEditableTrue ZoneSettingEditResponseZonesImageResizingEditable = true + ZoneSettingEditResponseZonesImageResizingEditableFalse ZoneSettingEditResponseZonesImageResizingEditable = false +) + +// Enable IP Geolocation to have Cloudflare geolocate visitors to your website and +// pass the country code to you. +// (https://support.cloudflare.com/hc/en-us/articles/200168236). +type ZoneSettingEditResponseZonesIPGeolocation struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesIPGeolocationID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesIPGeolocationValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesIPGeolocationEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesIPGeolocationJSON `json:"-"` +} + +// zoneSettingEditResponseZonesIPGeolocationJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseZonesIPGeolocation] +type zoneSettingEditResponseZonesIPGeolocationJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesIPGeolocation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesIPGeolocation) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesIPGeolocationID string + +const ( + ZoneSettingEditResponseZonesIPGeolocationIDIPGeolocation ZoneSettingEditResponseZonesIPGeolocationID = "ip_geolocation" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesIPGeolocationValue string + +const ( + ZoneSettingEditResponseZonesIPGeolocationValueOn ZoneSettingEditResponseZonesIPGeolocationValue = "on" + ZoneSettingEditResponseZonesIPGeolocationValueOff ZoneSettingEditResponseZonesIPGeolocationValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesIPGeolocationEditable bool + +const ( + ZoneSettingEditResponseZonesIPGeolocationEditableTrue ZoneSettingEditResponseZonesIPGeolocationEditable = true + ZoneSettingEditResponseZonesIPGeolocationEditableFalse ZoneSettingEditResponseZonesIPGeolocationEditable = false +) + +// Enable IPv6 on all subdomains that are Cloudflare enabled. +// (https://support.cloudflare.com/hc/en-us/articles/200168586). +type ZoneSettingEditResponseZonesIPV6 struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesIPV6ID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesIPV6Value `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesIPV6Editable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesIPV6JSON `json:"-"` +} + +// zoneSettingEditResponseZonesIPV6JSON contains the JSON metadata for the struct +// [ZoneSettingEditResponseZonesIPV6] +type zoneSettingEditResponseZonesIPV6JSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesIPV6) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesIPV6) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesIPV6ID string + +const ( + ZoneSettingEditResponseZonesIPV6IDIPV6 ZoneSettingEditResponseZonesIPV6ID = "ipv6" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesIPV6Value string + +const ( + ZoneSettingEditResponseZonesIPV6ValueOff ZoneSettingEditResponseZonesIPV6Value = "off" + ZoneSettingEditResponseZonesIPV6ValueOn ZoneSettingEditResponseZonesIPV6Value = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesIPV6Editable bool + +const ( + ZoneSettingEditResponseZonesIPV6EditableTrue ZoneSettingEditResponseZonesIPV6Editable = true + ZoneSettingEditResponseZonesIPV6EditableFalse ZoneSettingEditResponseZonesIPV6Editable = false +) + +// Maximum size of an allowable upload. +type ZoneSettingEditResponseZonesMaxUpload struct { + // identifier of the zone setting. + ID ZoneSettingEditResponseZonesMaxUploadID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesMaxUploadValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesMaxUploadEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesMaxUploadJSON `json:"-"` +} + +// zoneSettingEditResponseZonesMaxUploadJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseZonesMaxUpload] +type zoneSettingEditResponseZonesMaxUploadJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesMaxUpload) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesMaxUpload) implementsZoneSettingEditResponse() {} + +// identifier of the zone setting. +type ZoneSettingEditResponseZonesMaxUploadID string + +const ( + ZoneSettingEditResponseZonesMaxUploadIDMaxUpload ZoneSettingEditResponseZonesMaxUploadID = "max_upload" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesMaxUploadValue float64 + +const ( + ZoneSettingEditResponseZonesMaxUploadValue100 ZoneSettingEditResponseZonesMaxUploadValue = 100 + ZoneSettingEditResponseZonesMaxUploadValue200 ZoneSettingEditResponseZonesMaxUploadValue = 200 + ZoneSettingEditResponseZonesMaxUploadValue500 ZoneSettingEditResponseZonesMaxUploadValue = 500 +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesMaxUploadEditable bool + +const ( + ZoneSettingEditResponseZonesMaxUploadEditableTrue ZoneSettingEditResponseZonesMaxUploadEditable = true + ZoneSettingEditResponseZonesMaxUploadEditableFalse ZoneSettingEditResponseZonesMaxUploadEditable = false +) + +// Only accepts HTTPS requests that use at least the TLS protocol version +// specified. For example, if TLS 1.1 is selected, TLS 1.0 connections will be +// rejected, while 1.1, 1.2, and 1.3 (if enabled) will be permitted. +type ZoneSettingEditResponseZonesMinTLSVersion struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesMinTLSVersionID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesMinTLSVersionValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesMinTLSVersionEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesMinTLSVersionJSON `json:"-"` +} + +// zoneSettingEditResponseZonesMinTLSVersionJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseZonesMinTLSVersion] +type zoneSettingEditResponseZonesMinTLSVersionJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesMinTLSVersion) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesMinTLSVersion) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesMinTLSVersionID string + +const ( + ZoneSettingEditResponseZonesMinTLSVersionIDMinTLSVersion ZoneSettingEditResponseZonesMinTLSVersionID = "min_tls_version" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesMinTLSVersionValue string + +const ( + ZoneSettingEditResponseZonesMinTLSVersionValue1_0 ZoneSettingEditResponseZonesMinTLSVersionValue = "1.0" + ZoneSettingEditResponseZonesMinTLSVersionValue1_1 ZoneSettingEditResponseZonesMinTLSVersionValue = "1.1" + ZoneSettingEditResponseZonesMinTLSVersionValue1_2 ZoneSettingEditResponseZonesMinTLSVersionValue = "1.2" + ZoneSettingEditResponseZonesMinTLSVersionValue1_3 ZoneSettingEditResponseZonesMinTLSVersionValue = "1.3" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesMinTLSVersionEditable bool + +const ( + ZoneSettingEditResponseZonesMinTLSVersionEditableTrue ZoneSettingEditResponseZonesMinTLSVersionEditable = true + ZoneSettingEditResponseZonesMinTLSVersionEditableFalse ZoneSettingEditResponseZonesMinTLSVersionEditable = false +) + +// Automatically minify certain assets for your website. Refer to +// [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) +// for more information. +type ZoneSettingEditResponseZonesMinify struct { + // Zone setting identifier. + ID ZoneSettingEditResponseZonesMinifyID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesMinifyValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesMinifyEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesMinifyJSON `json:"-"` +} + +// zoneSettingEditResponseZonesMinifyJSON contains the JSON metadata for the struct +// [ZoneSettingEditResponseZonesMinify] +type zoneSettingEditResponseZonesMinifyJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesMinify) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesMinify) implementsZoneSettingEditResponse() {} + +// Zone setting identifier. +type ZoneSettingEditResponseZonesMinifyID string + +const ( + ZoneSettingEditResponseZonesMinifyIDMinify ZoneSettingEditResponseZonesMinifyID = "minify" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesMinifyValue struct { + // Automatically minify all CSS files for your website. + Css ZoneSettingEditResponseZonesMinifyValueCss `json:"css"` + // Automatically minify all HTML files for your website. + HTML ZoneSettingEditResponseZonesMinifyValueHTML `json:"html"` + // Automatically minify all JavaScript files for your website. + Js ZoneSettingEditResponseZonesMinifyValueJs `json:"js"` + JSON zoneSettingEditResponseZonesMinifyValueJSON `json:"-"` +} + +// zoneSettingEditResponseZonesMinifyValueJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseZonesMinifyValue] +type zoneSettingEditResponseZonesMinifyValueJSON struct { + Css apijson.Field + HTML apijson.Field + Js apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesMinifyValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Automatically minify all CSS files for your website. +type ZoneSettingEditResponseZonesMinifyValueCss string + +const ( + ZoneSettingEditResponseZonesMinifyValueCssOn ZoneSettingEditResponseZonesMinifyValueCss = "on" + ZoneSettingEditResponseZonesMinifyValueCssOff ZoneSettingEditResponseZonesMinifyValueCss = "off" +) + +// Automatically minify all HTML files for your website. +type ZoneSettingEditResponseZonesMinifyValueHTML string + +const ( + ZoneSettingEditResponseZonesMinifyValueHTMLOn ZoneSettingEditResponseZonesMinifyValueHTML = "on" + ZoneSettingEditResponseZonesMinifyValueHTMLOff ZoneSettingEditResponseZonesMinifyValueHTML = "off" +) + +// Automatically minify all JavaScript files for your website. +type ZoneSettingEditResponseZonesMinifyValueJs string + +const ( + ZoneSettingEditResponseZonesMinifyValueJsOn ZoneSettingEditResponseZonesMinifyValueJs = "on" + ZoneSettingEditResponseZonesMinifyValueJsOff ZoneSettingEditResponseZonesMinifyValueJs = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesMinifyEditable bool + +const ( + ZoneSettingEditResponseZonesMinifyEditableTrue ZoneSettingEditResponseZonesMinifyEditable = true + ZoneSettingEditResponseZonesMinifyEditableFalse ZoneSettingEditResponseZonesMinifyEditable = false +) + +// Automatically optimize image loading for website visitors on mobile devices. +// Refer to +// [our blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for +// more information. +type ZoneSettingEditResponseZonesMirage struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesMirageID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesMirageValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesMirageEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesMirageJSON `json:"-"` +} + +// zoneSettingEditResponseZonesMirageJSON contains the JSON metadata for the struct +// [ZoneSettingEditResponseZonesMirage] +type zoneSettingEditResponseZonesMirageJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesMirage) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesMirage) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesMirageID string + +const ( + ZoneSettingEditResponseZonesMirageIDMirage ZoneSettingEditResponseZonesMirageID = "mirage" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesMirageValue string + +const ( + ZoneSettingEditResponseZonesMirageValueOn ZoneSettingEditResponseZonesMirageValue = "on" + ZoneSettingEditResponseZonesMirageValueOff ZoneSettingEditResponseZonesMirageValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesMirageEditable bool + +const ( + ZoneSettingEditResponseZonesMirageEditableTrue ZoneSettingEditResponseZonesMirageEditable = true + ZoneSettingEditResponseZonesMirageEditableFalse ZoneSettingEditResponseZonesMirageEditable = false +) + +// Automatically redirect visitors on mobile devices to a mobile-optimized +// subdomain. Refer to +// [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) +// for more information. +type ZoneSettingEditResponseZonesMobileRedirect struct { + // Identifier of the zone setting. + ID ZoneSettingEditResponseZonesMobileRedirectID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesMobileRedirectValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesMobileRedirectEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesMobileRedirectJSON `json:"-"` +} + +// zoneSettingEditResponseZonesMobileRedirectJSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseZonesMobileRedirect] +type zoneSettingEditResponseZonesMobileRedirectJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesMobileRedirect) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesMobileRedirect) implementsZoneSettingEditResponse() {} + +// Identifier of the zone setting. +type ZoneSettingEditResponseZonesMobileRedirectID string + +const ( + ZoneSettingEditResponseZonesMobileRedirectIDMobileRedirect ZoneSettingEditResponseZonesMobileRedirectID = "mobile_redirect" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesMobileRedirectValue struct { + // Which subdomain prefix you wish to redirect visitors on mobile devices to + // (subdomain must already exist). + MobileSubdomain string `json:"mobile_subdomain,nullable"` + // Whether or not mobile redirect is enabled. + Status ZoneSettingEditResponseZonesMobileRedirectValueStatus `json:"status"` + // Whether to drop the current page path and redirect to the mobile subdomain URL + // root, or keep the path and redirect to the same page on the mobile subdomain. + StripUri bool `json:"strip_uri"` + JSON zoneSettingEditResponseZonesMobileRedirectValueJSON `json:"-"` +} + +// zoneSettingEditResponseZonesMobileRedirectValueJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseZonesMobileRedirectValue] +type zoneSettingEditResponseZonesMobileRedirectValueJSON struct { + MobileSubdomain apijson.Field + Status apijson.Field + StripUri apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesMobileRedirectValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether or not mobile redirect is enabled. +type ZoneSettingEditResponseZonesMobileRedirectValueStatus string + +const ( + ZoneSettingEditResponseZonesMobileRedirectValueStatusOn ZoneSettingEditResponseZonesMobileRedirectValueStatus = "on" + ZoneSettingEditResponseZonesMobileRedirectValueStatusOff ZoneSettingEditResponseZonesMobileRedirectValueStatus = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesMobileRedirectEditable bool + +const ( + ZoneSettingEditResponseZonesMobileRedirectEditableTrue ZoneSettingEditResponseZonesMobileRedirectEditable = true + ZoneSettingEditResponseZonesMobileRedirectEditableFalse ZoneSettingEditResponseZonesMobileRedirectEditable = false +) + +// Enable Network Error Logging reporting on your zone. (Beta) +type ZoneSettingEditResponseZonesNEL struct { + // Zone setting identifier. + ID ZoneSettingEditResponseZonesNELID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesNELValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesNELEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesNELJSON `json:"-"` +} + +// zoneSettingEditResponseZonesNELJSON contains the JSON metadata for the struct +// [ZoneSettingEditResponseZonesNEL] +type zoneSettingEditResponseZonesNELJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesNEL) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesNEL) implementsZoneSettingEditResponse() {} + +// Zone setting identifier. +type ZoneSettingEditResponseZonesNELID string + +const ( + ZoneSettingEditResponseZonesNELIDNEL ZoneSettingEditResponseZonesNELID = "nel" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesNELValue struct { + Enabled bool `json:"enabled"` + JSON zoneSettingEditResponseZonesNELValueJSON `json:"-"` +} + +// zoneSettingEditResponseZonesNELValueJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseZonesNELValue] +type zoneSettingEditResponseZonesNELValueJSON struct { + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesNELValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesNELEditable bool + +const ( + ZoneSettingEditResponseZonesNELEditableTrue ZoneSettingEditResponseZonesNELEditable = true + ZoneSettingEditResponseZonesNELEditableFalse ZoneSettingEditResponseZonesNELEditable = false +) + +// Enables the Opportunistic Encryption feature for a zone. +type ZoneSettingEditResponseZonesOpportunisticEncryption struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesOpportunisticEncryptionID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesOpportunisticEncryptionValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesOpportunisticEncryptionEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesOpportunisticEncryptionJSON `json:"-"` +} + +// zoneSettingEditResponseZonesOpportunisticEncryptionJSON contains the JSON +// metadata for the struct [ZoneSettingEditResponseZonesOpportunisticEncryption] +type zoneSettingEditResponseZonesOpportunisticEncryptionJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesOpportunisticEncryption) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesOpportunisticEncryption) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesOpportunisticEncryptionID string + +const ( + ZoneSettingEditResponseZonesOpportunisticEncryptionIDOpportunisticEncryption ZoneSettingEditResponseZonesOpportunisticEncryptionID = "opportunistic_encryption" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesOpportunisticEncryptionValue string + +const ( + ZoneSettingEditResponseZonesOpportunisticEncryptionValueOn ZoneSettingEditResponseZonesOpportunisticEncryptionValue = "on" + ZoneSettingEditResponseZonesOpportunisticEncryptionValueOff ZoneSettingEditResponseZonesOpportunisticEncryptionValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesOpportunisticEncryptionEditable bool + +const ( + ZoneSettingEditResponseZonesOpportunisticEncryptionEditableTrue ZoneSettingEditResponseZonesOpportunisticEncryptionEditable = true + ZoneSettingEditResponseZonesOpportunisticEncryptionEditableFalse ZoneSettingEditResponseZonesOpportunisticEncryptionEditable = false +) + +// Add an Alt-Svc header to all legitimate requests from Tor, allowing the +// connection to use our onion services instead of exit nodes. +type ZoneSettingEditResponseZonesOpportunisticOnion struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesOpportunisticOnionID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesOpportunisticOnionValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesOpportunisticOnionEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesOpportunisticOnionJSON `json:"-"` +} + +// zoneSettingEditResponseZonesOpportunisticOnionJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseZonesOpportunisticOnion] +type zoneSettingEditResponseZonesOpportunisticOnionJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesOpportunisticOnion) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesOpportunisticOnion) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesOpportunisticOnionID string + +const ( + ZoneSettingEditResponseZonesOpportunisticOnionIDOpportunisticOnion ZoneSettingEditResponseZonesOpportunisticOnionID = "opportunistic_onion" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesOpportunisticOnionValue string + +const ( + ZoneSettingEditResponseZonesOpportunisticOnionValueOn ZoneSettingEditResponseZonesOpportunisticOnionValue = "on" + ZoneSettingEditResponseZonesOpportunisticOnionValueOff ZoneSettingEditResponseZonesOpportunisticOnionValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesOpportunisticOnionEditable bool + +const ( + ZoneSettingEditResponseZonesOpportunisticOnionEditableTrue ZoneSettingEditResponseZonesOpportunisticOnionEditable = true + ZoneSettingEditResponseZonesOpportunisticOnionEditableFalse ZoneSettingEditResponseZonesOpportunisticOnionEditable = false +) + +// Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also +// on Cloudflare. +type ZoneSettingEditResponseZonesOrangeToOrange struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesOrangeToOrangeID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesOrangeToOrangeValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesOrangeToOrangeEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesOrangeToOrangeJSON `json:"-"` +} + +// zoneSettingEditResponseZonesOrangeToOrangeJSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseZonesOrangeToOrange] +type zoneSettingEditResponseZonesOrangeToOrangeJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesOrangeToOrange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesOrangeToOrange) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesOrangeToOrangeID string + +const ( + ZoneSettingEditResponseZonesOrangeToOrangeIDOrangeToOrange ZoneSettingEditResponseZonesOrangeToOrangeID = "orange_to_orange" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesOrangeToOrangeValue string + +const ( + ZoneSettingEditResponseZonesOrangeToOrangeValueOn ZoneSettingEditResponseZonesOrangeToOrangeValue = "on" + ZoneSettingEditResponseZonesOrangeToOrangeValueOff ZoneSettingEditResponseZonesOrangeToOrangeValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesOrangeToOrangeEditable bool + +const ( + ZoneSettingEditResponseZonesOrangeToOrangeEditableTrue ZoneSettingEditResponseZonesOrangeToOrangeEditable = true + ZoneSettingEditResponseZonesOrangeToOrangeEditableFalse ZoneSettingEditResponseZonesOrangeToOrangeEditable = false +) + +// Cloudflare will proxy customer error pages on any 502,504 errors on origin +// server instead of showing a default Cloudflare error page. This does not apply +// to 522 errors and is limited to Enterprise Zones. +type ZoneSettingEditResponseZonesOriginErrorPagePassThru struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesOriginErrorPagePassThruID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesOriginErrorPagePassThruValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesOriginErrorPagePassThruEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesOriginErrorPagePassThruJSON `json:"-"` +} + +// zoneSettingEditResponseZonesOriginErrorPagePassThruJSON contains the JSON +// metadata for the struct [ZoneSettingEditResponseZonesOriginErrorPagePassThru] +type zoneSettingEditResponseZonesOriginErrorPagePassThruJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesOriginErrorPagePassThru) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesOriginErrorPagePassThru) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesOriginErrorPagePassThruID string + +const ( + ZoneSettingEditResponseZonesOriginErrorPagePassThruIDOriginErrorPagePassThru ZoneSettingEditResponseZonesOriginErrorPagePassThruID = "origin_error_page_pass_thru" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesOriginErrorPagePassThruValue string + +const ( + ZoneSettingEditResponseZonesOriginErrorPagePassThruValueOn ZoneSettingEditResponseZonesOriginErrorPagePassThruValue = "on" + ZoneSettingEditResponseZonesOriginErrorPagePassThruValueOff ZoneSettingEditResponseZonesOriginErrorPagePassThruValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesOriginErrorPagePassThruEditable bool + +const ( + ZoneSettingEditResponseZonesOriginErrorPagePassThruEditableTrue ZoneSettingEditResponseZonesOriginErrorPagePassThruEditable = true + ZoneSettingEditResponseZonesOriginErrorPagePassThruEditableFalse ZoneSettingEditResponseZonesOriginErrorPagePassThruEditable = false +) + +// Removes metadata and compresses your images for faster page load times. Basic +// (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual +// quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster +// image loading. Larger JPEGs are converted to progressive images, loading a +// lower-resolution image first and ending in a higher-resolution version. Not +// recommended for hi-res photography sites. +type ZoneSettingEditResponseZonesPolish struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesPolishID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesPolishValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesPolishEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesPolishJSON `json:"-"` +} + +// zoneSettingEditResponseZonesPolishJSON contains the JSON metadata for the struct +// [ZoneSettingEditResponseZonesPolish] +type zoneSettingEditResponseZonesPolishJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesPolish) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesPolish) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesPolishID string + +const ( + ZoneSettingEditResponseZonesPolishIDPolish ZoneSettingEditResponseZonesPolishID = "polish" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesPolishValue string + +const ( + ZoneSettingEditResponseZonesPolishValueOff ZoneSettingEditResponseZonesPolishValue = "off" + ZoneSettingEditResponseZonesPolishValueLossless ZoneSettingEditResponseZonesPolishValue = "lossless" + ZoneSettingEditResponseZonesPolishValueLossy ZoneSettingEditResponseZonesPolishValue = "lossy" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesPolishEditable bool + +const ( + ZoneSettingEditResponseZonesPolishEditableTrue ZoneSettingEditResponseZonesPolishEditable = true + ZoneSettingEditResponseZonesPolishEditableFalse ZoneSettingEditResponseZonesPolishEditable = false +) + +// Cloudflare will prefetch any URLs that are included in the response headers. +// This is limited to Enterprise Zones. +type ZoneSettingEditResponseZonesPrefetchPreload struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesPrefetchPreloadID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesPrefetchPreloadValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesPrefetchPreloadEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesPrefetchPreloadJSON `json:"-"` +} + +// zoneSettingEditResponseZonesPrefetchPreloadJSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseZonesPrefetchPreload] +type zoneSettingEditResponseZonesPrefetchPreloadJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesPrefetchPreload) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesPrefetchPreload) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesPrefetchPreloadID string + +const ( + ZoneSettingEditResponseZonesPrefetchPreloadIDPrefetchPreload ZoneSettingEditResponseZonesPrefetchPreloadID = "prefetch_preload" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesPrefetchPreloadValue string + +const ( + ZoneSettingEditResponseZonesPrefetchPreloadValueOn ZoneSettingEditResponseZonesPrefetchPreloadValue = "on" + ZoneSettingEditResponseZonesPrefetchPreloadValueOff ZoneSettingEditResponseZonesPrefetchPreloadValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesPrefetchPreloadEditable bool + +const ( + ZoneSettingEditResponseZonesPrefetchPreloadEditableTrue ZoneSettingEditResponseZonesPrefetchPreloadEditable = true + ZoneSettingEditResponseZonesPrefetchPreloadEditableFalse ZoneSettingEditResponseZonesPrefetchPreloadEditable = false +) + +// Maximum time between two read operations from origin. +type ZoneSettingEditResponseZonesProxyReadTimeout struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesProxyReadTimeoutID `json:"id,required"` + // Current value of the zone setting. + Value float64 `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesProxyReadTimeoutEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesProxyReadTimeoutJSON `json:"-"` +} + +// zoneSettingEditResponseZonesProxyReadTimeoutJSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseZonesProxyReadTimeout] +type zoneSettingEditResponseZonesProxyReadTimeoutJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesProxyReadTimeout) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesProxyReadTimeout) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesProxyReadTimeoutID string + +const ( + ZoneSettingEditResponseZonesProxyReadTimeoutIDProxyReadTimeout ZoneSettingEditResponseZonesProxyReadTimeoutID = "proxy_read_timeout" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesProxyReadTimeoutEditable bool + +const ( + ZoneSettingEditResponseZonesProxyReadTimeoutEditableTrue ZoneSettingEditResponseZonesProxyReadTimeoutEditable = true + ZoneSettingEditResponseZonesProxyReadTimeoutEditableFalse ZoneSettingEditResponseZonesProxyReadTimeoutEditable = false +) + +// The value set for the Pseudo IPv4 setting. +type ZoneSettingEditResponseZonesPseudoIPV4 struct { + // Value of the Pseudo IPv4 setting. + ID ZoneSettingEditResponseZonesPseudoIPV4ID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesPseudoIPV4Value `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesPseudoIPV4Editable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesPseudoIPV4JSON `json:"-"` +} + +// zoneSettingEditResponseZonesPseudoIPV4JSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseZonesPseudoIPV4] +type zoneSettingEditResponseZonesPseudoIPV4JSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesPseudoIPV4) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesPseudoIPV4) implementsZoneSettingEditResponse() {} + +// Value of the Pseudo IPv4 setting. +type ZoneSettingEditResponseZonesPseudoIPV4ID string + +const ( + ZoneSettingEditResponseZonesPseudoIPV4IDPseudoIPV4 ZoneSettingEditResponseZonesPseudoIPV4ID = "pseudo_ipv4" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesPseudoIPV4Value string + +const ( + ZoneSettingEditResponseZonesPseudoIPV4ValueOff ZoneSettingEditResponseZonesPseudoIPV4Value = "off" + ZoneSettingEditResponseZonesPseudoIPV4ValueAddHeader ZoneSettingEditResponseZonesPseudoIPV4Value = "add_header" + ZoneSettingEditResponseZonesPseudoIPV4ValueOverwriteHeader ZoneSettingEditResponseZonesPseudoIPV4Value = "overwrite_header" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesPseudoIPV4Editable bool + +const ( + ZoneSettingEditResponseZonesPseudoIPV4EditableTrue ZoneSettingEditResponseZonesPseudoIPV4Editable = true + ZoneSettingEditResponseZonesPseudoIPV4EditableFalse ZoneSettingEditResponseZonesPseudoIPV4Editable = false +) + +// Enables or disables buffering of responses from the proxied server. Cloudflare +// may buffer the whole payload to deliver it at once to the client versus allowing +// it to be delivered in chunks. By default, the proxied server streams directly +// and is not buffered by Cloudflare. This is limited to Enterprise Zones. +type ZoneSettingEditResponseZonesResponseBuffering struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesResponseBufferingID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesResponseBufferingValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesResponseBufferingEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesResponseBufferingJSON `json:"-"` +} + +// zoneSettingEditResponseZonesResponseBufferingJSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseZonesResponseBuffering] +type zoneSettingEditResponseZonesResponseBufferingJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesResponseBuffering) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesResponseBuffering) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesResponseBufferingID string + +const ( + ZoneSettingEditResponseZonesResponseBufferingIDResponseBuffering ZoneSettingEditResponseZonesResponseBufferingID = "response_buffering" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesResponseBufferingValue string + +const ( + ZoneSettingEditResponseZonesResponseBufferingValueOn ZoneSettingEditResponseZonesResponseBufferingValue = "on" + ZoneSettingEditResponseZonesResponseBufferingValueOff ZoneSettingEditResponseZonesResponseBufferingValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesResponseBufferingEditable bool + +const ( + ZoneSettingEditResponseZonesResponseBufferingEditableTrue ZoneSettingEditResponseZonesResponseBufferingEditable = true + ZoneSettingEditResponseZonesResponseBufferingEditableFalse ZoneSettingEditResponseZonesResponseBufferingEditable = false +) + +// Rocket Loader is a general-purpose asynchronous JavaScript optimisation that +// prioritises rendering your content while loading your site's Javascript +// asynchronously. Turning on Rocket Loader will immediately improve a web page's +// rendering time sometimes measured as Time to First Paint (TTFP), and also the +// `window.onload` time (assuming there is JavaScript on the page). This can have a +// positive impact on your Google search ranking. When turned on, Rocket Loader +// will automatically defer the loading of all Javascript referenced in your HTML, +// with no configuration required. Refer to +// [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) +// for more information. +type ZoneSettingEditResponseZonesRocketLoader struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesRocketLoaderID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesRocketLoaderValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesRocketLoaderEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesRocketLoaderJSON `json:"-"` +} + +// zoneSettingEditResponseZonesRocketLoaderJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseZonesRocketLoader] +type zoneSettingEditResponseZonesRocketLoaderJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesRocketLoader) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesRocketLoader) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesRocketLoaderID string + +const ( + ZoneSettingEditResponseZonesRocketLoaderIDRocketLoader ZoneSettingEditResponseZonesRocketLoaderID = "rocket_loader" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesRocketLoaderValue string + +const ( + ZoneSettingEditResponseZonesRocketLoaderValueOn ZoneSettingEditResponseZonesRocketLoaderValue = "on" + ZoneSettingEditResponseZonesRocketLoaderValueOff ZoneSettingEditResponseZonesRocketLoaderValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesRocketLoaderEditable bool + +const ( + ZoneSettingEditResponseZonesRocketLoaderEditableTrue ZoneSettingEditResponseZonesRocketLoaderEditable = true + ZoneSettingEditResponseZonesRocketLoaderEditableFalse ZoneSettingEditResponseZonesRocketLoaderEditable = false +) + +// [Automatic Platform Optimization for WordPress](https://developers.cloudflare.com/automatic-platform-optimization/) +// serves your WordPress site from Cloudflare's edge network and caches third-party +// fonts. +type ZoneSettingEditResponseZonesSchemasAutomaticPlatformOptimization struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesSchemasAutomaticPlatformOptimizationID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesSchemasAutomaticPlatformOptimizationValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesSchemasAutomaticPlatformOptimizationEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesSchemasAutomaticPlatformOptimizationJSON `json:"-"` +} + +// zoneSettingEditResponseZonesSchemasAutomaticPlatformOptimizationJSON contains +// the JSON metadata for the struct +// [ZoneSettingEditResponseZonesSchemasAutomaticPlatformOptimization] +type zoneSettingEditResponseZonesSchemasAutomaticPlatformOptimizationJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesSchemasAutomaticPlatformOptimization) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesSchemasAutomaticPlatformOptimization) implementsZoneSettingEditResponse() { +} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesSchemasAutomaticPlatformOptimizationID string + +const ( + ZoneSettingEditResponseZonesSchemasAutomaticPlatformOptimizationIDAutomaticPlatformOptimization ZoneSettingEditResponseZonesSchemasAutomaticPlatformOptimizationID = "automatic_platform_optimization" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesSchemasAutomaticPlatformOptimizationValue struct { + // Indicates whether or not + // [cache by device type](https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/) + // is enabled. + CacheByDeviceType bool `json:"cache_by_device_type,required"` + // Indicates whether or not Cloudflare proxy is enabled. + Cf bool `json:"cf,required"` + // Indicates whether or not Automatic Platform Optimization is enabled. + Enabled bool `json:"enabled,required"` + // An array of hostnames where Automatic Platform Optimization for WordPress is + // activated. + Hostnames []string `json:"hostnames,required" format:"hostname"` + // Indicates whether or not site is powered by WordPress. + Wordpress bool `json:"wordpress,required"` + // Indicates whether or not + // [Cloudflare for WordPress plugin](https://wordpress.org/plugins/cloudflare/) is + // installed. + WpPlugin bool `json:"wp_plugin,required"` + JSON zoneSettingEditResponseZonesSchemasAutomaticPlatformOptimizationValueJSON `json:"-"` +} + +// zoneSettingEditResponseZonesSchemasAutomaticPlatformOptimizationValueJSON +// contains the JSON metadata for the struct +// [ZoneSettingEditResponseZonesSchemasAutomaticPlatformOptimizationValue] +type zoneSettingEditResponseZonesSchemasAutomaticPlatformOptimizationValueJSON struct { + CacheByDeviceType apijson.Field + Cf apijson.Field + Enabled apijson.Field + Hostnames apijson.Field + Wordpress apijson.Field + WpPlugin apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesSchemasAutomaticPlatformOptimizationValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesSchemasAutomaticPlatformOptimizationEditable bool + +const ( + ZoneSettingEditResponseZonesSchemasAutomaticPlatformOptimizationEditableTrue ZoneSettingEditResponseZonesSchemasAutomaticPlatformOptimizationEditable = true + ZoneSettingEditResponseZonesSchemasAutomaticPlatformOptimizationEditableFalse ZoneSettingEditResponseZonesSchemasAutomaticPlatformOptimizationEditable = false +) + +// Cloudflare security header for a zone. +type ZoneSettingEditResponseZonesSecurityHeader struct { + // ID of the zone's security header. + ID ZoneSettingEditResponseZonesSecurityHeaderID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesSecurityHeaderValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesSecurityHeaderEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesSecurityHeaderJSON `json:"-"` +} + +// zoneSettingEditResponseZonesSecurityHeaderJSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseZonesSecurityHeader] +type zoneSettingEditResponseZonesSecurityHeaderJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesSecurityHeader) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesSecurityHeader) implementsZoneSettingEditResponse() {} + +// ID of the zone's security header. +type ZoneSettingEditResponseZonesSecurityHeaderID string + +const ( + ZoneSettingEditResponseZonesSecurityHeaderIDSecurityHeader ZoneSettingEditResponseZonesSecurityHeaderID = "security_header" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesSecurityHeaderValue struct { + // Strict Transport Security. + StrictTransportSecurity ZoneSettingEditResponseZonesSecurityHeaderValueStrictTransportSecurity `json:"strict_transport_security"` + JSON zoneSettingEditResponseZonesSecurityHeaderValueJSON `json:"-"` +} + +// zoneSettingEditResponseZonesSecurityHeaderValueJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseZonesSecurityHeaderValue] +type zoneSettingEditResponseZonesSecurityHeaderValueJSON struct { + StrictTransportSecurity apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesSecurityHeaderValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Strict Transport Security. +type ZoneSettingEditResponseZonesSecurityHeaderValueStrictTransportSecurity struct { + // Whether or not strict transport security is enabled. + Enabled bool `json:"enabled"` + // Include all subdomains for strict transport security. + IncludeSubdomains bool `json:"include_subdomains"` + // Max age in seconds of the strict transport security. + MaxAge float64 `json:"max_age"` + // Whether or not to include 'X-Content-Type-Options: nosniff' header. + Nosniff bool `json:"nosniff"` + JSON zoneSettingEditResponseZonesSecurityHeaderValueStrictTransportSecurityJSON `json:"-"` +} + +// zoneSettingEditResponseZonesSecurityHeaderValueStrictTransportSecurityJSON +// contains the JSON metadata for the struct +// [ZoneSettingEditResponseZonesSecurityHeaderValueStrictTransportSecurity] +type zoneSettingEditResponseZonesSecurityHeaderValueStrictTransportSecurityJSON struct { + Enabled apijson.Field + IncludeSubdomains apijson.Field + MaxAge apijson.Field + Nosniff apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesSecurityHeaderValueStrictTransportSecurity) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesSecurityHeaderEditable bool + +const ( + ZoneSettingEditResponseZonesSecurityHeaderEditableTrue ZoneSettingEditResponseZonesSecurityHeaderEditable = true + ZoneSettingEditResponseZonesSecurityHeaderEditableFalse ZoneSettingEditResponseZonesSecurityHeaderEditable = false +) + +// Choose the appropriate security profile for your website, which will +// automatically adjust each of the security settings. If you choose to customize +// an individual security setting, the profile will become Custom. +// (https://support.cloudflare.com/hc/en-us/articles/200170056). +type ZoneSettingEditResponseZonesSecurityLevel struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesSecurityLevelID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesSecurityLevelValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesSecurityLevelEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesSecurityLevelJSON `json:"-"` +} + +// zoneSettingEditResponseZonesSecurityLevelJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseZonesSecurityLevel] +type zoneSettingEditResponseZonesSecurityLevelJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesSecurityLevel) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesSecurityLevel) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesSecurityLevelID string + +const ( + ZoneSettingEditResponseZonesSecurityLevelIDSecurityLevel ZoneSettingEditResponseZonesSecurityLevelID = "security_level" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesSecurityLevelValue string + +const ( + ZoneSettingEditResponseZonesSecurityLevelValueOff ZoneSettingEditResponseZonesSecurityLevelValue = "off" + ZoneSettingEditResponseZonesSecurityLevelValueEssentiallyOff ZoneSettingEditResponseZonesSecurityLevelValue = "essentially_off" + ZoneSettingEditResponseZonesSecurityLevelValueLow ZoneSettingEditResponseZonesSecurityLevelValue = "low" + ZoneSettingEditResponseZonesSecurityLevelValueMedium ZoneSettingEditResponseZonesSecurityLevelValue = "medium" + ZoneSettingEditResponseZonesSecurityLevelValueHigh ZoneSettingEditResponseZonesSecurityLevelValue = "high" + ZoneSettingEditResponseZonesSecurityLevelValueUnderAttack ZoneSettingEditResponseZonesSecurityLevelValue = "under_attack" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesSecurityLevelEditable bool + +const ( + ZoneSettingEditResponseZonesSecurityLevelEditableTrue ZoneSettingEditResponseZonesSecurityLevelEditable = true + ZoneSettingEditResponseZonesSecurityLevelEditableFalse ZoneSettingEditResponseZonesSecurityLevelEditable = false +) + +// If there is sensitive content on your website that you want visible to real +// visitors, but that you want to hide from suspicious visitors, all you have to do +// is wrap the content with Cloudflare SSE tags. Wrap any content that you want to +// be excluded from suspicious visitors in the following SSE tags: +// . For example: Bad visitors won't see my phone +// number, 555-555-5555 . Note: SSE only will work with HTML. If you +// have HTML minification enabled, you won't see the SSE tags in your HTML source +// when it's served through Cloudflare. SSE will still function in this case, as +// Cloudflare's HTML minification and SSE functionality occur on-the-fly as the +// resource moves through our network to the visitor's computer. +// (https://support.cloudflare.com/hc/en-us/articles/200170036). +type ZoneSettingEditResponseZonesServerSideExclude struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesServerSideExcludeID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesServerSideExcludeValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesServerSideExcludeEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesServerSideExcludeJSON `json:"-"` +} + +// zoneSettingEditResponseZonesServerSideExcludeJSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseZonesServerSideExclude] +type zoneSettingEditResponseZonesServerSideExcludeJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesServerSideExclude) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesServerSideExclude) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesServerSideExcludeID string + +const ( + ZoneSettingEditResponseZonesServerSideExcludeIDServerSideExclude ZoneSettingEditResponseZonesServerSideExcludeID = "server_side_exclude" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesServerSideExcludeValue string + +const ( + ZoneSettingEditResponseZonesServerSideExcludeValueOn ZoneSettingEditResponseZonesServerSideExcludeValue = "on" + ZoneSettingEditResponseZonesServerSideExcludeValueOff ZoneSettingEditResponseZonesServerSideExcludeValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesServerSideExcludeEditable bool + +const ( + ZoneSettingEditResponseZonesServerSideExcludeEditableTrue ZoneSettingEditResponseZonesServerSideExcludeEditable = true + ZoneSettingEditResponseZonesServerSideExcludeEditableFalse ZoneSettingEditResponseZonesServerSideExcludeEditable = false +) + +// Allow SHA1 support. +type ZoneSettingEditResponseZonesSha1Support struct { + // Zone setting identifier. + ID ZoneSettingEditResponseZonesSha1SupportID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesSha1SupportValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesSha1SupportEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesSha1SupportJSON `json:"-"` +} + +// zoneSettingEditResponseZonesSha1SupportJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseZonesSha1Support] +type zoneSettingEditResponseZonesSha1SupportJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesSha1Support) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesSha1Support) implementsZoneSettingEditResponse() {} + +// Zone setting identifier. +type ZoneSettingEditResponseZonesSha1SupportID string + +const ( + ZoneSettingEditResponseZonesSha1SupportIDSha1Support ZoneSettingEditResponseZonesSha1SupportID = "sha1_support" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesSha1SupportValue string + +const ( + ZoneSettingEditResponseZonesSha1SupportValueOff ZoneSettingEditResponseZonesSha1SupportValue = "off" + ZoneSettingEditResponseZonesSha1SupportValueOn ZoneSettingEditResponseZonesSha1SupportValue = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesSha1SupportEditable bool + +const ( + ZoneSettingEditResponseZonesSha1SupportEditableTrue ZoneSettingEditResponseZonesSha1SupportEditable = true + ZoneSettingEditResponseZonesSha1SupportEditableFalse ZoneSettingEditResponseZonesSha1SupportEditable = false +) + +// Cloudflare will treat files with the same query strings as the same file in +// cache, regardless of the order of the query strings. This is limited to +// Enterprise Zones. +type ZoneSettingEditResponseZonesSortQueryStringForCache struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesSortQueryStringForCacheID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesSortQueryStringForCacheValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesSortQueryStringForCacheEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesSortQueryStringForCacheJSON `json:"-"` +} + +// zoneSettingEditResponseZonesSortQueryStringForCacheJSON contains the JSON +// metadata for the struct [ZoneSettingEditResponseZonesSortQueryStringForCache] +type zoneSettingEditResponseZonesSortQueryStringForCacheJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesSortQueryStringForCache) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesSortQueryStringForCache) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesSortQueryStringForCacheID string + +const ( + ZoneSettingEditResponseZonesSortQueryStringForCacheIDSortQueryStringForCache ZoneSettingEditResponseZonesSortQueryStringForCacheID = "sort_query_string_for_cache" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesSortQueryStringForCacheValue string + +const ( + ZoneSettingEditResponseZonesSortQueryStringForCacheValueOn ZoneSettingEditResponseZonesSortQueryStringForCacheValue = "on" + ZoneSettingEditResponseZonesSortQueryStringForCacheValueOff ZoneSettingEditResponseZonesSortQueryStringForCacheValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesSortQueryStringForCacheEditable bool + +const ( + ZoneSettingEditResponseZonesSortQueryStringForCacheEditableTrue ZoneSettingEditResponseZonesSortQueryStringForCacheEditable = true + ZoneSettingEditResponseZonesSortQueryStringForCacheEditableFalse ZoneSettingEditResponseZonesSortQueryStringForCacheEditable = false +) + +// SSL encrypts your visitor's connection and safeguards credit card numbers and +// other personal data to and from your website. SSL can take up to 5 minutes to +// fully activate. Requires Cloudflare active on your root domain or www domain. +// Off: no SSL between the visitor and Cloudflare, and no SSL between Cloudflare +// and your web server (all HTTP traffic). Flexible: SSL between the visitor and +// Cloudflare -- visitor sees HTTPS on your site, but no SSL between Cloudflare and +// your web server. You don't need to have an SSL cert on your web server, but your +// vistors will still see the site as being HTTPS enabled. Full: SSL between the +// visitor and Cloudflare -- visitor sees HTTPS on your site, and SSL between +// Cloudflare and your web server. You'll need to have your own SSL cert or +// self-signed cert at the very least. Full (Strict): SSL between the visitor and +// Cloudflare -- visitor sees HTTPS on your site, and SSL between Cloudflare and +// your web server. You'll need to have a valid SSL certificate installed on your +// web server. This certificate must be signed by a certificate authority, have an +// expiration date in the future, and respond for the request domain name +// (hostname). (https://support.cloudflare.com/hc/en-us/articles/200170416). +type ZoneSettingEditResponseZonesSSL struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesSSLID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesSSLValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesSSLEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesSSLJSON `json:"-"` +} + +// zoneSettingEditResponseZonesSSLJSON contains the JSON metadata for the struct +// [ZoneSettingEditResponseZonesSSL] +type zoneSettingEditResponseZonesSSLJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesSSL) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesSSL) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesSSLID string + +const ( + ZoneSettingEditResponseZonesSSLIDSSL ZoneSettingEditResponseZonesSSLID = "ssl" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesSSLValue string + +const ( + ZoneSettingEditResponseZonesSSLValueOff ZoneSettingEditResponseZonesSSLValue = "off" + ZoneSettingEditResponseZonesSSLValueFlexible ZoneSettingEditResponseZonesSSLValue = "flexible" + ZoneSettingEditResponseZonesSSLValueFull ZoneSettingEditResponseZonesSSLValue = "full" + ZoneSettingEditResponseZonesSSLValueStrict ZoneSettingEditResponseZonesSSLValue = "strict" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesSSLEditable bool + +const ( + ZoneSettingEditResponseZonesSSLEditableTrue ZoneSettingEditResponseZonesSSLEditable = true + ZoneSettingEditResponseZonesSSLEditableFalse ZoneSettingEditResponseZonesSSLEditable = false +) + +// Enrollment in the SSL/TLS Recommender service which tries to detect and +// recommend (by sending periodic emails) the most secure SSL/TLS setting your +// origin servers support. +type ZoneSettingEditResponseZonesSSLRecommender struct { + // Enrollment value for SSL/TLS Recommender. + ID ZoneSettingEditResponseZonesSSLRecommenderID `json:"id"` + // ssl-recommender enrollment setting. + Enabled bool `json:"enabled"` + JSON zoneSettingEditResponseZonesSSLRecommenderJSON `json:"-"` +} + +// zoneSettingEditResponseZonesSSLRecommenderJSON contains the JSON metadata for +// the struct [ZoneSettingEditResponseZonesSSLRecommender] +type zoneSettingEditResponseZonesSSLRecommenderJSON struct { + ID apijson.Field + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesSSLRecommender) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesSSLRecommender) implementsZoneSettingEditResponse() {} + +// Enrollment value for SSL/TLS Recommender. +type ZoneSettingEditResponseZonesSSLRecommenderID string + +const ( + ZoneSettingEditResponseZonesSSLRecommenderIDSSLRecommender ZoneSettingEditResponseZonesSSLRecommenderID = "ssl_recommender" +) + +// Only allows TLS1.2. +type ZoneSettingEditResponseZonesTLS1_2Only struct { + // Zone setting identifier. + ID ZoneSettingEditResponseZonesTLS1_2OnlyID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesTLS1_2OnlyValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesTLS1_2OnlyEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesTls1_2OnlyJSON `json:"-"` +} + +// zoneSettingEditResponseZonesTls1_2OnlyJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseZonesTLS1_2Only] +type zoneSettingEditResponseZonesTls1_2OnlyJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesTLS1_2Only) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesTLS1_2Only) implementsZoneSettingEditResponse() {} + +// Zone setting identifier. +type ZoneSettingEditResponseZonesTLS1_2OnlyID string + +const ( + ZoneSettingEditResponseZonesTLS1_2OnlyIDTLS1_2Only ZoneSettingEditResponseZonesTLS1_2OnlyID = "tls_1_2_only" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesTLS1_2OnlyValue string + +const ( + ZoneSettingEditResponseZonesTLS1_2OnlyValueOff ZoneSettingEditResponseZonesTLS1_2OnlyValue = "off" + ZoneSettingEditResponseZonesTLS1_2OnlyValueOn ZoneSettingEditResponseZonesTLS1_2OnlyValue = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesTLS1_2OnlyEditable bool + +const ( + ZoneSettingEditResponseZonesTLS1_2OnlyEditableTrue ZoneSettingEditResponseZonesTLS1_2OnlyEditable = true + ZoneSettingEditResponseZonesTLS1_2OnlyEditableFalse ZoneSettingEditResponseZonesTLS1_2OnlyEditable = false +) + +// Enables Crypto TLS 1.3 feature for a zone. +type ZoneSettingEditResponseZonesTLS1_3 struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesTLS1_3ID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesTLS1_3Value `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesTLS1_3Editable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesTls1_3JSON `json:"-"` +} + +// zoneSettingEditResponseZonesTls1_3JSON contains the JSON metadata for the struct +// [ZoneSettingEditResponseZonesTLS1_3] +type zoneSettingEditResponseZonesTls1_3JSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesTLS1_3) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesTLS1_3) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesTLS1_3ID string + +const ( + ZoneSettingEditResponseZonesTLS1_3IDTLS1_3 ZoneSettingEditResponseZonesTLS1_3ID = "tls_1_3" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesTLS1_3Value string + +const ( + ZoneSettingEditResponseZonesTLS1_3ValueOn ZoneSettingEditResponseZonesTLS1_3Value = "on" + ZoneSettingEditResponseZonesTLS1_3ValueOff ZoneSettingEditResponseZonesTLS1_3Value = "off" + ZoneSettingEditResponseZonesTLS1_3ValueZrt ZoneSettingEditResponseZonesTLS1_3Value = "zrt" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesTLS1_3Editable bool + +const ( + ZoneSettingEditResponseZonesTLS1_3EditableTrue ZoneSettingEditResponseZonesTLS1_3Editable = true + ZoneSettingEditResponseZonesTLS1_3EditableFalse ZoneSettingEditResponseZonesTLS1_3Editable = false +) + +// TLS Client Auth requires Cloudflare to connect to your origin server using a +// client certificate (Enterprise Only). +type ZoneSettingEditResponseZonesTLSClientAuth struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesTLSClientAuthID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesTLSClientAuthValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesTLSClientAuthEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesTLSClientAuthJSON `json:"-"` +} + +// zoneSettingEditResponseZonesTLSClientAuthJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseZonesTLSClientAuth] +type zoneSettingEditResponseZonesTLSClientAuthJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesTLSClientAuth) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesTLSClientAuth) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesTLSClientAuthID string + +const ( + ZoneSettingEditResponseZonesTLSClientAuthIDTLSClientAuth ZoneSettingEditResponseZonesTLSClientAuthID = "tls_client_auth" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesTLSClientAuthValue string + +const ( + ZoneSettingEditResponseZonesTLSClientAuthValueOn ZoneSettingEditResponseZonesTLSClientAuthValue = "on" + ZoneSettingEditResponseZonesTLSClientAuthValueOff ZoneSettingEditResponseZonesTLSClientAuthValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesTLSClientAuthEditable bool + +const ( + ZoneSettingEditResponseZonesTLSClientAuthEditableTrue ZoneSettingEditResponseZonesTLSClientAuthEditable = true + ZoneSettingEditResponseZonesTLSClientAuthEditableFalse ZoneSettingEditResponseZonesTLSClientAuthEditable = false +) + +// Allows customer to continue to use True Client IP (Akamai feature) in the +// headers we send to the origin. This is limited to Enterprise Zones. +type ZoneSettingEditResponseZonesTrueClientIPHeader struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesTrueClientIPHeaderID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesTrueClientIPHeaderValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesTrueClientIPHeaderEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesTrueClientIPHeaderJSON `json:"-"` +} + +// zoneSettingEditResponseZonesTrueClientIPHeaderJSON contains the JSON metadata +// for the struct [ZoneSettingEditResponseZonesTrueClientIPHeader] +type zoneSettingEditResponseZonesTrueClientIPHeaderJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesTrueClientIPHeader) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesTrueClientIPHeader) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesTrueClientIPHeaderID string + +const ( + ZoneSettingEditResponseZonesTrueClientIPHeaderIDTrueClientIPHeader ZoneSettingEditResponseZonesTrueClientIPHeaderID = "true_client_ip_header" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesTrueClientIPHeaderValue string + +const ( + ZoneSettingEditResponseZonesTrueClientIPHeaderValueOn ZoneSettingEditResponseZonesTrueClientIPHeaderValue = "on" + ZoneSettingEditResponseZonesTrueClientIPHeaderValueOff ZoneSettingEditResponseZonesTrueClientIPHeaderValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesTrueClientIPHeaderEditable bool + +const ( + ZoneSettingEditResponseZonesTrueClientIPHeaderEditableTrue ZoneSettingEditResponseZonesTrueClientIPHeaderEditable = true + ZoneSettingEditResponseZonesTrueClientIPHeaderEditableFalse ZoneSettingEditResponseZonesTrueClientIPHeaderEditable = false +) + +// The WAF examines HTTP requests to your website. It inspects both GET and POST +// requests and applies rules to help filter out illegitimate traffic from +// legitimate website visitors. The Cloudflare WAF inspects website addresses or +// URLs to detect anything out of the ordinary. If the Cloudflare WAF determines +// suspicious user behavior, then the WAF will 'challenge' the web visitor with a +// page that asks them to submit a CAPTCHA successfully to continue their action. +// If the challenge is failed, the action will be stopped. What this means is that +// Cloudflare's WAF will block any traffic identified as illegitimate before it +// reaches your origin web server. +// (https://support.cloudflare.com/hc/en-us/articles/200172016). +type ZoneSettingEditResponseZonesWAF struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesWAFID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesWAFValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesWAFEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesWAFJSON `json:"-"` +} + +// zoneSettingEditResponseZonesWAFJSON contains the JSON metadata for the struct +// [ZoneSettingEditResponseZonesWAF] +type zoneSettingEditResponseZonesWAFJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesWAF) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesWAF) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesWAFID string + +const ( + ZoneSettingEditResponseZonesWAFIDWAF ZoneSettingEditResponseZonesWAFID = "waf" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesWAFValue string + +const ( + ZoneSettingEditResponseZonesWAFValueOn ZoneSettingEditResponseZonesWAFValue = "on" + ZoneSettingEditResponseZonesWAFValueOff ZoneSettingEditResponseZonesWAFValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesWAFEditable bool + +const ( + ZoneSettingEditResponseZonesWAFEditableTrue ZoneSettingEditResponseZonesWAFEditable = true + ZoneSettingEditResponseZonesWAFEditableFalse ZoneSettingEditResponseZonesWAFEditable = false +) + +// When the client requesting the image supports the WebP image codec, and WebP +// offers a performance advantage over the original image format, Cloudflare will +// serve a WebP version of the original image. +type ZoneSettingEditResponseZonesWebp struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesWebpID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesWebpValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesWebpEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesWebpJSON `json:"-"` +} + +// zoneSettingEditResponseZonesWebpJSON contains the JSON metadata for the struct +// [ZoneSettingEditResponseZonesWebp] +type zoneSettingEditResponseZonesWebpJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesWebp) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesWebp) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesWebpID string + +const ( + ZoneSettingEditResponseZonesWebpIDWebp ZoneSettingEditResponseZonesWebpID = "webp" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesWebpValue string + +const ( + ZoneSettingEditResponseZonesWebpValueOff ZoneSettingEditResponseZonesWebpValue = "off" + ZoneSettingEditResponseZonesWebpValueOn ZoneSettingEditResponseZonesWebpValue = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesWebpEditable bool + +const ( + ZoneSettingEditResponseZonesWebpEditableTrue ZoneSettingEditResponseZonesWebpEditable = true + ZoneSettingEditResponseZonesWebpEditableFalse ZoneSettingEditResponseZonesWebpEditable = false +) + +// WebSockets are open connections sustained between the client and the origin +// server. Inside a WebSockets connection, the client and the origin can pass data +// back and forth without having to reestablish sessions. This makes exchanging +// data within a WebSockets connection fast. WebSockets are often used for +// real-time applications such as live chat and gaming. For more information refer +// to +// [Can I use Cloudflare with Websockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Can-I-use-Cloudflare-with-WebSockets-). +type ZoneSettingEditResponseZonesWebsockets struct { + // ID of the zone setting. + ID ZoneSettingEditResponseZonesWebsocketsID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEditResponseZonesWebsocketsValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEditResponseZonesWebsocketsEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEditResponseZonesWebsocketsJSON `json:"-"` +} + +// zoneSettingEditResponseZonesWebsocketsJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseZonesWebsockets] +type zoneSettingEditResponseZonesWebsocketsJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseZonesWebsockets) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r ZoneSettingEditResponseZonesWebsockets) implementsZoneSettingEditResponse() {} + +// ID of the zone setting. +type ZoneSettingEditResponseZonesWebsocketsID string + +const ( + ZoneSettingEditResponseZonesWebsocketsIDWebsockets ZoneSettingEditResponseZonesWebsocketsID = "websockets" +) + +// Current value of the zone setting. +type ZoneSettingEditResponseZonesWebsocketsValue string + +const ( + ZoneSettingEditResponseZonesWebsocketsValueOff ZoneSettingEditResponseZonesWebsocketsValue = "off" + ZoneSettingEditResponseZonesWebsocketsValueOn ZoneSettingEditResponseZonesWebsocketsValue = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditResponseZonesWebsocketsEditable bool + +const ( + ZoneSettingEditResponseZonesWebsocketsEditableTrue ZoneSettingEditResponseZonesWebsocketsEditable = true + ZoneSettingEditResponseZonesWebsocketsEditableFalse ZoneSettingEditResponseZonesWebsocketsEditable = false +) + +type ZoneSettingListParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingListResponseEnvelope struct { + Errors []ZoneSettingListResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingListResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + Result []ZoneSettingListResponse `json:"result"` + JSON zoneSettingListResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingListResponseEnvelopeJSON contains the JSON metadata for the struct +// [ZoneSettingListResponseEnvelope] +type zoneSettingListResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingListResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingListResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingListResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseEnvelopeErrors] +type zoneSettingListResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingListResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingListResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingListResponseEnvelopeMessagesJSON contains the JSON metadata for the +// struct [ZoneSettingListResponseEnvelopeMessages] +type zoneSettingListResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingListResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // One or more zone setting objects. Must contain an ID and a value. + Items param.Field[[]ZoneSettingEditParamsItem] `json:"items,required"` +} + +func (r ZoneSettingEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// 0-RTT session resumption enabled for this zone. +// +// Satisfied by [ZoneSettingEditParamsItemsZones0rtt], +// [ZoneSettingEditParamsItemsZonesAdvancedDDOS], +// [ZoneSettingEditParamsItemsZonesAlwaysOnline], +// [ZoneSettingEditParamsItemsZonesAlwaysUseHTTPS], +// [ZoneSettingEditParamsItemsZonesAutomaticHTTPSRewrites], +// [ZoneSettingEditParamsItemsZonesBrotli], +// [ZoneSettingEditParamsItemsZonesBrowserCacheTTL], +// [ZoneSettingEditParamsItemsZonesBrowserCheck], +// [ZoneSettingEditParamsItemsZonesCacheLevel], +// [ZoneSettingEditParamsItemsZonesChallengeTTL], +// [ZoneSettingEditParamsItemsZonesCiphers], +// [ZoneSettingEditParamsItemsZonesCnameFlattening], +// [ZoneSettingEditParamsItemsZonesDevelopmentMode], +// [ZoneSettingEditParamsItemsZonesEarlyHints], +// [ZoneSettingEditParamsItemsZonesEdgeCacheTTL], +// [ZoneSettingEditParamsItemsZonesEmailObfuscation], +// [ZoneSettingEditParamsItemsZonesH2Prioritization], +// [ZoneSettingEditParamsItemsZonesHotlinkProtection], +// [ZoneSettingEditParamsItemsZonesHTTP2], [ZoneSettingEditParamsItemsZonesHTTP3], +// [ZoneSettingEditParamsItemsZonesImageResizing], +// [ZoneSettingEditParamsItemsZonesIPGeolocation], +// [ZoneSettingEditParamsItemsZonesIPV6], +// [ZoneSettingEditParamsItemsZonesMaxUpload], +// [ZoneSettingEditParamsItemsZonesMinTLSVersion], +// [ZoneSettingEditParamsItemsZonesMinify], +// [ZoneSettingEditParamsItemsZonesMirage], +// [ZoneSettingEditParamsItemsZonesMobileRedirect], +// [ZoneSettingEditParamsItemsZonesNEL], +// [ZoneSettingEditParamsItemsZonesOpportunisticEncryption], +// [ZoneSettingEditParamsItemsZonesOpportunisticOnion], +// [ZoneSettingEditParamsItemsZonesOrangeToOrange], +// [ZoneSettingEditParamsItemsZonesOriginErrorPagePassThru], +// [ZoneSettingEditParamsItemsZonesPolish], +// [ZoneSettingEditParamsItemsZonesPrefetchPreload], +// [ZoneSettingEditParamsItemsZonesProxyReadTimeout], +// [ZoneSettingEditParamsItemsZonesPseudoIPV4], +// [ZoneSettingEditParamsItemsZonesResponseBuffering], +// [ZoneSettingEditParamsItemsZonesRocketLoader], +// [ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimization], +// [ZoneSettingEditParamsItemsZonesSecurityHeader], +// [ZoneSettingEditParamsItemsZonesSecurityLevel], +// [ZoneSettingEditParamsItemsZonesServerSideExclude], +// [ZoneSettingEditParamsItemsZonesSha1Support], +// [ZoneSettingEditParamsItemsZonesSortQueryStringForCache], +// [ZoneSettingEditParamsItemsZonesSSL], +// [ZoneSettingEditParamsItemsZonesSSLRecommender], +// [ZoneSettingEditParamsItemsZonesTLS1_2Only], +// [ZoneSettingEditParamsItemsZonesTLS1_3], +// [ZoneSettingEditParamsItemsZonesTLSClientAuth], +// [ZoneSettingEditParamsItemsZonesTrueClientIPHeader], +// [ZoneSettingEditParamsItemsZonesWAF], [ZoneSettingEditParamsItemsZonesWebp], +// [ZoneSettingEditParamsItemsZonesWebsockets]. +type ZoneSettingEditParamsItem interface { + implementsZoneSettingEditParamsItem() +} + +// 0-RTT session resumption enabled for this zone. +type ZoneSettingEditParamsItemsZones0rtt struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZones0rttID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZones0rttValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZones0rtt) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZones0rtt) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZones0rttID string + +const ( + ZoneSettingEditParamsItemsZones0rttID0rtt ZoneSettingEditParamsItemsZones0rttID = "0rtt" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZones0rttValue string + +const ( + ZoneSettingEditParamsItemsZones0rttValueOn ZoneSettingEditParamsItemsZones0rttValue = "on" + ZoneSettingEditParamsItemsZones0rttValueOff ZoneSettingEditParamsItemsZones0rttValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZones0rttEditable bool + +const ( + ZoneSettingEditParamsItemsZones0rttEditableTrue ZoneSettingEditParamsItemsZones0rttEditable = true + ZoneSettingEditParamsItemsZones0rttEditableFalse ZoneSettingEditParamsItemsZones0rttEditable = false +) + +// Advanced protection from Distributed Denial of Service (DDoS) attacks on your +// website. This is an uneditable value that is 'on' in the case of Business and +// Enterprise zones. +type ZoneSettingEditParamsItemsZonesAdvancedDDOS struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesAdvancedDDOSID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesAdvancedDDOSValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesAdvancedDDOS) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesAdvancedDDOS) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesAdvancedDDOSID string + +const ( + ZoneSettingEditParamsItemsZonesAdvancedDDOSIDAdvancedDDOS ZoneSettingEditParamsItemsZonesAdvancedDDOSID = "advanced_ddos" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesAdvancedDDOSValue string + +const ( + ZoneSettingEditParamsItemsZonesAdvancedDDOSValueOn ZoneSettingEditParamsItemsZonesAdvancedDDOSValue = "on" + ZoneSettingEditParamsItemsZonesAdvancedDDOSValueOff ZoneSettingEditParamsItemsZonesAdvancedDDOSValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesAdvancedDDOSEditable bool + +const ( + ZoneSettingEditParamsItemsZonesAdvancedDDOSEditableTrue ZoneSettingEditParamsItemsZonesAdvancedDDOSEditable = true + ZoneSettingEditParamsItemsZonesAdvancedDDOSEditableFalse ZoneSettingEditParamsItemsZonesAdvancedDDOSEditable = false +) + +// When enabled, Cloudflare serves limited copies of web pages available from the +// [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is +// offline. Refer to +// [Always Online](https://developers.cloudflare.com/cache/about/always-online) for +// more information. +type ZoneSettingEditParamsItemsZonesAlwaysOnline struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesAlwaysOnlineID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesAlwaysOnlineValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesAlwaysOnline) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesAlwaysOnline) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesAlwaysOnlineID string + +const ( + ZoneSettingEditParamsItemsZonesAlwaysOnlineIDAlwaysOnline ZoneSettingEditParamsItemsZonesAlwaysOnlineID = "always_online" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesAlwaysOnlineValue string + +const ( + ZoneSettingEditParamsItemsZonesAlwaysOnlineValueOn ZoneSettingEditParamsItemsZonesAlwaysOnlineValue = "on" + ZoneSettingEditParamsItemsZonesAlwaysOnlineValueOff ZoneSettingEditParamsItemsZonesAlwaysOnlineValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesAlwaysOnlineEditable bool + +const ( + ZoneSettingEditParamsItemsZonesAlwaysOnlineEditableTrue ZoneSettingEditParamsItemsZonesAlwaysOnlineEditable = true + ZoneSettingEditParamsItemsZonesAlwaysOnlineEditableFalse ZoneSettingEditParamsItemsZonesAlwaysOnlineEditable = false +) + +// Reply to all requests for URLs that use "http" with a 301 redirect to the +// equivalent "https" URL. If you only want to redirect for a subset of requests, +// consider creating an "Always use HTTPS" page rule. +type ZoneSettingEditParamsItemsZonesAlwaysUseHTTPS struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesAlwaysUseHTTPSID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesAlwaysUseHTTPSValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesAlwaysUseHTTPS) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesAlwaysUseHTTPS) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesAlwaysUseHTTPSID string + +const ( + ZoneSettingEditParamsItemsZonesAlwaysUseHTTPSIDAlwaysUseHTTPS ZoneSettingEditParamsItemsZonesAlwaysUseHTTPSID = "always_use_https" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesAlwaysUseHTTPSValue string + +const ( + ZoneSettingEditParamsItemsZonesAlwaysUseHTTPSValueOn ZoneSettingEditParamsItemsZonesAlwaysUseHTTPSValue = "on" + ZoneSettingEditParamsItemsZonesAlwaysUseHTTPSValueOff ZoneSettingEditParamsItemsZonesAlwaysUseHTTPSValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesAlwaysUseHTTPSEditable bool + +const ( + ZoneSettingEditParamsItemsZonesAlwaysUseHTTPSEditableTrue ZoneSettingEditParamsItemsZonesAlwaysUseHTTPSEditable = true + ZoneSettingEditParamsItemsZonesAlwaysUseHTTPSEditableFalse ZoneSettingEditParamsItemsZonesAlwaysUseHTTPSEditable = false +) + +// Enable the Automatic HTTPS Rewrites feature for this zone. +type ZoneSettingEditParamsItemsZonesAutomaticHTTPSRewrites struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesAutomaticHTTPSRewritesID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesAutomaticHTTPSRewritesValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesAutomaticHTTPSRewrites) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesAutomaticHTTPSRewrites) implementsZoneSettingEditParamsItem() { +} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesAutomaticHTTPSRewritesID string + +const ( + ZoneSettingEditParamsItemsZonesAutomaticHTTPSRewritesIDAutomaticHTTPSRewrites ZoneSettingEditParamsItemsZonesAutomaticHTTPSRewritesID = "automatic_https_rewrites" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesAutomaticHTTPSRewritesValue string + +const ( + ZoneSettingEditParamsItemsZonesAutomaticHTTPSRewritesValueOn ZoneSettingEditParamsItemsZonesAutomaticHTTPSRewritesValue = "on" + ZoneSettingEditParamsItemsZonesAutomaticHTTPSRewritesValueOff ZoneSettingEditParamsItemsZonesAutomaticHTTPSRewritesValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesAutomaticHTTPSRewritesEditable bool + +const ( + ZoneSettingEditParamsItemsZonesAutomaticHTTPSRewritesEditableTrue ZoneSettingEditParamsItemsZonesAutomaticHTTPSRewritesEditable = true + ZoneSettingEditParamsItemsZonesAutomaticHTTPSRewritesEditableFalse ZoneSettingEditParamsItemsZonesAutomaticHTTPSRewritesEditable = false +) + +// When the client requesting an asset supports the Brotli compression algorithm, +// Cloudflare will serve a Brotli compressed version of the asset. +type ZoneSettingEditParamsItemsZonesBrotli struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesBrotliID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesBrotliValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesBrotli) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesBrotli) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesBrotliID string + +const ( + ZoneSettingEditParamsItemsZonesBrotliIDBrotli ZoneSettingEditParamsItemsZonesBrotliID = "brotli" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesBrotliValue string + +const ( + ZoneSettingEditParamsItemsZonesBrotliValueOff ZoneSettingEditParamsItemsZonesBrotliValue = "off" + ZoneSettingEditParamsItemsZonesBrotliValueOn ZoneSettingEditParamsItemsZonesBrotliValue = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesBrotliEditable bool + +const ( + ZoneSettingEditParamsItemsZonesBrotliEditableTrue ZoneSettingEditParamsItemsZonesBrotliEditable = true + ZoneSettingEditParamsItemsZonesBrotliEditableFalse ZoneSettingEditParamsItemsZonesBrotliEditable = false +) + +// Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources +// will remain on your visitors' computers. Cloudflare will honor any larger times +// specified by your server. +// (https://support.cloudflare.com/hc/en-us/articles/200168276). +type ZoneSettingEditParamsItemsZonesBrowserCacheTTL struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesBrowserCacheTTLID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesBrowserCacheTTL) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesBrowserCacheTTL) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesBrowserCacheTTLID string + +const ( + ZoneSettingEditParamsItemsZonesBrowserCacheTTLIDBrowserCacheTTL ZoneSettingEditParamsItemsZonesBrowserCacheTTLID = "browser_cache_ttl" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue float64 + +const ( + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue0 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 0 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue30 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 30 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue60 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 60 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue120 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 120 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue300 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 300 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue1200 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 1200 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue1800 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 1800 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue3600 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 3600 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue7200 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 7200 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue10800 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 10800 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue14400 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 14400 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue18000 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 18000 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue28800 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 28800 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue43200 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 43200 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue57600 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 57600 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue72000 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 72000 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue86400 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 86400 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue172800 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 172800 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue259200 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 259200 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue345600 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 345600 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue432000 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 432000 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue691200 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 691200 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue1382400 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 1382400 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue2073600 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 2073600 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue2678400 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 2678400 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue5356800 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 5356800 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue16070400 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 16070400 + ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue31536000 ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue = 31536000 +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesBrowserCacheTTLEditable bool + +const ( + ZoneSettingEditParamsItemsZonesBrowserCacheTTLEditableTrue ZoneSettingEditParamsItemsZonesBrowserCacheTTLEditable = true + ZoneSettingEditParamsItemsZonesBrowserCacheTTLEditableFalse ZoneSettingEditParamsItemsZonesBrowserCacheTTLEditable = false +) + +// Browser Integrity Check is similar to Bad Behavior and looks for common HTTP +// headers abused most commonly by spammers and denies access to your page. It will +// also challenge visitors that do not have a user agent or a non standard user +// agent (also commonly used by abuse bots, crawlers or visitors). +// (https://support.cloudflare.com/hc/en-us/articles/200170086). +type ZoneSettingEditParamsItemsZonesBrowserCheck struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesBrowserCheckID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesBrowserCheckValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesBrowserCheck) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesBrowserCheck) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesBrowserCheckID string + +const ( + ZoneSettingEditParamsItemsZonesBrowserCheckIDBrowserCheck ZoneSettingEditParamsItemsZonesBrowserCheckID = "browser_check" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesBrowserCheckValue string + +const ( + ZoneSettingEditParamsItemsZonesBrowserCheckValueOn ZoneSettingEditParamsItemsZonesBrowserCheckValue = "on" + ZoneSettingEditParamsItemsZonesBrowserCheckValueOff ZoneSettingEditParamsItemsZonesBrowserCheckValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesBrowserCheckEditable bool + +const ( + ZoneSettingEditParamsItemsZonesBrowserCheckEditableTrue ZoneSettingEditParamsItemsZonesBrowserCheckEditable = true + ZoneSettingEditParamsItemsZonesBrowserCheckEditableFalse ZoneSettingEditParamsItemsZonesBrowserCheckEditable = false +) + +// Cache Level functions based off the setting level. The basic setting will cache +// most static resources (i.e., css, images, and JavaScript). The simplified +// setting will ignore the query string when delivering a cached resource. The +// aggressive setting will cache all static resources, including ones with a query +// string. (https://support.cloudflare.com/hc/en-us/articles/200168256). +type ZoneSettingEditParamsItemsZonesCacheLevel struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesCacheLevelID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesCacheLevelValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesCacheLevel) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesCacheLevel) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesCacheLevelID string + +const ( + ZoneSettingEditParamsItemsZonesCacheLevelIDCacheLevel ZoneSettingEditParamsItemsZonesCacheLevelID = "cache_level" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesCacheLevelValue string + +const ( + ZoneSettingEditParamsItemsZonesCacheLevelValueAggressive ZoneSettingEditParamsItemsZonesCacheLevelValue = "aggressive" + ZoneSettingEditParamsItemsZonesCacheLevelValueBasic ZoneSettingEditParamsItemsZonesCacheLevelValue = "basic" + ZoneSettingEditParamsItemsZonesCacheLevelValueSimplified ZoneSettingEditParamsItemsZonesCacheLevelValue = "simplified" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesCacheLevelEditable bool + +const ( + ZoneSettingEditParamsItemsZonesCacheLevelEditableTrue ZoneSettingEditParamsItemsZonesCacheLevelEditable = true + ZoneSettingEditParamsItemsZonesCacheLevelEditableFalse ZoneSettingEditParamsItemsZonesCacheLevelEditable = false +) + +// Specify how long a visitor is allowed access to your site after successfully +// completing a challenge (such as a CAPTCHA). After the TTL has expired the +// visitor will have to complete a new challenge. We recommend a 15 - 45 minute +// setting and will attempt to honor any setting above 45 minutes. +// (https://support.cloudflare.com/hc/en-us/articles/200170136). +type ZoneSettingEditParamsItemsZonesChallengeTTL struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesChallengeTTLID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesChallengeTTLValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesChallengeTTL) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesChallengeTTL) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesChallengeTTLID string + +const ( + ZoneSettingEditParamsItemsZonesChallengeTTLIDChallengeTTL ZoneSettingEditParamsItemsZonesChallengeTTLID = "challenge_ttl" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesChallengeTTLValue float64 + +const ( + ZoneSettingEditParamsItemsZonesChallengeTTLValue300 ZoneSettingEditParamsItemsZonesChallengeTTLValue = 300 + ZoneSettingEditParamsItemsZonesChallengeTTLValue900 ZoneSettingEditParamsItemsZonesChallengeTTLValue = 900 + ZoneSettingEditParamsItemsZonesChallengeTTLValue1800 ZoneSettingEditParamsItemsZonesChallengeTTLValue = 1800 + ZoneSettingEditParamsItemsZonesChallengeTTLValue2700 ZoneSettingEditParamsItemsZonesChallengeTTLValue = 2700 + ZoneSettingEditParamsItemsZonesChallengeTTLValue3600 ZoneSettingEditParamsItemsZonesChallengeTTLValue = 3600 + ZoneSettingEditParamsItemsZonesChallengeTTLValue7200 ZoneSettingEditParamsItemsZonesChallengeTTLValue = 7200 + ZoneSettingEditParamsItemsZonesChallengeTTLValue10800 ZoneSettingEditParamsItemsZonesChallengeTTLValue = 10800 + ZoneSettingEditParamsItemsZonesChallengeTTLValue14400 ZoneSettingEditParamsItemsZonesChallengeTTLValue = 14400 + ZoneSettingEditParamsItemsZonesChallengeTTLValue28800 ZoneSettingEditParamsItemsZonesChallengeTTLValue = 28800 + ZoneSettingEditParamsItemsZonesChallengeTTLValue57600 ZoneSettingEditParamsItemsZonesChallengeTTLValue = 57600 + ZoneSettingEditParamsItemsZonesChallengeTTLValue86400 ZoneSettingEditParamsItemsZonesChallengeTTLValue = 86400 + ZoneSettingEditParamsItemsZonesChallengeTTLValue604800 ZoneSettingEditParamsItemsZonesChallengeTTLValue = 604800 + ZoneSettingEditParamsItemsZonesChallengeTTLValue2592000 ZoneSettingEditParamsItemsZonesChallengeTTLValue = 2592000 + ZoneSettingEditParamsItemsZonesChallengeTTLValue31536000 ZoneSettingEditParamsItemsZonesChallengeTTLValue = 31536000 +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesChallengeTTLEditable bool + +const ( + ZoneSettingEditParamsItemsZonesChallengeTTLEditableTrue ZoneSettingEditParamsItemsZonesChallengeTTLEditable = true + ZoneSettingEditParamsItemsZonesChallengeTTLEditableFalse ZoneSettingEditParamsItemsZonesChallengeTTLEditable = false +) + +// An allowlist of ciphers for TLS termination. These ciphers must be in the +// BoringSSL format. +type ZoneSettingEditParamsItemsZonesCiphers struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesCiphersID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[[]string] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesCiphers) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesCiphers) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesCiphersID string + +const ( + ZoneSettingEditParamsItemsZonesCiphersIDCiphers ZoneSettingEditParamsItemsZonesCiphersID = "ciphers" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesCiphersEditable bool + +const ( + ZoneSettingEditParamsItemsZonesCiphersEditableTrue ZoneSettingEditParamsItemsZonesCiphersEditable = true + ZoneSettingEditParamsItemsZonesCiphersEditableFalse ZoneSettingEditParamsItemsZonesCiphersEditable = false +) + +// Whether or not cname flattening is on. +type ZoneSettingEditParamsItemsZonesCnameFlattening struct { + // How to flatten the cname destination. + ID param.Field[ZoneSettingEditParamsItemsZonesCnameFlatteningID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesCnameFlatteningValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesCnameFlattening) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesCnameFlattening) implementsZoneSettingEditParamsItem() {} + +// How to flatten the cname destination. +type ZoneSettingEditParamsItemsZonesCnameFlatteningID string + +const ( + ZoneSettingEditParamsItemsZonesCnameFlatteningIDCnameFlattening ZoneSettingEditParamsItemsZonesCnameFlatteningID = "cname_flattening" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesCnameFlatteningValue string + +const ( + ZoneSettingEditParamsItemsZonesCnameFlatteningValueFlattenAtRoot ZoneSettingEditParamsItemsZonesCnameFlatteningValue = "flatten_at_root" + ZoneSettingEditParamsItemsZonesCnameFlatteningValueFlattenAll ZoneSettingEditParamsItemsZonesCnameFlatteningValue = "flatten_all" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesCnameFlatteningEditable bool + +const ( + ZoneSettingEditParamsItemsZonesCnameFlatteningEditableTrue ZoneSettingEditParamsItemsZonesCnameFlatteningEditable = true + ZoneSettingEditParamsItemsZonesCnameFlatteningEditableFalse ZoneSettingEditParamsItemsZonesCnameFlatteningEditable = false +) + +// Development Mode temporarily allows you to enter development mode for your +// websites if you need to make changes to your site. This will bypass Cloudflare's +// accelerated cache and slow down your site, but is useful if you are making +// changes to cacheable content (like images, css, or JavaScript) and would like to +// see those changes right away. Once entered, development mode will last for 3 +// hours and then automatically toggle off. +type ZoneSettingEditParamsItemsZonesDevelopmentMode struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesDevelopmentModeID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesDevelopmentModeValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesDevelopmentMode) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesDevelopmentMode) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesDevelopmentModeID string + +const ( + ZoneSettingEditParamsItemsZonesDevelopmentModeIDDevelopmentMode ZoneSettingEditParamsItemsZonesDevelopmentModeID = "development_mode" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesDevelopmentModeValue string + +const ( + ZoneSettingEditParamsItemsZonesDevelopmentModeValueOn ZoneSettingEditParamsItemsZonesDevelopmentModeValue = "on" + ZoneSettingEditParamsItemsZonesDevelopmentModeValueOff ZoneSettingEditParamsItemsZonesDevelopmentModeValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesDevelopmentModeEditable bool + +const ( + ZoneSettingEditParamsItemsZonesDevelopmentModeEditableTrue ZoneSettingEditParamsItemsZonesDevelopmentModeEditable = true + ZoneSettingEditParamsItemsZonesDevelopmentModeEditableFalse ZoneSettingEditParamsItemsZonesDevelopmentModeEditable = false +) + +// When enabled, Cloudflare will attempt to speed up overall page loads by serving +// `103` responses with `Link` headers from the final response. Refer to +// [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for +// more information. +type ZoneSettingEditParamsItemsZonesEarlyHints struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesEarlyHintsID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesEarlyHintsValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesEarlyHints) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesEarlyHints) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesEarlyHintsID string + +const ( + ZoneSettingEditParamsItemsZonesEarlyHintsIDEarlyHints ZoneSettingEditParamsItemsZonesEarlyHintsID = "early_hints" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesEarlyHintsValue string + +const ( + ZoneSettingEditParamsItemsZonesEarlyHintsValueOn ZoneSettingEditParamsItemsZonesEarlyHintsValue = "on" + ZoneSettingEditParamsItemsZonesEarlyHintsValueOff ZoneSettingEditParamsItemsZonesEarlyHintsValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesEarlyHintsEditable bool + +const ( + ZoneSettingEditParamsItemsZonesEarlyHintsEditableTrue ZoneSettingEditParamsItemsZonesEarlyHintsEditable = true + ZoneSettingEditParamsItemsZonesEarlyHintsEditableFalse ZoneSettingEditParamsItemsZonesEarlyHintsEditable = false +) + +// Time (in seconds) that a resource will be ensured to remain on Cloudflare's +// cache servers. +type ZoneSettingEditParamsItemsZonesEdgeCacheTTL struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesEdgeCacheTTLID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesEdgeCacheTTL) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesEdgeCacheTTL) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesEdgeCacheTTLID string + +const ( + ZoneSettingEditParamsItemsZonesEdgeCacheTTLIDEdgeCacheTTL ZoneSettingEditParamsItemsZonesEdgeCacheTTLID = "edge_cache_ttl" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue float64 + +const ( + ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue30 ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue = 30 + ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue60 ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue = 60 + ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue300 ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue = 300 + ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue1200 ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue = 1200 + ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue1800 ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue = 1800 + ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue3600 ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue = 3600 + ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue7200 ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue = 7200 + ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue10800 ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue = 10800 + ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue14400 ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue = 14400 + ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue18000 ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue = 18000 + ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue28800 ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue = 28800 + ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue43200 ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue = 43200 + ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue57600 ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue = 57600 + ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue72000 ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue = 72000 + ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue86400 ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue = 86400 + ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue172800 ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue = 172800 + ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue259200 ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue = 259200 + ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue345600 ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue = 345600 + ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue432000 ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue = 432000 + ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue518400 ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue = 518400 + ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue604800 ZoneSettingEditParamsItemsZonesEdgeCacheTTLValue = 604800 +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesEdgeCacheTTLEditable bool + +const ( + ZoneSettingEditParamsItemsZonesEdgeCacheTTLEditableTrue ZoneSettingEditParamsItemsZonesEdgeCacheTTLEditable = true + ZoneSettingEditParamsItemsZonesEdgeCacheTTLEditableFalse ZoneSettingEditParamsItemsZonesEdgeCacheTTLEditable = false +) + +// Encrypt email adresses on your web page from bots, while keeping them visible to +// humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). +type ZoneSettingEditParamsItemsZonesEmailObfuscation struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesEmailObfuscationID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesEmailObfuscationValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesEmailObfuscation) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesEmailObfuscation) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesEmailObfuscationID string + +const ( + ZoneSettingEditParamsItemsZonesEmailObfuscationIDEmailObfuscation ZoneSettingEditParamsItemsZonesEmailObfuscationID = "email_obfuscation" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesEmailObfuscationValue string + +const ( + ZoneSettingEditParamsItemsZonesEmailObfuscationValueOn ZoneSettingEditParamsItemsZonesEmailObfuscationValue = "on" + ZoneSettingEditParamsItemsZonesEmailObfuscationValueOff ZoneSettingEditParamsItemsZonesEmailObfuscationValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesEmailObfuscationEditable bool + +const ( + ZoneSettingEditParamsItemsZonesEmailObfuscationEditableTrue ZoneSettingEditParamsItemsZonesEmailObfuscationEditable = true + ZoneSettingEditParamsItemsZonesEmailObfuscationEditableFalse ZoneSettingEditParamsItemsZonesEmailObfuscationEditable = false +) + +// HTTP/2 Edge Prioritization optimises the delivery of resources served through +// HTTP/2 to improve page load performance. It also supports fine control of +// content delivery when used in conjunction with Workers. +type ZoneSettingEditParamsItemsZonesH2Prioritization struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesH2PrioritizationID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesH2PrioritizationValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesH2Prioritization) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesH2Prioritization) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesH2PrioritizationID string + +const ( + ZoneSettingEditParamsItemsZonesH2PrioritizationIDH2Prioritization ZoneSettingEditParamsItemsZonesH2PrioritizationID = "h2_prioritization" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesH2PrioritizationValue string + +const ( + ZoneSettingEditParamsItemsZonesH2PrioritizationValueOn ZoneSettingEditParamsItemsZonesH2PrioritizationValue = "on" + ZoneSettingEditParamsItemsZonesH2PrioritizationValueOff ZoneSettingEditParamsItemsZonesH2PrioritizationValue = "off" + ZoneSettingEditParamsItemsZonesH2PrioritizationValueCustom ZoneSettingEditParamsItemsZonesH2PrioritizationValue = "custom" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesH2PrioritizationEditable bool + +const ( + ZoneSettingEditParamsItemsZonesH2PrioritizationEditableTrue ZoneSettingEditParamsItemsZonesH2PrioritizationEditable = true + ZoneSettingEditParamsItemsZonesH2PrioritizationEditableFalse ZoneSettingEditParamsItemsZonesH2PrioritizationEditable = false +) + +// When enabled, the Hotlink Protection option ensures that other sites cannot suck +// up your bandwidth by building pages that use images hosted on your site. Anytime +// a request for an image on your site hits Cloudflare, we check to ensure that +// it's not another site requesting them. People will still be able to download and +// view images from your page, but other sites won't be able to steal them for use +// on their own pages. +// (https://support.cloudflare.com/hc/en-us/articles/200170026). +type ZoneSettingEditParamsItemsZonesHotlinkProtection struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesHotlinkProtectionID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesHotlinkProtectionValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesHotlinkProtection) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesHotlinkProtection) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesHotlinkProtectionID string + +const ( + ZoneSettingEditParamsItemsZonesHotlinkProtectionIDHotlinkProtection ZoneSettingEditParamsItemsZonesHotlinkProtectionID = "hotlink_protection" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesHotlinkProtectionValue string + +const ( + ZoneSettingEditParamsItemsZonesHotlinkProtectionValueOn ZoneSettingEditParamsItemsZonesHotlinkProtectionValue = "on" + ZoneSettingEditParamsItemsZonesHotlinkProtectionValueOff ZoneSettingEditParamsItemsZonesHotlinkProtectionValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesHotlinkProtectionEditable bool + +const ( + ZoneSettingEditParamsItemsZonesHotlinkProtectionEditableTrue ZoneSettingEditParamsItemsZonesHotlinkProtectionEditable = true + ZoneSettingEditParamsItemsZonesHotlinkProtectionEditableFalse ZoneSettingEditParamsItemsZonesHotlinkProtectionEditable = false +) + +// HTTP2 enabled for this zone. +type ZoneSettingEditParamsItemsZonesHTTP2 struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesHTTP2ID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesHTTP2Value] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesHTTP2) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesHTTP2) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesHTTP2ID string + +const ( + ZoneSettingEditParamsItemsZonesHTTP2IDHTTP2 ZoneSettingEditParamsItemsZonesHTTP2ID = "http2" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesHTTP2Value string + +const ( + ZoneSettingEditParamsItemsZonesHTTP2ValueOn ZoneSettingEditParamsItemsZonesHTTP2Value = "on" + ZoneSettingEditParamsItemsZonesHTTP2ValueOff ZoneSettingEditParamsItemsZonesHTTP2Value = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesHTTP2Editable bool + +const ( + ZoneSettingEditParamsItemsZonesHTTP2EditableTrue ZoneSettingEditParamsItemsZonesHTTP2Editable = true + ZoneSettingEditParamsItemsZonesHTTP2EditableFalse ZoneSettingEditParamsItemsZonesHTTP2Editable = false +) + +// HTTP3 enabled for this zone. +type ZoneSettingEditParamsItemsZonesHTTP3 struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesHTTP3ID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesHTTP3Value] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesHTTP3) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesHTTP3) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesHTTP3ID string + +const ( + ZoneSettingEditParamsItemsZonesHTTP3IDHTTP3 ZoneSettingEditParamsItemsZonesHTTP3ID = "http3" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesHTTP3Value string + +const ( + ZoneSettingEditParamsItemsZonesHTTP3ValueOn ZoneSettingEditParamsItemsZonesHTTP3Value = "on" + ZoneSettingEditParamsItemsZonesHTTP3ValueOff ZoneSettingEditParamsItemsZonesHTTP3Value = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesHTTP3Editable bool + +const ( + ZoneSettingEditParamsItemsZonesHTTP3EditableTrue ZoneSettingEditParamsItemsZonesHTTP3Editable = true + ZoneSettingEditParamsItemsZonesHTTP3EditableFalse ZoneSettingEditParamsItemsZonesHTTP3Editable = false +) + +// Image Resizing provides on-demand resizing, conversion and optimisation for +// images served through Cloudflare's network. Refer to the +// [Image Resizing documentation](https://developers.cloudflare.com/images/) for +// more information. +type ZoneSettingEditParamsItemsZonesImageResizing struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesImageResizingID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesImageResizingValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesImageResizing) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesImageResizing) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesImageResizingID string + +const ( + ZoneSettingEditParamsItemsZonesImageResizingIDImageResizing ZoneSettingEditParamsItemsZonesImageResizingID = "image_resizing" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesImageResizingValue string + +const ( + ZoneSettingEditParamsItemsZonesImageResizingValueOn ZoneSettingEditParamsItemsZonesImageResizingValue = "on" + ZoneSettingEditParamsItemsZonesImageResizingValueOff ZoneSettingEditParamsItemsZonesImageResizingValue = "off" + ZoneSettingEditParamsItemsZonesImageResizingValueOpen ZoneSettingEditParamsItemsZonesImageResizingValue = "open" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesImageResizingEditable bool + +const ( + ZoneSettingEditParamsItemsZonesImageResizingEditableTrue ZoneSettingEditParamsItemsZonesImageResizingEditable = true + ZoneSettingEditParamsItemsZonesImageResizingEditableFalse ZoneSettingEditParamsItemsZonesImageResizingEditable = false +) + +// Enable IP Geolocation to have Cloudflare geolocate visitors to your website and +// pass the country code to you. +// (https://support.cloudflare.com/hc/en-us/articles/200168236). +type ZoneSettingEditParamsItemsZonesIPGeolocation struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesIPGeolocationID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesIPGeolocationValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesIPGeolocation) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesIPGeolocation) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesIPGeolocationID string + +const ( + ZoneSettingEditParamsItemsZonesIPGeolocationIDIPGeolocation ZoneSettingEditParamsItemsZonesIPGeolocationID = "ip_geolocation" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesIPGeolocationValue string + +const ( + ZoneSettingEditParamsItemsZonesIPGeolocationValueOn ZoneSettingEditParamsItemsZonesIPGeolocationValue = "on" + ZoneSettingEditParamsItemsZonesIPGeolocationValueOff ZoneSettingEditParamsItemsZonesIPGeolocationValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesIPGeolocationEditable bool + +const ( + ZoneSettingEditParamsItemsZonesIPGeolocationEditableTrue ZoneSettingEditParamsItemsZonesIPGeolocationEditable = true + ZoneSettingEditParamsItemsZonesIPGeolocationEditableFalse ZoneSettingEditParamsItemsZonesIPGeolocationEditable = false +) + +// Enable IPv6 on all subdomains that are Cloudflare enabled. +// (https://support.cloudflare.com/hc/en-us/articles/200168586). +type ZoneSettingEditParamsItemsZonesIPV6 struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesIPV6ID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesIPV6Value] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesIPV6) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesIPV6) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesIPV6ID string + +const ( + ZoneSettingEditParamsItemsZonesIPV6IDIPV6 ZoneSettingEditParamsItemsZonesIPV6ID = "ipv6" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesIPV6Value string + +const ( + ZoneSettingEditParamsItemsZonesIPV6ValueOff ZoneSettingEditParamsItemsZonesIPV6Value = "off" + ZoneSettingEditParamsItemsZonesIPV6ValueOn ZoneSettingEditParamsItemsZonesIPV6Value = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesIPV6Editable bool + +const ( + ZoneSettingEditParamsItemsZonesIPV6EditableTrue ZoneSettingEditParamsItemsZonesIPV6Editable = true + ZoneSettingEditParamsItemsZonesIPV6EditableFalse ZoneSettingEditParamsItemsZonesIPV6Editable = false +) + +// Maximum size of an allowable upload. +type ZoneSettingEditParamsItemsZonesMaxUpload struct { + // identifier of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesMaxUploadID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesMaxUploadValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesMaxUpload) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesMaxUpload) implementsZoneSettingEditParamsItem() {} + +// identifier of the zone setting. +type ZoneSettingEditParamsItemsZonesMaxUploadID string + +const ( + ZoneSettingEditParamsItemsZonesMaxUploadIDMaxUpload ZoneSettingEditParamsItemsZonesMaxUploadID = "max_upload" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesMaxUploadValue float64 + +const ( + ZoneSettingEditParamsItemsZonesMaxUploadValue100 ZoneSettingEditParamsItemsZonesMaxUploadValue = 100 + ZoneSettingEditParamsItemsZonesMaxUploadValue200 ZoneSettingEditParamsItemsZonesMaxUploadValue = 200 + ZoneSettingEditParamsItemsZonesMaxUploadValue500 ZoneSettingEditParamsItemsZonesMaxUploadValue = 500 +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesMaxUploadEditable bool + +const ( + ZoneSettingEditParamsItemsZonesMaxUploadEditableTrue ZoneSettingEditParamsItemsZonesMaxUploadEditable = true + ZoneSettingEditParamsItemsZonesMaxUploadEditableFalse ZoneSettingEditParamsItemsZonesMaxUploadEditable = false +) + +// Only accepts HTTPS requests that use at least the TLS protocol version +// specified. For example, if TLS 1.1 is selected, TLS 1.0 connections will be +// rejected, while 1.1, 1.2, and 1.3 (if enabled) will be permitted. +type ZoneSettingEditParamsItemsZonesMinTLSVersion struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesMinTLSVersionID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesMinTLSVersionValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesMinTLSVersion) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesMinTLSVersion) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesMinTLSVersionID string + +const ( + ZoneSettingEditParamsItemsZonesMinTLSVersionIDMinTLSVersion ZoneSettingEditParamsItemsZonesMinTLSVersionID = "min_tls_version" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesMinTLSVersionValue string + +const ( + ZoneSettingEditParamsItemsZonesMinTLSVersionValue1_0 ZoneSettingEditParamsItemsZonesMinTLSVersionValue = "1.0" + ZoneSettingEditParamsItemsZonesMinTLSVersionValue1_1 ZoneSettingEditParamsItemsZonesMinTLSVersionValue = "1.1" + ZoneSettingEditParamsItemsZonesMinTLSVersionValue1_2 ZoneSettingEditParamsItemsZonesMinTLSVersionValue = "1.2" + ZoneSettingEditParamsItemsZonesMinTLSVersionValue1_3 ZoneSettingEditParamsItemsZonesMinTLSVersionValue = "1.3" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesMinTLSVersionEditable bool + +const ( + ZoneSettingEditParamsItemsZonesMinTLSVersionEditableTrue ZoneSettingEditParamsItemsZonesMinTLSVersionEditable = true + ZoneSettingEditParamsItemsZonesMinTLSVersionEditableFalse ZoneSettingEditParamsItemsZonesMinTLSVersionEditable = false +) + +// Automatically minify certain assets for your website. Refer to +// [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) +// for more information. +type ZoneSettingEditParamsItemsZonesMinify struct { + // Zone setting identifier. + ID param.Field[ZoneSettingEditParamsItemsZonesMinifyID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesMinifyValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesMinify) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesMinify) implementsZoneSettingEditParamsItem() {} + +// Zone setting identifier. +type ZoneSettingEditParamsItemsZonesMinifyID string + +const ( + ZoneSettingEditParamsItemsZonesMinifyIDMinify ZoneSettingEditParamsItemsZonesMinifyID = "minify" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesMinifyValue struct { + // Automatically minify all CSS files for your website. + Css param.Field[ZoneSettingEditParamsItemsZonesMinifyValueCss] `json:"css"` + // Automatically minify all HTML files for your website. + HTML param.Field[ZoneSettingEditParamsItemsZonesMinifyValueHTML] `json:"html"` + // Automatically minify all JavaScript files for your website. + Js param.Field[ZoneSettingEditParamsItemsZonesMinifyValueJs] `json:"js"` +} + +func (r ZoneSettingEditParamsItemsZonesMinifyValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Automatically minify all CSS files for your website. +type ZoneSettingEditParamsItemsZonesMinifyValueCss string + +const ( + ZoneSettingEditParamsItemsZonesMinifyValueCssOn ZoneSettingEditParamsItemsZonesMinifyValueCss = "on" + ZoneSettingEditParamsItemsZonesMinifyValueCssOff ZoneSettingEditParamsItemsZonesMinifyValueCss = "off" +) + +// Automatically minify all HTML files for your website. +type ZoneSettingEditParamsItemsZonesMinifyValueHTML string + +const ( + ZoneSettingEditParamsItemsZonesMinifyValueHTMLOn ZoneSettingEditParamsItemsZonesMinifyValueHTML = "on" + ZoneSettingEditParamsItemsZonesMinifyValueHTMLOff ZoneSettingEditParamsItemsZonesMinifyValueHTML = "off" +) + +// Automatically minify all JavaScript files for your website. +type ZoneSettingEditParamsItemsZonesMinifyValueJs string + +const ( + ZoneSettingEditParamsItemsZonesMinifyValueJsOn ZoneSettingEditParamsItemsZonesMinifyValueJs = "on" + ZoneSettingEditParamsItemsZonesMinifyValueJsOff ZoneSettingEditParamsItemsZonesMinifyValueJs = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesMinifyEditable bool + +const ( + ZoneSettingEditParamsItemsZonesMinifyEditableTrue ZoneSettingEditParamsItemsZonesMinifyEditable = true + ZoneSettingEditParamsItemsZonesMinifyEditableFalse ZoneSettingEditParamsItemsZonesMinifyEditable = false +) + +// Automatically optimize image loading for website visitors on mobile devices. +// Refer to +// [our blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for +// more information. +type ZoneSettingEditParamsItemsZonesMirage struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesMirageID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesMirageValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesMirage) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesMirage) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesMirageID string + +const ( + ZoneSettingEditParamsItemsZonesMirageIDMirage ZoneSettingEditParamsItemsZonesMirageID = "mirage" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesMirageValue string + +const ( + ZoneSettingEditParamsItemsZonesMirageValueOn ZoneSettingEditParamsItemsZonesMirageValue = "on" + ZoneSettingEditParamsItemsZonesMirageValueOff ZoneSettingEditParamsItemsZonesMirageValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesMirageEditable bool + +const ( + ZoneSettingEditParamsItemsZonesMirageEditableTrue ZoneSettingEditParamsItemsZonesMirageEditable = true + ZoneSettingEditParamsItemsZonesMirageEditableFalse ZoneSettingEditParamsItemsZonesMirageEditable = false +) + +// Automatically redirect visitors on mobile devices to a mobile-optimized +// subdomain. Refer to +// [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) +// for more information. +type ZoneSettingEditParamsItemsZonesMobileRedirect struct { + // Identifier of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesMobileRedirectID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesMobileRedirectValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesMobileRedirect) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesMobileRedirect) implementsZoneSettingEditParamsItem() {} + +// Identifier of the zone setting. +type ZoneSettingEditParamsItemsZonesMobileRedirectID string + +const ( + ZoneSettingEditParamsItemsZonesMobileRedirectIDMobileRedirect ZoneSettingEditParamsItemsZonesMobileRedirectID = "mobile_redirect" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesMobileRedirectValue struct { + // Which subdomain prefix you wish to redirect visitors on mobile devices to + // (subdomain must already exist). + MobileSubdomain param.Field[string] `json:"mobile_subdomain"` + // Whether or not mobile redirect is enabled. + Status param.Field[ZoneSettingEditParamsItemsZonesMobileRedirectValueStatus] `json:"status"` + // Whether to drop the current page path and redirect to the mobile subdomain URL + // root, or keep the path and redirect to the same page on the mobile subdomain. + StripUri param.Field[bool] `json:"strip_uri"` +} + +func (r ZoneSettingEditParamsItemsZonesMobileRedirectValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Whether or not mobile redirect is enabled. +type ZoneSettingEditParamsItemsZonesMobileRedirectValueStatus string + +const ( + ZoneSettingEditParamsItemsZonesMobileRedirectValueStatusOn ZoneSettingEditParamsItemsZonesMobileRedirectValueStatus = "on" + ZoneSettingEditParamsItemsZonesMobileRedirectValueStatusOff ZoneSettingEditParamsItemsZonesMobileRedirectValueStatus = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesMobileRedirectEditable bool + +const ( + ZoneSettingEditParamsItemsZonesMobileRedirectEditableTrue ZoneSettingEditParamsItemsZonesMobileRedirectEditable = true + ZoneSettingEditParamsItemsZonesMobileRedirectEditableFalse ZoneSettingEditParamsItemsZonesMobileRedirectEditable = false +) + +// Enable Network Error Logging reporting on your zone. (Beta) +type ZoneSettingEditParamsItemsZonesNEL struct { + // Zone setting identifier. + ID param.Field[ZoneSettingEditParamsItemsZonesNELID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesNELValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesNEL) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesNEL) implementsZoneSettingEditParamsItem() {} + +// Zone setting identifier. +type ZoneSettingEditParamsItemsZonesNELID string + +const ( + ZoneSettingEditParamsItemsZonesNELIDNEL ZoneSettingEditParamsItemsZonesNELID = "nel" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesNELValue struct { + Enabled param.Field[bool] `json:"enabled"` +} + +func (r ZoneSettingEditParamsItemsZonesNELValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesNELEditable bool + +const ( + ZoneSettingEditParamsItemsZonesNELEditableTrue ZoneSettingEditParamsItemsZonesNELEditable = true + ZoneSettingEditParamsItemsZonesNELEditableFalse ZoneSettingEditParamsItemsZonesNELEditable = false +) + +// Enables the Opportunistic Encryption feature for a zone. +type ZoneSettingEditParamsItemsZonesOpportunisticEncryption struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesOpportunisticEncryptionID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesOpportunisticEncryptionValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesOpportunisticEncryption) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesOpportunisticEncryption) implementsZoneSettingEditParamsItem() { +} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesOpportunisticEncryptionID string + +const ( + ZoneSettingEditParamsItemsZonesOpportunisticEncryptionIDOpportunisticEncryption ZoneSettingEditParamsItemsZonesOpportunisticEncryptionID = "opportunistic_encryption" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesOpportunisticEncryptionValue string + +const ( + ZoneSettingEditParamsItemsZonesOpportunisticEncryptionValueOn ZoneSettingEditParamsItemsZonesOpportunisticEncryptionValue = "on" + ZoneSettingEditParamsItemsZonesOpportunisticEncryptionValueOff ZoneSettingEditParamsItemsZonesOpportunisticEncryptionValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesOpportunisticEncryptionEditable bool + +const ( + ZoneSettingEditParamsItemsZonesOpportunisticEncryptionEditableTrue ZoneSettingEditParamsItemsZonesOpportunisticEncryptionEditable = true + ZoneSettingEditParamsItemsZonesOpportunisticEncryptionEditableFalse ZoneSettingEditParamsItemsZonesOpportunisticEncryptionEditable = false +) + +// Add an Alt-Svc header to all legitimate requests from Tor, allowing the +// connection to use our onion services instead of exit nodes. +type ZoneSettingEditParamsItemsZonesOpportunisticOnion struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesOpportunisticOnionID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesOpportunisticOnionValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesOpportunisticOnion) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesOpportunisticOnion) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesOpportunisticOnionID string + +const ( + ZoneSettingEditParamsItemsZonesOpportunisticOnionIDOpportunisticOnion ZoneSettingEditParamsItemsZonesOpportunisticOnionID = "opportunistic_onion" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesOpportunisticOnionValue string + +const ( + ZoneSettingEditParamsItemsZonesOpportunisticOnionValueOn ZoneSettingEditParamsItemsZonesOpportunisticOnionValue = "on" + ZoneSettingEditParamsItemsZonesOpportunisticOnionValueOff ZoneSettingEditParamsItemsZonesOpportunisticOnionValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesOpportunisticOnionEditable bool + +const ( + ZoneSettingEditParamsItemsZonesOpportunisticOnionEditableTrue ZoneSettingEditParamsItemsZonesOpportunisticOnionEditable = true + ZoneSettingEditParamsItemsZonesOpportunisticOnionEditableFalse ZoneSettingEditParamsItemsZonesOpportunisticOnionEditable = false +) + +// Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also +// on Cloudflare. +type ZoneSettingEditParamsItemsZonesOrangeToOrange struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesOrangeToOrangeID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesOrangeToOrangeValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesOrangeToOrange) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesOrangeToOrange) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesOrangeToOrangeID string + +const ( + ZoneSettingEditParamsItemsZonesOrangeToOrangeIDOrangeToOrange ZoneSettingEditParamsItemsZonesOrangeToOrangeID = "orange_to_orange" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesOrangeToOrangeValue string + +const ( + ZoneSettingEditParamsItemsZonesOrangeToOrangeValueOn ZoneSettingEditParamsItemsZonesOrangeToOrangeValue = "on" + ZoneSettingEditParamsItemsZonesOrangeToOrangeValueOff ZoneSettingEditParamsItemsZonesOrangeToOrangeValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesOrangeToOrangeEditable bool + +const ( + ZoneSettingEditParamsItemsZonesOrangeToOrangeEditableTrue ZoneSettingEditParamsItemsZonesOrangeToOrangeEditable = true + ZoneSettingEditParamsItemsZonesOrangeToOrangeEditableFalse ZoneSettingEditParamsItemsZonesOrangeToOrangeEditable = false +) + +// Cloudflare will proxy customer error pages on any 502,504 errors on origin +// server instead of showing a default Cloudflare error page. This does not apply +// to 522 errors and is limited to Enterprise Zones. +type ZoneSettingEditParamsItemsZonesOriginErrorPagePassThru struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesOriginErrorPagePassThru) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesOriginErrorPagePassThru) implementsZoneSettingEditParamsItem() { +} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruID string + +const ( + ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruIDOriginErrorPagePassThru ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruID = "origin_error_page_pass_thru" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruValue string + +const ( + ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruValueOn ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruValue = "on" + ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruValueOff ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruEditable bool + +const ( + ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruEditableTrue ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruEditable = true + ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruEditableFalse ZoneSettingEditParamsItemsZonesOriginErrorPagePassThruEditable = false +) + +// Removes metadata and compresses your images for faster page load times. Basic +// (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual +// quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster +// image loading. Larger JPEGs are converted to progressive images, loading a +// lower-resolution image first and ending in a higher-resolution version. Not +// recommended for hi-res photography sites. +type ZoneSettingEditParamsItemsZonesPolish struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesPolishID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesPolishValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesPolish) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesPolish) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesPolishID string + +const ( + ZoneSettingEditParamsItemsZonesPolishIDPolish ZoneSettingEditParamsItemsZonesPolishID = "polish" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesPolishValue string + +const ( + ZoneSettingEditParamsItemsZonesPolishValueOff ZoneSettingEditParamsItemsZonesPolishValue = "off" + ZoneSettingEditParamsItemsZonesPolishValueLossless ZoneSettingEditParamsItemsZonesPolishValue = "lossless" + ZoneSettingEditParamsItemsZonesPolishValueLossy ZoneSettingEditParamsItemsZonesPolishValue = "lossy" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesPolishEditable bool + +const ( + ZoneSettingEditParamsItemsZonesPolishEditableTrue ZoneSettingEditParamsItemsZonesPolishEditable = true + ZoneSettingEditParamsItemsZonesPolishEditableFalse ZoneSettingEditParamsItemsZonesPolishEditable = false +) + +// Cloudflare will prefetch any URLs that are included in the response headers. +// This is limited to Enterprise Zones. +type ZoneSettingEditParamsItemsZonesPrefetchPreload struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesPrefetchPreloadID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesPrefetchPreloadValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesPrefetchPreload) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesPrefetchPreload) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesPrefetchPreloadID string + +const ( + ZoneSettingEditParamsItemsZonesPrefetchPreloadIDPrefetchPreload ZoneSettingEditParamsItemsZonesPrefetchPreloadID = "prefetch_preload" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesPrefetchPreloadValue string + +const ( + ZoneSettingEditParamsItemsZonesPrefetchPreloadValueOn ZoneSettingEditParamsItemsZonesPrefetchPreloadValue = "on" + ZoneSettingEditParamsItemsZonesPrefetchPreloadValueOff ZoneSettingEditParamsItemsZonesPrefetchPreloadValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesPrefetchPreloadEditable bool + +const ( + ZoneSettingEditParamsItemsZonesPrefetchPreloadEditableTrue ZoneSettingEditParamsItemsZonesPrefetchPreloadEditable = true + ZoneSettingEditParamsItemsZonesPrefetchPreloadEditableFalse ZoneSettingEditParamsItemsZonesPrefetchPreloadEditable = false +) + +// Maximum time between two read operations from origin. +type ZoneSettingEditParamsItemsZonesProxyReadTimeout struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesProxyReadTimeoutID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[float64] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesProxyReadTimeout) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesProxyReadTimeout) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesProxyReadTimeoutID string + +const ( + ZoneSettingEditParamsItemsZonesProxyReadTimeoutIDProxyReadTimeout ZoneSettingEditParamsItemsZonesProxyReadTimeoutID = "proxy_read_timeout" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesProxyReadTimeoutEditable bool + +const ( + ZoneSettingEditParamsItemsZonesProxyReadTimeoutEditableTrue ZoneSettingEditParamsItemsZonesProxyReadTimeoutEditable = true + ZoneSettingEditParamsItemsZonesProxyReadTimeoutEditableFalse ZoneSettingEditParamsItemsZonesProxyReadTimeoutEditable = false +) + +// The value set for the Pseudo IPv4 setting. +type ZoneSettingEditParamsItemsZonesPseudoIPV4 struct { + // Value of the Pseudo IPv4 setting. + ID param.Field[ZoneSettingEditParamsItemsZonesPseudoIPV4ID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesPseudoIPV4Value] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesPseudoIPV4) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesPseudoIPV4) implementsZoneSettingEditParamsItem() {} + +// Value of the Pseudo IPv4 setting. +type ZoneSettingEditParamsItemsZonesPseudoIPV4ID string + +const ( + ZoneSettingEditParamsItemsZonesPseudoIPV4IDPseudoIPV4 ZoneSettingEditParamsItemsZonesPseudoIPV4ID = "pseudo_ipv4" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesPseudoIPV4Value string + +const ( + ZoneSettingEditParamsItemsZonesPseudoIPV4ValueOff ZoneSettingEditParamsItemsZonesPseudoIPV4Value = "off" + ZoneSettingEditParamsItemsZonesPseudoIPV4ValueAddHeader ZoneSettingEditParamsItemsZonesPseudoIPV4Value = "add_header" + ZoneSettingEditParamsItemsZonesPseudoIPV4ValueOverwriteHeader ZoneSettingEditParamsItemsZonesPseudoIPV4Value = "overwrite_header" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesPseudoIPV4Editable bool + +const ( + ZoneSettingEditParamsItemsZonesPseudoIPV4EditableTrue ZoneSettingEditParamsItemsZonesPseudoIPV4Editable = true + ZoneSettingEditParamsItemsZonesPseudoIPV4EditableFalse ZoneSettingEditParamsItemsZonesPseudoIPV4Editable = false +) + +// Enables or disables buffering of responses from the proxied server. Cloudflare +// may buffer the whole payload to deliver it at once to the client versus allowing +// it to be delivered in chunks. By default, the proxied server streams directly +// and is not buffered by Cloudflare. This is limited to Enterprise Zones. +type ZoneSettingEditParamsItemsZonesResponseBuffering struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesResponseBufferingID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesResponseBufferingValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesResponseBuffering) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesResponseBuffering) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesResponseBufferingID string + +const ( + ZoneSettingEditParamsItemsZonesResponseBufferingIDResponseBuffering ZoneSettingEditParamsItemsZonesResponseBufferingID = "response_buffering" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesResponseBufferingValue string + +const ( + ZoneSettingEditParamsItemsZonesResponseBufferingValueOn ZoneSettingEditParamsItemsZonesResponseBufferingValue = "on" + ZoneSettingEditParamsItemsZonesResponseBufferingValueOff ZoneSettingEditParamsItemsZonesResponseBufferingValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesResponseBufferingEditable bool + +const ( + ZoneSettingEditParamsItemsZonesResponseBufferingEditableTrue ZoneSettingEditParamsItemsZonesResponseBufferingEditable = true + ZoneSettingEditParamsItemsZonesResponseBufferingEditableFalse ZoneSettingEditParamsItemsZonesResponseBufferingEditable = false +) + +// Rocket Loader is a general-purpose asynchronous JavaScript optimisation that +// prioritises rendering your content while loading your site's Javascript +// asynchronously. Turning on Rocket Loader will immediately improve a web page's +// rendering time sometimes measured as Time to First Paint (TTFP), and also the +// `window.onload` time (assuming there is JavaScript on the page). This can have a +// positive impact on your Google search ranking. When turned on, Rocket Loader +// will automatically defer the loading of all Javascript referenced in your HTML, +// with no configuration required. Refer to +// [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) +// for more information. +type ZoneSettingEditParamsItemsZonesRocketLoader struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesRocketLoaderID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesRocketLoaderValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesRocketLoader) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesRocketLoader) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesRocketLoaderID string + +const ( + ZoneSettingEditParamsItemsZonesRocketLoaderIDRocketLoader ZoneSettingEditParamsItemsZonesRocketLoaderID = "rocket_loader" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesRocketLoaderValue string + +const ( + ZoneSettingEditParamsItemsZonesRocketLoaderValueOn ZoneSettingEditParamsItemsZonesRocketLoaderValue = "on" + ZoneSettingEditParamsItemsZonesRocketLoaderValueOff ZoneSettingEditParamsItemsZonesRocketLoaderValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesRocketLoaderEditable bool + +const ( + ZoneSettingEditParamsItemsZonesRocketLoaderEditableTrue ZoneSettingEditParamsItemsZonesRocketLoaderEditable = true + ZoneSettingEditParamsItemsZonesRocketLoaderEditableFalse ZoneSettingEditParamsItemsZonesRocketLoaderEditable = false +) + +// [Automatic Platform Optimization for WordPress](https://developers.cloudflare.com/automatic-platform-optimization/) +// serves your WordPress site from Cloudflare's edge network and caches third-party +// fonts. +type ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimization struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimization) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimization) implementsZoneSettingEditParamsItem() { +} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationID string + +const ( + ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationIDAutomaticPlatformOptimization ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationID = "automatic_platform_optimization" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationValue struct { + // Indicates whether or not + // [cache by device type](https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/) + // is enabled. + CacheByDeviceType param.Field[bool] `json:"cache_by_device_type,required"` + // Indicates whether or not Cloudflare proxy is enabled. + Cf param.Field[bool] `json:"cf,required"` + // Indicates whether or not Automatic Platform Optimization is enabled. + Enabled param.Field[bool] `json:"enabled,required"` + // An array of hostnames where Automatic Platform Optimization for WordPress is + // activated. + Hostnames param.Field[[]string] `json:"hostnames,required" format:"hostname"` + // Indicates whether or not site is powered by WordPress. + Wordpress param.Field[bool] `json:"wordpress,required"` + // Indicates whether or not + // [Cloudflare for WordPress plugin](https://wordpress.org/plugins/cloudflare/) is + // installed. + WpPlugin param.Field[bool] `json:"wp_plugin,required"` +} + +func (r ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationEditable bool + +const ( + ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationEditableTrue ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationEditable = true + ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationEditableFalse ZoneSettingEditParamsItemsZonesSchemasAutomaticPlatformOptimizationEditable = false +) + +// Cloudflare security header for a zone. +type ZoneSettingEditParamsItemsZonesSecurityHeader struct { + // ID of the zone's security header. + ID param.Field[ZoneSettingEditParamsItemsZonesSecurityHeaderID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesSecurityHeaderValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesSecurityHeader) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesSecurityHeader) implementsZoneSettingEditParamsItem() {} + +// ID of the zone's security header. +type ZoneSettingEditParamsItemsZonesSecurityHeaderID string + +const ( + ZoneSettingEditParamsItemsZonesSecurityHeaderIDSecurityHeader ZoneSettingEditParamsItemsZonesSecurityHeaderID = "security_header" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesSecurityHeaderValue struct { + // Strict Transport Security. + StrictTransportSecurity param.Field[ZoneSettingEditParamsItemsZonesSecurityHeaderValueStrictTransportSecurity] `json:"strict_transport_security"` +} + +func (r ZoneSettingEditParamsItemsZonesSecurityHeaderValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Strict Transport Security. +type ZoneSettingEditParamsItemsZonesSecurityHeaderValueStrictTransportSecurity struct { + // Whether or not strict transport security is enabled. + Enabled param.Field[bool] `json:"enabled"` + // Include all subdomains for strict transport security. + IncludeSubdomains param.Field[bool] `json:"include_subdomains"` + // Max age in seconds of the strict transport security. + MaxAge param.Field[float64] `json:"max_age"` + // Whether or not to include 'X-Content-Type-Options: nosniff' header. + Nosniff param.Field[bool] `json:"nosniff"` +} + +func (r ZoneSettingEditParamsItemsZonesSecurityHeaderValueStrictTransportSecurity) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesSecurityHeaderEditable bool + +const ( + ZoneSettingEditParamsItemsZonesSecurityHeaderEditableTrue ZoneSettingEditParamsItemsZonesSecurityHeaderEditable = true + ZoneSettingEditParamsItemsZonesSecurityHeaderEditableFalse ZoneSettingEditParamsItemsZonesSecurityHeaderEditable = false +) + +// Choose the appropriate security profile for your website, which will +// automatically adjust each of the security settings. If you choose to customize +// an individual security setting, the profile will become Custom. +// (https://support.cloudflare.com/hc/en-us/articles/200170056). +type ZoneSettingEditParamsItemsZonesSecurityLevel struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesSecurityLevelID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesSecurityLevelValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesSecurityLevel) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesSecurityLevel) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesSecurityLevelID string + +const ( + ZoneSettingEditParamsItemsZonesSecurityLevelIDSecurityLevel ZoneSettingEditParamsItemsZonesSecurityLevelID = "security_level" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesSecurityLevelValue string + +const ( + ZoneSettingEditParamsItemsZonesSecurityLevelValueOff ZoneSettingEditParamsItemsZonesSecurityLevelValue = "off" + ZoneSettingEditParamsItemsZonesSecurityLevelValueEssentiallyOff ZoneSettingEditParamsItemsZonesSecurityLevelValue = "essentially_off" + ZoneSettingEditParamsItemsZonesSecurityLevelValueLow ZoneSettingEditParamsItemsZonesSecurityLevelValue = "low" + ZoneSettingEditParamsItemsZonesSecurityLevelValueMedium ZoneSettingEditParamsItemsZonesSecurityLevelValue = "medium" + ZoneSettingEditParamsItemsZonesSecurityLevelValueHigh ZoneSettingEditParamsItemsZonesSecurityLevelValue = "high" + ZoneSettingEditParamsItemsZonesSecurityLevelValueUnderAttack ZoneSettingEditParamsItemsZonesSecurityLevelValue = "under_attack" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesSecurityLevelEditable bool + +const ( + ZoneSettingEditParamsItemsZonesSecurityLevelEditableTrue ZoneSettingEditParamsItemsZonesSecurityLevelEditable = true + ZoneSettingEditParamsItemsZonesSecurityLevelEditableFalse ZoneSettingEditParamsItemsZonesSecurityLevelEditable = false +) + +// If there is sensitive content on your website that you want visible to real +// visitors, but that you want to hide from suspicious visitors, all you have to do +// is wrap the content with Cloudflare SSE tags. Wrap any content that you want to +// be excluded from suspicious visitors in the following SSE tags: +// . For example: Bad visitors won't see my phone +// number, 555-555-5555 . Note: SSE only will work with HTML. If you +// have HTML minification enabled, you won't see the SSE tags in your HTML source +// when it's served through Cloudflare. SSE will still function in this case, as +// Cloudflare's HTML minification and SSE functionality occur on-the-fly as the +// resource moves through our network to the visitor's computer. +// (https://support.cloudflare.com/hc/en-us/articles/200170036). +type ZoneSettingEditParamsItemsZonesServerSideExclude struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesServerSideExcludeID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesServerSideExcludeValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesServerSideExclude) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesServerSideExclude) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesServerSideExcludeID string + +const ( + ZoneSettingEditParamsItemsZonesServerSideExcludeIDServerSideExclude ZoneSettingEditParamsItemsZonesServerSideExcludeID = "server_side_exclude" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesServerSideExcludeValue string + +const ( + ZoneSettingEditParamsItemsZonesServerSideExcludeValueOn ZoneSettingEditParamsItemsZonesServerSideExcludeValue = "on" + ZoneSettingEditParamsItemsZonesServerSideExcludeValueOff ZoneSettingEditParamsItemsZonesServerSideExcludeValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesServerSideExcludeEditable bool + +const ( + ZoneSettingEditParamsItemsZonesServerSideExcludeEditableTrue ZoneSettingEditParamsItemsZonesServerSideExcludeEditable = true + ZoneSettingEditParamsItemsZonesServerSideExcludeEditableFalse ZoneSettingEditParamsItemsZonesServerSideExcludeEditable = false +) + +// Allow SHA1 support. +type ZoneSettingEditParamsItemsZonesSha1Support struct { + // Zone setting identifier. + ID param.Field[ZoneSettingEditParamsItemsZonesSha1SupportID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesSha1SupportValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesSha1Support) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesSha1Support) implementsZoneSettingEditParamsItem() {} + +// Zone setting identifier. +type ZoneSettingEditParamsItemsZonesSha1SupportID string + +const ( + ZoneSettingEditParamsItemsZonesSha1SupportIDSha1Support ZoneSettingEditParamsItemsZonesSha1SupportID = "sha1_support" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesSha1SupportValue string + +const ( + ZoneSettingEditParamsItemsZonesSha1SupportValueOff ZoneSettingEditParamsItemsZonesSha1SupportValue = "off" + ZoneSettingEditParamsItemsZonesSha1SupportValueOn ZoneSettingEditParamsItemsZonesSha1SupportValue = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesSha1SupportEditable bool + +const ( + ZoneSettingEditParamsItemsZonesSha1SupportEditableTrue ZoneSettingEditParamsItemsZonesSha1SupportEditable = true + ZoneSettingEditParamsItemsZonesSha1SupportEditableFalse ZoneSettingEditParamsItemsZonesSha1SupportEditable = false +) + +// Cloudflare will treat files with the same query strings as the same file in +// cache, regardless of the order of the query strings. This is limited to +// Enterprise Zones. +type ZoneSettingEditParamsItemsZonesSortQueryStringForCache struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesSortQueryStringForCacheID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesSortQueryStringForCacheValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesSortQueryStringForCache) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesSortQueryStringForCache) implementsZoneSettingEditParamsItem() { +} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesSortQueryStringForCacheID string + +const ( + ZoneSettingEditParamsItemsZonesSortQueryStringForCacheIDSortQueryStringForCache ZoneSettingEditParamsItemsZonesSortQueryStringForCacheID = "sort_query_string_for_cache" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesSortQueryStringForCacheValue string + +const ( + ZoneSettingEditParamsItemsZonesSortQueryStringForCacheValueOn ZoneSettingEditParamsItemsZonesSortQueryStringForCacheValue = "on" + ZoneSettingEditParamsItemsZonesSortQueryStringForCacheValueOff ZoneSettingEditParamsItemsZonesSortQueryStringForCacheValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesSortQueryStringForCacheEditable bool + +const ( + ZoneSettingEditParamsItemsZonesSortQueryStringForCacheEditableTrue ZoneSettingEditParamsItemsZonesSortQueryStringForCacheEditable = true + ZoneSettingEditParamsItemsZonesSortQueryStringForCacheEditableFalse ZoneSettingEditParamsItemsZonesSortQueryStringForCacheEditable = false +) + +// SSL encrypts your visitor's connection and safeguards credit card numbers and +// other personal data to and from your website. SSL can take up to 5 minutes to +// fully activate. Requires Cloudflare active on your root domain or www domain. +// Off: no SSL between the visitor and Cloudflare, and no SSL between Cloudflare +// and your web server (all HTTP traffic). Flexible: SSL between the visitor and +// Cloudflare -- visitor sees HTTPS on your site, but no SSL between Cloudflare and +// your web server. You don't need to have an SSL cert on your web server, but your +// vistors will still see the site as being HTTPS enabled. Full: SSL between the +// visitor and Cloudflare -- visitor sees HTTPS on your site, and SSL between +// Cloudflare and your web server. You'll need to have your own SSL cert or +// self-signed cert at the very least. Full (Strict): SSL between the visitor and +// Cloudflare -- visitor sees HTTPS on your site, and SSL between Cloudflare and +// your web server. You'll need to have a valid SSL certificate installed on your +// web server. This certificate must be signed by a certificate authority, have an +// expiration date in the future, and respond for the request domain name +// (hostname). (https://support.cloudflare.com/hc/en-us/articles/200170416). +type ZoneSettingEditParamsItemsZonesSSL struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesSSLID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesSSLValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesSSL) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesSSL) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesSSLID string + +const ( + ZoneSettingEditParamsItemsZonesSSLIDSSL ZoneSettingEditParamsItemsZonesSSLID = "ssl" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesSSLValue string + +const ( + ZoneSettingEditParamsItemsZonesSSLValueOff ZoneSettingEditParamsItemsZonesSSLValue = "off" + ZoneSettingEditParamsItemsZonesSSLValueFlexible ZoneSettingEditParamsItemsZonesSSLValue = "flexible" + ZoneSettingEditParamsItemsZonesSSLValueFull ZoneSettingEditParamsItemsZonesSSLValue = "full" + ZoneSettingEditParamsItemsZonesSSLValueStrict ZoneSettingEditParamsItemsZonesSSLValue = "strict" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesSSLEditable bool + +const ( + ZoneSettingEditParamsItemsZonesSSLEditableTrue ZoneSettingEditParamsItemsZonesSSLEditable = true + ZoneSettingEditParamsItemsZonesSSLEditableFalse ZoneSettingEditParamsItemsZonesSSLEditable = false +) + +// Enrollment in the SSL/TLS Recommender service which tries to detect and +// recommend (by sending periodic emails) the most secure SSL/TLS setting your +// origin servers support. +type ZoneSettingEditParamsItemsZonesSSLRecommender struct { + // Enrollment value for SSL/TLS Recommender. + ID param.Field[ZoneSettingEditParamsItemsZonesSSLRecommenderID] `json:"id"` + // ssl-recommender enrollment setting. + Enabled param.Field[bool] `json:"enabled"` +} + +func (r ZoneSettingEditParamsItemsZonesSSLRecommender) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesSSLRecommender) implementsZoneSettingEditParamsItem() {} + +// Enrollment value for SSL/TLS Recommender. +type ZoneSettingEditParamsItemsZonesSSLRecommenderID string + +const ( + ZoneSettingEditParamsItemsZonesSSLRecommenderIDSSLRecommender ZoneSettingEditParamsItemsZonesSSLRecommenderID = "ssl_recommender" +) + +// Only allows TLS1.2. +type ZoneSettingEditParamsItemsZonesTLS1_2Only struct { + // Zone setting identifier. + ID param.Field[ZoneSettingEditParamsItemsZonesTLS1_2OnlyID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesTLS1_2OnlyValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesTLS1_2Only) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesTLS1_2Only) implementsZoneSettingEditParamsItem() {} + +// Zone setting identifier. +type ZoneSettingEditParamsItemsZonesTLS1_2OnlyID string + +const ( + ZoneSettingEditParamsItemsZonesTLS1_2OnlyIDTLS1_2Only ZoneSettingEditParamsItemsZonesTLS1_2OnlyID = "tls_1_2_only" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesTLS1_2OnlyValue string + +const ( + ZoneSettingEditParamsItemsZonesTLS1_2OnlyValueOff ZoneSettingEditParamsItemsZonesTLS1_2OnlyValue = "off" + ZoneSettingEditParamsItemsZonesTLS1_2OnlyValueOn ZoneSettingEditParamsItemsZonesTLS1_2OnlyValue = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesTLS1_2OnlyEditable bool + +const ( + ZoneSettingEditParamsItemsZonesTLS1_2OnlyEditableTrue ZoneSettingEditParamsItemsZonesTLS1_2OnlyEditable = true + ZoneSettingEditParamsItemsZonesTLS1_2OnlyEditableFalse ZoneSettingEditParamsItemsZonesTLS1_2OnlyEditable = false +) + +// Enables Crypto TLS 1.3 feature for a zone. +type ZoneSettingEditParamsItemsZonesTLS1_3 struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesTLS1_3ID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesTLS1_3Value] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesTLS1_3) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesTLS1_3) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesTLS1_3ID string + +const ( + ZoneSettingEditParamsItemsZonesTLS1_3IDTLS1_3 ZoneSettingEditParamsItemsZonesTLS1_3ID = "tls_1_3" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesTLS1_3Value string + +const ( + ZoneSettingEditParamsItemsZonesTLS1_3ValueOn ZoneSettingEditParamsItemsZonesTLS1_3Value = "on" + ZoneSettingEditParamsItemsZonesTLS1_3ValueOff ZoneSettingEditParamsItemsZonesTLS1_3Value = "off" + ZoneSettingEditParamsItemsZonesTLS1_3ValueZrt ZoneSettingEditParamsItemsZonesTLS1_3Value = "zrt" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesTLS1_3Editable bool + +const ( + ZoneSettingEditParamsItemsZonesTLS1_3EditableTrue ZoneSettingEditParamsItemsZonesTLS1_3Editable = true + ZoneSettingEditParamsItemsZonesTLS1_3EditableFalse ZoneSettingEditParamsItemsZonesTLS1_3Editable = false +) + +// TLS Client Auth requires Cloudflare to connect to your origin server using a +// client certificate (Enterprise Only). +type ZoneSettingEditParamsItemsZonesTLSClientAuth struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesTLSClientAuthID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesTLSClientAuthValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesTLSClientAuth) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesTLSClientAuth) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesTLSClientAuthID string + +const ( + ZoneSettingEditParamsItemsZonesTLSClientAuthIDTLSClientAuth ZoneSettingEditParamsItemsZonesTLSClientAuthID = "tls_client_auth" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesTLSClientAuthValue string + +const ( + ZoneSettingEditParamsItemsZonesTLSClientAuthValueOn ZoneSettingEditParamsItemsZonesTLSClientAuthValue = "on" + ZoneSettingEditParamsItemsZonesTLSClientAuthValueOff ZoneSettingEditParamsItemsZonesTLSClientAuthValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesTLSClientAuthEditable bool + +const ( + ZoneSettingEditParamsItemsZonesTLSClientAuthEditableTrue ZoneSettingEditParamsItemsZonesTLSClientAuthEditable = true + ZoneSettingEditParamsItemsZonesTLSClientAuthEditableFalse ZoneSettingEditParamsItemsZonesTLSClientAuthEditable = false +) + +// Allows customer to continue to use True Client IP (Akamai feature) in the +// headers we send to the origin. This is limited to Enterprise Zones. +type ZoneSettingEditParamsItemsZonesTrueClientIPHeader struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesTrueClientIPHeaderID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesTrueClientIPHeaderValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesTrueClientIPHeader) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesTrueClientIPHeader) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesTrueClientIPHeaderID string + +const ( + ZoneSettingEditParamsItemsZonesTrueClientIPHeaderIDTrueClientIPHeader ZoneSettingEditParamsItemsZonesTrueClientIPHeaderID = "true_client_ip_header" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesTrueClientIPHeaderValue string + +const ( + ZoneSettingEditParamsItemsZonesTrueClientIPHeaderValueOn ZoneSettingEditParamsItemsZonesTrueClientIPHeaderValue = "on" + ZoneSettingEditParamsItemsZonesTrueClientIPHeaderValueOff ZoneSettingEditParamsItemsZonesTrueClientIPHeaderValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesTrueClientIPHeaderEditable bool + +const ( + ZoneSettingEditParamsItemsZonesTrueClientIPHeaderEditableTrue ZoneSettingEditParamsItemsZonesTrueClientIPHeaderEditable = true + ZoneSettingEditParamsItemsZonesTrueClientIPHeaderEditableFalse ZoneSettingEditParamsItemsZonesTrueClientIPHeaderEditable = false +) + +// The WAF examines HTTP requests to your website. It inspects both GET and POST +// requests and applies rules to help filter out illegitimate traffic from +// legitimate website visitors. The Cloudflare WAF inspects website addresses or +// URLs to detect anything out of the ordinary. If the Cloudflare WAF determines +// suspicious user behavior, then the WAF will 'challenge' the web visitor with a +// page that asks them to submit a CAPTCHA successfully to continue their action. +// If the challenge is failed, the action will be stopped. What this means is that +// Cloudflare's WAF will block any traffic identified as illegitimate before it +// reaches your origin web server. +// (https://support.cloudflare.com/hc/en-us/articles/200172016). +type ZoneSettingEditParamsItemsZonesWAF struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesWAFID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesWAFValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesWAF) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesWAF) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesWAFID string + +const ( + ZoneSettingEditParamsItemsZonesWAFIDWAF ZoneSettingEditParamsItemsZonesWAFID = "waf" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesWAFValue string + +const ( + ZoneSettingEditParamsItemsZonesWAFValueOn ZoneSettingEditParamsItemsZonesWAFValue = "on" + ZoneSettingEditParamsItemsZonesWAFValueOff ZoneSettingEditParamsItemsZonesWAFValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesWAFEditable bool + +const ( + ZoneSettingEditParamsItemsZonesWAFEditableTrue ZoneSettingEditParamsItemsZonesWAFEditable = true + ZoneSettingEditParamsItemsZonesWAFEditableFalse ZoneSettingEditParamsItemsZonesWAFEditable = false +) + +// When the client requesting the image supports the WebP image codec, and WebP +// offers a performance advantage over the original image format, Cloudflare will +// serve a WebP version of the original image. +type ZoneSettingEditParamsItemsZonesWebp struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesWebpID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesWebpValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesWebp) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesWebp) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesWebpID string + +const ( + ZoneSettingEditParamsItemsZonesWebpIDWebp ZoneSettingEditParamsItemsZonesWebpID = "webp" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesWebpValue string + +const ( + ZoneSettingEditParamsItemsZonesWebpValueOff ZoneSettingEditParamsItemsZonesWebpValue = "off" + ZoneSettingEditParamsItemsZonesWebpValueOn ZoneSettingEditParamsItemsZonesWebpValue = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesWebpEditable bool + +const ( + ZoneSettingEditParamsItemsZonesWebpEditableTrue ZoneSettingEditParamsItemsZonesWebpEditable = true + ZoneSettingEditParamsItemsZonesWebpEditableFalse ZoneSettingEditParamsItemsZonesWebpEditable = false +) + +// WebSockets are open connections sustained between the client and the origin +// server. Inside a WebSockets connection, the client and the origin can pass data +// back and forth without having to reestablish sessions. This makes exchanging +// data within a WebSockets connection fast. WebSockets are often used for +// real-time applications such as live chat and gaming. For more information refer +// to +// [Can I use Cloudflare with Websockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Can-I-use-Cloudflare-with-WebSockets-). +type ZoneSettingEditParamsItemsZonesWebsockets struct { + // ID of the zone setting. + ID param.Field[ZoneSettingEditParamsItemsZonesWebsocketsID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingEditParamsItemsZonesWebsocketsValue] `json:"value,required"` +} + +func (r ZoneSettingEditParamsItemsZonesWebsockets) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +func (r ZoneSettingEditParamsItemsZonesWebsockets) implementsZoneSettingEditParamsItem() {} + +// ID of the zone setting. +type ZoneSettingEditParamsItemsZonesWebsocketsID string + +const ( + ZoneSettingEditParamsItemsZonesWebsocketsIDWebsockets ZoneSettingEditParamsItemsZonesWebsocketsID = "websockets" +) + +// Current value of the zone setting. +type ZoneSettingEditParamsItemsZonesWebsocketsValue string + +const ( + ZoneSettingEditParamsItemsZonesWebsocketsValueOff ZoneSettingEditParamsItemsZonesWebsocketsValue = "off" + ZoneSettingEditParamsItemsZonesWebsocketsValueOn ZoneSettingEditParamsItemsZonesWebsocketsValue = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEditParamsItemsZonesWebsocketsEditable bool + +const ( + ZoneSettingEditParamsItemsZonesWebsocketsEditableTrue ZoneSettingEditParamsItemsZonesWebsocketsEditable = true + ZoneSettingEditParamsItemsZonesWebsocketsEditableFalse ZoneSettingEditParamsItemsZonesWebsocketsEditable = false +) + +type ZoneSettingEditResponseEnvelope struct { + Errors []ZoneSettingEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + Result []ZoneSettingEditResponse `json:"result"` + JSON zoneSettingEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingEditResponseEnvelopeJSON contains the JSON metadata for the struct +// [ZoneSettingEditResponseEnvelope] +type zoneSettingEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingEditResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseEnvelopeErrors] +type zoneSettingEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingEditResponseEnvelopeMessagesJSON contains the JSON metadata for the +// struct [ZoneSettingEditResponseEnvelopeMessages] +type zoneSettingEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/setting_test.go b/zonesetting_test.go similarity index 63% rename from setting_test.go rename to zonesetting_test.go index 47bdbc69126..4e20c81ef05 100644 --- a/setting_test.go +++ b/zonesetting_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingList(t *testing.T) { +func TestZoneSettingList(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 { @@ -29,7 +29,7 @@ func TestSettingList(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.List(context.TODO(), cloudflare.SettingListParams{ + _, err := client.Zones.Settings.List(context.TODO(), cloudflare.ZoneSettingListParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { @@ -41,7 +41,7 @@ func TestSettingList(t *testing.T) { } } -func TestSettingEdit(t *testing.T) { +func TestZoneSettingEdit(t *testing.T) { t.Skip("oneOf doesnt match") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { @@ -57,17 +57,17 @@ func TestSettingEdit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.Edit(context.TODO(), cloudflare.SettingEditParams{ + _, err := client.Zones.Settings.Edit(context.TODO(), cloudflare.ZoneSettingEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Items: cloudflare.F([]cloudflare.SettingEditParamsItem{cloudflare.SettingEditParamsItemsZonesAlwaysOnline(cloudflare.SettingEditParamsItemsZonesAlwaysOnline{ - ID: cloudflare.F(cloudflare.SettingEditParamsItemsZonesAlwaysOnlineIDAlwaysOnline), - Value: cloudflare.F(cloudflare.SettingEditParamsItemsZonesAlwaysOnlineValueOn), - }), cloudflare.SettingEditParamsItemsZonesBrowserCacheTTL(cloudflare.SettingEditParamsItemsZonesBrowserCacheTTL{ - ID: cloudflare.F(cloudflare.SettingEditParamsItemsZonesBrowserCacheTTLIDBrowserCacheTTL), - Value: cloudflare.F(cloudflare.SettingEditParamsItemsZonesBrowserCacheTTLValue18000), - }), cloudflare.SettingEditParamsItemsZonesIPGeolocation(cloudflare.SettingEditParamsItemsZonesIPGeolocation{ - ID: cloudflare.F(cloudflare.SettingEditParamsItemsZonesIPGeolocationIDIPGeolocation), - Value: cloudflare.F(cloudflare.SettingEditParamsItemsZonesIPGeolocationValueOff), + Items: cloudflare.F([]cloudflare.ZoneSettingEditParamsItem{cloudflare.ZoneSettingEditParamsItemsZonesAlwaysOnline(cloudflare.ZoneSettingEditParamsItemsZonesAlwaysOnline{ + ID: cloudflare.F(cloudflare.ZoneSettingEditParamsItemsZonesAlwaysOnlineIDAlwaysOnline), + Value: cloudflare.F(cloudflare.ZoneSettingEditParamsItemsZonesAlwaysOnlineValueOn), + }), cloudflare.ZoneSettingEditParamsItemsZonesBrowserCacheTTL(cloudflare.ZoneSettingEditParamsItemsZonesBrowserCacheTTL{ + ID: cloudflare.F(cloudflare.ZoneSettingEditParamsItemsZonesBrowserCacheTTLIDBrowserCacheTTL), + Value: cloudflare.F(cloudflare.ZoneSettingEditParamsItemsZonesBrowserCacheTTLValue18000), + }), cloudflare.ZoneSettingEditParamsItemsZonesIPGeolocation(cloudflare.ZoneSettingEditParamsItemsZonesIPGeolocation{ + ID: cloudflare.F(cloudflare.ZoneSettingEditParamsItemsZonesIPGeolocationIDIPGeolocation), + Value: cloudflare.F(cloudflare.ZoneSettingEditParamsItemsZonesIPGeolocationValueOff), })}), }) if err != nil { diff --git a/zonesettingadvancedddos.go b/zonesettingadvancedddos.go new file mode 100644 index 00000000000..7c0a586c405 --- /dev/null +++ b/zonesettingadvancedddos.go @@ -0,0 +1,173 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingAdvancedDDOSService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewZoneSettingAdvancedDDOSService] method instead. +type ZoneSettingAdvancedDDOSService struct { + Options []option.RequestOption +} + +// NewZoneSettingAdvancedDDOSService generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewZoneSettingAdvancedDDOSService(opts ...option.RequestOption) (r *ZoneSettingAdvancedDDOSService) { + r = &ZoneSettingAdvancedDDOSService{} + r.Options = opts + return +} + +// Advanced protection from Distributed Denial of Service (DDoS) attacks on your +// website. This is an uneditable value that is 'on' in the case of Business and +// Enterprise zones. +func (r *ZoneSettingAdvancedDDOSService) Get(ctx context.Context, query ZoneSettingAdvancedDDOSGetParams, opts ...option.RequestOption) (res *ZoneSettingAdvancedDDOSGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingAdvancedDDOSGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/advanced_ddos", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Advanced protection from Distributed Denial of Service (DDoS) attacks on your +// website. This is an uneditable value that is 'on' in the case of Business and +// Enterprise zones. +type ZoneSettingAdvancedDDOSGetResponse struct { + // ID of the zone setting. + ID ZoneSettingAdvancedDDOSGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingAdvancedDDOSGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingAdvancedDDOSGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingAdvancedDDOSGetResponseJSON `json:"-"` +} + +// zoneSettingAdvancedDDOSGetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingAdvancedDDOSGetResponse] +type zoneSettingAdvancedDDOSGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAdvancedDDOSGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingAdvancedDDOSGetResponseID string + +const ( + ZoneSettingAdvancedDDOSGetResponseIDAdvancedDDOS ZoneSettingAdvancedDDOSGetResponseID = "advanced_ddos" +) + +// Current value of the zone setting. +type ZoneSettingAdvancedDDOSGetResponseValue string + +const ( + ZoneSettingAdvancedDDOSGetResponseValueOn ZoneSettingAdvancedDDOSGetResponseValue = "on" + ZoneSettingAdvancedDDOSGetResponseValueOff ZoneSettingAdvancedDDOSGetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingAdvancedDDOSGetResponseEditable bool + +const ( + ZoneSettingAdvancedDDOSGetResponseEditableTrue ZoneSettingAdvancedDDOSGetResponseEditable = true + ZoneSettingAdvancedDDOSGetResponseEditableFalse ZoneSettingAdvancedDDOSGetResponseEditable = false +) + +type ZoneSettingAdvancedDDOSGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingAdvancedDDOSGetResponseEnvelope struct { + Errors []ZoneSettingAdvancedDDOSGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingAdvancedDDOSGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Advanced protection from Distributed Denial of Service (DDoS) attacks on your + // website. This is an uneditable value that is 'on' in the case of Business and + // Enterprise zones. + Result ZoneSettingAdvancedDDOSGetResponse `json:"result"` + JSON zoneSettingAdvancedDDOSGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingAdvancedDDOSGetResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingAdvancedDDOSGetResponseEnvelope] +type zoneSettingAdvancedDDOSGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAdvancedDDOSGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAdvancedDDOSGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingAdvancedDDOSGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingAdvancedDDOSGetResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [ZoneSettingAdvancedDDOSGetResponseEnvelopeErrors] +type zoneSettingAdvancedDDOSGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAdvancedDDOSGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAdvancedDDOSGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingAdvancedDDOSGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingAdvancedDDOSGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingAdvancedDDOSGetResponseEnvelopeMessages] +type zoneSettingAdvancedDDOSGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAdvancedDDOSGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingadvancedddos_test.go b/zonesettingadvancedddos_test.go similarity index 88% rename from settingadvancedddos_test.go rename to zonesettingadvancedddos_test.go index 5d0a6b69ae7..18e0a0fe31a 100644 --- a/settingadvancedddos_test.go +++ b/zonesettingadvancedddos_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingAdvancedDDOSGet(t *testing.T) { +func TestZoneSettingAdvancedDDOSGet(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 { @@ -29,7 +29,7 @@ func TestSettingAdvancedDDOSGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.AdvancedDDOS.Get(context.TODO(), cloudflare.SettingAdvancedDDOSGetParams{ + _, err := client.Zones.Settings.AdvancedDDOS.Get(context.TODO(), cloudflare.ZoneSettingAdvancedDDOSGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingalwaysonline.go b/zonesettingalwaysonline.go new file mode 100644 index 00000000000..c69c8d4c696 --- /dev/null +++ b/zonesettingalwaysonline.go @@ -0,0 +1,339 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingAlwaysOnlineService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewZoneSettingAlwaysOnlineService] method instead. +type ZoneSettingAlwaysOnlineService struct { + Options []option.RequestOption +} + +// NewZoneSettingAlwaysOnlineService generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewZoneSettingAlwaysOnlineService(opts ...option.RequestOption) (r *ZoneSettingAlwaysOnlineService) { + r = &ZoneSettingAlwaysOnlineService{} + r.Options = opts + return +} + +// When enabled, Cloudflare serves limited copies of web pages available from the +// [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is +// offline. Refer to +// [Always Online](https://developers.cloudflare.com/cache/about/always-online) for +// more information. +func (r *ZoneSettingAlwaysOnlineService) Edit(ctx context.Context, params ZoneSettingAlwaysOnlineEditParams, opts ...option.RequestOption) (res *ZoneSettingAlwaysOnlineEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingAlwaysOnlineEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/always_online", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// When enabled, Cloudflare serves limited copies of web pages available from the +// [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is +// offline. Refer to +// [Always Online](https://developers.cloudflare.com/cache/about/always-online) for +// more information. +func (r *ZoneSettingAlwaysOnlineService) Get(ctx context.Context, query ZoneSettingAlwaysOnlineGetParams, opts ...option.RequestOption) (res *ZoneSettingAlwaysOnlineGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingAlwaysOnlineGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/always_online", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// When enabled, Cloudflare serves limited copies of web pages available from the +// [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is +// offline. Refer to +// [Always Online](https://developers.cloudflare.com/cache/about/always-online) for +// more information. +type ZoneSettingAlwaysOnlineEditResponse struct { + // ID of the zone setting. + ID ZoneSettingAlwaysOnlineEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingAlwaysOnlineEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingAlwaysOnlineEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingAlwaysOnlineEditResponseJSON `json:"-"` +} + +// zoneSettingAlwaysOnlineEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingAlwaysOnlineEditResponse] +type zoneSettingAlwaysOnlineEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAlwaysOnlineEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingAlwaysOnlineEditResponseID string + +const ( + ZoneSettingAlwaysOnlineEditResponseIDAlwaysOnline ZoneSettingAlwaysOnlineEditResponseID = "always_online" +) + +// Current value of the zone setting. +type ZoneSettingAlwaysOnlineEditResponseValue string + +const ( + ZoneSettingAlwaysOnlineEditResponseValueOn ZoneSettingAlwaysOnlineEditResponseValue = "on" + ZoneSettingAlwaysOnlineEditResponseValueOff ZoneSettingAlwaysOnlineEditResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingAlwaysOnlineEditResponseEditable bool + +const ( + ZoneSettingAlwaysOnlineEditResponseEditableTrue ZoneSettingAlwaysOnlineEditResponseEditable = true + ZoneSettingAlwaysOnlineEditResponseEditableFalse ZoneSettingAlwaysOnlineEditResponseEditable = false +) + +// When enabled, Cloudflare serves limited copies of web pages available from the +// [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is +// offline. Refer to +// [Always Online](https://developers.cloudflare.com/cache/about/always-online) for +// more information. +type ZoneSettingAlwaysOnlineGetResponse struct { + // ID of the zone setting. + ID ZoneSettingAlwaysOnlineGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingAlwaysOnlineGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingAlwaysOnlineGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingAlwaysOnlineGetResponseJSON `json:"-"` +} + +// zoneSettingAlwaysOnlineGetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingAlwaysOnlineGetResponse] +type zoneSettingAlwaysOnlineGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAlwaysOnlineGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingAlwaysOnlineGetResponseID string + +const ( + ZoneSettingAlwaysOnlineGetResponseIDAlwaysOnline ZoneSettingAlwaysOnlineGetResponseID = "always_online" +) + +// Current value of the zone setting. +type ZoneSettingAlwaysOnlineGetResponseValue string + +const ( + ZoneSettingAlwaysOnlineGetResponseValueOn ZoneSettingAlwaysOnlineGetResponseValue = "on" + ZoneSettingAlwaysOnlineGetResponseValueOff ZoneSettingAlwaysOnlineGetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingAlwaysOnlineGetResponseEditable bool + +const ( + ZoneSettingAlwaysOnlineGetResponseEditableTrue ZoneSettingAlwaysOnlineGetResponseEditable = true + ZoneSettingAlwaysOnlineGetResponseEditableFalse ZoneSettingAlwaysOnlineGetResponseEditable = false +) + +type ZoneSettingAlwaysOnlineEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingAlwaysOnlineEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingAlwaysOnlineEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingAlwaysOnlineEditParamsValue string + +const ( + ZoneSettingAlwaysOnlineEditParamsValueOn ZoneSettingAlwaysOnlineEditParamsValue = "on" + ZoneSettingAlwaysOnlineEditParamsValueOff ZoneSettingAlwaysOnlineEditParamsValue = "off" +) + +type ZoneSettingAlwaysOnlineEditResponseEnvelope struct { + Errors []ZoneSettingAlwaysOnlineEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingAlwaysOnlineEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // When enabled, Cloudflare serves limited copies of web pages available from the + // [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is + // offline. Refer to + // [Always Online](https://developers.cloudflare.com/cache/about/always-online) for + // more information. + Result ZoneSettingAlwaysOnlineEditResponse `json:"result"` + JSON zoneSettingAlwaysOnlineEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingAlwaysOnlineEditResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingAlwaysOnlineEditResponseEnvelope] +type zoneSettingAlwaysOnlineEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAlwaysOnlineEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAlwaysOnlineEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingAlwaysOnlineEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingAlwaysOnlineEditResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [ZoneSettingAlwaysOnlineEditResponseEnvelopeErrors] +type zoneSettingAlwaysOnlineEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAlwaysOnlineEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAlwaysOnlineEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingAlwaysOnlineEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingAlwaysOnlineEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingAlwaysOnlineEditResponseEnvelopeMessages] +type zoneSettingAlwaysOnlineEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAlwaysOnlineEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAlwaysOnlineGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingAlwaysOnlineGetResponseEnvelope struct { + Errors []ZoneSettingAlwaysOnlineGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingAlwaysOnlineGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // When enabled, Cloudflare serves limited copies of web pages available from the + // [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is + // offline. Refer to + // [Always Online](https://developers.cloudflare.com/cache/about/always-online) for + // more information. + Result ZoneSettingAlwaysOnlineGetResponse `json:"result"` + JSON zoneSettingAlwaysOnlineGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingAlwaysOnlineGetResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingAlwaysOnlineGetResponseEnvelope] +type zoneSettingAlwaysOnlineGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAlwaysOnlineGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAlwaysOnlineGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingAlwaysOnlineGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingAlwaysOnlineGetResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [ZoneSettingAlwaysOnlineGetResponseEnvelopeErrors] +type zoneSettingAlwaysOnlineGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAlwaysOnlineGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAlwaysOnlineGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingAlwaysOnlineGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingAlwaysOnlineGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingAlwaysOnlineGetResponseEnvelopeMessages] +type zoneSettingAlwaysOnlineGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAlwaysOnlineGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingemailobfuscation_test.go b/zonesettingalwaysonline_test.go similarity index 84% rename from settingemailobfuscation_test.go rename to zonesettingalwaysonline_test.go index 116969338cf..ee151465c7b 100644 --- a/settingemailobfuscation_test.go +++ b/zonesettingalwaysonline_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingEmailObfuscationEdit(t *testing.T) { +func TestZoneSettingAlwaysOnlineEdit(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 { @@ -29,9 +29,9 @@ func TestSettingEmailObfuscationEdit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.EmailObfuscation.Edit(context.TODO(), cloudflare.SettingEmailObfuscationEditParams{ + _, err := client.Zones.Settings.AlwaysOnline.Edit(context.TODO(), cloudflare.ZoneSettingAlwaysOnlineEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingEmailObfuscationEditParamsValueOn), + Value: cloudflare.F(cloudflare.ZoneSettingAlwaysOnlineEditParamsValueOn), }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +42,7 @@ func TestSettingEmailObfuscationEdit(t *testing.T) { } } -func TestSettingEmailObfuscationGet(t *testing.T) { +func TestZoneSettingAlwaysOnlineGet(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 { @@ -58,7 +58,7 @@ func TestSettingEmailObfuscationGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.EmailObfuscation.Get(context.TODO(), cloudflare.SettingEmailObfuscationGetParams{ + _, err := client.Zones.Settings.AlwaysOnline.Get(context.TODO(), cloudflare.ZoneSettingAlwaysOnlineGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingalwaysusehttps.go b/zonesettingalwaysusehttps.go new file mode 100644 index 00000000000..0b57b56c7f7 --- /dev/null +++ b/zonesettingalwaysusehttps.go @@ -0,0 +1,327 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingAlwaysUseHTTPSService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewZoneSettingAlwaysUseHTTPSService] method instead. +type ZoneSettingAlwaysUseHTTPSService struct { + Options []option.RequestOption +} + +// NewZoneSettingAlwaysUseHTTPSService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewZoneSettingAlwaysUseHTTPSService(opts ...option.RequestOption) (r *ZoneSettingAlwaysUseHTTPSService) { + r = &ZoneSettingAlwaysUseHTTPSService{} + r.Options = opts + return +} + +// Reply to all requests for URLs that use "http" with a 301 redirect to the +// equivalent "https" URL. If you only want to redirect for a subset of requests, +// consider creating an "Always use HTTPS" page rule. +func (r *ZoneSettingAlwaysUseHTTPSService) Edit(ctx context.Context, params ZoneSettingAlwaysUseHTTPSEditParams, opts ...option.RequestOption) (res *ZoneSettingAlwaysUseHTTPSEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingAlwaysUseHTTPSEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/always_use_https", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Reply to all requests for URLs that use "http" with a 301 redirect to the +// equivalent "https" URL. If you only want to redirect for a subset of requests, +// consider creating an "Always use HTTPS" page rule. +func (r *ZoneSettingAlwaysUseHTTPSService) Get(ctx context.Context, query ZoneSettingAlwaysUseHTTPSGetParams, opts ...option.RequestOption) (res *ZoneSettingAlwaysUseHTTPSGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingAlwaysUseHTTPSGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/always_use_https", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Reply to all requests for URLs that use "http" with a 301 redirect to the +// equivalent "https" URL. If you only want to redirect for a subset of requests, +// consider creating an "Always use HTTPS" page rule. +type ZoneSettingAlwaysUseHTTPSEditResponse struct { + // ID of the zone setting. + ID ZoneSettingAlwaysUseHTTPSEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingAlwaysUseHTTPSEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingAlwaysUseHTTPSEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingAlwaysUseHTTPSEditResponseJSON `json:"-"` +} + +// zoneSettingAlwaysUseHTTPSEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingAlwaysUseHTTPSEditResponse] +type zoneSettingAlwaysUseHTTPSEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAlwaysUseHTTPSEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingAlwaysUseHTTPSEditResponseID string + +const ( + ZoneSettingAlwaysUseHTTPSEditResponseIDAlwaysUseHTTPS ZoneSettingAlwaysUseHTTPSEditResponseID = "always_use_https" +) + +// Current value of the zone setting. +type ZoneSettingAlwaysUseHTTPSEditResponseValue string + +const ( + ZoneSettingAlwaysUseHTTPSEditResponseValueOn ZoneSettingAlwaysUseHTTPSEditResponseValue = "on" + ZoneSettingAlwaysUseHTTPSEditResponseValueOff ZoneSettingAlwaysUseHTTPSEditResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingAlwaysUseHTTPSEditResponseEditable bool + +const ( + ZoneSettingAlwaysUseHTTPSEditResponseEditableTrue ZoneSettingAlwaysUseHTTPSEditResponseEditable = true + ZoneSettingAlwaysUseHTTPSEditResponseEditableFalse ZoneSettingAlwaysUseHTTPSEditResponseEditable = false +) + +// Reply to all requests for URLs that use "http" with a 301 redirect to the +// equivalent "https" URL. If you only want to redirect for a subset of requests, +// consider creating an "Always use HTTPS" page rule. +type ZoneSettingAlwaysUseHTTPSGetResponse struct { + // ID of the zone setting. + ID ZoneSettingAlwaysUseHTTPSGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingAlwaysUseHTTPSGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingAlwaysUseHTTPSGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingAlwaysUseHTTPSGetResponseJSON `json:"-"` +} + +// zoneSettingAlwaysUseHTTPSGetResponseJSON contains the JSON metadata for the +// struct [ZoneSettingAlwaysUseHTTPSGetResponse] +type zoneSettingAlwaysUseHTTPSGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAlwaysUseHTTPSGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingAlwaysUseHTTPSGetResponseID string + +const ( + ZoneSettingAlwaysUseHTTPSGetResponseIDAlwaysUseHTTPS ZoneSettingAlwaysUseHTTPSGetResponseID = "always_use_https" +) + +// Current value of the zone setting. +type ZoneSettingAlwaysUseHTTPSGetResponseValue string + +const ( + ZoneSettingAlwaysUseHTTPSGetResponseValueOn ZoneSettingAlwaysUseHTTPSGetResponseValue = "on" + ZoneSettingAlwaysUseHTTPSGetResponseValueOff ZoneSettingAlwaysUseHTTPSGetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingAlwaysUseHTTPSGetResponseEditable bool + +const ( + ZoneSettingAlwaysUseHTTPSGetResponseEditableTrue ZoneSettingAlwaysUseHTTPSGetResponseEditable = true + ZoneSettingAlwaysUseHTTPSGetResponseEditableFalse ZoneSettingAlwaysUseHTTPSGetResponseEditable = false +) + +type ZoneSettingAlwaysUseHTTPSEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingAlwaysUseHTTPSEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingAlwaysUseHTTPSEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingAlwaysUseHTTPSEditParamsValue string + +const ( + ZoneSettingAlwaysUseHTTPSEditParamsValueOn ZoneSettingAlwaysUseHTTPSEditParamsValue = "on" + ZoneSettingAlwaysUseHTTPSEditParamsValueOff ZoneSettingAlwaysUseHTTPSEditParamsValue = "off" +) + +type ZoneSettingAlwaysUseHTTPSEditResponseEnvelope struct { + Errors []ZoneSettingAlwaysUseHTTPSEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingAlwaysUseHTTPSEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Reply to all requests for URLs that use "http" with a 301 redirect to the + // equivalent "https" URL. If you only want to redirect for a subset of requests, + // consider creating an "Always use HTTPS" page rule. + Result ZoneSettingAlwaysUseHTTPSEditResponse `json:"result"` + JSON zoneSettingAlwaysUseHTTPSEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingAlwaysUseHTTPSEditResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingAlwaysUseHTTPSEditResponseEnvelope] +type zoneSettingAlwaysUseHTTPSEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAlwaysUseHTTPSEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAlwaysUseHTTPSEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingAlwaysUseHTTPSEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingAlwaysUseHTTPSEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingAlwaysUseHTTPSEditResponseEnvelopeErrors] +type zoneSettingAlwaysUseHTTPSEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAlwaysUseHTTPSEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAlwaysUseHTTPSEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingAlwaysUseHTTPSEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingAlwaysUseHTTPSEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingAlwaysUseHTTPSEditResponseEnvelopeMessages] +type zoneSettingAlwaysUseHTTPSEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAlwaysUseHTTPSEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAlwaysUseHTTPSGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingAlwaysUseHTTPSGetResponseEnvelope struct { + Errors []ZoneSettingAlwaysUseHTTPSGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingAlwaysUseHTTPSGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Reply to all requests for URLs that use "http" with a 301 redirect to the + // equivalent "https" URL. If you only want to redirect for a subset of requests, + // consider creating an "Always use HTTPS" page rule. + Result ZoneSettingAlwaysUseHTTPSGetResponse `json:"result"` + JSON zoneSettingAlwaysUseHTTPSGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingAlwaysUseHTTPSGetResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingAlwaysUseHTTPSGetResponseEnvelope] +type zoneSettingAlwaysUseHTTPSGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAlwaysUseHTTPSGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAlwaysUseHTTPSGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingAlwaysUseHTTPSGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingAlwaysUseHTTPSGetResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingAlwaysUseHTTPSGetResponseEnvelopeErrors] +type zoneSettingAlwaysUseHTTPSGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAlwaysUseHTTPSGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAlwaysUseHTTPSGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingAlwaysUseHTTPSGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingAlwaysUseHTTPSGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingAlwaysUseHTTPSGetResponseEnvelopeMessages] +type zoneSettingAlwaysUseHTTPSGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAlwaysUseHTTPSGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingopportunisticonion_test.go b/zonesettingalwaysusehttps_test.go similarity index 84% rename from settingopportunisticonion_test.go rename to zonesettingalwaysusehttps_test.go index 000f131ba4b..583e4a4cd8d 100644 --- a/settingopportunisticonion_test.go +++ b/zonesettingalwaysusehttps_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingOpportunisticOnionEdit(t *testing.T) { +func TestZoneSettingAlwaysUseHTTPSEdit(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 { @@ -29,9 +29,9 @@ func TestSettingOpportunisticOnionEdit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.OpportunisticOnion.Edit(context.TODO(), cloudflare.SettingOpportunisticOnionEditParams{ + _, err := client.Zones.Settings.AlwaysUseHTTPS.Edit(context.TODO(), cloudflare.ZoneSettingAlwaysUseHTTPSEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingOpportunisticOnionEditParamsValueOn), + Value: cloudflare.F(cloudflare.ZoneSettingAlwaysUseHTTPSEditParamsValueOn), }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +42,7 @@ func TestSettingOpportunisticOnionEdit(t *testing.T) { } } -func TestSettingOpportunisticOnionGet(t *testing.T) { +func TestZoneSettingAlwaysUseHTTPSGet(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 { @@ -58,7 +58,7 @@ func TestSettingOpportunisticOnionGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.OpportunisticOnion.Get(context.TODO(), cloudflare.SettingOpportunisticOnionGetParams{ + _, err := client.Zones.Settings.AlwaysUseHTTPS.Get(context.TODO(), cloudflare.ZoneSettingAlwaysUseHTTPSGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingautomatichttpsrewrite.go b/zonesettingautomatichttpsrewrite.go new file mode 100644 index 00000000000..0dd6e80d189 --- /dev/null +++ b/zonesettingautomatichttpsrewrite.go @@ -0,0 +1,321 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingAutomaticHTTPSRewriteService contains methods and other services that +// help with interacting with the cloudflare API. Note, unlike clients, this +// service does not read variables from the environment automatically. You should +// not instantiate this service directly, and instead use the +// [NewZoneSettingAutomaticHTTPSRewriteService] method instead. +type ZoneSettingAutomaticHTTPSRewriteService struct { + Options []option.RequestOption +} + +// NewZoneSettingAutomaticHTTPSRewriteService generates a new service that applies +// the given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewZoneSettingAutomaticHTTPSRewriteService(opts ...option.RequestOption) (r *ZoneSettingAutomaticHTTPSRewriteService) { + r = &ZoneSettingAutomaticHTTPSRewriteService{} + r.Options = opts + return +} + +// Enable the Automatic HTTPS Rewrites feature for this zone. +func (r *ZoneSettingAutomaticHTTPSRewriteService) Edit(ctx context.Context, params ZoneSettingAutomaticHTTPSRewriteEditParams, opts ...option.RequestOption) (res *ZoneSettingAutomaticHTTPSRewriteEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingAutomaticHTTPSRewriteEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/automatic_https_rewrites", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Enable the Automatic HTTPS Rewrites feature for this zone. +func (r *ZoneSettingAutomaticHTTPSRewriteService) Get(ctx context.Context, query ZoneSettingAutomaticHTTPSRewriteGetParams, opts ...option.RequestOption) (res *ZoneSettingAutomaticHTTPSRewriteGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingAutomaticHTTPSRewriteGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/automatic_https_rewrites", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Enable the Automatic HTTPS Rewrites feature for this zone. +type ZoneSettingAutomaticHTTPSRewriteEditResponse struct { + // ID of the zone setting. + ID ZoneSettingAutomaticHTTPSRewriteEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingAutomaticHTTPSRewriteEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingAutomaticHTTPSRewriteEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingAutomaticHTTPSRewriteEditResponseJSON `json:"-"` +} + +// zoneSettingAutomaticHTTPSRewriteEditResponseJSON contains the JSON metadata for +// the struct [ZoneSettingAutomaticHTTPSRewriteEditResponse] +type zoneSettingAutomaticHTTPSRewriteEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAutomaticHTTPSRewriteEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingAutomaticHTTPSRewriteEditResponseID string + +const ( + ZoneSettingAutomaticHTTPSRewriteEditResponseIDAutomaticHTTPSRewrites ZoneSettingAutomaticHTTPSRewriteEditResponseID = "automatic_https_rewrites" +) + +// Current value of the zone setting. +type ZoneSettingAutomaticHTTPSRewriteEditResponseValue string + +const ( + ZoneSettingAutomaticHTTPSRewriteEditResponseValueOn ZoneSettingAutomaticHTTPSRewriteEditResponseValue = "on" + ZoneSettingAutomaticHTTPSRewriteEditResponseValueOff ZoneSettingAutomaticHTTPSRewriteEditResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingAutomaticHTTPSRewriteEditResponseEditable bool + +const ( + ZoneSettingAutomaticHTTPSRewriteEditResponseEditableTrue ZoneSettingAutomaticHTTPSRewriteEditResponseEditable = true + ZoneSettingAutomaticHTTPSRewriteEditResponseEditableFalse ZoneSettingAutomaticHTTPSRewriteEditResponseEditable = false +) + +// Enable the Automatic HTTPS Rewrites feature for this zone. +type ZoneSettingAutomaticHTTPSRewriteGetResponse struct { + // ID of the zone setting. + ID ZoneSettingAutomaticHTTPSRewriteGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingAutomaticHTTPSRewriteGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingAutomaticHTTPSRewriteGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingAutomaticHTTPSRewriteGetResponseJSON `json:"-"` +} + +// zoneSettingAutomaticHTTPSRewriteGetResponseJSON contains the JSON metadata for +// the struct [ZoneSettingAutomaticHTTPSRewriteGetResponse] +type zoneSettingAutomaticHTTPSRewriteGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAutomaticHTTPSRewriteGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingAutomaticHTTPSRewriteGetResponseID string + +const ( + ZoneSettingAutomaticHTTPSRewriteGetResponseIDAutomaticHTTPSRewrites ZoneSettingAutomaticHTTPSRewriteGetResponseID = "automatic_https_rewrites" +) + +// Current value of the zone setting. +type ZoneSettingAutomaticHTTPSRewriteGetResponseValue string + +const ( + ZoneSettingAutomaticHTTPSRewriteGetResponseValueOn ZoneSettingAutomaticHTTPSRewriteGetResponseValue = "on" + ZoneSettingAutomaticHTTPSRewriteGetResponseValueOff ZoneSettingAutomaticHTTPSRewriteGetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingAutomaticHTTPSRewriteGetResponseEditable bool + +const ( + ZoneSettingAutomaticHTTPSRewriteGetResponseEditableTrue ZoneSettingAutomaticHTTPSRewriteGetResponseEditable = true + ZoneSettingAutomaticHTTPSRewriteGetResponseEditableFalse ZoneSettingAutomaticHTTPSRewriteGetResponseEditable = false +) + +type ZoneSettingAutomaticHTTPSRewriteEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. Notes: Default value depends on the zone's plan + // level. + Value param.Field[ZoneSettingAutomaticHTTPSRewriteEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingAutomaticHTTPSRewriteEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. Notes: Default value depends on the zone's plan +// level. +type ZoneSettingAutomaticHTTPSRewriteEditParamsValue string + +const ( + ZoneSettingAutomaticHTTPSRewriteEditParamsValueOn ZoneSettingAutomaticHTTPSRewriteEditParamsValue = "on" + ZoneSettingAutomaticHTTPSRewriteEditParamsValueOff ZoneSettingAutomaticHTTPSRewriteEditParamsValue = "off" +) + +type ZoneSettingAutomaticHTTPSRewriteEditResponseEnvelope struct { + Errors []ZoneSettingAutomaticHTTPSRewriteEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingAutomaticHTTPSRewriteEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Enable the Automatic HTTPS Rewrites feature for this zone. + Result ZoneSettingAutomaticHTTPSRewriteEditResponse `json:"result"` + JSON zoneSettingAutomaticHTTPSRewriteEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingAutomaticHTTPSRewriteEditResponseEnvelopeJSON contains the JSON +// metadata for the struct [ZoneSettingAutomaticHTTPSRewriteEditResponseEnvelope] +type zoneSettingAutomaticHTTPSRewriteEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAutomaticHTTPSRewriteEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAutomaticHTTPSRewriteEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingAutomaticHTTPSRewriteEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingAutomaticHTTPSRewriteEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct +// [ZoneSettingAutomaticHTTPSRewriteEditResponseEnvelopeErrors] +type zoneSettingAutomaticHTTPSRewriteEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAutomaticHTTPSRewriteEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAutomaticHTTPSRewriteEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingAutomaticHTTPSRewriteEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingAutomaticHTTPSRewriteEditResponseEnvelopeMessagesJSON contains the +// JSON metadata for the struct +// [ZoneSettingAutomaticHTTPSRewriteEditResponseEnvelopeMessages] +type zoneSettingAutomaticHTTPSRewriteEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAutomaticHTTPSRewriteEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAutomaticHTTPSRewriteGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingAutomaticHTTPSRewriteGetResponseEnvelope struct { + Errors []ZoneSettingAutomaticHTTPSRewriteGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingAutomaticHTTPSRewriteGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Enable the Automatic HTTPS Rewrites feature for this zone. + Result ZoneSettingAutomaticHTTPSRewriteGetResponse `json:"result"` + JSON zoneSettingAutomaticHTTPSRewriteGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingAutomaticHTTPSRewriteGetResponseEnvelopeJSON contains the JSON +// metadata for the struct [ZoneSettingAutomaticHTTPSRewriteGetResponseEnvelope] +type zoneSettingAutomaticHTTPSRewriteGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAutomaticHTTPSRewriteGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAutomaticHTTPSRewriteGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingAutomaticHTTPSRewriteGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingAutomaticHTTPSRewriteGetResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct +// [ZoneSettingAutomaticHTTPSRewriteGetResponseEnvelopeErrors] +type zoneSettingAutomaticHTTPSRewriteGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAutomaticHTTPSRewriteGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAutomaticHTTPSRewriteGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingAutomaticHTTPSRewriteGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingAutomaticHTTPSRewriteGetResponseEnvelopeMessagesJSON contains the +// JSON metadata for the struct +// [ZoneSettingAutomaticHTTPSRewriteGetResponseEnvelopeMessages] +type zoneSettingAutomaticHTTPSRewriteGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAutomaticHTTPSRewriteGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/zonesettingautomatichttpsrewrite_test.go b/zonesettingautomatichttpsrewrite_test.go new file mode 100644 index 00000000000..0f8c552fbfe --- /dev/null +++ b/zonesettingautomatichttpsrewrite_test.go @@ -0,0 +1,71 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingAutomaticHTTPSRewriteEdit(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.AutomaticHTTPSRewrites.Edit(context.TODO(), cloudflare.ZoneSettingAutomaticHTTPSRewriteEditParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Value: cloudflare.F(cloudflare.ZoneSettingAutomaticHTTPSRewriteEditParamsValueOn), + }) + 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 TestZoneSettingAutomaticHTTPSRewriteGet(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.AutomaticHTTPSRewrites.Get(context.TODO(), cloudflare.ZoneSettingAutomaticHTTPSRewriteGetParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/zonesettingautomaticplatformoptimization.go b/zonesettingautomaticplatformoptimization.go new file mode 100644 index 00000000000..ab3f23542a0 --- /dev/null +++ b/zonesettingautomaticplatformoptimization.go @@ -0,0 +1,308 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingAutomaticPlatformOptimizationService contains methods and other +// services that help with interacting with the cloudflare API. Note, unlike +// clients, this service does not read variables from the environment +// automatically. You should not instantiate this service directly, and instead use +// the [NewZoneSettingAutomaticPlatformOptimizationService] method instead. +type ZoneSettingAutomaticPlatformOptimizationService struct { + Options []option.RequestOption +} + +// NewZoneSettingAutomaticPlatformOptimizationService generates a new service that +// applies the given options to each request. These options are applied after the +// parent client's options (if there is one), and before any request-specific +// options. +func NewZoneSettingAutomaticPlatformOptimizationService(opts ...option.RequestOption) (r *ZoneSettingAutomaticPlatformOptimizationService) { + r = &ZoneSettingAutomaticPlatformOptimizationService{} + r.Options = opts + return +} + +// [Automatic Platform Optimization for WordPress](https://developers.cloudflare.com/automatic-platform-optimization/) +// serves your WordPress site from Cloudflare's edge network and caches third-party +// fonts. +func (r *ZoneSettingAutomaticPlatformOptimizationService) Edit(ctx context.Context, params ZoneSettingAutomaticPlatformOptimizationEditParams, opts ...option.RequestOption) (res *ZoneSettingAutomaticPlatformOptimizationEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingAutomaticPlatformOptimizationEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/automatic_platform_optimization", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// [Automatic Platform Optimization for WordPress](https://developers.cloudflare.com/automatic-platform-optimization/) +// serves your WordPress site from Cloudflare's edge network and caches third-party +// fonts. +func (r *ZoneSettingAutomaticPlatformOptimizationService) Get(ctx context.Context, query ZoneSettingAutomaticPlatformOptimizationGetParams, opts ...option.RequestOption) (res *ZoneSettingAutomaticPlatformOptimizationGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingAutomaticPlatformOptimizationGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/automatic_platform_optimization", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +type ZoneSettingAutomaticPlatformOptimizationEditResponse struct { + // Indicates whether or not + // [cache by device type](https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/) + // is enabled. + CacheByDeviceType bool `json:"cache_by_device_type,required"` + // Indicates whether or not Cloudflare proxy is enabled. + Cf bool `json:"cf,required"` + // Indicates whether or not Automatic Platform Optimization is enabled. + Enabled bool `json:"enabled,required"` + // An array of hostnames where Automatic Platform Optimization for WordPress is + // activated. + Hostnames []string `json:"hostnames,required" format:"hostname"` + // Indicates whether or not site is powered by WordPress. + Wordpress bool `json:"wordpress,required"` + // Indicates whether or not + // [Cloudflare for WordPress plugin](https://wordpress.org/plugins/cloudflare/) is + // installed. + WpPlugin bool `json:"wp_plugin,required"` + JSON zoneSettingAutomaticPlatformOptimizationEditResponseJSON `json:"-"` +} + +// zoneSettingAutomaticPlatformOptimizationEditResponseJSON contains the JSON +// metadata for the struct [ZoneSettingAutomaticPlatformOptimizationEditResponse] +type zoneSettingAutomaticPlatformOptimizationEditResponseJSON struct { + CacheByDeviceType apijson.Field + Cf apijson.Field + Enabled apijson.Field + Hostnames apijson.Field + Wordpress apijson.Field + WpPlugin apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAutomaticPlatformOptimizationEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAutomaticPlatformOptimizationGetResponse struct { + // Indicates whether or not + // [cache by device type](https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/) + // is enabled. + CacheByDeviceType bool `json:"cache_by_device_type,required"` + // Indicates whether or not Cloudflare proxy is enabled. + Cf bool `json:"cf,required"` + // Indicates whether or not Automatic Platform Optimization is enabled. + Enabled bool `json:"enabled,required"` + // An array of hostnames where Automatic Platform Optimization for WordPress is + // activated. + Hostnames []string `json:"hostnames,required" format:"hostname"` + // Indicates whether or not site is powered by WordPress. + Wordpress bool `json:"wordpress,required"` + // Indicates whether or not + // [Cloudflare for WordPress plugin](https://wordpress.org/plugins/cloudflare/) is + // installed. + WpPlugin bool `json:"wp_plugin,required"` + JSON zoneSettingAutomaticPlatformOptimizationGetResponseJSON `json:"-"` +} + +// zoneSettingAutomaticPlatformOptimizationGetResponseJSON contains the JSON +// metadata for the struct [ZoneSettingAutomaticPlatformOptimizationGetResponse] +type zoneSettingAutomaticPlatformOptimizationGetResponseJSON struct { + CacheByDeviceType apijson.Field + Cf apijson.Field + Enabled apijson.Field + Hostnames apijson.Field + Wordpress apijson.Field + WpPlugin apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAutomaticPlatformOptimizationGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAutomaticPlatformOptimizationEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + Value param.Field[ZoneSettingAutomaticPlatformOptimizationEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingAutomaticPlatformOptimizationEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneSettingAutomaticPlatformOptimizationEditParamsValue struct { + // Indicates whether or not + // [cache by device type](https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/) + // is enabled. + CacheByDeviceType param.Field[bool] `json:"cache_by_device_type,required"` + // Indicates whether or not Cloudflare proxy is enabled. + Cf param.Field[bool] `json:"cf,required"` + // Indicates whether or not Automatic Platform Optimization is enabled. + Enabled param.Field[bool] `json:"enabled,required"` + // An array of hostnames where Automatic Platform Optimization for WordPress is + // activated. + Hostnames param.Field[[]string] `json:"hostnames,required" format:"hostname"` + // Indicates whether or not site is powered by WordPress. + Wordpress param.Field[bool] `json:"wordpress,required"` + // Indicates whether or not + // [Cloudflare for WordPress plugin](https://wordpress.org/plugins/cloudflare/) is + // installed. + WpPlugin param.Field[bool] `json:"wp_plugin,required"` +} + +func (r ZoneSettingAutomaticPlatformOptimizationEditParamsValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneSettingAutomaticPlatformOptimizationEditResponseEnvelope struct { + Errors []ZoneSettingAutomaticPlatformOptimizationEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingAutomaticPlatformOptimizationEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + Result ZoneSettingAutomaticPlatformOptimizationEditResponse `json:"result"` + JSON zoneSettingAutomaticPlatformOptimizationEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingAutomaticPlatformOptimizationEditResponseEnvelopeJSON contains the +// JSON metadata for the struct +// [ZoneSettingAutomaticPlatformOptimizationEditResponseEnvelope] +type zoneSettingAutomaticPlatformOptimizationEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAutomaticPlatformOptimizationEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAutomaticPlatformOptimizationEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingAutomaticPlatformOptimizationEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingAutomaticPlatformOptimizationEditResponseEnvelopeErrorsJSON contains +// the JSON metadata for the struct +// [ZoneSettingAutomaticPlatformOptimizationEditResponseEnvelopeErrors] +type zoneSettingAutomaticPlatformOptimizationEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAutomaticPlatformOptimizationEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAutomaticPlatformOptimizationEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingAutomaticPlatformOptimizationEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingAutomaticPlatformOptimizationEditResponseEnvelopeMessagesJSON +// contains the JSON metadata for the struct +// [ZoneSettingAutomaticPlatformOptimizationEditResponseEnvelopeMessages] +type zoneSettingAutomaticPlatformOptimizationEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAutomaticPlatformOptimizationEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAutomaticPlatformOptimizationGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingAutomaticPlatformOptimizationGetResponseEnvelope struct { + Errors []ZoneSettingAutomaticPlatformOptimizationGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingAutomaticPlatformOptimizationGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + Result ZoneSettingAutomaticPlatformOptimizationGetResponse `json:"result"` + JSON zoneSettingAutomaticPlatformOptimizationGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingAutomaticPlatformOptimizationGetResponseEnvelopeJSON contains the +// JSON metadata for the struct +// [ZoneSettingAutomaticPlatformOptimizationGetResponseEnvelope] +type zoneSettingAutomaticPlatformOptimizationGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAutomaticPlatformOptimizationGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAutomaticPlatformOptimizationGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingAutomaticPlatformOptimizationGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingAutomaticPlatformOptimizationGetResponseEnvelopeErrorsJSON contains +// the JSON metadata for the struct +// [ZoneSettingAutomaticPlatformOptimizationGetResponseEnvelopeErrors] +type zoneSettingAutomaticPlatformOptimizationGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAutomaticPlatformOptimizationGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingAutomaticPlatformOptimizationGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingAutomaticPlatformOptimizationGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingAutomaticPlatformOptimizationGetResponseEnvelopeMessagesJSON contains +// the JSON metadata for the struct +// [ZoneSettingAutomaticPlatformOptimizationGetResponseEnvelopeMessages] +type zoneSettingAutomaticPlatformOptimizationGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingAutomaticPlatformOptimizationGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingautomaticplatformoptimization_test.go b/zonesettingautomaticplatformoptimization_test.go similarity index 82% rename from settingautomaticplatformoptimization_test.go rename to zonesettingautomaticplatformoptimization_test.go index 1123e1570e7..3960aa03b27 100644 --- a/settingautomaticplatformoptimization_test.go +++ b/zonesettingautomaticplatformoptimization_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingAutomaticPlatformOptimizationEdit(t *testing.T) { +func TestZoneSettingAutomaticPlatformOptimizationEdit(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 { @@ -29,9 +29,9 @@ func TestSettingAutomaticPlatformOptimizationEdit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.AutomaticPlatformOptimization.Edit(context.TODO(), cloudflare.SettingAutomaticPlatformOptimizationEditParams{ + _, err := client.Zones.Settings.AutomaticPlatformOptimization.Edit(context.TODO(), cloudflare.ZoneSettingAutomaticPlatformOptimizationEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingAutomaticPlatformOptimizationEditParamsValue{ + Value: cloudflare.F(cloudflare.ZoneSettingAutomaticPlatformOptimizationEditParamsValue{ CacheByDeviceType: cloudflare.F(false), Cf: cloudflare.F(true), Enabled: cloudflare.F(true), @@ -49,7 +49,7 @@ func TestSettingAutomaticPlatformOptimizationEdit(t *testing.T) { } } -func TestSettingAutomaticPlatformOptimizationGet(t *testing.T) { +func TestZoneSettingAutomaticPlatformOptimizationGet(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 { @@ -65,7 +65,7 @@ func TestSettingAutomaticPlatformOptimizationGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.AutomaticPlatformOptimization.Get(context.TODO(), cloudflare.SettingAutomaticPlatformOptimizationGetParams{ + _, err := client.Zones.Settings.AutomaticPlatformOptimization.Get(context.TODO(), cloudflare.ZoneSettingAutomaticPlatformOptimizationGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingbrotli.go b/zonesettingbrotli.go new file mode 100644 index 00000000000..9a3f09728b5 --- /dev/null +++ b/zonesettingbrotli.go @@ -0,0 +1,321 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingBrotliService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewZoneSettingBrotliService] method +// instead. +type ZoneSettingBrotliService struct { + Options []option.RequestOption +} + +// NewZoneSettingBrotliService generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewZoneSettingBrotliService(opts ...option.RequestOption) (r *ZoneSettingBrotliService) { + r = &ZoneSettingBrotliService{} + r.Options = opts + return +} + +// When the client requesting an asset supports the Brotli compression algorithm, +// Cloudflare will serve a Brotli compressed version of the asset. +func (r *ZoneSettingBrotliService) Edit(ctx context.Context, params ZoneSettingBrotliEditParams, opts ...option.RequestOption) (res *ZoneSettingBrotliEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingBrotliEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/brotli", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// When the client requesting an asset supports the Brotli compression algorithm, +// Cloudflare will serve a Brotli compressed version of the asset. +func (r *ZoneSettingBrotliService) Get(ctx context.Context, query ZoneSettingBrotliGetParams, opts ...option.RequestOption) (res *ZoneSettingBrotliGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingBrotliGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/brotli", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// When the client requesting an asset supports the Brotli compression algorithm, +// Cloudflare will serve a Brotli compressed version of the asset. +type ZoneSettingBrotliEditResponse struct { + // ID of the zone setting. + ID ZoneSettingBrotliEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingBrotliEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingBrotliEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingBrotliEditResponseJSON `json:"-"` +} + +// zoneSettingBrotliEditResponseJSON contains the JSON metadata for the struct +// [ZoneSettingBrotliEditResponse] +type zoneSettingBrotliEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrotliEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingBrotliEditResponseID string + +const ( + ZoneSettingBrotliEditResponseIDBrotli ZoneSettingBrotliEditResponseID = "brotli" +) + +// Current value of the zone setting. +type ZoneSettingBrotliEditResponseValue string + +const ( + ZoneSettingBrotliEditResponseValueOff ZoneSettingBrotliEditResponseValue = "off" + ZoneSettingBrotliEditResponseValueOn ZoneSettingBrotliEditResponseValue = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingBrotliEditResponseEditable bool + +const ( + ZoneSettingBrotliEditResponseEditableTrue ZoneSettingBrotliEditResponseEditable = true + ZoneSettingBrotliEditResponseEditableFalse ZoneSettingBrotliEditResponseEditable = false +) + +// When the client requesting an asset supports the Brotli compression algorithm, +// Cloudflare will serve a Brotli compressed version of the asset. +type ZoneSettingBrotliGetResponse struct { + // ID of the zone setting. + ID ZoneSettingBrotliGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingBrotliGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingBrotliGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingBrotliGetResponseJSON `json:"-"` +} + +// zoneSettingBrotliGetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingBrotliGetResponse] +type zoneSettingBrotliGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrotliGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingBrotliGetResponseID string + +const ( + ZoneSettingBrotliGetResponseIDBrotli ZoneSettingBrotliGetResponseID = "brotli" +) + +// Current value of the zone setting. +type ZoneSettingBrotliGetResponseValue string + +const ( + ZoneSettingBrotliGetResponseValueOff ZoneSettingBrotliGetResponseValue = "off" + ZoneSettingBrotliGetResponseValueOn ZoneSettingBrotliGetResponseValue = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingBrotliGetResponseEditable bool + +const ( + ZoneSettingBrotliGetResponseEditableTrue ZoneSettingBrotliGetResponseEditable = true + ZoneSettingBrotliGetResponseEditableFalse ZoneSettingBrotliGetResponseEditable = false +) + +type ZoneSettingBrotliEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingBrotliEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingBrotliEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingBrotliEditParamsValue string + +const ( + ZoneSettingBrotliEditParamsValueOff ZoneSettingBrotliEditParamsValue = "off" + ZoneSettingBrotliEditParamsValueOn ZoneSettingBrotliEditParamsValue = "on" +) + +type ZoneSettingBrotliEditResponseEnvelope struct { + Errors []ZoneSettingBrotliEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingBrotliEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // When the client requesting an asset supports the Brotli compression algorithm, + // Cloudflare will serve a Brotli compressed version of the asset. + Result ZoneSettingBrotliEditResponse `json:"result"` + JSON zoneSettingBrotliEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingBrotliEditResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingBrotliEditResponseEnvelope] +type zoneSettingBrotliEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrotliEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingBrotliEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingBrotliEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingBrotliEditResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [ZoneSettingBrotliEditResponseEnvelopeErrors] +type zoneSettingBrotliEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrotliEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingBrotliEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingBrotliEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingBrotliEditResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingBrotliEditResponseEnvelopeMessages] +type zoneSettingBrotliEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrotliEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingBrotliGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingBrotliGetResponseEnvelope struct { + Errors []ZoneSettingBrotliGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingBrotliGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // When the client requesting an asset supports the Brotli compression algorithm, + // Cloudflare will serve a Brotli compressed version of the asset. + Result ZoneSettingBrotliGetResponse `json:"result"` + JSON zoneSettingBrotliGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingBrotliGetResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingBrotliGetResponseEnvelope] +type zoneSettingBrotliGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrotliGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingBrotliGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingBrotliGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingBrotliGetResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [ZoneSettingBrotliGetResponseEnvelopeErrors] +type zoneSettingBrotliGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrotliGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingBrotliGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingBrotliGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingBrotliGetResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingBrotliGetResponseEnvelopeMessages] +type zoneSettingBrotliGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrotliGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingpseudoipv4_test.go b/zonesettingbrotli_test.go similarity index 85% rename from settingpseudoipv4_test.go rename to zonesettingbrotli_test.go index 3ef9905633e..2db97a59573 100644 --- a/settingpseudoipv4_test.go +++ b/zonesettingbrotli_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingPseudoIPV4Edit(t *testing.T) { +func TestZoneSettingBrotliEdit(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 { @@ -29,9 +29,9 @@ func TestSettingPseudoIPV4Edit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.PseudoIPV4.Edit(context.TODO(), cloudflare.SettingPseudoIPV4EditParams{ + _, err := client.Zones.Settings.Brotli.Edit(context.TODO(), cloudflare.ZoneSettingBrotliEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingPseudoIPV4EditParamsValueOff), + Value: cloudflare.F(cloudflare.ZoneSettingBrotliEditParamsValueOff), }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +42,7 @@ func TestSettingPseudoIPV4Edit(t *testing.T) { } } -func TestSettingPseudoIPV4Get(t *testing.T) { +func TestZoneSettingBrotliGet(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 { @@ -58,7 +58,7 @@ func TestSettingPseudoIPV4Get(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.PseudoIPV4.Get(context.TODO(), cloudflare.SettingPseudoIPV4GetParams{ + _, err := client.Zones.Settings.Brotli.Get(context.TODO(), cloudflare.ZoneSettingBrotliGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingbrowsercachettl.go b/zonesettingbrowsercachettl.go new file mode 100644 index 00000000000..224abe208af --- /dev/null +++ b/zonesettingbrowsercachettl.go @@ -0,0 +1,413 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingBrowserCacheTTLService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewZoneSettingBrowserCacheTTLService] method instead. +type ZoneSettingBrowserCacheTTLService struct { + Options []option.RequestOption +} + +// NewZoneSettingBrowserCacheTTLService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewZoneSettingBrowserCacheTTLService(opts ...option.RequestOption) (r *ZoneSettingBrowserCacheTTLService) { + r = &ZoneSettingBrowserCacheTTLService{} + r.Options = opts + return +} + +// Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources +// will remain on your visitors' computers. Cloudflare will honor any larger times +// specified by your server. +// (https://support.cloudflare.com/hc/en-us/articles/200168276). +func (r *ZoneSettingBrowserCacheTTLService) Edit(ctx context.Context, params ZoneSettingBrowserCacheTTLEditParams, opts ...option.RequestOption) (res *ZoneSettingBrowserCacheTTLEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingBrowserCacheTTLEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/browser_cache_ttl", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources +// will remain on your visitors' computers. Cloudflare will honor any larger times +// specified by your server. +// (https://support.cloudflare.com/hc/en-us/articles/200168276). +func (r *ZoneSettingBrowserCacheTTLService) Get(ctx context.Context, query ZoneSettingBrowserCacheTTLGetParams, opts ...option.RequestOption) (res *ZoneSettingBrowserCacheTTLGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingBrowserCacheTTLGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/browser_cache_ttl", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources +// will remain on your visitors' computers. Cloudflare will honor any larger times +// specified by your server. +// (https://support.cloudflare.com/hc/en-us/articles/200168276). +type ZoneSettingBrowserCacheTTLEditResponse struct { + // ID of the zone setting. + ID ZoneSettingBrowserCacheTTLEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingBrowserCacheTTLEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingBrowserCacheTTLEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingBrowserCacheTTLEditResponseJSON `json:"-"` +} + +// zoneSettingBrowserCacheTTLEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingBrowserCacheTTLEditResponse] +type zoneSettingBrowserCacheTTLEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrowserCacheTTLEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingBrowserCacheTTLEditResponseID string + +const ( + ZoneSettingBrowserCacheTTLEditResponseIDBrowserCacheTTL ZoneSettingBrowserCacheTTLEditResponseID = "browser_cache_ttl" +) + +// Current value of the zone setting. +type ZoneSettingBrowserCacheTTLEditResponseValue float64 + +const ( + ZoneSettingBrowserCacheTTLEditResponseValue0 ZoneSettingBrowserCacheTTLEditResponseValue = 0 + ZoneSettingBrowserCacheTTLEditResponseValue30 ZoneSettingBrowserCacheTTLEditResponseValue = 30 + ZoneSettingBrowserCacheTTLEditResponseValue60 ZoneSettingBrowserCacheTTLEditResponseValue = 60 + ZoneSettingBrowserCacheTTLEditResponseValue120 ZoneSettingBrowserCacheTTLEditResponseValue = 120 + ZoneSettingBrowserCacheTTLEditResponseValue300 ZoneSettingBrowserCacheTTLEditResponseValue = 300 + ZoneSettingBrowserCacheTTLEditResponseValue1200 ZoneSettingBrowserCacheTTLEditResponseValue = 1200 + ZoneSettingBrowserCacheTTLEditResponseValue1800 ZoneSettingBrowserCacheTTLEditResponseValue = 1800 + ZoneSettingBrowserCacheTTLEditResponseValue3600 ZoneSettingBrowserCacheTTLEditResponseValue = 3600 + ZoneSettingBrowserCacheTTLEditResponseValue7200 ZoneSettingBrowserCacheTTLEditResponseValue = 7200 + ZoneSettingBrowserCacheTTLEditResponseValue10800 ZoneSettingBrowserCacheTTLEditResponseValue = 10800 + ZoneSettingBrowserCacheTTLEditResponseValue14400 ZoneSettingBrowserCacheTTLEditResponseValue = 14400 + ZoneSettingBrowserCacheTTLEditResponseValue18000 ZoneSettingBrowserCacheTTLEditResponseValue = 18000 + ZoneSettingBrowserCacheTTLEditResponseValue28800 ZoneSettingBrowserCacheTTLEditResponseValue = 28800 + ZoneSettingBrowserCacheTTLEditResponseValue43200 ZoneSettingBrowserCacheTTLEditResponseValue = 43200 + ZoneSettingBrowserCacheTTLEditResponseValue57600 ZoneSettingBrowserCacheTTLEditResponseValue = 57600 + ZoneSettingBrowserCacheTTLEditResponseValue72000 ZoneSettingBrowserCacheTTLEditResponseValue = 72000 + ZoneSettingBrowserCacheTTLEditResponseValue86400 ZoneSettingBrowserCacheTTLEditResponseValue = 86400 + ZoneSettingBrowserCacheTTLEditResponseValue172800 ZoneSettingBrowserCacheTTLEditResponseValue = 172800 + ZoneSettingBrowserCacheTTLEditResponseValue259200 ZoneSettingBrowserCacheTTLEditResponseValue = 259200 + ZoneSettingBrowserCacheTTLEditResponseValue345600 ZoneSettingBrowserCacheTTLEditResponseValue = 345600 + ZoneSettingBrowserCacheTTLEditResponseValue432000 ZoneSettingBrowserCacheTTLEditResponseValue = 432000 + ZoneSettingBrowserCacheTTLEditResponseValue691200 ZoneSettingBrowserCacheTTLEditResponseValue = 691200 + ZoneSettingBrowserCacheTTLEditResponseValue1382400 ZoneSettingBrowserCacheTTLEditResponseValue = 1382400 + ZoneSettingBrowserCacheTTLEditResponseValue2073600 ZoneSettingBrowserCacheTTLEditResponseValue = 2073600 + ZoneSettingBrowserCacheTTLEditResponseValue2678400 ZoneSettingBrowserCacheTTLEditResponseValue = 2678400 + ZoneSettingBrowserCacheTTLEditResponseValue5356800 ZoneSettingBrowserCacheTTLEditResponseValue = 5356800 + ZoneSettingBrowserCacheTTLEditResponseValue16070400 ZoneSettingBrowserCacheTTLEditResponseValue = 16070400 + ZoneSettingBrowserCacheTTLEditResponseValue31536000 ZoneSettingBrowserCacheTTLEditResponseValue = 31536000 +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingBrowserCacheTTLEditResponseEditable bool + +const ( + ZoneSettingBrowserCacheTTLEditResponseEditableTrue ZoneSettingBrowserCacheTTLEditResponseEditable = true + ZoneSettingBrowserCacheTTLEditResponseEditableFalse ZoneSettingBrowserCacheTTLEditResponseEditable = false +) + +// Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources +// will remain on your visitors' computers. Cloudflare will honor any larger times +// specified by your server. +// (https://support.cloudflare.com/hc/en-us/articles/200168276). +type ZoneSettingBrowserCacheTTLGetResponse struct { + // ID of the zone setting. + ID ZoneSettingBrowserCacheTTLGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingBrowserCacheTTLGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingBrowserCacheTTLGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingBrowserCacheTTLGetResponseJSON `json:"-"` +} + +// zoneSettingBrowserCacheTTLGetResponseJSON contains the JSON metadata for the +// struct [ZoneSettingBrowserCacheTTLGetResponse] +type zoneSettingBrowserCacheTTLGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrowserCacheTTLGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingBrowserCacheTTLGetResponseID string + +const ( + ZoneSettingBrowserCacheTTLGetResponseIDBrowserCacheTTL ZoneSettingBrowserCacheTTLGetResponseID = "browser_cache_ttl" +) + +// Current value of the zone setting. +type ZoneSettingBrowserCacheTTLGetResponseValue float64 + +const ( + ZoneSettingBrowserCacheTTLGetResponseValue0 ZoneSettingBrowserCacheTTLGetResponseValue = 0 + ZoneSettingBrowserCacheTTLGetResponseValue30 ZoneSettingBrowserCacheTTLGetResponseValue = 30 + ZoneSettingBrowserCacheTTLGetResponseValue60 ZoneSettingBrowserCacheTTLGetResponseValue = 60 + ZoneSettingBrowserCacheTTLGetResponseValue120 ZoneSettingBrowserCacheTTLGetResponseValue = 120 + ZoneSettingBrowserCacheTTLGetResponseValue300 ZoneSettingBrowserCacheTTLGetResponseValue = 300 + ZoneSettingBrowserCacheTTLGetResponseValue1200 ZoneSettingBrowserCacheTTLGetResponseValue = 1200 + ZoneSettingBrowserCacheTTLGetResponseValue1800 ZoneSettingBrowserCacheTTLGetResponseValue = 1800 + ZoneSettingBrowserCacheTTLGetResponseValue3600 ZoneSettingBrowserCacheTTLGetResponseValue = 3600 + ZoneSettingBrowserCacheTTLGetResponseValue7200 ZoneSettingBrowserCacheTTLGetResponseValue = 7200 + ZoneSettingBrowserCacheTTLGetResponseValue10800 ZoneSettingBrowserCacheTTLGetResponseValue = 10800 + ZoneSettingBrowserCacheTTLGetResponseValue14400 ZoneSettingBrowserCacheTTLGetResponseValue = 14400 + ZoneSettingBrowserCacheTTLGetResponseValue18000 ZoneSettingBrowserCacheTTLGetResponseValue = 18000 + ZoneSettingBrowserCacheTTLGetResponseValue28800 ZoneSettingBrowserCacheTTLGetResponseValue = 28800 + ZoneSettingBrowserCacheTTLGetResponseValue43200 ZoneSettingBrowserCacheTTLGetResponseValue = 43200 + ZoneSettingBrowserCacheTTLGetResponseValue57600 ZoneSettingBrowserCacheTTLGetResponseValue = 57600 + ZoneSettingBrowserCacheTTLGetResponseValue72000 ZoneSettingBrowserCacheTTLGetResponseValue = 72000 + ZoneSettingBrowserCacheTTLGetResponseValue86400 ZoneSettingBrowserCacheTTLGetResponseValue = 86400 + ZoneSettingBrowserCacheTTLGetResponseValue172800 ZoneSettingBrowserCacheTTLGetResponseValue = 172800 + ZoneSettingBrowserCacheTTLGetResponseValue259200 ZoneSettingBrowserCacheTTLGetResponseValue = 259200 + ZoneSettingBrowserCacheTTLGetResponseValue345600 ZoneSettingBrowserCacheTTLGetResponseValue = 345600 + ZoneSettingBrowserCacheTTLGetResponseValue432000 ZoneSettingBrowserCacheTTLGetResponseValue = 432000 + ZoneSettingBrowserCacheTTLGetResponseValue691200 ZoneSettingBrowserCacheTTLGetResponseValue = 691200 + ZoneSettingBrowserCacheTTLGetResponseValue1382400 ZoneSettingBrowserCacheTTLGetResponseValue = 1382400 + ZoneSettingBrowserCacheTTLGetResponseValue2073600 ZoneSettingBrowserCacheTTLGetResponseValue = 2073600 + ZoneSettingBrowserCacheTTLGetResponseValue2678400 ZoneSettingBrowserCacheTTLGetResponseValue = 2678400 + ZoneSettingBrowserCacheTTLGetResponseValue5356800 ZoneSettingBrowserCacheTTLGetResponseValue = 5356800 + ZoneSettingBrowserCacheTTLGetResponseValue16070400 ZoneSettingBrowserCacheTTLGetResponseValue = 16070400 + ZoneSettingBrowserCacheTTLGetResponseValue31536000 ZoneSettingBrowserCacheTTLGetResponseValue = 31536000 +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingBrowserCacheTTLGetResponseEditable bool + +const ( + ZoneSettingBrowserCacheTTLGetResponseEditableTrue ZoneSettingBrowserCacheTTLGetResponseEditable = true + ZoneSettingBrowserCacheTTLGetResponseEditableFalse ZoneSettingBrowserCacheTTLGetResponseEditable = false +) + +type ZoneSettingBrowserCacheTTLEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. Notes: Setting a TTL of 0 is equivalent to selecting + // `Respect Existing Headers` + Value param.Field[ZoneSettingBrowserCacheTTLEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingBrowserCacheTTLEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. Notes: Setting a TTL of 0 is equivalent to selecting +// `Respect Existing Headers` +type ZoneSettingBrowserCacheTTLEditParamsValue float64 + +const ( + ZoneSettingBrowserCacheTTLEditParamsValue0 ZoneSettingBrowserCacheTTLEditParamsValue = 0 + ZoneSettingBrowserCacheTTLEditParamsValue30 ZoneSettingBrowserCacheTTLEditParamsValue = 30 + ZoneSettingBrowserCacheTTLEditParamsValue60 ZoneSettingBrowserCacheTTLEditParamsValue = 60 + ZoneSettingBrowserCacheTTLEditParamsValue120 ZoneSettingBrowserCacheTTLEditParamsValue = 120 + ZoneSettingBrowserCacheTTLEditParamsValue300 ZoneSettingBrowserCacheTTLEditParamsValue = 300 + ZoneSettingBrowserCacheTTLEditParamsValue1200 ZoneSettingBrowserCacheTTLEditParamsValue = 1200 + ZoneSettingBrowserCacheTTLEditParamsValue1800 ZoneSettingBrowserCacheTTLEditParamsValue = 1800 + ZoneSettingBrowserCacheTTLEditParamsValue3600 ZoneSettingBrowserCacheTTLEditParamsValue = 3600 + ZoneSettingBrowserCacheTTLEditParamsValue7200 ZoneSettingBrowserCacheTTLEditParamsValue = 7200 + ZoneSettingBrowserCacheTTLEditParamsValue10800 ZoneSettingBrowserCacheTTLEditParamsValue = 10800 + ZoneSettingBrowserCacheTTLEditParamsValue14400 ZoneSettingBrowserCacheTTLEditParamsValue = 14400 + ZoneSettingBrowserCacheTTLEditParamsValue18000 ZoneSettingBrowserCacheTTLEditParamsValue = 18000 + ZoneSettingBrowserCacheTTLEditParamsValue28800 ZoneSettingBrowserCacheTTLEditParamsValue = 28800 + ZoneSettingBrowserCacheTTLEditParamsValue43200 ZoneSettingBrowserCacheTTLEditParamsValue = 43200 + ZoneSettingBrowserCacheTTLEditParamsValue57600 ZoneSettingBrowserCacheTTLEditParamsValue = 57600 + ZoneSettingBrowserCacheTTLEditParamsValue72000 ZoneSettingBrowserCacheTTLEditParamsValue = 72000 + ZoneSettingBrowserCacheTTLEditParamsValue86400 ZoneSettingBrowserCacheTTLEditParamsValue = 86400 + ZoneSettingBrowserCacheTTLEditParamsValue172800 ZoneSettingBrowserCacheTTLEditParamsValue = 172800 + ZoneSettingBrowserCacheTTLEditParamsValue259200 ZoneSettingBrowserCacheTTLEditParamsValue = 259200 + ZoneSettingBrowserCacheTTLEditParamsValue345600 ZoneSettingBrowserCacheTTLEditParamsValue = 345600 + ZoneSettingBrowserCacheTTLEditParamsValue432000 ZoneSettingBrowserCacheTTLEditParamsValue = 432000 + ZoneSettingBrowserCacheTTLEditParamsValue691200 ZoneSettingBrowserCacheTTLEditParamsValue = 691200 + ZoneSettingBrowserCacheTTLEditParamsValue1382400 ZoneSettingBrowserCacheTTLEditParamsValue = 1382400 + ZoneSettingBrowserCacheTTLEditParamsValue2073600 ZoneSettingBrowserCacheTTLEditParamsValue = 2073600 + ZoneSettingBrowserCacheTTLEditParamsValue2678400 ZoneSettingBrowserCacheTTLEditParamsValue = 2678400 + ZoneSettingBrowserCacheTTLEditParamsValue5356800 ZoneSettingBrowserCacheTTLEditParamsValue = 5356800 + ZoneSettingBrowserCacheTTLEditParamsValue16070400 ZoneSettingBrowserCacheTTLEditParamsValue = 16070400 + ZoneSettingBrowserCacheTTLEditParamsValue31536000 ZoneSettingBrowserCacheTTLEditParamsValue = 31536000 +) + +type ZoneSettingBrowserCacheTTLEditResponseEnvelope struct { + Errors []ZoneSettingBrowserCacheTTLEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingBrowserCacheTTLEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources + // will remain on your visitors' computers. Cloudflare will honor any larger times + // specified by your server. + // (https://support.cloudflare.com/hc/en-us/articles/200168276). + Result ZoneSettingBrowserCacheTTLEditResponse `json:"result"` + JSON zoneSettingBrowserCacheTTLEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingBrowserCacheTTLEditResponseEnvelopeJSON contains the JSON metadata +// for the struct [ZoneSettingBrowserCacheTTLEditResponseEnvelope] +type zoneSettingBrowserCacheTTLEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrowserCacheTTLEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingBrowserCacheTTLEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingBrowserCacheTTLEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingBrowserCacheTTLEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingBrowserCacheTTLEditResponseEnvelopeErrors] +type zoneSettingBrowserCacheTTLEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrowserCacheTTLEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingBrowserCacheTTLEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingBrowserCacheTTLEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingBrowserCacheTTLEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingBrowserCacheTTLEditResponseEnvelopeMessages] +type zoneSettingBrowserCacheTTLEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrowserCacheTTLEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingBrowserCacheTTLGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingBrowserCacheTTLGetResponseEnvelope struct { + Errors []ZoneSettingBrowserCacheTTLGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingBrowserCacheTTLGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources + // will remain on your visitors' computers. Cloudflare will honor any larger times + // specified by your server. + // (https://support.cloudflare.com/hc/en-us/articles/200168276). + Result ZoneSettingBrowserCacheTTLGetResponse `json:"result"` + JSON zoneSettingBrowserCacheTTLGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingBrowserCacheTTLGetResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingBrowserCacheTTLGetResponseEnvelope] +type zoneSettingBrowserCacheTTLGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrowserCacheTTLGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingBrowserCacheTTLGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingBrowserCacheTTLGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingBrowserCacheTTLGetResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingBrowserCacheTTLGetResponseEnvelopeErrors] +type zoneSettingBrowserCacheTTLGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrowserCacheTTLGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingBrowserCacheTTLGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingBrowserCacheTTLGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingBrowserCacheTTLGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingBrowserCacheTTLGetResponseEnvelopeMessages] +type zoneSettingBrowserCacheTTLGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrowserCacheTTLGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/zonesettingbrowsercachettl_test.go b/zonesettingbrowsercachettl_test.go new file mode 100644 index 00000000000..929c206b786 --- /dev/null +++ b/zonesettingbrowsercachettl_test.go @@ -0,0 +1,71 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingBrowserCacheTTLEdit(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.BrowserCacheTTL.Edit(context.TODO(), cloudflare.ZoneSettingBrowserCacheTTLEditParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Value: cloudflare.F(cloudflare.ZoneSettingBrowserCacheTTLEditParamsValue0), + }) + 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 TestZoneSettingBrowserCacheTTLGet(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.BrowserCacheTTL.Get(context.TODO(), cloudflare.ZoneSettingBrowserCacheTTLGetParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/zonesettingbrowsercheck.go b/zonesettingbrowsercheck.go new file mode 100644 index 00000000000..cee4618261b --- /dev/null +++ b/zonesettingbrowsercheck.go @@ -0,0 +1,339 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingBrowserCheckService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewZoneSettingBrowserCheckService] method instead. +type ZoneSettingBrowserCheckService struct { + Options []option.RequestOption +} + +// NewZoneSettingBrowserCheckService generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewZoneSettingBrowserCheckService(opts ...option.RequestOption) (r *ZoneSettingBrowserCheckService) { + r = &ZoneSettingBrowserCheckService{} + r.Options = opts + return +} + +// Browser Integrity Check is similar to Bad Behavior and looks for common HTTP +// headers abused most commonly by spammers and denies access to your page. It will +// also challenge visitors that do not have a user agent or a non standard user +// agent (also commonly used by abuse bots, crawlers or visitors). +// (https://support.cloudflare.com/hc/en-us/articles/200170086). +func (r *ZoneSettingBrowserCheckService) Edit(ctx context.Context, params ZoneSettingBrowserCheckEditParams, opts ...option.RequestOption) (res *ZoneSettingBrowserCheckEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingBrowserCheckEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/browser_check", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Browser Integrity Check is similar to Bad Behavior and looks for common HTTP +// headers abused most commonly by spammers and denies access to your page. It will +// also challenge visitors that do not have a user agent or a non standard user +// agent (also commonly used by abuse bots, crawlers or visitors). +// (https://support.cloudflare.com/hc/en-us/articles/200170086). +func (r *ZoneSettingBrowserCheckService) Get(ctx context.Context, query ZoneSettingBrowserCheckGetParams, opts ...option.RequestOption) (res *ZoneSettingBrowserCheckGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingBrowserCheckGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/browser_check", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Browser Integrity Check is similar to Bad Behavior and looks for common HTTP +// headers abused most commonly by spammers and denies access to your page. It will +// also challenge visitors that do not have a user agent or a non standard user +// agent (also commonly used by abuse bots, crawlers or visitors). +// (https://support.cloudflare.com/hc/en-us/articles/200170086). +type ZoneSettingBrowserCheckEditResponse struct { + // ID of the zone setting. + ID ZoneSettingBrowserCheckEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingBrowserCheckEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingBrowserCheckEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingBrowserCheckEditResponseJSON `json:"-"` +} + +// zoneSettingBrowserCheckEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingBrowserCheckEditResponse] +type zoneSettingBrowserCheckEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrowserCheckEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingBrowserCheckEditResponseID string + +const ( + ZoneSettingBrowserCheckEditResponseIDBrowserCheck ZoneSettingBrowserCheckEditResponseID = "browser_check" +) + +// Current value of the zone setting. +type ZoneSettingBrowserCheckEditResponseValue string + +const ( + ZoneSettingBrowserCheckEditResponseValueOn ZoneSettingBrowserCheckEditResponseValue = "on" + ZoneSettingBrowserCheckEditResponseValueOff ZoneSettingBrowserCheckEditResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingBrowserCheckEditResponseEditable bool + +const ( + ZoneSettingBrowserCheckEditResponseEditableTrue ZoneSettingBrowserCheckEditResponseEditable = true + ZoneSettingBrowserCheckEditResponseEditableFalse ZoneSettingBrowserCheckEditResponseEditable = false +) + +// Browser Integrity Check is similar to Bad Behavior and looks for common HTTP +// headers abused most commonly by spammers and denies access to your page. It will +// also challenge visitors that do not have a user agent or a non standard user +// agent (also commonly used by abuse bots, crawlers or visitors). +// (https://support.cloudflare.com/hc/en-us/articles/200170086). +type ZoneSettingBrowserCheckGetResponse struct { + // ID of the zone setting. + ID ZoneSettingBrowserCheckGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingBrowserCheckGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingBrowserCheckGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingBrowserCheckGetResponseJSON `json:"-"` +} + +// zoneSettingBrowserCheckGetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingBrowserCheckGetResponse] +type zoneSettingBrowserCheckGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrowserCheckGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingBrowserCheckGetResponseID string + +const ( + ZoneSettingBrowserCheckGetResponseIDBrowserCheck ZoneSettingBrowserCheckGetResponseID = "browser_check" +) + +// Current value of the zone setting. +type ZoneSettingBrowserCheckGetResponseValue string + +const ( + ZoneSettingBrowserCheckGetResponseValueOn ZoneSettingBrowserCheckGetResponseValue = "on" + ZoneSettingBrowserCheckGetResponseValueOff ZoneSettingBrowserCheckGetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingBrowserCheckGetResponseEditable bool + +const ( + ZoneSettingBrowserCheckGetResponseEditableTrue ZoneSettingBrowserCheckGetResponseEditable = true + ZoneSettingBrowserCheckGetResponseEditableFalse ZoneSettingBrowserCheckGetResponseEditable = false +) + +type ZoneSettingBrowserCheckEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingBrowserCheckEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingBrowserCheckEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingBrowserCheckEditParamsValue string + +const ( + ZoneSettingBrowserCheckEditParamsValueOn ZoneSettingBrowserCheckEditParamsValue = "on" + ZoneSettingBrowserCheckEditParamsValueOff ZoneSettingBrowserCheckEditParamsValue = "off" +) + +type ZoneSettingBrowserCheckEditResponseEnvelope struct { + Errors []ZoneSettingBrowserCheckEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingBrowserCheckEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Browser Integrity Check is similar to Bad Behavior and looks for common HTTP + // headers abused most commonly by spammers and denies access to your page. It will + // also challenge visitors that do not have a user agent or a non standard user + // agent (also commonly used by abuse bots, crawlers or visitors). + // (https://support.cloudflare.com/hc/en-us/articles/200170086). + Result ZoneSettingBrowserCheckEditResponse `json:"result"` + JSON zoneSettingBrowserCheckEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingBrowserCheckEditResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingBrowserCheckEditResponseEnvelope] +type zoneSettingBrowserCheckEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrowserCheckEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingBrowserCheckEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingBrowserCheckEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingBrowserCheckEditResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [ZoneSettingBrowserCheckEditResponseEnvelopeErrors] +type zoneSettingBrowserCheckEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrowserCheckEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingBrowserCheckEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingBrowserCheckEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingBrowserCheckEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingBrowserCheckEditResponseEnvelopeMessages] +type zoneSettingBrowserCheckEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrowserCheckEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingBrowserCheckGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingBrowserCheckGetResponseEnvelope struct { + Errors []ZoneSettingBrowserCheckGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingBrowserCheckGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Browser Integrity Check is similar to Bad Behavior and looks for common HTTP + // headers abused most commonly by spammers and denies access to your page. It will + // also challenge visitors that do not have a user agent or a non standard user + // agent (also commonly used by abuse bots, crawlers or visitors). + // (https://support.cloudflare.com/hc/en-us/articles/200170086). + Result ZoneSettingBrowserCheckGetResponse `json:"result"` + JSON zoneSettingBrowserCheckGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingBrowserCheckGetResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingBrowserCheckGetResponseEnvelope] +type zoneSettingBrowserCheckGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrowserCheckGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingBrowserCheckGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingBrowserCheckGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingBrowserCheckGetResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [ZoneSettingBrowserCheckGetResponseEnvelopeErrors] +type zoneSettingBrowserCheckGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrowserCheckGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingBrowserCheckGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingBrowserCheckGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingBrowserCheckGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingBrowserCheckGetResponseEnvelopeMessages] +type zoneSettingBrowserCheckGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingBrowserCheckGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingalwaysonline_test.go b/zonesettingbrowsercheck_test.go similarity index 83% rename from settingalwaysonline_test.go rename to zonesettingbrowsercheck_test.go index 0d5027cb0b2..3091f0d38be 100644 --- a/settingalwaysonline_test.go +++ b/zonesettingbrowsercheck_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingAlwaysOnlineEdit(t *testing.T) { +func TestZoneSettingBrowserCheckEdit(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 { @@ -29,9 +29,9 @@ func TestSettingAlwaysOnlineEdit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.AlwaysOnline.Edit(context.TODO(), cloudflare.SettingAlwaysOnlineEditParams{ + _, err := client.Zones.Settings.BrowserCheck.Edit(context.TODO(), cloudflare.ZoneSettingBrowserCheckEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingAlwaysOnlineEditParamsValueOn), + Value: cloudflare.F(cloudflare.ZoneSettingBrowserCheckEditParamsValueOn), }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +42,7 @@ func TestSettingAlwaysOnlineEdit(t *testing.T) { } } -func TestSettingAlwaysOnlineGet(t *testing.T) { +func TestZoneSettingBrowserCheckGet(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 { @@ -58,7 +58,7 @@ func TestSettingAlwaysOnlineGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.AlwaysOnline.Get(context.TODO(), cloudflare.SettingAlwaysOnlineGetParams{ + _, err := client.Zones.Settings.BrowserCheck.Get(context.TODO(), cloudflare.ZoneSettingBrowserCheckGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingcachelevel.go b/zonesettingcachelevel.go new file mode 100644 index 00000000000..d26380ee058 --- /dev/null +++ b/zonesettingcachelevel.go @@ -0,0 +1,342 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingCacheLevelService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewZoneSettingCacheLevelService] +// method instead. +type ZoneSettingCacheLevelService struct { + Options []option.RequestOption +} + +// NewZoneSettingCacheLevelService generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewZoneSettingCacheLevelService(opts ...option.RequestOption) (r *ZoneSettingCacheLevelService) { + r = &ZoneSettingCacheLevelService{} + r.Options = opts + return +} + +// Cache Level functions based off the setting level. The basic setting will cache +// most static resources (i.e., css, images, and JavaScript). The simplified +// setting will ignore the query string when delivering a cached resource. The +// aggressive setting will cache all static resources, including ones with a query +// string. (https://support.cloudflare.com/hc/en-us/articles/200168256). +func (r *ZoneSettingCacheLevelService) Edit(ctx context.Context, params ZoneSettingCacheLevelEditParams, opts ...option.RequestOption) (res *ZoneSettingCacheLevelEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingCacheLevelEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/cache_level", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Cache Level functions based off the setting level. The basic setting will cache +// most static resources (i.e., css, images, and JavaScript). The simplified +// setting will ignore the query string when delivering a cached resource. The +// aggressive setting will cache all static resources, including ones with a query +// string. (https://support.cloudflare.com/hc/en-us/articles/200168256). +func (r *ZoneSettingCacheLevelService) Get(ctx context.Context, query ZoneSettingCacheLevelGetParams, opts ...option.RequestOption) (res *ZoneSettingCacheLevelGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingCacheLevelGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/cache_level", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Cache Level functions based off the setting level. The basic setting will cache +// most static resources (i.e., css, images, and JavaScript). The simplified +// setting will ignore the query string when delivering a cached resource. The +// aggressive setting will cache all static resources, including ones with a query +// string. (https://support.cloudflare.com/hc/en-us/articles/200168256). +type ZoneSettingCacheLevelEditResponse struct { + // ID of the zone setting. + ID ZoneSettingCacheLevelEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingCacheLevelEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingCacheLevelEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingCacheLevelEditResponseJSON `json:"-"` +} + +// zoneSettingCacheLevelEditResponseJSON contains the JSON metadata for the struct +// [ZoneSettingCacheLevelEditResponse] +type zoneSettingCacheLevelEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingCacheLevelEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingCacheLevelEditResponseID string + +const ( + ZoneSettingCacheLevelEditResponseIDCacheLevel ZoneSettingCacheLevelEditResponseID = "cache_level" +) + +// Current value of the zone setting. +type ZoneSettingCacheLevelEditResponseValue string + +const ( + ZoneSettingCacheLevelEditResponseValueAggressive ZoneSettingCacheLevelEditResponseValue = "aggressive" + ZoneSettingCacheLevelEditResponseValueBasic ZoneSettingCacheLevelEditResponseValue = "basic" + ZoneSettingCacheLevelEditResponseValueSimplified ZoneSettingCacheLevelEditResponseValue = "simplified" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingCacheLevelEditResponseEditable bool + +const ( + ZoneSettingCacheLevelEditResponseEditableTrue ZoneSettingCacheLevelEditResponseEditable = true + ZoneSettingCacheLevelEditResponseEditableFalse ZoneSettingCacheLevelEditResponseEditable = false +) + +// Cache Level functions based off the setting level. The basic setting will cache +// most static resources (i.e., css, images, and JavaScript). The simplified +// setting will ignore the query string when delivering a cached resource. The +// aggressive setting will cache all static resources, including ones with a query +// string. (https://support.cloudflare.com/hc/en-us/articles/200168256). +type ZoneSettingCacheLevelGetResponse struct { + // ID of the zone setting. + ID ZoneSettingCacheLevelGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingCacheLevelGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingCacheLevelGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingCacheLevelGetResponseJSON `json:"-"` +} + +// zoneSettingCacheLevelGetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingCacheLevelGetResponse] +type zoneSettingCacheLevelGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingCacheLevelGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingCacheLevelGetResponseID string + +const ( + ZoneSettingCacheLevelGetResponseIDCacheLevel ZoneSettingCacheLevelGetResponseID = "cache_level" +) + +// Current value of the zone setting. +type ZoneSettingCacheLevelGetResponseValue string + +const ( + ZoneSettingCacheLevelGetResponseValueAggressive ZoneSettingCacheLevelGetResponseValue = "aggressive" + ZoneSettingCacheLevelGetResponseValueBasic ZoneSettingCacheLevelGetResponseValue = "basic" + ZoneSettingCacheLevelGetResponseValueSimplified ZoneSettingCacheLevelGetResponseValue = "simplified" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingCacheLevelGetResponseEditable bool + +const ( + ZoneSettingCacheLevelGetResponseEditableTrue ZoneSettingCacheLevelGetResponseEditable = true + ZoneSettingCacheLevelGetResponseEditableFalse ZoneSettingCacheLevelGetResponseEditable = false +) + +type ZoneSettingCacheLevelEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingCacheLevelEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingCacheLevelEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingCacheLevelEditParamsValue string + +const ( + ZoneSettingCacheLevelEditParamsValueAggressive ZoneSettingCacheLevelEditParamsValue = "aggressive" + ZoneSettingCacheLevelEditParamsValueBasic ZoneSettingCacheLevelEditParamsValue = "basic" + ZoneSettingCacheLevelEditParamsValueSimplified ZoneSettingCacheLevelEditParamsValue = "simplified" +) + +type ZoneSettingCacheLevelEditResponseEnvelope struct { + Errors []ZoneSettingCacheLevelEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingCacheLevelEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Cache Level functions based off the setting level. The basic setting will cache + // most static resources (i.e., css, images, and JavaScript). The simplified + // setting will ignore the query string when delivering a cached resource. The + // aggressive setting will cache all static resources, including ones with a query + // string. (https://support.cloudflare.com/hc/en-us/articles/200168256). + Result ZoneSettingCacheLevelEditResponse `json:"result"` + JSON zoneSettingCacheLevelEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingCacheLevelEditResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingCacheLevelEditResponseEnvelope] +type zoneSettingCacheLevelEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingCacheLevelEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingCacheLevelEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingCacheLevelEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingCacheLevelEditResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [ZoneSettingCacheLevelEditResponseEnvelopeErrors] +type zoneSettingCacheLevelEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingCacheLevelEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingCacheLevelEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingCacheLevelEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingCacheLevelEditResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [ZoneSettingCacheLevelEditResponseEnvelopeMessages] +type zoneSettingCacheLevelEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingCacheLevelEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingCacheLevelGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingCacheLevelGetResponseEnvelope struct { + Errors []ZoneSettingCacheLevelGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingCacheLevelGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Cache Level functions based off the setting level. The basic setting will cache + // most static resources (i.e., css, images, and JavaScript). The simplified + // setting will ignore the query string when delivering a cached resource. The + // aggressive setting will cache all static resources, including ones with a query + // string. (https://support.cloudflare.com/hc/en-us/articles/200168256). + Result ZoneSettingCacheLevelGetResponse `json:"result"` + JSON zoneSettingCacheLevelGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingCacheLevelGetResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingCacheLevelGetResponseEnvelope] +type zoneSettingCacheLevelGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingCacheLevelGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingCacheLevelGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingCacheLevelGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingCacheLevelGetResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [ZoneSettingCacheLevelGetResponseEnvelopeErrors] +type zoneSettingCacheLevelGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingCacheLevelGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingCacheLevelGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingCacheLevelGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingCacheLevelGetResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [ZoneSettingCacheLevelGetResponseEnvelopeMessages] +type zoneSettingCacheLevelGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingCacheLevelGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingbrowsercachettl_test.go b/zonesettingcachelevel_test.go similarity index 84% rename from settingbrowsercachettl_test.go rename to zonesettingcachelevel_test.go index b82a37d783c..131ccf988f2 100644 --- a/settingbrowsercachettl_test.go +++ b/zonesettingcachelevel_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingBrowserCacheTTLEdit(t *testing.T) { +func TestZoneSettingCacheLevelEdit(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 { @@ -29,9 +29,9 @@ func TestSettingBrowserCacheTTLEdit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.BrowserCacheTTL.Edit(context.TODO(), cloudflare.SettingBrowserCacheTTLEditParams{ + _, err := client.Zones.Settings.CacheLevel.Edit(context.TODO(), cloudflare.ZoneSettingCacheLevelEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingBrowserCacheTTLEditParamsValue0), + Value: cloudflare.F(cloudflare.ZoneSettingCacheLevelEditParamsValueAggressive), }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +42,7 @@ func TestSettingBrowserCacheTTLEdit(t *testing.T) { } } -func TestSettingBrowserCacheTTLGet(t *testing.T) { +func TestZoneSettingCacheLevelGet(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 { @@ -58,7 +58,7 @@ func TestSettingBrowserCacheTTLGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.BrowserCacheTTL.Get(context.TODO(), cloudflare.SettingBrowserCacheTTLGetParams{ + _, err := client.Zones.Settings.CacheLevel.Get(context.TODO(), cloudflare.ZoneSettingCacheLevelGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingchallengettl.go b/zonesettingchallengettl.go new file mode 100644 index 00000000000..88fafdc5790 --- /dev/null +++ b/zonesettingchallengettl.go @@ -0,0 +1,375 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingChallengeTTLService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewZoneSettingChallengeTTLService] method instead. +type ZoneSettingChallengeTTLService struct { + Options []option.RequestOption +} + +// NewZoneSettingChallengeTTLService generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewZoneSettingChallengeTTLService(opts ...option.RequestOption) (r *ZoneSettingChallengeTTLService) { + r = &ZoneSettingChallengeTTLService{} + r.Options = opts + return +} + +// Specify how long a visitor is allowed access to your site after successfully +// completing a challenge (such as a CAPTCHA). After the TTL has expired the +// visitor will have to complete a new challenge. We recommend a 15 - 45 minute +// setting and will attempt to honor any setting above 45 minutes. +// (https://support.cloudflare.com/hc/en-us/articles/200170136). +func (r *ZoneSettingChallengeTTLService) Edit(ctx context.Context, params ZoneSettingChallengeTTLEditParams, opts ...option.RequestOption) (res *ZoneSettingChallengeTTLEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingChallengeTTLEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/challenge_ttl", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Specify how long a visitor is allowed access to your site after successfully +// completing a challenge (such as a CAPTCHA). After the TTL has expired the +// visitor will have to complete a new challenge. We recommend a 15 - 45 minute +// setting and will attempt to honor any setting above 45 minutes. +// (https://support.cloudflare.com/hc/en-us/articles/200170136). +func (r *ZoneSettingChallengeTTLService) Get(ctx context.Context, query ZoneSettingChallengeTTLGetParams, opts ...option.RequestOption) (res *ZoneSettingChallengeTTLGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingChallengeTTLGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/challenge_ttl", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Specify how long a visitor is allowed access to your site after successfully +// completing a challenge (such as a CAPTCHA). After the TTL has expired the +// visitor will have to complete a new challenge. We recommend a 15 - 45 minute +// setting and will attempt to honor any setting above 45 minutes. +// (https://support.cloudflare.com/hc/en-us/articles/200170136). +type ZoneSettingChallengeTTLEditResponse struct { + // ID of the zone setting. + ID ZoneSettingChallengeTTLEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingChallengeTTLEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingChallengeTTLEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingChallengeTTLEditResponseJSON `json:"-"` +} + +// zoneSettingChallengeTTLEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingChallengeTTLEditResponse] +type zoneSettingChallengeTTLEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingChallengeTTLEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingChallengeTTLEditResponseID string + +const ( + ZoneSettingChallengeTTLEditResponseIDChallengeTTL ZoneSettingChallengeTTLEditResponseID = "challenge_ttl" +) + +// Current value of the zone setting. +type ZoneSettingChallengeTTLEditResponseValue float64 + +const ( + ZoneSettingChallengeTTLEditResponseValue300 ZoneSettingChallengeTTLEditResponseValue = 300 + ZoneSettingChallengeTTLEditResponseValue900 ZoneSettingChallengeTTLEditResponseValue = 900 + ZoneSettingChallengeTTLEditResponseValue1800 ZoneSettingChallengeTTLEditResponseValue = 1800 + ZoneSettingChallengeTTLEditResponseValue2700 ZoneSettingChallengeTTLEditResponseValue = 2700 + ZoneSettingChallengeTTLEditResponseValue3600 ZoneSettingChallengeTTLEditResponseValue = 3600 + ZoneSettingChallengeTTLEditResponseValue7200 ZoneSettingChallengeTTLEditResponseValue = 7200 + ZoneSettingChallengeTTLEditResponseValue10800 ZoneSettingChallengeTTLEditResponseValue = 10800 + ZoneSettingChallengeTTLEditResponseValue14400 ZoneSettingChallengeTTLEditResponseValue = 14400 + ZoneSettingChallengeTTLEditResponseValue28800 ZoneSettingChallengeTTLEditResponseValue = 28800 + ZoneSettingChallengeTTLEditResponseValue57600 ZoneSettingChallengeTTLEditResponseValue = 57600 + ZoneSettingChallengeTTLEditResponseValue86400 ZoneSettingChallengeTTLEditResponseValue = 86400 + ZoneSettingChallengeTTLEditResponseValue604800 ZoneSettingChallengeTTLEditResponseValue = 604800 + ZoneSettingChallengeTTLEditResponseValue2592000 ZoneSettingChallengeTTLEditResponseValue = 2592000 + ZoneSettingChallengeTTLEditResponseValue31536000 ZoneSettingChallengeTTLEditResponseValue = 31536000 +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingChallengeTTLEditResponseEditable bool + +const ( + ZoneSettingChallengeTTLEditResponseEditableTrue ZoneSettingChallengeTTLEditResponseEditable = true + ZoneSettingChallengeTTLEditResponseEditableFalse ZoneSettingChallengeTTLEditResponseEditable = false +) + +// Specify how long a visitor is allowed access to your site after successfully +// completing a challenge (such as a CAPTCHA). After the TTL has expired the +// visitor will have to complete a new challenge. We recommend a 15 - 45 minute +// setting and will attempt to honor any setting above 45 minutes. +// (https://support.cloudflare.com/hc/en-us/articles/200170136). +type ZoneSettingChallengeTTLGetResponse struct { + // ID of the zone setting. + ID ZoneSettingChallengeTTLGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingChallengeTTLGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingChallengeTTLGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingChallengeTTLGetResponseJSON `json:"-"` +} + +// zoneSettingChallengeTTLGetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingChallengeTTLGetResponse] +type zoneSettingChallengeTTLGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingChallengeTTLGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingChallengeTTLGetResponseID string + +const ( + ZoneSettingChallengeTTLGetResponseIDChallengeTTL ZoneSettingChallengeTTLGetResponseID = "challenge_ttl" +) + +// Current value of the zone setting. +type ZoneSettingChallengeTTLGetResponseValue float64 + +const ( + ZoneSettingChallengeTTLGetResponseValue300 ZoneSettingChallengeTTLGetResponseValue = 300 + ZoneSettingChallengeTTLGetResponseValue900 ZoneSettingChallengeTTLGetResponseValue = 900 + ZoneSettingChallengeTTLGetResponseValue1800 ZoneSettingChallengeTTLGetResponseValue = 1800 + ZoneSettingChallengeTTLGetResponseValue2700 ZoneSettingChallengeTTLGetResponseValue = 2700 + ZoneSettingChallengeTTLGetResponseValue3600 ZoneSettingChallengeTTLGetResponseValue = 3600 + ZoneSettingChallengeTTLGetResponseValue7200 ZoneSettingChallengeTTLGetResponseValue = 7200 + ZoneSettingChallengeTTLGetResponseValue10800 ZoneSettingChallengeTTLGetResponseValue = 10800 + ZoneSettingChallengeTTLGetResponseValue14400 ZoneSettingChallengeTTLGetResponseValue = 14400 + ZoneSettingChallengeTTLGetResponseValue28800 ZoneSettingChallengeTTLGetResponseValue = 28800 + ZoneSettingChallengeTTLGetResponseValue57600 ZoneSettingChallengeTTLGetResponseValue = 57600 + ZoneSettingChallengeTTLGetResponseValue86400 ZoneSettingChallengeTTLGetResponseValue = 86400 + ZoneSettingChallengeTTLGetResponseValue604800 ZoneSettingChallengeTTLGetResponseValue = 604800 + ZoneSettingChallengeTTLGetResponseValue2592000 ZoneSettingChallengeTTLGetResponseValue = 2592000 + ZoneSettingChallengeTTLGetResponseValue31536000 ZoneSettingChallengeTTLGetResponseValue = 31536000 +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingChallengeTTLGetResponseEditable bool + +const ( + ZoneSettingChallengeTTLGetResponseEditableTrue ZoneSettingChallengeTTLGetResponseEditable = true + ZoneSettingChallengeTTLGetResponseEditableFalse ZoneSettingChallengeTTLGetResponseEditable = false +) + +type ZoneSettingChallengeTTLEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingChallengeTTLEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingChallengeTTLEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingChallengeTTLEditParamsValue float64 + +const ( + ZoneSettingChallengeTTLEditParamsValue300 ZoneSettingChallengeTTLEditParamsValue = 300 + ZoneSettingChallengeTTLEditParamsValue900 ZoneSettingChallengeTTLEditParamsValue = 900 + ZoneSettingChallengeTTLEditParamsValue1800 ZoneSettingChallengeTTLEditParamsValue = 1800 + ZoneSettingChallengeTTLEditParamsValue2700 ZoneSettingChallengeTTLEditParamsValue = 2700 + ZoneSettingChallengeTTLEditParamsValue3600 ZoneSettingChallengeTTLEditParamsValue = 3600 + ZoneSettingChallengeTTLEditParamsValue7200 ZoneSettingChallengeTTLEditParamsValue = 7200 + ZoneSettingChallengeTTLEditParamsValue10800 ZoneSettingChallengeTTLEditParamsValue = 10800 + ZoneSettingChallengeTTLEditParamsValue14400 ZoneSettingChallengeTTLEditParamsValue = 14400 + ZoneSettingChallengeTTLEditParamsValue28800 ZoneSettingChallengeTTLEditParamsValue = 28800 + ZoneSettingChallengeTTLEditParamsValue57600 ZoneSettingChallengeTTLEditParamsValue = 57600 + ZoneSettingChallengeTTLEditParamsValue86400 ZoneSettingChallengeTTLEditParamsValue = 86400 + ZoneSettingChallengeTTLEditParamsValue604800 ZoneSettingChallengeTTLEditParamsValue = 604800 + ZoneSettingChallengeTTLEditParamsValue2592000 ZoneSettingChallengeTTLEditParamsValue = 2592000 + ZoneSettingChallengeTTLEditParamsValue31536000 ZoneSettingChallengeTTLEditParamsValue = 31536000 +) + +type ZoneSettingChallengeTTLEditResponseEnvelope struct { + Errors []ZoneSettingChallengeTTLEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingChallengeTTLEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Specify how long a visitor is allowed access to your site after successfully + // completing a challenge (such as a CAPTCHA). After the TTL has expired the + // visitor will have to complete a new challenge. We recommend a 15 - 45 minute + // setting and will attempt to honor any setting above 45 minutes. + // (https://support.cloudflare.com/hc/en-us/articles/200170136). + Result ZoneSettingChallengeTTLEditResponse `json:"result"` + JSON zoneSettingChallengeTTLEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingChallengeTTLEditResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingChallengeTTLEditResponseEnvelope] +type zoneSettingChallengeTTLEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingChallengeTTLEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingChallengeTTLEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingChallengeTTLEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingChallengeTTLEditResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [ZoneSettingChallengeTTLEditResponseEnvelopeErrors] +type zoneSettingChallengeTTLEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingChallengeTTLEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingChallengeTTLEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingChallengeTTLEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingChallengeTTLEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingChallengeTTLEditResponseEnvelopeMessages] +type zoneSettingChallengeTTLEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingChallengeTTLEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingChallengeTTLGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingChallengeTTLGetResponseEnvelope struct { + Errors []ZoneSettingChallengeTTLGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingChallengeTTLGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Specify how long a visitor is allowed access to your site after successfully + // completing a challenge (such as a CAPTCHA). After the TTL has expired the + // visitor will have to complete a new challenge. We recommend a 15 - 45 minute + // setting and will attempt to honor any setting above 45 minutes. + // (https://support.cloudflare.com/hc/en-us/articles/200170136). + Result ZoneSettingChallengeTTLGetResponse `json:"result"` + JSON zoneSettingChallengeTTLGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingChallengeTTLGetResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingChallengeTTLGetResponseEnvelope] +type zoneSettingChallengeTTLGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingChallengeTTLGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingChallengeTTLGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingChallengeTTLGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingChallengeTTLGetResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [ZoneSettingChallengeTTLGetResponseEnvelopeErrors] +type zoneSettingChallengeTTLGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingChallengeTTLGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingChallengeTTLGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingChallengeTTLGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingChallengeTTLGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingChallengeTTLGetResponseEnvelopeMessages] +type zoneSettingChallengeTTLGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingChallengeTTLGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingalwaysusehttps_test.go b/zonesettingchallengettl_test.go similarity index 83% rename from settingalwaysusehttps_test.go rename to zonesettingchallengettl_test.go index e8924ad9d52..b984224b6f4 100644 --- a/settingalwaysusehttps_test.go +++ b/zonesettingchallengettl_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingAlwaysUseHTTPSEdit(t *testing.T) { +func TestZoneSettingChallengeTTLEdit(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 { @@ -29,9 +29,9 @@ func TestSettingAlwaysUseHTTPSEdit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.AlwaysUseHTTPS.Edit(context.TODO(), cloudflare.SettingAlwaysUseHTTPSEditParams{ + _, err := client.Zones.Settings.ChallengeTTL.Edit(context.TODO(), cloudflare.ZoneSettingChallengeTTLEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingAlwaysUseHTTPSEditParamsValueOn), + Value: cloudflare.F(cloudflare.ZoneSettingChallengeTTLEditParamsValue300), }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +42,7 @@ func TestSettingAlwaysUseHTTPSEdit(t *testing.T) { } } -func TestSettingAlwaysUseHTTPSGet(t *testing.T) { +func TestZoneSettingChallengeTTLGet(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 { @@ -58,7 +58,7 @@ func TestSettingAlwaysUseHTTPSGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.AlwaysUseHTTPS.Get(context.TODO(), cloudflare.SettingAlwaysUseHTTPSGetParams{ + _, err := client.Zones.Settings.ChallengeTTL.Get(context.TODO(), cloudflare.ZoneSettingChallengeTTLGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingcipher.go b/zonesettingcipher.go new file mode 100644 index 00000000000..290f3edcd7d --- /dev/null +++ b/zonesettingcipher.go @@ -0,0 +1,295 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingCipherService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewZoneSettingCipherService] method +// instead. +type ZoneSettingCipherService struct { + Options []option.RequestOption +} + +// NewZoneSettingCipherService generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewZoneSettingCipherService(opts ...option.RequestOption) (r *ZoneSettingCipherService) { + r = &ZoneSettingCipherService{} + r.Options = opts + return +} + +// Changes ciphers setting. +func (r *ZoneSettingCipherService) Edit(ctx context.Context, params ZoneSettingCipherEditParams, opts ...option.RequestOption) (res *ZoneSettingCipherEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingCipherEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/ciphers", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Gets ciphers setting. +func (r *ZoneSettingCipherService) Get(ctx context.Context, query ZoneSettingCipherGetParams, opts ...option.RequestOption) (res *ZoneSettingCipherGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingCipherGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/ciphers", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// An allowlist of ciphers for TLS termination. These ciphers must be in the +// BoringSSL format. +type ZoneSettingCipherEditResponse struct { + // ID of the zone setting. + ID ZoneSettingCipherEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value []string `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingCipherEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingCipherEditResponseJSON `json:"-"` +} + +// zoneSettingCipherEditResponseJSON contains the JSON metadata for the struct +// [ZoneSettingCipherEditResponse] +type zoneSettingCipherEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingCipherEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingCipherEditResponseID string + +const ( + ZoneSettingCipherEditResponseIDCiphers ZoneSettingCipherEditResponseID = "ciphers" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingCipherEditResponseEditable bool + +const ( + ZoneSettingCipherEditResponseEditableTrue ZoneSettingCipherEditResponseEditable = true + ZoneSettingCipherEditResponseEditableFalse ZoneSettingCipherEditResponseEditable = false +) + +// An allowlist of ciphers for TLS termination. These ciphers must be in the +// BoringSSL format. +type ZoneSettingCipherGetResponse struct { + // ID of the zone setting. + ID ZoneSettingCipherGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value []string `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingCipherGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingCipherGetResponseJSON `json:"-"` +} + +// zoneSettingCipherGetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingCipherGetResponse] +type zoneSettingCipherGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingCipherGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingCipherGetResponseID string + +const ( + ZoneSettingCipherGetResponseIDCiphers ZoneSettingCipherGetResponseID = "ciphers" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingCipherGetResponseEditable bool + +const ( + ZoneSettingCipherGetResponseEditableTrue ZoneSettingCipherGetResponseEditable = true + ZoneSettingCipherGetResponseEditableFalse ZoneSettingCipherGetResponseEditable = false +) + +type ZoneSettingCipherEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[[]string] `json:"value,required"` +} + +func (r ZoneSettingCipherEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneSettingCipherEditResponseEnvelope struct { + Errors []ZoneSettingCipherEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingCipherEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // An allowlist of ciphers for TLS termination. These ciphers must be in the + // BoringSSL format. + Result ZoneSettingCipherEditResponse `json:"result"` + JSON zoneSettingCipherEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingCipherEditResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingCipherEditResponseEnvelope] +type zoneSettingCipherEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingCipherEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingCipherEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingCipherEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingCipherEditResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [ZoneSettingCipherEditResponseEnvelopeErrors] +type zoneSettingCipherEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingCipherEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingCipherEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingCipherEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingCipherEditResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingCipherEditResponseEnvelopeMessages] +type zoneSettingCipherEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingCipherEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingCipherGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingCipherGetResponseEnvelope struct { + Errors []ZoneSettingCipherGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingCipherGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // An allowlist of ciphers for TLS termination. These ciphers must be in the + // BoringSSL format. + Result ZoneSettingCipherGetResponse `json:"result"` + JSON zoneSettingCipherGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingCipherGetResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingCipherGetResponseEnvelope] +type zoneSettingCipherGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingCipherGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingCipherGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingCipherGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingCipherGetResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [ZoneSettingCipherGetResponseEnvelopeErrors] +type zoneSettingCipherGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingCipherGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingCipherGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingCipherGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingCipherGetResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingCipherGetResponseEnvelopeMessages] +type zoneSettingCipherGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingCipherGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingcipher_test.go b/zonesettingcipher_test.go similarity index 88% rename from settingcipher_test.go rename to zonesettingcipher_test.go index 2aef1335754..0454c84d1f2 100644 --- a/settingcipher_test.go +++ b/zonesettingcipher_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingCipherEdit(t *testing.T) { +func TestZoneSettingCipherEdit(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 { @@ -29,7 +29,7 @@ func TestSettingCipherEdit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.Ciphers.Edit(context.TODO(), cloudflare.SettingCipherEditParams{ + _, err := client.Zones.Settings.Ciphers.Edit(context.TODO(), cloudflare.ZoneSettingCipherEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Value: cloudflare.F([]string{"ECDHE-RSA-AES128-GCM-SHA256", "AES128-SHA"}), }) @@ -42,7 +42,7 @@ func TestSettingCipherEdit(t *testing.T) { } } -func TestSettingCipherGet(t *testing.T) { +func TestZoneSettingCipherGet(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 { @@ -58,7 +58,7 @@ func TestSettingCipherGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.Ciphers.Get(context.TODO(), cloudflare.SettingCipherGetParams{ + _, err := client.Zones.Settings.Ciphers.Get(context.TODO(), cloudflare.ZoneSettingCipherGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingdevelopmentmode.go b/zonesettingdevelopmentmode.go new file mode 100644 index 00000000000..1889e1fca6e --- /dev/null +++ b/zonesettingdevelopmentmode.go @@ -0,0 +1,355 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingDevelopmentModeService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewZoneSettingDevelopmentModeService] method instead. +type ZoneSettingDevelopmentModeService struct { + Options []option.RequestOption +} + +// NewZoneSettingDevelopmentModeService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewZoneSettingDevelopmentModeService(opts ...option.RequestOption) (r *ZoneSettingDevelopmentModeService) { + r = &ZoneSettingDevelopmentModeService{} + r.Options = opts + return +} + +// Development Mode temporarily allows you to enter development mode for your +// websites if you need to make changes to your site. This will bypass Cloudflare's +// accelerated cache and slow down your site, but is useful if you are making +// changes to cacheable content (like images, css, or JavaScript) and would like to +// see those changes right away. Once entered, development mode will last for 3 +// hours and then automatically toggle off. +func (r *ZoneSettingDevelopmentModeService) Edit(ctx context.Context, params ZoneSettingDevelopmentModeEditParams, opts ...option.RequestOption) (res *ZoneSettingDevelopmentModeEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingDevelopmentModeEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/development_mode", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Development Mode temporarily allows you to enter development mode for your +// websites if you need to make changes to your site. This will bypass Cloudflare's +// accelerated cache and slow down your site, but is useful if you are making +// changes to cacheable content (like images, css, or JavaScript) and would like to +// see those changes right away. Once entered, development mode will last for 3 +// hours and then automatically toggle off. +func (r *ZoneSettingDevelopmentModeService) Get(ctx context.Context, query ZoneSettingDevelopmentModeGetParams, opts ...option.RequestOption) (res *ZoneSettingDevelopmentModeGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingDevelopmentModeGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/development_mode", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Development Mode temporarily allows you to enter development mode for your +// websites if you need to make changes to your site. This will bypass Cloudflare's +// accelerated cache and slow down your site, but is useful if you are making +// changes to cacheable content (like images, css, or JavaScript) and would like to +// see those changes right away. Once entered, development mode will last for 3 +// hours and then automatically toggle off. +type ZoneSettingDevelopmentModeEditResponse struct { + // ID of the zone setting. + ID ZoneSettingDevelopmentModeEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingDevelopmentModeEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingDevelopmentModeEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. Notes: The interval (in seconds) from when + // development mode expires (positive integer) or last expired (negative integer) + // for the domain. If development mode has never been enabled, this value is false. + TimeRemaining float64 `json:"time_remaining"` + JSON zoneSettingDevelopmentModeEditResponseJSON `json:"-"` +} + +// zoneSettingDevelopmentModeEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingDevelopmentModeEditResponse] +type zoneSettingDevelopmentModeEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + TimeRemaining apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingDevelopmentModeEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingDevelopmentModeEditResponseID string + +const ( + ZoneSettingDevelopmentModeEditResponseIDDevelopmentMode ZoneSettingDevelopmentModeEditResponseID = "development_mode" +) + +// Current value of the zone setting. +type ZoneSettingDevelopmentModeEditResponseValue string + +const ( + ZoneSettingDevelopmentModeEditResponseValueOn ZoneSettingDevelopmentModeEditResponseValue = "on" + ZoneSettingDevelopmentModeEditResponseValueOff ZoneSettingDevelopmentModeEditResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingDevelopmentModeEditResponseEditable bool + +const ( + ZoneSettingDevelopmentModeEditResponseEditableTrue ZoneSettingDevelopmentModeEditResponseEditable = true + ZoneSettingDevelopmentModeEditResponseEditableFalse ZoneSettingDevelopmentModeEditResponseEditable = false +) + +// Development Mode temporarily allows you to enter development mode for your +// websites if you need to make changes to your site. This will bypass Cloudflare's +// accelerated cache and slow down your site, but is useful if you are making +// changes to cacheable content (like images, css, or JavaScript) and would like to +// see those changes right away. Once entered, development mode will last for 3 +// hours and then automatically toggle off. +type ZoneSettingDevelopmentModeGetResponse struct { + // ID of the zone setting. + ID ZoneSettingDevelopmentModeGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingDevelopmentModeGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingDevelopmentModeGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + // Value of the zone setting. Notes: The interval (in seconds) from when + // development mode expires (positive integer) or last expired (negative integer) + // for the domain. If development mode has never been enabled, this value is false. + TimeRemaining float64 `json:"time_remaining"` + JSON zoneSettingDevelopmentModeGetResponseJSON `json:"-"` +} + +// zoneSettingDevelopmentModeGetResponseJSON contains the JSON metadata for the +// struct [ZoneSettingDevelopmentModeGetResponse] +type zoneSettingDevelopmentModeGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + TimeRemaining apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingDevelopmentModeGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingDevelopmentModeGetResponseID string + +const ( + ZoneSettingDevelopmentModeGetResponseIDDevelopmentMode ZoneSettingDevelopmentModeGetResponseID = "development_mode" +) + +// Current value of the zone setting. +type ZoneSettingDevelopmentModeGetResponseValue string + +const ( + ZoneSettingDevelopmentModeGetResponseValueOn ZoneSettingDevelopmentModeGetResponseValue = "on" + ZoneSettingDevelopmentModeGetResponseValueOff ZoneSettingDevelopmentModeGetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingDevelopmentModeGetResponseEditable bool + +const ( + ZoneSettingDevelopmentModeGetResponseEditableTrue ZoneSettingDevelopmentModeGetResponseEditable = true + ZoneSettingDevelopmentModeGetResponseEditableFalse ZoneSettingDevelopmentModeGetResponseEditable = false +) + +type ZoneSettingDevelopmentModeEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingDevelopmentModeEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingDevelopmentModeEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingDevelopmentModeEditParamsValue string + +const ( + ZoneSettingDevelopmentModeEditParamsValueOn ZoneSettingDevelopmentModeEditParamsValue = "on" + ZoneSettingDevelopmentModeEditParamsValueOff ZoneSettingDevelopmentModeEditParamsValue = "off" +) + +type ZoneSettingDevelopmentModeEditResponseEnvelope struct { + Errors []ZoneSettingDevelopmentModeEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingDevelopmentModeEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Development Mode temporarily allows you to enter development mode for your + // websites if you need to make changes to your site. This will bypass Cloudflare's + // accelerated cache and slow down your site, but is useful if you are making + // changes to cacheable content (like images, css, or JavaScript) and would like to + // see those changes right away. Once entered, development mode will last for 3 + // hours and then automatically toggle off. + Result ZoneSettingDevelopmentModeEditResponse `json:"result"` + JSON zoneSettingDevelopmentModeEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingDevelopmentModeEditResponseEnvelopeJSON contains the JSON metadata +// for the struct [ZoneSettingDevelopmentModeEditResponseEnvelope] +type zoneSettingDevelopmentModeEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingDevelopmentModeEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingDevelopmentModeEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingDevelopmentModeEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingDevelopmentModeEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingDevelopmentModeEditResponseEnvelopeErrors] +type zoneSettingDevelopmentModeEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingDevelopmentModeEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingDevelopmentModeEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingDevelopmentModeEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingDevelopmentModeEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingDevelopmentModeEditResponseEnvelopeMessages] +type zoneSettingDevelopmentModeEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingDevelopmentModeEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingDevelopmentModeGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingDevelopmentModeGetResponseEnvelope struct { + Errors []ZoneSettingDevelopmentModeGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingDevelopmentModeGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Development Mode temporarily allows you to enter development mode for your + // websites if you need to make changes to your site. This will bypass Cloudflare's + // accelerated cache and slow down your site, but is useful if you are making + // changes to cacheable content (like images, css, or JavaScript) and would like to + // see those changes right away. Once entered, development mode will last for 3 + // hours and then automatically toggle off. + Result ZoneSettingDevelopmentModeGetResponse `json:"result"` + JSON zoneSettingDevelopmentModeGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingDevelopmentModeGetResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingDevelopmentModeGetResponseEnvelope] +type zoneSettingDevelopmentModeGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingDevelopmentModeGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingDevelopmentModeGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingDevelopmentModeGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingDevelopmentModeGetResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingDevelopmentModeGetResponseEnvelopeErrors] +type zoneSettingDevelopmentModeGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingDevelopmentModeGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingDevelopmentModeGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingDevelopmentModeGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingDevelopmentModeGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingDevelopmentModeGetResponseEnvelopeMessages] +type zoneSettingDevelopmentModeGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingDevelopmentModeGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/zonesettingdevelopmentmode_test.go b/zonesettingdevelopmentmode_test.go new file mode 100644 index 00000000000..920dea03046 --- /dev/null +++ b/zonesettingdevelopmentmode_test.go @@ -0,0 +1,71 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingDevelopmentModeEdit(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.DevelopmentMode.Edit(context.TODO(), cloudflare.ZoneSettingDevelopmentModeEditParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Value: cloudflare.F(cloudflare.ZoneSettingDevelopmentModeEditParamsValueOn), + }) + 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 TestZoneSettingDevelopmentModeGet(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.DevelopmentMode.Get(context.TODO(), cloudflare.ZoneSettingDevelopmentModeGetParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/zonesettingearlyhint.go b/zonesettingearlyhint.go new file mode 100644 index 00000000000..5a2975275d2 --- /dev/null +++ b/zonesettingearlyhint.go @@ -0,0 +1,333 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingEarlyHintService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewZoneSettingEarlyHintService] +// method instead. +type ZoneSettingEarlyHintService struct { + Options []option.RequestOption +} + +// NewZoneSettingEarlyHintService generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewZoneSettingEarlyHintService(opts ...option.RequestOption) (r *ZoneSettingEarlyHintService) { + r = &ZoneSettingEarlyHintService{} + r.Options = opts + return +} + +// When enabled, Cloudflare will attempt to speed up overall page loads by serving +// `103` responses with `Link` headers from the final response. Refer to +// [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for +// more information. +func (r *ZoneSettingEarlyHintService) Edit(ctx context.Context, params ZoneSettingEarlyHintEditParams, opts ...option.RequestOption) (res *ZoneSettingEarlyHintEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingEarlyHintEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/early_hints", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// When enabled, Cloudflare will attempt to speed up overall page loads by serving +// `103` responses with `Link` headers from the final response. Refer to +// [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for +// more information. +func (r *ZoneSettingEarlyHintService) Get(ctx context.Context, query ZoneSettingEarlyHintGetParams, opts ...option.RequestOption) (res *ZoneSettingEarlyHintGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingEarlyHintGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/early_hints", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// When enabled, Cloudflare will attempt to speed up overall page loads by serving +// `103` responses with `Link` headers from the final response. Refer to +// [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for +// more information. +type ZoneSettingEarlyHintEditResponse struct { + // ID of the zone setting. + ID ZoneSettingEarlyHintEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEarlyHintEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEarlyHintEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEarlyHintEditResponseJSON `json:"-"` +} + +// zoneSettingEarlyHintEditResponseJSON contains the JSON metadata for the struct +// [ZoneSettingEarlyHintEditResponse] +type zoneSettingEarlyHintEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEarlyHintEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingEarlyHintEditResponseID string + +const ( + ZoneSettingEarlyHintEditResponseIDEarlyHints ZoneSettingEarlyHintEditResponseID = "early_hints" +) + +// Current value of the zone setting. +type ZoneSettingEarlyHintEditResponseValue string + +const ( + ZoneSettingEarlyHintEditResponseValueOn ZoneSettingEarlyHintEditResponseValue = "on" + ZoneSettingEarlyHintEditResponseValueOff ZoneSettingEarlyHintEditResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEarlyHintEditResponseEditable bool + +const ( + ZoneSettingEarlyHintEditResponseEditableTrue ZoneSettingEarlyHintEditResponseEditable = true + ZoneSettingEarlyHintEditResponseEditableFalse ZoneSettingEarlyHintEditResponseEditable = false +) + +// When enabled, Cloudflare will attempt to speed up overall page loads by serving +// `103` responses with `Link` headers from the final response. Refer to +// [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for +// more information. +type ZoneSettingEarlyHintGetResponse struct { + // ID of the zone setting. + ID ZoneSettingEarlyHintGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEarlyHintGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEarlyHintGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEarlyHintGetResponseJSON `json:"-"` +} + +// zoneSettingEarlyHintGetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingEarlyHintGetResponse] +type zoneSettingEarlyHintGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEarlyHintGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingEarlyHintGetResponseID string + +const ( + ZoneSettingEarlyHintGetResponseIDEarlyHints ZoneSettingEarlyHintGetResponseID = "early_hints" +) + +// Current value of the zone setting. +type ZoneSettingEarlyHintGetResponseValue string + +const ( + ZoneSettingEarlyHintGetResponseValueOn ZoneSettingEarlyHintGetResponseValue = "on" + ZoneSettingEarlyHintGetResponseValueOff ZoneSettingEarlyHintGetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEarlyHintGetResponseEditable bool + +const ( + ZoneSettingEarlyHintGetResponseEditableTrue ZoneSettingEarlyHintGetResponseEditable = true + ZoneSettingEarlyHintGetResponseEditableFalse ZoneSettingEarlyHintGetResponseEditable = false +) + +type ZoneSettingEarlyHintEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingEarlyHintEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingEarlyHintEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingEarlyHintEditParamsValue string + +const ( + ZoneSettingEarlyHintEditParamsValueOn ZoneSettingEarlyHintEditParamsValue = "on" + ZoneSettingEarlyHintEditParamsValueOff ZoneSettingEarlyHintEditParamsValue = "off" +) + +type ZoneSettingEarlyHintEditResponseEnvelope struct { + Errors []ZoneSettingEarlyHintEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingEarlyHintEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // When enabled, Cloudflare will attempt to speed up overall page loads by serving + // `103` responses with `Link` headers from the final response. Refer to + // [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for + // more information. + Result ZoneSettingEarlyHintEditResponse `json:"result"` + JSON zoneSettingEarlyHintEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingEarlyHintEditResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingEarlyHintEditResponseEnvelope] +type zoneSettingEarlyHintEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEarlyHintEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingEarlyHintEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingEarlyHintEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingEarlyHintEditResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [ZoneSettingEarlyHintEditResponseEnvelopeErrors] +type zoneSettingEarlyHintEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEarlyHintEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingEarlyHintEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingEarlyHintEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingEarlyHintEditResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [ZoneSettingEarlyHintEditResponseEnvelopeMessages] +type zoneSettingEarlyHintEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEarlyHintEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingEarlyHintGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingEarlyHintGetResponseEnvelope struct { + Errors []ZoneSettingEarlyHintGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingEarlyHintGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // When enabled, Cloudflare will attempt to speed up overall page loads by serving + // `103` responses with `Link` headers from the final response. Refer to + // [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for + // more information. + Result ZoneSettingEarlyHintGetResponse `json:"result"` + JSON zoneSettingEarlyHintGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingEarlyHintGetResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingEarlyHintGetResponseEnvelope] +type zoneSettingEarlyHintGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEarlyHintGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingEarlyHintGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingEarlyHintGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingEarlyHintGetResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [ZoneSettingEarlyHintGetResponseEnvelopeErrors] +type zoneSettingEarlyHintGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEarlyHintGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingEarlyHintGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingEarlyHintGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingEarlyHintGetResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [ZoneSettingEarlyHintGetResponseEnvelopeMessages] +type zoneSettingEarlyHintGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEarlyHintGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingipgeolocation_test.go b/zonesettingearlyhint_test.go similarity index 84% rename from settingipgeolocation_test.go rename to zonesettingearlyhint_test.go index bd492ba8e54..987c0f80d16 100644 --- a/settingipgeolocation_test.go +++ b/zonesettingearlyhint_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingIPGeolocationEdit(t *testing.T) { +func TestZoneSettingEarlyHintEdit(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 { @@ -29,9 +29,9 @@ func TestSettingIPGeolocationEdit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.IPGeolocation.Edit(context.TODO(), cloudflare.SettingIPGeolocationEditParams{ + _, err := client.Zones.Settings.EarlyHints.Edit(context.TODO(), cloudflare.ZoneSettingEarlyHintEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingIPGeolocationEditParamsValueOn), + Value: cloudflare.F(cloudflare.ZoneSettingEarlyHintEditParamsValueOn), }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +42,7 @@ func TestSettingIPGeolocationEdit(t *testing.T) { } } -func TestSettingIPGeolocationGet(t *testing.T) { +func TestZoneSettingEarlyHintGet(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 { @@ -58,7 +58,7 @@ func TestSettingIPGeolocationGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.IPGeolocation.Get(context.TODO(), cloudflare.SettingIPGeolocationGetParams{ + _, err := client.Zones.Settings.EarlyHints.Get(context.TODO(), cloudflare.ZoneSettingEarlyHintGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingemailobfuscation.go b/zonesettingemailobfuscation.go new file mode 100644 index 00000000000..553d1714758 --- /dev/null +++ b/zonesettingemailobfuscation.go @@ -0,0 +1,322 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingEmailObfuscationService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewZoneSettingEmailObfuscationService] method instead. +type ZoneSettingEmailObfuscationService struct { + Options []option.RequestOption +} + +// NewZoneSettingEmailObfuscationService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewZoneSettingEmailObfuscationService(opts ...option.RequestOption) (r *ZoneSettingEmailObfuscationService) { + r = &ZoneSettingEmailObfuscationService{} + r.Options = opts + return +} + +// Encrypt email adresses on your web page from bots, while keeping them visible to +// humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). +func (r *ZoneSettingEmailObfuscationService) Edit(ctx context.Context, params ZoneSettingEmailObfuscationEditParams, opts ...option.RequestOption) (res *ZoneSettingEmailObfuscationEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingEmailObfuscationEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/email_obfuscation", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Encrypt email adresses on your web page from bots, while keeping them visible to +// humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). +func (r *ZoneSettingEmailObfuscationService) Get(ctx context.Context, query ZoneSettingEmailObfuscationGetParams, opts ...option.RequestOption) (res *ZoneSettingEmailObfuscationGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingEmailObfuscationGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/email_obfuscation", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Encrypt email adresses on your web page from bots, while keeping them visible to +// humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). +type ZoneSettingEmailObfuscationEditResponse struct { + // ID of the zone setting. + ID ZoneSettingEmailObfuscationEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEmailObfuscationEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEmailObfuscationEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEmailObfuscationEditResponseJSON `json:"-"` +} + +// zoneSettingEmailObfuscationEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingEmailObfuscationEditResponse] +type zoneSettingEmailObfuscationEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEmailObfuscationEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingEmailObfuscationEditResponseID string + +const ( + ZoneSettingEmailObfuscationEditResponseIDEmailObfuscation ZoneSettingEmailObfuscationEditResponseID = "email_obfuscation" +) + +// Current value of the zone setting. +type ZoneSettingEmailObfuscationEditResponseValue string + +const ( + ZoneSettingEmailObfuscationEditResponseValueOn ZoneSettingEmailObfuscationEditResponseValue = "on" + ZoneSettingEmailObfuscationEditResponseValueOff ZoneSettingEmailObfuscationEditResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEmailObfuscationEditResponseEditable bool + +const ( + ZoneSettingEmailObfuscationEditResponseEditableTrue ZoneSettingEmailObfuscationEditResponseEditable = true + ZoneSettingEmailObfuscationEditResponseEditableFalse ZoneSettingEmailObfuscationEditResponseEditable = false +) + +// Encrypt email adresses on your web page from bots, while keeping them visible to +// humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). +type ZoneSettingEmailObfuscationGetResponse struct { + // ID of the zone setting. + ID ZoneSettingEmailObfuscationGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingEmailObfuscationGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingEmailObfuscationGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingEmailObfuscationGetResponseJSON `json:"-"` +} + +// zoneSettingEmailObfuscationGetResponseJSON contains the JSON metadata for the +// struct [ZoneSettingEmailObfuscationGetResponse] +type zoneSettingEmailObfuscationGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEmailObfuscationGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingEmailObfuscationGetResponseID string + +const ( + ZoneSettingEmailObfuscationGetResponseIDEmailObfuscation ZoneSettingEmailObfuscationGetResponseID = "email_obfuscation" +) + +// Current value of the zone setting. +type ZoneSettingEmailObfuscationGetResponseValue string + +const ( + ZoneSettingEmailObfuscationGetResponseValueOn ZoneSettingEmailObfuscationGetResponseValue = "on" + ZoneSettingEmailObfuscationGetResponseValueOff ZoneSettingEmailObfuscationGetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingEmailObfuscationGetResponseEditable bool + +const ( + ZoneSettingEmailObfuscationGetResponseEditableTrue ZoneSettingEmailObfuscationGetResponseEditable = true + ZoneSettingEmailObfuscationGetResponseEditableFalse ZoneSettingEmailObfuscationGetResponseEditable = false +) + +type ZoneSettingEmailObfuscationEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingEmailObfuscationEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingEmailObfuscationEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingEmailObfuscationEditParamsValue string + +const ( + ZoneSettingEmailObfuscationEditParamsValueOn ZoneSettingEmailObfuscationEditParamsValue = "on" + ZoneSettingEmailObfuscationEditParamsValueOff ZoneSettingEmailObfuscationEditParamsValue = "off" +) + +type ZoneSettingEmailObfuscationEditResponseEnvelope struct { + Errors []ZoneSettingEmailObfuscationEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingEmailObfuscationEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Encrypt email adresses on your web page from bots, while keeping them visible to + // humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). + Result ZoneSettingEmailObfuscationEditResponse `json:"result"` + JSON zoneSettingEmailObfuscationEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingEmailObfuscationEditResponseEnvelopeJSON contains the JSON metadata +// for the struct [ZoneSettingEmailObfuscationEditResponseEnvelope] +type zoneSettingEmailObfuscationEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEmailObfuscationEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingEmailObfuscationEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingEmailObfuscationEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingEmailObfuscationEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingEmailObfuscationEditResponseEnvelopeErrors] +type zoneSettingEmailObfuscationEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEmailObfuscationEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingEmailObfuscationEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingEmailObfuscationEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingEmailObfuscationEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct +// [ZoneSettingEmailObfuscationEditResponseEnvelopeMessages] +type zoneSettingEmailObfuscationEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEmailObfuscationEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingEmailObfuscationGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingEmailObfuscationGetResponseEnvelope struct { + Errors []ZoneSettingEmailObfuscationGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingEmailObfuscationGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Encrypt email adresses on your web page from bots, while keeping them visible to + // humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). + Result ZoneSettingEmailObfuscationGetResponse `json:"result"` + JSON zoneSettingEmailObfuscationGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingEmailObfuscationGetResponseEnvelopeJSON contains the JSON metadata +// for the struct [ZoneSettingEmailObfuscationGetResponseEnvelope] +type zoneSettingEmailObfuscationGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEmailObfuscationGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingEmailObfuscationGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingEmailObfuscationGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingEmailObfuscationGetResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingEmailObfuscationGetResponseEnvelopeErrors] +type zoneSettingEmailObfuscationGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEmailObfuscationGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingEmailObfuscationGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingEmailObfuscationGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingEmailObfuscationGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingEmailObfuscationGetResponseEnvelopeMessages] +type zoneSettingEmailObfuscationGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingEmailObfuscationGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/zonesettingemailobfuscation_test.go b/zonesettingemailobfuscation_test.go new file mode 100644 index 00000000000..58f9393d641 --- /dev/null +++ b/zonesettingemailobfuscation_test.go @@ -0,0 +1,71 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingEmailObfuscationEdit(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.EmailObfuscation.Edit(context.TODO(), cloudflare.ZoneSettingEmailObfuscationEditParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Value: cloudflare.F(cloudflare.ZoneSettingEmailObfuscationEditParamsValueOn), + }) + 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 TestZoneSettingEmailObfuscationGet(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.EmailObfuscation.Get(context.TODO(), cloudflare.ZoneSettingEmailObfuscationGetParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/zonesettingfontsetting.go b/zonesettingfontsetting.go new file mode 100644 index 00000000000..bfea911081d --- /dev/null +++ b/zonesettingfontsetting.go @@ -0,0 +1,327 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingFontSettingService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewZoneSettingFontSettingService] +// method instead. +type ZoneSettingFontSettingService struct { + Options []option.RequestOption +} + +// NewZoneSettingFontSettingService generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewZoneSettingFontSettingService(opts ...option.RequestOption) (r *ZoneSettingFontSettingService) { + r = &ZoneSettingFontSettingService{} + r.Options = opts + return +} + +// Enhance your website's font delivery with Cloudflare Fonts. Deliver Google +// Hosted fonts from your own domain, boost performance, and enhance user privacy. +// Refer to the Cloudflare Fonts documentation for more information. +func (r *ZoneSettingFontSettingService) Edit(ctx context.Context, params ZoneSettingFontSettingEditParams, opts ...option.RequestOption) (res *ZoneSettingFontSettingEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingFontSettingEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/fonts", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Enhance your website's font delivery with Cloudflare Fonts. Deliver Google +// Hosted fonts from your own domain, boost performance, and enhance user privacy. +// Refer to the Cloudflare Fonts documentation for more information. +func (r *ZoneSettingFontSettingService) Get(ctx context.Context, query ZoneSettingFontSettingGetParams, opts ...option.RequestOption) (res *ZoneSettingFontSettingGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingFontSettingGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/fonts", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Enhance your website's font delivery with Cloudflare Fonts. Deliver Google +// Hosted fonts from your own domain, boost performance, and enhance user privacy. +// Refer to the Cloudflare Fonts documentation for more information. +type ZoneSettingFontSettingEditResponse struct { + // ID of the zone setting. + ID ZoneSettingFontSettingEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingFontSettingEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingFontSettingEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingFontSettingEditResponseJSON `json:"-"` +} + +// zoneSettingFontSettingEditResponseJSON contains the JSON metadata for the struct +// [ZoneSettingFontSettingEditResponse] +type zoneSettingFontSettingEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingFontSettingEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingFontSettingEditResponseID string + +const ( + ZoneSettingFontSettingEditResponseIDFonts ZoneSettingFontSettingEditResponseID = "fonts" +) + +// Current value of the zone setting. +type ZoneSettingFontSettingEditResponseValue string + +const ( + ZoneSettingFontSettingEditResponseValueOn ZoneSettingFontSettingEditResponseValue = "on" + ZoneSettingFontSettingEditResponseValueOff ZoneSettingFontSettingEditResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingFontSettingEditResponseEditable bool + +const ( + ZoneSettingFontSettingEditResponseEditableTrue ZoneSettingFontSettingEditResponseEditable = true + ZoneSettingFontSettingEditResponseEditableFalse ZoneSettingFontSettingEditResponseEditable = false +) + +// Enhance your website's font delivery with Cloudflare Fonts. Deliver Google +// Hosted fonts from your own domain, boost performance, and enhance user privacy. +// Refer to the Cloudflare Fonts documentation for more information. +type ZoneSettingFontSettingGetResponse struct { + // ID of the zone setting. + ID ZoneSettingFontSettingGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingFontSettingGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingFontSettingGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingFontSettingGetResponseJSON `json:"-"` +} + +// zoneSettingFontSettingGetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingFontSettingGetResponse] +type zoneSettingFontSettingGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingFontSettingGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingFontSettingGetResponseID string + +const ( + ZoneSettingFontSettingGetResponseIDFonts ZoneSettingFontSettingGetResponseID = "fonts" +) + +// Current value of the zone setting. +type ZoneSettingFontSettingGetResponseValue string + +const ( + ZoneSettingFontSettingGetResponseValueOn ZoneSettingFontSettingGetResponseValue = "on" + ZoneSettingFontSettingGetResponseValueOff ZoneSettingFontSettingGetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingFontSettingGetResponseEditable bool + +const ( + ZoneSettingFontSettingGetResponseEditableTrue ZoneSettingFontSettingGetResponseEditable = true + ZoneSettingFontSettingGetResponseEditableFalse ZoneSettingFontSettingGetResponseEditable = false +) + +type ZoneSettingFontSettingEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Whether the feature is enabled or disabled. + Value param.Field[ZoneSettingFontSettingEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingFontSettingEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Whether the feature is enabled or disabled. +type ZoneSettingFontSettingEditParamsValue string + +const ( + ZoneSettingFontSettingEditParamsValueOn ZoneSettingFontSettingEditParamsValue = "on" + ZoneSettingFontSettingEditParamsValueOff ZoneSettingFontSettingEditParamsValue = "off" +) + +type ZoneSettingFontSettingEditResponseEnvelope struct { + Errors []ZoneSettingFontSettingEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingFontSettingEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Enhance your website's font delivery with Cloudflare Fonts. Deliver Google + // Hosted fonts from your own domain, boost performance, and enhance user privacy. + // Refer to the Cloudflare Fonts documentation for more information. + Result ZoneSettingFontSettingEditResponse `json:"result"` + JSON zoneSettingFontSettingEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingFontSettingEditResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingFontSettingEditResponseEnvelope] +type zoneSettingFontSettingEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingFontSettingEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingFontSettingEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingFontSettingEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingFontSettingEditResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [ZoneSettingFontSettingEditResponseEnvelopeErrors] +type zoneSettingFontSettingEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingFontSettingEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingFontSettingEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingFontSettingEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingFontSettingEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingFontSettingEditResponseEnvelopeMessages] +type zoneSettingFontSettingEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingFontSettingEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingFontSettingGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingFontSettingGetResponseEnvelope struct { + Errors []ZoneSettingFontSettingGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingFontSettingGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Enhance your website's font delivery with Cloudflare Fonts. Deliver Google + // Hosted fonts from your own domain, boost performance, and enhance user privacy. + // Refer to the Cloudflare Fonts documentation for more information. + Result ZoneSettingFontSettingGetResponse `json:"result"` + JSON zoneSettingFontSettingGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingFontSettingGetResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingFontSettingGetResponseEnvelope] +type zoneSettingFontSettingGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingFontSettingGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingFontSettingGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingFontSettingGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingFontSettingGetResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [ZoneSettingFontSettingGetResponseEnvelopeErrors] +type zoneSettingFontSettingGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingFontSettingGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingFontSettingGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingFontSettingGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingFontSettingGetResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [ZoneSettingFontSettingGetResponseEnvelopeMessages] +type zoneSettingFontSettingGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingFontSettingGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingdevelopmentmode_test.go b/zonesettingfontsetting_test.go similarity index 84% rename from settingdevelopmentmode_test.go rename to zonesettingfontsetting_test.go index 3852aeacffd..8494ac1cc66 100644 --- a/settingdevelopmentmode_test.go +++ b/zonesettingfontsetting_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingDevelopmentModeEdit(t *testing.T) { +func TestZoneSettingFontSettingEdit(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 { @@ -29,9 +29,9 @@ func TestSettingDevelopmentModeEdit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.DevelopmentMode.Edit(context.TODO(), cloudflare.SettingDevelopmentModeEditParams{ + _, err := client.Zones.Settings.FontSettings.Edit(context.TODO(), cloudflare.ZoneSettingFontSettingEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingDevelopmentModeEditParamsValueOn), + Value: cloudflare.F(cloudflare.ZoneSettingFontSettingEditParamsValueOn), }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +42,7 @@ func TestSettingDevelopmentModeEdit(t *testing.T) { } } -func TestSettingDevelopmentModeGet(t *testing.T) { +func TestZoneSettingFontSettingGet(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 { @@ -58,7 +58,7 @@ func TestSettingDevelopmentModeGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.DevelopmentMode.Get(context.TODO(), cloudflare.SettingDevelopmentModeGetParams{ + _, err := client.Zones.Settings.FontSettings.Get(context.TODO(), cloudflare.ZoneSettingFontSettingGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingh2prioritization.go b/zonesettingh2prioritization.go new file mode 100644 index 00000000000..08bd47cc6ba --- /dev/null +++ b/zonesettingh2prioritization.go @@ -0,0 +1,359 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingH2PrioritizationService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewZoneSettingH2PrioritizationService] method instead. +type ZoneSettingH2PrioritizationService struct { + Options []option.RequestOption +} + +// NewZoneSettingH2PrioritizationService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewZoneSettingH2PrioritizationService(opts ...option.RequestOption) (r *ZoneSettingH2PrioritizationService) { + r = &ZoneSettingH2PrioritizationService{} + r.Options = opts + return +} + +// Gets HTTP/2 Edge Prioritization setting. +func (r *ZoneSettingH2PrioritizationService) Edit(ctx context.Context, params ZoneSettingH2PrioritizationEditParams, opts ...option.RequestOption) (res *ZoneSettingH2PrioritizationEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingH2PrioritizationEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/h2_prioritization", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Gets HTTP/2 Edge Prioritization setting. +func (r *ZoneSettingH2PrioritizationService) Get(ctx context.Context, query ZoneSettingH2PrioritizationGetParams, opts ...option.RequestOption) (res *ZoneSettingH2PrioritizationGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingH2PrioritizationGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/h2_prioritization", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// HTTP/2 Edge Prioritization optimises the delivery of resources served through +// HTTP/2 to improve page load performance. It also supports fine control of +// content delivery when used in conjunction with Workers. +type ZoneSettingH2PrioritizationEditResponse struct { + // ID of the zone setting. + ID ZoneSettingH2PrioritizationEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingH2PrioritizationEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingH2PrioritizationEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingH2PrioritizationEditResponseJSON `json:"-"` +} + +// zoneSettingH2PrioritizationEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingH2PrioritizationEditResponse] +type zoneSettingH2PrioritizationEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingH2PrioritizationEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingH2PrioritizationEditResponseID string + +const ( + ZoneSettingH2PrioritizationEditResponseIDH2Prioritization ZoneSettingH2PrioritizationEditResponseID = "h2_prioritization" +) + +// Current value of the zone setting. +type ZoneSettingH2PrioritizationEditResponseValue string + +const ( + ZoneSettingH2PrioritizationEditResponseValueOn ZoneSettingH2PrioritizationEditResponseValue = "on" + ZoneSettingH2PrioritizationEditResponseValueOff ZoneSettingH2PrioritizationEditResponseValue = "off" + ZoneSettingH2PrioritizationEditResponseValueCustom ZoneSettingH2PrioritizationEditResponseValue = "custom" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingH2PrioritizationEditResponseEditable bool + +const ( + ZoneSettingH2PrioritizationEditResponseEditableTrue ZoneSettingH2PrioritizationEditResponseEditable = true + ZoneSettingH2PrioritizationEditResponseEditableFalse ZoneSettingH2PrioritizationEditResponseEditable = false +) + +// HTTP/2 Edge Prioritization optimises the delivery of resources served through +// HTTP/2 to improve page load performance. It also supports fine control of +// content delivery when used in conjunction with Workers. +type ZoneSettingH2PrioritizationGetResponse struct { + // ID of the zone setting. + ID ZoneSettingH2PrioritizationGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingH2PrioritizationGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingH2PrioritizationGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingH2PrioritizationGetResponseJSON `json:"-"` +} + +// zoneSettingH2PrioritizationGetResponseJSON contains the JSON metadata for the +// struct [ZoneSettingH2PrioritizationGetResponse] +type zoneSettingH2PrioritizationGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingH2PrioritizationGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingH2PrioritizationGetResponseID string + +const ( + ZoneSettingH2PrioritizationGetResponseIDH2Prioritization ZoneSettingH2PrioritizationGetResponseID = "h2_prioritization" +) + +// Current value of the zone setting. +type ZoneSettingH2PrioritizationGetResponseValue string + +const ( + ZoneSettingH2PrioritizationGetResponseValueOn ZoneSettingH2PrioritizationGetResponseValue = "on" + ZoneSettingH2PrioritizationGetResponseValueOff ZoneSettingH2PrioritizationGetResponseValue = "off" + ZoneSettingH2PrioritizationGetResponseValueCustom ZoneSettingH2PrioritizationGetResponseValue = "custom" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingH2PrioritizationGetResponseEditable bool + +const ( + ZoneSettingH2PrioritizationGetResponseEditableTrue ZoneSettingH2PrioritizationGetResponseEditable = true + ZoneSettingH2PrioritizationGetResponseEditableFalse ZoneSettingH2PrioritizationGetResponseEditable = false +) + +type ZoneSettingH2PrioritizationEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // HTTP/2 Edge Prioritization optimises the delivery of resources served through + // HTTP/2 to improve page load performance. It also supports fine control of + // content delivery when used in conjunction with Workers. + Value param.Field[ZoneSettingH2PrioritizationEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingH2PrioritizationEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// HTTP/2 Edge Prioritization optimises the delivery of resources served through +// HTTP/2 to improve page load performance. It also supports fine control of +// content delivery when used in conjunction with Workers. +type ZoneSettingH2PrioritizationEditParamsValue struct { + // ID of the zone setting. + ID param.Field[ZoneSettingH2PrioritizationEditParamsValueID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingH2PrioritizationEditParamsValueValue] `json:"value,required"` +} + +func (r ZoneSettingH2PrioritizationEditParamsValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// ID of the zone setting. +type ZoneSettingH2PrioritizationEditParamsValueID string + +const ( + ZoneSettingH2PrioritizationEditParamsValueIDH2Prioritization ZoneSettingH2PrioritizationEditParamsValueID = "h2_prioritization" +) + +// Current value of the zone setting. +type ZoneSettingH2PrioritizationEditParamsValueValue string + +const ( + ZoneSettingH2PrioritizationEditParamsValueValueOn ZoneSettingH2PrioritizationEditParamsValueValue = "on" + ZoneSettingH2PrioritizationEditParamsValueValueOff ZoneSettingH2PrioritizationEditParamsValueValue = "off" + ZoneSettingH2PrioritizationEditParamsValueValueCustom ZoneSettingH2PrioritizationEditParamsValueValue = "custom" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingH2PrioritizationEditParamsValueEditable bool + +const ( + ZoneSettingH2PrioritizationEditParamsValueEditableTrue ZoneSettingH2PrioritizationEditParamsValueEditable = true + ZoneSettingH2PrioritizationEditParamsValueEditableFalse ZoneSettingH2PrioritizationEditParamsValueEditable = false +) + +type ZoneSettingH2PrioritizationEditResponseEnvelope struct { + Errors []ZoneSettingH2PrioritizationEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingH2PrioritizationEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // HTTP/2 Edge Prioritization optimises the delivery of resources served through + // HTTP/2 to improve page load performance. It also supports fine control of + // content delivery when used in conjunction with Workers. + Result ZoneSettingH2PrioritizationEditResponse `json:"result"` + JSON zoneSettingH2PrioritizationEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingH2PrioritizationEditResponseEnvelopeJSON contains the JSON metadata +// for the struct [ZoneSettingH2PrioritizationEditResponseEnvelope] +type zoneSettingH2PrioritizationEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingH2PrioritizationEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingH2PrioritizationEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingH2PrioritizationEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingH2PrioritizationEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingH2PrioritizationEditResponseEnvelopeErrors] +type zoneSettingH2PrioritizationEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingH2PrioritizationEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingH2PrioritizationEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingH2PrioritizationEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingH2PrioritizationEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct +// [ZoneSettingH2PrioritizationEditResponseEnvelopeMessages] +type zoneSettingH2PrioritizationEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingH2PrioritizationEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingH2PrioritizationGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingH2PrioritizationGetResponseEnvelope struct { + Errors []ZoneSettingH2PrioritizationGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingH2PrioritizationGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // HTTP/2 Edge Prioritization optimises the delivery of resources served through + // HTTP/2 to improve page load performance. It also supports fine control of + // content delivery when used in conjunction with Workers. + Result ZoneSettingH2PrioritizationGetResponse `json:"result"` + JSON zoneSettingH2PrioritizationGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingH2PrioritizationGetResponseEnvelopeJSON contains the JSON metadata +// for the struct [ZoneSettingH2PrioritizationGetResponseEnvelope] +type zoneSettingH2PrioritizationGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingH2PrioritizationGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingH2PrioritizationGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingH2PrioritizationGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingH2PrioritizationGetResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingH2PrioritizationGetResponseEnvelopeErrors] +type zoneSettingH2PrioritizationGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingH2PrioritizationGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingH2PrioritizationGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingH2PrioritizationGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingH2PrioritizationGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingH2PrioritizationGetResponseEnvelopeMessages] +type zoneSettingH2PrioritizationGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingH2PrioritizationGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/zonesettingh2prioritization_test.go b/zonesettingh2prioritization_test.go new file mode 100644 index 00000000000..8f5b26feadb --- /dev/null +++ b/zonesettingh2prioritization_test.go @@ -0,0 +1,74 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingH2PrioritizationEditWithOptionalParams(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.H2Prioritization.Edit(context.TODO(), cloudflare.ZoneSettingH2PrioritizationEditParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Value: cloudflare.F(cloudflare.ZoneSettingH2PrioritizationEditParamsValue{ + ID: cloudflare.F(cloudflare.ZoneSettingH2PrioritizationEditParamsValueIDH2Prioritization), + Value: cloudflare.F(cloudflare.ZoneSettingH2PrioritizationEditParamsValueValueOn), + }), + }) + 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 TestZoneSettingH2PrioritizationGet(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.H2Prioritization.Get(context.TODO(), cloudflare.ZoneSettingH2PrioritizationGetParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/zonesettinghotlinkprotection.go b/zonesettinghotlinkprotection.go new file mode 100644 index 00000000000..30459614fb0 --- /dev/null +++ b/zonesettinghotlinkprotection.go @@ -0,0 +1,353 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingHotlinkProtectionService contains methods and other services that +// help with interacting with the cloudflare API. Note, unlike clients, this +// service does not read variables from the environment automatically. You should +// not instantiate this service directly, and instead use the +// [NewZoneSettingHotlinkProtectionService] method instead. +type ZoneSettingHotlinkProtectionService struct { + Options []option.RequestOption +} + +// NewZoneSettingHotlinkProtectionService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewZoneSettingHotlinkProtectionService(opts ...option.RequestOption) (r *ZoneSettingHotlinkProtectionService) { + r = &ZoneSettingHotlinkProtectionService{} + r.Options = opts + return +} + +// When enabled, the Hotlink Protection option ensures that other sites cannot suck +// up your bandwidth by building pages that use images hosted on your site. Anytime +// a request for an image on your site hits Cloudflare, we check to ensure that +// it's not another site requesting them. People will still be able to download and +// view images from your page, but other sites won't be able to steal them for use +// on their own pages. +// (https://support.cloudflare.com/hc/en-us/articles/200170026). +func (r *ZoneSettingHotlinkProtectionService) Edit(ctx context.Context, params ZoneSettingHotlinkProtectionEditParams, opts ...option.RequestOption) (res *ZoneSettingHotlinkProtectionEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingHotlinkProtectionEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/hotlink_protection", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// When enabled, the Hotlink Protection option ensures that other sites cannot suck +// up your bandwidth by building pages that use images hosted on your site. Anytime +// a request for an image on your site hits Cloudflare, we check to ensure that +// it's not another site requesting them. People will still be able to download and +// view images from your page, but other sites won't be able to steal them for use +// on their own pages. +// (https://support.cloudflare.com/hc/en-us/articles/200170026). +func (r *ZoneSettingHotlinkProtectionService) Get(ctx context.Context, query ZoneSettingHotlinkProtectionGetParams, opts ...option.RequestOption) (res *ZoneSettingHotlinkProtectionGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingHotlinkProtectionGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/hotlink_protection", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// When enabled, the Hotlink Protection option ensures that other sites cannot suck +// up your bandwidth by building pages that use images hosted on your site. Anytime +// a request for an image on your site hits Cloudflare, we check to ensure that +// it's not another site requesting them. People will still be able to download and +// view images from your page, but other sites won't be able to steal them for use +// on their own pages. +// (https://support.cloudflare.com/hc/en-us/articles/200170026). +type ZoneSettingHotlinkProtectionEditResponse struct { + // ID of the zone setting. + ID ZoneSettingHotlinkProtectionEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingHotlinkProtectionEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingHotlinkProtectionEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingHotlinkProtectionEditResponseJSON `json:"-"` +} + +// zoneSettingHotlinkProtectionEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingHotlinkProtectionEditResponse] +type zoneSettingHotlinkProtectionEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHotlinkProtectionEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingHotlinkProtectionEditResponseID string + +const ( + ZoneSettingHotlinkProtectionEditResponseIDHotlinkProtection ZoneSettingHotlinkProtectionEditResponseID = "hotlink_protection" +) + +// Current value of the zone setting. +type ZoneSettingHotlinkProtectionEditResponseValue string + +const ( + ZoneSettingHotlinkProtectionEditResponseValueOn ZoneSettingHotlinkProtectionEditResponseValue = "on" + ZoneSettingHotlinkProtectionEditResponseValueOff ZoneSettingHotlinkProtectionEditResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingHotlinkProtectionEditResponseEditable bool + +const ( + ZoneSettingHotlinkProtectionEditResponseEditableTrue ZoneSettingHotlinkProtectionEditResponseEditable = true + ZoneSettingHotlinkProtectionEditResponseEditableFalse ZoneSettingHotlinkProtectionEditResponseEditable = false +) + +// When enabled, the Hotlink Protection option ensures that other sites cannot suck +// up your bandwidth by building pages that use images hosted on your site. Anytime +// a request for an image on your site hits Cloudflare, we check to ensure that +// it's not another site requesting them. People will still be able to download and +// view images from your page, but other sites won't be able to steal them for use +// on their own pages. +// (https://support.cloudflare.com/hc/en-us/articles/200170026). +type ZoneSettingHotlinkProtectionGetResponse struct { + // ID of the zone setting. + ID ZoneSettingHotlinkProtectionGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingHotlinkProtectionGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingHotlinkProtectionGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingHotlinkProtectionGetResponseJSON `json:"-"` +} + +// zoneSettingHotlinkProtectionGetResponseJSON contains the JSON metadata for the +// struct [ZoneSettingHotlinkProtectionGetResponse] +type zoneSettingHotlinkProtectionGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHotlinkProtectionGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingHotlinkProtectionGetResponseID string + +const ( + ZoneSettingHotlinkProtectionGetResponseIDHotlinkProtection ZoneSettingHotlinkProtectionGetResponseID = "hotlink_protection" +) + +// Current value of the zone setting. +type ZoneSettingHotlinkProtectionGetResponseValue string + +const ( + ZoneSettingHotlinkProtectionGetResponseValueOn ZoneSettingHotlinkProtectionGetResponseValue = "on" + ZoneSettingHotlinkProtectionGetResponseValueOff ZoneSettingHotlinkProtectionGetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingHotlinkProtectionGetResponseEditable bool + +const ( + ZoneSettingHotlinkProtectionGetResponseEditableTrue ZoneSettingHotlinkProtectionGetResponseEditable = true + ZoneSettingHotlinkProtectionGetResponseEditableFalse ZoneSettingHotlinkProtectionGetResponseEditable = false +) + +type ZoneSettingHotlinkProtectionEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingHotlinkProtectionEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingHotlinkProtectionEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingHotlinkProtectionEditParamsValue string + +const ( + ZoneSettingHotlinkProtectionEditParamsValueOn ZoneSettingHotlinkProtectionEditParamsValue = "on" + ZoneSettingHotlinkProtectionEditParamsValueOff ZoneSettingHotlinkProtectionEditParamsValue = "off" +) + +type ZoneSettingHotlinkProtectionEditResponseEnvelope struct { + Errors []ZoneSettingHotlinkProtectionEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingHotlinkProtectionEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // When enabled, the Hotlink Protection option ensures that other sites cannot suck + // up your bandwidth by building pages that use images hosted on your site. Anytime + // a request for an image on your site hits Cloudflare, we check to ensure that + // it's not another site requesting them. People will still be able to download and + // view images from your page, but other sites won't be able to steal them for use + // on their own pages. + // (https://support.cloudflare.com/hc/en-us/articles/200170026). + Result ZoneSettingHotlinkProtectionEditResponse `json:"result"` + JSON zoneSettingHotlinkProtectionEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingHotlinkProtectionEditResponseEnvelopeJSON contains the JSON metadata +// for the struct [ZoneSettingHotlinkProtectionEditResponseEnvelope] +type zoneSettingHotlinkProtectionEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHotlinkProtectionEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingHotlinkProtectionEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingHotlinkProtectionEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingHotlinkProtectionEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingHotlinkProtectionEditResponseEnvelopeErrors] +type zoneSettingHotlinkProtectionEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHotlinkProtectionEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingHotlinkProtectionEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingHotlinkProtectionEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingHotlinkProtectionEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct +// [ZoneSettingHotlinkProtectionEditResponseEnvelopeMessages] +type zoneSettingHotlinkProtectionEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHotlinkProtectionEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingHotlinkProtectionGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingHotlinkProtectionGetResponseEnvelope struct { + Errors []ZoneSettingHotlinkProtectionGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingHotlinkProtectionGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // When enabled, the Hotlink Protection option ensures that other sites cannot suck + // up your bandwidth by building pages that use images hosted on your site. Anytime + // a request for an image on your site hits Cloudflare, we check to ensure that + // it's not another site requesting them. People will still be able to download and + // view images from your page, but other sites won't be able to steal them for use + // on their own pages. + // (https://support.cloudflare.com/hc/en-us/articles/200170026). + Result ZoneSettingHotlinkProtectionGetResponse `json:"result"` + JSON zoneSettingHotlinkProtectionGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingHotlinkProtectionGetResponseEnvelopeJSON contains the JSON metadata +// for the struct [ZoneSettingHotlinkProtectionGetResponseEnvelope] +type zoneSettingHotlinkProtectionGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHotlinkProtectionGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingHotlinkProtectionGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingHotlinkProtectionGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingHotlinkProtectionGetResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingHotlinkProtectionGetResponseEnvelopeErrors] +type zoneSettingHotlinkProtectionGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHotlinkProtectionGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingHotlinkProtectionGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingHotlinkProtectionGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingHotlinkProtectionGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct +// [ZoneSettingHotlinkProtectionGetResponseEnvelopeMessages] +type zoneSettingHotlinkProtectionGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHotlinkProtectionGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingautomatichttpsrewrite_test.go b/zonesettinghotlinkprotection_test.go similarity index 83% rename from settingautomatichttpsrewrite_test.go rename to zonesettinghotlinkprotection_test.go index 1445e11225f..cc2e9c3a502 100644 --- a/settingautomatichttpsrewrite_test.go +++ b/zonesettinghotlinkprotection_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingAutomaticHTTPSRewriteEdit(t *testing.T) { +func TestZoneSettingHotlinkProtectionEdit(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 { @@ -29,9 +29,9 @@ func TestSettingAutomaticHTTPSRewriteEdit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.AutomaticHTTPSRewrites.Edit(context.TODO(), cloudflare.SettingAutomaticHTTPSRewriteEditParams{ + _, err := client.Zones.Settings.HotlinkProtection.Edit(context.TODO(), cloudflare.ZoneSettingHotlinkProtectionEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingAutomaticHTTPSRewriteEditParamsValueOn), + Value: cloudflare.F(cloudflare.ZoneSettingHotlinkProtectionEditParamsValueOn), }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +42,7 @@ func TestSettingAutomaticHTTPSRewriteEdit(t *testing.T) { } } -func TestSettingAutomaticHTTPSRewriteGet(t *testing.T) { +func TestZoneSettingHotlinkProtectionGet(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 { @@ -58,7 +58,7 @@ func TestSettingAutomaticHTTPSRewriteGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.AutomaticHTTPSRewrites.Get(context.TODO(), cloudflare.SettingAutomaticHTTPSRewriteGetParams{ + _, err := client.Zones.Settings.HotlinkProtection.Get(context.TODO(), cloudflare.ZoneSettingHotlinkProtectionGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettinghttp2.go b/zonesettinghttp2.go new file mode 100644 index 00000000000..8a867af2659 --- /dev/null +++ b/zonesettinghttp2.go @@ -0,0 +1,315 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingHTTP2Service contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewZoneSettingHTTP2Service] method +// instead. +type ZoneSettingHTTP2Service struct { + Options []option.RequestOption +} + +// NewZoneSettingHTTP2Service generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewZoneSettingHTTP2Service(opts ...option.RequestOption) (r *ZoneSettingHTTP2Service) { + r = &ZoneSettingHTTP2Service{} + r.Options = opts + return +} + +// Value of the HTTP2 setting. +func (r *ZoneSettingHTTP2Service) Edit(ctx context.Context, params ZoneSettingHTTP2EditParams, opts ...option.RequestOption) (res *ZoneSettingHTTP2EditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingHTTP2EditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/http2", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Value of the HTTP2 setting. +func (r *ZoneSettingHTTP2Service) Get(ctx context.Context, query ZoneSettingHTTP2GetParams, opts ...option.RequestOption) (res *ZoneSettingHTTP2GetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingHTTP2GetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/http2", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// HTTP2 enabled for this zone. +type ZoneSettingHTTP2EditResponse struct { + // ID of the zone setting. + ID ZoneSettingHTTP2EditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingHTTP2EditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingHTTP2EditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingHTTP2EditResponseJSON `json:"-"` +} + +// zoneSettingHTTP2EditResponseJSON contains the JSON metadata for the struct +// [ZoneSettingHTTP2EditResponse] +type zoneSettingHTTP2EditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHTTP2EditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingHTTP2EditResponseID string + +const ( + ZoneSettingHTTP2EditResponseIDHTTP2 ZoneSettingHTTP2EditResponseID = "http2" +) + +// Current value of the zone setting. +type ZoneSettingHTTP2EditResponseValue string + +const ( + ZoneSettingHTTP2EditResponseValueOn ZoneSettingHTTP2EditResponseValue = "on" + ZoneSettingHTTP2EditResponseValueOff ZoneSettingHTTP2EditResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingHTTP2EditResponseEditable bool + +const ( + ZoneSettingHTTP2EditResponseEditableTrue ZoneSettingHTTP2EditResponseEditable = true + ZoneSettingHTTP2EditResponseEditableFalse ZoneSettingHTTP2EditResponseEditable = false +) + +// HTTP2 enabled for this zone. +type ZoneSettingHTTP2GetResponse struct { + // ID of the zone setting. + ID ZoneSettingHTTP2GetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingHTTP2GetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingHTTP2GetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingHTTP2GetResponseJSON `json:"-"` +} + +// zoneSettingHTTP2GetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingHTTP2GetResponse] +type zoneSettingHTTP2GetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHTTP2GetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingHTTP2GetResponseID string + +const ( + ZoneSettingHTTP2GetResponseIDHTTP2 ZoneSettingHTTP2GetResponseID = "http2" +) + +// Current value of the zone setting. +type ZoneSettingHTTP2GetResponseValue string + +const ( + ZoneSettingHTTP2GetResponseValueOn ZoneSettingHTTP2GetResponseValue = "on" + ZoneSettingHTTP2GetResponseValueOff ZoneSettingHTTP2GetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingHTTP2GetResponseEditable bool + +const ( + ZoneSettingHTTP2GetResponseEditableTrue ZoneSettingHTTP2GetResponseEditable = true + ZoneSettingHTTP2GetResponseEditableFalse ZoneSettingHTTP2GetResponseEditable = false +) + +type ZoneSettingHTTP2EditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the HTTP2 setting. + Value param.Field[ZoneSettingHTTP2EditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingHTTP2EditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the HTTP2 setting. +type ZoneSettingHTTP2EditParamsValue string + +const ( + ZoneSettingHTTP2EditParamsValueOn ZoneSettingHTTP2EditParamsValue = "on" + ZoneSettingHTTP2EditParamsValueOff ZoneSettingHTTP2EditParamsValue = "off" +) + +type ZoneSettingHTTP2EditResponseEnvelope struct { + Errors []ZoneSettingHTTP2EditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingHTTP2EditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // HTTP2 enabled for this zone. + Result ZoneSettingHTTP2EditResponse `json:"result"` + JSON zoneSettingHTTP2EditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingHTTP2EditResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingHTTP2EditResponseEnvelope] +type zoneSettingHTTP2EditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHTTP2EditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingHTTP2EditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingHTTP2EditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingHTTP2EditResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [ZoneSettingHTTP2EditResponseEnvelopeErrors] +type zoneSettingHTTP2EditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHTTP2EditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingHTTP2EditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingHTTP2EditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingHTTP2EditResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingHTTP2EditResponseEnvelopeMessages] +type zoneSettingHTTP2EditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHTTP2EditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingHTTP2GetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingHTTP2GetResponseEnvelope struct { + Errors []ZoneSettingHTTP2GetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingHTTP2GetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // HTTP2 enabled for this zone. + Result ZoneSettingHTTP2GetResponse `json:"result"` + JSON zoneSettingHTTP2GetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingHTTP2GetResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingHTTP2GetResponseEnvelope] +type zoneSettingHTTP2GetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHTTP2GetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingHTTP2GetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingHTTP2GetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingHTTP2GetResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [ZoneSettingHTTP2GetResponseEnvelopeErrors] +type zoneSettingHTTP2GetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHTTP2GetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingHTTP2GetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingHTTP2GetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingHTTP2GetResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingHTTP2GetResponseEnvelopeMessages] +type zoneSettingHTTP2GetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHTTP2GetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingearlyhint_test.go b/zonesettinghttp2_test.go similarity index 85% rename from settingearlyhint_test.go rename to zonesettinghttp2_test.go index 1ac2814afc7..219ecdd8467 100644 --- a/settingearlyhint_test.go +++ b/zonesettinghttp2_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingEarlyHintEdit(t *testing.T) { +func TestZoneSettingHTTP2Edit(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 { @@ -29,9 +29,9 @@ func TestSettingEarlyHintEdit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.EarlyHints.Edit(context.TODO(), cloudflare.SettingEarlyHintEditParams{ + _, err := client.Zones.Settings.HTTP2.Edit(context.TODO(), cloudflare.ZoneSettingHTTP2EditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingEarlyHintEditParamsValueOn), + Value: cloudflare.F(cloudflare.ZoneSettingHTTP2EditParamsValueOn), }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +42,7 @@ func TestSettingEarlyHintEdit(t *testing.T) { } } -func TestSettingEarlyHintGet(t *testing.T) { +func TestZoneSettingHTTP2Get(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 { @@ -58,7 +58,7 @@ func TestSettingEarlyHintGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.EarlyHints.Get(context.TODO(), cloudflare.SettingEarlyHintGetParams{ + _, err := client.Zones.Settings.HTTP2.Get(context.TODO(), cloudflare.ZoneSettingHTTP2GetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettinghttp3.go b/zonesettinghttp3.go new file mode 100644 index 00000000000..ddc2eff4fc0 --- /dev/null +++ b/zonesettinghttp3.go @@ -0,0 +1,315 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingHTTP3Service contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewZoneSettingHTTP3Service] method +// instead. +type ZoneSettingHTTP3Service struct { + Options []option.RequestOption +} + +// NewZoneSettingHTTP3Service generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewZoneSettingHTTP3Service(opts ...option.RequestOption) (r *ZoneSettingHTTP3Service) { + r = &ZoneSettingHTTP3Service{} + r.Options = opts + return +} + +// Value of the HTTP3 setting. +func (r *ZoneSettingHTTP3Service) Edit(ctx context.Context, params ZoneSettingHTTP3EditParams, opts ...option.RequestOption) (res *ZoneSettingHTTP3EditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingHTTP3EditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/http3", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Value of the HTTP3 setting. +func (r *ZoneSettingHTTP3Service) Get(ctx context.Context, query ZoneSettingHTTP3GetParams, opts ...option.RequestOption) (res *ZoneSettingHTTP3GetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingHTTP3GetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/http3", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// HTTP3 enabled for this zone. +type ZoneSettingHTTP3EditResponse struct { + // ID of the zone setting. + ID ZoneSettingHTTP3EditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingHTTP3EditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingHTTP3EditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingHTTP3EditResponseJSON `json:"-"` +} + +// zoneSettingHTTP3EditResponseJSON contains the JSON metadata for the struct +// [ZoneSettingHTTP3EditResponse] +type zoneSettingHTTP3EditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHTTP3EditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingHTTP3EditResponseID string + +const ( + ZoneSettingHTTP3EditResponseIDHTTP3 ZoneSettingHTTP3EditResponseID = "http3" +) + +// Current value of the zone setting. +type ZoneSettingHTTP3EditResponseValue string + +const ( + ZoneSettingHTTP3EditResponseValueOn ZoneSettingHTTP3EditResponseValue = "on" + ZoneSettingHTTP3EditResponseValueOff ZoneSettingHTTP3EditResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingHTTP3EditResponseEditable bool + +const ( + ZoneSettingHTTP3EditResponseEditableTrue ZoneSettingHTTP3EditResponseEditable = true + ZoneSettingHTTP3EditResponseEditableFalse ZoneSettingHTTP3EditResponseEditable = false +) + +// HTTP3 enabled for this zone. +type ZoneSettingHTTP3GetResponse struct { + // ID of the zone setting. + ID ZoneSettingHTTP3GetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingHTTP3GetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingHTTP3GetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingHTTP3GetResponseJSON `json:"-"` +} + +// zoneSettingHTTP3GetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingHTTP3GetResponse] +type zoneSettingHTTP3GetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHTTP3GetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingHTTP3GetResponseID string + +const ( + ZoneSettingHTTP3GetResponseIDHTTP3 ZoneSettingHTTP3GetResponseID = "http3" +) + +// Current value of the zone setting. +type ZoneSettingHTTP3GetResponseValue string + +const ( + ZoneSettingHTTP3GetResponseValueOn ZoneSettingHTTP3GetResponseValue = "on" + ZoneSettingHTTP3GetResponseValueOff ZoneSettingHTTP3GetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingHTTP3GetResponseEditable bool + +const ( + ZoneSettingHTTP3GetResponseEditableTrue ZoneSettingHTTP3GetResponseEditable = true + ZoneSettingHTTP3GetResponseEditableFalse ZoneSettingHTTP3GetResponseEditable = false +) + +type ZoneSettingHTTP3EditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the HTTP3 setting. + Value param.Field[ZoneSettingHTTP3EditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingHTTP3EditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the HTTP3 setting. +type ZoneSettingHTTP3EditParamsValue string + +const ( + ZoneSettingHTTP3EditParamsValueOn ZoneSettingHTTP3EditParamsValue = "on" + ZoneSettingHTTP3EditParamsValueOff ZoneSettingHTTP3EditParamsValue = "off" +) + +type ZoneSettingHTTP3EditResponseEnvelope struct { + Errors []ZoneSettingHTTP3EditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingHTTP3EditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // HTTP3 enabled for this zone. + Result ZoneSettingHTTP3EditResponse `json:"result"` + JSON zoneSettingHTTP3EditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingHTTP3EditResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingHTTP3EditResponseEnvelope] +type zoneSettingHTTP3EditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHTTP3EditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingHTTP3EditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingHTTP3EditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingHTTP3EditResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [ZoneSettingHTTP3EditResponseEnvelopeErrors] +type zoneSettingHTTP3EditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHTTP3EditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingHTTP3EditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingHTTP3EditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingHTTP3EditResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingHTTP3EditResponseEnvelopeMessages] +type zoneSettingHTTP3EditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHTTP3EditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingHTTP3GetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingHTTP3GetResponseEnvelope struct { + Errors []ZoneSettingHTTP3GetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingHTTP3GetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // HTTP3 enabled for this zone. + Result ZoneSettingHTTP3GetResponse `json:"result"` + JSON zoneSettingHTTP3GetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingHTTP3GetResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingHTTP3GetResponseEnvelope] +type zoneSettingHTTP3GetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHTTP3GetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingHTTP3GetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingHTTP3GetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingHTTP3GetResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [ZoneSettingHTTP3GetResponseEnvelopeErrors] +type zoneSettingHTTP3GetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHTTP3GetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingHTTP3GetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingHTTP3GetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingHTTP3GetResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingHTTP3GetResponseEnvelopeMessages] +type zoneSettingHTTP3GetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingHTTP3GetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settinghttp2_test.go b/zonesettinghttp3_test.go similarity index 85% rename from settinghttp2_test.go rename to zonesettinghttp3_test.go index dd9b12440e3..ba3a80b73cd 100644 --- a/settinghttp2_test.go +++ b/zonesettinghttp3_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingHTTP2Edit(t *testing.T) { +func TestZoneSettingHTTP3Edit(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 { @@ -29,9 +29,9 @@ func TestSettingHTTP2Edit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.HTTP2.Edit(context.TODO(), cloudflare.SettingHTTP2EditParams{ + _, err := client.Zones.Settings.HTTP3.Edit(context.TODO(), cloudflare.ZoneSettingHTTP3EditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingHTTP2EditParamsValueOn), + Value: cloudflare.F(cloudflare.ZoneSettingHTTP3EditParamsValueOn), }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +42,7 @@ func TestSettingHTTP2Edit(t *testing.T) { } } -func TestSettingHTTP2Get(t *testing.T) { +func TestZoneSettingHTTP3Get(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 { @@ -58,7 +58,7 @@ func TestSettingHTTP2Get(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.HTTP2.Get(context.TODO(), cloudflare.SettingHTTP2GetParams{ + _, err := client.Zones.Settings.HTTP3.Get(context.TODO(), cloudflare.ZoneSettingHTTP3GetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingimageresizing.go b/zonesettingimageresizing.go new file mode 100644 index 00000000000..b85e4f3cfbf --- /dev/null +++ b/zonesettingimageresizing.go @@ -0,0 +1,370 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingImageResizingService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewZoneSettingImageResizingService] method instead. +type ZoneSettingImageResizingService struct { + Options []option.RequestOption +} + +// NewZoneSettingImageResizingService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewZoneSettingImageResizingService(opts ...option.RequestOption) (r *ZoneSettingImageResizingService) { + r = &ZoneSettingImageResizingService{} + r.Options = opts + return +} + +// Image Resizing provides on-demand resizing, conversion and optimisation for +// images served through Cloudflare's network. Refer to the +// [Image Resizing documentation](https://developers.cloudflare.com/images/) for +// more information. +func (r *ZoneSettingImageResizingService) Edit(ctx context.Context, params ZoneSettingImageResizingEditParams, opts ...option.RequestOption) (res *ZoneSettingImageResizingEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingImageResizingEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/image_resizing", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Image Resizing provides on-demand resizing, conversion and optimisation for +// images served through Cloudflare's network. Refer to the +// [Image Resizing documentation](https://developers.cloudflare.com/images/) for +// more information. +func (r *ZoneSettingImageResizingService) Get(ctx context.Context, query ZoneSettingImageResizingGetParams, opts ...option.RequestOption) (res *ZoneSettingImageResizingGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingImageResizingGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/image_resizing", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Image Resizing provides on-demand resizing, conversion and optimisation for +// images served through Cloudflare's network. Refer to the +// [Image Resizing documentation](https://developers.cloudflare.com/images/) for +// more information. +type ZoneSettingImageResizingEditResponse struct { + // ID of the zone setting. + ID ZoneSettingImageResizingEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingImageResizingEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingImageResizingEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingImageResizingEditResponseJSON `json:"-"` +} + +// zoneSettingImageResizingEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingImageResizingEditResponse] +type zoneSettingImageResizingEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingImageResizingEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingImageResizingEditResponseID string + +const ( + ZoneSettingImageResizingEditResponseIDImageResizing ZoneSettingImageResizingEditResponseID = "image_resizing" +) + +// Current value of the zone setting. +type ZoneSettingImageResizingEditResponseValue string + +const ( + ZoneSettingImageResizingEditResponseValueOn ZoneSettingImageResizingEditResponseValue = "on" + ZoneSettingImageResizingEditResponseValueOff ZoneSettingImageResizingEditResponseValue = "off" + ZoneSettingImageResizingEditResponseValueOpen ZoneSettingImageResizingEditResponseValue = "open" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingImageResizingEditResponseEditable bool + +const ( + ZoneSettingImageResizingEditResponseEditableTrue ZoneSettingImageResizingEditResponseEditable = true + ZoneSettingImageResizingEditResponseEditableFalse ZoneSettingImageResizingEditResponseEditable = false +) + +// Image Resizing provides on-demand resizing, conversion and optimisation for +// images served through Cloudflare's network. Refer to the +// [Image Resizing documentation](https://developers.cloudflare.com/images/) for +// more information. +type ZoneSettingImageResizingGetResponse struct { + // ID of the zone setting. + ID ZoneSettingImageResizingGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingImageResizingGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingImageResizingGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingImageResizingGetResponseJSON `json:"-"` +} + +// zoneSettingImageResizingGetResponseJSON contains the JSON metadata for the +// struct [ZoneSettingImageResizingGetResponse] +type zoneSettingImageResizingGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingImageResizingGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingImageResizingGetResponseID string + +const ( + ZoneSettingImageResizingGetResponseIDImageResizing ZoneSettingImageResizingGetResponseID = "image_resizing" +) + +// Current value of the zone setting. +type ZoneSettingImageResizingGetResponseValue string + +const ( + ZoneSettingImageResizingGetResponseValueOn ZoneSettingImageResizingGetResponseValue = "on" + ZoneSettingImageResizingGetResponseValueOff ZoneSettingImageResizingGetResponseValue = "off" + ZoneSettingImageResizingGetResponseValueOpen ZoneSettingImageResizingGetResponseValue = "open" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingImageResizingGetResponseEditable bool + +const ( + ZoneSettingImageResizingGetResponseEditableTrue ZoneSettingImageResizingGetResponseEditable = true + ZoneSettingImageResizingGetResponseEditableFalse ZoneSettingImageResizingGetResponseEditable = false +) + +type ZoneSettingImageResizingEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Image Resizing provides on-demand resizing, conversion and optimisation for + // images served through Cloudflare's network. Refer to the + // [Image Resizing documentation](https://developers.cloudflare.com/images/) for + // more information. + Value param.Field[ZoneSettingImageResizingEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingImageResizingEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Image Resizing provides on-demand resizing, conversion and optimisation for +// images served through Cloudflare's network. Refer to the +// [Image Resizing documentation](https://developers.cloudflare.com/images/) for +// more information. +type ZoneSettingImageResizingEditParamsValue struct { + // ID of the zone setting. + ID param.Field[ZoneSettingImageResizingEditParamsValueID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingImageResizingEditParamsValueValue] `json:"value,required"` +} + +func (r ZoneSettingImageResizingEditParamsValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// ID of the zone setting. +type ZoneSettingImageResizingEditParamsValueID string + +const ( + ZoneSettingImageResizingEditParamsValueIDImageResizing ZoneSettingImageResizingEditParamsValueID = "image_resizing" +) + +// Current value of the zone setting. +type ZoneSettingImageResizingEditParamsValueValue string + +const ( + ZoneSettingImageResizingEditParamsValueValueOn ZoneSettingImageResizingEditParamsValueValue = "on" + ZoneSettingImageResizingEditParamsValueValueOff ZoneSettingImageResizingEditParamsValueValue = "off" + ZoneSettingImageResizingEditParamsValueValueOpen ZoneSettingImageResizingEditParamsValueValue = "open" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingImageResizingEditParamsValueEditable bool + +const ( + ZoneSettingImageResizingEditParamsValueEditableTrue ZoneSettingImageResizingEditParamsValueEditable = true + ZoneSettingImageResizingEditParamsValueEditableFalse ZoneSettingImageResizingEditParamsValueEditable = false +) + +type ZoneSettingImageResizingEditResponseEnvelope struct { + Errors []ZoneSettingImageResizingEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingImageResizingEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Image Resizing provides on-demand resizing, conversion and optimisation for + // images served through Cloudflare's network. Refer to the + // [Image Resizing documentation](https://developers.cloudflare.com/images/) for + // more information. + Result ZoneSettingImageResizingEditResponse `json:"result"` + JSON zoneSettingImageResizingEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingImageResizingEditResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingImageResizingEditResponseEnvelope] +type zoneSettingImageResizingEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingImageResizingEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingImageResizingEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingImageResizingEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingImageResizingEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingImageResizingEditResponseEnvelopeErrors] +type zoneSettingImageResizingEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingImageResizingEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingImageResizingEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingImageResizingEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingImageResizingEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingImageResizingEditResponseEnvelopeMessages] +type zoneSettingImageResizingEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingImageResizingEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingImageResizingGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingImageResizingGetResponseEnvelope struct { + Errors []ZoneSettingImageResizingGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingImageResizingGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Image Resizing provides on-demand resizing, conversion and optimisation for + // images served through Cloudflare's network. Refer to the + // [Image Resizing documentation](https://developers.cloudflare.com/images/) for + // more information. + Result ZoneSettingImageResizingGetResponse `json:"result"` + JSON zoneSettingImageResizingGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingImageResizingGetResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingImageResizingGetResponseEnvelope] +type zoneSettingImageResizingGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingImageResizingGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingImageResizingGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingImageResizingGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingImageResizingGetResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [ZoneSettingImageResizingGetResponseEnvelopeErrors] +type zoneSettingImageResizingGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingImageResizingGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingImageResizingGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingImageResizingGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingImageResizingGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingImageResizingGetResponseEnvelopeMessages] +type zoneSettingImageResizingGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingImageResizingGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingminify_test.go b/zonesettingimageresizing_test.go similarity index 77% rename from settingminify_test.go rename to zonesettingimageresizing_test.go index 1c59381eb3e..a2a70bd8a7e 100644 --- a/settingminify_test.go +++ b/zonesettingimageresizing_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingMinifyEditWithOptionalParams(t *testing.T) { +func TestZoneSettingImageResizingEditWithOptionalParams(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 { @@ -29,12 +29,11 @@ func TestSettingMinifyEditWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.Minify.Edit(context.TODO(), cloudflare.SettingMinifyEditParams{ + _, err := client.Zones.Settings.ImageResizing.Edit(context.TODO(), cloudflare.ZoneSettingImageResizingEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingMinifyEditParamsValue{ - Css: cloudflare.F(cloudflare.SettingMinifyEditParamsValueCssOn), - HTML: cloudflare.F(cloudflare.SettingMinifyEditParamsValueHTMLOn), - Js: cloudflare.F(cloudflare.SettingMinifyEditParamsValueJsOn), + Value: cloudflare.F(cloudflare.ZoneSettingImageResizingEditParamsValue{ + ID: cloudflare.F(cloudflare.ZoneSettingImageResizingEditParamsValueIDImageResizing), + Value: cloudflare.F(cloudflare.ZoneSettingImageResizingEditParamsValueValueOn), }), }) if err != nil { @@ -46,7 +45,7 @@ func TestSettingMinifyEditWithOptionalParams(t *testing.T) { } } -func TestSettingMinifyGet(t *testing.T) { +func TestZoneSettingImageResizingGet(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 { @@ -62,7 +61,7 @@ func TestSettingMinifyGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.Minify.Get(context.TODO(), cloudflare.SettingMinifyGetParams{ + _, err := client.Zones.Settings.ImageResizing.Get(context.TODO(), cloudflare.ZoneSettingImageResizingGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingipgeolocation.go b/zonesettingipgeolocation.go new file mode 100644 index 00000000000..ff092ec1081 --- /dev/null +++ b/zonesettingipgeolocation.go @@ -0,0 +1,327 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingIPGeolocationService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewZoneSettingIPGeolocationService] method instead. +type ZoneSettingIPGeolocationService struct { + Options []option.RequestOption +} + +// NewZoneSettingIPGeolocationService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewZoneSettingIPGeolocationService(opts ...option.RequestOption) (r *ZoneSettingIPGeolocationService) { + r = &ZoneSettingIPGeolocationService{} + r.Options = opts + return +} + +// Enable IP Geolocation to have Cloudflare geolocate visitors to your website and +// pass the country code to you. +// (https://support.cloudflare.com/hc/en-us/articles/200168236). +func (r *ZoneSettingIPGeolocationService) Edit(ctx context.Context, params ZoneSettingIPGeolocationEditParams, opts ...option.RequestOption) (res *ZoneSettingIPGeolocationEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingIPGeolocationEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/ip_geolocation", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Enable IP Geolocation to have Cloudflare geolocate visitors to your website and +// pass the country code to you. +// (https://support.cloudflare.com/hc/en-us/articles/200168236). +func (r *ZoneSettingIPGeolocationService) Get(ctx context.Context, query ZoneSettingIPGeolocationGetParams, opts ...option.RequestOption) (res *ZoneSettingIPGeolocationGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingIPGeolocationGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/ip_geolocation", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Enable IP Geolocation to have Cloudflare geolocate visitors to your website and +// pass the country code to you. +// (https://support.cloudflare.com/hc/en-us/articles/200168236). +type ZoneSettingIPGeolocationEditResponse struct { + // ID of the zone setting. + ID ZoneSettingIPGeolocationEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingIPGeolocationEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingIPGeolocationEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingIPGeolocationEditResponseJSON `json:"-"` +} + +// zoneSettingIPGeolocationEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingIPGeolocationEditResponse] +type zoneSettingIPGeolocationEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingIPGeolocationEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingIPGeolocationEditResponseID string + +const ( + ZoneSettingIPGeolocationEditResponseIDIPGeolocation ZoneSettingIPGeolocationEditResponseID = "ip_geolocation" +) + +// Current value of the zone setting. +type ZoneSettingIPGeolocationEditResponseValue string + +const ( + ZoneSettingIPGeolocationEditResponseValueOn ZoneSettingIPGeolocationEditResponseValue = "on" + ZoneSettingIPGeolocationEditResponseValueOff ZoneSettingIPGeolocationEditResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingIPGeolocationEditResponseEditable bool + +const ( + ZoneSettingIPGeolocationEditResponseEditableTrue ZoneSettingIPGeolocationEditResponseEditable = true + ZoneSettingIPGeolocationEditResponseEditableFalse ZoneSettingIPGeolocationEditResponseEditable = false +) + +// Enable IP Geolocation to have Cloudflare geolocate visitors to your website and +// pass the country code to you. +// (https://support.cloudflare.com/hc/en-us/articles/200168236). +type ZoneSettingIPGeolocationGetResponse struct { + // ID of the zone setting. + ID ZoneSettingIPGeolocationGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingIPGeolocationGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingIPGeolocationGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingIPGeolocationGetResponseJSON `json:"-"` +} + +// zoneSettingIPGeolocationGetResponseJSON contains the JSON metadata for the +// struct [ZoneSettingIPGeolocationGetResponse] +type zoneSettingIPGeolocationGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingIPGeolocationGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingIPGeolocationGetResponseID string + +const ( + ZoneSettingIPGeolocationGetResponseIDIPGeolocation ZoneSettingIPGeolocationGetResponseID = "ip_geolocation" +) + +// Current value of the zone setting. +type ZoneSettingIPGeolocationGetResponseValue string + +const ( + ZoneSettingIPGeolocationGetResponseValueOn ZoneSettingIPGeolocationGetResponseValue = "on" + ZoneSettingIPGeolocationGetResponseValueOff ZoneSettingIPGeolocationGetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingIPGeolocationGetResponseEditable bool + +const ( + ZoneSettingIPGeolocationGetResponseEditableTrue ZoneSettingIPGeolocationGetResponseEditable = true + ZoneSettingIPGeolocationGetResponseEditableFalse ZoneSettingIPGeolocationGetResponseEditable = false +) + +type ZoneSettingIPGeolocationEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingIPGeolocationEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingIPGeolocationEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingIPGeolocationEditParamsValue string + +const ( + ZoneSettingIPGeolocationEditParamsValueOn ZoneSettingIPGeolocationEditParamsValue = "on" + ZoneSettingIPGeolocationEditParamsValueOff ZoneSettingIPGeolocationEditParamsValue = "off" +) + +type ZoneSettingIPGeolocationEditResponseEnvelope struct { + Errors []ZoneSettingIPGeolocationEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingIPGeolocationEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Enable IP Geolocation to have Cloudflare geolocate visitors to your website and + // pass the country code to you. + // (https://support.cloudflare.com/hc/en-us/articles/200168236). + Result ZoneSettingIPGeolocationEditResponse `json:"result"` + JSON zoneSettingIPGeolocationEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingIPGeolocationEditResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingIPGeolocationEditResponseEnvelope] +type zoneSettingIPGeolocationEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingIPGeolocationEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingIPGeolocationEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingIPGeolocationEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingIPGeolocationEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingIPGeolocationEditResponseEnvelopeErrors] +type zoneSettingIPGeolocationEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingIPGeolocationEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingIPGeolocationEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingIPGeolocationEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingIPGeolocationEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingIPGeolocationEditResponseEnvelopeMessages] +type zoneSettingIPGeolocationEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingIPGeolocationEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingIPGeolocationGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingIPGeolocationGetResponseEnvelope struct { + Errors []ZoneSettingIPGeolocationGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingIPGeolocationGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Enable IP Geolocation to have Cloudflare geolocate visitors to your website and + // pass the country code to you. + // (https://support.cloudflare.com/hc/en-us/articles/200168236). + Result ZoneSettingIPGeolocationGetResponse `json:"result"` + JSON zoneSettingIPGeolocationGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingIPGeolocationGetResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingIPGeolocationGetResponseEnvelope] +type zoneSettingIPGeolocationGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingIPGeolocationGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingIPGeolocationGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingIPGeolocationGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingIPGeolocationGetResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [ZoneSettingIPGeolocationGetResponseEnvelopeErrors] +type zoneSettingIPGeolocationGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingIPGeolocationGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingIPGeolocationGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingIPGeolocationGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingIPGeolocationGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingIPGeolocationGetResponseEnvelopeMessages] +type zoneSettingIPGeolocationGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingIPGeolocationGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settinghotlinkprotection_test.go b/zonesettingipgeolocation_test.go similarity index 84% rename from settinghotlinkprotection_test.go rename to zonesettingipgeolocation_test.go index 6d4351ec024..cd6f2d9f7da 100644 --- a/settinghotlinkprotection_test.go +++ b/zonesettingipgeolocation_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingHotlinkProtectionEdit(t *testing.T) { +func TestZoneSettingIPGeolocationEdit(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 { @@ -29,9 +29,9 @@ func TestSettingHotlinkProtectionEdit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.HotlinkProtection.Edit(context.TODO(), cloudflare.SettingHotlinkProtectionEditParams{ + _, err := client.Zones.Settings.IPGeolocation.Edit(context.TODO(), cloudflare.ZoneSettingIPGeolocationEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingHotlinkProtectionEditParamsValueOn), + Value: cloudflare.F(cloudflare.ZoneSettingIPGeolocationEditParamsValueOn), }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +42,7 @@ func TestSettingHotlinkProtectionEdit(t *testing.T) { } } -func TestSettingHotlinkProtectionGet(t *testing.T) { +func TestZoneSettingIPGeolocationGet(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 { @@ -58,7 +58,7 @@ func TestSettingHotlinkProtectionGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.HotlinkProtection.Get(context.TODO(), cloudflare.SettingHotlinkProtectionGetParams{ + _, err := client.Zones.Settings.IPGeolocation.Get(context.TODO(), cloudflare.ZoneSettingIPGeolocationGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingipv6.go b/zonesettingipv6.go new file mode 100644 index 00000000000..f01373151ee --- /dev/null +++ b/zonesettingipv6.go @@ -0,0 +1,321 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingIPV6Service contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewZoneSettingIPV6Service] method +// instead. +type ZoneSettingIPV6Service struct { + Options []option.RequestOption +} + +// NewZoneSettingIPV6Service generates a new service that applies the given options +// to each request. These options are applied after the parent client's options (if +// there is one), and before any request-specific options. +func NewZoneSettingIPV6Service(opts ...option.RequestOption) (r *ZoneSettingIPV6Service) { + r = &ZoneSettingIPV6Service{} + r.Options = opts + return +} + +// Enable IPv6 on all subdomains that are Cloudflare enabled. +// (https://support.cloudflare.com/hc/en-us/articles/200168586). +func (r *ZoneSettingIPV6Service) Edit(ctx context.Context, params ZoneSettingIPV6EditParams, opts ...option.RequestOption) (res *ZoneSettingIPV6EditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingIPV6EditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/ipv6", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Enable IPv6 on all subdomains that are Cloudflare enabled. +// (https://support.cloudflare.com/hc/en-us/articles/200168586). +func (r *ZoneSettingIPV6Service) Get(ctx context.Context, query ZoneSettingIPV6GetParams, opts ...option.RequestOption) (res *ZoneSettingIPV6GetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingIPV6GetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/ipv6", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Enable IPv6 on all subdomains that are Cloudflare enabled. +// (https://support.cloudflare.com/hc/en-us/articles/200168586). +type ZoneSettingIPV6EditResponse struct { + // ID of the zone setting. + ID ZoneSettingIPV6EditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingIPV6EditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingIPV6EditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingIPV6EditResponseJSON `json:"-"` +} + +// zoneSettingIPV6EditResponseJSON contains the JSON metadata for the struct +// [ZoneSettingIPV6EditResponse] +type zoneSettingIPV6EditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingIPV6EditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingIPV6EditResponseID string + +const ( + ZoneSettingIPV6EditResponseIDIPV6 ZoneSettingIPV6EditResponseID = "ipv6" +) + +// Current value of the zone setting. +type ZoneSettingIPV6EditResponseValue string + +const ( + ZoneSettingIPV6EditResponseValueOff ZoneSettingIPV6EditResponseValue = "off" + ZoneSettingIPV6EditResponseValueOn ZoneSettingIPV6EditResponseValue = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingIPV6EditResponseEditable bool + +const ( + ZoneSettingIPV6EditResponseEditableTrue ZoneSettingIPV6EditResponseEditable = true + ZoneSettingIPV6EditResponseEditableFalse ZoneSettingIPV6EditResponseEditable = false +) + +// Enable IPv6 on all subdomains that are Cloudflare enabled. +// (https://support.cloudflare.com/hc/en-us/articles/200168586). +type ZoneSettingIPV6GetResponse struct { + // ID of the zone setting. + ID ZoneSettingIPV6GetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingIPV6GetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingIPV6GetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingIPV6GetResponseJSON `json:"-"` +} + +// zoneSettingIPV6GetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingIPV6GetResponse] +type zoneSettingIPV6GetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingIPV6GetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingIPV6GetResponseID string + +const ( + ZoneSettingIPV6GetResponseIDIPV6 ZoneSettingIPV6GetResponseID = "ipv6" +) + +// Current value of the zone setting. +type ZoneSettingIPV6GetResponseValue string + +const ( + ZoneSettingIPV6GetResponseValueOff ZoneSettingIPV6GetResponseValue = "off" + ZoneSettingIPV6GetResponseValueOn ZoneSettingIPV6GetResponseValue = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingIPV6GetResponseEditable bool + +const ( + ZoneSettingIPV6GetResponseEditableTrue ZoneSettingIPV6GetResponseEditable = true + ZoneSettingIPV6GetResponseEditableFalse ZoneSettingIPV6GetResponseEditable = false +) + +type ZoneSettingIPV6EditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingIPV6EditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingIPV6EditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingIPV6EditParamsValue string + +const ( + ZoneSettingIPV6EditParamsValueOff ZoneSettingIPV6EditParamsValue = "off" + ZoneSettingIPV6EditParamsValueOn ZoneSettingIPV6EditParamsValue = "on" +) + +type ZoneSettingIPV6EditResponseEnvelope struct { + Errors []ZoneSettingIPV6EditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingIPV6EditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Enable IPv6 on all subdomains that are Cloudflare enabled. + // (https://support.cloudflare.com/hc/en-us/articles/200168586). + Result ZoneSettingIPV6EditResponse `json:"result"` + JSON zoneSettingIPV6EditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingIPV6EditResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingIPV6EditResponseEnvelope] +type zoneSettingIPV6EditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingIPV6EditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingIPV6EditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingIPV6EditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingIPV6EditResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [ZoneSettingIPV6EditResponseEnvelopeErrors] +type zoneSettingIPV6EditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingIPV6EditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingIPV6EditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingIPV6EditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingIPV6EditResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingIPV6EditResponseEnvelopeMessages] +type zoneSettingIPV6EditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingIPV6EditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingIPV6GetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingIPV6GetResponseEnvelope struct { + Errors []ZoneSettingIPV6GetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingIPV6GetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Enable IPv6 on all subdomains that are Cloudflare enabled. + // (https://support.cloudflare.com/hc/en-us/articles/200168586). + Result ZoneSettingIPV6GetResponse `json:"result"` + JSON zoneSettingIPV6GetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingIPV6GetResponseEnvelopeJSON contains the JSON metadata for the struct +// [ZoneSettingIPV6GetResponseEnvelope] +type zoneSettingIPV6GetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingIPV6GetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingIPV6GetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingIPV6GetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingIPV6GetResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [ZoneSettingIPV6GetResponseEnvelopeErrors] +type zoneSettingIPV6GetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingIPV6GetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingIPV6GetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingIPV6GetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingIPV6GetResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingIPV6GetResponseEnvelopeMessages] +type zoneSettingIPV6GetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingIPV6GetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settinghttp3_test.go b/zonesettingipv6_test.go similarity index 85% rename from settinghttp3_test.go rename to zonesettingipv6_test.go index e99bfd000ee..44b0f5c32bf 100644 --- a/settinghttp3_test.go +++ b/zonesettingipv6_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingHTTP3Edit(t *testing.T) { +func TestZoneSettingIPV6Edit(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 { @@ -29,9 +29,9 @@ func TestSettingHTTP3Edit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.HTTP3.Edit(context.TODO(), cloudflare.SettingHTTP3EditParams{ + _, err := client.Zones.Settings.IPV6.Edit(context.TODO(), cloudflare.ZoneSettingIPV6EditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingHTTP3EditParamsValueOn), + Value: cloudflare.F(cloudflare.ZoneSettingIPV6EditParamsValueOff), }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +42,7 @@ func TestSettingHTTP3Edit(t *testing.T) { } } -func TestSettingHTTP3Get(t *testing.T) { +func TestZoneSettingIPV6Get(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 { @@ -58,7 +58,7 @@ func TestSettingHTTP3Get(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.HTTP3.Get(context.TODO(), cloudflare.SettingHTTP3GetParams{ + _, err := client.Zones.Settings.IPV6.Get(context.TODO(), cloudflare.ZoneSettingIPV6GetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingminify.go b/zonesettingminify.go new file mode 100644 index 00000000000..63d98e4c2ff --- /dev/null +++ b/zonesettingminify.go @@ -0,0 +1,439 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingMinifyService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewZoneSettingMinifyService] method +// instead. +type ZoneSettingMinifyService struct { + Options []option.RequestOption +} + +// NewZoneSettingMinifyService generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewZoneSettingMinifyService(opts ...option.RequestOption) (r *ZoneSettingMinifyService) { + r = &ZoneSettingMinifyService{} + r.Options = opts + return +} + +// Automatically minify certain assets for your website. Refer to +// [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) +// for more information. +func (r *ZoneSettingMinifyService) Edit(ctx context.Context, params ZoneSettingMinifyEditParams, opts ...option.RequestOption) (res *ZoneSettingMinifyEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingMinifyEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/minify", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Automatically minify certain assets for your website. Refer to +// [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) +// for more information. +func (r *ZoneSettingMinifyService) Get(ctx context.Context, query ZoneSettingMinifyGetParams, opts ...option.RequestOption) (res *ZoneSettingMinifyGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingMinifyGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/minify", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Automatically minify certain assets for your website. Refer to +// [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) +// for more information. +type ZoneSettingMinifyEditResponse struct { + // Zone setting identifier. + ID ZoneSettingMinifyEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingMinifyEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingMinifyEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingMinifyEditResponseJSON `json:"-"` +} + +// zoneSettingMinifyEditResponseJSON contains the JSON metadata for the struct +// [ZoneSettingMinifyEditResponse] +type zoneSettingMinifyEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMinifyEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Zone setting identifier. +type ZoneSettingMinifyEditResponseID string + +const ( + ZoneSettingMinifyEditResponseIDMinify ZoneSettingMinifyEditResponseID = "minify" +) + +// Current value of the zone setting. +type ZoneSettingMinifyEditResponseValue struct { + // Automatically minify all CSS files for your website. + Css ZoneSettingMinifyEditResponseValueCss `json:"css"` + // Automatically minify all HTML files for your website. + HTML ZoneSettingMinifyEditResponseValueHTML `json:"html"` + // Automatically minify all JavaScript files for your website. + Js ZoneSettingMinifyEditResponseValueJs `json:"js"` + JSON zoneSettingMinifyEditResponseValueJSON `json:"-"` +} + +// zoneSettingMinifyEditResponseValueJSON contains the JSON metadata for the struct +// [ZoneSettingMinifyEditResponseValue] +type zoneSettingMinifyEditResponseValueJSON struct { + Css apijson.Field + HTML apijson.Field + Js apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMinifyEditResponseValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Automatically minify all CSS files for your website. +type ZoneSettingMinifyEditResponseValueCss string + +const ( + ZoneSettingMinifyEditResponseValueCssOn ZoneSettingMinifyEditResponseValueCss = "on" + ZoneSettingMinifyEditResponseValueCssOff ZoneSettingMinifyEditResponseValueCss = "off" +) + +// Automatically minify all HTML files for your website. +type ZoneSettingMinifyEditResponseValueHTML string + +const ( + ZoneSettingMinifyEditResponseValueHTMLOn ZoneSettingMinifyEditResponseValueHTML = "on" + ZoneSettingMinifyEditResponseValueHTMLOff ZoneSettingMinifyEditResponseValueHTML = "off" +) + +// Automatically minify all JavaScript files for your website. +type ZoneSettingMinifyEditResponseValueJs string + +const ( + ZoneSettingMinifyEditResponseValueJsOn ZoneSettingMinifyEditResponseValueJs = "on" + ZoneSettingMinifyEditResponseValueJsOff ZoneSettingMinifyEditResponseValueJs = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingMinifyEditResponseEditable bool + +const ( + ZoneSettingMinifyEditResponseEditableTrue ZoneSettingMinifyEditResponseEditable = true + ZoneSettingMinifyEditResponseEditableFalse ZoneSettingMinifyEditResponseEditable = false +) + +// Automatically minify certain assets for your website. Refer to +// [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) +// for more information. +type ZoneSettingMinifyGetResponse struct { + // Zone setting identifier. + ID ZoneSettingMinifyGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingMinifyGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingMinifyGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingMinifyGetResponseJSON `json:"-"` +} + +// zoneSettingMinifyGetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingMinifyGetResponse] +type zoneSettingMinifyGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMinifyGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Zone setting identifier. +type ZoneSettingMinifyGetResponseID string + +const ( + ZoneSettingMinifyGetResponseIDMinify ZoneSettingMinifyGetResponseID = "minify" +) + +// Current value of the zone setting. +type ZoneSettingMinifyGetResponseValue struct { + // Automatically minify all CSS files for your website. + Css ZoneSettingMinifyGetResponseValueCss `json:"css"` + // Automatically minify all HTML files for your website. + HTML ZoneSettingMinifyGetResponseValueHTML `json:"html"` + // Automatically minify all JavaScript files for your website. + Js ZoneSettingMinifyGetResponseValueJs `json:"js"` + JSON zoneSettingMinifyGetResponseValueJSON `json:"-"` +} + +// zoneSettingMinifyGetResponseValueJSON contains the JSON metadata for the struct +// [ZoneSettingMinifyGetResponseValue] +type zoneSettingMinifyGetResponseValueJSON struct { + Css apijson.Field + HTML apijson.Field + Js apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMinifyGetResponseValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Automatically minify all CSS files for your website. +type ZoneSettingMinifyGetResponseValueCss string + +const ( + ZoneSettingMinifyGetResponseValueCssOn ZoneSettingMinifyGetResponseValueCss = "on" + ZoneSettingMinifyGetResponseValueCssOff ZoneSettingMinifyGetResponseValueCss = "off" +) + +// Automatically minify all HTML files for your website. +type ZoneSettingMinifyGetResponseValueHTML string + +const ( + ZoneSettingMinifyGetResponseValueHTMLOn ZoneSettingMinifyGetResponseValueHTML = "on" + ZoneSettingMinifyGetResponseValueHTMLOff ZoneSettingMinifyGetResponseValueHTML = "off" +) + +// Automatically minify all JavaScript files for your website. +type ZoneSettingMinifyGetResponseValueJs string + +const ( + ZoneSettingMinifyGetResponseValueJsOn ZoneSettingMinifyGetResponseValueJs = "on" + ZoneSettingMinifyGetResponseValueJsOff ZoneSettingMinifyGetResponseValueJs = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingMinifyGetResponseEditable bool + +const ( + ZoneSettingMinifyGetResponseEditableTrue ZoneSettingMinifyGetResponseEditable = true + ZoneSettingMinifyGetResponseEditableFalse ZoneSettingMinifyGetResponseEditable = false +) + +type ZoneSettingMinifyEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingMinifyEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingMinifyEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingMinifyEditParamsValue struct { + // Automatically minify all CSS files for your website. + Css param.Field[ZoneSettingMinifyEditParamsValueCss] `json:"css"` + // Automatically minify all HTML files for your website. + HTML param.Field[ZoneSettingMinifyEditParamsValueHTML] `json:"html"` + // Automatically minify all JavaScript files for your website. + Js param.Field[ZoneSettingMinifyEditParamsValueJs] `json:"js"` +} + +func (r ZoneSettingMinifyEditParamsValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Automatically minify all CSS files for your website. +type ZoneSettingMinifyEditParamsValueCss string + +const ( + ZoneSettingMinifyEditParamsValueCssOn ZoneSettingMinifyEditParamsValueCss = "on" + ZoneSettingMinifyEditParamsValueCssOff ZoneSettingMinifyEditParamsValueCss = "off" +) + +// Automatically minify all HTML files for your website. +type ZoneSettingMinifyEditParamsValueHTML string + +const ( + ZoneSettingMinifyEditParamsValueHTMLOn ZoneSettingMinifyEditParamsValueHTML = "on" + ZoneSettingMinifyEditParamsValueHTMLOff ZoneSettingMinifyEditParamsValueHTML = "off" +) + +// Automatically minify all JavaScript files for your website. +type ZoneSettingMinifyEditParamsValueJs string + +const ( + ZoneSettingMinifyEditParamsValueJsOn ZoneSettingMinifyEditParamsValueJs = "on" + ZoneSettingMinifyEditParamsValueJsOff ZoneSettingMinifyEditParamsValueJs = "off" +) + +type ZoneSettingMinifyEditResponseEnvelope struct { + Errors []ZoneSettingMinifyEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingMinifyEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Automatically minify certain assets for your website. Refer to + // [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) + // for more information. + Result ZoneSettingMinifyEditResponse `json:"result"` + JSON zoneSettingMinifyEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingMinifyEditResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingMinifyEditResponseEnvelope] +type zoneSettingMinifyEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMinifyEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingMinifyEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingMinifyEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingMinifyEditResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [ZoneSettingMinifyEditResponseEnvelopeErrors] +type zoneSettingMinifyEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMinifyEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingMinifyEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingMinifyEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingMinifyEditResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingMinifyEditResponseEnvelopeMessages] +type zoneSettingMinifyEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMinifyEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingMinifyGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingMinifyGetResponseEnvelope struct { + Errors []ZoneSettingMinifyGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingMinifyGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Automatically minify certain assets for your website. Refer to + // [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) + // for more information. + Result ZoneSettingMinifyGetResponse `json:"result"` + JSON zoneSettingMinifyGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingMinifyGetResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingMinifyGetResponseEnvelope] +type zoneSettingMinifyGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMinifyGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingMinifyGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingMinifyGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingMinifyGetResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [ZoneSettingMinifyGetResponseEnvelopeErrors] +type zoneSettingMinifyGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMinifyGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingMinifyGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingMinifyGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingMinifyGetResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingMinifyGetResponseEnvelopeMessages] +type zoneSettingMinifyGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMinifyGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingimageresizing_test.go b/zonesettingminify_test.go similarity index 78% rename from settingimageresizing_test.go rename to zonesettingminify_test.go index 410d6f4b9eb..81970ee1825 100644 --- a/settingimageresizing_test.go +++ b/zonesettingminify_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingImageResizingEditWithOptionalParams(t *testing.T) { +func TestZoneSettingMinifyEditWithOptionalParams(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 { @@ -29,11 +29,12 @@ func TestSettingImageResizingEditWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.ImageResizing.Edit(context.TODO(), cloudflare.SettingImageResizingEditParams{ + _, err := client.Zones.Settings.Minify.Edit(context.TODO(), cloudflare.ZoneSettingMinifyEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingImageResizingEditParamsValue{ - ID: cloudflare.F(cloudflare.SettingImageResizingEditParamsValueIDImageResizing), - Value: cloudflare.F(cloudflare.SettingImageResizingEditParamsValueValueOn), + Value: cloudflare.F(cloudflare.ZoneSettingMinifyEditParamsValue{ + Css: cloudflare.F(cloudflare.ZoneSettingMinifyEditParamsValueCssOn), + HTML: cloudflare.F(cloudflare.ZoneSettingMinifyEditParamsValueHTMLOn), + Js: cloudflare.F(cloudflare.ZoneSettingMinifyEditParamsValueJsOn), }), }) if err != nil { @@ -45,7 +46,7 @@ func TestSettingImageResizingEditWithOptionalParams(t *testing.T) { } } -func TestSettingImageResizingGet(t *testing.T) { +func TestZoneSettingMinifyGet(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 { @@ -61,7 +62,7 @@ func TestSettingImageResizingGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.ImageResizing.Get(context.TODO(), cloudflare.SettingImageResizingGetParams{ + _, err := client.Zones.Settings.Minify.Get(context.TODO(), cloudflare.ZoneSettingMinifyGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingmintlsversion.go b/zonesettingmintlsversion.go new file mode 100644 index 00000000000..80476869d46 --- /dev/null +++ b/zonesettingmintlsversion.go @@ -0,0 +1,329 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingMinTLSVersionService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewZoneSettingMinTLSVersionService] method instead. +type ZoneSettingMinTLSVersionService struct { + Options []option.RequestOption +} + +// NewZoneSettingMinTLSVersionService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewZoneSettingMinTLSVersionService(opts ...option.RequestOption) (r *ZoneSettingMinTLSVersionService) { + r = &ZoneSettingMinTLSVersionService{} + r.Options = opts + return +} + +// Changes Minimum TLS Version setting. +func (r *ZoneSettingMinTLSVersionService) Edit(ctx context.Context, params ZoneSettingMinTLSVersionEditParams, opts ...option.RequestOption) (res *ZoneSettingMinTLSVersionEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingMinTLSVersionEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/min_tls_version", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Gets Minimum TLS Version setting. +func (r *ZoneSettingMinTLSVersionService) Get(ctx context.Context, query ZoneSettingMinTLSVersionGetParams, opts ...option.RequestOption) (res *ZoneSettingMinTLSVersionGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingMinTLSVersionGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/min_tls_version", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Only accepts HTTPS requests that use at least the TLS protocol version +// specified. For example, if TLS 1.1 is selected, TLS 1.0 connections will be +// rejected, while 1.1, 1.2, and 1.3 (if enabled) will be permitted. +type ZoneSettingMinTLSVersionEditResponse struct { + // ID of the zone setting. + ID ZoneSettingMinTLSVersionEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingMinTLSVersionEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingMinTLSVersionEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingMinTLSVersionEditResponseJSON `json:"-"` +} + +// zoneSettingMinTLSVersionEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingMinTLSVersionEditResponse] +type zoneSettingMinTLSVersionEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMinTLSVersionEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingMinTLSVersionEditResponseID string + +const ( + ZoneSettingMinTLSVersionEditResponseIDMinTLSVersion ZoneSettingMinTLSVersionEditResponseID = "min_tls_version" +) + +// Current value of the zone setting. +type ZoneSettingMinTLSVersionEditResponseValue string + +const ( + ZoneSettingMinTLSVersionEditResponseValue1_0 ZoneSettingMinTLSVersionEditResponseValue = "1.0" + ZoneSettingMinTLSVersionEditResponseValue1_1 ZoneSettingMinTLSVersionEditResponseValue = "1.1" + ZoneSettingMinTLSVersionEditResponseValue1_2 ZoneSettingMinTLSVersionEditResponseValue = "1.2" + ZoneSettingMinTLSVersionEditResponseValue1_3 ZoneSettingMinTLSVersionEditResponseValue = "1.3" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingMinTLSVersionEditResponseEditable bool + +const ( + ZoneSettingMinTLSVersionEditResponseEditableTrue ZoneSettingMinTLSVersionEditResponseEditable = true + ZoneSettingMinTLSVersionEditResponseEditableFalse ZoneSettingMinTLSVersionEditResponseEditable = false +) + +// Only accepts HTTPS requests that use at least the TLS protocol version +// specified. For example, if TLS 1.1 is selected, TLS 1.0 connections will be +// rejected, while 1.1, 1.2, and 1.3 (if enabled) will be permitted. +type ZoneSettingMinTLSVersionGetResponse struct { + // ID of the zone setting. + ID ZoneSettingMinTLSVersionGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingMinTLSVersionGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingMinTLSVersionGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingMinTLSVersionGetResponseJSON `json:"-"` +} + +// zoneSettingMinTLSVersionGetResponseJSON contains the JSON metadata for the +// struct [ZoneSettingMinTLSVersionGetResponse] +type zoneSettingMinTLSVersionGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMinTLSVersionGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingMinTLSVersionGetResponseID string + +const ( + ZoneSettingMinTLSVersionGetResponseIDMinTLSVersion ZoneSettingMinTLSVersionGetResponseID = "min_tls_version" +) + +// Current value of the zone setting. +type ZoneSettingMinTLSVersionGetResponseValue string + +const ( + ZoneSettingMinTLSVersionGetResponseValue1_0 ZoneSettingMinTLSVersionGetResponseValue = "1.0" + ZoneSettingMinTLSVersionGetResponseValue1_1 ZoneSettingMinTLSVersionGetResponseValue = "1.1" + ZoneSettingMinTLSVersionGetResponseValue1_2 ZoneSettingMinTLSVersionGetResponseValue = "1.2" + ZoneSettingMinTLSVersionGetResponseValue1_3 ZoneSettingMinTLSVersionGetResponseValue = "1.3" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingMinTLSVersionGetResponseEditable bool + +const ( + ZoneSettingMinTLSVersionGetResponseEditableTrue ZoneSettingMinTLSVersionGetResponseEditable = true + ZoneSettingMinTLSVersionGetResponseEditableFalse ZoneSettingMinTLSVersionGetResponseEditable = false +) + +type ZoneSettingMinTLSVersionEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingMinTLSVersionEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingMinTLSVersionEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingMinTLSVersionEditParamsValue string + +const ( + ZoneSettingMinTLSVersionEditParamsValue1_0 ZoneSettingMinTLSVersionEditParamsValue = "1.0" + ZoneSettingMinTLSVersionEditParamsValue1_1 ZoneSettingMinTLSVersionEditParamsValue = "1.1" + ZoneSettingMinTLSVersionEditParamsValue1_2 ZoneSettingMinTLSVersionEditParamsValue = "1.2" + ZoneSettingMinTLSVersionEditParamsValue1_3 ZoneSettingMinTLSVersionEditParamsValue = "1.3" +) + +type ZoneSettingMinTLSVersionEditResponseEnvelope struct { + Errors []ZoneSettingMinTLSVersionEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingMinTLSVersionEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Only accepts HTTPS requests that use at least the TLS protocol version + // specified. For example, if TLS 1.1 is selected, TLS 1.0 connections will be + // rejected, while 1.1, 1.2, and 1.3 (if enabled) will be permitted. + Result ZoneSettingMinTLSVersionEditResponse `json:"result"` + JSON zoneSettingMinTLSVersionEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingMinTLSVersionEditResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingMinTLSVersionEditResponseEnvelope] +type zoneSettingMinTLSVersionEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMinTLSVersionEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingMinTLSVersionEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingMinTLSVersionEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingMinTLSVersionEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingMinTLSVersionEditResponseEnvelopeErrors] +type zoneSettingMinTLSVersionEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMinTLSVersionEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingMinTLSVersionEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingMinTLSVersionEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingMinTLSVersionEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingMinTLSVersionEditResponseEnvelopeMessages] +type zoneSettingMinTLSVersionEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMinTLSVersionEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingMinTLSVersionGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingMinTLSVersionGetResponseEnvelope struct { + Errors []ZoneSettingMinTLSVersionGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingMinTLSVersionGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Only accepts HTTPS requests that use at least the TLS protocol version + // specified. For example, if TLS 1.1 is selected, TLS 1.0 connections will be + // rejected, while 1.1, 1.2, and 1.3 (if enabled) will be permitted. + Result ZoneSettingMinTLSVersionGetResponse `json:"result"` + JSON zoneSettingMinTLSVersionGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingMinTLSVersionGetResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingMinTLSVersionGetResponseEnvelope] +type zoneSettingMinTLSVersionGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMinTLSVersionGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingMinTLSVersionGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingMinTLSVersionGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingMinTLSVersionGetResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [ZoneSettingMinTLSVersionGetResponseEnvelopeErrors] +type zoneSettingMinTLSVersionGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMinTLSVersionGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingMinTLSVersionGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingMinTLSVersionGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingMinTLSVersionGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingMinTLSVersionGetResponseEnvelopeMessages] +type zoneSettingMinTLSVersionGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMinTLSVersionGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/zonesettingmintlsversion_test.go b/zonesettingmintlsversion_test.go new file mode 100644 index 00000000000..c7fe05d4270 --- /dev/null +++ b/zonesettingmintlsversion_test.go @@ -0,0 +1,71 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingMinTLSVersionEdit(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.MinTLSVersion.Edit(context.TODO(), cloudflare.ZoneSettingMinTLSVersionEditParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Value: cloudflare.F(cloudflare.ZoneSettingMinTLSVersionEditParamsValue1_0), + }) + 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 TestZoneSettingMinTLSVersionGet(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.MinTLSVersion.Get(context.TODO(), cloudflare.ZoneSettingMinTLSVersionGetParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/zonesettingmirage.go b/zonesettingmirage.go new file mode 100644 index 00000000000..8e159dbfeea --- /dev/null +++ b/zonesettingmirage.go @@ -0,0 +1,333 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingMirageService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewZoneSettingMirageService] method +// instead. +type ZoneSettingMirageService struct { + Options []option.RequestOption +} + +// NewZoneSettingMirageService generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewZoneSettingMirageService(opts ...option.RequestOption) (r *ZoneSettingMirageService) { + r = &ZoneSettingMirageService{} + r.Options = opts + return +} + +// Automatically optimize image loading for website visitors on mobile devices. +// Refer to our +// [blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for more +// information. +func (r *ZoneSettingMirageService) Edit(ctx context.Context, params ZoneSettingMirageEditParams, opts ...option.RequestOption) (res *ZoneSettingMirageEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingMirageEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/mirage", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Automatically optimize image loading for website visitors on mobile devices. +// Refer to our +// [blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for more +// information. +func (r *ZoneSettingMirageService) Get(ctx context.Context, query ZoneSettingMirageGetParams, opts ...option.RequestOption) (res *ZoneSettingMirageGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingMirageGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/mirage", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Automatically optimize image loading for website visitors on mobile devices. +// Refer to +// [our blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for +// more information. +type ZoneSettingMirageEditResponse struct { + // ID of the zone setting. + ID ZoneSettingMirageEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingMirageEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingMirageEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingMirageEditResponseJSON `json:"-"` +} + +// zoneSettingMirageEditResponseJSON contains the JSON metadata for the struct +// [ZoneSettingMirageEditResponse] +type zoneSettingMirageEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMirageEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingMirageEditResponseID string + +const ( + ZoneSettingMirageEditResponseIDMirage ZoneSettingMirageEditResponseID = "mirage" +) + +// Current value of the zone setting. +type ZoneSettingMirageEditResponseValue string + +const ( + ZoneSettingMirageEditResponseValueOn ZoneSettingMirageEditResponseValue = "on" + ZoneSettingMirageEditResponseValueOff ZoneSettingMirageEditResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingMirageEditResponseEditable bool + +const ( + ZoneSettingMirageEditResponseEditableTrue ZoneSettingMirageEditResponseEditable = true + ZoneSettingMirageEditResponseEditableFalse ZoneSettingMirageEditResponseEditable = false +) + +// Automatically optimize image loading for website visitors on mobile devices. +// Refer to +// [our blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for +// more information. +type ZoneSettingMirageGetResponse struct { + // ID of the zone setting. + ID ZoneSettingMirageGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingMirageGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingMirageGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingMirageGetResponseJSON `json:"-"` +} + +// zoneSettingMirageGetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingMirageGetResponse] +type zoneSettingMirageGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMirageGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingMirageGetResponseID string + +const ( + ZoneSettingMirageGetResponseIDMirage ZoneSettingMirageGetResponseID = "mirage" +) + +// Current value of the zone setting. +type ZoneSettingMirageGetResponseValue string + +const ( + ZoneSettingMirageGetResponseValueOn ZoneSettingMirageGetResponseValue = "on" + ZoneSettingMirageGetResponseValueOff ZoneSettingMirageGetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingMirageGetResponseEditable bool + +const ( + ZoneSettingMirageGetResponseEditableTrue ZoneSettingMirageGetResponseEditable = true + ZoneSettingMirageGetResponseEditableFalse ZoneSettingMirageGetResponseEditable = false +) + +type ZoneSettingMirageEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingMirageEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingMirageEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingMirageEditParamsValue string + +const ( + ZoneSettingMirageEditParamsValueOn ZoneSettingMirageEditParamsValue = "on" + ZoneSettingMirageEditParamsValueOff ZoneSettingMirageEditParamsValue = "off" +) + +type ZoneSettingMirageEditResponseEnvelope struct { + Errors []ZoneSettingMirageEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingMirageEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Automatically optimize image loading for website visitors on mobile devices. + // Refer to + // [our blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for + // more information. + Result ZoneSettingMirageEditResponse `json:"result"` + JSON zoneSettingMirageEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingMirageEditResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingMirageEditResponseEnvelope] +type zoneSettingMirageEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMirageEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingMirageEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingMirageEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingMirageEditResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [ZoneSettingMirageEditResponseEnvelopeErrors] +type zoneSettingMirageEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMirageEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingMirageEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingMirageEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingMirageEditResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingMirageEditResponseEnvelopeMessages] +type zoneSettingMirageEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMirageEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingMirageGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingMirageGetResponseEnvelope struct { + Errors []ZoneSettingMirageGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingMirageGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Automatically optimize image loading for website visitors on mobile devices. + // Refer to + // [our blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for + // more information. + Result ZoneSettingMirageGetResponse `json:"result"` + JSON zoneSettingMirageGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingMirageGetResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingMirageGetResponseEnvelope] +type zoneSettingMirageGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMirageGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingMirageGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingMirageGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingMirageGetResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [ZoneSettingMirageGetResponseEnvelopeErrors] +type zoneSettingMirageGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMirageGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingMirageGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingMirageGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingMirageGetResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingMirageGetResponseEnvelopeMessages] +type zoneSettingMirageGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMirageGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/zonesettingmirage_test.go b/zonesettingmirage_test.go new file mode 100644 index 00000000000..d8f8daf12b7 --- /dev/null +++ b/zonesettingmirage_test.go @@ -0,0 +1,71 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingMirageEdit(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.Mirage.Edit(context.TODO(), cloudflare.ZoneSettingMirageEditParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Value: cloudflare.F(cloudflare.ZoneSettingMirageEditParamsValueOn), + }) + 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 TestZoneSettingMirageGet(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.Mirage.Get(context.TODO(), cloudflare.ZoneSettingMirageGetParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/zonesettingmobileredirect.go b/zonesettingmobileredirect.go new file mode 100644 index 00000000000..22c8a506693 --- /dev/null +++ b/zonesettingmobileredirect.go @@ -0,0 +1,403 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingMobileRedirectService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewZoneSettingMobileRedirectService] method instead. +type ZoneSettingMobileRedirectService struct { + Options []option.RequestOption +} + +// NewZoneSettingMobileRedirectService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewZoneSettingMobileRedirectService(opts ...option.RequestOption) (r *ZoneSettingMobileRedirectService) { + r = &ZoneSettingMobileRedirectService{} + r.Options = opts + return +} + +// Automatically redirect visitors on mobile devices to a mobile-optimized +// subdomain. Refer to +// [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) +// for more information. +func (r *ZoneSettingMobileRedirectService) Edit(ctx context.Context, params ZoneSettingMobileRedirectEditParams, opts ...option.RequestOption) (res *ZoneSettingMobileRedirectEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingMobileRedirectEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/mobile_redirect", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Automatically redirect visitors on mobile devices to a mobile-optimized +// subdomain. Refer to +// [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) +// for more information. +func (r *ZoneSettingMobileRedirectService) Get(ctx context.Context, query ZoneSettingMobileRedirectGetParams, opts ...option.RequestOption) (res *ZoneSettingMobileRedirectGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingMobileRedirectGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/mobile_redirect", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Automatically redirect visitors on mobile devices to a mobile-optimized +// subdomain. Refer to +// [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) +// for more information. +type ZoneSettingMobileRedirectEditResponse struct { + // Identifier of the zone setting. + ID ZoneSettingMobileRedirectEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingMobileRedirectEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingMobileRedirectEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingMobileRedirectEditResponseJSON `json:"-"` +} + +// zoneSettingMobileRedirectEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingMobileRedirectEditResponse] +type zoneSettingMobileRedirectEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMobileRedirectEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Identifier of the zone setting. +type ZoneSettingMobileRedirectEditResponseID string + +const ( + ZoneSettingMobileRedirectEditResponseIDMobileRedirect ZoneSettingMobileRedirectEditResponseID = "mobile_redirect" +) + +// Current value of the zone setting. +type ZoneSettingMobileRedirectEditResponseValue struct { + // Which subdomain prefix you wish to redirect visitors on mobile devices to + // (subdomain must already exist). + MobileSubdomain string `json:"mobile_subdomain,nullable"` + // Whether or not mobile redirect is enabled. + Status ZoneSettingMobileRedirectEditResponseValueStatus `json:"status"` + // Whether to drop the current page path and redirect to the mobile subdomain URL + // root, or keep the path and redirect to the same page on the mobile subdomain. + StripUri bool `json:"strip_uri"` + JSON zoneSettingMobileRedirectEditResponseValueJSON `json:"-"` +} + +// zoneSettingMobileRedirectEditResponseValueJSON contains the JSON metadata for +// the struct [ZoneSettingMobileRedirectEditResponseValue] +type zoneSettingMobileRedirectEditResponseValueJSON struct { + MobileSubdomain apijson.Field + Status apijson.Field + StripUri apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMobileRedirectEditResponseValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether or not mobile redirect is enabled. +type ZoneSettingMobileRedirectEditResponseValueStatus string + +const ( + ZoneSettingMobileRedirectEditResponseValueStatusOn ZoneSettingMobileRedirectEditResponseValueStatus = "on" + ZoneSettingMobileRedirectEditResponseValueStatusOff ZoneSettingMobileRedirectEditResponseValueStatus = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingMobileRedirectEditResponseEditable bool + +const ( + ZoneSettingMobileRedirectEditResponseEditableTrue ZoneSettingMobileRedirectEditResponseEditable = true + ZoneSettingMobileRedirectEditResponseEditableFalse ZoneSettingMobileRedirectEditResponseEditable = false +) + +// Automatically redirect visitors on mobile devices to a mobile-optimized +// subdomain. Refer to +// [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) +// for more information. +type ZoneSettingMobileRedirectGetResponse struct { + // Identifier of the zone setting. + ID ZoneSettingMobileRedirectGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingMobileRedirectGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingMobileRedirectGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingMobileRedirectGetResponseJSON `json:"-"` +} + +// zoneSettingMobileRedirectGetResponseJSON contains the JSON metadata for the +// struct [ZoneSettingMobileRedirectGetResponse] +type zoneSettingMobileRedirectGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMobileRedirectGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Identifier of the zone setting. +type ZoneSettingMobileRedirectGetResponseID string + +const ( + ZoneSettingMobileRedirectGetResponseIDMobileRedirect ZoneSettingMobileRedirectGetResponseID = "mobile_redirect" +) + +// Current value of the zone setting. +type ZoneSettingMobileRedirectGetResponseValue struct { + // Which subdomain prefix you wish to redirect visitors on mobile devices to + // (subdomain must already exist). + MobileSubdomain string `json:"mobile_subdomain,nullable"` + // Whether or not mobile redirect is enabled. + Status ZoneSettingMobileRedirectGetResponseValueStatus `json:"status"` + // Whether to drop the current page path and redirect to the mobile subdomain URL + // root, or keep the path and redirect to the same page on the mobile subdomain. + StripUri bool `json:"strip_uri"` + JSON zoneSettingMobileRedirectGetResponseValueJSON `json:"-"` +} + +// zoneSettingMobileRedirectGetResponseValueJSON contains the JSON metadata for the +// struct [ZoneSettingMobileRedirectGetResponseValue] +type zoneSettingMobileRedirectGetResponseValueJSON struct { + MobileSubdomain apijson.Field + Status apijson.Field + StripUri apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMobileRedirectGetResponseValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether or not mobile redirect is enabled. +type ZoneSettingMobileRedirectGetResponseValueStatus string + +const ( + ZoneSettingMobileRedirectGetResponseValueStatusOn ZoneSettingMobileRedirectGetResponseValueStatus = "on" + ZoneSettingMobileRedirectGetResponseValueStatusOff ZoneSettingMobileRedirectGetResponseValueStatus = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingMobileRedirectGetResponseEditable bool + +const ( + ZoneSettingMobileRedirectGetResponseEditableTrue ZoneSettingMobileRedirectGetResponseEditable = true + ZoneSettingMobileRedirectGetResponseEditableFalse ZoneSettingMobileRedirectGetResponseEditable = false +) + +type ZoneSettingMobileRedirectEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingMobileRedirectEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingMobileRedirectEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingMobileRedirectEditParamsValue struct { + // Which subdomain prefix you wish to redirect visitors on mobile devices to + // (subdomain must already exist). + MobileSubdomain param.Field[string] `json:"mobile_subdomain"` + // Whether or not mobile redirect is enabled. + Status param.Field[ZoneSettingMobileRedirectEditParamsValueStatus] `json:"status"` + // Whether to drop the current page path and redirect to the mobile subdomain URL + // root, or keep the path and redirect to the same page on the mobile subdomain. + StripUri param.Field[bool] `json:"strip_uri"` +} + +func (r ZoneSettingMobileRedirectEditParamsValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Whether or not mobile redirect is enabled. +type ZoneSettingMobileRedirectEditParamsValueStatus string + +const ( + ZoneSettingMobileRedirectEditParamsValueStatusOn ZoneSettingMobileRedirectEditParamsValueStatus = "on" + ZoneSettingMobileRedirectEditParamsValueStatusOff ZoneSettingMobileRedirectEditParamsValueStatus = "off" +) + +type ZoneSettingMobileRedirectEditResponseEnvelope struct { + Errors []ZoneSettingMobileRedirectEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingMobileRedirectEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Automatically redirect visitors on mobile devices to a mobile-optimized + // subdomain. Refer to + // [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) + // for more information. + Result ZoneSettingMobileRedirectEditResponse `json:"result"` + JSON zoneSettingMobileRedirectEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingMobileRedirectEditResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingMobileRedirectEditResponseEnvelope] +type zoneSettingMobileRedirectEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMobileRedirectEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingMobileRedirectEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingMobileRedirectEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingMobileRedirectEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingMobileRedirectEditResponseEnvelopeErrors] +type zoneSettingMobileRedirectEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMobileRedirectEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingMobileRedirectEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingMobileRedirectEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingMobileRedirectEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingMobileRedirectEditResponseEnvelopeMessages] +type zoneSettingMobileRedirectEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMobileRedirectEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingMobileRedirectGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingMobileRedirectGetResponseEnvelope struct { + Errors []ZoneSettingMobileRedirectGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingMobileRedirectGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Automatically redirect visitors on mobile devices to a mobile-optimized + // subdomain. Refer to + // [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) + // for more information. + Result ZoneSettingMobileRedirectGetResponse `json:"result"` + JSON zoneSettingMobileRedirectGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingMobileRedirectGetResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingMobileRedirectGetResponseEnvelope] +type zoneSettingMobileRedirectGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMobileRedirectGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingMobileRedirectGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingMobileRedirectGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingMobileRedirectGetResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingMobileRedirectGetResponseEnvelopeErrors] +type zoneSettingMobileRedirectGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMobileRedirectGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingMobileRedirectGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingMobileRedirectGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingMobileRedirectGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingMobileRedirectGetResponseEnvelopeMessages] +type zoneSettingMobileRedirectGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingMobileRedirectGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingmobileredirect_test.go b/zonesettingmobileredirect_test.go similarity index 80% rename from settingmobileredirect_test.go rename to zonesettingmobileredirect_test.go index 173fcff9f18..c32db6b7d85 100644 --- a/settingmobileredirect_test.go +++ b/zonesettingmobileredirect_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingMobileRedirectEditWithOptionalParams(t *testing.T) { +func TestZoneSettingMobileRedirectEditWithOptionalParams(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 { @@ -29,11 +29,11 @@ func TestSettingMobileRedirectEditWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.MobileRedirect.Edit(context.TODO(), cloudflare.SettingMobileRedirectEditParams{ + _, err := client.Zones.Settings.MobileRedirect.Edit(context.TODO(), cloudflare.ZoneSettingMobileRedirectEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingMobileRedirectEditParamsValue{ + Value: cloudflare.F(cloudflare.ZoneSettingMobileRedirectEditParamsValue{ MobileSubdomain: cloudflare.F("m"), - Status: cloudflare.F(cloudflare.SettingMobileRedirectEditParamsValueStatusOn), + Status: cloudflare.F(cloudflare.ZoneSettingMobileRedirectEditParamsValueStatusOn), StripUri: cloudflare.F(false), }), }) @@ -46,7 +46,7 @@ func TestSettingMobileRedirectEditWithOptionalParams(t *testing.T) { } } -func TestSettingMobileRedirectGet(t *testing.T) { +func TestZoneSettingMobileRedirectGet(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 { @@ -62,7 +62,7 @@ func TestSettingMobileRedirectGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.MobileRedirect.Get(context.TODO(), cloudflare.SettingMobileRedirectGetParams{ + _, err := client.Zones.Settings.MobileRedirect.Get(context.TODO(), cloudflare.ZoneSettingMobileRedirectGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingnel.go b/zonesettingnel.go new file mode 100644 index 00000000000..3f079384898 --- /dev/null +++ b/zonesettingnel.go @@ -0,0 +1,366 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingNELService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewZoneSettingNELService] method +// instead. +type ZoneSettingNELService struct { + Options []option.RequestOption +} + +// NewZoneSettingNELService generates a new service that applies the given options +// to each request. These options are applied after the parent client's options (if +// there is one), and before any request-specific options. +func NewZoneSettingNELService(opts ...option.RequestOption) (r *ZoneSettingNELService) { + r = &ZoneSettingNELService{} + r.Options = opts + return +} + +// Automatically optimize image loading for website visitors on mobile devices. +// Refer to our [blog post](http://blog.cloudflare.com/nel-solving-mobile-speed) +// for more information. +func (r *ZoneSettingNELService) Edit(ctx context.Context, params ZoneSettingNELEditParams, opts ...option.RequestOption) (res *ZoneSettingNELEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingNELEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/nel", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Enable Network Error Logging reporting on your zone. (Beta) +func (r *ZoneSettingNELService) Get(ctx context.Context, query ZoneSettingNELGetParams, opts ...option.RequestOption) (res *ZoneSettingNELGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingNELGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/nel", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Enable Network Error Logging reporting on your zone. (Beta) +type ZoneSettingNELEditResponse struct { + // Zone setting identifier. + ID ZoneSettingNELEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingNELEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingNELEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingNELEditResponseJSON `json:"-"` +} + +// zoneSettingNELEditResponseJSON contains the JSON metadata for the struct +// [ZoneSettingNELEditResponse] +type zoneSettingNELEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingNELEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Zone setting identifier. +type ZoneSettingNELEditResponseID string + +const ( + ZoneSettingNELEditResponseIDNEL ZoneSettingNELEditResponseID = "nel" +) + +// Current value of the zone setting. +type ZoneSettingNELEditResponseValue struct { + Enabled bool `json:"enabled"` + JSON zoneSettingNELEditResponseValueJSON `json:"-"` +} + +// zoneSettingNELEditResponseValueJSON contains the JSON metadata for the struct +// [ZoneSettingNELEditResponseValue] +type zoneSettingNELEditResponseValueJSON struct { + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingNELEditResponseValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingNELEditResponseEditable bool + +const ( + ZoneSettingNELEditResponseEditableTrue ZoneSettingNELEditResponseEditable = true + ZoneSettingNELEditResponseEditableFalse ZoneSettingNELEditResponseEditable = false +) + +// Enable Network Error Logging reporting on your zone. (Beta) +type ZoneSettingNELGetResponse struct { + // Zone setting identifier. + ID ZoneSettingNELGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingNELGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingNELGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingNELGetResponseJSON `json:"-"` +} + +// zoneSettingNELGetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingNELGetResponse] +type zoneSettingNELGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingNELGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Zone setting identifier. +type ZoneSettingNELGetResponseID string + +const ( + ZoneSettingNELGetResponseIDNEL ZoneSettingNELGetResponseID = "nel" +) + +// Current value of the zone setting. +type ZoneSettingNELGetResponseValue struct { + Enabled bool `json:"enabled"` + JSON zoneSettingNELGetResponseValueJSON `json:"-"` +} + +// zoneSettingNELGetResponseValueJSON contains the JSON metadata for the struct +// [ZoneSettingNELGetResponseValue] +type zoneSettingNELGetResponseValueJSON struct { + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingNELGetResponseValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingNELGetResponseEditable bool + +const ( + ZoneSettingNELGetResponseEditableTrue ZoneSettingNELGetResponseEditable = true + ZoneSettingNELGetResponseEditableFalse ZoneSettingNELGetResponseEditable = false +) + +type ZoneSettingNELEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Enable Network Error Logging reporting on your zone. (Beta) + Value param.Field[ZoneSettingNELEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingNELEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enable Network Error Logging reporting on your zone. (Beta) +type ZoneSettingNELEditParamsValue struct { + // Zone setting identifier. + ID param.Field[ZoneSettingNELEditParamsValueID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingNELEditParamsValueValue] `json:"value,required"` +} + +func (r ZoneSettingNELEditParamsValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Zone setting identifier. +type ZoneSettingNELEditParamsValueID string + +const ( + ZoneSettingNELEditParamsValueIDNEL ZoneSettingNELEditParamsValueID = "nel" +) + +// Current value of the zone setting. +type ZoneSettingNELEditParamsValueValue struct { + Enabled param.Field[bool] `json:"enabled"` +} + +func (r ZoneSettingNELEditParamsValueValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingNELEditParamsValueEditable bool + +const ( + ZoneSettingNELEditParamsValueEditableTrue ZoneSettingNELEditParamsValueEditable = true + ZoneSettingNELEditParamsValueEditableFalse ZoneSettingNELEditParamsValueEditable = false +) + +type ZoneSettingNELEditResponseEnvelope struct { + Errors []ZoneSettingNELEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingNELEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Enable Network Error Logging reporting on your zone. (Beta) + Result ZoneSettingNELEditResponse `json:"result"` + JSON zoneSettingNELEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingNELEditResponseEnvelopeJSON contains the JSON metadata for the struct +// [ZoneSettingNELEditResponseEnvelope] +type zoneSettingNELEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingNELEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingNELEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingNELEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingNELEditResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [ZoneSettingNELEditResponseEnvelopeErrors] +type zoneSettingNELEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingNELEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingNELEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingNELEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingNELEditResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingNELEditResponseEnvelopeMessages] +type zoneSettingNELEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingNELEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingNELGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingNELGetResponseEnvelope struct { + Errors []ZoneSettingNELGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingNELGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Enable Network Error Logging reporting on your zone. (Beta) + Result ZoneSettingNELGetResponse `json:"result"` + JSON zoneSettingNELGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingNELGetResponseEnvelopeJSON contains the JSON metadata for the struct +// [ZoneSettingNELGetResponseEnvelope] +type zoneSettingNELGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingNELGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingNELGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingNELGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingNELGetResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [ZoneSettingNELGetResponseEnvelopeErrors] +type zoneSettingNELGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingNELGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingNELGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingNELGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingNELGetResponseEnvelopeMessagesJSON contains the JSON metadata for the +// struct [ZoneSettingNELGetResponseEnvelopeMessages] +type zoneSettingNELGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingNELGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingnel_test.go b/zonesettingnel_test.go similarity index 81% rename from settingnel_test.go rename to zonesettingnel_test.go index 2b550bbdb06..91296d56c2b 100644 --- a/settingnel_test.go +++ b/zonesettingnel_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingNELEditWithOptionalParams(t *testing.T) { +func TestZoneSettingNELEditWithOptionalParams(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 { @@ -29,11 +29,11 @@ func TestSettingNELEditWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.NEL.Edit(context.TODO(), cloudflare.SettingNELEditParams{ + _, err := client.Zones.Settings.NEL.Edit(context.TODO(), cloudflare.ZoneSettingNELEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingNELEditParamsValue{ - ID: cloudflare.F(cloudflare.SettingNELEditParamsValueIDNEL), - Value: cloudflare.F(cloudflare.SettingNELEditParamsValueValue{ + Value: cloudflare.F(cloudflare.ZoneSettingNELEditParamsValue{ + ID: cloudflare.F(cloudflare.ZoneSettingNELEditParamsValueIDNEL), + Value: cloudflare.F(cloudflare.ZoneSettingNELEditParamsValueValue{ Enabled: cloudflare.F(false), }), }), @@ -47,7 +47,7 @@ func TestSettingNELEditWithOptionalParams(t *testing.T) { } } -func TestSettingNELGet(t *testing.T) { +func TestZoneSettingNELGet(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 { @@ -63,7 +63,7 @@ func TestSettingNELGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.NEL.Get(context.TODO(), cloudflare.SettingNELGetParams{ + _, err := client.Zones.Settings.NEL.Get(context.TODO(), cloudflare.ZoneSettingNELGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingopportunisticencryption.go b/zonesettingopportunisticencryption.go new file mode 100644 index 00000000000..1adf8a9914e --- /dev/null +++ b/zonesettingopportunisticencryption.go @@ -0,0 +1,322 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingOpportunisticEncryptionService contains methods and other services +// that help with interacting with the cloudflare API. Note, unlike clients, this +// service does not read variables from the environment automatically. You should +// not instantiate this service directly, and instead use the +// [NewZoneSettingOpportunisticEncryptionService] method instead. +type ZoneSettingOpportunisticEncryptionService struct { + Options []option.RequestOption +} + +// NewZoneSettingOpportunisticEncryptionService generates a new service that +// applies the given options to each request. These options are applied after the +// parent client's options (if there is one), and before any request-specific +// options. +func NewZoneSettingOpportunisticEncryptionService(opts ...option.RequestOption) (r *ZoneSettingOpportunisticEncryptionService) { + r = &ZoneSettingOpportunisticEncryptionService{} + r.Options = opts + return +} + +// Changes Opportunistic Encryption setting. +func (r *ZoneSettingOpportunisticEncryptionService) Edit(ctx context.Context, params ZoneSettingOpportunisticEncryptionEditParams, opts ...option.RequestOption) (res *ZoneSettingOpportunisticEncryptionEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingOpportunisticEncryptionEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/opportunistic_encryption", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Gets Opportunistic Encryption setting. +func (r *ZoneSettingOpportunisticEncryptionService) Get(ctx context.Context, query ZoneSettingOpportunisticEncryptionGetParams, opts ...option.RequestOption) (res *ZoneSettingOpportunisticEncryptionGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingOpportunisticEncryptionGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/opportunistic_encryption", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Enables the Opportunistic Encryption feature for a zone. +type ZoneSettingOpportunisticEncryptionEditResponse struct { + // ID of the zone setting. + ID ZoneSettingOpportunisticEncryptionEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingOpportunisticEncryptionEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingOpportunisticEncryptionEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingOpportunisticEncryptionEditResponseJSON `json:"-"` +} + +// zoneSettingOpportunisticEncryptionEditResponseJSON contains the JSON metadata +// for the struct [ZoneSettingOpportunisticEncryptionEditResponse] +type zoneSettingOpportunisticEncryptionEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOpportunisticEncryptionEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingOpportunisticEncryptionEditResponseID string + +const ( + ZoneSettingOpportunisticEncryptionEditResponseIDOpportunisticEncryption ZoneSettingOpportunisticEncryptionEditResponseID = "opportunistic_encryption" +) + +// Current value of the zone setting. +type ZoneSettingOpportunisticEncryptionEditResponseValue string + +const ( + ZoneSettingOpportunisticEncryptionEditResponseValueOn ZoneSettingOpportunisticEncryptionEditResponseValue = "on" + ZoneSettingOpportunisticEncryptionEditResponseValueOff ZoneSettingOpportunisticEncryptionEditResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingOpportunisticEncryptionEditResponseEditable bool + +const ( + ZoneSettingOpportunisticEncryptionEditResponseEditableTrue ZoneSettingOpportunisticEncryptionEditResponseEditable = true + ZoneSettingOpportunisticEncryptionEditResponseEditableFalse ZoneSettingOpportunisticEncryptionEditResponseEditable = false +) + +// Enables the Opportunistic Encryption feature for a zone. +type ZoneSettingOpportunisticEncryptionGetResponse struct { + // ID of the zone setting. + ID ZoneSettingOpportunisticEncryptionGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingOpportunisticEncryptionGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingOpportunisticEncryptionGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingOpportunisticEncryptionGetResponseJSON `json:"-"` +} + +// zoneSettingOpportunisticEncryptionGetResponseJSON contains the JSON metadata for +// the struct [ZoneSettingOpportunisticEncryptionGetResponse] +type zoneSettingOpportunisticEncryptionGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOpportunisticEncryptionGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingOpportunisticEncryptionGetResponseID string + +const ( + ZoneSettingOpportunisticEncryptionGetResponseIDOpportunisticEncryption ZoneSettingOpportunisticEncryptionGetResponseID = "opportunistic_encryption" +) + +// Current value of the zone setting. +type ZoneSettingOpportunisticEncryptionGetResponseValue string + +const ( + ZoneSettingOpportunisticEncryptionGetResponseValueOn ZoneSettingOpportunisticEncryptionGetResponseValue = "on" + ZoneSettingOpportunisticEncryptionGetResponseValueOff ZoneSettingOpportunisticEncryptionGetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingOpportunisticEncryptionGetResponseEditable bool + +const ( + ZoneSettingOpportunisticEncryptionGetResponseEditableTrue ZoneSettingOpportunisticEncryptionGetResponseEditable = true + ZoneSettingOpportunisticEncryptionGetResponseEditableFalse ZoneSettingOpportunisticEncryptionGetResponseEditable = false +) + +type ZoneSettingOpportunisticEncryptionEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. Notes: Default value depends on the zone's plan + // level. + Value param.Field[ZoneSettingOpportunisticEncryptionEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingOpportunisticEncryptionEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. Notes: Default value depends on the zone's plan +// level. +type ZoneSettingOpportunisticEncryptionEditParamsValue string + +const ( + ZoneSettingOpportunisticEncryptionEditParamsValueOn ZoneSettingOpportunisticEncryptionEditParamsValue = "on" + ZoneSettingOpportunisticEncryptionEditParamsValueOff ZoneSettingOpportunisticEncryptionEditParamsValue = "off" +) + +type ZoneSettingOpportunisticEncryptionEditResponseEnvelope struct { + Errors []ZoneSettingOpportunisticEncryptionEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingOpportunisticEncryptionEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Enables the Opportunistic Encryption feature for a zone. + Result ZoneSettingOpportunisticEncryptionEditResponse `json:"result"` + JSON zoneSettingOpportunisticEncryptionEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingOpportunisticEncryptionEditResponseEnvelopeJSON contains the JSON +// metadata for the struct [ZoneSettingOpportunisticEncryptionEditResponseEnvelope] +type zoneSettingOpportunisticEncryptionEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOpportunisticEncryptionEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOpportunisticEncryptionEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingOpportunisticEncryptionEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingOpportunisticEncryptionEditResponseEnvelopeErrorsJSON contains the +// JSON metadata for the struct +// [ZoneSettingOpportunisticEncryptionEditResponseEnvelopeErrors] +type zoneSettingOpportunisticEncryptionEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOpportunisticEncryptionEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOpportunisticEncryptionEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingOpportunisticEncryptionEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingOpportunisticEncryptionEditResponseEnvelopeMessagesJSON contains the +// JSON metadata for the struct +// [ZoneSettingOpportunisticEncryptionEditResponseEnvelopeMessages] +type zoneSettingOpportunisticEncryptionEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOpportunisticEncryptionEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOpportunisticEncryptionGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingOpportunisticEncryptionGetResponseEnvelope struct { + Errors []ZoneSettingOpportunisticEncryptionGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingOpportunisticEncryptionGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Enables the Opportunistic Encryption feature for a zone. + Result ZoneSettingOpportunisticEncryptionGetResponse `json:"result"` + JSON zoneSettingOpportunisticEncryptionGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingOpportunisticEncryptionGetResponseEnvelopeJSON contains the JSON +// metadata for the struct [ZoneSettingOpportunisticEncryptionGetResponseEnvelope] +type zoneSettingOpportunisticEncryptionGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOpportunisticEncryptionGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOpportunisticEncryptionGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingOpportunisticEncryptionGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingOpportunisticEncryptionGetResponseEnvelopeErrorsJSON contains the +// JSON metadata for the struct +// [ZoneSettingOpportunisticEncryptionGetResponseEnvelopeErrors] +type zoneSettingOpportunisticEncryptionGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOpportunisticEncryptionGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOpportunisticEncryptionGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingOpportunisticEncryptionGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingOpportunisticEncryptionGetResponseEnvelopeMessagesJSON contains the +// JSON metadata for the struct +// [ZoneSettingOpportunisticEncryptionGetResponseEnvelopeMessages] +type zoneSettingOpportunisticEncryptionGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOpportunisticEncryptionGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/zonesettingopportunisticencryption_test.go b/zonesettingopportunisticencryption_test.go new file mode 100644 index 00000000000..5417b15718d --- /dev/null +++ b/zonesettingopportunisticencryption_test.go @@ -0,0 +1,71 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingOpportunisticEncryptionEdit(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.OpportunisticEncryption.Edit(context.TODO(), cloudflare.ZoneSettingOpportunisticEncryptionEditParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Value: cloudflare.F(cloudflare.ZoneSettingOpportunisticEncryptionEditParamsValueOn), + }) + 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 TestZoneSettingOpportunisticEncryptionGet(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.OpportunisticEncryption.Get(context.TODO(), cloudflare.ZoneSettingOpportunisticEncryptionGetParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/zonesettingopportunisticonion.go b/zonesettingopportunisticonion.go new file mode 100644 index 00000000000..898f0c0170f --- /dev/null +++ b/zonesettingopportunisticonion.go @@ -0,0 +1,326 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingOpportunisticOnionService contains methods and other services that +// help with interacting with the cloudflare API. Note, unlike clients, this +// service does not read variables from the environment automatically. You should +// not instantiate this service directly, and instead use the +// [NewZoneSettingOpportunisticOnionService] method instead. +type ZoneSettingOpportunisticOnionService struct { + Options []option.RequestOption +} + +// NewZoneSettingOpportunisticOnionService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewZoneSettingOpportunisticOnionService(opts ...option.RequestOption) (r *ZoneSettingOpportunisticOnionService) { + r = &ZoneSettingOpportunisticOnionService{} + r.Options = opts + return +} + +// Add an Alt-Svc header to all legitimate requests from Tor, allowing the +// connection to use our onion services instead of exit nodes. +func (r *ZoneSettingOpportunisticOnionService) Edit(ctx context.Context, params ZoneSettingOpportunisticOnionEditParams, opts ...option.RequestOption) (res *ZoneSettingOpportunisticOnionEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingOpportunisticOnionEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/opportunistic_onion", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Add an Alt-Svc header to all legitimate requests from Tor, allowing the +// connection to use our onion services instead of exit nodes. +func (r *ZoneSettingOpportunisticOnionService) Get(ctx context.Context, query ZoneSettingOpportunisticOnionGetParams, opts ...option.RequestOption) (res *ZoneSettingOpportunisticOnionGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingOpportunisticOnionGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/opportunistic_onion", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Add an Alt-Svc header to all legitimate requests from Tor, allowing the +// connection to use our onion services instead of exit nodes. +type ZoneSettingOpportunisticOnionEditResponse struct { + // ID of the zone setting. + ID ZoneSettingOpportunisticOnionEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingOpportunisticOnionEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingOpportunisticOnionEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingOpportunisticOnionEditResponseJSON `json:"-"` +} + +// zoneSettingOpportunisticOnionEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingOpportunisticOnionEditResponse] +type zoneSettingOpportunisticOnionEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOpportunisticOnionEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingOpportunisticOnionEditResponseID string + +const ( + ZoneSettingOpportunisticOnionEditResponseIDOpportunisticOnion ZoneSettingOpportunisticOnionEditResponseID = "opportunistic_onion" +) + +// Current value of the zone setting. +type ZoneSettingOpportunisticOnionEditResponseValue string + +const ( + ZoneSettingOpportunisticOnionEditResponseValueOn ZoneSettingOpportunisticOnionEditResponseValue = "on" + ZoneSettingOpportunisticOnionEditResponseValueOff ZoneSettingOpportunisticOnionEditResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingOpportunisticOnionEditResponseEditable bool + +const ( + ZoneSettingOpportunisticOnionEditResponseEditableTrue ZoneSettingOpportunisticOnionEditResponseEditable = true + ZoneSettingOpportunisticOnionEditResponseEditableFalse ZoneSettingOpportunisticOnionEditResponseEditable = false +) + +// Add an Alt-Svc header to all legitimate requests from Tor, allowing the +// connection to use our onion services instead of exit nodes. +type ZoneSettingOpportunisticOnionGetResponse struct { + // ID of the zone setting. + ID ZoneSettingOpportunisticOnionGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingOpportunisticOnionGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingOpportunisticOnionGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingOpportunisticOnionGetResponseJSON `json:"-"` +} + +// zoneSettingOpportunisticOnionGetResponseJSON contains the JSON metadata for the +// struct [ZoneSettingOpportunisticOnionGetResponse] +type zoneSettingOpportunisticOnionGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOpportunisticOnionGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingOpportunisticOnionGetResponseID string + +const ( + ZoneSettingOpportunisticOnionGetResponseIDOpportunisticOnion ZoneSettingOpportunisticOnionGetResponseID = "opportunistic_onion" +) + +// Current value of the zone setting. +type ZoneSettingOpportunisticOnionGetResponseValue string + +const ( + ZoneSettingOpportunisticOnionGetResponseValueOn ZoneSettingOpportunisticOnionGetResponseValue = "on" + ZoneSettingOpportunisticOnionGetResponseValueOff ZoneSettingOpportunisticOnionGetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingOpportunisticOnionGetResponseEditable bool + +const ( + ZoneSettingOpportunisticOnionGetResponseEditableTrue ZoneSettingOpportunisticOnionGetResponseEditable = true + ZoneSettingOpportunisticOnionGetResponseEditableFalse ZoneSettingOpportunisticOnionGetResponseEditable = false +) + +type ZoneSettingOpportunisticOnionEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. Notes: Default value depends on the zone's plan + // level. + Value param.Field[ZoneSettingOpportunisticOnionEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingOpportunisticOnionEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. Notes: Default value depends on the zone's plan +// level. +type ZoneSettingOpportunisticOnionEditParamsValue string + +const ( + ZoneSettingOpportunisticOnionEditParamsValueOn ZoneSettingOpportunisticOnionEditParamsValue = "on" + ZoneSettingOpportunisticOnionEditParamsValueOff ZoneSettingOpportunisticOnionEditParamsValue = "off" +) + +type ZoneSettingOpportunisticOnionEditResponseEnvelope struct { + Errors []ZoneSettingOpportunisticOnionEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingOpportunisticOnionEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Add an Alt-Svc header to all legitimate requests from Tor, allowing the + // connection to use our onion services instead of exit nodes. + Result ZoneSettingOpportunisticOnionEditResponse `json:"result"` + JSON zoneSettingOpportunisticOnionEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingOpportunisticOnionEditResponseEnvelopeJSON contains the JSON metadata +// for the struct [ZoneSettingOpportunisticOnionEditResponseEnvelope] +type zoneSettingOpportunisticOnionEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOpportunisticOnionEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOpportunisticOnionEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingOpportunisticOnionEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingOpportunisticOnionEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct +// [ZoneSettingOpportunisticOnionEditResponseEnvelopeErrors] +type zoneSettingOpportunisticOnionEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOpportunisticOnionEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOpportunisticOnionEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingOpportunisticOnionEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingOpportunisticOnionEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct +// [ZoneSettingOpportunisticOnionEditResponseEnvelopeMessages] +type zoneSettingOpportunisticOnionEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOpportunisticOnionEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOpportunisticOnionGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingOpportunisticOnionGetResponseEnvelope struct { + Errors []ZoneSettingOpportunisticOnionGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingOpportunisticOnionGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Add an Alt-Svc header to all legitimate requests from Tor, allowing the + // connection to use our onion services instead of exit nodes. + Result ZoneSettingOpportunisticOnionGetResponse `json:"result"` + JSON zoneSettingOpportunisticOnionGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingOpportunisticOnionGetResponseEnvelopeJSON contains the JSON metadata +// for the struct [ZoneSettingOpportunisticOnionGetResponseEnvelope] +type zoneSettingOpportunisticOnionGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOpportunisticOnionGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOpportunisticOnionGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingOpportunisticOnionGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingOpportunisticOnionGetResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingOpportunisticOnionGetResponseEnvelopeErrors] +type zoneSettingOpportunisticOnionGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOpportunisticOnionGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOpportunisticOnionGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingOpportunisticOnionGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingOpportunisticOnionGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct +// [ZoneSettingOpportunisticOnionGetResponseEnvelopeMessages] +type zoneSettingOpportunisticOnionGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOpportunisticOnionGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/zonesettingopportunisticonion_test.go b/zonesettingopportunisticonion_test.go new file mode 100644 index 00000000000..d424e78cc2f --- /dev/null +++ b/zonesettingopportunisticonion_test.go @@ -0,0 +1,71 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingOpportunisticOnionEdit(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.OpportunisticOnion.Edit(context.TODO(), cloudflare.ZoneSettingOpportunisticOnionEditParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Value: cloudflare.F(cloudflare.ZoneSettingOpportunisticOnionEditParamsValueOn), + }) + 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 TestZoneSettingOpportunisticOnionGet(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.OpportunisticOnion.Get(context.TODO(), cloudflare.ZoneSettingOpportunisticOnionGetParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/zonesettingorangetoorange.go b/zonesettingorangetoorange.go new file mode 100644 index 00000000000..299765af63f --- /dev/null +++ b/zonesettingorangetoorange.go @@ -0,0 +1,351 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingOrangeToOrangeService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewZoneSettingOrangeToOrangeService] method instead. +type ZoneSettingOrangeToOrangeService struct { + Options []option.RequestOption +} + +// NewZoneSettingOrangeToOrangeService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewZoneSettingOrangeToOrangeService(opts ...option.RequestOption) (r *ZoneSettingOrangeToOrangeService) { + r = &ZoneSettingOrangeToOrangeService{} + r.Options = opts + return +} + +// Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also +// on Cloudflare. +func (r *ZoneSettingOrangeToOrangeService) Edit(ctx context.Context, params ZoneSettingOrangeToOrangeEditParams, opts ...option.RequestOption) (res *ZoneSettingOrangeToOrangeEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingOrangeToOrangeEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/orange_to_orange", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also +// on Cloudflare. +func (r *ZoneSettingOrangeToOrangeService) Get(ctx context.Context, query ZoneSettingOrangeToOrangeGetParams, opts ...option.RequestOption) (res *ZoneSettingOrangeToOrangeGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingOrangeToOrangeGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/orange_to_orange", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also +// on Cloudflare. +type ZoneSettingOrangeToOrangeEditResponse struct { + // ID of the zone setting. + ID ZoneSettingOrangeToOrangeEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingOrangeToOrangeEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingOrangeToOrangeEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingOrangeToOrangeEditResponseJSON `json:"-"` +} + +// zoneSettingOrangeToOrangeEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingOrangeToOrangeEditResponse] +type zoneSettingOrangeToOrangeEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOrangeToOrangeEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingOrangeToOrangeEditResponseID string + +const ( + ZoneSettingOrangeToOrangeEditResponseIDOrangeToOrange ZoneSettingOrangeToOrangeEditResponseID = "orange_to_orange" +) + +// Current value of the zone setting. +type ZoneSettingOrangeToOrangeEditResponseValue string + +const ( + ZoneSettingOrangeToOrangeEditResponseValueOn ZoneSettingOrangeToOrangeEditResponseValue = "on" + ZoneSettingOrangeToOrangeEditResponseValueOff ZoneSettingOrangeToOrangeEditResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingOrangeToOrangeEditResponseEditable bool + +const ( + ZoneSettingOrangeToOrangeEditResponseEditableTrue ZoneSettingOrangeToOrangeEditResponseEditable = true + ZoneSettingOrangeToOrangeEditResponseEditableFalse ZoneSettingOrangeToOrangeEditResponseEditable = false +) + +// Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also +// on Cloudflare. +type ZoneSettingOrangeToOrangeGetResponse struct { + // ID of the zone setting. + ID ZoneSettingOrangeToOrangeGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingOrangeToOrangeGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingOrangeToOrangeGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingOrangeToOrangeGetResponseJSON `json:"-"` +} + +// zoneSettingOrangeToOrangeGetResponseJSON contains the JSON metadata for the +// struct [ZoneSettingOrangeToOrangeGetResponse] +type zoneSettingOrangeToOrangeGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOrangeToOrangeGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingOrangeToOrangeGetResponseID string + +const ( + ZoneSettingOrangeToOrangeGetResponseIDOrangeToOrange ZoneSettingOrangeToOrangeGetResponseID = "orange_to_orange" +) + +// Current value of the zone setting. +type ZoneSettingOrangeToOrangeGetResponseValue string + +const ( + ZoneSettingOrangeToOrangeGetResponseValueOn ZoneSettingOrangeToOrangeGetResponseValue = "on" + ZoneSettingOrangeToOrangeGetResponseValueOff ZoneSettingOrangeToOrangeGetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingOrangeToOrangeGetResponseEditable bool + +const ( + ZoneSettingOrangeToOrangeGetResponseEditableTrue ZoneSettingOrangeToOrangeGetResponseEditable = true + ZoneSettingOrangeToOrangeGetResponseEditableFalse ZoneSettingOrangeToOrangeGetResponseEditable = false +) + +type ZoneSettingOrangeToOrangeEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also + // on Cloudflare. + Value param.Field[ZoneSettingOrangeToOrangeEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingOrangeToOrangeEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also +// on Cloudflare. +type ZoneSettingOrangeToOrangeEditParamsValue struct { + // ID of the zone setting. + ID param.Field[ZoneSettingOrangeToOrangeEditParamsValueID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingOrangeToOrangeEditParamsValueValue] `json:"value,required"` +} + +func (r ZoneSettingOrangeToOrangeEditParamsValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// ID of the zone setting. +type ZoneSettingOrangeToOrangeEditParamsValueID string + +const ( + ZoneSettingOrangeToOrangeEditParamsValueIDOrangeToOrange ZoneSettingOrangeToOrangeEditParamsValueID = "orange_to_orange" +) + +// Current value of the zone setting. +type ZoneSettingOrangeToOrangeEditParamsValueValue string + +const ( + ZoneSettingOrangeToOrangeEditParamsValueValueOn ZoneSettingOrangeToOrangeEditParamsValueValue = "on" + ZoneSettingOrangeToOrangeEditParamsValueValueOff ZoneSettingOrangeToOrangeEditParamsValueValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingOrangeToOrangeEditParamsValueEditable bool + +const ( + ZoneSettingOrangeToOrangeEditParamsValueEditableTrue ZoneSettingOrangeToOrangeEditParamsValueEditable = true + ZoneSettingOrangeToOrangeEditParamsValueEditableFalse ZoneSettingOrangeToOrangeEditParamsValueEditable = false +) + +type ZoneSettingOrangeToOrangeEditResponseEnvelope struct { + Errors []ZoneSettingOrangeToOrangeEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingOrangeToOrangeEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also + // on Cloudflare. + Result ZoneSettingOrangeToOrangeEditResponse `json:"result"` + JSON zoneSettingOrangeToOrangeEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingOrangeToOrangeEditResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingOrangeToOrangeEditResponseEnvelope] +type zoneSettingOrangeToOrangeEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOrangeToOrangeEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOrangeToOrangeEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingOrangeToOrangeEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingOrangeToOrangeEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingOrangeToOrangeEditResponseEnvelopeErrors] +type zoneSettingOrangeToOrangeEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOrangeToOrangeEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOrangeToOrangeEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingOrangeToOrangeEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingOrangeToOrangeEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingOrangeToOrangeEditResponseEnvelopeMessages] +type zoneSettingOrangeToOrangeEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOrangeToOrangeEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOrangeToOrangeGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingOrangeToOrangeGetResponseEnvelope struct { + Errors []ZoneSettingOrangeToOrangeGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingOrangeToOrangeGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also + // on Cloudflare. + Result ZoneSettingOrangeToOrangeGetResponse `json:"result"` + JSON zoneSettingOrangeToOrangeGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingOrangeToOrangeGetResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingOrangeToOrangeGetResponseEnvelope] +type zoneSettingOrangeToOrangeGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOrangeToOrangeGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOrangeToOrangeGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingOrangeToOrangeGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingOrangeToOrangeGetResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingOrangeToOrangeGetResponseEnvelopeErrors] +type zoneSettingOrangeToOrangeGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOrangeToOrangeGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOrangeToOrangeGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingOrangeToOrangeGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingOrangeToOrangeGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingOrangeToOrangeGetResponseEnvelopeMessages] +type zoneSettingOrangeToOrangeGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOrangeToOrangeGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/zonesettingorangetoorange_test.go b/zonesettingorangetoorange_test.go new file mode 100644 index 00000000000..bfcf6870f35 --- /dev/null +++ b/zonesettingorangetoorange_test.go @@ -0,0 +1,74 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingOrangeToOrangeEditWithOptionalParams(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.OrangeToOrange.Edit(context.TODO(), cloudflare.ZoneSettingOrangeToOrangeEditParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Value: cloudflare.F(cloudflare.ZoneSettingOrangeToOrangeEditParamsValue{ + ID: cloudflare.F(cloudflare.ZoneSettingOrangeToOrangeEditParamsValueIDOrangeToOrange), + Value: cloudflare.F(cloudflare.ZoneSettingOrangeToOrangeEditParamsValueValueOn), + }), + }) + 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 TestZoneSettingOrangeToOrangeGet(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.OrangeToOrange.Get(context.TODO(), cloudflare.ZoneSettingOrangeToOrangeGetParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/zonesettingoriginerrorpagepassthru.go b/zonesettingoriginerrorpagepassthru.go new file mode 100644 index 00000000000..76f99452109 --- /dev/null +++ b/zonesettingoriginerrorpagepassthru.go @@ -0,0 +1,332 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingOriginErrorPagePassThruService contains methods and other services +// that help with interacting with the cloudflare API. Note, unlike clients, this +// service does not read variables from the environment automatically. You should +// not instantiate this service directly, and instead use the +// [NewZoneSettingOriginErrorPagePassThruService] method instead. +type ZoneSettingOriginErrorPagePassThruService struct { + Options []option.RequestOption +} + +// NewZoneSettingOriginErrorPagePassThruService generates a new service that +// applies the given options to each request. These options are applied after the +// parent client's options (if there is one), and before any request-specific +// options. +func NewZoneSettingOriginErrorPagePassThruService(opts ...option.RequestOption) (r *ZoneSettingOriginErrorPagePassThruService) { + r = &ZoneSettingOriginErrorPagePassThruService{} + r.Options = opts + return +} + +// Cloudflare will proxy customer error pages on any 502,504 errors on origin +// server instead of showing a default Cloudflare error page. This does not apply +// to 522 errors and is limited to Enterprise Zones. +func (r *ZoneSettingOriginErrorPagePassThruService) Edit(ctx context.Context, params ZoneSettingOriginErrorPagePassThruEditParams, opts ...option.RequestOption) (res *ZoneSettingOriginErrorPagePassThruEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingOriginErrorPagePassThruEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/origin_error_page_pass_thru", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Cloudflare will proxy customer error pages on any 502,504 errors on origin +// server instead of showing a default Cloudflare error page. This does not apply +// to 522 errors and is limited to Enterprise Zones. +func (r *ZoneSettingOriginErrorPagePassThruService) Get(ctx context.Context, query ZoneSettingOriginErrorPagePassThruGetParams, opts ...option.RequestOption) (res *ZoneSettingOriginErrorPagePassThruGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingOriginErrorPagePassThruGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/origin_error_page_pass_thru", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Cloudflare will proxy customer error pages on any 502,504 errors on origin +// server instead of showing a default Cloudflare error page. This does not apply +// to 522 errors and is limited to Enterprise Zones. +type ZoneSettingOriginErrorPagePassThruEditResponse struct { + // ID of the zone setting. + ID ZoneSettingOriginErrorPagePassThruEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingOriginErrorPagePassThruEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingOriginErrorPagePassThruEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingOriginErrorPagePassThruEditResponseJSON `json:"-"` +} + +// zoneSettingOriginErrorPagePassThruEditResponseJSON contains the JSON metadata +// for the struct [ZoneSettingOriginErrorPagePassThruEditResponse] +type zoneSettingOriginErrorPagePassThruEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOriginErrorPagePassThruEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingOriginErrorPagePassThruEditResponseID string + +const ( + ZoneSettingOriginErrorPagePassThruEditResponseIDOriginErrorPagePassThru ZoneSettingOriginErrorPagePassThruEditResponseID = "origin_error_page_pass_thru" +) + +// Current value of the zone setting. +type ZoneSettingOriginErrorPagePassThruEditResponseValue string + +const ( + ZoneSettingOriginErrorPagePassThruEditResponseValueOn ZoneSettingOriginErrorPagePassThruEditResponseValue = "on" + ZoneSettingOriginErrorPagePassThruEditResponseValueOff ZoneSettingOriginErrorPagePassThruEditResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingOriginErrorPagePassThruEditResponseEditable bool + +const ( + ZoneSettingOriginErrorPagePassThruEditResponseEditableTrue ZoneSettingOriginErrorPagePassThruEditResponseEditable = true + ZoneSettingOriginErrorPagePassThruEditResponseEditableFalse ZoneSettingOriginErrorPagePassThruEditResponseEditable = false +) + +// Cloudflare will proxy customer error pages on any 502,504 errors on origin +// server instead of showing a default Cloudflare error page. This does not apply +// to 522 errors and is limited to Enterprise Zones. +type ZoneSettingOriginErrorPagePassThruGetResponse struct { + // ID of the zone setting. + ID ZoneSettingOriginErrorPagePassThruGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingOriginErrorPagePassThruGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingOriginErrorPagePassThruGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingOriginErrorPagePassThruGetResponseJSON `json:"-"` +} + +// zoneSettingOriginErrorPagePassThruGetResponseJSON contains the JSON metadata for +// the struct [ZoneSettingOriginErrorPagePassThruGetResponse] +type zoneSettingOriginErrorPagePassThruGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOriginErrorPagePassThruGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingOriginErrorPagePassThruGetResponseID string + +const ( + ZoneSettingOriginErrorPagePassThruGetResponseIDOriginErrorPagePassThru ZoneSettingOriginErrorPagePassThruGetResponseID = "origin_error_page_pass_thru" +) + +// Current value of the zone setting. +type ZoneSettingOriginErrorPagePassThruGetResponseValue string + +const ( + ZoneSettingOriginErrorPagePassThruGetResponseValueOn ZoneSettingOriginErrorPagePassThruGetResponseValue = "on" + ZoneSettingOriginErrorPagePassThruGetResponseValueOff ZoneSettingOriginErrorPagePassThruGetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingOriginErrorPagePassThruGetResponseEditable bool + +const ( + ZoneSettingOriginErrorPagePassThruGetResponseEditableTrue ZoneSettingOriginErrorPagePassThruGetResponseEditable = true + ZoneSettingOriginErrorPagePassThruGetResponseEditableFalse ZoneSettingOriginErrorPagePassThruGetResponseEditable = false +) + +type ZoneSettingOriginErrorPagePassThruEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingOriginErrorPagePassThruEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingOriginErrorPagePassThruEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingOriginErrorPagePassThruEditParamsValue string + +const ( + ZoneSettingOriginErrorPagePassThruEditParamsValueOn ZoneSettingOriginErrorPagePassThruEditParamsValue = "on" + ZoneSettingOriginErrorPagePassThruEditParamsValueOff ZoneSettingOriginErrorPagePassThruEditParamsValue = "off" +) + +type ZoneSettingOriginErrorPagePassThruEditResponseEnvelope struct { + Errors []ZoneSettingOriginErrorPagePassThruEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingOriginErrorPagePassThruEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Cloudflare will proxy customer error pages on any 502,504 errors on origin + // server instead of showing a default Cloudflare error page. This does not apply + // to 522 errors and is limited to Enterprise Zones. + Result ZoneSettingOriginErrorPagePassThruEditResponse `json:"result"` + JSON zoneSettingOriginErrorPagePassThruEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingOriginErrorPagePassThruEditResponseEnvelopeJSON contains the JSON +// metadata for the struct [ZoneSettingOriginErrorPagePassThruEditResponseEnvelope] +type zoneSettingOriginErrorPagePassThruEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOriginErrorPagePassThruEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOriginErrorPagePassThruEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingOriginErrorPagePassThruEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingOriginErrorPagePassThruEditResponseEnvelopeErrorsJSON contains the +// JSON metadata for the struct +// [ZoneSettingOriginErrorPagePassThruEditResponseEnvelopeErrors] +type zoneSettingOriginErrorPagePassThruEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOriginErrorPagePassThruEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOriginErrorPagePassThruEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingOriginErrorPagePassThruEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingOriginErrorPagePassThruEditResponseEnvelopeMessagesJSON contains the +// JSON metadata for the struct +// [ZoneSettingOriginErrorPagePassThruEditResponseEnvelopeMessages] +type zoneSettingOriginErrorPagePassThruEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOriginErrorPagePassThruEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOriginErrorPagePassThruGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingOriginErrorPagePassThruGetResponseEnvelope struct { + Errors []ZoneSettingOriginErrorPagePassThruGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingOriginErrorPagePassThruGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Cloudflare will proxy customer error pages on any 502,504 errors on origin + // server instead of showing a default Cloudflare error page. This does not apply + // to 522 errors and is limited to Enterprise Zones. + Result ZoneSettingOriginErrorPagePassThruGetResponse `json:"result"` + JSON zoneSettingOriginErrorPagePassThruGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingOriginErrorPagePassThruGetResponseEnvelopeJSON contains the JSON +// metadata for the struct [ZoneSettingOriginErrorPagePassThruGetResponseEnvelope] +type zoneSettingOriginErrorPagePassThruGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOriginErrorPagePassThruGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOriginErrorPagePassThruGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingOriginErrorPagePassThruGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingOriginErrorPagePassThruGetResponseEnvelopeErrorsJSON contains the +// JSON metadata for the struct +// [ZoneSettingOriginErrorPagePassThruGetResponseEnvelopeErrors] +type zoneSettingOriginErrorPagePassThruGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOriginErrorPagePassThruGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOriginErrorPagePassThruGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingOriginErrorPagePassThruGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingOriginErrorPagePassThruGetResponseEnvelopeMessagesJSON contains the +// JSON metadata for the struct +// [ZoneSettingOriginErrorPagePassThruGetResponseEnvelopeMessages] +type zoneSettingOriginErrorPagePassThruGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOriginErrorPagePassThruGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/zonesettingoriginerrorpagepassthru_test.go b/zonesettingoriginerrorpagepassthru_test.go new file mode 100644 index 00000000000..fbf57f1c35e --- /dev/null +++ b/zonesettingoriginerrorpagepassthru_test.go @@ -0,0 +1,71 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingOriginErrorPagePassThruEdit(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.OriginErrorPagePassThru.Edit(context.TODO(), cloudflare.ZoneSettingOriginErrorPagePassThruEditParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Value: cloudflare.F(cloudflare.ZoneSettingOriginErrorPagePassThruEditParamsValueOn), + }) + 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 TestZoneSettingOriginErrorPagePassThruGet(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.OriginErrorPagePassThru.Get(context.TODO(), cloudflare.ZoneSettingOriginErrorPagePassThruGetParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/zonesettingoriginmaxhttpversion.go b/zonesettingoriginmaxhttpversion.go new file mode 100644 index 00000000000..ba865a791b5 --- /dev/null +++ b/zonesettingoriginmaxhttpversion.go @@ -0,0 +1,337 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingOriginMaxHTTPVersionService contains methods and other services that +// help with interacting with the cloudflare API. Note, unlike clients, this +// service does not read variables from the environment automatically. You should +// not instantiate this service directly, and instead use the +// [NewZoneSettingOriginMaxHTTPVersionService] method instead. +type ZoneSettingOriginMaxHTTPVersionService struct { + Options []option.RequestOption +} + +// NewZoneSettingOriginMaxHTTPVersionService generates a new service that applies +// the given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewZoneSettingOriginMaxHTTPVersionService(opts ...option.RequestOption) (r *ZoneSettingOriginMaxHTTPVersionService) { + r = &ZoneSettingOriginMaxHTTPVersionService{} + r.Options = opts + return +} + +// Origin Max HTTP Setting Version sets the highest HTTP version Cloudflare will +// attempt to use with your origin. This setting allows Cloudflare to make HTTP/2 +// requests to your origin. (Refer to +// [Enable HTTP/2 to Origin](https://developers.cloudflare.com/cache/how-to/enable-http2-to-origin/), +// for more information.). The default value is "2" for all plan types except ENT +// where it is "1" +func (r *ZoneSettingOriginMaxHTTPVersionService) Edit(ctx context.Context, params ZoneSettingOriginMaxHTTPVersionEditParams, opts ...option.RequestOption) (res *ZoneSettingOriginMaxHTTPVersionEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingOriginMaxHTTPVersionEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/origin_max_http_version", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Origin Max HTTP Setting Version sets the highest HTTP version Cloudflare will +// attempt to use with your origin. This setting allows Cloudflare to make HTTP/2 +// requests to your origin. (Refer to +// [Enable HTTP/2 to Origin](https://developers.cloudflare.com/cache/how-to/enable-http2-to-origin/), +// for more information.). The default value is "2" for all plan types except ENT +// where it is "1" +func (r *ZoneSettingOriginMaxHTTPVersionService) Get(ctx context.Context, query ZoneSettingOriginMaxHTTPVersionGetParams, opts ...option.RequestOption) (res *ZoneSettingOriginMaxHTTPVersionGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingOriginMaxHTTPVersionGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/origin_max_http_version", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Origin Max HTTP Setting Version sets the highest HTTP version Cloudflare will +// attempt to use with your origin. This setting allows Cloudflare to make HTTP/2 +// requests to your origin. (Refer to +// [Enable HTTP/2 to Origin](https://developers.cloudflare.com/cache/how-to/enable-http2-to-origin/), +// for more information.). The default value is "2" for all plan types except ENT +// where it is "1" +type ZoneSettingOriginMaxHTTPVersionEditResponse struct { + // Value of the zone setting. + ID ZoneSettingOriginMaxHTTPVersionEditResponseID `json:"id,required"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,required,nullable" format:"date-time"` + // Value of the Origin Max HTTP Version Setting. + Value ZoneSettingOriginMaxHTTPVersionEditResponseValue `json:"value,required"` + JSON zoneSettingOriginMaxHTTPVersionEditResponseJSON `json:"-"` +} + +// zoneSettingOriginMaxHTTPVersionEditResponseJSON contains the JSON metadata for +// the struct [ZoneSettingOriginMaxHTTPVersionEditResponse] +type zoneSettingOriginMaxHTTPVersionEditResponseJSON struct { + ID apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOriginMaxHTTPVersionEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Value of the zone setting. +type ZoneSettingOriginMaxHTTPVersionEditResponseID string + +const ( + ZoneSettingOriginMaxHTTPVersionEditResponseIDOriginMaxHTTPVersion ZoneSettingOriginMaxHTTPVersionEditResponseID = "origin_max_http_version" +) + +// Value of the Origin Max HTTP Version Setting. +type ZoneSettingOriginMaxHTTPVersionEditResponseValue string + +const ( + ZoneSettingOriginMaxHTTPVersionEditResponseValue2 ZoneSettingOriginMaxHTTPVersionEditResponseValue = "2" + ZoneSettingOriginMaxHTTPVersionEditResponseValue1 ZoneSettingOriginMaxHTTPVersionEditResponseValue = "1" +) + +// Origin Max HTTP Setting Version sets the highest HTTP version Cloudflare will +// attempt to use with your origin. This setting allows Cloudflare to make HTTP/2 +// requests to your origin. (Refer to +// [Enable HTTP/2 to Origin](https://developers.cloudflare.com/cache/how-to/enable-http2-to-origin/), +// for more information.). The default value is "2" for all plan types except ENT +// where it is "1" +type ZoneSettingOriginMaxHTTPVersionGetResponse struct { + // Value of the zone setting. + ID ZoneSettingOriginMaxHTTPVersionGetResponseID `json:"id,required"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,required,nullable" format:"date-time"` + // Value of the Origin Max HTTP Version Setting. + Value ZoneSettingOriginMaxHTTPVersionGetResponseValue `json:"value,required"` + JSON zoneSettingOriginMaxHTTPVersionGetResponseJSON `json:"-"` +} + +// zoneSettingOriginMaxHTTPVersionGetResponseJSON contains the JSON metadata for +// the struct [ZoneSettingOriginMaxHTTPVersionGetResponse] +type zoneSettingOriginMaxHTTPVersionGetResponseJSON struct { + ID apijson.Field + ModifiedOn apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOriginMaxHTTPVersionGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Value of the zone setting. +type ZoneSettingOriginMaxHTTPVersionGetResponseID string + +const ( + ZoneSettingOriginMaxHTTPVersionGetResponseIDOriginMaxHTTPVersion ZoneSettingOriginMaxHTTPVersionGetResponseID = "origin_max_http_version" +) + +// Value of the Origin Max HTTP Version Setting. +type ZoneSettingOriginMaxHTTPVersionGetResponseValue string + +const ( + ZoneSettingOriginMaxHTTPVersionGetResponseValue2 ZoneSettingOriginMaxHTTPVersionGetResponseValue = "2" + ZoneSettingOriginMaxHTTPVersionGetResponseValue1 ZoneSettingOriginMaxHTTPVersionGetResponseValue = "1" +) + +type ZoneSettingOriginMaxHTTPVersionEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the Origin Max HTTP Version Setting. + Value param.Field[ZoneSettingOriginMaxHTTPVersionEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingOriginMaxHTTPVersionEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the Origin Max HTTP Version Setting. +type ZoneSettingOriginMaxHTTPVersionEditParamsValue string + +const ( + ZoneSettingOriginMaxHTTPVersionEditParamsValue2 ZoneSettingOriginMaxHTTPVersionEditParamsValue = "2" + ZoneSettingOriginMaxHTTPVersionEditParamsValue1 ZoneSettingOriginMaxHTTPVersionEditParamsValue = "1" +) + +type ZoneSettingOriginMaxHTTPVersionEditResponseEnvelope struct { + Errors []ZoneSettingOriginMaxHTTPVersionEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingOriginMaxHTTPVersionEditResponseEnvelopeMessages `json:"messages,required"` + // Origin Max HTTP Setting Version sets the highest HTTP version Cloudflare will + // attempt to use with your origin. This setting allows Cloudflare to make HTTP/2 + // requests to your origin. (Refer to + // [Enable HTTP/2 to Origin](https://developers.cloudflare.com/cache/how-to/enable-http2-to-origin/), + // for more information.). The default value is "2" for all plan types except ENT + // where it is "1" + Result ZoneSettingOriginMaxHTTPVersionEditResponse `json:"result,required"` + // Whether the API call was successful + Success ZoneSettingOriginMaxHTTPVersionEditResponseEnvelopeSuccess `json:"success,required"` + JSON zoneSettingOriginMaxHTTPVersionEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingOriginMaxHTTPVersionEditResponseEnvelopeJSON contains the JSON +// metadata for the struct [ZoneSettingOriginMaxHTTPVersionEditResponseEnvelope] +type zoneSettingOriginMaxHTTPVersionEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOriginMaxHTTPVersionEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOriginMaxHTTPVersionEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingOriginMaxHTTPVersionEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingOriginMaxHTTPVersionEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct +// [ZoneSettingOriginMaxHTTPVersionEditResponseEnvelopeErrors] +type zoneSettingOriginMaxHTTPVersionEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOriginMaxHTTPVersionEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOriginMaxHTTPVersionEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingOriginMaxHTTPVersionEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingOriginMaxHTTPVersionEditResponseEnvelopeMessagesJSON contains the +// JSON metadata for the struct +// [ZoneSettingOriginMaxHTTPVersionEditResponseEnvelopeMessages] +type zoneSettingOriginMaxHTTPVersionEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOriginMaxHTTPVersionEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSettingOriginMaxHTTPVersionEditResponseEnvelopeSuccess bool + +const ( + ZoneSettingOriginMaxHTTPVersionEditResponseEnvelopeSuccessTrue ZoneSettingOriginMaxHTTPVersionEditResponseEnvelopeSuccess = true +) + +type ZoneSettingOriginMaxHTTPVersionGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingOriginMaxHTTPVersionGetResponseEnvelope struct { + Errors []ZoneSettingOriginMaxHTTPVersionGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingOriginMaxHTTPVersionGetResponseEnvelopeMessages `json:"messages,required"` + // Origin Max HTTP Setting Version sets the highest HTTP version Cloudflare will + // attempt to use with your origin. This setting allows Cloudflare to make HTTP/2 + // requests to your origin. (Refer to + // [Enable HTTP/2 to Origin](https://developers.cloudflare.com/cache/how-to/enable-http2-to-origin/), + // for more information.). The default value is "2" for all plan types except ENT + // where it is "1" + Result ZoneSettingOriginMaxHTTPVersionGetResponse `json:"result,required"` + // Whether the API call was successful + Success ZoneSettingOriginMaxHTTPVersionGetResponseEnvelopeSuccess `json:"success,required"` + JSON zoneSettingOriginMaxHTTPVersionGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingOriginMaxHTTPVersionGetResponseEnvelopeJSON contains the JSON +// metadata for the struct [ZoneSettingOriginMaxHTTPVersionGetResponseEnvelope] +type zoneSettingOriginMaxHTTPVersionGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOriginMaxHTTPVersionGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOriginMaxHTTPVersionGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingOriginMaxHTTPVersionGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingOriginMaxHTTPVersionGetResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct +// [ZoneSettingOriginMaxHTTPVersionGetResponseEnvelopeErrors] +type zoneSettingOriginMaxHTTPVersionGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOriginMaxHTTPVersionGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingOriginMaxHTTPVersionGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingOriginMaxHTTPVersionGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingOriginMaxHTTPVersionGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct +// [ZoneSettingOriginMaxHTTPVersionGetResponseEnvelopeMessages] +type zoneSettingOriginMaxHTTPVersionGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingOriginMaxHTTPVersionGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneSettingOriginMaxHTTPVersionGetResponseEnvelopeSuccess bool + +const ( + ZoneSettingOriginMaxHTTPVersionGetResponseEnvelopeSuccessTrue ZoneSettingOriginMaxHTTPVersionGetResponseEnvelopeSuccess = true +) diff --git a/settingssl_test.go b/zonesettingoriginmaxhttpversion_test.go similarity index 82% rename from settingssl_test.go rename to zonesettingoriginmaxhttpversion_test.go index 1099c86eeb8..5176502f2a0 100644 --- a/settingssl_test.go +++ b/zonesettingoriginmaxhttpversion_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingSSLEdit(t *testing.T) { +func TestZoneSettingOriginMaxHTTPVersionEdit(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 { @@ -29,9 +29,9 @@ func TestSettingSSLEdit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.SSL.Edit(context.TODO(), cloudflare.SettingSSLEditParams{ + _, err := client.Zones.Settings.OriginMaxHTTPVersion.Edit(context.TODO(), cloudflare.ZoneSettingOriginMaxHTTPVersionEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingSSLEditParamsValueOff), + Value: cloudflare.F(cloudflare.ZoneSettingOriginMaxHTTPVersionEditParamsValue2), }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +42,7 @@ func TestSettingSSLEdit(t *testing.T) { } } -func TestSettingSSLGet(t *testing.T) { +func TestZoneSettingOriginMaxHTTPVersionGet(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 { @@ -58,7 +58,7 @@ func TestSettingSSLGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.SSL.Get(context.TODO(), cloudflare.SettingSSLGetParams{ + _, err := client.Zones.Settings.OriginMaxHTTPVersion.Get(context.TODO(), cloudflare.ZoneSettingOriginMaxHTTPVersionGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingpolish.go b/zonesettingpolish.go new file mode 100644 index 00000000000..b3865d9bee7 --- /dev/null +++ b/zonesettingpolish.go @@ -0,0 +1,380 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingPolishService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewZoneSettingPolishService] method +// instead. +type ZoneSettingPolishService struct { + Options []option.RequestOption +} + +// NewZoneSettingPolishService generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewZoneSettingPolishService(opts ...option.RequestOption) (r *ZoneSettingPolishService) { + r = &ZoneSettingPolishService{} + r.Options = opts + return +} + +// Automatically optimize image loading for website visitors on mobile devices. +// Refer to our [blog post](http://blog.cloudflare.com/polish-solving-mobile-speed) +// for more information. +func (r *ZoneSettingPolishService) Edit(ctx context.Context, params ZoneSettingPolishEditParams, opts ...option.RequestOption) (res *ZoneSettingPolishEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingPolishEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/polish", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Automatically optimize image loading for website visitors on mobile devices. +// Refer to our [blog post](http://blog.cloudflare.com/polish-solving-mobile-speed) +// for more information. +func (r *ZoneSettingPolishService) Get(ctx context.Context, query ZoneSettingPolishGetParams, opts ...option.RequestOption) (res *ZoneSettingPolishGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingPolishGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/polish", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Removes metadata and compresses your images for faster page load times. Basic +// (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual +// quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster +// image loading. Larger JPEGs are converted to progressive images, loading a +// lower-resolution image first and ending in a higher-resolution version. Not +// recommended for hi-res photography sites. +type ZoneSettingPolishEditResponse struct { + // ID of the zone setting. + ID ZoneSettingPolishEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingPolishEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingPolishEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingPolishEditResponseJSON `json:"-"` +} + +// zoneSettingPolishEditResponseJSON contains the JSON metadata for the struct +// [ZoneSettingPolishEditResponse] +type zoneSettingPolishEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPolishEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingPolishEditResponseID string + +const ( + ZoneSettingPolishEditResponseIDPolish ZoneSettingPolishEditResponseID = "polish" +) + +// Current value of the zone setting. +type ZoneSettingPolishEditResponseValue string + +const ( + ZoneSettingPolishEditResponseValueOff ZoneSettingPolishEditResponseValue = "off" + ZoneSettingPolishEditResponseValueLossless ZoneSettingPolishEditResponseValue = "lossless" + ZoneSettingPolishEditResponseValueLossy ZoneSettingPolishEditResponseValue = "lossy" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingPolishEditResponseEditable bool + +const ( + ZoneSettingPolishEditResponseEditableTrue ZoneSettingPolishEditResponseEditable = true + ZoneSettingPolishEditResponseEditableFalse ZoneSettingPolishEditResponseEditable = false +) + +// Removes metadata and compresses your images for faster page load times. Basic +// (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual +// quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster +// image loading. Larger JPEGs are converted to progressive images, loading a +// lower-resolution image first and ending in a higher-resolution version. Not +// recommended for hi-res photography sites. +type ZoneSettingPolishGetResponse struct { + // ID of the zone setting. + ID ZoneSettingPolishGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingPolishGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingPolishGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingPolishGetResponseJSON `json:"-"` +} + +// zoneSettingPolishGetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingPolishGetResponse] +type zoneSettingPolishGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPolishGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingPolishGetResponseID string + +const ( + ZoneSettingPolishGetResponseIDPolish ZoneSettingPolishGetResponseID = "polish" +) + +// Current value of the zone setting. +type ZoneSettingPolishGetResponseValue string + +const ( + ZoneSettingPolishGetResponseValueOff ZoneSettingPolishGetResponseValue = "off" + ZoneSettingPolishGetResponseValueLossless ZoneSettingPolishGetResponseValue = "lossless" + ZoneSettingPolishGetResponseValueLossy ZoneSettingPolishGetResponseValue = "lossy" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingPolishGetResponseEditable bool + +const ( + ZoneSettingPolishGetResponseEditableTrue ZoneSettingPolishGetResponseEditable = true + ZoneSettingPolishGetResponseEditableFalse ZoneSettingPolishGetResponseEditable = false +) + +type ZoneSettingPolishEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Removes metadata and compresses your images for faster page load times. Basic + // (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual + // quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster + // image loading. Larger JPEGs are converted to progressive images, loading a + // lower-resolution image first and ending in a higher-resolution version. Not + // recommended for hi-res photography sites. + Value param.Field[ZoneSettingPolishEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingPolishEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Removes metadata and compresses your images for faster page load times. Basic +// (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual +// quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster +// image loading. Larger JPEGs are converted to progressive images, loading a +// lower-resolution image first and ending in a higher-resolution version. Not +// recommended for hi-res photography sites. +type ZoneSettingPolishEditParamsValue struct { + // ID of the zone setting. + ID param.Field[ZoneSettingPolishEditParamsValueID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[ZoneSettingPolishEditParamsValueValue] `json:"value,required"` +} + +func (r ZoneSettingPolishEditParamsValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// ID of the zone setting. +type ZoneSettingPolishEditParamsValueID string + +const ( + ZoneSettingPolishEditParamsValueIDPolish ZoneSettingPolishEditParamsValueID = "polish" +) + +// Current value of the zone setting. +type ZoneSettingPolishEditParamsValueValue string + +const ( + ZoneSettingPolishEditParamsValueValueOff ZoneSettingPolishEditParamsValueValue = "off" + ZoneSettingPolishEditParamsValueValueLossless ZoneSettingPolishEditParamsValueValue = "lossless" + ZoneSettingPolishEditParamsValueValueLossy ZoneSettingPolishEditParamsValueValue = "lossy" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingPolishEditParamsValueEditable bool + +const ( + ZoneSettingPolishEditParamsValueEditableTrue ZoneSettingPolishEditParamsValueEditable = true + ZoneSettingPolishEditParamsValueEditableFalse ZoneSettingPolishEditParamsValueEditable = false +) + +type ZoneSettingPolishEditResponseEnvelope struct { + Errors []ZoneSettingPolishEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingPolishEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Removes metadata and compresses your images for faster page load times. Basic + // (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual + // quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster + // image loading. Larger JPEGs are converted to progressive images, loading a + // lower-resolution image first and ending in a higher-resolution version. Not + // recommended for hi-res photography sites. + Result ZoneSettingPolishEditResponse `json:"result"` + JSON zoneSettingPolishEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingPolishEditResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingPolishEditResponseEnvelope] +type zoneSettingPolishEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPolishEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingPolishEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingPolishEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingPolishEditResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [ZoneSettingPolishEditResponseEnvelopeErrors] +type zoneSettingPolishEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPolishEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingPolishEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingPolishEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingPolishEditResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingPolishEditResponseEnvelopeMessages] +type zoneSettingPolishEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPolishEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingPolishGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingPolishGetResponseEnvelope struct { + Errors []ZoneSettingPolishGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingPolishGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Removes metadata and compresses your images for faster page load times. Basic + // (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual + // quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster + // image loading. Larger JPEGs are converted to progressive images, loading a + // lower-resolution image first and ending in a higher-resolution version. Not + // recommended for hi-res photography sites. + Result ZoneSettingPolishGetResponse `json:"result"` + JSON zoneSettingPolishGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingPolishGetResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingPolishGetResponseEnvelope] +type zoneSettingPolishGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPolishGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingPolishGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingPolishGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingPolishGetResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [ZoneSettingPolishGetResponseEnvelopeErrors] +type zoneSettingPolishGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPolishGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingPolishGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingPolishGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingPolishGetResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingPolishGetResponseEnvelopeMessages] +type zoneSettingPolishGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPolishGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingpolish_test.go b/zonesettingpolish_test.go similarity index 79% rename from settingpolish_test.go rename to zonesettingpolish_test.go index e022ee5d251..f94ada66c79 100644 --- a/settingpolish_test.go +++ b/zonesettingpolish_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingPolishEditWithOptionalParams(t *testing.T) { +func TestZoneSettingPolishEditWithOptionalParams(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 { @@ -29,11 +29,11 @@ func TestSettingPolishEditWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.Polish.Edit(context.TODO(), cloudflare.SettingPolishEditParams{ + _, err := client.Zones.Settings.Polish.Edit(context.TODO(), cloudflare.ZoneSettingPolishEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingPolishEditParamsValue{ - ID: cloudflare.F(cloudflare.SettingPolishEditParamsValueIDPolish), - Value: cloudflare.F(cloudflare.SettingPolishEditParamsValueValueOff), + Value: cloudflare.F(cloudflare.ZoneSettingPolishEditParamsValue{ + ID: cloudflare.F(cloudflare.ZoneSettingPolishEditParamsValueIDPolish), + Value: cloudflare.F(cloudflare.ZoneSettingPolishEditParamsValueValueOff), }), }) if err != nil { @@ -45,7 +45,7 @@ func TestSettingPolishEditWithOptionalParams(t *testing.T) { } } -func TestSettingPolishGet(t *testing.T) { +func TestZoneSettingPolishGet(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 { @@ -61,7 +61,7 @@ func TestSettingPolishGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.Polish.Get(context.TODO(), cloudflare.SettingPolishGetParams{ + _, err := client.Zones.Settings.Polish.Get(context.TODO(), cloudflare.ZoneSettingPolishGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingprefetchpreload.go b/zonesettingprefetchpreload.go new file mode 100644 index 00000000000..c45f5283da6 --- /dev/null +++ b/zonesettingprefetchpreload.go @@ -0,0 +1,321 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingPrefetchPreloadService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewZoneSettingPrefetchPreloadService] method instead. +type ZoneSettingPrefetchPreloadService struct { + Options []option.RequestOption +} + +// NewZoneSettingPrefetchPreloadService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewZoneSettingPrefetchPreloadService(opts ...option.RequestOption) (r *ZoneSettingPrefetchPreloadService) { + r = &ZoneSettingPrefetchPreloadService{} + r.Options = opts + return +} + +// Cloudflare will prefetch any URLs that are included in the response headers. +// This is limited to Enterprise Zones. +func (r *ZoneSettingPrefetchPreloadService) Edit(ctx context.Context, params ZoneSettingPrefetchPreloadEditParams, opts ...option.RequestOption) (res *ZoneSettingPrefetchPreloadEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingPrefetchPreloadEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/prefetch_preload", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Cloudflare will prefetch any URLs that are included in the response headers. +// This is limited to Enterprise Zones. +func (r *ZoneSettingPrefetchPreloadService) Get(ctx context.Context, query ZoneSettingPrefetchPreloadGetParams, opts ...option.RequestOption) (res *ZoneSettingPrefetchPreloadGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingPrefetchPreloadGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/prefetch_preload", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Cloudflare will prefetch any URLs that are included in the response headers. +// This is limited to Enterprise Zones. +type ZoneSettingPrefetchPreloadEditResponse struct { + // ID of the zone setting. + ID ZoneSettingPrefetchPreloadEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingPrefetchPreloadEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingPrefetchPreloadEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingPrefetchPreloadEditResponseJSON `json:"-"` +} + +// zoneSettingPrefetchPreloadEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingPrefetchPreloadEditResponse] +type zoneSettingPrefetchPreloadEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPrefetchPreloadEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingPrefetchPreloadEditResponseID string + +const ( + ZoneSettingPrefetchPreloadEditResponseIDPrefetchPreload ZoneSettingPrefetchPreloadEditResponseID = "prefetch_preload" +) + +// Current value of the zone setting. +type ZoneSettingPrefetchPreloadEditResponseValue string + +const ( + ZoneSettingPrefetchPreloadEditResponseValueOn ZoneSettingPrefetchPreloadEditResponseValue = "on" + ZoneSettingPrefetchPreloadEditResponseValueOff ZoneSettingPrefetchPreloadEditResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingPrefetchPreloadEditResponseEditable bool + +const ( + ZoneSettingPrefetchPreloadEditResponseEditableTrue ZoneSettingPrefetchPreloadEditResponseEditable = true + ZoneSettingPrefetchPreloadEditResponseEditableFalse ZoneSettingPrefetchPreloadEditResponseEditable = false +) + +// Cloudflare will prefetch any URLs that are included in the response headers. +// This is limited to Enterprise Zones. +type ZoneSettingPrefetchPreloadGetResponse struct { + // ID of the zone setting. + ID ZoneSettingPrefetchPreloadGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingPrefetchPreloadGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingPrefetchPreloadGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingPrefetchPreloadGetResponseJSON `json:"-"` +} + +// zoneSettingPrefetchPreloadGetResponseJSON contains the JSON metadata for the +// struct [ZoneSettingPrefetchPreloadGetResponse] +type zoneSettingPrefetchPreloadGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPrefetchPreloadGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingPrefetchPreloadGetResponseID string + +const ( + ZoneSettingPrefetchPreloadGetResponseIDPrefetchPreload ZoneSettingPrefetchPreloadGetResponseID = "prefetch_preload" +) + +// Current value of the zone setting. +type ZoneSettingPrefetchPreloadGetResponseValue string + +const ( + ZoneSettingPrefetchPreloadGetResponseValueOn ZoneSettingPrefetchPreloadGetResponseValue = "on" + ZoneSettingPrefetchPreloadGetResponseValueOff ZoneSettingPrefetchPreloadGetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingPrefetchPreloadGetResponseEditable bool + +const ( + ZoneSettingPrefetchPreloadGetResponseEditableTrue ZoneSettingPrefetchPreloadGetResponseEditable = true + ZoneSettingPrefetchPreloadGetResponseEditableFalse ZoneSettingPrefetchPreloadGetResponseEditable = false +) + +type ZoneSettingPrefetchPreloadEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingPrefetchPreloadEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingPrefetchPreloadEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingPrefetchPreloadEditParamsValue string + +const ( + ZoneSettingPrefetchPreloadEditParamsValueOn ZoneSettingPrefetchPreloadEditParamsValue = "on" + ZoneSettingPrefetchPreloadEditParamsValueOff ZoneSettingPrefetchPreloadEditParamsValue = "off" +) + +type ZoneSettingPrefetchPreloadEditResponseEnvelope struct { + Errors []ZoneSettingPrefetchPreloadEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingPrefetchPreloadEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Cloudflare will prefetch any URLs that are included in the response headers. + // This is limited to Enterprise Zones. + Result ZoneSettingPrefetchPreloadEditResponse `json:"result"` + JSON zoneSettingPrefetchPreloadEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingPrefetchPreloadEditResponseEnvelopeJSON contains the JSON metadata +// for the struct [ZoneSettingPrefetchPreloadEditResponseEnvelope] +type zoneSettingPrefetchPreloadEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPrefetchPreloadEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingPrefetchPreloadEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingPrefetchPreloadEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingPrefetchPreloadEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingPrefetchPreloadEditResponseEnvelopeErrors] +type zoneSettingPrefetchPreloadEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPrefetchPreloadEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingPrefetchPreloadEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingPrefetchPreloadEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingPrefetchPreloadEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingPrefetchPreloadEditResponseEnvelopeMessages] +type zoneSettingPrefetchPreloadEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPrefetchPreloadEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingPrefetchPreloadGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingPrefetchPreloadGetResponseEnvelope struct { + Errors []ZoneSettingPrefetchPreloadGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingPrefetchPreloadGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Cloudflare will prefetch any URLs that are included in the response headers. + // This is limited to Enterprise Zones. + Result ZoneSettingPrefetchPreloadGetResponse `json:"result"` + JSON zoneSettingPrefetchPreloadGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingPrefetchPreloadGetResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingPrefetchPreloadGetResponseEnvelope] +type zoneSettingPrefetchPreloadGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPrefetchPreloadGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingPrefetchPreloadGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingPrefetchPreloadGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingPrefetchPreloadGetResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingPrefetchPreloadGetResponseEnvelopeErrors] +type zoneSettingPrefetchPreloadGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPrefetchPreloadGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingPrefetchPreloadGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingPrefetchPreloadGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingPrefetchPreloadGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingPrefetchPreloadGetResponseEnvelopeMessages] +type zoneSettingPrefetchPreloadGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPrefetchPreloadGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/zonesettingprefetchpreload_test.go b/zonesettingprefetchpreload_test.go new file mode 100644 index 00000000000..0d56555a6da --- /dev/null +++ b/zonesettingprefetchpreload_test.go @@ -0,0 +1,71 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingPrefetchPreloadEdit(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.PrefetchPreload.Edit(context.TODO(), cloudflare.ZoneSettingPrefetchPreloadEditParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Value: cloudflare.F(cloudflare.ZoneSettingPrefetchPreloadEditParamsValueOn), + }) + 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 TestZoneSettingPrefetchPreloadGet(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.PrefetchPreload.Get(context.TODO(), cloudflare.ZoneSettingPrefetchPreloadGetParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/zonesettingproxyreadtimeout.go b/zonesettingproxyreadtimeout.go new file mode 100644 index 00000000000..c665d1b7daf --- /dev/null +++ b/zonesettingproxyreadtimeout.go @@ -0,0 +1,320 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingProxyReadTimeoutService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewZoneSettingProxyReadTimeoutService] method instead. +type ZoneSettingProxyReadTimeoutService struct { + Options []option.RequestOption +} + +// NewZoneSettingProxyReadTimeoutService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewZoneSettingProxyReadTimeoutService(opts ...option.RequestOption) (r *ZoneSettingProxyReadTimeoutService) { + r = &ZoneSettingProxyReadTimeoutService{} + r.Options = opts + return +} + +// Maximum time between two read operations from origin. +func (r *ZoneSettingProxyReadTimeoutService) Edit(ctx context.Context, params ZoneSettingProxyReadTimeoutEditParams, opts ...option.RequestOption) (res *ZoneSettingProxyReadTimeoutEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingProxyReadTimeoutEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/proxy_read_timeout", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Maximum time between two read operations from origin. +func (r *ZoneSettingProxyReadTimeoutService) Get(ctx context.Context, query ZoneSettingProxyReadTimeoutGetParams, opts ...option.RequestOption) (res *ZoneSettingProxyReadTimeoutGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingProxyReadTimeoutGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/proxy_read_timeout", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Maximum time between two read operations from origin. +type ZoneSettingProxyReadTimeoutEditResponse struct { + // ID of the zone setting. + ID ZoneSettingProxyReadTimeoutEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value float64 `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingProxyReadTimeoutEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingProxyReadTimeoutEditResponseJSON `json:"-"` +} + +// zoneSettingProxyReadTimeoutEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingProxyReadTimeoutEditResponse] +type zoneSettingProxyReadTimeoutEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingProxyReadTimeoutEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingProxyReadTimeoutEditResponseID string + +const ( + ZoneSettingProxyReadTimeoutEditResponseIDProxyReadTimeout ZoneSettingProxyReadTimeoutEditResponseID = "proxy_read_timeout" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingProxyReadTimeoutEditResponseEditable bool + +const ( + ZoneSettingProxyReadTimeoutEditResponseEditableTrue ZoneSettingProxyReadTimeoutEditResponseEditable = true + ZoneSettingProxyReadTimeoutEditResponseEditableFalse ZoneSettingProxyReadTimeoutEditResponseEditable = false +) + +// Maximum time between two read operations from origin. +type ZoneSettingProxyReadTimeoutGetResponse struct { + // ID of the zone setting. + ID ZoneSettingProxyReadTimeoutGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value float64 `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingProxyReadTimeoutGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingProxyReadTimeoutGetResponseJSON `json:"-"` +} + +// zoneSettingProxyReadTimeoutGetResponseJSON contains the JSON metadata for the +// struct [ZoneSettingProxyReadTimeoutGetResponse] +type zoneSettingProxyReadTimeoutGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingProxyReadTimeoutGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingProxyReadTimeoutGetResponseID string + +const ( + ZoneSettingProxyReadTimeoutGetResponseIDProxyReadTimeout ZoneSettingProxyReadTimeoutGetResponseID = "proxy_read_timeout" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingProxyReadTimeoutGetResponseEditable bool + +const ( + ZoneSettingProxyReadTimeoutGetResponseEditableTrue ZoneSettingProxyReadTimeoutGetResponseEditable = true + ZoneSettingProxyReadTimeoutGetResponseEditableFalse ZoneSettingProxyReadTimeoutGetResponseEditable = false +) + +type ZoneSettingProxyReadTimeoutEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Maximum time between two read operations from origin. + Value param.Field[ZoneSettingProxyReadTimeoutEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingProxyReadTimeoutEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Maximum time between two read operations from origin. +type ZoneSettingProxyReadTimeoutEditParamsValue struct { + // ID of the zone setting. + ID param.Field[ZoneSettingProxyReadTimeoutEditParamsValueID] `json:"id,required"` + // Current value of the zone setting. + Value param.Field[float64] `json:"value,required"` +} + +func (r ZoneSettingProxyReadTimeoutEditParamsValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// ID of the zone setting. +type ZoneSettingProxyReadTimeoutEditParamsValueID string + +const ( + ZoneSettingProxyReadTimeoutEditParamsValueIDProxyReadTimeout ZoneSettingProxyReadTimeoutEditParamsValueID = "proxy_read_timeout" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingProxyReadTimeoutEditParamsValueEditable bool + +const ( + ZoneSettingProxyReadTimeoutEditParamsValueEditableTrue ZoneSettingProxyReadTimeoutEditParamsValueEditable = true + ZoneSettingProxyReadTimeoutEditParamsValueEditableFalse ZoneSettingProxyReadTimeoutEditParamsValueEditable = false +) + +type ZoneSettingProxyReadTimeoutEditResponseEnvelope struct { + Errors []ZoneSettingProxyReadTimeoutEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingProxyReadTimeoutEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Maximum time between two read operations from origin. + Result ZoneSettingProxyReadTimeoutEditResponse `json:"result"` + JSON zoneSettingProxyReadTimeoutEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingProxyReadTimeoutEditResponseEnvelopeJSON contains the JSON metadata +// for the struct [ZoneSettingProxyReadTimeoutEditResponseEnvelope] +type zoneSettingProxyReadTimeoutEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingProxyReadTimeoutEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingProxyReadTimeoutEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingProxyReadTimeoutEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingProxyReadTimeoutEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingProxyReadTimeoutEditResponseEnvelopeErrors] +type zoneSettingProxyReadTimeoutEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingProxyReadTimeoutEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingProxyReadTimeoutEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingProxyReadTimeoutEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingProxyReadTimeoutEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct +// [ZoneSettingProxyReadTimeoutEditResponseEnvelopeMessages] +type zoneSettingProxyReadTimeoutEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingProxyReadTimeoutEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingProxyReadTimeoutGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingProxyReadTimeoutGetResponseEnvelope struct { + Errors []ZoneSettingProxyReadTimeoutGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingProxyReadTimeoutGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Maximum time between two read operations from origin. + Result ZoneSettingProxyReadTimeoutGetResponse `json:"result"` + JSON zoneSettingProxyReadTimeoutGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingProxyReadTimeoutGetResponseEnvelopeJSON contains the JSON metadata +// for the struct [ZoneSettingProxyReadTimeoutGetResponseEnvelope] +type zoneSettingProxyReadTimeoutGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingProxyReadTimeoutGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingProxyReadTimeoutGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingProxyReadTimeoutGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingProxyReadTimeoutGetResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingProxyReadTimeoutGetResponseEnvelopeErrors] +type zoneSettingProxyReadTimeoutGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingProxyReadTimeoutGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingProxyReadTimeoutGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingProxyReadTimeoutGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingProxyReadTimeoutGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingProxyReadTimeoutGetResponseEnvelopeMessages] +type zoneSettingProxyReadTimeoutGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingProxyReadTimeoutGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingproxyreadtimeout_test.go b/zonesettingproxyreadtimeout_test.go similarity index 79% rename from settingproxyreadtimeout_test.go rename to zonesettingproxyreadtimeout_test.go index 164c7ad7df0..cccff036bf2 100644 --- a/settingproxyreadtimeout_test.go +++ b/zonesettingproxyreadtimeout_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingProxyReadTimeoutEditWithOptionalParams(t *testing.T) { +func TestZoneSettingProxyReadTimeoutEditWithOptionalParams(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 { @@ -29,10 +29,10 @@ func TestSettingProxyReadTimeoutEditWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.ProxyReadTimeout.Edit(context.TODO(), cloudflare.SettingProxyReadTimeoutEditParams{ + _, err := client.Zones.Settings.ProxyReadTimeout.Edit(context.TODO(), cloudflare.ZoneSettingProxyReadTimeoutEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingProxyReadTimeoutEditParamsValue{ - ID: cloudflare.F(cloudflare.SettingProxyReadTimeoutEditParamsValueIDProxyReadTimeout), + Value: cloudflare.F(cloudflare.ZoneSettingProxyReadTimeoutEditParamsValue{ + ID: cloudflare.F(cloudflare.ZoneSettingProxyReadTimeoutEditParamsValueIDProxyReadTimeout), Value: cloudflare.F(0.000000), }), }) @@ -45,7 +45,7 @@ func TestSettingProxyReadTimeoutEditWithOptionalParams(t *testing.T) { } } -func TestSettingProxyReadTimeoutGet(t *testing.T) { +func TestZoneSettingProxyReadTimeoutGet(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 { @@ -61,7 +61,7 @@ func TestSettingProxyReadTimeoutGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.ProxyReadTimeout.Get(context.TODO(), cloudflare.SettingProxyReadTimeoutGetParams{ + _, err := client.Zones.Settings.ProxyReadTimeout.Get(context.TODO(), cloudflare.ZoneSettingProxyReadTimeoutGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingpseudoipv4.go b/zonesettingpseudoipv4.go new file mode 100644 index 00000000000..75ef4c3054c --- /dev/null +++ b/zonesettingpseudoipv4.go @@ -0,0 +1,318 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingPseudoIPV4Service contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewZoneSettingPseudoIPV4Service] +// method instead. +type ZoneSettingPseudoIPV4Service struct { + Options []option.RequestOption +} + +// NewZoneSettingPseudoIPV4Service generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewZoneSettingPseudoIPV4Service(opts ...option.RequestOption) (r *ZoneSettingPseudoIPV4Service) { + r = &ZoneSettingPseudoIPV4Service{} + r.Options = opts + return +} + +// Value of the Pseudo IPv4 setting. +func (r *ZoneSettingPseudoIPV4Service) Edit(ctx context.Context, params ZoneSettingPseudoIPV4EditParams, opts ...option.RequestOption) (res *ZoneSettingPseudoIPV4EditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingPseudoIPV4EditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/pseudo_ipv4", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Value of the Pseudo IPv4 setting. +func (r *ZoneSettingPseudoIPV4Service) Get(ctx context.Context, query ZoneSettingPseudoIPV4GetParams, opts ...option.RequestOption) (res *ZoneSettingPseudoIPV4GetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingPseudoIPV4GetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/pseudo_ipv4", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// The value set for the Pseudo IPv4 setting. +type ZoneSettingPseudoIPV4EditResponse struct { + // Value of the Pseudo IPv4 setting. + ID ZoneSettingPseudoIPV4EditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingPseudoIPV4EditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingPseudoIPV4EditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingPseudoIPV4EditResponseJSON `json:"-"` +} + +// zoneSettingPseudoIPV4EditResponseJSON contains the JSON metadata for the struct +// [ZoneSettingPseudoIPV4EditResponse] +type zoneSettingPseudoIPV4EditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPseudoIPV4EditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Value of the Pseudo IPv4 setting. +type ZoneSettingPseudoIPV4EditResponseID string + +const ( + ZoneSettingPseudoIPV4EditResponseIDPseudoIPV4 ZoneSettingPseudoIPV4EditResponseID = "pseudo_ipv4" +) + +// Current value of the zone setting. +type ZoneSettingPseudoIPV4EditResponseValue string + +const ( + ZoneSettingPseudoIPV4EditResponseValueOff ZoneSettingPseudoIPV4EditResponseValue = "off" + ZoneSettingPseudoIPV4EditResponseValueAddHeader ZoneSettingPseudoIPV4EditResponseValue = "add_header" + ZoneSettingPseudoIPV4EditResponseValueOverwriteHeader ZoneSettingPseudoIPV4EditResponseValue = "overwrite_header" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingPseudoIPV4EditResponseEditable bool + +const ( + ZoneSettingPseudoIPV4EditResponseEditableTrue ZoneSettingPseudoIPV4EditResponseEditable = true + ZoneSettingPseudoIPV4EditResponseEditableFalse ZoneSettingPseudoIPV4EditResponseEditable = false +) + +// The value set for the Pseudo IPv4 setting. +type ZoneSettingPseudoIPV4GetResponse struct { + // Value of the Pseudo IPv4 setting. + ID ZoneSettingPseudoIPV4GetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingPseudoIPV4GetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingPseudoIPV4GetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingPseudoIPV4GetResponseJSON `json:"-"` +} + +// zoneSettingPseudoIPV4GetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingPseudoIPV4GetResponse] +type zoneSettingPseudoIPV4GetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPseudoIPV4GetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Value of the Pseudo IPv4 setting. +type ZoneSettingPseudoIPV4GetResponseID string + +const ( + ZoneSettingPseudoIPV4GetResponseIDPseudoIPV4 ZoneSettingPseudoIPV4GetResponseID = "pseudo_ipv4" +) + +// Current value of the zone setting. +type ZoneSettingPseudoIPV4GetResponseValue string + +const ( + ZoneSettingPseudoIPV4GetResponseValueOff ZoneSettingPseudoIPV4GetResponseValue = "off" + ZoneSettingPseudoIPV4GetResponseValueAddHeader ZoneSettingPseudoIPV4GetResponseValue = "add_header" + ZoneSettingPseudoIPV4GetResponseValueOverwriteHeader ZoneSettingPseudoIPV4GetResponseValue = "overwrite_header" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingPseudoIPV4GetResponseEditable bool + +const ( + ZoneSettingPseudoIPV4GetResponseEditableTrue ZoneSettingPseudoIPV4GetResponseEditable = true + ZoneSettingPseudoIPV4GetResponseEditableFalse ZoneSettingPseudoIPV4GetResponseEditable = false +) + +type ZoneSettingPseudoIPV4EditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the Pseudo IPv4 setting. + Value param.Field[ZoneSettingPseudoIPV4EditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingPseudoIPV4EditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the Pseudo IPv4 setting. +type ZoneSettingPseudoIPV4EditParamsValue string + +const ( + ZoneSettingPseudoIPV4EditParamsValueOff ZoneSettingPseudoIPV4EditParamsValue = "off" + ZoneSettingPseudoIPV4EditParamsValueAddHeader ZoneSettingPseudoIPV4EditParamsValue = "add_header" + ZoneSettingPseudoIPV4EditParamsValueOverwriteHeader ZoneSettingPseudoIPV4EditParamsValue = "overwrite_header" +) + +type ZoneSettingPseudoIPV4EditResponseEnvelope struct { + Errors []ZoneSettingPseudoIPV4EditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingPseudoIPV4EditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // The value set for the Pseudo IPv4 setting. + Result ZoneSettingPseudoIPV4EditResponse `json:"result"` + JSON zoneSettingPseudoIPV4EditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingPseudoIPV4EditResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingPseudoIPV4EditResponseEnvelope] +type zoneSettingPseudoIPV4EditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPseudoIPV4EditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingPseudoIPV4EditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingPseudoIPV4EditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingPseudoIPV4EditResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [ZoneSettingPseudoIPV4EditResponseEnvelopeErrors] +type zoneSettingPseudoIPV4EditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPseudoIPV4EditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingPseudoIPV4EditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingPseudoIPV4EditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingPseudoIPV4EditResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [ZoneSettingPseudoIPV4EditResponseEnvelopeMessages] +type zoneSettingPseudoIPV4EditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPseudoIPV4EditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingPseudoIPV4GetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingPseudoIPV4GetResponseEnvelope struct { + Errors []ZoneSettingPseudoIPV4GetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingPseudoIPV4GetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // The value set for the Pseudo IPv4 setting. + Result ZoneSettingPseudoIPV4GetResponse `json:"result"` + JSON zoneSettingPseudoIPV4GetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingPseudoIPV4GetResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingPseudoIPV4GetResponseEnvelope] +type zoneSettingPseudoIPV4GetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPseudoIPV4GetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingPseudoIPV4GetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingPseudoIPV4GetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingPseudoIPV4GetResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [ZoneSettingPseudoIPV4GetResponseEnvelopeErrors] +type zoneSettingPseudoIPV4GetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPseudoIPV4GetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingPseudoIPV4GetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingPseudoIPV4GetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingPseudoIPV4GetResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [ZoneSettingPseudoIPV4GetResponseEnvelopeMessages] +type zoneSettingPseudoIPV4GetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingPseudoIPV4GetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingbrowsercheck_test.go b/zonesettingpseudoipv4_test.go similarity index 84% rename from settingbrowsercheck_test.go rename to zonesettingpseudoipv4_test.go index cc404d6f5c6..4bf9092b024 100644 --- a/settingbrowsercheck_test.go +++ b/zonesettingpseudoipv4_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingBrowserCheckEdit(t *testing.T) { +func TestZoneSettingPseudoIPV4Edit(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 { @@ -29,9 +29,9 @@ func TestSettingBrowserCheckEdit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.BrowserCheck.Edit(context.TODO(), cloudflare.SettingBrowserCheckEditParams{ + _, err := client.Zones.Settings.PseudoIPV4.Edit(context.TODO(), cloudflare.ZoneSettingPseudoIPV4EditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingBrowserCheckEditParamsValueOn), + Value: cloudflare.F(cloudflare.ZoneSettingPseudoIPV4EditParamsValueOff), }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +42,7 @@ func TestSettingBrowserCheckEdit(t *testing.T) { } } -func TestSettingBrowserCheckGet(t *testing.T) { +func TestZoneSettingPseudoIPV4Get(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 { @@ -58,7 +58,7 @@ func TestSettingBrowserCheckGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.BrowserCheck.Get(context.TODO(), cloudflare.SettingBrowserCheckGetParams{ + _, err := client.Zones.Settings.PseudoIPV4.Get(context.TODO(), cloudflare.ZoneSettingPseudoIPV4GetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingresponsebuffering.go b/zonesettingresponsebuffering.go new file mode 100644 index 00000000000..0e6b5a82647 --- /dev/null +++ b/zonesettingresponsebuffering.go @@ -0,0 +1,335 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingResponseBufferingService contains methods and other services that +// help with interacting with the cloudflare API. Note, unlike clients, this +// service does not read variables from the environment automatically. You should +// not instantiate this service directly, and instead use the +// [NewZoneSettingResponseBufferingService] method instead. +type ZoneSettingResponseBufferingService struct { + Options []option.RequestOption +} + +// NewZoneSettingResponseBufferingService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewZoneSettingResponseBufferingService(opts ...option.RequestOption) (r *ZoneSettingResponseBufferingService) { + r = &ZoneSettingResponseBufferingService{} + r.Options = opts + return +} + +// Enables or disables buffering of responses from the proxied server. Cloudflare +// may buffer the whole payload to deliver it at once to the client versus allowing +// it to be delivered in chunks. By default, the proxied server streams directly +// and is not buffered by Cloudflare. This is limited to Enterprise Zones. +func (r *ZoneSettingResponseBufferingService) Edit(ctx context.Context, params ZoneSettingResponseBufferingEditParams, opts ...option.RequestOption) (res *ZoneSettingResponseBufferingEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingResponseBufferingEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/response_buffering", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Enables or disables buffering of responses from the proxied server. Cloudflare +// may buffer the whole payload to deliver it at once to the client versus allowing +// it to be delivered in chunks. By default, the proxied server streams directly +// and is not buffered by Cloudflare. This is limited to Enterprise Zones. +func (r *ZoneSettingResponseBufferingService) Get(ctx context.Context, query ZoneSettingResponseBufferingGetParams, opts ...option.RequestOption) (res *ZoneSettingResponseBufferingGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingResponseBufferingGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/response_buffering", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Enables or disables buffering of responses from the proxied server. Cloudflare +// may buffer the whole payload to deliver it at once to the client versus allowing +// it to be delivered in chunks. By default, the proxied server streams directly +// and is not buffered by Cloudflare. This is limited to Enterprise Zones. +type ZoneSettingResponseBufferingEditResponse struct { + // ID of the zone setting. + ID ZoneSettingResponseBufferingEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingResponseBufferingEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingResponseBufferingEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingResponseBufferingEditResponseJSON `json:"-"` +} + +// zoneSettingResponseBufferingEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingResponseBufferingEditResponse] +type zoneSettingResponseBufferingEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingResponseBufferingEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingResponseBufferingEditResponseID string + +const ( + ZoneSettingResponseBufferingEditResponseIDResponseBuffering ZoneSettingResponseBufferingEditResponseID = "response_buffering" +) + +// Current value of the zone setting. +type ZoneSettingResponseBufferingEditResponseValue string + +const ( + ZoneSettingResponseBufferingEditResponseValueOn ZoneSettingResponseBufferingEditResponseValue = "on" + ZoneSettingResponseBufferingEditResponseValueOff ZoneSettingResponseBufferingEditResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingResponseBufferingEditResponseEditable bool + +const ( + ZoneSettingResponseBufferingEditResponseEditableTrue ZoneSettingResponseBufferingEditResponseEditable = true + ZoneSettingResponseBufferingEditResponseEditableFalse ZoneSettingResponseBufferingEditResponseEditable = false +) + +// Enables or disables buffering of responses from the proxied server. Cloudflare +// may buffer the whole payload to deliver it at once to the client versus allowing +// it to be delivered in chunks. By default, the proxied server streams directly +// and is not buffered by Cloudflare. This is limited to Enterprise Zones. +type ZoneSettingResponseBufferingGetResponse struct { + // ID of the zone setting. + ID ZoneSettingResponseBufferingGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingResponseBufferingGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingResponseBufferingGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingResponseBufferingGetResponseJSON `json:"-"` +} + +// zoneSettingResponseBufferingGetResponseJSON contains the JSON metadata for the +// struct [ZoneSettingResponseBufferingGetResponse] +type zoneSettingResponseBufferingGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingResponseBufferingGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingResponseBufferingGetResponseID string + +const ( + ZoneSettingResponseBufferingGetResponseIDResponseBuffering ZoneSettingResponseBufferingGetResponseID = "response_buffering" +) + +// Current value of the zone setting. +type ZoneSettingResponseBufferingGetResponseValue string + +const ( + ZoneSettingResponseBufferingGetResponseValueOn ZoneSettingResponseBufferingGetResponseValue = "on" + ZoneSettingResponseBufferingGetResponseValueOff ZoneSettingResponseBufferingGetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingResponseBufferingGetResponseEditable bool + +const ( + ZoneSettingResponseBufferingGetResponseEditableTrue ZoneSettingResponseBufferingGetResponseEditable = true + ZoneSettingResponseBufferingGetResponseEditableFalse ZoneSettingResponseBufferingGetResponseEditable = false +) + +type ZoneSettingResponseBufferingEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingResponseBufferingEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingResponseBufferingEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingResponseBufferingEditParamsValue string + +const ( + ZoneSettingResponseBufferingEditParamsValueOn ZoneSettingResponseBufferingEditParamsValue = "on" + ZoneSettingResponseBufferingEditParamsValueOff ZoneSettingResponseBufferingEditParamsValue = "off" +) + +type ZoneSettingResponseBufferingEditResponseEnvelope struct { + Errors []ZoneSettingResponseBufferingEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingResponseBufferingEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Enables or disables buffering of responses from the proxied server. Cloudflare + // may buffer the whole payload to deliver it at once to the client versus allowing + // it to be delivered in chunks. By default, the proxied server streams directly + // and is not buffered by Cloudflare. This is limited to Enterprise Zones. + Result ZoneSettingResponseBufferingEditResponse `json:"result"` + JSON zoneSettingResponseBufferingEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingResponseBufferingEditResponseEnvelopeJSON contains the JSON metadata +// for the struct [ZoneSettingResponseBufferingEditResponseEnvelope] +type zoneSettingResponseBufferingEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingResponseBufferingEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingResponseBufferingEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingResponseBufferingEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingResponseBufferingEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingResponseBufferingEditResponseEnvelopeErrors] +type zoneSettingResponseBufferingEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingResponseBufferingEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingResponseBufferingEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingResponseBufferingEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingResponseBufferingEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct +// [ZoneSettingResponseBufferingEditResponseEnvelopeMessages] +type zoneSettingResponseBufferingEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingResponseBufferingEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingResponseBufferingGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingResponseBufferingGetResponseEnvelope struct { + Errors []ZoneSettingResponseBufferingGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingResponseBufferingGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Enables or disables buffering of responses from the proxied server. Cloudflare + // may buffer the whole payload to deliver it at once to the client versus allowing + // it to be delivered in chunks. By default, the proxied server streams directly + // and is not buffered by Cloudflare. This is limited to Enterprise Zones. + Result ZoneSettingResponseBufferingGetResponse `json:"result"` + JSON zoneSettingResponseBufferingGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingResponseBufferingGetResponseEnvelopeJSON contains the JSON metadata +// for the struct [ZoneSettingResponseBufferingGetResponseEnvelope] +type zoneSettingResponseBufferingGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingResponseBufferingGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingResponseBufferingGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingResponseBufferingGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingResponseBufferingGetResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingResponseBufferingGetResponseEnvelopeErrors] +type zoneSettingResponseBufferingGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingResponseBufferingGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingResponseBufferingGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingResponseBufferingGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingResponseBufferingGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct +// [ZoneSettingResponseBufferingGetResponseEnvelopeMessages] +type zoneSettingResponseBufferingGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingResponseBufferingGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/zonesettingresponsebuffering_test.go b/zonesettingresponsebuffering_test.go new file mode 100644 index 00000000000..0756dc18b34 --- /dev/null +++ b/zonesettingresponsebuffering_test.go @@ -0,0 +1,71 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingResponseBufferingEdit(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.ResponseBuffering.Edit(context.TODO(), cloudflare.ZoneSettingResponseBufferingEditParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Value: cloudflare.F(cloudflare.ZoneSettingResponseBufferingEditParamsValueOn), + }) + 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 TestZoneSettingResponseBufferingGet(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.ResponseBuffering.Get(context.TODO(), cloudflare.ZoneSettingResponseBufferingGetParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/settingrocketloader.go b/zonesettingrocketloader.go similarity index 52% rename from settingrocketloader.go rename to zonesettingrocketloader.go index d867abd29b6..1440978ead3 100644 --- a/settingrocketloader.go +++ b/zonesettingrocketloader.go @@ -14,20 +14,20 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -// SettingRocketLoaderService contains methods and other services that help with -// interacting with the cloudflare API. Note, unlike clients, this service does not -// read variables from the environment automatically. You should not instantiate -// this service directly, and instead use the [NewSettingRocketLoaderService] -// method instead. -type SettingRocketLoaderService struct { +// ZoneSettingRocketLoaderService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewZoneSettingRocketLoaderService] method instead. +type ZoneSettingRocketLoaderService struct { Options []option.RequestOption } -// NewSettingRocketLoaderService generates a new service that applies the given +// NewZoneSettingRocketLoaderService generates a new service that applies the given // options to each request. These options are applied after the parent client's // options (if there is one), and before any request-specific options. -func NewSettingRocketLoaderService(opts ...option.RequestOption) (r *SettingRocketLoaderService) { - r = &SettingRocketLoaderService{} +func NewZoneSettingRocketLoaderService(opts ...option.RequestOption) (r *ZoneSettingRocketLoaderService) { + r = &ZoneSettingRocketLoaderService{} r.Options = opts return } @@ -42,9 +42,9 @@ func NewSettingRocketLoaderService(opts ...option.RequestOption) (r *SettingRock // with no configuration required. Refer to // [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) // for more information. -func (r *SettingRocketLoaderService) Edit(ctx context.Context, params SettingRocketLoaderEditParams, opts ...option.RequestOption) (res *SettingRocketLoaderEditResponse, err error) { +func (r *ZoneSettingRocketLoaderService) Edit(ctx context.Context, params ZoneSettingRocketLoaderEditParams, opts ...option.RequestOption) (res *ZoneSettingRocketLoaderEditResponse, err error) { opts = append(r.Options[:], opts...) - var env SettingRocketLoaderEditResponseEnvelope + var env ZoneSettingRocketLoaderEditResponseEnvelope path := fmt.Sprintf("zones/%s/settings/rocket_loader", params.ZoneID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) if err != nil { @@ -64,9 +64,9 @@ func (r *SettingRocketLoaderService) Edit(ctx context.Context, params SettingRoc // with no configuration required. Refer to // [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) // for more information. -func (r *SettingRocketLoaderService) Get(ctx context.Context, query SettingRocketLoaderGetParams, opts ...option.RequestOption) (res *SettingRocketLoaderGetResponse, err error) { +func (r *ZoneSettingRocketLoaderService) Get(ctx context.Context, query ZoneSettingRocketLoaderGetParams, opts ...option.RequestOption) (res *ZoneSettingRocketLoaderGetResponse, err error) { opts = append(r.Options[:], opts...) - var env SettingRocketLoaderGetResponseEnvelope + var env ZoneSettingRocketLoaderGetResponseEnvelope path := fmt.Sprintf("zones/%s/settings/rocket_loader", query.ZoneID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) if err != nil { @@ -86,22 +86,22 @@ func (r *SettingRocketLoaderService) Get(ctx context.Context, query SettingRocke // with no configuration required. Refer to // [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) // for more information. -type SettingRocketLoaderEditResponse struct { +type ZoneSettingRocketLoaderEditResponse struct { // ID of the zone setting. - ID SettingRocketLoaderEditResponseID `json:"id,required"` + ID ZoneSettingRocketLoaderEditResponseID `json:"id,required"` // Current value of the zone setting. - Value SettingRocketLoaderEditResponseValue `json:"value,required"` + Value ZoneSettingRocketLoaderEditResponseValue `json:"value,required"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable SettingRocketLoaderEditResponseEditable `json:"editable"` + Editable ZoneSettingRocketLoaderEditResponseEditable `json:"editable"` // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingRocketLoaderEditResponseJSON `json:"-"` + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingRocketLoaderEditResponseJSON `json:"-"` } -// settingRocketLoaderEditResponseJSON contains the JSON metadata for the struct -// [SettingRocketLoaderEditResponse] -type settingRocketLoaderEditResponseJSON struct { +// zoneSettingRocketLoaderEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingRocketLoaderEditResponse] +type zoneSettingRocketLoaderEditResponseJSON struct { ID apijson.Field Value apijson.Field Editable apijson.Field @@ -110,32 +110,32 @@ type settingRocketLoaderEditResponseJSON struct { ExtraFields map[string]apijson.Field } -func (r *SettingRocketLoaderEditResponse) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingRocketLoaderEditResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // ID of the zone setting. -type SettingRocketLoaderEditResponseID string +type ZoneSettingRocketLoaderEditResponseID string const ( - SettingRocketLoaderEditResponseIDRocketLoader SettingRocketLoaderEditResponseID = "rocket_loader" + ZoneSettingRocketLoaderEditResponseIDRocketLoader ZoneSettingRocketLoaderEditResponseID = "rocket_loader" ) // Current value of the zone setting. -type SettingRocketLoaderEditResponseValue string +type ZoneSettingRocketLoaderEditResponseValue string const ( - SettingRocketLoaderEditResponseValueOn SettingRocketLoaderEditResponseValue = "on" - SettingRocketLoaderEditResponseValueOff SettingRocketLoaderEditResponseValue = "off" + ZoneSettingRocketLoaderEditResponseValueOn ZoneSettingRocketLoaderEditResponseValue = "on" + ZoneSettingRocketLoaderEditResponseValueOff ZoneSettingRocketLoaderEditResponseValue = "off" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type SettingRocketLoaderEditResponseEditable bool +type ZoneSettingRocketLoaderEditResponseEditable bool const ( - SettingRocketLoaderEditResponseEditableTrue SettingRocketLoaderEditResponseEditable = true - SettingRocketLoaderEditResponseEditableFalse SettingRocketLoaderEditResponseEditable = false + ZoneSettingRocketLoaderEditResponseEditableTrue ZoneSettingRocketLoaderEditResponseEditable = true + ZoneSettingRocketLoaderEditResponseEditableFalse ZoneSettingRocketLoaderEditResponseEditable = false ) // Rocket Loader is a general-purpose asynchronous JavaScript optimisation that @@ -148,22 +148,22 @@ const ( // with no configuration required. Refer to // [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) // for more information. -type SettingRocketLoaderGetResponse struct { +type ZoneSettingRocketLoaderGetResponse struct { // ID of the zone setting. - ID SettingRocketLoaderGetResponseID `json:"id,required"` + ID ZoneSettingRocketLoaderGetResponseID `json:"id,required"` // Current value of the zone setting. - Value SettingRocketLoaderGetResponseValue `json:"value,required"` + Value ZoneSettingRocketLoaderGetResponseValue `json:"value,required"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable SettingRocketLoaderGetResponseEditable `json:"editable"` + Editable ZoneSettingRocketLoaderGetResponseEditable `json:"editable"` // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingRocketLoaderGetResponseJSON `json:"-"` + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingRocketLoaderGetResponseJSON `json:"-"` } -// settingRocketLoaderGetResponseJSON contains the JSON metadata for the struct -// [SettingRocketLoaderGetResponse] -type settingRocketLoaderGetResponseJSON struct { +// zoneSettingRocketLoaderGetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingRocketLoaderGetResponse] +type zoneSettingRocketLoaderGetResponseJSON struct { ID apijson.Field Value apijson.Field Editable apijson.Field @@ -172,35 +172,35 @@ type settingRocketLoaderGetResponseJSON struct { ExtraFields map[string]apijson.Field } -func (r *SettingRocketLoaderGetResponse) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingRocketLoaderGetResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // ID of the zone setting. -type SettingRocketLoaderGetResponseID string +type ZoneSettingRocketLoaderGetResponseID string const ( - SettingRocketLoaderGetResponseIDRocketLoader SettingRocketLoaderGetResponseID = "rocket_loader" + ZoneSettingRocketLoaderGetResponseIDRocketLoader ZoneSettingRocketLoaderGetResponseID = "rocket_loader" ) // Current value of the zone setting. -type SettingRocketLoaderGetResponseValue string +type ZoneSettingRocketLoaderGetResponseValue string const ( - SettingRocketLoaderGetResponseValueOn SettingRocketLoaderGetResponseValue = "on" - SettingRocketLoaderGetResponseValueOff SettingRocketLoaderGetResponseValue = "off" + ZoneSettingRocketLoaderGetResponseValueOn ZoneSettingRocketLoaderGetResponseValue = "on" + ZoneSettingRocketLoaderGetResponseValueOff ZoneSettingRocketLoaderGetResponseValue = "off" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type SettingRocketLoaderGetResponseEditable bool +type ZoneSettingRocketLoaderGetResponseEditable bool const ( - SettingRocketLoaderGetResponseEditableTrue SettingRocketLoaderGetResponseEditable = true - SettingRocketLoaderGetResponseEditableFalse SettingRocketLoaderGetResponseEditable = false + ZoneSettingRocketLoaderGetResponseEditableTrue ZoneSettingRocketLoaderGetResponseEditable = true + ZoneSettingRocketLoaderGetResponseEditableFalse ZoneSettingRocketLoaderGetResponseEditable = false ) -type SettingRocketLoaderEditParams struct { +type ZoneSettingRocketLoaderEditParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` // Rocket Loader is a general-purpose asynchronous JavaScript optimisation that @@ -213,10 +213,10 @@ type SettingRocketLoaderEditParams struct { // with no configuration required. Refer to // [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) // for more information. - Value param.Field[SettingRocketLoaderEditParamsValue] `json:"value,required"` + Value param.Field[ZoneSettingRocketLoaderEditParamsValue] `json:"value,required"` } -func (r SettingRocketLoaderEditParams) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingRocketLoaderEditParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } @@ -230,44 +230,44 @@ func (r SettingRocketLoaderEditParams) MarshalJSON() (data []byte, err error) { // with no configuration required. Refer to // [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) // for more information. -type SettingRocketLoaderEditParamsValue struct { +type ZoneSettingRocketLoaderEditParamsValue struct { // ID of the zone setting. - ID param.Field[SettingRocketLoaderEditParamsValueID] `json:"id,required"` + ID param.Field[ZoneSettingRocketLoaderEditParamsValueID] `json:"id,required"` // Current value of the zone setting. - Value param.Field[SettingRocketLoaderEditParamsValueValue] `json:"value,required"` + Value param.Field[ZoneSettingRocketLoaderEditParamsValueValue] `json:"value,required"` } -func (r SettingRocketLoaderEditParamsValue) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingRocketLoaderEditParamsValue) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // ID of the zone setting. -type SettingRocketLoaderEditParamsValueID string +type ZoneSettingRocketLoaderEditParamsValueID string const ( - SettingRocketLoaderEditParamsValueIDRocketLoader SettingRocketLoaderEditParamsValueID = "rocket_loader" + ZoneSettingRocketLoaderEditParamsValueIDRocketLoader ZoneSettingRocketLoaderEditParamsValueID = "rocket_loader" ) // Current value of the zone setting. -type SettingRocketLoaderEditParamsValueValue string +type ZoneSettingRocketLoaderEditParamsValueValue string const ( - SettingRocketLoaderEditParamsValueValueOn SettingRocketLoaderEditParamsValueValue = "on" - SettingRocketLoaderEditParamsValueValueOff SettingRocketLoaderEditParamsValueValue = "off" + ZoneSettingRocketLoaderEditParamsValueValueOn ZoneSettingRocketLoaderEditParamsValueValue = "on" + ZoneSettingRocketLoaderEditParamsValueValueOff ZoneSettingRocketLoaderEditParamsValueValue = "off" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type SettingRocketLoaderEditParamsValueEditable bool +type ZoneSettingRocketLoaderEditParamsValueEditable bool const ( - SettingRocketLoaderEditParamsValueEditableTrue SettingRocketLoaderEditParamsValueEditable = true - SettingRocketLoaderEditParamsValueEditableFalse SettingRocketLoaderEditParamsValueEditable = false + ZoneSettingRocketLoaderEditParamsValueEditableTrue ZoneSettingRocketLoaderEditParamsValueEditable = true + ZoneSettingRocketLoaderEditParamsValueEditableFalse ZoneSettingRocketLoaderEditParamsValueEditable = false ) -type SettingRocketLoaderEditResponseEnvelope struct { - Errors []SettingRocketLoaderEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingRocketLoaderEditResponseEnvelopeMessages `json:"messages,required"` +type ZoneSettingRocketLoaderEditResponseEnvelope struct { + Errors []ZoneSettingRocketLoaderEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingRocketLoaderEditResponseEnvelopeMessages `json:"messages,required"` // Whether the API call was successful Success bool `json:"success,required"` // Rocket Loader is a general-purpose asynchronous JavaScript optimisation that @@ -280,13 +280,13 @@ type SettingRocketLoaderEditResponseEnvelope struct { // with no configuration required. Refer to // [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) // for more information. - Result SettingRocketLoaderEditResponse `json:"result"` - JSON settingRocketLoaderEditResponseEnvelopeJSON `json:"-"` + Result ZoneSettingRocketLoaderEditResponse `json:"result"` + JSON zoneSettingRocketLoaderEditResponseEnvelopeJSON `json:"-"` } -// settingRocketLoaderEditResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingRocketLoaderEditResponseEnvelope] -type settingRocketLoaderEditResponseEnvelopeJSON struct { +// zoneSettingRocketLoaderEditResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingRocketLoaderEditResponseEnvelope] +type zoneSettingRocketLoaderEditResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field Success apijson.Field @@ -295,56 +295,56 @@ type settingRocketLoaderEditResponseEnvelopeJSON struct { ExtraFields map[string]apijson.Field } -func (r *SettingRocketLoaderEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingRocketLoaderEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type SettingRocketLoaderEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingRocketLoaderEditResponseEnvelopeErrorsJSON `json:"-"` +type ZoneSettingRocketLoaderEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingRocketLoaderEditResponseEnvelopeErrorsJSON `json:"-"` } -// settingRocketLoaderEditResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [SettingRocketLoaderEditResponseEnvelopeErrors] -type settingRocketLoaderEditResponseEnvelopeErrorsJSON struct { +// zoneSettingRocketLoaderEditResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [ZoneSettingRocketLoaderEditResponseEnvelopeErrors] +type zoneSettingRocketLoaderEditResponseEnvelopeErrorsJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *SettingRocketLoaderEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingRocketLoaderEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type SettingRocketLoaderEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingRocketLoaderEditResponseEnvelopeMessagesJSON `json:"-"` +type ZoneSettingRocketLoaderEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingRocketLoaderEditResponseEnvelopeMessagesJSON `json:"-"` } -// settingRocketLoaderEditResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingRocketLoaderEditResponseEnvelopeMessages] -type settingRocketLoaderEditResponseEnvelopeMessagesJSON struct { +// zoneSettingRocketLoaderEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingRocketLoaderEditResponseEnvelopeMessages] +type zoneSettingRocketLoaderEditResponseEnvelopeMessagesJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *SettingRocketLoaderEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingRocketLoaderEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type SettingRocketLoaderGetParams struct { +type ZoneSettingRocketLoaderGetParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` } -type SettingRocketLoaderGetResponseEnvelope struct { - Errors []SettingRocketLoaderGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingRocketLoaderGetResponseEnvelopeMessages `json:"messages,required"` +type ZoneSettingRocketLoaderGetResponseEnvelope struct { + Errors []ZoneSettingRocketLoaderGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingRocketLoaderGetResponseEnvelopeMessages `json:"messages,required"` // Whether the API call was successful Success bool `json:"success,required"` // Rocket Loader is a general-purpose asynchronous JavaScript optimisation that @@ -357,13 +357,13 @@ type SettingRocketLoaderGetResponseEnvelope struct { // with no configuration required. Refer to // [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) // for more information. - Result SettingRocketLoaderGetResponse `json:"result"` - JSON settingRocketLoaderGetResponseEnvelopeJSON `json:"-"` + Result ZoneSettingRocketLoaderGetResponse `json:"result"` + JSON zoneSettingRocketLoaderGetResponseEnvelopeJSON `json:"-"` } -// settingRocketLoaderGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [SettingRocketLoaderGetResponseEnvelope] -type settingRocketLoaderGetResponseEnvelopeJSON struct { +// zoneSettingRocketLoaderGetResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingRocketLoaderGetResponseEnvelope] +type zoneSettingRocketLoaderGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field Success apijson.Field @@ -372,44 +372,44 @@ type settingRocketLoaderGetResponseEnvelopeJSON struct { ExtraFields map[string]apijson.Field } -func (r *SettingRocketLoaderGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingRocketLoaderGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type SettingRocketLoaderGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingRocketLoaderGetResponseEnvelopeErrorsJSON `json:"-"` +type ZoneSettingRocketLoaderGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingRocketLoaderGetResponseEnvelopeErrorsJSON `json:"-"` } -// settingRocketLoaderGetResponseEnvelopeErrorsJSON contains the JSON metadata for -// the struct [SettingRocketLoaderGetResponseEnvelopeErrors] -type settingRocketLoaderGetResponseEnvelopeErrorsJSON struct { +// zoneSettingRocketLoaderGetResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [ZoneSettingRocketLoaderGetResponseEnvelopeErrors] +type zoneSettingRocketLoaderGetResponseEnvelopeErrorsJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *SettingRocketLoaderGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingRocketLoaderGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type SettingRocketLoaderGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingRocketLoaderGetResponseEnvelopeMessagesJSON `json:"-"` +type ZoneSettingRocketLoaderGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingRocketLoaderGetResponseEnvelopeMessagesJSON `json:"-"` } -// settingRocketLoaderGetResponseEnvelopeMessagesJSON contains the JSON metadata -// for the struct [SettingRocketLoaderGetResponseEnvelopeMessages] -type settingRocketLoaderGetResponseEnvelopeMessagesJSON struct { +// zoneSettingRocketLoaderGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingRocketLoaderGetResponseEnvelopeMessages] +type zoneSettingRocketLoaderGetResponseEnvelopeMessagesJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *SettingRocketLoaderGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingRocketLoaderGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } diff --git a/settingh2prioritization_test.go b/zonesettingrocketloader_test.go similarity index 79% rename from settingh2prioritization_test.go rename to zonesettingrocketloader_test.go index 79130d95efe..7764d706624 100644 --- a/settingh2prioritization_test.go +++ b/zonesettingrocketloader_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingH2PrioritizationEditWithOptionalParams(t *testing.T) { +func TestZoneSettingRocketLoaderEditWithOptionalParams(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 { @@ -29,11 +29,11 @@ func TestSettingH2PrioritizationEditWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.H2Prioritization.Edit(context.TODO(), cloudflare.SettingH2PrioritizationEditParams{ + _, err := client.Zones.Settings.RocketLoader.Edit(context.TODO(), cloudflare.ZoneSettingRocketLoaderEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingH2PrioritizationEditParamsValue{ - ID: cloudflare.F(cloudflare.SettingH2PrioritizationEditParamsValueIDH2Prioritization), - Value: cloudflare.F(cloudflare.SettingH2PrioritizationEditParamsValueValueOn), + Value: cloudflare.F(cloudflare.ZoneSettingRocketLoaderEditParamsValue{ + ID: cloudflare.F(cloudflare.ZoneSettingRocketLoaderEditParamsValueIDRocketLoader), + Value: cloudflare.F(cloudflare.ZoneSettingRocketLoaderEditParamsValueValueOn), }), }) if err != nil { @@ -45,7 +45,7 @@ func TestSettingH2PrioritizationEditWithOptionalParams(t *testing.T) { } } -func TestSettingH2PrioritizationGet(t *testing.T) { +func TestZoneSettingRocketLoaderGet(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 { @@ -61,7 +61,7 @@ func TestSettingH2PrioritizationGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.H2Prioritization.Get(context.TODO(), cloudflare.SettingH2PrioritizationGetParams{ + _, err := client.Zones.Settings.RocketLoader.Get(context.TODO(), cloudflare.ZoneSettingRocketLoaderGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingsecurityheader.go b/zonesettingsecurityheader.go new file mode 100644 index 00000000000..6b894853af7 --- /dev/null +++ b/zonesettingsecurityheader.go @@ -0,0 +1,411 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingSecurityHeaderService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewZoneSettingSecurityHeaderService] method instead. +type ZoneSettingSecurityHeaderService struct { + Options []option.RequestOption +} + +// NewZoneSettingSecurityHeaderService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewZoneSettingSecurityHeaderService(opts ...option.RequestOption) (r *ZoneSettingSecurityHeaderService) { + r = &ZoneSettingSecurityHeaderService{} + r.Options = opts + return +} + +// Cloudflare security header for a zone. +func (r *ZoneSettingSecurityHeaderService) Edit(ctx context.Context, params ZoneSettingSecurityHeaderEditParams, opts ...option.RequestOption) (res *ZoneSettingSecurityHeaderEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingSecurityHeaderEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/security_header", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Cloudflare security header for a zone. +func (r *ZoneSettingSecurityHeaderService) Get(ctx context.Context, query ZoneSettingSecurityHeaderGetParams, opts ...option.RequestOption) (res *ZoneSettingSecurityHeaderGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingSecurityHeaderGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/security_header", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Cloudflare security header for a zone. +type ZoneSettingSecurityHeaderEditResponse struct { + // ID of the zone's security header. + ID ZoneSettingSecurityHeaderEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingSecurityHeaderEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingSecurityHeaderEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingSecurityHeaderEditResponseJSON `json:"-"` +} + +// zoneSettingSecurityHeaderEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingSecurityHeaderEditResponse] +type zoneSettingSecurityHeaderEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSecurityHeaderEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone's security header. +type ZoneSettingSecurityHeaderEditResponseID string + +const ( + ZoneSettingSecurityHeaderEditResponseIDSecurityHeader ZoneSettingSecurityHeaderEditResponseID = "security_header" +) + +// Current value of the zone setting. +type ZoneSettingSecurityHeaderEditResponseValue struct { + // Strict Transport Security. + StrictTransportSecurity ZoneSettingSecurityHeaderEditResponseValueStrictTransportSecurity `json:"strict_transport_security"` + JSON zoneSettingSecurityHeaderEditResponseValueJSON `json:"-"` +} + +// zoneSettingSecurityHeaderEditResponseValueJSON contains the JSON metadata for +// the struct [ZoneSettingSecurityHeaderEditResponseValue] +type zoneSettingSecurityHeaderEditResponseValueJSON struct { + StrictTransportSecurity apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSecurityHeaderEditResponseValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Strict Transport Security. +type ZoneSettingSecurityHeaderEditResponseValueStrictTransportSecurity struct { + // Whether or not strict transport security is enabled. + Enabled bool `json:"enabled"` + // Include all subdomains for strict transport security. + IncludeSubdomains bool `json:"include_subdomains"` + // Max age in seconds of the strict transport security. + MaxAge float64 `json:"max_age"` + // Whether or not to include 'X-Content-Type-Options: nosniff' header. + Nosniff bool `json:"nosniff"` + JSON zoneSettingSecurityHeaderEditResponseValueStrictTransportSecurityJSON `json:"-"` +} + +// zoneSettingSecurityHeaderEditResponseValueStrictTransportSecurityJSON contains +// the JSON metadata for the struct +// [ZoneSettingSecurityHeaderEditResponseValueStrictTransportSecurity] +type zoneSettingSecurityHeaderEditResponseValueStrictTransportSecurityJSON struct { + Enabled apijson.Field + IncludeSubdomains apijson.Field + MaxAge apijson.Field + Nosniff apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSecurityHeaderEditResponseValueStrictTransportSecurity) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingSecurityHeaderEditResponseEditable bool + +const ( + ZoneSettingSecurityHeaderEditResponseEditableTrue ZoneSettingSecurityHeaderEditResponseEditable = true + ZoneSettingSecurityHeaderEditResponseEditableFalse ZoneSettingSecurityHeaderEditResponseEditable = false +) + +// Cloudflare security header for a zone. +type ZoneSettingSecurityHeaderGetResponse struct { + // ID of the zone's security header. + ID ZoneSettingSecurityHeaderGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingSecurityHeaderGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingSecurityHeaderGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingSecurityHeaderGetResponseJSON `json:"-"` +} + +// zoneSettingSecurityHeaderGetResponseJSON contains the JSON metadata for the +// struct [ZoneSettingSecurityHeaderGetResponse] +type zoneSettingSecurityHeaderGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSecurityHeaderGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone's security header. +type ZoneSettingSecurityHeaderGetResponseID string + +const ( + ZoneSettingSecurityHeaderGetResponseIDSecurityHeader ZoneSettingSecurityHeaderGetResponseID = "security_header" +) + +// Current value of the zone setting. +type ZoneSettingSecurityHeaderGetResponseValue struct { + // Strict Transport Security. + StrictTransportSecurity ZoneSettingSecurityHeaderGetResponseValueStrictTransportSecurity `json:"strict_transport_security"` + JSON zoneSettingSecurityHeaderGetResponseValueJSON `json:"-"` +} + +// zoneSettingSecurityHeaderGetResponseValueJSON contains the JSON metadata for the +// struct [ZoneSettingSecurityHeaderGetResponseValue] +type zoneSettingSecurityHeaderGetResponseValueJSON struct { + StrictTransportSecurity apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSecurityHeaderGetResponseValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Strict Transport Security. +type ZoneSettingSecurityHeaderGetResponseValueStrictTransportSecurity struct { + // Whether or not strict transport security is enabled. + Enabled bool `json:"enabled"` + // Include all subdomains for strict transport security. + IncludeSubdomains bool `json:"include_subdomains"` + // Max age in seconds of the strict transport security. + MaxAge float64 `json:"max_age"` + // Whether or not to include 'X-Content-Type-Options: nosniff' header. + Nosniff bool `json:"nosniff"` + JSON zoneSettingSecurityHeaderGetResponseValueStrictTransportSecurityJSON `json:"-"` +} + +// zoneSettingSecurityHeaderGetResponseValueStrictTransportSecurityJSON contains +// the JSON metadata for the struct +// [ZoneSettingSecurityHeaderGetResponseValueStrictTransportSecurity] +type zoneSettingSecurityHeaderGetResponseValueStrictTransportSecurityJSON struct { + Enabled apijson.Field + IncludeSubdomains apijson.Field + MaxAge apijson.Field + Nosniff apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSecurityHeaderGetResponseValueStrictTransportSecurity) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingSecurityHeaderGetResponseEditable bool + +const ( + ZoneSettingSecurityHeaderGetResponseEditableTrue ZoneSettingSecurityHeaderGetResponseEditable = true + ZoneSettingSecurityHeaderGetResponseEditableFalse ZoneSettingSecurityHeaderGetResponseEditable = false +) + +type ZoneSettingSecurityHeaderEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + Value param.Field[ZoneSettingSecurityHeaderEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingSecurityHeaderEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneSettingSecurityHeaderEditParamsValue struct { + // Strict Transport Security. + StrictTransportSecurity param.Field[ZoneSettingSecurityHeaderEditParamsValueStrictTransportSecurity] `json:"strict_transport_security"` +} + +func (r ZoneSettingSecurityHeaderEditParamsValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Strict Transport Security. +type ZoneSettingSecurityHeaderEditParamsValueStrictTransportSecurity struct { + // Whether or not strict transport security is enabled. + Enabled param.Field[bool] `json:"enabled"` + // Include all subdomains for strict transport security. + IncludeSubdomains param.Field[bool] `json:"include_subdomains"` + // Max age in seconds of the strict transport security. + MaxAge param.Field[float64] `json:"max_age"` + // Whether or not to include 'X-Content-Type-Options: nosniff' header. + Nosniff param.Field[bool] `json:"nosniff"` +} + +func (r ZoneSettingSecurityHeaderEditParamsValueStrictTransportSecurity) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ZoneSettingSecurityHeaderEditResponseEnvelope struct { + Errors []ZoneSettingSecurityHeaderEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingSecurityHeaderEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Cloudflare security header for a zone. + Result ZoneSettingSecurityHeaderEditResponse `json:"result"` + JSON zoneSettingSecurityHeaderEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingSecurityHeaderEditResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingSecurityHeaderEditResponseEnvelope] +type zoneSettingSecurityHeaderEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSecurityHeaderEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingSecurityHeaderEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingSecurityHeaderEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingSecurityHeaderEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingSecurityHeaderEditResponseEnvelopeErrors] +type zoneSettingSecurityHeaderEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSecurityHeaderEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingSecurityHeaderEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingSecurityHeaderEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingSecurityHeaderEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingSecurityHeaderEditResponseEnvelopeMessages] +type zoneSettingSecurityHeaderEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSecurityHeaderEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingSecurityHeaderGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingSecurityHeaderGetResponseEnvelope struct { + Errors []ZoneSettingSecurityHeaderGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingSecurityHeaderGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Cloudflare security header for a zone. + Result ZoneSettingSecurityHeaderGetResponse `json:"result"` + JSON zoneSettingSecurityHeaderGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingSecurityHeaderGetResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingSecurityHeaderGetResponseEnvelope] +type zoneSettingSecurityHeaderGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSecurityHeaderGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingSecurityHeaderGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingSecurityHeaderGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingSecurityHeaderGetResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingSecurityHeaderGetResponseEnvelopeErrors] +type zoneSettingSecurityHeaderGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSecurityHeaderGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingSecurityHeaderGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingSecurityHeaderGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingSecurityHeaderGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingSecurityHeaderGetResponseEnvelopeMessages] +type zoneSettingSecurityHeaderGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSecurityHeaderGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingsecurityheader_test.go b/zonesettingsecurityheader_test.go similarity index 80% rename from settingsecurityheader_test.go rename to zonesettingsecurityheader_test.go index 182337e9a5d..e021fb98efb 100644 --- a/settingsecurityheader_test.go +++ b/zonesettingsecurityheader_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingSecurityHeaderEditWithOptionalParams(t *testing.T) { +func TestZoneSettingSecurityHeaderEditWithOptionalParams(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 { @@ -29,10 +29,10 @@ func TestSettingSecurityHeaderEditWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.SecurityHeaders.Edit(context.TODO(), cloudflare.SettingSecurityHeaderEditParams{ + _, err := client.Zones.Settings.SecurityHeaders.Edit(context.TODO(), cloudflare.ZoneSettingSecurityHeaderEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingSecurityHeaderEditParamsValue{ - StrictTransportSecurity: cloudflare.F(cloudflare.SettingSecurityHeaderEditParamsValueStrictTransportSecurity{ + Value: cloudflare.F(cloudflare.ZoneSettingSecurityHeaderEditParamsValue{ + StrictTransportSecurity: cloudflare.F(cloudflare.ZoneSettingSecurityHeaderEditParamsValueStrictTransportSecurity{ Enabled: cloudflare.F(true), IncludeSubdomains: cloudflare.F(true), MaxAge: cloudflare.F(86400.000000), @@ -49,7 +49,7 @@ func TestSettingSecurityHeaderEditWithOptionalParams(t *testing.T) { } } -func TestSettingSecurityHeaderGet(t *testing.T) { +func TestZoneSettingSecurityHeaderGet(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 { @@ -65,7 +65,7 @@ func TestSettingSecurityHeaderGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.SecurityHeaders.Get(context.TODO(), cloudflare.SettingSecurityHeaderGetParams{ + _, err := client.Zones.Settings.SecurityHeaders.Get(context.TODO(), cloudflare.ZoneSettingSecurityHeaderGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingsecuritylevel.go b/zonesettingsecuritylevel.go new file mode 100644 index 00000000000..99bd8475022 --- /dev/null +++ b/zonesettingsecuritylevel.go @@ -0,0 +1,345 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingSecurityLevelService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewZoneSettingSecurityLevelService] method instead. +type ZoneSettingSecurityLevelService struct { + Options []option.RequestOption +} + +// NewZoneSettingSecurityLevelService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewZoneSettingSecurityLevelService(opts ...option.RequestOption) (r *ZoneSettingSecurityLevelService) { + r = &ZoneSettingSecurityLevelService{} + r.Options = opts + return +} + +// Choose the appropriate security profile for your website, which will +// automatically adjust each of the security settings. If you choose to customize +// an individual security setting, the profile will become Custom. +// (https://support.cloudflare.com/hc/en-us/articles/200170056). +func (r *ZoneSettingSecurityLevelService) Edit(ctx context.Context, params ZoneSettingSecurityLevelEditParams, opts ...option.RequestOption) (res *ZoneSettingSecurityLevelEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingSecurityLevelEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/security_level", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Choose the appropriate security profile for your website, which will +// automatically adjust each of the security settings. If you choose to customize +// an individual security setting, the profile will become Custom. +// (https://support.cloudflare.com/hc/en-us/articles/200170056). +func (r *ZoneSettingSecurityLevelService) Get(ctx context.Context, query ZoneSettingSecurityLevelGetParams, opts ...option.RequestOption) (res *ZoneSettingSecurityLevelGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingSecurityLevelGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/security_level", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Choose the appropriate security profile for your website, which will +// automatically adjust each of the security settings. If you choose to customize +// an individual security setting, the profile will become Custom. +// (https://support.cloudflare.com/hc/en-us/articles/200170056). +type ZoneSettingSecurityLevelEditResponse struct { + // ID of the zone setting. + ID ZoneSettingSecurityLevelEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingSecurityLevelEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingSecurityLevelEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingSecurityLevelEditResponseJSON `json:"-"` +} + +// zoneSettingSecurityLevelEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingSecurityLevelEditResponse] +type zoneSettingSecurityLevelEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSecurityLevelEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingSecurityLevelEditResponseID string + +const ( + ZoneSettingSecurityLevelEditResponseIDSecurityLevel ZoneSettingSecurityLevelEditResponseID = "security_level" +) + +// Current value of the zone setting. +type ZoneSettingSecurityLevelEditResponseValue string + +const ( + ZoneSettingSecurityLevelEditResponseValueOff ZoneSettingSecurityLevelEditResponseValue = "off" + ZoneSettingSecurityLevelEditResponseValueEssentiallyOff ZoneSettingSecurityLevelEditResponseValue = "essentially_off" + ZoneSettingSecurityLevelEditResponseValueLow ZoneSettingSecurityLevelEditResponseValue = "low" + ZoneSettingSecurityLevelEditResponseValueMedium ZoneSettingSecurityLevelEditResponseValue = "medium" + ZoneSettingSecurityLevelEditResponseValueHigh ZoneSettingSecurityLevelEditResponseValue = "high" + ZoneSettingSecurityLevelEditResponseValueUnderAttack ZoneSettingSecurityLevelEditResponseValue = "under_attack" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingSecurityLevelEditResponseEditable bool + +const ( + ZoneSettingSecurityLevelEditResponseEditableTrue ZoneSettingSecurityLevelEditResponseEditable = true + ZoneSettingSecurityLevelEditResponseEditableFalse ZoneSettingSecurityLevelEditResponseEditable = false +) + +// Choose the appropriate security profile for your website, which will +// automatically adjust each of the security settings. If you choose to customize +// an individual security setting, the profile will become Custom. +// (https://support.cloudflare.com/hc/en-us/articles/200170056). +type ZoneSettingSecurityLevelGetResponse struct { + // ID of the zone setting. + ID ZoneSettingSecurityLevelGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingSecurityLevelGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingSecurityLevelGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingSecurityLevelGetResponseJSON `json:"-"` +} + +// zoneSettingSecurityLevelGetResponseJSON contains the JSON metadata for the +// struct [ZoneSettingSecurityLevelGetResponse] +type zoneSettingSecurityLevelGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSecurityLevelGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingSecurityLevelGetResponseID string + +const ( + ZoneSettingSecurityLevelGetResponseIDSecurityLevel ZoneSettingSecurityLevelGetResponseID = "security_level" +) + +// Current value of the zone setting. +type ZoneSettingSecurityLevelGetResponseValue string + +const ( + ZoneSettingSecurityLevelGetResponseValueOff ZoneSettingSecurityLevelGetResponseValue = "off" + ZoneSettingSecurityLevelGetResponseValueEssentiallyOff ZoneSettingSecurityLevelGetResponseValue = "essentially_off" + ZoneSettingSecurityLevelGetResponseValueLow ZoneSettingSecurityLevelGetResponseValue = "low" + ZoneSettingSecurityLevelGetResponseValueMedium ZoneSettingSecurityLevelGetResponseValue = "medium" + ZoneSettingSecurityLevelGetResponseValueHigh ZoneSettingSecurityLevelGetResponseValue = "high" + ZoneSettingSecurityLevelGetResponseValueUnderAttack ZoneSettingSecurityLevelGetResponseValue = "under_attack" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingSecurityLevelGetResponseEditable bool + +const ( + ZoneSettingSecurityLevelGetResponseEditableTrue ZoneSettingSecurityLevelGetResponseEditable = true + ZoneSettingSecurityLevelGetResponseEditableFalse ZoneSettingSecurityLevelGetResponseEditable = false +) + +type ZoneSettingSecurityLevelEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingSecurityLevelEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingSecurityLevelEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingSecurityLevelEditParamsValue string + +const ( + ZoneSettingSecurityLevelEditParamsValueOff ZoneSettingSecurityLevelEditParamsValue = "off" + ZoneSettingSecurityLevelEditParamsValueEssentiallyOff ZoneSettingSecurityLevelEditParamsValue = "essentially_off" + ZoneSettingSecurityLevelEditParamsValueLow ZoneSettingSecurityLevelEditParamsValue = "low" + ZoneSettingSecurityLevelEditParamsValueMedium ZoneSettingSecurityLevelEditParamsValue = "medium" + ZoneSettingSecurityLevelEditParamsValueHigh ZoneSettingSecurityLevelEditParamsValue = "high" + ZoneSettingSecurityLevelEditParamsValueUnderAttack ZoneSettingSecurityLevelEditParamsValue = "under_attack" +) + +type ZoneSettingSecurityLevelEditResponseEnvelope struct { + Errors []ZoneSettingSecurityLevelEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingSecurityLevelEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Choose the appropriate security profile for your website, which will + // automatically adjust each of the security settings. If you choose to customize + // an individual security setting, the profile will become Custom. + // (https://support.cloudflare.com/hc/en-us/articles/200170056). + Result ZoneSettingSecurityLevelEditResponse `json:"result"` + JSON zoneSettingSecurityLevelEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingSecurityLevelEditResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingSecurityLevelEditResponseEnvelope] +type zoneSettingSecurityLevelEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSecurityLevelEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingSecurityLevelEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingSecurityLevelEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingSecurityLevelEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingSecurityLevelEditResponseEnvelopeErrors] +type zoneSettingSecurityLevelEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSecurityLevelEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingSecurityLevelEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingSecurityLevelEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingSecurityLevelEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingSecurityLevelEditResponseEnvelopeMessages] +type zoneSettingSecurityLevelEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSecurityLevelEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingSecurityLevelGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingSecurityLevelGetResponseEnvelope struct { + Errors []ZoneSettingSecurityLevelGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingSecurityLevelGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Choose the appropriate security profile for your website, which will + // automatically adjust each of the security settings. If you choose to customize + // an individual security setting, the profile will become Custom. + // (https://support.cloudflare.com/hc/en-us/articles/200170056). + Result ZoneSettingSecurityLevelGetResponse `json:"result"` + JSON zoneSettingSecurityLevelGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingSecurityLevelGetResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingSecurityLevelGetResponseEnvelope] +type zoneSettingSecurityLevelGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSecurityLevelGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingSecurityLevelGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingSecurityLevelGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingSecurityLevelGetResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [ZoneSettingSecurityLevelGetResponseEnvelopeErrors] +type zoneSettingSecurityLevelGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSecurityLevelGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingSecurityLevelGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingSecurityLevelGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingSecurityLevelGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingSecurityLevelGetResponseEnvelopeMessages] +type zoneSettingSecurityLevelGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSecurityLevelGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/zonesettingsecuritylevel_test.go b/zonesettingsecuritylevel_test.go new file mode 100644 index 00000000000..c19d4a0b73f --- /dev/null +++ b/zonesettingsecuritylevel_test.go @@ -0,0 +1,71 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingSecurityLevelEdit(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.SecurityLevel.Edit(context.TODO(), cloudflare.ZoneSettingSecurityLevelEditParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Value: cloudflare.F(cloudflare.ZoneSettingSecurityLevelEditParamsValueOff), + }) + 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 TestZoneSettingSecurityLevelGet(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.SecurityLevel.Get(context.TODO(), cloudflare.ZoneSettingSecurityLevelGetParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/settingserversideexclude.go b/zonesettingserversideexclude.go similarity index 52% rename from settingserversideexclude.go rename to zonesettingserversideexclude.go index def76cf7e89..87192582df4 100644 --- a/settingserversideexclude.go +++ b/zonesettingserversideexclude.go @@ -14,20 +14,20 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -// SettingServerSideExcludeService contains methods and other services that help -// with interacting with the cloudflare API. Note, unlike clients, this service -// does not read variables from the environment automatically. You should not -// instantiate this service directly, and instead use the -// [NewSettingServerSideExcludeService] method instead. -type SettingServerSideExcludeService struct { +// ZoneSettingServerSideExcludeService contains methods and other services that +// help with interacting with the cloudflare API. Note, unlike clients, this +// service does not read variables from the environment automatically. You should +// not instantiate this service directly, and instead use the +// [NewZoneSettingServerSideExcludeService] method instead. +type ZoneSettingServerSideExcludeService struct { Options []option.RequestOption } -// NewSettingServerSideExcludeService generates a new service that applies the +// NewZoneSettingServerSideExcludeService generates a new service that applies the // given options to each request. These options are applied after the parent // client's options (if there is one), and before any request-specific options. -func NewSettingServerSideExcludeService(opts ...option.RequestOption) (r *SettingServerSideExcludeService) { - r = &SettingServerSideExcludeService{} +func NewZoneSettingServerSideExcludeService(opts ...option.RequestOption) (r *ZoneSettingServerSideExcludeService) { + r = &ZoneSettingServerSideExcludeService{} r.Options = opts return } @@ -43,9 +43,9 @@ func NewSettingServerSideExcludeService(opts ...option.RequestOption) (r *Settin // Cloudflare's HTML minification and SSE functionality occur on-the-fly as the // resource moves through our network to the visitor's computer. // (https://support.cloudflare.com/hc/en-us/articles/200170036). -func (r *SettingServerSideExcludeService) Edit(ctx context.Context, params SettingServerSideExcludeEditParams, opts ...option.RequestOption) (res *SettingServerSideExcludeEditResponse, err error) { +func (r *ZoneSettingServerSideExcludeService) Edit(ctx context.Context, params ZoneSettingServerSideExcludeEditParams, opts ...option.RequestOption) (res *ZoneSettingServerSideExcludeEditResponse, err error) { opts = append(r.Options[:], opts...) - var env SettingServerSideExcludeEditResponseEnvelope + var env ZoneSettingServerSideExcludeEditResponseEnvelope path := fmt.Sprintf("zones/%s/settings/server_side_exclude", params.ZoneID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) if err != nil { @@ -66,9 +66,9 @@ func (r *SettingServerSideExcludeService) Edit(ctx context.Context, params Setti // Cloudflare's HTML minification and SSE functionality occur on-the-fly as the // resource moves through our network to the visitor's computer. // (https://support.cloudflare.com/hc/en-us/articles/200170036). -func (r *SettingServerSideExcludeService) Get(ctx context.Context, query SettingServerSideExcludeGetParams, opts ...option.RequestOption) (res *SettingServerSideExcludeGetResponse, err error) { +func (r *ZoneSettingServerSideExcludeService) Get(ctx context.Context, query ZoneSettingServerSideExcludeGetParams, opts ...option.RequestOption) (res *ZoneSettingServerSideExcludeGetResponse, err error) { opts = append(r.Options[:], opts...) - var env SettingServerSideExcludeGetResponseEnvelope + var env ZoneSettingServerSideExcludeGetResponseEnvelope path := fmt.Sprintf("zones/%s/settings/server_side_exclude", query.ZoneID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) if err != nil { @@ -89,22 +89,22 @@ func (r *SettingServerSideExcludeService) Get(ctx context.Context, query Setting // Cloudflare's HTML minification and SSE functionality occur on-the-fly as the // resource moves through our network to the visitor's computer. // (https://support.cloudflare.com/hc/en-us/articles/200170036). -type SettingServerSideExcludeEditResponse struct { +type ZoneSettingServerSideExcludeEditResponse struct { // ID of the zone setting. - ID SettingServerSideExcludeEditResponseID `json:"id,required"` + ID ZoneSettingServerSideExcludeEditResponseID `json:"id,required"` // Current value of the zone setting. - Value SettingServerSideExcludeEditResponseValue `json:"value,required"` + Value ZoneSettingServerSideExcludeEditResponseValue `json:"value,required"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable SettingServerSideExcludeEditResponseEditable `json:"editable"` + Editable ZoneSettingServerSideExcludeEditResponseEditable `json:"editable"` // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingServerSideExcludeEditResponseJSON `json:"-"` + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingServerSideExcludeEditResponseJSON `json:"-"` } -// settingServerSideExcludeEditResponseJSON contains the JSON metadata for the -// struct [SettingServerSideExcludeEditResponse] -type settingServerSideExcludeEditResponseJSON struct { +// zoneSettingServerSideExcludeEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingServerSideExcludeEditResponse] +type zoneSettingServerSideExcludeEditResponseJSON struct { ID apijson.Field Value apijson.Field Editable apijson.Field @@ -113,32 +113,32 @@ type settingServerSideExcludeEditResponseJSON struct { ExtraFields map[string]apijson.Field } -func (r *SettingServerSideExcludeEditResponse) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingServerSideExcludeEditResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // ID of the zone setting. -type SettingServerSideExcludeEditResponseID string +type ZoneSettingServerSideExcludeEditResponseID string const ( - SettingServerSideExcludeEditResponseIDServerSideExclude SettingServerSideExcludeEditResponseID = "server_side_exclude" + ZoneSettingServerSideExcludeEditResponseIDServerSideExclude ZoneSettingServerSideExcludeEditResponseID = "server_side_exclude" ) // Current value of the zone setting. -type SettingServerSideExcludeEditResponseValue string +type ZoneSettingServerSideExcludeEditResponseValue string const ( - SettingServerSideExcludeEditResponseValueOn SettingServerSideExcludeEditResponseValue = "on" - SettingServerSideExcludeEditResponseValueOff SettingServerSideExcludeEditResponseValue = "off" + ZoneSettingServerSideExcludeEditResponseValueOn ZoneSettingServerSideExcludeEditResponseValue = "on" + ZoneSettingServerSideExcludeEditResponseValueOff ZoneSettingServerSideExcludeEditResponseValue = "off" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type SettingServerSideExcludeEditResponseEditable bool +type ZoneSettingServerSideExcludeEditResponseEditable bool const ( - SettingServerSideExcludeEditResponseEditableTrue SettingServerSideExcludeEditResponseEditable = true - SettingServerSideExcludeEditResponseEditableFalse SettingServerSideExcludeEditResponseEditable = false + ZoneSettingServerSideExcludeEditResponseEditableTrue ZoneSettingServerSideExcludeEditResponseEditable = true + ZoneSettingServerSideExcludeEditResponseEditableFalse ZoneSettingServerSideExcludeEditResponseEditable = false ) // If there is sensitive content on your website that you want visible to real @@ -152,22 +152,22 @@ const ( // Cloudflare's HTML minification and SSE functionality occur on-the-fly as the // resource moves through our network to the visitor's computer. // (https://support.cloudflare.com/hc/en-us/articles/200170036). -type SettingServerSideExcludeGetResponse struct { +type ZoneSettingServerSideExcludeGetResponse struct { // ID of the zone setting. - ID SettingServerSideExcludeGetResponseID `json:"id,required"` + ID ZoneSettingServerSideExcludeGetResponseID `json:"id,required"` // Current value of the zone setting. - Value SettingServerSideExcludeGetResponseValue `json:"value,required"` + Value ZoneSettingServerSideExcludeGetResponseValue `json:"value,required"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable SettingServerSideExcludeGetResponseEditable `json:"editable"` + Editable ZoneSettingServerSideExcludeGetResponseEditable `json:"editable"` // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingServerSideExcludeGetResponseJSON `json:"-"` + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingServerSideExcludeGetResponseJSON `json:"-"` } -// settingServerSideExcludeGetResponseJSON contains the JSON metadata for the -// struct [SettingServerSideExcludeGetResponse] -type settingServerSideExcludeGetResponseJSON struct { +// zoneSettingServerSideExcludeGetResponseJSON contains the JSON metadata for the +// struct [ZoneSettingServerSideExcludeGetResponse] +type zoneSettingServerSideExcludeGetResponseJSON struct { ID apijson.Field Value apijson.Field Editable apijson.Field @@ -176,56 +176,56 @@ type settingServerSideExcludeGetResponseJSON struct { ExtraFields map[string]apijson.Field } -func (r *SettingServerSideExcludeGetResponse) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingServerSideExcludeGetResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // ID of the zone setting. -type SettingServerSideExcludeGetResponseID string +type ZoneSettingServerSideExcludeGetResponseID string const ( - SettingServerSideExcludeGetResponseIDServerSideExclude SettingServerSideExcludeGetResponseID = "server_side_exclude" + ZoneSettingServerSideExcludeGetResponseIDServerSideExclude ZoneSettingServerSideExcludeGetResponseID = "server_side_exclude" ) // Current value of the zone setting. -type SettingServerSideExcludeGetResponseValue string +type ZoneSettingServerSideExcludeGetResponseValue string const ( - SettingServerSideExcludeGetResponseValueOn SettingServerSideExcludeGetResponseValue = "on" - SettingServerSideExcludeGetResponseValueOff SettingServerSideExcludeGetResponseValue = "off" + ZoneSettingServerSideExcludeGetResponseValueOn ZoneSettingServerSideExcludeGetResponseValue = "on" + ZoneSettingServerSideExcludeGetResponseValueOff ZoneSettingServerSideExcludeGetResponseValue = "off" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type SettingServerSideExcludeGetResponseEditable bool +type ZoneSettingServerSideExcludeGetResponseEditable bool const ( - SettingServerSideExcludeGetResponseEditableTrue SettingServerSideExcludeGetResponseEditable = true - SettingServerSideExcludeGetResponseEditableFalse SettingServerSideExcludeGetResponseEditable = false + ZoneSettingServerSideExcludeGetResponseEditableTrue ZoneSettingServerSideExcludeGetResponseEditable = true + ZoneSettingServerSideExcludeGetResponseEditableFalse ZoneSettingServerSideExcludeGetResponseEditable = false ) -type SettingServerSideExcludeEditParams struct { +type ZoneSettingServerSideExcludeEditParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` // Value of the zone setting. - Value param.Field[SettingServerSideExcludeEditParamsValue] `json:"value,required"` + Value param.Field[ZoneSettingServerSideExcludeEditParamsValue] `json:"value,required"` } -func (r SettingServerSideExcludeEditParams) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingServerSideExcludeEditParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Value of the zone setting. -type SettingServerSideExcludeEditParamsValue string +type ZoneSettingServerSideExcludeEditParamsValue string const ( - SettingServerSideExcludeEditParamsValueOn SettingServerSideExcludeEditParamsValue = "on" - SettingServerSideExcludeEditParamsValueOff SettingServerSideExcludeEditParamsValue = "off" + ZoneSettingServerSideExcludeEditParamsValueOn ZoneSettingServerSideExcludeEditParamsValue = "on" + ZoneSettingServerSideExcludeEditParamsValueOff ZoneSettingServerSideExcludeEditParamsValue = "off" ) -type SettingServerSideExcludeEditResponseEnvelope struct { - Errors []SettingServerSideExcludeEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingServerSideExcludeEditResponseEnvelopeMessages `json:"messages,required"` +type ZoneSettingServerSideExcludeEditResponseEnvelope struct { + Errors []ZoneSettingServerSideExcludeEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingServerSideExcludeEditResponseEnvelopeMessages `json:"messages,required"` // Whether the API call was successful Success bool `json:"success,required"` // If there is sensitive content on your website that you want visible to real @@ -239,13 +239,13 @@ type SettingServerSideExcludeEditResponseEnvelope struct { // Cloudflare's HTML minification and SSE functionality occur on-the-fly as the // resource moves through our network to the visitor's computer. // (https://support.cloudflare.com/hc/en-us/articles/200170036). - Result SettingServerSideExcludeEditResponse `json:"result"` - JSON settingServerSideExcludeEditResponseEnvelopeJSON `json:"-"` + Result ZoneSettingServerSideExcludeEditResponse `json:"result"` + JSON zoneSettingServerSideExcludeEditResponseEnvelopeJSON `json:"-"` } -// settingServerSideExcludeEditResponseEnvelopeJSON contains the JSON metadata for -// the struct [SettingServerSideExcludeEditResponseEnvelope] -type settingServerSideExcludeEditResponseEnvelopeJSON struct { +// zoneSettingServerSideExcludeEditResponseEnvelopeJSON contains the JSON metadata +// for the struct [ZoneSettingServerSideExcludeEditResponseEnvelope] +type zoneSettingServerSideExcludeEditResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field Success apijson.Field @@ -254,56 +254,57 @@ type settingServerSideExcludeEditResponseEnvelopeJSON struct { ExtraFields map[string]apijson.Field } -func (r *SettingServerSideExcludeEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingServerSideExcludeEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type SettingServerSideExcludeEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingServerSideExcludeEditResponseEnvelopeErrorsJSON `json:"-"` +type ZoneSettingServerSideExcludeEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingServerSideExcludeEditResponseEnvelopeErrorsJSON `json:"-"` } -// settingServerSideExcludeEditResponseEnvelopeErrorsJSON contains the JSON -// metadata for the struct [SettingServerSideExcludeEditResponseEnvelopeErrors] -type settingServerSideExcludeEditResponseEnvelopeErrorsJSON struct { +// zoneSettingServerSideExcludeEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingServerSideExcludeEditResponseEnvelopeErrors] +type zoneSettingServerSideExcludeEditResponseEnvelopeErrorsJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *SettingServerSideExcludeEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingServerSideExcludeEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type SettingServerSideExcludeEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingServerSideExcludeEditResponseEnvelopeMessagesJSON `json:"-"` +type ZoneSettingServerSideExcludeEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingServerSideExcludeEditResponseEnvelopeMessagesJSON `json:"-"` } -// settingServerSideExcludeEditResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [SettingServerSideExcludeEditResponseEnvelopeMessages] -type settingServerSideExcludeEditResponseEnvelopeMessagesJSON struct { +// zoneSettingServerSideExcludeEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct +// [ZoneSettingServerSideExcludeEditResponseEnvelopeMessages] +type zoneSettingServerSideExcludeEditResponseEnvelopeMessagesJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *SettingServerSideExcludeEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingServerSideExcludeEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type SettingServerSideExcludeGetParams struct { +type ZoneSettingServerSideExcludeGetParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` } -type SettingServerSideExcludeGetResponseEnvelope struct { - Errors []SettingServerSideExcludeGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingServerSideExcludeGetResponseEnvelopeMessages `json:"messages,required"` +type ZoneSettingServerSideExcludeGetResponseEnvelope struct { + Errors []ZoneSettingServerSideExcludeGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingServerSideExcludeGetResponseEnvelopeMessages `json:"messages,required"` // Whether the API call was successful Success bool `json:"success,required"` // If there is sensitive content on your website that you want visible to real @@ -317,13 +318,13 @@ type SettingServerSideExcludeGetResponseEnvelope struct { // Cloudflare's HTML minification and SSE functionality occur on-the-fly as the // resource moves through our network to the visitor's computer. // (https://support.cloudflare.com/hc/en-us/articles/200170036). - Result SettingServerSideExcludeGetResponse `json:"result"` - JSON settingServerSideExcludeGetResponseEnvelopeJSON `json:"-"` + Result ZoneSettingServerSideExcludeGetResponse `json:"result"` + JSON zoneSettingServerSideExcludeGetResponseEnvelopeJSON `json:"-"` } -// settingServerSideExcludeGetResponseEnvelopeJSON contains the JSON metadata for -// the struct [SettingServerSideExcludeGetResponseEnvelope] -type settingServerSideExcludeGetResponseEnvelopeJSON struct { +// zoneSettingServerSideExcludeGetResponseEnvelopeJSON contains the JSON metadata +// for the struct [ZoneSettingServerSideExcludeGetResponseEnvelope] +type zoneSettingServerSideExcludeGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field Success apijson.Field @@ -332,44 +333,45 @@ type settingServerSideExcludeGetResponseEnvelopeJSON struct { ExtraFields map[string]apijson.Field } -func (r *SettingServerSideExcludeGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingServerSideExcludeGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type SettingServerSideExcludeGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingServerSideExcludeGetResponseEnvelopeErrorsJSON `json:"-"` +type ZoneSettingServerSideExcludeGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingServerSideExcludeGetResponseEnvelopeErrorsJSON `json:"-"` } -// settingServerSideExcludeGetResponseEnvelopeErrorsJSON contains the JSON metadata -// for the struct [SettingServerSideExcludeGetResponseEnvelopeErrors] -type settingServerSideExcludeGetResponseEnvelopeErrorsJSON struct { +// zoneSettingServerSideExcludeGetResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingServerSideExcludeGetResponseEnvelopeErrors] +type zoneSettingServerSideExcludeGetResponseEnvelopeErrorsJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *SettingServerSideExcludeGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingServerSideExcludeGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type SettingServerSideExcludeGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingServerSideExcludeGetResponseEnvelopeMessagesJSON `json:"-"` +type ZoneSettingServerSideExcludeGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingServerSideExcludeGetResponseEnvelopeMessagesJSON `json:"-"` } -// settingServerSideExcludeGetResponseEnvelopeMessagesJSON contains the JSON -// metadata for the struct [SettingServerSideExcludeGetResponseEnvelopeMessages] -type settingServerSideExcludeGetResponseEnvelopeMessagesJSON struct { +// zoneSettingServerSideExcludeGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct +// [ZoneSettingServerSideExcludeGetResponseEnvelopeMessages] +type zoneSettingServerSideExcludeGetResponseEnvelopeMessagesJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *SettingServerSideExcludeGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingServerSideExcludeGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } diff --git a/zonesettingserversideexclude_test.go b/zonesettingserversideexclude_test.go new file mode 100644 index 00000000000..546c8032fcf --- /dev/null +++ b/zonesettingserversideexclude_test.go @@ -0,0 +1,71 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingServerSideExcludeEdit(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.ServerSideExcludes.Edit(context.TODO(), cloudflare.ZoneSettingServerSideExcludeEditParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Value: cloudflare.F(cloudflare.ZoneSettingServerSideExcludeEditParamsValueOn), + }) + 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 TestZoneSettingServerSideExcludeGet(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.ServerSideExcludes.Get(context.TODO(), cloudflare.ZoneSettingServerSideExcludeGetParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/zonesettingsortquerystringforcache.go b/zonesettingsortquerystringforcache.go new file mode 100644 index 00000000000..63be52423bd --- /dev/null +++ b/zonesettingsortquerystringforcache.go @@ -0,0 +1,332 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingSortQueryStringForCacheService contains methods and other services +// that help with interacting with the cloudflare API. Note, unlike clients, this +// service does not read variables from the environment automatically. You should +// not instantiate this service directly, and instead use the +// [NewZoneSettingSortQueryStringForCacheService] method instead. +type ZoneSettingSortQueryStringForCacheService struct { + Options []option.RequestOption +} + +// NewZoneSettingSortQueryStringForCacheService generates a new service that +// applies the given options to each request. These options are applied after the +// parent client's options (if there is one), and before any request-specific +// options. +func NewZoneSettingSortQueryStringForCacheService(opts ...option.RequestOption) (r *ZoneSettingSortQueryStringForCacheService) { + r = &ZoneSettingSortQueryStringForCacheService{} + r.Options = opts + return +} + +// Cloudflare will treat files with the same query strings as the same file in +// cache, regardless of the order of the query strings. This is limited to +// Enterprise Zones. +func (r *ZoneSettingSortQueryStringForCacheService) Edit(ctx context.Context, params ZoneSettingSortQueryStringForCacheEditParams, opts ...option.RequestOption) (res *ZoneSettingSortQueryStringForCacheEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingSortQueryStringForCacheEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/sort_query_string_for_cache", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Cloudflare will treat files with the same query strings as the same file in +// cache, regardless of the order of the query strings. This is limited to +// Enterprise Zones. +func (r *ZoneSettingSortQueryStringForCacheService) Get(ctx context.Context, query ZoneSettingSortQueryStringForCacheGetParams, opts ...option.RequestOption) (res *ZoneSettingSortQueryStringForCacheGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingSortQueryStringForCacheGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/sort_query_string_for_cache", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Cloudflare will treat files with the same query strings as the same file in +// cache, regardless of the order of the query strings. This is limited to +// Enterprise Zones. +type ZoneSettingSortQueryStringForCacheEditResponse struct { + // ID of the zone setting. + ID ZoneSettingSortQueryStringForCacheEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingSortQueryStringForCacheEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingSortQueryStringForCacheEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingSortQueryStringForCacheEditResponseJSON `json:"-"` +} + +// zoneSettingSortQueryStringForCacheEditResponseJSON contains the JSON metadata +// for the struct [ZoneSettingSortQueryStringForCacheEditResponse] +type zoneSettingSortQueryStringForCacheEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSortQueryStringForCacheEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingSortQueryStringForCacheEditResponseID string + +const ( + ZoneSettingSortQueryStringForCacheEditResponseIDSortQueryStringForCache ZoneSettingSortQueryStringForCacheEditResponseID = "sort_query_string_for_cache" +) + +// Current value of the zone setting. +type ZoneSettingSortQueryStringForCacheEditResponseValue string + +const ( + ZoneSettingSortQueryStringForCacheEditResponseValueOn ZoneSettingSortQueryStringForCacheEditResponseValue = "on" + ZoneSettingSortQueryStringForCacheEditResponseValueOff ZoneSettingSortQueryStringForCacheEditResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingSortQueryStringForCacheEditResponseEditable bool + +const ( + ZoneSettingSortQueryStringForCacheEditResponseEditableTrue ZoneSettingSortQueryStringForCacheEditResponseEditable = true + ZoneSettingSortQueryStringForCacheEditResponseEditableFalse ZoneSettingSortQueryStringForCacheEditResponseEditable = false +) + +// Cloudflare will treat files with the same query strings as the same file in +// cache, regardless of the order of the query strings. This is limited to +// Enterprise Zones. +type ZoneSettingSortQueryStringForCacheGetResponse struct { + // ID of the zone setting. + ID ZoneSettingSortQueryStringForCacheGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingSortQueryStringForCacheGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingSortQueryStringForCacheGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingSortQueryStringForCacheGetResponseJSON `json:"-"` +} + +// zoneSettingSortQueryStringForCacheGetResponseJSON contains the JSON metadata for +// the struct [ZoneSettingSortQueryStringForCacheGetResponse] +type zoneSettingSortQueryStringForCacheGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSortQueryStringForCacheGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingSortQueryStringForCacheGetResponseID string + +const ( + ZoneSettingSortQueryStringForCacheGetResponseIDSortQueryStringForCache ZoneSettingSortQueryStringForCacheGetResponseID = "sort_query_string_for_cache" +) + +// Current value of the zone setting. +type ZoneSettingSortQueryStringForCacheGetResponseValue string + +const ( + ZoneSettingSortQueryStringForCacheGetResponseValueOn ZoneSettingSortQueryStringForCacheGetResponseValue = "on" + ZoneSettingSortQueryStringForCacheGetResponseValueOff ZoneSettingSortQueryStringForCacheGetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingSortQueryStringForCacheGetResponseEditable bool + +const ( + ZoneSettingSortQueryStringForCacheGetResponseEditableTrue ZoneSettingSortQueryStringForCacheGetResponseEditable = true + ZoneSettingSortQueryStringForCacheGetResponseEditableFalse ZoneSettingSortQueryStringForCacheGetResponseEditable = false +) + +type ZoneSettingSortQueryStringForCacheEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingSortQueryStringForCacheEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingSortQueryStringForCacheEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingSortQueryStringForCacheEditParamsValue string + +const ( + ZoneSettingSortQueryStringForCacheEditParamsValueOn ZoneSettingSortQueryStringForCacheEditParamsValue = "on" + ZoneSettingSortQueryStringForCacheEditParamsValueOff ZoneSettingSortQueryStringForCacheEditParamsValue = "off" +) + +type ZoneSettingSortQueryStringForCacheEditResponseEnvelope struct { + Errors []ZoneSettingSortQueryStringForCacheEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingSortQueryStringForCacheEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Cloudflare will treat files with the same query strings as the same file in + // cache, regardless of the order of the query strings. This is limited to + // Enterprise Zones. + Result ZoneSettingSortQueryStringForCacheEditResponse `json:"result"` + JSON zoneSettingSortQueryStringForCacheEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingSortQueryStringForCacheEditResponseEnvelopeJSON contains the JSON +// metadata for the struct [ZoneSettingSortQueryStringForCacheEditResponseEnvelope] +type zoneSettingSortQueryStringForCacheEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSortQueryStringForCacheEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingSortQueryStringForCacheEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingSortQueryStringForCacheEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingSortQueryStringForCacheEditResponseEnvelopeErrorsJSON contains the +// JSON metadata for the struct +// [ZoneSettingSortQueryStringForCacheEditResponseEnvelopeErrors] +type zoneSettingSortQueryStringForCacheEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSortQueryStringForCacheEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingSortQueryStringForCacheEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingSortQueryStringForCacheEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingSortQueryStringForCacheEditResponseEnvelopeMessagesJSON contains the +// JSON metadata for the struct +// [ZoneSettingSortQueryStringForCacheEditResponseEnvelopeMessages] +type zoneSettingSortQueryStringForCacheEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSortQueryStringForCacheEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingSortQueryStringForCacheGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingSortQueryStringForCacheGetResponseEnvelope struct { + Errors []ZoneSettingSortQueryStringForCacheGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingSortQueryStringForCacheGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Cloudflare will treat files with the same query strings as the same file in + // cache, regardless of the order of the query strings. This is limited to + // Enterprise Zones. + Result ZoneSettingSortQueryStringForCacheGetResponse `json:"result"` + JSON zoneSettingSortQueryStringForCacheGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingSortQueryStringForCacheGetResponseEnvelopeJSON contains the JSON +// metadata for the struct [ZoneSettingSortQueryStringForCacheGetResponseEnvelope] +type zoneSettingSortQueryStringForCacheGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSortQueryStringForCacheGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingSortQueryStringForCacheGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingSortQueryStringForCacheGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingSortQueryStringForCacheGetResponseEnvelopeErrorsJSON contains the +// JSON metadata for the struct +// [ZoneSettingSortQueryStringForCacheGetResponseEnvelopeErrors] +type zoneSettingSortQueryStringForCacheGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSortQueryStringForCacheGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingSortQueryStringForCacheGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingSortQueryStringForCacheGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingSortQueryStringForCacheGetResponseEnvelopeMessagesJSON contains the +// JSON metadata for the struct +// [ZoneSettingSortQueryStringForCacheGetResponseEnvelopeMessages] +type zoneSettingSortQueryStringForCacheGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSortQueryStringForCacheGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/zonesettingsortquerystringforcache_test.go b/zonesettingsortquerystringforcache_test.go new file mode 100644 index 00000000000..8c0566c5278 --- /dev/null +++ b/zonesettingsortquerystringforcache_test.go @@ -0,0 +1,71 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingSortQueryStringForCacheEdit(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.SortQueryStringForCache.Edit(context.TODO(), cloudflare.ZoneSettingSortQueryStringForCacheEditParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Value: cloudflare.F(cloudflare.ZoneSettingSortQueryStringForCacheEditParamsValueOn), + }) + 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 TestZoneSettingSortQueryStringForCacheGet(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.SortQueryStringForCache.Get(context.TODO(), cloudflare.ZoneSettingSortQueryStringForCacheGetParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/settingssl.go b/zonesettingssl.go similarity index 60% rename from settingssl.go rename to zonesettingssl.go index 144fe550e10..a458b8e95be 100644 --- a/settingssl.go +++ b/zonesettingssl.go @@ -14,19 +14,20 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -// SettingSSLService contains methods and other services that help with interacting -// with the cloudflare API. Note, unlike clients, this service does not read -// variables from the environment automatically. You should not instantiate this -// service directly, and instead use the [NewSettingSSLService] method instead. -type SettingSSLService struct { +// ZoneSettingSSLService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewZoneSettingSSLService] method +// instead. +type ZoneSettingSSLService struct { Options []option.RequestOption } -// NewSettingSSLService generates a new service that applies the given options to -// each request. These options are applied after the parent client's options (if +// NewZoneSettingSSLService generates a new service that applies the given options +// to each request. These options are applied after the parent client's options (if // there is one), and before any request-specific options. -func NewSettingSSLService(opts ...option.RequestOption) (r *SettingSSLService) { - r = &SettingSSLService{} +func NewZoneSettingSSLService(opts ...option.RequestOption) (r *ZoneSettingSSLService) { + r = &ZoneSettingSSLService{} r.Options = opts return } @@ -47,9 +48,9 @@ func NewSettingSSLService(opts ...option.RequestOption) (r *SettingSSLService) { // web server. This certificate must be signed by a certificate authority, have an // expiration date in the future, and respond for the request domain name // (hostname). (https://support.cloudflare.com/hc/en-us/articles/200170416). -func (r *SettingSSLService) Edit(ctx context.Context, params SettingSSLEditParams, opts ...option.RequestOption) (res *SettingSSLEditResponse, err error) { +func (r *ZoneSettingSSLService) Edit(ctx context.Context, params ZoneSettingSSLEditParams, opts ...option.RequestOption) (res *ZoneSettingSSLEditResponse, err error) { opts = append(r.Options[:], opts...) - var env SettingSSLEditResponseEnvelope + var env ZoneSettingSSLEditResponseEnvelope path := fmt.Sprintf("zones/%s/settings/ssl", params.ZoneID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) if err != nil { @@ -75,9 +76,9 @@ func (r *SettingSSLService) Edit(ctx context.Context, params SettingSSLEditParam // web server. This certificate must be signed by a certificate authority, have an // expiration date in the future, and respond for the request domain name // (hostname). (https://support.cloudflare.com/hc/en-us/articles/200170416). -func (r *SettingSSLService) Get(ctx context.Context, query SettingSSLGetParams, opts ...option.RequestOption) (res *SettingSSLGetResponse, err error) { +func (r *ZoneSettingSSLService) Get(ctx context.Context, query ZoneSettingSSLGetParams, opts ...option.RequestOption) (res *ZoneSettingSSLGetResponse, err error) { opts = append(r.Options[:], opts...) - var env SettingSSLGetResponseEnvelope + var env ZoneSettingSSLGetResponseEnvelope path := fmt.Sprintf("zones/%s/settings/ssl", query.ZoneID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) if err != nil { @@ -103,22 +104,22 @@ func (r *SettingSSLService) Get(ctx context.Context, query SettingSSLGetParams, // web server. This certificate must be signed by a certificate authority, have an // expiration date in the future, and respond for the request domain name // (hostname). (https://support.cloudflare.com/hc/en-us/articles/200170416). -type SettingSSLEditResponse struct { +type ZoneSettingSSLEditResponse struct { // ID of the zone setting. - ID SettingSSLEditResponseID `json:"id,required"` + ID ZoneSettingSSLEditResponseID `json:"id,required"` // Current value of the zone setting. - Value SettingSSLEditResponseValue `json:"value,required"` + Value ZoneSettingSSLEditResponseValue `json:"value,required"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable SettingSSLEditResponseEditable `json:"editable"` + Editable ZoneSettingSSLEditResponseEditable `json:"editable"` // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingSSLEditResponseJSON `json:"-"` + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingSSLEditResponseJSON `json:"-"` } -// settingSSLEditResponseJSON contains the JSON metadata for the struct -// [SettingSSLEditResponse] -type settingSSLEditResponseJSON struct { +// zoneSettingSSLEditResponseJSON contains the JSON metadata for the struct +// [ZoneSettingSSLEditResponse] +type zoneSettingSSLEditResponseJSON struct { ID apijson.Field Value apijson.Field Editable apijson.Field @@ -127,34 +128,34 @@ type settingSSLEditResponseJSON struct { ExtraFields map[string]apijson.Field } -func (r *SettingSSLEditResponse) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingSSLEditResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // ID of the zone setting. -type SettingSSLEditResponseID string +type ZoneSettingSSLEditResponseID string const ( - SettingSSLEditResponseIDSSL SettingSSLEditResponseID = "ssl" + ZoneSettingSSLEditResponseIDSSL ZoneSettingSSLEditResponseID = "ssl" ) // Current value of the zone setting. -type SettingSSLEditResponseValue string +type ZoneSettingSSLEditResponseValue string const ( - SettingSSLEditResponseValueOff SettingSSLEditResponseValue = "off" - SettingSSLEditResponseValueFlexible SettingSSLEditResponseValue = "flexible" - SettingSSLEditResponseValueFull SettingSSLEditResponseValue = "full" - SettingSSLEditResponseValueStrict SettingSSLEditResponseValue = "strict" + ZoneSettingSSLEditResponseValueOff ZoneSettingSSLEditResponseValue = "off" + ZoneSettingSSLEditResponseValueFlexible ZoneSettingSSLEditResponseValue = "flexible" + ZoneSettingSSLEditResponseValueFull ZoneSettingSSLEditResponseValue = "full" + ZoneSettingSSLEditResponseValueStrict ZoneSettingSSLEditResponseValue = "strict" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type SettingSSLEditResponseEditable bool +type ZoneSettingSSLEditResponseEditable bool const ( - SettingSSLEditResponseEditableTrue SettingSSLEditResponseEditable = true - SettingSSLEditResponseEditableFalse SettingSSLEditResponseEditable = false + ZoneSettingSSLEditResponseEditableTrue ZoneSettingSSLEditResponseEditable = true + ZoneSettingSSLEditResponseEditableFalse ZoneSettingSSLEditResponseEditable = false ) // SSL encrypts your visitor's connection and safeguards credit card numbers and @@ -173,22 +174,22 @@ const ( // web server. This certificate must be signed by a certificate authority, have an // expiration date in the future, and respond for the request domain name // (hostname). (https://support.cloudflare.com/hc/en-us/articles/200170416). -type SettingSSLGetResponse struct { +type ZoneSettingSSLGetResponse struct { // ID of the zone setting. - ID SettingSSLGetResponseID `json:"id,required"` + ID ZoneSettingSSLGetResponseID `json:"id,required"` // Current value of the zone setting. - Value SettingSSLGetResponseValue `json:"value,required"` + Value ZoneSettingSSLGetResponseValue `json:"value,required"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable SettingSSLGetResponseEditable `json:"editable"` + Editable ZoneSettingSSLGetResponseEditable `json:"editable"` // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingSSLGetResponseJSON `json:"-"` + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingSSLGetResponseJSON `json:"-"` } -// settingSSLGetResponseJSON contains the JSON metadata for the struct -// [SettingSSLGetResponse] -type settingSSLGetResponseJSON struct { +// zoneSettingSSLGetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingSSLGetResponse] +type zoneSettingSSLGetResponseJSON struct { ID apijson.Field Value apijson.Field Editable apijson.Field @@ -197,60 +198,60 @@ type settingSSLGetResponseJSON struct { ExtraFields map[string]apijson.Field } -func (r *SettingSSLGetResponse) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingSSLGetResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // ID of the zone setting. -type SettingSSLGetResponseID string +type ZoneSettingSSLGetResponseID string const ( - SettingSSLGetResponseIDSSL SettingSSLGetResponseID = "ssl" + ZoneSettingSSLGetResponseIDSSL ZoneSettingSSLGetResponseID = "ssl" ) // Current value of the zone setting. -type SettingSSLGetResponseValue string +type ZoneSettingSSLGetResponseValue string const ( - SettingSSLGetResponseValueOff SettingSSLGetResponseValue = "off" - SettingSSLGetResponseValueFlexible SettingSSLGetResponseValue = "flexible" - SettingSSLGetResponseValueFull SettingSSLGetResponseValue = "full" - SettingSSLGetResponseValueStrict SettingSSLGetResponseValue = "strict" + ZoneSettingSSLGetResponseValueOff ZoneSettingSSLGetResponseValue = "off" + ZoneSettingSSLGetResponseValueFlexible ZoneSettingSSLGetResponseValue = "flexible" + ZoneSettingSSLGetResponseValueFull ZoneSettingSSLGetResponseValue = "full" + ZoneSettingSSLGetResponseValueStrict ZoneSettingSSLGetResponseValue = "strict" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type SettingSSLGetResponseEditable bool +type ZoneSettingSSLGetResponseEditable bool const ( - SettingSSLGetResponseEditableTrue SettingSSLGetResponseEditable = true - SettingSSLGetResponseEditableFalse SettingSSLGetResponseEditable = false + ZoneSettingSSLGetResponseEditableTrue ZoneSettingSSLGetResponseEditable = true + ZoneSettingSSLGetResponseEditableFalse ZoneSettingSSLGetResponseEditable = false ) -type SettingSSLEditParams struct { +type ZoneSettingSSLEditParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` // Value of the zone setting. Notes: Depends on the zone's plan level - Value param.Field[SettingSSLEditParamsValue] `json:"value,required"` + Value param.Field[ZoneSettingSSLEditParamsValue] `json:"value,required"` } -func (r SettingSSLEditParams) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingSSLEditParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Value of the zone setting. Notes: Depends on the zone's plan level -type SettingSSLEditParamsValue string +type ZoneSettingSSLEditParamsValue string const ( - SettingSSLEditParamsValueOff SettingSSLEditParamsValue = "off" - SettingSSLEditParamsValueFlexible SettingSSLEditParamsValue = "flexible" - SettingSSLEditParamsValueFull SettingSSLEditParamsValue = "full" - SettingSSLEditParamsValueStrict SettingSSLEditParamsValue = "strict" + ZoneSettingSSLEditParamsValueOff ZoneSettingSSLEditParamsValue = "off" + ZoneSettingSSLEditParamsValueFlexible ZoneSettingSSLEditParamsValue = "flexible" + ZoneSettingSSLEditParamsValueFull ZoneSettingSSLEditParamsValue = "full" + ZoneSettingSSLEditParamsValueStrict ZoneSettingSSLEditParamsValue = "strict" ) -type SettingSSLEditResponseEnvelope struct { - Errors []SettingSSLEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingSSLEditResponseEnvelopeMessages `json:"messages,required"` +type ZoneSettingSSLEditResponseEnvelope struct { + Errors []ZoneSettingSSLEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingSSLEditResponseEnvelopeMessages `json:"messages,required"` // Whether the API call was successful Success bool `json:"success,required"` // SSL encrypts your visitor's connection and safeguards credit card numbers and @@ -269,13 +270,13 @@ type SettingSSLEditResponseEnvelope struct { // web server. This certificate must be signed by a certificate authority, have an // expiration date in the future, and respond for the request domain name // (hostname). (https://support.cloudflare.com/hc/en-us/articles/200170416). - Result SettingSSLEditResponse `json:"result"` - JSON settingSSLEditResponseEnvelopeJSON `json:"-"` + Result ZoneSettingSSLEditResponse `json:"result"` + JSON zoneSettingSSLEditResponseEnvelopeJSON `json:"-"` } -// settingSSLEditResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingSSLEditResponseEnvelope] -type settingSSLEditResponseEnvelopeJSON struct { +// zoneSettingSSLEditResponseEnvelopeJSON contains the JSON metadata for the struct +// [ZoneSettingSSLEditResponseEnvelope] +type zoneSettingSSLEditResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field Success apijson.Field @@ -284,56 +285,56 @@ type settingSSLEditResponseEnvelopeJSON struct { ExtraFields map[string]apijson.Field } -func (r *SettingSSLEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingSSLEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type SettingSSLEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingSSLEditResponseEnvelopeErrorsJSON `json:"-"` +type ZoneSettingSSLEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingSSLEditResponseEnvelopeErrorsJSON `json:"-"` } -// settingSSLEditResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingSSLEditResponseEnvelopeErrors] -type settingSSLEditResponseEnvelopeErrorsJSON struct { +// zoneSettingSSLEditResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [ZoneSettingSSLEditResponseEnvelopeErrors] +type zoneSettingSSLEditResponseEnvelopeErrorsJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *SettingSSLEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingSSLEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type SettingSSLEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingSSLEditResponseEnvelopeMessagesJSON `json:"-"` +type ZoneSettingSSLEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingSSLEditResponseEnvelopeMessagesJSON `json:"-"` } -// settingSSLEditResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingSSLEditResponseEnvelopeMessages] -type settingSSLEditResponseEnvelopeMessagesJSON struct { +// zoneSettingSSLEditResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingSSLEditResponseEnvelopeMessages] +type zoneSettingSSLEditResponseEnvelopeMessagesJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *SettingSSLEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingSSLEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type SettingSSLGetParams struct { +type ZoneSettingSSLGetParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` } -type SettingSSLGetResponseEnvelope struct { - Errors []SettingSSLGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingSSLGetResponseEnvelopeMessages `json:"messages,required"` +type ZoneSettingSSLGetResponseEnvelope struct { + Errors []ZoneSettingSSLGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingSSLGetResponseEnvelopeMessages `json:"messages,required"` // Whether the API call was successful Success bool `json:"success,required"` // SSL encrypts your visitor's connection and safeguards credit card numbers and @@ -352,13 +353,13 @@ type SettingSSLGetResponseEnvelope struct { // web server. This certificate must be signed by a certificate authority, have an // expiration date in the future, and respond for the request domain name // (hostname). (https://support.cloudflare.com/hc/en-us/articles/200170416). - Result SettingSSLGetResponse `json:"result"` - JSON settingSSLGetResponseEnvelopeJSON `json:"-"` + Result ZoneSettingSSLGetResponse `json:"result"` + JSON zoneSettingSSLGetResponseEnvelopeJSON `json:"-"` } -// settingSSLGetResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingSSLGetResponseEnvelope] -type settingSSLGetResponseEnvelopeJSON struct { +// zoneSettingSSLGetResponseEnvelopeJSON contains the JSON metadata for the struct +// [ZoneSettingSSLGetResponseEnvelope] +type zoneSettingSSLGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field Success apijson.Field @@ -367,44 +368,44 @@ type settingSSLGetResponseEnvelopeJSON struct { ExtraFields map[string]apijson.Field } -func (r *SettingSSLGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingSSLGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type SettingSSLGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingSSLGetResponseEnvelopeErrorsJSON `json:"-"` +type ZoneSettingSSLGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingSSLGetResponseEnvelopeErrorsJSON `json:"-"` } -// settingSSLGetResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingSSLGetResponseEnvelopeErrors] -type settingSSLGetResponseEnvelopeErrorsJSON struct { +// zoneSettingSSLGetResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [ZoneSettingSSLGetResponseEnvelopeErrors] +type zoneSettingSSLGetResponseEnvelopeErrorsJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *SettingSSLGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingSSLGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type SettingSSLGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingSSLGetResponseEnvelopeMessagesJSON `json:"-"` +type ZoneSettingSSLGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingSSLGetResponseEnvelopeMessagesJSON `json:"-"` } -// settingSSLGetResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingSSLGetResponseEnvelopeMessages] -type settingSSLGetResponseEnvelopeMessagesJSON struct { +// zoneSettingSSLGetResponseEnvelopeMessagesJSON contains the JSON metadata for the +// struct [ZoneSettingSSLGetResponseEnvelopeMessages] +type zoneSettingSSLGetResponseEnvelopeMessagesJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *SettingSSLGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingSSLGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } diff --git a/settingipv6_test.go b/zonesettingssl_test.go similarity index 86% rename from settingipv6_test.go rename to zonesettingssl_test.go index 0f045b0c67a..b1b4bbfcf7d 100644 --- a/settingipv6_test.go +++ b/zonesettingssl_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingIPV6Edit(t *testing.T) { +func TestZoneSettingSSLEdit(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 { @@ -29,9 +29,9 @@ func TestSettingIPV6Edit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.IPV6.Edit(context.TODO(), cloudflare.SettingIPV6EditParams{ + _, err := client.Zones.Settings.SSL.Edit(context.TODO(), cloudflare.ZoneSettingSSLEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingIPV6EditParamsValueOff), + Value: cloudflare.F(cloudflare.ZoneSettingSSLEditParamsValueOff), }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +42,7 @@ func TestSettingIPV6Edit(t *testing.T) { } } -func TestSettingIPV6Get(t *testing.T) { +func TestZoneSettingSSLGet(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 { @@ -58,7 +58,7 @@ func TestSettingIPV6Get(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.IPV6.Get(context.TODO(), cloudflare.SettingIPV6GetParams{ + _, err := client.Zones.Settings.SSL.Get(context.TODO(), cloudflare.ZoneSettingSSLGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingsslrecommender.go b/zonesettingsslrecommender.go new file mode 100644 index 00000000000..9ad4ba39c40 --- /dev/null +++ b/zonesettingsslrecommender.go @@ -0,0 +1,293 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingSSLRecommenderService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewZoneSettingSSLRecommenderService] method instead. +type ZoneSettingSSLRecommenderService struct { + Options []option.RequestOption +} + +// NewZoneSettingSSLRecommenderService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewZoneSettingSSLRecommenderService(opts ...option.RequestOption) (r *ZoneSettingSSLRecommenderService) { + r = &ZoneSettingSSLRecommenderService{} + r.Options = opts + return +} + +// Enrollment in the SSL/TLS Recommender service which tries to detect and +// recommend (by sending periodic emails) the most secure SSL/TLS setting your +// origin servers support. +func (r *ZoneSettingSSLRecommenderService) Edit(ctx context.Context, params ZoneSettingSSLRecommenderEditParams, opts ...option.RequestOption) (res *ZoneSettingSSLRecommenderEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingSSLRecommenderEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/ssl_recommender", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Enrollment in the SSL/TLS Recommender service which tries to detect and +// recommend (by sending periodic emails) the most secure SSL/TLS setting your +// origin servers support. +func (r *ZoneSettingSSLRecommenderService) Get(ctx context.Context, query ZoneSettingSSLRecommenderGetParams, opts ...option.RequestOption) (res *ZoneSettingSSLRecommenderGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingSSLRecommenderGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/ssl_recommender", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Enrollment in the SSL/TLS Recommender service which tries to detect and +// recommend (by sending periodic emails) the most secure SSL/TLS setting your +// origin servers support. +type ZoneSettingSSLRecommenderEditResponse struct { + // Enrollment value for SSL/TLS Recommender. + ID ZoneSettingSSLRecommenderEditResponseID `json:"id"` + // ssl-recommender enrollment setting. + Enabled bool `json:"enabled"` + JSON zoneSettingSSLRecommenderEditResponseJSON `json:"-"` +} + +// zoneSettingSSLRecommenderEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingSSLRecommenderEditResponse] +type zoneSettingSSLRecommenderEditResponseJSON struct { + ID apijson.Field + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSSLRecommenderEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enrollment value for SSL/TLS Recommender. +type ZoneSettingSSLRecommenderEditResponseID string + +const ( + ZoneSettingSSLRecommenderEditResponseIDSSLRecommender ZoneSettingSSLRecommenderEditResponseID = "ssl_recommender" +) + +// Enrollment in the SSL/TLS Recommender service which tries to detect and +// recommend (by sending periodic emails) the most secure SSL/TLS setting your +// origin servers support. +type ZoneSettingSSLRecommenderGetResponse struct { + // Enrollment value for SSL/TLS Recommender. + ID ZoneSettingSSLRecommenderGetResponseID `json:"id"` + // ssl-recommender enrollment setting. + Enabled bool `json:"enabled"` + JSON zoneSettingSSLRecommenderGetResponseJSON `json:"-"` +} + +// zoneSettingSSLRecommenderGetResponseJSON contains the JSON metadata for the +// struct [ZoneSettingSSLRecommenderGetResponse] +type zoneSettingSSLRecommenderGetResponseJSON struct { + ID apijson.Field + Enabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSSLRecommenderGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Enrollment value for SSL/TLS Recommender. +type ZoneSettingSSLRecommenderGetResponseID string + +const ( + ZoneSettingSSLRecommenderGetResponseIDSSLRecommender ZoneSettingSSLRecommenderGetResponseID = "ssl_recommender" +) + +type ZoneSettingSSLRecommenderEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Enrollment in the SSL/TLS Recommender service which tries to detect and + // recommend (by sending periodic emails) the most secure SSL/TLS setting your + // origin servers support. + Value param.Field[ZoneSettingSSLRecommenderEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingSSLRecommenderEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enrollment in the SSL/TLS Recommender service which tries to detect and +// recommend (by sending periodic emails) the most secure SSL/TLS setting your +// origin servers support. +type ZoneSettingSSLRecommenderEditParamsValue struct { + // Enrollment value for SSL/TLS Recommender. + ID param.Field[ZoneSettingSSLRecommenderEditParamsValueID] `json:"id"` + // ssl-recommender enrollment setting. + Enabled param.Field[bool] `json:"enabled"` +} + +func (r ZoneSettingSSLRecommenderEditParamsValue) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Enrollment value for SSL/TLS Recommender. +type ZoneSettingSSLRecommenderEditParamsValueID string + +const ( + ZoneSettingSSLRecommenderEditParamsValueIDSSLRecommender ZoneSettingSSLRecommenderEditParamsValueID = "ssl_recommender" +) + +type ZoneSettingSSLRecommenderEditResponseEnvelope struct { + Errors []ZoneSettingSSLRecommenderEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingSSLRecommenderEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Enrollment in the SSL/TLS Recommender service which tries to detect and + // recommend (by sending periodic emails) the most secure SSL/TLS setting your + // origin servers support. + Result ZoneSettingSSLRecommenderEditResponse `json:"result"` + JSON zoneSettingSSLRecommenderEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingSSLRecommenderEditResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingSSLRecommenderEditResponseEnvelope] +type zoneSettingSSLRecommenderEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSSLRecommenderEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingSSLRecommenderEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingSSLRecommenderEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingSSLRecommenderEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingSSLRecommenderEditResponseEnvelopeErrors] +type zoneSettingSSLRecommenderEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSSLRecommenderEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingSSLRecommenderEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingSSLRecommenderEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingSSLRecommenderEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingSSLRecommenderEditResponseEnvelopeMessages] +type zoneSettingSSLRecommenderEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSSLRecommenderEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingSSLRecommenderGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingSSLRecommenderGetResponseEnvelope struct { + Errors []ZoneSettingSSLRecommenderGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingSSLRecommenderGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Enrollment in the SSL/TLS Recommender service which tries to detect and + // recommend (by sending periodic emails) the most secure SSL/TLS setting your + // origin servers support. + Result ZoneSettingSSLRecommenderGetResponse `json:"result"` + JSON zoneSettingSSLRecommenderGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingSSLRecommenderGetResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingSSLRecommenderGetResponseEnvelope] +type zoneSettingSSLRecommenderGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSSLRecommenderGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingSSLRecommenderGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingSSLRecommenderGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingSSLRecommenderGetResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingSSLRecommenderGetResponseEnvelopeErrors] +type zoneSettingSSLRecommenderGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSSLRecommenderGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingSSLRecommenderGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingSSLRecommenderGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingSSLRecommenderGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingSSLRecommenderGetResponseEnvelopeMessages] +type zoneSettingSSLRecommenderGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingSSLRecommenderGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingsslrecommender_test.go b/zonesettingsslrecommender_test.go similarity index 80% rename from settingsslrecommender_test.go rename to zonesettingsslrecommender_test.go index 9a01485e108..67726133f7c 100644 --- a/settingsslrecommender_test.go +++ b/zonesettingsslrecommender_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingSSLRecommenderEditWithOptionalParams(t *testing.T) { +func TestZoneSettingSSLRecommenderEditWithOptionalParams(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 { @@ -29,11 +29,11 @@ func TestSettingSSLRecommenderEditWithOptionalParams(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.SSLRecommender.Edit(context.TODO(), cloudflare.SettingSSLRecommenderEditParams{ + _, err := client.Zones.Settings.SSLRecommender.Edit(context.TODO(), cloudflare.ZoneSettingSSLRecommenderEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingSSLRecommenderEditParamsValue{ + Value: cloudflare.F(cloudflare.ZoneSettingSSLRecommenderEditParamsValue{ Enabled: cloudflare.F(true), - ID: cloudflare.F(cloudflare.SettingSSLRecommenderEditParamsValueIDSSLRecommender), + ID: cloudflare.F(cloudflare.ZoneSettingSSLRecommenderEditParamsValueIDSSLRecommender), }), }) if err != nil { @@ -45,7 +45,7 @@ func TestSettingSSLRecommenderEditWithOptionalParams(t *testing.T) { } } -func TestSettingSSLRecommenderGet(t *testing.T) { +func TestZoneSettingSSLRecommenderGet(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 { @@ -61,7 +61,7 @@ func TestSettingSSLRecommenderGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.SSLRecommender.Get(context.TODO(), cloudflare.SettingSSLRecommenderGetParams{ + _, err := client.Zones.Settings.SSLRecommender.Get(context.TODO(), cloudflare.ZoneSettingSSLRecommenderGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingtls13.go b/zonesettingtls13.go new file mode 100644 index 00000000000..dfeb2a49f62 --- /dev/null +++ b/zonesettingtls13.go @@ -0,0 +1,320 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingTLS1_3Service contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewZoneSettingTLS1_3Service] method +// instead. +type ZoneSettingTLS1_3Service struct { + Options []option.RequestOption +} + +// NewZoneSettingTLS1_3Service generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewZoneSettingTLS1_3Service(opts ...option.RequestOption) (r *ZoneSettingTLS1_3Service) { + r = &ZoneSettingTLS1_3Service{} + r.Options = opts + return +} + +// Changes TLS 1.3 setting. +func (r *ZoneSettingTLS1_3Service) Edit(ctx context.Context, params ZoneSettingTLS1_3EditParams, opts ...option.RequestOption) (res *ZoneSettingTls1_3EditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingTls1_3EditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/tls_1_3", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Gets TLS 1.3 setting enabled for a zone. +func (r *ZoneSettingTLS1_3Service) Get(ctx context.Context, query ZoneSettingTLS1_3GetParams, opts ...option.RequestOption) (res *ZoneSettingTls1_3GetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingTls1_3GetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/tls_1_3", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Enables Crypto TLS 1.3 feature for a zone. +type ZoneSettingTls1_3EditResponse struct { + // ID of the zone setting. + ID ZoneSettingTls1_3EditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingTls1_3EditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingTls1_3EditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingTls1_3EditResponseJSON `json:"-"` +} + +// zoneSettingTls1_3EditResponseJSON contains the JSON metadata for the struct +// [ZoneSettingTls1_3EditResponse] +type zoneSettingTls1_3EditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTls1_3EditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingTls1_3EditResponseID string + +const ( + ZoneSettingTls1_3EditResponseIDTLS1_3 ZoneSettingTls1_3EditResponseID = "tls_1_3" +) + +// Current value of the zone setting. +type ZoneSettingTls1_3EditResponseValue string + +const ( + ZoneSettingTls1_3EditResponseValueOn ZoneSettingTls1_3EditResponseValue = "on" + ZoneSettingTls1_3EditResponseValueOff ZoneSettingTls1_3EditResponseValue = "off" + ZoneSettingTls1_3EditResponseValueZrt ZoneSettingTls1_3EditResponseValue = "zrt" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingTls1_3EditResponseEditable bool + +const ( + ZoneSettingTls1_3EditResponseEditableTrue ZoneSettingTls1_3EditResponseEditable = true + ZoneSettingTls1_3EditResponseEditableFalse ZoneSettingTls1_3EditResponseEditable = false +) + +// Enables Crypto TLS 1.3 feature for a zone. +type ZoneSettingTls1_3GetResponse struct { + // ID of the zone setting. + ID ZoneSettingTls1_3GetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingTls1_3GetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingTls1_3GetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingTls1_3GetResponseJSON `json:"-"` +} + +// zoneSettingTls1_3GetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingTls1_3GetResponse] +type zoneSettingTls1_3GetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTls1_3GetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingTls1_3GetResponseID string + +const ( + ZoneSettingTls1_3GetResponseIDTLS1_3 ZoneSettingTls1_3GetResponseID = "tls_1_3" +) + +// Current value of the zone setting. +type ZoneSettingTls1_3GetResponseValue string + +const ( + ZoneSettingTls1_3GetResponseValueOn ZoneSettingTls1_3GetResponseValue = "on" + ZoneSettingTls1_3GetResponseValueOff ZoneSettingTls1_3GetResponseValue = "off" + ZoneSettingTls1_3GetResponseValueZrt ZoneSettingTls1_3GetResponseValue = "zrt" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingTls1_3GetResponseEditable bool + +const ( + ZoneSettingTls1_3GetResponseEditableTrue ZoneSettingTls1_3GetResponseEditable = true + ZoneSettingTls1_3GetResponseEditableFalse ZoneSettingTls1_3GetResponseEditable = false +) + +type ZoneSettingTLS1_3EditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. Notes: Default value depends on the zone's plan + // level. + Value param.Field[ZoneSettingTls1_3EditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingTLS1_3EditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. Notes: Default value depends on the zone's plan +// level. +type ZoneSettingTls1_3EditParamsValue string + +const ( + ZoneSettingTls1_3EditParamsValueOn ZoneSettingTls1_3EditParamsValue = "on" + ZoneSettingTls1_3EditParamsValueOff ZoneSettingTls1_3EditParamsValue = "off" + ZoneSettingTls1_3EditParamsValueZrt ZoneSettingTls1_3EditParamsValue = "zrt" +) + +type ZoneSettingTls1_3EditResponseEnvelope struct { + Errors []ZoneSettingTls1_3EditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingTls1_3EditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Enables Crypto TLS 1.3 feature for a zone. + Result ZoneSettingTls1_3EditResponse `json:"result"` + JSON zoneSettingTls1_3EditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingTls1_3EditResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingTls1_3EditResponseEnvelope] +type zoneSettingTls1_3EditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTls1_3EditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingTls1_3EditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingTls1_3EditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingTls1_3EditResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [ZoneSettingTls1_3EditResponseEnvelopeErrors] +type zoneSettingTls1_3EditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTls1_3EditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingTls1_3EditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingTls1_3EditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingTls1_3EditResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingTls1_3EditResponseEnvelopeMessages] +type zoneSettingTls1_3EditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTls1_3EditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingTLS1_3GetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingTls1_3GetResponseEnvelope struct { + Errors []ZoneSettingTls1_3GetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingTls1_3GetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Enables Crypto TLS 1.3 feature for a zone. + Result ZoneSettingTls1_3GetResponse `json:"result"` + JSON zoneSettingTls1_3GetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingTls1_3GetResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingTls1_3GetResponseEnvelope] +type zoneSettingTls1_3GetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTls1_3GetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingTls1_3GetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingTls1_3GetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingTls1_3GetResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [ZoneSettingTls1_3GetResponseEnvelopeErrors] +type zoneSettingTls1_3GetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTls1_3GetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingTls1_3GetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingTls1_3GetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingTls1_3GetResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingTls1_3GetResponseEnvelopeMessages] +type zoneSettingTls1_3GetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTls1_3GetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/zonesettingtls13_test.go b/zonesettingtls13_test.go new file mode 100644 index 00000000000..7ac49162bfc --- /dev/null +++ b/zonesettingtls13_test.go @@ -0,0 +1,71 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingTLS1_3Edit(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.TLS1_3.Edit(context.TODO(), cloudflare.ZoneSettingTLS1_3EditParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Value: cloudflare.F(cloudflare.ZoneSettingTls1_3EditParamsValueOn), + }) + 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 TestZoneSettingTLS1_3Get(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.TLS1_3.Get(context.TODO(), cloudflare.ZoneSettingTLS1_3GetParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/zonesettingtlsclientauth.go b/zonesettingtlsclientauth.go new file mode 100644 index 00000000000..d8e6ae77d4a --- /dev/null +++ b/zonesettingtlsclientauth.go @@ -0,0 +1,321 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingTLSClientAuthService contains methods and other services that help +// with interacting with the cloudflare API. Note, unlike clients, this service +// does not read variables from the environment automatically. You should not +// instantiate this service directly, and instead use the +// [NewZoneSettingTLSClientAuthService] method instead. +type ZoneSettingTLSClientAuthService struct { + Options []option.RequestOption +} + +// NewZoneSettingTLSClientAuthService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewZoneSettingTLSClientAuthService(opts ...option.RequestOption) (r *ZoneSettingTLSClientAuthService) { + r = &ZoneSettingTLSClientAuthService{} + r.Options = opts + return +} + +// TLS Client Auth requires Cloudflare to connect to your origin server using a +// client certificate (Enterprise Only). +func (r *ZoneSettingTLSClientAuthService) Edit(ctx context.Context, params ZoneSettingTLSClientAuthEditParams, opts ...option.RequestOption) (res *ZoneSettingTLSClientAuthEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingTLSClientAuthEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/tls_client_auth", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// TLS Client Auth requires Cloudflare to connect to your origin server using a +// client certificate (Enterprise Only). +func (r *ZoneSettingTLSClientAuthService) Get(ctx context.Context, query ZoneSettingTLSClientAuthGetParams, opts ...option.RequestOption) (res *ZoneSettingTLSClientAuthGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingTLSClientAuthGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/tls_client_auth", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// TLS Client Auth requires Cloudflare to connect to your origin server using a +// client certificate (Enterprise Only). +type ZoneSettingTLSClientAuthEditResponse struct { + // ID of the zone setting. + ID ZoneSettingTLSClientAuthEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingTLSClientAuthEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingTLSClientAuthEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingTLSClientAuthEditResponseJSON `json:"-"` +} + +// zoneSettingTLSClientAuthEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingTLSClientAuthEditResponse] +type zoneSettingTLSClientAuthEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTLSClientAuthEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingTLSClientAuthEditResponseID string + +const ( + ZoneSettingTLSClientAuthEditResponseIDTLSClientAuth ZoneSettingTLSClientAuthEditResponseID = "tls_client_auth" +) + +// Current value of the zone setting. +type ZoneSettingTLSClientAuthEditResponseValue string + +const ( + ZoneSettingTLSClientAuthEditResponseValueOn ZoneSettingTLSClientAuthEditResponseValue = "on" + ZoneSettingTLSClientAuthEditResponseValueOff ZoneSettingTLSClientAuthEditResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingTLSClientAuthEditResponseEditable bool + +const ( + ZoneSettingTLSClientAuthEditResponseEditableTrue ZoneSettingTLSClientAuthEditResponseEditable = true + ZoneSettingTLSClientAuthEditResponseEditableFalse ZoneSettingTLSClientAuthEditResponseEditable = false +) + +// TLS Client Auth requires Cloudflare to connect to your origin server using a +// client certificate (Enterprise Only). +type ZoneSettingTLSClientAuthGetResponse struct { + // ID of the zone setting. + ID ZoneSettingTLSClientAuthGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingTLSClientAuthGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingTLSClientAuthGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingTLSClientAuthGetResponseJSON `json:"-"` +} + +// zoneSettingTLSClientAuthGetResponseJSON contains the JSON metadata for the +// struct [ZoneSettingTLSClientAuthGetResponse] +type zoneSettingTLSClientAuthGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTLSClientAuthGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingTLSClientAuthGetResponseID string + +const ( + ZoneSettingTLSClientAuthGetResponseIDTLSClientAuth ZoneSettingTLSClientAuthGetResponseID = "tls_client_auth" +) + +// Current value of the zone setting. +type ZoneSettingTLSClientAuthGetResponseValue string + +const ( + ZoneSettingTLSClientAuthGetResponseValueOn ZoneSettingTLSClientAuthGetResponseValue = "on" + ZoneSettingTLSClientAuthGetResponseValueOff ZoneSettingTLSClientAuthGetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingTLSClientAuthGetResponseEditable bool + +const ( + ZoneSettingTLSClientAuthGetResponseEditableTrue ZoneSettingTLSClientAuthGetResponseEditable = true + ZoneSettingTLSClientAuthGetResponseEditableFalse ZoneSettingTLSClientAuthGetResponseEditable = false +) + +type ZoneSettingTLSClientAuthEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // value of the zone setting. + Value param.Field[ZoneSettingTLSClientAuthEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingTLSClientAuthEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// value of the zone setting. +type ZoneSettingTLSClientAuthEditParamsValue string + +const ( + ZoneSettingTLSClientAuthEditParamsValueOn ZoneSettingTLSClientAuthEditParamsValue = "on" + ZoneSettingTLSClientAuthEditParamsValueOff ZoneSettingTLSClientAuthEditParamsValue = "off" +) + +type ZoneSettingTLSClientAuthEditResponseEnvelope struct { + Errors []ZoneSettingTLSClientAuthEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingTLSClientAuthEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // TLS Client Auth requires Cloudflare to connect to your origin server using a + // client certificate (Enterprise Only). + Result ZoneSettingTLSClientAuthEditResponse `json:"result"` + JSON zoneSettingTLSClientAuthEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingTLSClientAuthEditResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingTLSClientAuthEditResponseEnvelope] +type zoneSettingTLSClientAuthEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTLSClientAuthEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingTLSClientAuthEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingTLSClientAuthEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingTLSClientAuthEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingTLSClientAuthEditResponseEnvelopeErrors] +type zoneSettingTLSClientAuthEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTLSClientAuthEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingTLSClientAuthEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingTLSClientAuthEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingTLSClientAuthEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingTLSClientAuthEditResponseEnvelopeMessages] +type zoneSettingTLSClientAuthEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTLSClientAuthEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingTLSClientAuthGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingTLSClientAuthGetResponseEnvelope struct { + Errors []ZoneSettingTLSClientAuthGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingTLSClientAuthGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // TLS Client Auth requires Cloudflare to connect to your origin server using a + // client certificate (Enterprise Only). + Result ZoneSettingTLSClientAuthGetResponse `json:"result"` + JSON zoneSettingTLSClientAuthGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingTLSClientAuthGetResponseEnvelopeJSON contains the JSON metadata for +// the struct [ZoneSettingTLSClientAuthGetResponseEnvelope] +type zoneSettingTLSClientAuthGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTLSClientAuthGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingTLSClientAuthGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingTLSClientAuthGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingTLSClientAuthGetResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [ZoneSettingTLSClientAuthGetResponseEnvelopeErrors] +type zoneSettingTLSClientAuthGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTLSClientAuthGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingTLSClientAuthGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingTLSClientAuthGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingTLSClientAuthGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct [ZoneSettingTLSClientAuthGetResponseEnvelopeMessages] +type zoneSettingTLSClientAuthGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTLSClientAuthGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingresponsebuffering_test.go b/zonesettingtlsclientauth_test.go similarity index 84% rename from settingresponsebuffering_test.go rename to zonesettingtlsclientauth_test.go index a267fb8d9ae..b821d5d92bd 100644 --- a/settingresponsebuffering_test.go +++ b/zonesettingtlsclientauth_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingResponseBufferingEdit(t *testing.T) { +func TestZoneSettingTLSClientAuthEdit(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 { @@ -29,9 +29,9 @@ func TestSettingResponseBufferingEdit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.ResponseBuffering.Edit(context.TODO(), cloudflare.SettingResponseBufferingEditParams{ + _, err := client.Zones.Settings.TLSClientAuth.Edit(context.TODO(), cloudflare.ZoneSettingTLSClientAuthEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingResponseBufferingEditParamsValueOn), + Value: cloudflare.F(cloudflare.ZoneSettingTLSClientAuthEditParamsValueOn), }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +42,7 @@ func TestSettingResponseBufferingEdit(t *testing.T) { } } -func TestSettingResponseBufferingGet(t *testing.T) { +func TestZoneSettingTLSClientAuthGet(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 { @@ -58,7 +58,7 @@ func TestSettingResponseBufferingGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.ResponseBuffering.Get(context.TODO(), cloudflare.SettingResponseBufferingGetParams{ + _, err := client.Zones.Settings.TLSClientAuth.Get(context.TODO(), cloudflare.ZoneSettingTLSClientAuthGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingtrueclientipheader.go b/zonesettingtrueclientipheader.go new file mode 100644 index 00000000000..7f7ca82a249 --- /dev/null +++ b/zonesettingtrueclientipheader.go @@ -0,0 +1,324 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingTrueClientIPHeaderService contains methods and other services that +// help with interacting with the cloudflare API. Note, unlike clients, this +// service does not read variables from the environment automatically. You should +// not instantiate this service directly, and instead use the +// [NewZoneSettingTrueClientIPHeaderService] method instead. +type ZoneSettingTrueClientIPHeaderService struct { + Options []option.RequestOption +} + +// NewZoneSettingTrueClientIPHeaderService generates a new service that applies the +// given options to each request. These options are applied after the parent +// client's options (if there is one), and before any request-specific options. +func NewZoneSettingTrueClientIPHeaderService(opts ...option.RequestOption) (r *ZoneSettingTrueClientIPHeaderService) { + r = &ZoneSettingTrueClientIPHeaderService{} + r.Options = opts + return +} + +// Allows customer to continue to use True Client IP (Akamai feature) in the +// headers we send to the origin. This is limited to Enterprise Zones. +func (r *ZoneSettingTrueClientIPHeaderService) Edit(ctx context.Context, params ZoneSettingTrueClientIPHeaderEditParams, opts ...option.RequestOption) (res *ZoneSettingTrueClientIPHeaderEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingTrueClientIPHeaderEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/true_client_ip_header", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Allows customer to continue to use True Client IP (Akamai feature) in the +// headers we send to the origin. This is limited to Enterprise Zones. +func (r *ZoneSettingTrueClientIPHeaderService) Get(ctx context.Context, query ZoneSettingTrueClientIPHeaderGetParams, opts ...option.RequestOption) (res *ZoneSettingTrueClientIPHeaderGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingTrueClientIPHeaderGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/true_client_ip_header", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Allows customer to continue to use True Client IP (Akamai feature) in the +// headers we send to the origin. This is limited to Enterprise Zones. +type ZoneSettingTrueClientIPHeaderEditResponse struct { + // ID of the zone setting. + ID ZoneSettingTrueClientIPHeaderEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingTrueClientIPHeaderEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingTrueClientIPHeaderEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingTrueClientIPHeaderEditResponseJSON `json:"-"` +} + +// zoneSettingTrueClientIPHeaderEditResponseJSON contains the JSON metadata for the +// struct [ZoneSettingTrueClientIPHeaderEditResponse] +type zoneSettingTrueClientIPHeaderEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTrueClientIPHeaderEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingTrueClientIPHeaderEditResponseID string + +const ( + ZoneSettingTrueClientIPHeaderEditResponseIDTrueClientIPHeader ZoneSettingTrueClientIPHeaderEditResponseID = "true_client_ip_header" +) + +// Current value of the zone setting. +type ZoneSettingTrueClientIPHeaderEditResponseValue string + +const ( + ZoneSettingTrueClientIPHeaderEditResponseValueOn ZoneSettingTrueClientIPHeaderEditResponseValue = "on" + ZoneSettingTrueClientIPHeaderEditResponseValueOff ZoneSettingTrueClientIPHeaderEditResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingTrueClientIPHeaderEditResponseEditable bool + +const ( + ZoneSettingTrueClientIPHeaderEditResponseEditableTrue ZoneSettingTrueClientIPHeaderEditResponseEditable = true + ZoneSettingTrueClientIPHeaderEditResponseEditableFalse ZoneSettingTrueClientIPHeaderEditResponseEditable = false +) + +// Allows customer to continue to use True Client IP (Akamai feature) in the +// headers we send to the origin. This is limited to Enterprise Zones. +type ZoneSettingTrueClientIPHeaderGetResponse struct { + // ID of the zone setting. + ID ZoneSettingTrueClientIPHeaderGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingTrueClientIPHeaderGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingTrueClientIPHeaderGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingTrueClientIPHeaderGetResponseJSON `json:"-"` +} + +// zoneSettingTrueClientIPHeaderGetResponseJSON contains the JSON metadata for the +// struct [ZoneSettingTrueClientIPHeaderGetResponse] +type zoneSettingTrueClientIPHeaderGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTrueClientIPHeaderGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingTrueClientIPHeaderGetResponseID string + +const ( + ZoneSettingTrueClientIPHeaderGetResponseIDTrueClientIPHeader ZoneSettingTrueClientIPHeaderGetResponseID = "true_client_ip_header" +) + +// Current value of the zone setting. +type ZoneSettingTrueClientIPHeaderGetResponseValue string + +const ( + ZoneSettingTrueClientIPHeaderGetResponseValueOn ZoneSettingTrueClientIPHeaderGetResponseValue = "on" + ZoneSettingTrueClientIPHeaderGetResponseValueOff ZoneSettingTrueClientIPHeaderGetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingTrueClientIPHeaderGetResponseEditable bool + +const ( + ZoneSettingTrueClientIPHeaderGetResponseEditableTrue ZoneSettingTrueClientIPHeaderGetResponseEditable = true + ZoneSettingTrueClientIPHeaderGetResponseEditableFalse ZoneSettingTrueClientIPHeaderGetResponseEditable = false +) + +type ZoneSettingTrueClientIPHeaderEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingTrueClientIPHeaderEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingTrueClientIPHeaderEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingTrueClientIPHeaderEditParamsValue string + +const ( + ZoneSettingTrueClientIPHeaderEditParamsValueOn ZoneSettingTrueClientIPHeaderEditParamsValue = "on" + ZoneSettingTrueClientIPHeaderEditParamsValueOff ZoneSettingTrueClientIPHeaderEditParamsValue = "off" +) + +type ZoneSettingTrueClientIPHeaderEditResponseEnvelope struct { + Errors []ZoneSettingTrueClientIPHeaderEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingTrueClientIPHeaderEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Allows customer to continue to use True Client IP (Akamai feature) in the + // headers we send to the origin. This is limited to Enterprise Zones. + Result ZoneSettingTrueClientIPHeaderEditResponse `json:"result"` + JSON zoneSettingTrueClientIPHeaderEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingTrueClientIPHeaderEditResponseEnvelopeJSON contains the JSON metadata +// for the struct [ZoneSettingTrueClientIPHeaderEditResponseEnvelope] +type zoneSettingTrueClientIPHeaderEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTrueClientIPHeaderEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingTrueClientIPHeaderEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingTrueClientIPHeaderEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingTrueClientIPHeaderEditResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct +// [ZoneSettingTrueClientIPHeaderEditResponseEnvelopeErrors] +type zoneSettingTrueClientIPHeaderEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTrueClientIPHeaderEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingTrueClientIPHeaderEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingTrueClientIPHeaderEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingTrueClientIPHeaderEditResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct +// [ZoneSettingTrueClientIPHeaderEditResponseEnvelopeMessages] +type zoneSettingTrueClientIPHeaderEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTrueClientIPHeaderEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingTrueClientIPHeaderGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingTrueClientIPHeaderGetResponseEnvelope struct { + Errors []ZoneSettingTrueClientIPHeaderGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingTrueClientIPHeaderGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // Allows customer to continue to use True Client IP (Akamai feature) in the + // headers we send to the origin. This is limited to Enterprise Zones. + Result ZoneSettingTrueClientIPHeaderGetResponse `json:"result"` + JSON zoneSettingTrueClientIPHeaderGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingTrueClientIPHeaderGetResponseEnvelopeJSON contains the JSON metadata +// for the struct [ZoneSettingTrueClientIPHeaderGetResponseEnvelope] +type zoneSettingTrueClientIPHeaderGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTrueClientIPHeaderGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingTrueClientIPHeaderGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingTrueClientIPHeaderGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingTrueClientIPHeaderGetResponseEnvelopeErrorsJSON contains the JSON +// metadata for the struct [ZoneSettingTrueClientIPHeaderGetResponseEnvelopeErrors] +type zoneSettingTrueClientIPHeaderGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTrueClientIPHeaderGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingTrueClientIPHeaderGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingTrueClientIPHeaderGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingTrueClientIPHeaderGetResponseEnvelopeMessagesJSON contains the JSON +// metadata for the struct +// [ZoneSettingTrueClientIPHeaderGetResponseEnvelopeMessages] +type zoneSettingTrueClientIPHeaderGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingTrueClientIPHeaderGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/zonesettingtrueclientipheader_test.go b/zonesettingtrueclientipheader_test.go new file mode 100644 index 00000000000..0fcbdc998b5 --- /dev/null +++ b/zonesettingtrueclientipheader_test.go @@ -0,0 +1,71 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneSettingTrueClientIPHeaderEdit(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.TrueClientIPHeader.Edit(context.TODO(), cloudflare.ZoneSettingTrueClientIPHeaderEditParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Value: cloudflare.F(cloudflare.ZoneSettingTrueClientIPHeaderEditParamsValueOn), + }) + 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 TestZoneSettingTrueClientIPHeaderGet(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Settings.TrueClientIPHeader.Get(context.TODO(), cloudflare.ZoneSettingTrueClientIPHeaderGetParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/settingwaf.go b/zonesettingwaf.go similarity index 53% rename from settingwaf.go rename to zonesettingwaf.go index 29a1bdd3fd3..64b21127ff4 100644 --- a/settingwaf.go +++ b/zonesettingwaf.go @@ -14,19 +14,20 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -// SettingWAFService contains methods and other services that help with interacting -// with the cloudflare API. Note, unlike clients, this service does not read -// variables from the environment automatically. You should not instantiate this -// service directly, and instead use the [NewSettingWAFService] method instead. -type SettingWAFService struct { +// ZoneSettingWAFService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewZoneSettingWAFService] method +// instead. +type ZoneSettingWAFService struct { Options []option.RequestOption } -// NewSettingWAFService generates a new service that applies the given options to -// each request. These options are applied after the parent client's options (if +// NewZoneSettingWAFService generates a new service that applies the given options +// to each request. These options are applied after the parent client's options (if // there is one), and before any request-specific options. -func NewSettingWAFService(opts ...option.RequestOption) (r *SettingWAFService) { - r = &SettingWAFService{} +func NewZoneSettingWAFService(opts ...option.RequestOption) (r *ZoneSettingWAFService) { + r = &ZoneSettingWAFService{} r.Options = opts return } @@ -41,9 +42,9 @@ func NewSettingWAFService(opts ...option.RequestOption) (r *SettingWAFService) { // Cloudflare's WAF will block any traffic identified as illegitimate before it // reaches your origin web server. // (https://support.cloudflare.com/hc/en-us/articles/200172016). -func (r *SettingWAFService) Edit(ctx context.Context, params SettingWAFEditParams, opts ...option.RequestOption) (res *SettingWAFEditResponse, err error) { +func (r *ZoneSettingWAFService) Edit(ctx context.Context, params ZoneSettingWAFEditParams, opts ...option.RequestOption) (res *ZoneSettingWAFEditResponse, err error) { opts = append(r.Options[:], opts...) - var env SettingWAFEditResponseEnvelope + var env ZoneSettingWAFEditResponseEnvelope path := fmt.Sprintf("zones/%s/settings/waf", params.ZoneID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) if err != nil { @@ -63,9 +64,9 @@ func (r *SettingWAFService) Edit(ctx context.Context, params SettingWAFEditParam // Cloudflare's WAF will block any traffic identified as illegitimate before it // reaches your origin web server. // (https://support.cloudflare.com/hc/en-us/articles/200172016). -func (r *SettingWAFService) Get(ctx context.Context, query SettingWAFGetParams, opts ...option.RequestOption) (res *SettingWAFGetResponse, err error) { +func (r *ZoneSettingWAFService) Get(ctx context.Context, query ZoneSettingWAFGetParams, opts ...option.RequestOption) (res *ZoneSettingWAFGetResponse, err error) { opts = append(r.Options[:], opts...) - var env SettingWAFGetResponseEnvelope + var env ZoneSettingWAFGetResponseEnvelope path := fmt.Sprintf("zones/%s/settings/waf", query.ZoneID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) if err != nil { @@ -85,22 +86,22 @@ func (r *SettingWAFService) Get(ctx context.Context, query SettingWAFGetParams, // Cloudflare's WAF will block any traffic identified as illegitimate before it // reaches your origin web server. // (https://support.cloudflare.com/hc/en-us/articles/200172016). -type SettingWAFEditResponse struct { +type ZoneSettingWAFEditResponse struct { // ID of the zone setting. - ID SettingWAFEditResponseID `json:"id,required"` + ID ZoneSettingWAFEditResponseID `json:"id,required"` // Current value of the zone setting. - Value SettingWAFEditResponseValue `json:"value,required"` + Value ZoneSettingWAFEditResponseValue `json:"value,required"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable SettingWAFEditResponseEditable `json:"editable"` + Editable ZoneSettingWAFEditResponseEditable `json:"editable"` // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingWAFEditResponseJSON `json:"-"` + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingWAFEditResponseJSON `json:"-"` } -// settingWAFEditResponseJSON contains the JSON metadata for the struct -// [SettingWAFEditResponse] -type settingWAFEditResponseJSON struct { +// zoneSettingWAFEditResponseJSON contains the JSON metadata for the struct +// [ZoneSettingWAFEditResponse] +type zoneSettingWAFEditResponseJSON struct { ID apijson.Field Value apijson.Field Editable apijson.Field @@ -109,32 +110,32 @@ type settingWAFEditResponseJSON struct { ExtraFields map[string]apijson.Field } -func (r *SettingWAFEditResponse) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingWAFEditResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // ID of the zone setting. -type SettingWAFEditResponseID string +type ZoneSettingWAFEditResponseID string const ( - SettingWAFEditResponseIDWAF SettingWAFEditResponseID = "waf" + ZoneSettingWAFEditResponseIDWAF ZoneSettingWAFEditResponseID = "waf" ) // Current value of the zone setting. -type SettingWAFEditResponseValue string +type ZoneSettingWAFEditResponseValue string const ( - SettingWAFEditResponseValueOn SettingWAFEditResponseValue = "on" - SettingWAFEditResponseValueOff SettingWAFEditResponseValue = "off" + ZoneSettingWAFEditResponseValueOn ZoneSettingWAFEditResponseValue = "on" + ZoneSettingWAFEditResponseValueOff ZoneSettingWAFEditResponseValue = "off" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type SettingWAFEditResponseEditable bool +type ZoneSettingWAFEditResponseEditable bool const ( - SettingWAFEditResponseEditableTrue SettingWAFEditResponseEditable = true - SettingWAFEditResponseEditableFalse SettingWAFEditResponseEditable = false + ZoneSettingWAFEditResponseEditableTrue ZoneSettingWAFEditResponseEditable = true + ZoneSettingWAFEditResponseEditableFalse ZoneSettingWAFEditResponseEditable = false ) // The WAF examines HTTP requests to your website. It inspects both GET and POST @@ -147,22 +148,22 @@ const ( // Cloudflare's WAF will block any traffic identified as illegitimate before it // reaches your origin web server. // (https://support.cloudflare.com/hc/en-us/articles/200172016). -type SettingWAFGetResponse struct { +type ZoneSettingWAFGetResponse struct { // ID of the zone setting. - ID SettingWAFGetResponseID `json:"id,required"` + ID ZoneSettingWAFGetResponseID `json:"id,required"` // Current value of the zone setting. - Value SettingWAFGetResponseValue `json:"value,required"` + Value ZoneSettingWAFGetResponseValue `json:"value,required"` // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). - Editable SettingWAFGetResponseEditable `json:"editable"` + Editable ZoneSettingWAFGetResponseEditable `json:"editable"` // last time this setting was modified. - ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` - JSON settingWAFGetResponseJSON `json:"-"` + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingWAFGetResponseJSON `json:"-"` } -// settingWAFGetResponseJSON contains the JSON metadata for the struct -// [SettingWAFGetResponse] -type settingWAFGetResponseJSON struct { +// zoneSettingWAFGetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingWAFGetResponse] +type zoneSettingWAFGetResponseJSON struct { ID apijson.Field Value apijson.Field Editable apijson.Field @@ -171,56 +172,56 @@ type settingWAFGetResponseJSON struct { ExtraFields map[string]apijson.Field } -func (r *SettingWAFGetResponse) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingWAFGetResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } // ID of the zone setting. -type SettingWAFGetResponseID string +type ZoneSettingWAFGetResponseID string const ( - SettingWAFGetResponseIDWAF SettingWAFGetResponseID = "waf" + ZoneSettingWAFGetResponseIDWAF ZoneSettingWAFGetResponseID = "waf" ) // Current value of the zone setting. -type SettingWAFGetResponseValue string +type ZoneSettingWAFGetResponseValue string const ( - SettingWAFGetResponseValueOn SettingWAFGetResponseValue = "on" - SettingWAFGetResponseValueOff SettingWAFGetResponseValue = "off" + ZoneSettingWAFGetResponseValueOn ZoneSettingWAFGetResponseValue = "on" + ZoneSettingWAFGetResponseValueOff ZoneSettingWAFGetResponseValue = "off" ) // Whether or not this setting can be modified for this zone (based on your // Cloudflare plan level). -type SettingWAFGetResponseEditable bool +type ZoneSettingWAFGetResponseEditable bool const ( - SettingWAFGetResponseEditableTrue SettingWAFGetResponseEditable = true - SettingWAFGetResponseEditableFalse SettingWAFGetResponseEditable = false + ZoneSettingWAFGetResponseEditableTrue ZoneSettingWAFGetResponseEditable = true + ZoneSettingWAFGetResponseEditableFalse ZoneSettingWAFGetResponseEditable = false ) -type SettingWAFEditParams struct { +type ZoneSettingWAFEditParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` // Value of the zone setting. - Value param.Field[SettingWAFEditParamsValue] `json:"value,required"` + Value param.Field[ZoneSettingWAFEditParamsValue] `json:"value,required"` } -func (r SettingWAFEditParams) MarshalJSON() (data []byte, err error) { +func (r ZoneSettingWAFEditParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Value of the zone setting. -type SettingWAFEditParamsValue string +type ZoneSettingWAFEditParamsValue string const ( - SettingWAFEditParamsValueOn SettingWAFEditParamsValue = "on" - SettingWAFEditParamsValueOff SettingWAFEditParamsValue = "off" + ZoneSettingWAFEditParamsValueOn ZoneSettingWAFEditParamsValue = "on" + ZoneSettingWAFEditParamsValueOff ZoneSettingWAFEditParamsValue = "off" ) -type SettingWAFEditResponseEnvelope struct { - Errors []SettingWAFEditResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingWAFEditResponseEnvelopeMessages `json:"messages,required"` +type ZoneSettingWAFEditResponseEnvelope struct { + Errors []ZoneSettingWAFEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingWAFEditResponseEnvelopeMessages `json:"messages,required"` // Whether the API call was successful Success bool `json:"success,required"` // The WAF examines HTTP requests to your website. It inspects both GET and POST @@ -233,13 +234,13 @@ type SettingWAFEditResponseEnvelope struct { // Cloudflare's WAF will block any traffic identified as illegitimate before it // reaches your origin web server. // (https://support.cloudflare.com/hc/en-us/articles/200172016). - Result SettingWAFEditResponse `json:"result"` - JSON settingWAFEditResponseEnvelopeJSON `json:"-"` + Result ZoneSettingWAFEditResponse `json:"result"` + JSON zoneSettingWAFEditResponseEnvelopeJSON `json:"-"` } -// settingWAFEditResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingWAFEditResponseEnvelope] -type settingWAFEditResponseEnvelopeJSON struct { +// zoneSettingWAFEditResponseEnvelopeJSON contains the JSON metadata for the struct +// [ZoneSettingWAFEditResponseEnvelope] +type zoneSettingWAFEditResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field Success apijson.Field @@ -248,56 +249,56 @@ type settingWAFEditResponseEnvelopeJSON struct { ExtraFields map[string]apijson.Field } -func (r *SettingWAFEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingWAFEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type SettingWAFEditResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingWAFEditResponseEnvelopeErrorsJSON `json:"-"` +type ZoneSettingWAFEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingWAFEditResponseEnvelopeErrorsJSON `json:"-"` } -// settingWAFEditResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingWAFEditResponseEnvelopeErrors] -type settingWAFEditResponseEnvelopeErrorsJSON struct { +// zoneSettingWAFEditResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [ZoneSettingWAFEditResponseEnvelopeErrors] +type zoneSettingWAFEditResponseEnvelopeErrorsJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *SettingWAFEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingWAFEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type SettingWAFEditResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingWAFEditResponseEnvelopeMessagesJSON `json:"-"` +type ZoneSettingWAFEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingWAFEditResponseEnvelopeMessagesJSON `json:"-"` } -// settingWAFEditResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingWAFEditResponseEnvelopeMessages] -type settingWAFEditResponseEnvelopeMessagesJSON struct { +// zoneSettingWAFEditResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingWAFEditResponseEnvelopeMessages] +type zoneSettingWAFEditResponseEnvelopeMessagesJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *SettingWAFEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingWAFEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type SettingWAFGetParams struct { +type ZoneSettingWAFGetParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` } -type SettingWAFGetResponseEnvelope struct { - Errors []SettingWAFGetResponseEnvelopeErrors `json:"errors,required"` - Messages []SettingWAFGetResponseEnvelopeMessages `json:"messages,required"` +type ZoneSettingWAFGetResponseEnvelope struct { + Errors []ZoneSettingWAFGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingWAFGetResponseEnvelopeMessages `json:"messages,required"` // Whether the API call was successful Success bool `json:"success,required"` // The WAF examines HTTP requests to your website. It inspects both GET and POST @@ -310,13 +311,13 @@ type SettingWAFGetResponseEnvelope struct { // Cloudflare's WAF will block any traffic identified as illegitimate before it // reaches your origin web server. // (https://support.cloudflare.com/hc/en-us/articles/200172016). - Result SettingWAFGetResponse `json:"result"` - JSON settingWAFGetResponseEnvelopeJSON `json:"-"` + Result ZoneSettingWAFGetResponse `json:"result"` + JSON zoneSettingWAFGetResponseEnvelopeJSON `json:"-"` } -// settingWAFGetResponseEnvelopeJSON contains the JSON metadata for the struct -// [SettingWAFGetResponseEnvelope] -type settingWAFGetResponseEnvelopeJSON struct { +// zoneSettingWAFGetResponseEnvelopeJSON contains the JSON metadata for the struct +// [ZoneSettingWAFGetResponseEnvelope] +type zoneSettingWAFGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field Success apijson.Field @@ -325,44 +326,44 @@ type settingWAFGetResponseEnvelopeJSON struct { ExtraFields map[string]apijson.Field } -func (r *SettingWAFGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingWAFGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type SettingWAFGetResponseEnvelopeErrors struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingWAFGetResponseEnvelopeErrorsJSON `json:"-"` +type ZoneSettingWAFGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingWAFGetResponseEnvelopeErrorsJSON `json:"-"` } -// settingWAFGetResponseEnvelopeErrorsJSON contains the JSON metadata for the -// struct [SettingWAFGetResponseEnvelopeErrors] -type settingWAFGetResponseEnvelopeErrorsJSON struct { +// zoneSettingWAFGetResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [ZoneSettingWAFGetResponseEnvelopeErrors] +type zoneSettingWAFGetResponseEnvelopeErrorsJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *SettingWAFGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingWAFGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -type SettingWAFGetResponseEnvelopeMessages struct { - Code int64 `json:"code,required"` - Message string `json:"message,required"` - JSON settingWAFGetResponseEnvelopeMessagesJSON `json:"-"` +type ZoneSettingWAFGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingWAFGetResponseEnvelopeMessagesJSON `json:"-"` } -// settingWAFGetResponseEnvelopeMessagesJSON contains the JSON metadata for the -// struct [SettingWAFGetResponseEnvelopeMessages] -type settingWAFGetResponseEnvelopeMessagesJSON struct { +// zoneSettingWAFGetResponseEnvelopeMessagesJSON contains the JSON metadata for the +// struct [ZoneSettingWAFGetResponseEnvelopeMessages] +type zoneSettingWAFGetResponseEnvelopeMessagesJSON struct { Code apijson.Field Message apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *SettingWAFGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { +func (r *ZoneSettingWAFGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } diff --git a/settingzerortt_test.go b/zonesettingwaf_test.go similarity index 86% rename from settingzerortt_test.go rename to zonesettingwaf_test.go index ae556ca37c6..96f29be612f 100644 --- a/settingzerortt_test.go +++ b/zonesettingwaf_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingZeroRTTEdit(t *testing.T) { +func TestZoneSettingWAFEdit(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 { @@ -29,9 +29,9 @@ func TestSettingZeroRTTEdit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.ZeroRTT.Edit(context.TODO(), cloudflare.SettingZeroRTTEditParams{ + _, err := client.Zones.Settings.WAF.Edit(context.TODO(), cloudflare.ZoneSettingWAFEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingZeroRTTEditParamsValueOn), + Value: cloudflare.F(cloudflare.ZoneSettingWAFEditParamsValueOn), }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +42,7 @@ func TestSettingZeroRTTEdit(t *testing.T) { } } -func TestSettingZeroRTTGet(t *testing.T) { +func TestZoneSettingWAFGet(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 { @@ -58,7 +58,7 @@ func TestSettingZeroRTTGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.ZeroRTT.Get(context.TODO(), cloudflare.SettingZeroRTTGetParams{ + _, err := client.Zones.Settings.WAF.Get(context.TODO(), cloudflare.ZoneSettingWAFGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingwebp.go b/zonesettingwebp.go new file mode 100644 index 00000000000..2d272399f7c --- /dev/null +++ b/zonesettingwebp.go @@ -0,0 +1,327 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingWebpService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewZoneSettingWebpService] method +// instead. +type ZoneSettingWebpService struct { + Options []option.RequestOption +} + +// NewZoneSettingWebpService generates a new service that applies the given options +// to each request. These options are applied after the parent client's options (if +// there is one), and before any request-specific options. +func NewZoneSettingWebpService(opts ...option.RequestOption) (r *ZoneSettingWebpService) { + r = &ZoneSettingWebpService{} + r.Options = opts + return +} + +// When the client requesting the image supports the WebP image codec, and WebP +// offers a performance advantage over the original image format, Cloudflare will +// serve a WebP version of the original image. +func (r *ZoneSettingWebpService) Edit(ctx context.Context, params ZoneSettingWebpEditParams, opts ...option.RequestOption) (res *ZoneSettingWebpEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingWebpEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/webp", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// When the client requesting the image supports the WebP image codec, and WebP +// offers a performance advantage over the original image format, Cloudflare will +// serve a WebP version of the original image. +func (r *ZoneSettingWebpService) Get(ctx context.Context, query ZoneSettingWebpGetParams, opts ...option.RequestOption) (res *ZoneSettingWebpGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingWebpGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/webp", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// When the client requesting the image supports the WebP image codec, and WebP +// offers a performance advantage over the original image format, Cloudflare will +// serve a WebP version of the original image. +type ZoneSettingWebpEditResponse struct { + // ID of the zone setting. + ID ZoneSettingWebpEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingWebpEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingWebpEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingWebpEditResponseJSON `json:"-"` +} + +// zoneSettingWebpEditResponseJSON contains the JSON metadata for the struct +// [ZoneSettingWebpEditResponse] +type zoneSettingWebpEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingWebpEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingWebpEditResponseID string + +const ( + ZoneSettingWebpEditResponseIDWebp ZoneSettingWebpEditResponseID = "webp" +) + +// Current value of the zone setting. +type ZoneSettingWebpEditResponseValue string + +const ( + ZoneSettingWebpEditResponseValueOff ZoneSettingWebpEditResponseValue = "off" + ZoneSettingWebpEditResponseValueOn ZoneSettingWebpEditResponseValue = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingWebpEditResponseEditable bool + +const ( + ZoneSettingWebpEditResponseEditableTrue ZoneSettingWebpEditResponseEditable = true + ZoneSettingWebpEditResponseEditableFalse ZoneSettingWebpEditResponseEditable = false +) + +// When the client requesting the image supports the WebP image codec, and WebP +// offers a performance advantage over the original image format, Cloudflare will +// serve a WebP version of the original image. +type ZoneSettingWebpGetResponse struct { + // ID of the zone setting. + ID ZoneSettingWebpGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingWebpGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingWebpGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingWebpGetResponseJSON `json:"-"` +} + +// zoneSettingWebpGetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingWebpGetResponse] +type zoneSettingWebpGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingWebpGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingWebpGetResponseID string + +const ( + ZoneSettingWebpGetResponseIDWebp ZoneSettingWebpGetResponseID = "webp" +) + +// Current value of the zone setting. +type ZoneSettingWebpGetResponseValue string + +const ( + ZoneSettingWebpGetResponseValueOff ZoneSettingWebpGetResponseValue = "off" + ZoneSettingWebpGetResponseValueOn ZoneSettingWebpGetResponseValue = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingWebpGetResponseEditable bool + +const ( + ZoneSettingWebpGetResponseEditableTrue ZoneSettingWebpGetResponseEditable = true + ZoneSettingWebpGetResponseEditableFalse ZoneSettingWebpGetResponseEditable = false +) + +type ZoneSettingWebpEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingWebpEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingWebpEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingWebpEditParamsValue string + +const ( + ZoneSettingWebpEditParamsValueOff ZoneSettingWebpEditParamsValue = "off" + ZoneSettingWebpEditParamsValueOn ZoneSettingWebpEditParamsValue = "on" +) + +type ZoneSettingWebpEditResponseEnvelope struct { + Errors []ZoneSettingWebpEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingWebpEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // When the client requesting the image supports the WebP image codec, and WebP + // offers a performance advantage over the original image format, Cloudflare will + // serve a WebP version of the original image. + Result ZoneSettingWebpEditResponse `json:"result"` + JSON zoneSettingWebpEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingWebpEditResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingWebpEditResponseEnvelope] +type zoneSettingWebpEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingWebpEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingWebpEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingWebpEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingWebpEditResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [ZoneSettingWebpEditResponseEnvelopeErrors] +type zoneSettingWebpEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingWebpEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingWebpEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingWebpEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingWebpEditResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingWebpEditResponseEnvelopeMessages] +type zoneSettingWebpEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingWebpEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingWebpGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingWebpGetResponseEnvelope struct { + Errors []ZoneSettingWebpGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingWebpGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // When the client requesting the image supports the WebP image codec, and WebP + // offers a performance advantage over the original image format, Cloudflare will + // serve a WebP version of the original image. + Result ZoneSettingWebpGetResponse `json:"result"` + JSON zoneSettingWebpGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingWebpGetResponseEnvelopeJSON contains the JSON metadata for the struct +// [ZoneSettingWebpGetResponseEnvelope] +type zoneSettingWebpGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingWebpGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingWebpGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingWebpGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingWebpGetResponseEnvelopeErrorsJSON contains the JSON metadata for the +// struct [ZoneSettingWebpGetResponseEnvelopeErrors] +type zoneSettingWebpGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingWebpGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingWebpGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingWebpGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingWebpGetResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingWebpGetResponseEnvelopeMessages] +type zoneSettingWebpGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingWebpGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingbrotli_test.go b/zonesettingwebp_test.go similarity index 85% rename from settingbrotli_test.go rename to zonesettingwebp_test.go index 901c3cc3456..d220fa82348 100644 --- a/settingbrotli_test.go +++ b/zonesettingwebp_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingBrotliEdit(t *testing.T) { +func TestZoneSettingWebpEdit(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 { @@ -29,9 +29,9 @@ func TestSettingBrotliEdit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.Brotli.Edit(context.TODO(), cloudflare.SettingBrotliEditParams{ + _, err := client.Zones.Settings.Webp.Edit(context.TODO(), cloudflare.ZoneSettingWebpEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingBrotliEditParamsValueOff), + Value: cloudflare.F(cloudflare.ZoneSettingWebpEditParamsValueOff), }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +42,7 @@ func TestSettingBrotliEdit(t *testing.T) { } } -func TestSettingBrotliGet(t *testing.T) { +func TestZoneSettingWebpGet(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 { @@ -58,7 +58,7 @@ func TestSettingBrotliGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.Brotli.Get(context.TODO(), cloudflare.SettingBrotliGetParams{ + _, err := client.Zones.Settings.Webp.Get(context.TODO(), cloudflare.ZoneSettingWebpGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingwebsocket.go b/zonesettingwebsocket.go new file mode 100644 index 00000000000..0c7081f6071 --- /dev/null +++ b/zonesettingwebsocket.go @@ -0,0 +1,342 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingWebsocketService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewZoneSettingWebsocketService] +// method instead. +type ZoneSettingWebsocketService struct { + Options []option.RequestOption +} + +// NewZoneSettingWebsocketService generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewZoneSettingWebsocketService(opts ...option.RequestOption) (r *ZoneSettingWebsocketService) { + r = &ZoneSettingWebsocketService{} + r.Options = opts + return +} + +// Changes Websockets setting. For more information about Websockets, please refer +// to +// [Using Cloudflare with WebSockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Using-Cloudflare-with-WebSockets). +func (r *ZoneSettingWebsocketService) Edit(ctx context.Context, params ZoneSettingWebsocketEditParams, opts ...option.RequestOption) (res *ZoneSettingWebsocketEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingWebsocketEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/websockets", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Gets Websockets setting. For more information about Websockets, please refer to +// [Using Cloudflare with WebSockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Using-Cloudflare-with-WebSockets). +func (r *ZoneSettingWebsocketService) Get(ctx context.Context, query ZoneSettingWebsocketGetParams, opts ...option.RequestOption) (res *ZoneSettingWebsocketGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingWebsocketGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/websockets", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// WebSockets are open connections sustained between the client and the origin +// server. Inside a WebSockets connection, the client and the origin can pass data +// back and forth without having to reestablish sessions. This makes exchanging +// data within a WebSockets connection fast. WebSockets are often used for +// real-time applications such as live chat and gaming. For more information refer +// to +// [Can I use Cloudflare with Websockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Can-I-use-Cloudflare-with-WebSockets-). +type ZoneSettingWebsocketEditResponse struct { + // ID of the zone setting. + ID ZoneSettingWebsocketEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingWebsocketEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingWebsocketEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingWebsocketEditResponseJSON `json:"-"` +} + +// zoneSettingWebsocketEditResponseJSON contains the JSON metadata for the struct +// [ZoneSettingWebsocketEditResponse] +type zoneSettingWebsocketEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingWebsocketEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingWebsocketEditResponseID string + +const ( + ZoneSettingWebsocketEditResponseIDWebsockets ZoneSettingWebsocketEditResponseID = "websockets" +) + +// Current value of the zone setting. +type ZoneSettingWebsocketEditResponseValue string + +const ( + ZoneSettingWebsocketEditResponseValueOff ZoneSettingWebsocketEditResponseValue = "off" + ZoneSettingWebsocketEditResponseValueOn ZoneSettingWebsocketEditResponseValue = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingWebsocketEditResponseEditable bool + +const ( + ZoneSettingWebsocketEditResponseEditableTrue ZoneSettingWebsocketEditResponseEditable = true + ZoneSettingWebsocketEditResponseEditableFalse ZoneSettingWebsocketEditResponseEditable = false +) + +// WebSockets are open connections sustained between the client and the origin +// server. Inside a WebSockets connection, the client and the origin can pass data +// back and forth without having to reestablish sessions. This makes exchanging +// data within a WebSockets connection fast. WebSockets are often used for +// real-time applications such as live chat and gaming. For more information refer +// to +// [Can I use Cloudflare with Websockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Can-I-use-Cloudflare-with-WebSockets-). +type ZoneSettingWebsocketGetResponse struct { + // ID of the zone setting. + ID ZoneSettingWebsocketGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingWebsocketGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingWebsocketGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingWebsocketGetResponseJSON `json:"-"` +} + +// zoneSettingWebsocketGetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingWebsocketGetResponse] +type zoneSettingWebsocketGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingWebsocketGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingWebsocketGetResponseID string + +const ( + ZoneSettingWebsocketGetResponseIDWebsockets ZoneSettingWebsocketGetResponseID = "websockets" +) + +// Current value of the zone setting. +type ZoneSettingWebsocketGetResponseValue string + +const ( + ZoneSettingWebsocketGetResponseValueOff ZoneSettingWebsocketGetResponseValue = "off" + ZoneSettingWebsocketGetResponseValueOn ZoneSettingWebsocketGetResponseValue = "on" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingWebsocketGetResponseEditable bool + +const ( + ZoneSettingWebsocketGetResponseEditableTrue ZoneSettingWebsocketGetResponseEditable = true + ZoneSettingWebsocketGetResponseEditableFalse ZoneSettingWebsocketGetResponseEditable = false +) + +type ZoneSettingWebsocketEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the zone setting. + Value param.Field[ZoneSettingWebsocketEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingWebsocketEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the zone setting. +type ZoneSettingWebsocketEditParamsValue string + +const ( + ZoneSettingWebsocketEditParamsValueOff ZoneSettingWebsocketEditParamsValue = "off" + ZoneSettingWebsocketEditParamsValueOn ZoneSettingWebsocketEditParamsValue = "on" +) + +type ZoneSettingWebsocketEditResponseEnvelope struct { + Errors []ZoneSettingWebsocketEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingWebsocketEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // WebSockets are open connections sustained between the client and the origin + // server. Inside a WebSockets connection, the client and the origin can pass data + // back and forth without having to reestablish sessions. This makes exchanging + // data within a WebSockets connection fast. WebSockets are often used for + // real-time applications such as live chat and gaming. For more information refer + // to + // [Can I use Cloudflare with Websockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Can-I-use-Cloudflare-with-WebSockets-). + Result ZoneSettingWebsocketEditResponse `json:"result"` + JSON zoneSettingWebsocketEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingWebsocketEditResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingWebsocketEditResponseEnvelope] +type zoneSettingWebsocketEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingWebsocketEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingWebsocketEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingWebsocketEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingWebsocketEditResponseEnvelopeErrorsJSON contains the JSON metadata +// for the struct [ZoneSettingWebsocketEditResponseEnvelopeErrors] +type zoneSettingWebsocketEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingWebsocketEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingWebsocketEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingWebsocketEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingWebsocketEditResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [ZoneSettingWebsocketEditResponseEnvelopeMessages] +type zoneSettingWebsocketEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingWebsocketEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingWebsocketGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingWebsocketGetResponseEnvelope struct { + Errors []ZoneSettingWebsocketGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingWebsocketGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // WebSockets are open connections sustained between the client and the origin + // server. Inside a WebSockets connection, the client and the origin can pass data + // back and forth without having to reestablish sessions. This makes exchanging + // data within a WebSockets connection fast. WebSockets are often used for + // real-time applications such as live chat and gaming. For more information refer + // to + // [Can I use Cloudflare with Websockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Can-I-use-Cloudflare-with-WebSockets-). + Result ZoneSettingWebsocketGetResponse `json:"result"` + JSON zoneSettingWebsocketGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingWebsocketGetResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingWebsocketGetResponseEnvelope] +type zoneSettingWebsocketGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingWebsocketGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingWebsocketGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingWebsocketGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingWebsocketGetResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [ZoneSettingWebsocketGetResponseEnvelopeErrors] +type zoneSettingWebsocketGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingWebsocketGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingWebsocketGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingWebsocketGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingWebsocketGetResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [ZoneSettingWebsocketGetResponseEnvelopeMessages] +type zoneSettingWebsocketGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingWebsocketGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingsecuritylevel_test.go b/zonesettingwebsocket_test.go similarity index 85% rename from settingsecuritylevel_test.go rename to zonesettingwebsocket_test.go index d53c4011e09..751c5fc775d 100644 --- a/settingsecuritylevel_test.go +++ b/zonesettingwebsocket_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingSecurityLevelEdit(t *testing.T) { +func TestZoneSettingWebsocketEdit(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 { @@ -29,9 +29,9 @@ func TestSettingSecurityLevelEdit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.SecurityLevel.Edit(context.TODO(), cloudflare.SettingSecurityLevelEditParams{ + _, err := client.Zones.Settings.Websocket.Edit(context.TODO(), cloudflare.ZoneSettingWebsocketEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingSecurityLevelEditParamsValueOff), + Value: cloudflare.F(cloudflare.ZoneSettingWebsocketEditParamsValueOff), }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +42,7 @@ func TestSettingSecurityLevelEdit(t *testing.T) { } } -func TestSettingSecurityLevelGet(t *testing.T) { +func TestZoneSettingWebsocketGet(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 { @@ -58,7 +58,7 @@ func TestSettingSecurityLevelGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.SecurityLevel.Get(context.TODO(), cloudflare.SettingSecurityLevelGetParams{ + _, err := client.Zones.Settings.Websocket.Get(context.TODO(), cloudflare.ZoneSettingWebsocketGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zonesettingzerortt.go b/zonesettingzerortt.go new file mode 100644 index 00000000000..dc98152dfa7 --- /dev/null +++ b/zonesettingzerortt.go @@ -0,0 +1,315 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneSettingZeroRTTService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewZoneSettingZeroRTTService] method +// instead. +type ZoneSettingZeroRTTService struct { + Options []option.RequestOption +} + +// NewZoneSettingZeroRTTService generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewZoneSettingZeroRTTService(opts ...option.RequestOption) (r *ZoneSettingZeroRTTService) { + r = &ZoneSettingZeroRTTService{} + r.Options = opts + return +} + +// Changes the 0-RTT session resumption setting. +func (r *ZoneSettingZeroRTTService) Edit(ctx context.Context, params ZoneSettingZeroRTTEditParams, opts ...option.RequestOption) (res *ZoneSettingZeroRTTEditResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingZeroRTTEditResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/0rtt", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Gets 0-RTT session resumption setting. +func (r *ZoneSettingZeroRTTService) Get(ctx context.Context, query ZoneSettingZeroRTTGetParams, opts ...option.RequestOption) (res *ZoneSettingZeroRTTGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneSettingZeroRTTGetResponseEnvelope + path := fmt.Sprintf("zones/%s/settings/0rtt", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// 0-RTT session resumption enabled for this zone. +type ZoneSettingZeroRTTEditResponse struct { + // ID of the zone setting. + ID ZoneSettingZeroRTTEditResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingZeroRTTEditResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingZeroRTTEditResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingZeroRTTEditResponseJSON `json:"-"` +} + +// zoneSettingZeroRTTEditResponseJSON contains the JSON metadata for the struct +// [ZoneSettingZeroRTTEditResponse] +type zoneSettingZeroRTTEditResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZeroRTTEditResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingZeroRTTEditResponseID string + +const ( + ZoneSettingZeroRTTEditResponseID0rtt ZoneSettingZeroRTTEditResponseID = "0rtt" +) + +// Current value of the zone setting. +type ZoneSettingZeroRTTEditResponseValue string + +const ( + ZoneSettingZeroRTTEditResponseValueOn ZoneSettingZeroRTTEditResponseValue = "on" + ZoneSettingZeroRTTEditResponseValueOff ZoneSettingZeroRTTEditResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingZeroRTTEditResponseEditable bool + +const ( + ZoneSettingZeroRTTEditResponseEditableTrue ZoneSettingZeroRTTEditResponseEditable = true + ZoneSettingZeroRTTEditResponseEditableFalse ZoneSettingZeroRTTEditResponseEditable = false +) + +// 0-RTT session resumption enabled for this zone. +type ZoneSettingZeroRTTGetResponse struct { + // ID of the zone setting. + ID ZoneSettingZeroRTTGetResponseID `json:"id,required"` + // Current value of the zone setting. + Value ZoneSettingZeroRTTGetResponseValue `json:"value,required"` + // Whether or not this setting can be modified for this zone (based on your + // Cloudflare plan level). + Editable ZoneSettingZeroRTTGetResponseEditable `json:"editable"` + // last time this setting was modified. + ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"` + JSON zoneSettingZeroRTTGetResponseJSON `json:"-"` +} + +// zoneSettingZeroRTTGetResponseJSON contains the JSON metadata for the struct +// [ZoneSettingZeroRTTGetResponse] +type zoneSettingZeroRTTGetResponseJSON struct { + ID apijson.Field + Value apijson.Field + Editable apijson.Field + ModifiedOn apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZeroRTTGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// ID of the zone setting. +type ZoneSettingZeroRTTGetResponseID string + +const ( + ZoneSettingZeroRTTGetResponseID0rtt ZoneSettingZeroRTTGetResponseID = "0rtt" +) + +// Current value of the zone setting. +type ZoneSettingZeroRTTGetResponseValue string + +const ( + ZoneSettingZeroRTTGetResponseValueOn ZoneSettingZeroRTTGetResponseValue = "on" + ZoneSettingZeroRTTGetResponseValueOff ZoneSettingZeroRTTGetResponseValue = "off" +) + +// Whether or not this setting can be modified for this zone (based on your +// Cloudflare plan level). +type ZoneSettingZeroRTTGetResponseEditable bool + +const ( + ZoneSettingZeroRTTGetResponseEditableTrue ZoneSettingZeroRTTGetResponseEditable = true + ZoneSettingZeroRTTGetResponseEditableFalse ZoneSettingZeroRTTGetResponseEditable = false +) + +type ZoneSettingZeroRTTEditParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // Value of the 0-RTT setting. + Value param.Field[ZoneSettingZeroRTTEditParamsValue] `json:"value,required"` +} + +func (r ZoneSettingZeroRTTEditParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Value of the 0-RTT setting. +type ZoneSettingZeroRTTEditParamsValue string + +const ( + ZoneSettingZeroRTTEditParamsValueOn ZoneSettingZeroRTTEditParamsValue = "on" + ZoneSettingZeroRTTEditParamsValueOff ZoneSettingZeroRTTEditParamsValue = "off" +) + +type ZoneSettingZeroRTTEditResponseEnvelope struct { + Errors []ZoneSettingZeroRTTEditResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingZeroRTTEditResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // 0-RTT session resumption enabled for this zone. + Result ZoneSettingZeroRTTEditResponse `json:"result"` + JSON zoneSettingZeroRTTEditResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingZeroRTTEditResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingZeroRTTEditResponseEnvelope] +type zoneSettingZeroRTTEditResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZeroRTTEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingZeroRTTEditResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingZeroRTTEditResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingZeroRTTEditResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [ZoneSettingZeroRTTEditResponseEnvelopeErrors] +type zoneSettingZeroRTTEditResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZeroRTTEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingZeroRTTEditResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingZeroRTTEditResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingZeroRTTEditResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [ZoneSettingZeroRTTEditResponseEnvelopeMessages] +type zoneSettingZeroRTTEditResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZeroRTTEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingZeroRTTGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneSettingZeroRTTGetResponseEnvelope struct { + Errors []ZoneSettingZeroRTTGetResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneSettingZeroRTTGetResponseEnvelopeMessages `json:"messages,required"` + // Whether the API call was successful + Success bool `json:"success,required"` + // 0-RTT session resumption enabled for this zone. + Result ZoneSettingZeroRTTGetResponse `json:"result"` + JSON zoneSettingZeroRTTGetResponseEnvelopeJSON `json:"-"` +} + +// zoneSettingZeroRTTGetResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneSettingZeroRTTGetResponseEnvelope] +type zoneSettingZeroRTTGetResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZeroRTTGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingZeroRTTGetResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingZeroRTTGetResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneSettingZeroRTTGetResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [ZoneSettingZeroRTTGetResponseEnvelopeErrors] +type zoneSettingZeroRTTGetResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZeroRTTGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneSettingZeroRTTGetResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneSettingZeroRTTGetResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneSettingZeroRTTGetResponseEnvelopeMessagesJSON contains the JSON metadata for +// the struct [ZoneSettingZeroRTTGetResponseEnvelopeMessages] +type zoneSettingZeroRTTGetResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneSettingZeroRTTGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} diff --git a/settingfontsetting_test.go b/zonesettingzerortt_test.go similarity index 85% rename from settingfontsetting_test.go rename to zonesettingzerortt_test.go index 7aa41628be0..a39fd21ea29 100644 --- a/settingfontsetting_test.go +++ b/zonesettingzerortt_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudflare/cloudflare-sdk-go/option" ) -func TestSettingFontSettingEdit(t *testing.T) { +func TestZoneSettingZeroRTTEdit(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 { @@ -29,9 +29,9 @@ func TestSettingFontSettingEdit(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.FontSettings.Edit(context.TODO(), cloudflare.SettingFontSettingEditParams{ + _, err := client.Zones.Settings.ZeroRTT.Edit(context.TODO(), cloudflare.ZoneSettingZeroRTTEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Value: cloudflare.F(cloudflare.SettingFontSettingEditParamsValueOn), + Value: cloudflare.F(cloudflare.ZoneSettingZeroRTTEditParamsValueOn), }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +42,7 @@ func TestSettingFontSettingEdit(t *testing.T) { } } -func TestSettingFontSettingGet(t *testing.T) { +func TestZoneSettingZeroRTTGet(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 { @@ -58,7 +58,7 @@ func TestSettingFontSettingGet(t *testing.T) { option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), ) - _, err := client.Settings.FontSettings.Get(context.TODO(), cloudflare.SettingFontSettingGetParams{ + _, err := client.Zones.Settings.ZeroRTT.Get(context.TODO(), cloudflare.ZoneSettingZeroRTTGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { diff --git a/zoneworker.go b/zoneworker.go new file mode 100644 index 00000000000..3c33f8f5ef2 --- /dev/null +++ b/zoneworker.go @@ -0,0 +1,26 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +// ZoneWorkerService contains methods and other services that help with interacting +// with the cloudflare API. Note, unlike clients, this service does not read +// variables from the environment automatically. You should not instantiate this +// service directly, and instead use the [NewZoneWorkerService] method instead. +type ZoneWorkerService struct { + Options []option.RequestOption + Script *ZoneWorkerScriptService +} + +// NewZoneWorkerService generates a new service that applies the given options to +// each request. These options are applied after the parent client's options (if +// there is one), and before any request-specific options. +func NewZoneWorkerService(opts ...option.RequestOption) (r *ZoneWorkerService) { + r = &ZoneWorkerService{} + r.Options = opts + r.Script = NewZoneWorkerScriptService(opts...) + return +} diff --git a/zoneworkerscript.go b/zoneworkerscript.go new file mode 100644 index 00000000000..7a1378008a6 --- /dev/null +++ b/zoneworkerscript.go @@ -0,0 +1,168 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare + +import ( + "context" + "fmt" + "net/http" + "reflect" + + "github.com/cloudflare/cloudflare-sdk-go/internal/apijson" + "github.com/cloudflare/cloudflare-sdk-go/internal/param" + "github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig" + "github.com/cloudflare/cloudflare-sdk-go/internal/shared" + "github.com/cloudflare/cloudflare-sdk-go/option" + "github.com/tidwall/gjson" +) + +// ZoneWorkerScriptService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewZoneWorkerScriptService] method +// instead. +type ZoneWorkerScriptService struct { + Options []option.RequestOption +} + +// NewZoneWorkerScriptService generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewZoneWorkerScriptService(opts ...option.RequestOption) (r *ZoneWorkerScriptService) { + r = &ZoneWorkerScriptService{} + r.Options = opts + return +} + +// Upload a worker, or a new version of a worker. +func (r *ZoneWorkerScriptService) Update(ctx context.Context, body ZoneWorkerScriptUpdateParams, opts ...option.RequestOption) (res *ZoneWorkerScriptUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + var env ZoneWorkerScriptUpdateResponseEnvelope + path := fmt.Sprintf("zones/%s/workers/script", body.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Delete your Worker. This call has no response body on a successful delete. +func (r *ZoneWorkerScriptService) Delete(ctx context.Context, body ZoneWorkerScriptDeleteParams, opts ...option.RequestOption) (err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) + path := fmt.Sprintf("zones/%s/workers/script", body.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, nil, opts...) + return +} + +// Fetch raw script content for your worker. Note this is the original script +// content, not JSON encoded. +func (r *ZoneWorkerScriptService) Get(ctx context.Context, query ZoneWorkerScriptGetParams, opts ...option.RequestOption) (res *http.Response, err error) { + opts = append(r.Options[:], opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "undefined")}, opts...) + path := fmt.Sprintf("zones/%s/workers/script", query.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + +// Union satisfied by [ZoneWorkerScriptUpdateResponseUnknown] or +// [shared.UnionString]. +type ZoneWorkerScriptUpdateResponse interface { + ImplementsZoneWorkerScriptUpdateResponse() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ZoneWorkerScriptUpdateResponse)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type ZoneWorkerScriptUpdateParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneWorkerScriptUpdateResponseEnvelope struct { + Errors []ZoneWorkerScriptUpdateResponseEnvelopeErrors `json:"errors,required"` + Messages []ZoneWorkerScriptUpdateResponseEnvelopeMessages `json:"messages,required"` + Result ZoneWorkerScriptUpdateResponse `json:"result,required"` + // Whether the API call was successful + Success ZoneWorkerScriptUpdateResponseEnvelopeSuccess `json:"success,required"` + JSON zoneWorkerScriptUpdateResponseEnvelopeJSON `json:"-"` +} + +// zoneWorkerScriptUpdateResponseEnvelopeJSON contains the JSON metadata for the +// struct [ZoneWorkerScriptUpdateResponseEnvelope] +type zoneWorkerScriptUpdateResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerScriptUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerScriptUpdateResponseEnvelopeErrors struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerScriptUpdateResponseEnvelopeErrorsJSON `json:"-"` +} + +// zoneWorkerScriptUpdateResponseEnvelopeErrorsJSON contains the JSON metadata for +// the struct [ZoneWorkerScriptUpdateResponseEnvelopeErrors] +type zoneWorkerScriptUpdateResponseEnvelopeErrorsJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerScriptUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +type ZoneWorkerScriptUpdateResponseEnvelopeMessages struct { + Code int64 `json:"code,required"` + Message string `json:"message,required"` + JSON zoneWorkerScriptUpdateResponseEnvelopeMessagesJSON `json:"-"` +} + +// zoneWorkerScriptUpdateResponseEnvelopeMessagesJSON contains the JSON metadata +// for the struct [ZoneWorkerScriptUpdateResponseEnvelopeMessages] +type zoneWorkerScriptUpdateResponseEnvelopeMessagesJSON struct { + Code apijson.Field + Message apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ZoneWorkerScriptUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +// Whether the API call was successful +type ZoneWorkerScriptUpdateResponseEnvelopeSuccess bool + +const ( + ZoneWorkerScriptUpdateResponseEnvelopeSuccessTrue ZoneWorkerScriptUpdateResponseEnvelopeSuccess = true +) + +type ZoneWorkerScriptDeleteParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type ZoneWorkerScriptGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} diff --git a/zoneworkerscript_test.go b/zoneworkerscript_test.go new file mode 100644 index 00000000000..3629253e3b2 --- /dev/null +++ b/zoneworkerscript_test.go @@ -0,0 +1,114 @@ +// File generated from our OpenAPI spec by Stainless. + +package cloudflare_test + +import ( + "bytes" + "context" + "errors" + "io" + "net/http" + "net/http/httptest" + "os" + "testing" + + "github.com/cloudflare/cloudflare-sdk-go" + "github.com/cloudflare/cloudflare-sdk-go/internal/testutil" + "github.com/cloudflare/cloudflare-sdk-go/option" +) + +func TestZoneWorkerScriptUpdate(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + _, err := client.Zones.Workers.Script.Update(context.TODO(), cloudflare.ZoneWorkerScriptUpdateParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} + +func TestZoneWorkerScriptDelete(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"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + err := client.Zones.Workers.Script.Delete(context.TODO(), cloudflare.ZoneWorkerScriptDeleteParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} + +func TestZoneWorkerScriptGet(t *testing.T) { + t.Skip("skipped: tests are disabled for the time being") + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(200) + w.Write([]byte("abc")) + })) + defer server.Close() + baseURL := server.URL + client := cloudflare.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), + option.WithAPIEmail("user@example.com"), + option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), + option.WithUserServiceKey("v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719"), + ) + resp, err := client.Zones.Workers.Script.Get(context.TODO(), cloudflare.ZoneWorkerScriptGetParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } + defer resp.Body.Close() + + b, err := io.ReadAll(resp.Body) + 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()) + } + if !bytes.Equal(b, []byte("abc")) { + t.Fatalf("return value not %s: %s", "abc", b) + } +}