# Settings # Zone ## Show DNS Settings `client.DNS.Settings.Zone.Get(ctx, query) (*SettingZoneGetResponse, error)` **get** `/zones/{zone_id}/dns_settings` Show DNS settings for a zone ### Parameters - `query SettingZoneGetParams` - `ZoneID param.Field[string]` Identifier. ### Returns - `type SettingZoneGetResponse struct{…}` - `FlattenAllCNAMEs bool` Whether to flatten all CNAME records in the zone. Note that, due to DNS limitations, a CNAME record at the zone apex will always be flattened. - `FoundationDNS bool` Whether to enable Foundation DNS Advanced Nameservers on the zone. - `InternalDNS SettingZoneGetResponseInternalDNS` Settings for this internal zone. - `ReferenceZoneID string` The ID of the zone to fallback to. - `MultiProvider bool` Whether to enable multi-provider DNS, which causes Cloudflare to activate the zone even when non-Cloudflare NS records exist, and to respect NS records at the zone apex during outbound zone transfers. - `Nameservers SettingZoneGetResponseNameservers` Settings determining the nameservers through which the zone should be available. - `Type SettingZoneGetResponseNameserversType` Nameserver type - `const SettingZoneGetResponseNameserversTypeCloudflareStandard SettingZoneGetResponseNameserversType = "cloudflare.standard"` - `const SettingZoneGetResponseNameserversTypeCustomAccount SettingZoneGetResponseNameserversType = "custom.account"` - `const SettingZoneGetResponseNameserversTypeCustomTenant SettingZoneGetResponseNameserversType = "custom.tenant"` - `const SettingZoneGetResponseNameserversTypeCustomZone SettingZoneGetResponseNameserversType = "custom.zone"` - `NSSet int64` Configured nameserver set to be used for this zone - `NSTTL float64` The time to live (TTL) of the zone's nameserver (NS) records. - `SecondaryOverrides bool` Allows a Secondary DNS zone to use (proxied) override records and CNAME flattening at the zone apex. - `SOA SettingZoneGetResponseSOA` Components of the zone's SOA record. - `Expire float64` Time in seconds of being unable to query the primary server after which secondary servers should stop serving the zone. - `MinTTL float64` The time to live (TTL) for negative caching of records within the zone. - `MNAME string` The primary nameserver, which may be used for outbound zone transfers. If null, a Cloudflare-assigned value will be used. - `Refresh float64` Time in seconds after which secondary servers should re-check the SOA record to see if the zone has been updated. - `Retry float64` Time in seconds after which secondary servers should retry queries after the primary server was unresponsive. - `RNAME string` The email address of the zone administrator, with the first label representing the local part of the email address. - `TTL float64` The time to live (TTL) of the SOA record itself. - `ZoneMode SettingZoneGetResponseZoneMode` Whether the zone mode is a regular or CDN/DNS only zone. - `const SettingZoneGetResponseZoneModeStandard SettingZoneGetResponseZoneMode = "standard"` - `const SettingZoneGetResponseZoneModeCDNOnly SettingZoneGetResponseZoneMode = "cdn_only"` - `const SettingZoneGetResponseZoneModeDNSOnly SettingZoneGetResponseZoneMode = "dns_only"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/dns" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) zone, err := client.DNS.Settings.Zone.Get(context.TODO(), dns.SettingZoneGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", zone.MultiProvider) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "flatten_all_cnames": false, "foundation_dns": false, "internal_dns": { "reference_zone_id": "reference_zone_id" }, "multi_provider": false, "nameservers": { "type": "cloudflare.standard", "ns_set": 1 }, "ns_ttl": 86400, "secondary_overrides": false, "soa": { "expire": 604800, "min_ttl": 1800, "mname": "kristina.ns.cloudflare.com", "refresh": 10000, "retry": 2400, "rname": "admin.example.com", "ttl": 3600 }, "zone_mode": "dns_only" } } ``` ## Update DNS Settings `client.DNS.Settings.Zone.Edit(ctx, params) (*SettingZoneEditResponse, error)` **patch** `/zones/{zone_id}/dns_settings` Update DNS settings for a zone ### Parameters - `params SettingZoneEditParams` - `ZoneID param.Field[string]` Path param: Identifier. - `FlattenAllCNAMEs param.Field[bool]` Body param: Whether to flatten all CNAME records in the zone. Note that, due to DNS limitations, a CNAME record at the zone apex will always be flattened. - `FoundationDNS param.Field[bool]` Body param: Whether to enable Foundation DNS Advanced Nameservers on the zone. - `InternalDNS param.Field[SettingZoneEditParamsInternalDNS]` Body param: Settings for this internal zone. - `ReferenceZoneID string` The ID of the zone to fallback to. - `MultiProvider param.Field[bool]` Body param: Whether to enable multi-provider DNS, which causes Cloudflare to activate the zone even when non-Cloudflare NS records exist, and to respect NS records at the zone apex during outbound zone transfers. - `Nameservers param.Field[SettingZoneEditParamsNameservers]` Body param: Settings determining the nameservers through which the zone should be available. - `NSSet int64` Configured nameserver set to be used for this zone - `Type SettingZoneEditParamsNameserversType` Nameserver type - `const SettingZoneEditParamsNameserversTypeCloudflareStandard SettingZoneEditParamsNameserversType = "cloudflare.standard"` - `const SettingZoneEditParamsNameserversTypeCustomAccount SettingZoneEditParamsNameserversType = "custom.account"` - `const SettingZoneEditParamsNameserversTypeCustomTenant SettingZoneEditParamsNameserversType = "custom.tenant"` - `const SettingZoneEditParamsNameserversTypeCustomZone SettingZoneEditParamsNameserversType = "custom.zone"` - `NSTTL param.Field[float64]` Body param: The time to live (TTL) of the zone's nameserver (NS) records. - `SecondaryOverrides param.Field[bool]` Body param: Allows a Secondary DNS zone to use (proxied) override records and CNAME flattening at the zone apex. - `SOA param.Field[SettingZoneEditParamsSOA]` Body param: Components of the zone's SOA record. - `Expire float64` Time in seconds of being unable to query the primary server after which secondary servers should stop serving the zone. - `MinTTL float64` The time to live (TTL) for negative caching of records within the zone. - `MNAME string` The primary nameserver, which may be used for outbound zone transfers. If null, a Cloudflare-assigned value will be used. - `Refresh float64` Time in seconds after which secondary servers should re-check the SOA record to see if the zone has been updated. - `Retry float64` Time in seconds after which secondary servers should retry queries after the primary server was unresponsive. - `RNAME string` The email address of the zone administrator, with the first label representing the local part of the email address. - `TTL float64` The time to live (TTL) of the SOA record itself. - `ZoneMode param.Field[SettingZoneEditParamsZoneMode]` Body param: Whether the zone mode is a regular or CDN/DNS only zone. - `const SettingZoneEditParamsZoneModeStandard SettingZoneEditParamsZoneMode = "standard"` - `const SettingZoneEditParamsZoneModeCDNOnly SettingZoneEditParamsZoneMode = "cdn_only"` - `const SettingZoneEditParamsZoneModeDNSOnly SettingZoneEditParamsZoneMode = "dns_only"` ### Returns - `type SettingZoneEditResponse struct{…}` - `FlattenAllCNAMEs bool` Whether to flatten all CNAME records in the zone. Note that, due to DNS limitations, a CNAME record at the zone apex will always be flattened. - `FoundationDNS bool` Whether to enable Foundation DNS Advanced Nameservers on the zone. - `InternalDNS SettingZoneEditResponseInternalDNS` Settings for this internal zone. - `ReferenceZoneID string` The ID of the zone to fallback to. - `MultiProvider bool` Whether to enable multi-provider DNS, which causes Cloudflare to activate the zone even when non-Cloudflare NS records exist, and to respect NS records at the zone apex during outbound zone transfers. - `Nameservers SettingZoneEditResponseNameservers` Settings determining the nameservers through which the zone should be available. - `Type SettingZoneEditResponseNameserversType` Nameserver type - `const SettingZoneEditResponseNameserversTypeCloudflareStandard SettingZoneEditResponseNameserversType = "cloudflare.standard"` - `const SettingZoneEditResponseNameserversTypeCustomAccount SettingZoneEditResponseNameserversType = "custom.account"` - `const SettingZoneEditResponseNameserversTypeCustomTenant SettingZoneEditResponseNameserversType = "custom.tenant"` - `const SettingZoneEditResponseNameserversTypeCustomZone SettingZoneEditResponseNameserversType = "custom.zone"` - `NSSet int64` Configured nameserver set to be used for this zone - `NSTTL float64` The time to live (TTL) of the zone's nameserver (NS) records. - `SecondaryOverrides bool` Allows a Secondary DNS zone to use (proxied) override records and CNAME flattening at the zone apex. - `SOA SettingZoneEditResponseSOA` Components of the zone's SOA record. - `Expire float64` Time in seconds of being unable to query the primary server after which secondary servers should stop serving the zone. - `MinTTL float64` The time to live (TTL) for negative caching of records within the zone. - `MNAME string` The primary nameserver, which may be used for outbound zone transfers. If null, a Cloudflare-assigned value will be used. - `Refresh float64` Time in seconds after which secondary servers should re-check the SOA record to see if the zone has been updated. - `Retry float64` Time in seconds after which secondary servers should retry queries after the primary server was unresponsive. - `RNAME string` The email address of the zone administrator, with the first label representing the local part of the email address. - `TTL float64` The time to live (TTL) of the SOA record itself. - `ZoneMode SettingZoneEditResponseZoneMode` Whether the zone mode is a regular or CDN/DNS only zone. - `const SettingZoneEditResponseZoneModeStandard SettingZoneEditResponseZoneMode = "standard"` - `const SettingZoneEditResponseZoneModeCDNOnly SettingZoneEditResponseZoneMode = "cdn_only"` - `const SettingZoneEditResponseZoneModeDNSOnly SettingZoneEditResponseZoneMode = "dns_only"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/dns" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.DNS.Settings.Zone.Edit(context.TODO(), dns.SettingZoneEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.MultiProvider) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "flatten_all_cnames": false, "foundation_dns": false, "internal_dns": { "reference_zone_id": "reference_zone_id" }, "multi_provider": false, "nameservers": { "type": "cloudflare.standard", "ns_set": 1 }, "ns_ttl": 86400, "secondary_overrides": false, "soa": { "expire": 604800, "min_ttl": 1800, "mname": "kristina.ns.cloudflare.com", "refresh": 10000, "retry": 2400, "rname": "admin.example.com", "ttl": 3600 }, "zone_mode": "dns_only" } } ``` # Account ## Show DNS Settings `client.DNS.Settings.Account.Get(ctx, query) (*SettingAccountGetResponse, error)` **get** `/accounts/{account_id}/dns_settings` Show DNS settings for an account ### Parameters - `query SettingAccountGetParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type SettingAccountGetResponse struct{…}` - `ZoneDefaults SettingAccountGetResponseZoneDefaults` - `FlattenAllCNAMEs bool` Whether to flatten all CNAME records in the zone. Note that, due to DNS limitations, a CNAME record at the zone apex will always be flattened. - `FoundationDNS bool` Whether to enable Foundation DNS Advanced Nameservers on the zone. - `InternalDNS SettingAccountGetResponseZoneDefaultsInternalDNS` Settings for this internal zone. - `ReferenceZoneID string` The ID of the zone to fallback to. - `MultiProvider bool` Whether to enable multi-provider DNS, which causes Cloudflare to activate the zone even when non-Cloudflare NS records exist, and to respect NS records at the zone apex during outbound zone transfers. - `Nameservers SettingAccountGetResponseZoneDefaultsNameservers` Settings determining the nameservers through which the zone should be available. - `Type SettingAccountGetResponseZoneDefaultsNameserversType` Nameserver type - `const SettingAccountGetResponseZoneDefaultsNameserversTypeCloudflareStandard SettingAccountGetResponseZoneDefaultsNameserversType = "cloudflare.standard"` - `const SettingAccountGetResponseZoneDefaultsNameserversTypeCloudflareStandardRandom SettingAccountGetResponseZoneDefaultsNameserversType = "cloudflare.standard.random"` - `const SettingAccountGetResponseZoneDefaultsNameserversTypeCustomAccount SettingAccountGetResponseZoneDefaultsNameserversType = "custom.account"` - `const SettingAccountGetResponseZoneDefaultsNameserversTypeCustomTenant SettingAccountGetResponseZoneDefaultsNameserversType = "custom.tenant"` - `NSTTL float64` The time to live (TTL) of the zone's nameserver (NS) records. - `SecondaryOverrides bool` Allows a Secondary DNS zone to use (proxied) override records and CNAME flattening at the zone apex. - `SOA SettingAccountGetResponseZoneDefaultsSOA` Components of the zone's SOA record. - `Expire float64` Time in seconds of being unable to query the primary server after which secondary servers should stop serving the zone. - `MinTTL float64` The time to live (TTL) for negative caching of records within the zone. - `MNAME string` The primary nameserver, which may be used for outbound zone transfers. If null, a Cloudflare-assigned value will be used. - `Refresh float64` Time in seconds after which secondary servers should re-check the SOA record to see if the zone has been updated. - `Retry float64` Time in seconds after which secondary servers should retry queries after the primary server was unresponsive. - `RNAME string` The email address of the zone administrator, with the first label representing the local part of the email address. - `TTL float64` The time to live (TTL) of the SOA record itself. - `ZoneMode SettingAccountGetResponseZoneDefaultsZoneMode` Whether the zone mode is a regular or CDN/DNS only zone. - `const SettingAccountGetResponseZoneDefaultsZoneModeStandard SettingAccountGetResponseZoneDefaultsZoneMode = "standard"` - `const SettingAccountGetResponseZoneDefaultsZoneModeCDNOnly SettingAccountGetResponseZoneDefaultsZoneMode = "cdn_only"` - `const SettingAccountGetResponseZoneDefaultsZoneModeDNSOnly SettingAccountGetResponseZoneDefaultsZoneMode = "dns_only"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/dns" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) account, err := client.DNS.Settings.Account.Get(context.TODO(), dns.SettingAccountGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", account.ZoneDefaults) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "zone_defaults": { "flatten_all_cnames": false, "foundation_dns": false, "internal_dns": { "reference_zone_id": "reference_zone_id" }, "multi_provider": false, "nameservers": { "type": "cloudflare.standard" }, "ns_ttl": 86400, "secondary_overrides": false, "soa": { "expire": 604800, "min_ttl": 1800, "mname": "kristina.ns.cloudflare.com", "refresh": 10000, "retry": 2400, "rname": "admin.example.com", "ttl": 3600 }, "zone_mode": "dns_only" } } } ``` ## Update DNS Settings `client.DNS.Settings.Account.Edit(ctx, params) (*SettingAccountEditResponse, error)` **patch** `/accounts/{account_id}/dns_settings` Update DNS settings for an account ### Parameters - `params SettingAccountEditParams` - `AccountID param.Field[string]` Path param: Identifier. - `ZoneDefaults param.Field[SettingAccountEditParamsZoneDefaults]` Body param - `FlattenAllCNAMEs bool` Whether to flatten all CNAME records in the zone. Note that, due to DNS limitations, a CNAME record at the zone apex will always be flattened. - `FoundationDNS bool` Whether to enable Foundation DNS Advanced Nameservers on the zone. - `InternalDNS SettingAccountEditParamsZoneDefaultsInternalDNS` Settings for this internal zone. - `ReferenceZoneID string` The ID of the zone to fallback to. - `MultiProvider bool` Whether to enable multi-provider DNS, which causes Cloudflare to activate the zone even when non-Cloudflare NS records exist, and to respect NS records at the zone apex during outbound zone transfers. - `Nameservers SettingAccountEditParamsZoneDefaultsNameservers` Settings determining the nameservers through which the zone should be available. - `Type SettingAccountEditParamsZoneDefaultsNameserversType` Nameserver type - `const SettingAccountEditParamsZoneDefaultsNameserversTypeCloudflareStandard SettingAccountEditParamsZoneDefaultsNameserversType = "cloudflare.standard"` - `const SettingAccountEditParamsZoneDefaultsNameserversTypeCloudflareStandardRandom SettingAccountEditParamsZoneDefaultsNameserversType = "cloudflare.standard.random"` - `const SettingAccountEditParamsZoneDefaultsNameserversTypeCustomAccount SettingAccountEditParamsZoneDefaultsNameserversType = "custom.account"` - `const SettingAccountEditParamsZoneDefaultsNameserversTypeCustomTenant SettingAccountEditParamsZoneDefaultsNameserversType = "custom.tenant"` - `NSTTL float64` The time to live (TTL) of the zone's nameserver (NS) records. - `SecondaryOverrides bool` Allows a Secondary DNS zone to use (proxied) override records and CNAME flattening at the zone apex. - `SOA SettingAccountEditParamsZoneDefaultsSOA` Components of the zone's SOA record. - `Expire float64` Time in seconds of being unable to query the primary server after which secondary servers should stop serving the zone. - `MinTTL float64` The time to live (TTL) for negative caching of records within the zone. - `MNAME string` The primary nameserver, which may be used for outbound zone transfers. If null, a Cloudflare-assigned value will be used. - `Refresh float64` Time in seconds after which secondary servers should re-check the SOA record to see if the zone has been updated. - `Retry float64` Time in seconds after which secondary servers should retry queries after the primary server was unresponsive. - `RNAME string` The email address of the zone administrator, with the first label representing the local part of the email address. - `TTL float64` The time to live (TTL) of the SOA record itself. - `ZoneMode SettingAccountEditParamsZoneDefaultsZoneMode` Whether the zone mode is a regular or CDN/DNS only zone. - `const SettingAccountEditParamsZoneDefaultsZoneModeStandard SettingAccountEditParamsZoneDefaultsZoneMode = "standard"` - `const SettingAccountEditParamsZoneDefaultsZoneModeCDNOnly SettingAccountEditParamsZoneDefaultsZoneMode = "cdn_only"` - `const SettingAccountEditParamsZoneDefaultsZoneModeDNSOnly SettingAccountEditParamsZoneDefaultsZoneMode = "dns_only"` ### Returns - `type SettingAccountEditResponse struct{…}` - `ZoneDefaults SettingAccountEditResponseZoneDefaults` - `FlattenAllCNAMEs bool` Whether to flatten all CNAME records in the zone. Note that, due to DNS limitations, a CNAME record at the zone apex will always be flattened. - `FoundationDNS bool` Whether to enable Foundation DNS Advanced Nameservers on the zone. - `InternalDNS SettingAccountEditResponseZoneDefaultsInternalDNS` Settings for this internal zone. - `ReferenceZoneID string` The ID of the zone to fallback to. - `MultiProvider bool` Whether to enable multi-provider DNS, which causes Cloudflare to activate the zone even when non-Cloudflare NS records exist, and to respect NS records at the zone apex during outbound zone transfers. - `Nameservers SettingAccountEditResponseZoneDefaultsNameservers` Settings determining the nameservers through which the zone should be available. - `Type SettingAccountEditResponseZoneDefaultsNameserversType` Nameserver type - `const SettingAccountEditResponseZoneDefaultsNameserversTypeCloudflareStandard SettingAccountEditResponseZoneDefaultsNameserversType = "cloudflare.standard"` - `const SettingAccountEditResponseZoneDefaultsNameserversTypeCloudflareStandardRandom SettingAccountEditResponseZoneDefaultsNameserversType = "cloudflare.standard.random"` - `const SettingAccountEditResponseZoneDefaultsNameserversTypeCustomAccount SettingAccountEditResponseZoneDefaultsNameserversType = "custom.account"` - `const SettingAccountEditResponseZoneDefaultsNameserversTypeCustomTenant SettingAccountEditResponseZoneDefaultsNameserversType = "custom.tenant"` - `NSTTL float64` The time to live (TTL) of the zone's nameserver (NS) records. - `SecondaryOverrides bool` Allows a Secondary DNS zone to use (proxied) override records and CNAME flattening at the zone apex. - `SOA SettingAccountEditResponseZoneDefaultsSOA` Components of the zone's SOA record. - `Expire float64` Time in seconds of being unable to query the primary server after which secondary servers should stop serving the zone. - `MinTTL float64` The time to live (TTL) for negative caching of records within the zone. - `MNAME string` The primary nameserver, which may be used for outbound zone transfers. If null, a Cloudflare-assigned value will be used. - `Refresh float64` Time in seconds after which secondary servers should re-check the SOA record to see if the zone has been updated. - `Retry float64` Time in seconds after which secondary servers should retry queries after the primary server was unresponsive. - `RNAME string` The email address of the zone administrator, with the first label representing the local part of the email address. - `TTL float64` The time to live (TTL) of the SOA record itself. - `ZoneMode SettingAccountEditResponseZoneDefaultsZoneMode` Whether the zone mode is a regular or CDN/DNS only zone. - `const SettingAccountEditResponseZoneDefaultsZoneModeStandard SettingAccountEditResponseZoneDefaultsZoneMode = "standard"` - `const SettingAccountEditResponseZoneDefaultsZoneModeCDNOnly SettingAccountEditResponseZoneDefaultsZoneMode = "cdn_only"` - `const SettingAccountEditResponseZoneDefaultsZoneModeDNSOnly SettingAccountEditResponseZoneDefaultsZoneMode = "dns_only"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/dns" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.DNS.Settings.Account.Edit(context.TODO(), dns.SettingAccountEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ZoneDefaults) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "zone_defaults": { "flatten_all_cnames": false, "foundation_dns": false, "internal_dns": { "reference_zone_id": "reference_zone_id" }, "multi_provider": false, "nameservers": { "type": "cloudflare.standard" }, "ns_ttl": 86400, "secondary_overrides": false, "soa": { "expire": 604800, "min_ttl": 1800, "mname": "kristina.ns.cloudflare.com", "refresh": 10000, "retry": 2400, "rname": "admin.example.com", "ttl": 3600 }, "zone_mode": "dns_only" } } } ``` # Views ## List Internal DNS Views `client.DNS.Settings.Account.Views.List(ctx, params) (*V4PagePaginationArray[SettingAccountViewListResponse], error)` **get** `/accounts/{account_id}/dns_settings/views` List DNS Internal Views for an Account ### Parameters - `params SettingAccountViewListParams` - `AccountID param.Field[string]` Path param: Identifier. - `Direction param.Field[SettingAccountViewListParamsDirection]` Query param: Direction to order DNS views in. - `const SettingAccountViewListParamsDirectionAsc SettingAccountViewListParamsDirection = "asc"` - `const SettingAccountViewListParamsDirectionDesc SettingAccountViewListParamsDirection = "desc"` - `Match param.Field[SettingAccountViewListParamsMatch]` Query param: Whether to match all search requirements or at least one (any). If set to `all`, acts like a logical AND between filters. If set to `any`, acts like a logical OR instead. - `const SettingAccountViewListParamsMatchAny SettingAccountViewListParamsMatch = "any"` - `const SettingAccountViewListParamsMatchAll SettingAccountViewListParamsMatch = "all"` - `Name param.Field[SettingAccountViewListParamsName]` Query param - `Contains string` Substring of the DNS view name. - `Endswith string` Suffix of the DNS view name. - `Exact string` Exact value of the DNS view name. - `Startswith string` Prefix of the DNS view name. - `Order param.Field[SettingAccountViewListParamsOrder]` Query param: Field to order DNS views by. - `const SettingAccountViewListParamsOrderName SettingAccountViewListParamsOrder = "name"` - `const SettingAccountViewListParamsOrderCreatedOn SettingAccountViewListParamsOrder = "created_on"` - `const SettingAccountViewListParamsOrderModifiedOn SettingAccountViewListParamsOrder = "modified_on"` - `Page param.Field[float64]` Query param: Page number of paginated results. - `PerPage param.Field[float64]` Query param: Number of DNS views per page. - `ZoneID param.Field[string]` Query param: A zone ID that exists in the zones list for the view. - `ZoneName param.Field[string]` Query param: A zone name that exists in the zones list for the view. ### Returns - `type SettingAccountViewListResponse struct{…}` - `ID string` Identifier. - `CreatedTime Time` When the view was created. - `ModifiedTime Time` When the view was last modified. - `Name string` The name of the view. - `Zones []string` The list of zones linked to this view. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/dns" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.DNS.Settings.Account.Views.List(context.TODO(), dns.SettingAccountViewListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created_time": "2014-01-01T05:20:00.12345Z", "modified_time": "2014-01-01T05:20:00.12345Z", "name": "my view", "zones": [ "372e67954025e0ba6aaa6d586b9e0b59" ] } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## DNS Internal View Details `client.DNS.Settings.Account.Views.Get(ctx, viewID, query) (*SettingAccountViewGetResponse, error)` **get** `/accounts/{account_id}/dns_settings/views/{view_id}` Get DNS Internal View ### Parameters - `viewID string` Identifier. - `query SettingAccountViewGetParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type SettingAccountViewGetResponse struct{…}` - `ID string` Identifier. - `CreatedTime Time` When the view was created. - `ModifiedTime Time` When the view was last modified. - `Name string` The name of the view. - `Zones []string` The list of zones linked to this view. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/dns" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) view, err := client.DNS.Settings.Account.Views.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", dns.SettingAccountViewGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", view.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created_time": "2014-01-01T05:20:00.12345Z", "modified_time": "2014-01-01T05:20:00.12345Z", "name": "my view", "zones": [ "372e67954025e0ba6aaa6d586b9e0b59" ] } } ``` ## Create Internal DNS View `client.DNS.Settings.Account.Views.New(ctx, params) (*SettingAccountViewNewResponse, error)` **post** `/accounts/{account_id}/dns_settings/views` Create Internal DNS View for an account ### Parameters - `params SettingAccountViewNewParams` - `AccountID param.Field[string]` Path param: Identifier. - `Name param.Field[string]` Body param: The name of the view. - `Zones param.Field[[]string]` Body param: The list of zones linked to this view. ### Returns - `type SettingAccountViewNewResponse struct{…}` - `ID string` Identifier. - `CreatedTime Time` When the view was created. - `ModifiedTime Time` When the view was last modified. - `Name string` The name of the view. - `Zones []string` The list of zones linked to this view. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/dns" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) view, err := client.DNS.Settings.Account.Views.New(context.TODO(), dns.SettingAccountViewNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Name: cloudflare.F("my view"), Zones: cloudflare.F([]string{"372e67954025e0ba6aaa6d586b9e0b59"}), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", view.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created_time": "2014-01-01T05:20:00.12345Z", "modified_time": "2014-01-01T05:20:00.12345Z", "name": "my view", "zones": [ "372e67954025e0ba6aaa6d586b9e0b59" ] } } ``` ## Update Internal DNS View `client.DNS.Settings.Account.Views.Edit(ctx, viewID, params) (*SettingAccountViewEditResponse, error)` **patch** `/accounts/{account_id}/dns_settings/views/{view_id}` Update an existing Internal DNS View ### Parameters - `viewID string` Identifier. - `params SettingAccountViewEditParams` - `AccountID param.Field[string]` Path param: Identifier. - `Name param.Field[string]` Body param: The name of the view. - `Zones param.Field[[]string]` Body param: The list of zones linked to this view. ### Returns - `type SettingAccountViewEditResponse struct{…}` - `ID string` Identifier. - `CreatedTime Time` When the view was created. - `ModifiedTime Time` When the view was last modified. - `Name string` The name of the view. - `Zones []string` The list of zones linked to this view. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/dns" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.DNS.Settings.Account.Views.Edit( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", dns.SettingAccountViewEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created_time": "2014-01-01T05:20:00.12345Z", "modified_time": "2014-01-01T05:20:00.12345Z", "name": "my view", "zones": [ "372e67954025e0ba6aaa6d586b9e0b59" ] } } ``` ## Delete Internal DNS View `client.DNS.Settings.Account.Views.Delete(ctx, viewID, body) (*SettingAccountViewDeleteResponse, error)` **delete** `/accounts/{account_id}/dns_settings/views/{view_id}` Delete an existing Internal DNS View ### Parameters - `viewID string` Identifier. - `body SettingAccountViewDeleteParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type SettingAccountViewDeleteResponse struct{…}` - `ID string` Identifier. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/dns" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) view, err := client.DNS.Settings.Account.Views.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", dns.SettingAccountViewDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", view.ID) } ``` #### Response ```json { "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353" } } ```