## Update Spectrum application configuration using a name for the origin `client.Spectrum.Apps.Update(ctx, appID, params) (*AppUpdateResponse, error)` **put** `/zones/{zone_id}/spectrum/apps/{app_id}` Updates a previously existing application's configuration that uses a name for the origin. ### Parameters - `appID string` App identifier. - `params AppUpdateParams` - `ZoneID param.Field[string]` Path param: Zone identifier. - `DNS param.Field[DNS]` Body param: The name and type of DNS record for the Spectrum application. - `Protocol param.Field[string]` Body param: The port configuration at Cloudflare's edge. May specify a single port, for example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`. - `TrafficType param.Field[AppUpdateParamsSpectrumConfigAppConfigTrafficType]` Body param: Determines how data travels from the edge to your origin. When set to "direct", Spectrum will send traffic directly to your origin, and the application's type is derived from the `protocol`. When set to "http" or "https", Spectrum will apply Cloudflare's HTTP/HTTPS features as it sends traffic to your origin, and the application type matches this property exactly. - `const AppUpdateParamsSpectrumConfigAppConfigTrafficTypeDirect AppUpdateParamsSpectrumConfigAppConfigTrafficType = "direct"` - `const AppUpdateParamsSpectrumConfigAppConfigTrafficTypeHTTP AppUpdateParamsSpectrumConfigAppConfigTrafficType = "http"` - `const AppUpdateParamsSpectrumConfigAppConfigTrafficTypeHTTPS AppUpdateParamsSpectrumConfigAppConfigTrafficType = "https"` - `ArgoSmartRouting param.Field[bool]` Body param: Enables Argo Smart Routing for this application. Notes: Only available for TCP applications with traffic_type set to "direct". - `EdgeIPs param.Field[EdgeIPs]` Body param: The anycast edge IP configuration for the hostname of this application. - `IPFirewall param.Field[bool]` Body param: Enables IP Access Rules for this application. Notes: Only available for TCP applications. - `OriginDirect param.Field[[]string]` Body param: List of origin IP addresses. Array may contain multiple IP addresses for load balancing. - `OriginDNS param.Field[OriginDNS]` Body param: The name and type of DNS record for the Spectrum application. - `OriginPort param.Field[OriginPortUnion]` Body param: The destination port at the origin. Only specified in conjunction with origin_dns. May use an integer to specify a single origin port, for example `1000`, or a string to specify a range of origin ports, for example `"1000-2000"`. Notes: If specifying a port range, the number of ports in the range must match the number of ports specified in the "protocol" field. - `ProxyProtocol param.Field[AppUpdateParamsSpectrumConfigAppConfigProxyProtocol]` Body param: Enables Proxy Protocol to the origin. Refer to [Enable Proxy protocol](https://developers.cloudflare.com/spectrum/getting-started/proxy-protocol/) for implementation details on PROXY Protocol V1, PROXY Protocol V2, and Simple Proxy Protocol. - `const AppUpdateParamsSpectrumConfigAppConfigProxyProtocolOff AppUpdateParamsSpectrumConfigAppConfigProxyProtocol = "off"` - `const AppUpdateParamsSpectrumConfigAppConfigProxyProtocolV1 AppUpdateParamsSpectrumConfigAppConfigProxyProtocol = "v1"` - `const AppUpdateParamsSpectrumConfigAppConfigProxyProtocolV2 AppUpdateParamsSpectrumConfigAppConfigProxyProtocol = "v2"` - `const AppUpdateParamsSpectrumConfigAppConfigProxyProtocolSimple AppUpdateParamsSpectrumConfigAppConfigProxyProtocol = "simple"` - `TLS param.Field[AppUpdateParamsSpectrumConfigAppConfigTLS]` Body param: The type of TLS termination associated with the application. - `const AppUpdateParamsSpectrumConfigAppConfigTLSOff AppUpdateParamsSpectrumConfigAppConfigTLS = "off"` - `const AppUpdateParamsSpectrumConfigAppConfigTLSFlexible AppUpdateParamsSpectrumConfigAppConfigTLS = "flexible"` - `const AppUpdateParamsSpectrumConfigAppConfigTLSFull AppUpdateParamsSpectrumConfigAppConfigTLS = "full"` - `const AppUpdateParamsSpectrumConfigAppConfigTLSStrict AppUpdateParamsSpectrumConfigAppConfigTLS = "strict"` ### Returns - `type AppUpdateResponse interface{…}` - `type AppUpdateResponseSpectrumConfigAppConfig struct{…}` - `ID string` App identifier. - `CreatedOn Time` When the Application was created. - `DNS DNS` The name and type of DNS record for the Spectrum application. - `Name string` The name of the DNS record associated with the application. - `Type DNSType` The type of DNS record associated with the application. - `const DNSTypeCNAME DNSType = "CNAME"` - `const DNSTypeAddress DNSType = "ADDRESS"` - `ModifiedOn Time` When the Application was last modified. - `Protocol string` The port configuration at Cloudflare's edge. May specify a single port, for example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`. - `TrafficType AppUpdateResponseSpectrumConfigAppConfigTrafficType` Determines how data travels from the edge to your origin. When set to "direct", Spectrum will send traffic directly to your origin, and the application's type is derived from the `protocol`. When set to "http" or "https", Spectrum will apply Cloudflare's HTTP/HTTPS features as it sends traffic to your origin, and the application type matches this property exactly. - `const AppUpdateResponseSpectrumConfigAppConfigTrafficTypeDirect AppUpdateResponseSpectrumConfigAppConfigTrafficType = "direct"` - `const AppUpdateResponseSpectrumConfigAppConfigTrafficTypeHTTP AppUpdateResponseSpectrumConfigAppConfigTrafficType = "http"` - `const AppUpdateResponseSpectrumConfigAppConfigTrafficTypeHTTPS AppUpdateResponseSpectrumConfigAppConfigTrafficType = "https"` - `ArgoSmartRouting bool` Enables Argo Smart Routing for this application. Notes: Only available for TCP applications with traffic_type set to "direct". - `EdgeIPs EdgeIPs` The anycast edge IP configuration for the hostname of this application. - `type EdgeIPsDynamic struct{…}` - `Connectivity EdgeIPsDynamicConnectivity` The IP versions supported for inbound connections on Spectrum anycast IPs. - `const EdgeIPsDynamicConnectivityAll EdgeIPsDynamicConnectivity = "all"` - `const EdgeIPsDynamicConnectivityIPV4 EdgeIPsDynamicConnectivity = "ipv4"` - `const EdgeIPsDynamicConnectivityIPV6 EdgeIPsDynamicConnectivity = "ipv6"` - `Type EdgeIPsDynamicType` The type of edge IP configuration specified. Dynamically allocated edge IPs use Spectrum anycast IPs in accordance with the connectivity you specify. Only valid with CNAME DNS names. - `const EdgeIPsDynamicTypeDynamic EdgeIPsDynamicType = "dynamic"` - `type EdgeIPsStatic struct{…}` - `IPs []string` The array of customer owned IPs we broadcast via anycast for this hostname and application. - `Type EdgeIPsStaticType` The type of edge IP configuration specified. Statically allocated edge IPs use customer IPs in accordance with the ips array you specify. Only valid with ADDRESS DNS names. - `const EdgeIPsStaticTypeStatic EdgeIPsStaticType = "static"` - `IPFirewall bool` Enables IP Access Rules for this application. Notes: Only available for TCP applications. - `OriginDirect []string` List of origin IP addresses. Array may contain multiple IP addresses for load balancing. - `OriginDNS OriginDNS` The name and type of DNS record for the Spectrum application. - `Name string` The name of the DNS record associated with the origin. - `TTL int64` The TTL of our resolution of your DNS record in seconds. - `Type OriginDNSType` The type of DNS record associated with the origin. "" is used to specify a combination of A/AAAA records. - `const OriginDNSTypeEmpty OriginDNSType = ""` - `const OriginDNSTypeA OriginDNSType = "A"` - `const OriginDNSTypeAAAA OriginDNSType = "AAAA"` - `const OriginDNSTypeSRV OriginDNSType = "SRV"` - `OriginPort OriginPortUnion` The destination port at the origin. Only specified in conjunction with origin_dns. May use an integer to specify a single origin port, for example `1000`, or a string to specify a range of origin ports, for example `"1000-2000"`. Notes: If specifying a port range, the number of ports in the range must match the number of ports specified in the "protocol" field. - `UnionInt` - `UnionString` - `ProxyProtocol AppUpdateResponseSpectrumConfigAppConfigProxyProtocol` Enables Proxy Protocol to the origin. Refer to [Enable Proxy protocol](https://developers.cloudflare.com/spectrum/getting-started/proxy-protocol/) for implementation details on PROXY Protocol V1, PROXY Protocol V2, and Simple Proxy Protocol. - `const AppUpdateResponseSpectrumConfigAppConfigProxyProtocolOff AppUpdateResponseSpectrumConfigAppConfigProxyProtocol = "off"` - `const AppUpdateResponseSpectrumConfigAppConfigProxyProtocolV1 AppUpdateResponseSpectrumConfigAppConfigProxyProtocol = "v1"` - `const AppUpdateResponseSpectrumConfigAppConfigProxyProtocolV2 AppUpdateResponseSpectrumConfigAppConfigProxyProtocol = "v2"` - `const AppUpdateResponseSpectrumConfigAppConfigProxyProtocolSimple AppUpdateResponseSpectrumConfigAppConfigProxyProtocol = "simple"` - `TLS AppUpdateResponseSpectrumConfigAppConfigTLS` The type of TLS termination associated with the application. - `const AppUpdateResponseSpectrumConfigAppConfigTLSOff AppUpdateResponseSpectrumConfigAppConfigTLS = "off"` - `const AppUpdateResponseSpectrumConfigAppConfigTLSFlexible AppUpdateResponseSpectrumConfigAppConfigTLS = "flexible"` - `const AppUpdateResponseSpectrumConfigAppConfigTLSFull AppUpdateResponseSpectrumConfigAppConfigTLS = "full"` - `const AppUpdateResponseSpectrumConfigAppConfigTLSStrict AppUpdateResponseSpectrumConfigAppConfigTLS = "strict"` - `type AppUpdateResponseSpectrumConfigPaygoAppConfig struct{…}` - `ID string` App identifier. - `CreatedOn Time` When the Application was created. - `DNS DNS` The name and type of DNS record for the Spectrum application. - `ModifiedOn Time` When the Application was last modified. - `Protocol string` The port configuration at Cloudflare's edge. May specify a single port, for example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`. - `OriginDirect []string` List of origin IP addresses. Array may contain multiple IP addresses for load balancing. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/spectrum" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) app, err := client.Spectrum.Apps.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", spectrum.AppUpdateParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Body: spectrum.AppUpdateParamsBodySpectrumConfigAppConfig{ DNS: cloudflare.F(spectrum.DNSParam{ }), Protocol: cloudflare.F("tcp/22"), TrafficType: cloudflare.F(spectrum.AppUpdateParamsBodySpectrumConfigAppConfigTrafficTypeDirect), }, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", app) } ``` #### 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_on": "2014-01-01T05:20:00.12345Z", "dns": { "name": "ssh.example.com", "type": "CNAME" }, "modified_on": "2014-01-01T05:20:00.12345Z", "protocol": "tcp/22", "traffic_type": "direct", "argo_smart_routing": true, "edge_ips": { "connectivity": "all", "type": "dynamic" }, "ip_firewall": false, "origin_direct": [ "tcp://127.0.0.1:8080" ], "origin_dns": { "name": "origin.example.com", "ttl": 600, "type": "" }, "origin_port": 22, "proxy_protocol": "off", "tls": "off" } } ```