# Argo # Smart Routing ## Get Argo Smart Routing setting `client.Argo.SmartRouting.Get(ctx, query) (*SmartRoutingGetResponse, error)` **get** `/zones/{zone_id}/argo/smart_routing` Retrieves the value of Argo Smart Routing enablement setting. ### Parameters - `query SmartRoutingGetParams` - `ZoneID param.Field[string]` Specifies the zone associated with the API call. ### Returns - `type SmartRoutingGetResponse struct{…}` - `ID string` Specifies the identifier of the Argo Smart Routing setting. - `Editable bool` Specifies if the setting is editable. - `Value SmartRoutingGetResponseValue` Specifies the enablement value of Argo Smart Routing. - `const SmartRoutingGetResponseValueOn SmartRoutingGetResponseValue = "on"` - `const SmartRoutingGetResponseValueOff SmartRoutingGetResponseValue = "off"` - `ModifiedOn Time` Specifies the time when the setting was last modified. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/argo" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) smartRouting, err := client.Argo.SmartRouting.Get(context.TODO(), argo.SmartRoutingGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", smartRouting.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" } } ], "result": { "id": "id", "editable": true, "value": "on", "modified_on": "2019-12-27T18:11:19.117Z" }, "success": true } ``` ## Patch Argo Smart Routing setting `client.Argo.SmartRouting.Edit(ctx, params) (*SmartRoutingEditResponse, error)` **patch** `/zones/{zone_id}/argo/smart_routing` Configures the value of the Argo Smart Routing enablement setting. ### Parameters - `params SmartRoutingEditParams` - `ZoneID param.Field[string]` Path param: Specifies the zone associated with the API call. - `Value param.Field[SmartRoutingEditParamsValue]` Body param: Specifies the enablement value of Argo Smart Routing. - `const SmartRoutingEditParamsValueOn SmartRoutingEditParamsValue = "on"` - `const SmartRoutingEditParamsValueOff SmartRoutingEditParamsValue = "off"` ### Returns - `type SmartRoutingEditResponse struct{…}` - `ID string` Specifies the identifier of the Argo Smart Routing setting. - `Editable bool` Specifies if the setting is editable. - `Value SmartRoutingEditResponseValue` Specifies the enablement value of Argo Smart Routing. - `const SmartRoutingEditResponseValueOn SmartRoutingEditResponseValue = "on"` - `const SmartRoutingEditResponseValueOff SmartRoutingEditResponseValue = "off"` - `ModifiedOn Time` Specifies the time when the setting was last modified. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/argo" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.Argo.SmartRouting.Edit(context.TODO(), argo.SmartRoutingEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Value: cloudflare.F(argo.SmartRoutingEditParamsValueOn), }) 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" } } ], "result": { "id": "id", "editable": true, "value": "on", "modified_on": "2019-12-27T18:11:19.117Z" }, "success": true } ``` # Tiered Caching ## Get Tiered Caching setting `client.Argo.TieredCaching.Get(ctx, query) (*TieredCachingGetResponse, error)` **get** `/zones/{zone_id}/argo/tiered_caching` Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of lower-tiers and upper-tiers. If content is not cached in lower-tier data centers (generally the ones closest to a visitor), the lower-tier must ask an upper-tier to see if it has the content. If the upper-tier does not have the content, only the upper-tier can ask the origin for content. This practice improves bandwidth efficiency by limiting the number of data centers that can ask the origin for content, which reduces origin load and makes websites more cost-effective to operate. Additionally, Tiered Cache concentrates connections to origin servers so they come from a small number of data centers rather than the full set of network locations. This results in fewer open connections using server resources. ### Parameters - `query TieredCachingGetParams` - `ZoneID param.Field[string]` Identifier. ### Returns - `type TieredCachingGetResponse struct{…}` - `ID TieredCachingGetResponseID` The identifier of the caching setting. - `const TieredCachingGetResponseIDTieredCaching TieredCachingGetResponseID = "tiered_caching"` - `Editable bool` Whether the setting is editable. - `Value TieredCachingGetResponseValue` Value of the Tiered Cache zone setting. - `const TieredCachingGetResponseValueOn TieredCachingGetResponseValue = "on"` - `const TieredCachingGetResponseValueOff TieredCachingGetResponseValue = "off"` - `ModifiedOn Time` Last time this setting was modified. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/argo" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) tieredCaching, err := client.Argo.TieredCaching.Get(context.TODO(), argo.TieredCachingGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", tieredCaching.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": "tiered_caching", "editable": true, "value": "on", "modified_on": "2014-01-01T05:20:00.12345Z" } } ``` ## Patch Tiered Caching setting `client.Argo.TieredCaching.Edit(ctx, params) (*TieredCachingEditResponse, error)` **patch** `/zones/{zone_id}/argo/tiered_caching` Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of lower-tiers and upper-tiers. If content is not cached in lower-tier data centers (generally the ones closest to a visitor), the lower-tier must ask an upper-tier to see if it has the content. If the upper-tier does not have the content, only the upper-tier can ask the origin for content. This practice improves bandwidth efficiency by limiting the number of data centers that can ask the origin for content, which reduces origin load and makes websites more cost-effective to operate. Additionally, Tiered Cache concentrates connections to origin servers so they come from a small number of data centers rather than the full set of network locations. This results in fewer open connections using server resources. ### Parameters - `params TieredCachingEditParams` - `ZoneID param.Field[string]` Path param: Identifier. - `Value param.Field[TieredCachingEditParamsValue]` Body param: Enables Tiered Caching. - `const TieredCachingEditParamsValueOn TieredCachingEditParamsValue = "on"` - `const TieredCachingEditParamsValueOff TieredCachingEditParamsValue = "off"` ### Returns - `type TieredCachingEditResponse struct{…}` - `ID TieredCachingEditResponseID` The identifier of the caching setting. - `const TieredCachingEditResponseIDTieredCaching TieredCachingEditResponseID = "tiered_caching"` - `Editable bool` Whether the setting is editable. - `Value TieredCachingEditResponseValue` Value of the Tiered Cache zone setting. - `const TieredCachingEditResponseValueOn TieredCachingEditResponseValue = "on"` - `const TieredCachingEditResponseValueOff TieredCachingEditResponseValue = "off"` - `ModifiedOn Time` Last time this setting was modified. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/argo" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.Argo.TieredCaching.Edit(context.TODO(), argo.TieredCachingEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Value: cloudflare.F(argo.TieredCachingEditParamsValueOn), }) 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": "tiered_caching", "editable": true, "value": "on", "modified_on": "2014-01-01T05:20:00.12345Z" } } ```