# Spectrum ## Domain Types ### DNS - `type DNS struct{…}` 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"` ### Edge IPs - `type EdgeIPs interface{…}` 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"` ### Origin DNS - `type OriginDNS struct{…}` 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"` ### Origin Port - `type OriginPortUnion interface{…}` 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` # Analytics # Aggregates # Currents ## Get current aggregated analytics `client.Spectrum.Analytics.Aggregates.Currents.Get(ctx, params) (*[]AnalyticsAggregateCurrentGetResponse, error)` **get** `/zones/{zone_id}/spectrum/analytics/aggregate/current` Retrieves analytics aggregated from the last minute of usage on Spectrum applications underneath a given zone. ### Parameters - `params AnalyticsAggregateCurrentGetParams` - `ZoneID param.Field[string]` Path param: Identifier. - `AppID param.Field[string]` Query param: Comma-delimited list of Spectrum Application Id(s). If provided, the response will be limited to Spectrum Application Id(s) that match. - `ColoName param.Field[string]` Query param: Co-location identifier. ### Returns - `type AnalyticsAggregateCurrentGetResponseEnvelopeResult []AnalyticsAggregateCurrentGetResponse` - `AppID string` Application identifier. - `BytesEgress float64` Number of bytes sent - `BytesIngress float64` Number of bytes received - `Connections float64` Number of connections - `DurationAvg float64` Average duration of connections ### 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"), ) currents, err := client.Spectrum.Analytics.Aggregates.Currents.Get(context.TODO(), spectrum.AnalyticsAggregateCurrentGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", currents) } ``` #### 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": [ { "appID": "023e105f4ecef8ad9ca31a8372d0c353", "bytesEgress": 0, "bytesIngress": 0, "connections": 0, "durationAvg": 0 } ] } ``` # Events ## Domain Types ### Dimension - `type Dimension string` - `const DimensionEvent Dimension = "event"` - `const DimensionAppID Dimension = "appID"` - `const DimensionColoName Dimension = "coloName"` - `const DimensionIPVersion Dimension = "ipVersion"` # Bytimes ## Get analytics by time `client.Spectrum.Analytics.Events.Bytimes.Get(ctx, params) (*AnalyticsEventBytimeGetResponse, error)` **get** `/zones/{zone_id}/spectrum/analytics/events/bytime` Retrieves a list of aggregate metrics grouped by time interval. ### Parameters - `params AnalyticsEventBytimeGetParams` - `ZoneID param.Field[string]` Path param: Identifier. - `TimeDelta param.Field[AnalyticsEventBytimeGetParamsTimeDelta]` Query param: Used to select time series resolution. - `const AnalyticsEventBytimeGetParamsTimeDeltaYear AnalyticsEventBytimeGetParamsTimeDelta = "year"` - `const AnalyticsEventBytimeGetParamsTimeDeltaQuarter AnalyticsEventBytimeGetParamsTimeDelta = "quarter"` - `const AnalyticsEventBytimeGetParamsTimeDeltaMonth AnalyticsEventBytimeGetParamsTimeDelta = "month"` - `const AnalyticsEventBytimeGetParamsTimeDeltaWeek AnalyticsEventBytimeGetParamsTimeDelta = "week"` - `const AnalyticsEventBytimeGetParamsTimeDeltaDay AnalyticsEventBytimeGetParamsTimeDelta = "day"` - `const AnalyticsEventBytimeGetParamsTimeDeltaHour AnalyticsEventBytimeGetParamsTimeDelta = "hour"` - `const AnalyticsEventBytimeGetParamsTimeDeltaDekaminute AnalyticsEventBytimeGetParamsTimeDelta = "dekaminute"` - `const AnalyticsEventBytimeGetParamsTimeDeltaMinute AnalyticsEventBytimeGetParamsTimeDelta = "minute"` - `Dimensions param.Field[[]Dimension]` Query param: Can be used to break down the data by given attributes. Options are: | Dimension | Name | Example | | --------- | ----------------------------- | ---------------------------------------------------------- | | event | Connection Event | connect, progress, disconnect, originError, clientFiltered | | appID | Application ID | 40d67c87c6cd4b889a4fd57805225e85 | | coloName | Colo Name | SFO | | ipVersion | IP version used by the client | 4, 6. | - `const DimensionEvent Dimension = "event"` - `const DimensionAppID Dimension = "appID"` - `const DimensionColoName Dimension = "coloName"` - `const DimensionIPVersion Dimension = "ipVersion"` - `Filters param.Field[string]` Query param: Used to filter rows by one or more dimensions. Filters can be combined using OR and AND boolean logic. AND takes precedence over OR in all the expressions. The OR operator is defined using a comma (,) or OR keyword surrounded by whitespace. The AND operator is defined using a semicolon (;) or AND keyword surrounded by whitespace. Note that the semicolon is a reserved character in URLs (rfc1738) and needs to be percent-encoded as %3B. Comparison options are: | Operator | Name | URL Encoded | | -------- | ------------------------ | ----------- | | == | Equals | %3D%3D | | != | Does not equals | !%3D | | \> | Greater Than | %3E | | < | Less Than | %3C | | \>= | Greater than or equal to | %3E%3D | | <= | Less than or equal to | %3C%3D | - `Metrics param.Field[[]AnalyticsEventBytimeGetParamsMetric]` Query param: One or more metrics to compute. Options are: | Metric | Name | Example | Unit | | -------------- | ----------------------------------- | ------- | --------------------- | | count | Count of total events | 1000 | Count | | bytesIngress | Sum of ingress bytes | 1000 | Sum | | bytesEgress | Sum of egress bytes | 1000 | Sum | | durationAvg | Average connection duration | 1.0 | Time in milliseconds | | durationMedian | Median connection duration | 1.0 | Time in milliseconds | | duration90th | 90th percentile connection duration | 1.0 | Time in milliseconds | | duration99th | 99th percentile connection duration | 1.0 | Time in milliseconds. | - `const AnalyticsEventBytimeGetParamsMetricCount AnalyticsEventBytimeGetParamsMetric = "count"` - `const AnalyticsEventBytimeGetParamsMetricBytesIngress AnalyticsEventBytimeGetParamsMetric = "bytesIngress"` - `const AnalyticsEventBytimeGetParamsMetricBytesEgress AnalyticsEventBytimeGetParamsMetric = "bytesEgress"` - `const AnalyticsEventBytimeGetParamsMetricDurationAvg AnalyticsEventBytimeGetParamsMetric = "durationAvg"` - `const AnalyticsEventBytimeGetParamsMetricDurationMedian AnalyticsEventBytimeGetParamsMetric = "durationMedian"` - `const AnalyticsEventBytimeGetParamsMetricDuration90th AnalyticsEventBytimeGetParamsMetric = "duration90th"` - `const AnalyticsEventBytimeGetParamsMetricDuration99th AnalyticsEventBytimeGetParamsMetric = "duration99th"` - `Since param.Field[Time]` Query param: Start of time interval to query, defaults to `until` - 6 hours. Timestamp must be in RFC3339 format and uses UTC unless otherwise specified. - `Sort param.Field[[]string]` Query param: The sort order for the result set; sort fields must be included in `metrics` or `dimensions`. - `Until param.Field[Time]` Query param: End of time interval to query, defaults to current time. Timestamp must be in RFC3339 format and uses UTC unless otherwise specified. ### Returns - `type AnalyticsEventBytimeGetResponse struct{…}` - `Data []AnalyticsEventBytimeGetResponseData` List of columns returned by the analytics query. - `Dimensions []string` - `Metrics AnalyticsEventBytimeGetResponseDataMetricsUnion` - `type AnalyticsEventBytimeGetResponseDataMetricsArray []float64` - `type AnalyticsEventBytimeGetResponseDataMetricsArray [][]float64` - `DataLag float64` Number of seconds between current time and last processed event, i.e. how many seconds of data could be missing. - `Max map[string, float64]` Maximum result for each selected metrics across all data. - `Min map[string, float64]` Minimum result for each selected metrics across all data. - `Query AnalyticsEventBytimeGetResponseQuery` - `Dimensions []Dimension` Can be used to break down the data by given attributes. Options are: | Dimension | Name | Example | | --------- | ----------------------------- | ---------------------------------------------------------- | | event | Connection Event | connect, progress, disconnect, originError, clientFiltered | | appID | Application ID | 40d67c87c6cd4b889a4fd57805225e85 | | coloName | Colo Name | SFO | | ipVersion | IP version used by the client | 4, 6. | - `const DimensionEvent Dimension = "event"` - `const DimensionAppID Dimension = "appID"` - `const DimensionColoName Dimension = "coloName"` - `const DimensionIPVersion Dimension = "ipVersion"` - `Filters string` Used to filter rows by one or more dimensions. Filters can be combined using OR and AND boolean logic. AND takes precedence over OR in all the expressions. The OR operator is defined using a comma (,) or OR keyword surrounded by whitespace. The AND operator is defined using a semicolon (;) or AND keyword surrounded by whitespace. Note that the semicolon is a reserved character in URLs (rfc1738) and needs to be percent-encoded as %3B. Comparison options are: | Operator | Name | URL Encoded | | -------- | ------------------------ | ----------- | | == | Equals | %3D%3D | | != | Does not equals | !%3D | | \> | Greater Than | %3E | | < | Less Than | %3C | | \>= | Greater than or equal to | %3E%3D | | <= | Less than or equal to | %3C%3D | - `Limit float64` Limit number of returned metrics. - `Metrics []AnalyticsEventBytimeGetResponseQueryMetric` One or more metrics to compute. Options are: | Metric | Name | Example | Unit | | -------------- | ----------------------------------- | ------- | --------------------- | | count | Count of total events | 1000 | Count | | bytesIngress | Sum of ingress bytes | 1000 | Sum | | bytesEgress | Sum of egress bytes | 1000 | Sum | | durationAvg | Average connection duration | 1.0 | Time in milliseconds | | durationMedian | Median connection duration | 1.0 | Time in milliseconds | | duration90th | 90th percentile connection duration | 1.0 | Time in milliseconds | | duration99th | 99th percentile connection duration | 1.0 | Time in milliseconds. | - `const AnalyticsEventBytimeGetResponseQueryMetricCount AnalyticsEventBytimeGetResponseQueryMetric = "count"` - `const AnalyticsEventBytimeGetResponseQueryMetricBytesIngress AnalyticsEventBytimeGetResponseQueryMetric = "bytesIngress"` - `const AnalyticsEventBytimeGetResponseQueryMetricBytesEgress AnalyticsEventBytimeGetResponseQueryMetric = "bytesEgress"` - `const AnalyticsEventBytimeGetResponseQueryMetricDurationAvg AnalyticsEventBytimeGetResponseQueryMetric = "durationAvg"` - `const AnalyticsEventBytimeGetResponseQueryMetricDurationMedian AnalyticsEventBytimeGetResponseQueryMetric = "durationMedian"` - `const AnalyticsEventBytimeGetResponseQueryMetricDuration90th AnalyticsEventBytimeGetResponseQueryMetric = "duration90th"` - `const AnalyticsEventBytimeGetResponseQueryMetricDuration99th AnalyticsEventBytimeGetResponseQueryMetric = "duration99th"` - `Since Time` Start of time interval to query, defaults to `until` - 6 hours. Timestamp must be in RFC3339 format and uses UTC unless otherwise specified. - `Sort []string` The sort order for the result set; sort fields must be included in `metrics` or `dimensions`. - `Until Time` End of time interval to query, defaults to current time. Timestamp must be in RFC3339 format and uses UTC unless otherwise specified. - `Rows float64` Total number of rows in the result. - `Totals map[string, float64]` Total result for each selected metrics across all data. - `TimeIntervals [][]Time` List of time interval buckets: [start, end] ### 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"), ) bytime, err := client.Spectrum.Analytics.Events.Bytimes.Get(context.TODO(), spectrum.AnalyticsEventBytimeGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), TimeDelta: cloudflare.F(spectrum.AnalyticsEventBytimeGetParamsTimeDeltaMinute), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", bytime.Data) } ``` #### 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": { "data": [ { "dimensions": [ "string" ], "metrics": [ 0 ] } ], "data_lag": 3, "max": { "bytesEgress": 100, "bytesIngress": 50 }, "min": { "bytesEgress": 100, "bytesIngress": 50 }, "query": { "dimensions": [ "event", "appID" ], "filters": "event==disconnect%20AND%20coloName!=SFO", "limit": 0, "metrics": [ "count", "bytesIngress" ], "since": "2014-01-01T05:20:00.12345Z", "sort": [ "+count", "-bytesIngress" ], "until": "2014-01-01T05:20:00.12345Z" }, "rows": 5, "totals": { "bytesEgress": 100, "bytesIngress": 50 }, "time_intervals": [ [ "2014-01-01T05:20:00.12345Z" ] ] } } ``` # Summaries ## Get analytics summary `client.Spectrum.Analytics.Events.Summaries.Get(ctx, params) (*AnalyticsEventSummaryGetResponse, error)` **get** `/zones/{zone_id}/spectrum/analytics/events/summary` Retrieves a list of summarised aggregate metrics over a given time period. ### Parameters - `params AnalyticsEventSummaryGetParams` - `ZoneID param.Field[string]` Path param: Identifier. - `Dimensions param.Field[[]Dimension]` Query param: Can be used to break down the data by given attributes. Options are: | Dimension | Name | Example | | --------- | ----------------------------- | ---------------------------------------------------------- | | event | Connection Event | connect, progress, disconnect, originError, clientFiltered | | appID | Application ID | 40d67c87c6cd4b889a4fd57805225e85 | | coloName | Colo Name | SFO | | ipVersion | IP version used by the client | 4, 6. | - `const DimensionEvent Dimension = "event"` - `const DimensionAppID Dimension = "appID"` - `const DimensionColoName Dimension = "coloName"` - `const DimensionIPVersion Dimension = "ipVersion"` - `Filters param.Field[string]` Query param: Used to filter rows by one or more dimensions. Filters can be combined using OR and AND boolean logic. AND takes precedence over OR in all the expressions. The OR operator is defined using a comma (,) or OR keyword surrounded by whitespace. The AND operator is defined using a semicolon (;) or AND keyword surrounded by whitespace. Note that the semicolon is a reserved character in URLs (rfc1738) and needs to be percent-encoded as %3B. Comparison options are: | Operator | Name | URL Encoded | | -------- | ------------------------ | ----------- | | == | Equals | %3D%3D | | != | Does not equals | !%3D | | \> | Greater Than | %3E | | < | Less Than | %3C | | \>= | Greater than or equal to | %3E%3D | | <= | Less than or equal to | %3C%3D | - `Metrics param.Field[[]AnalyticsEventSummaryGetParamsMetric]` Query param: One or more metrics to compute. Options are: | Metric | Name | Example | Unit | | -------------- | ----------------------------------- | ------- | --------------------- | | count | Count of total events | 1000 | Count | | bytesIngress | Sum of ingress bytes | 1000 | Sum | | bytesEgress | Sum of egress bytes | 1000 | Sum | | durationAvg | Average connection duration | 1.0 | Time in milliseconds | | durationMedian | Median connection duration | 1.0 | Time in milliseconds | | duration90th | 90th percentile connection duration | 1.0 | Time in milliseconds | | duration99th | 99th percentile connection duration | 1.0 | Time in milliseconds. | - `const AnalyticsEventSummaryGetParamsMetricCount AnalyticsEventSummaryGetParamsMetric = "count"` - `const AnalyticsEventSummaryGetParamsMetricBytesIngress AnalyticsEventSummaryGetParamsMetric = "bytesIngress"` - `const AnalyticsEventSummaryGetParamsMetricBytesEgress AnalyticsEventSummaryGetParamsMetric = "bytesEgress"` - `const AnalyticsEventSummaryGetParamsMetricDurationAvg AnalyticsEventSummaryGetParamsMetric = "durationAvg"` - `const AnalyticsEventSummaryGetParamsMetricDurationMedian AnalyticsEventSummaryGetParamsMetric = "durationMedian"` - `const AnalyticsEventSummaryGetParamsMetricDuration90th AnalyticsEventSummaryGetParamsMetric = "duration90th"` - `const AnalyticsEventSummaryGetParamsMetricDuration99th AnalyticsEventSummaryGetParamsMetric = "duration99th"` - `Since param.Field[Time]` Query param: Start of time interval to query, defaults to `until` - 6 hours. Timestamp must be in RFC3339 format and uses UTC unless otherwise specified. - `Sort param.Field[[]string]` Query param: The sort order for the result set; sort fields must be included in `metrics` or `dimensions`. - `Until param.Field[Time]` Query param: End of time interval to query, defaults to current time. Timestamp must be in RFC3339 format and uses UTC unless otherwise specified. ### Returns - `type AnalyticsEventSummaryGetResponse struct{…}` - `Data []AnalyticsEventSummaryGetResponseData` List of columns returned by the analytics query. - `Dimensions []string` - `Metrics AnalyticsEventSummaryGetResponseDataMetricsUnion` - `type AnalyticsEventSummaryGetResponseDataMetricsArray []float64` - `type AnalyticsEventSummaryGetResponseDataMetricsArray [][]float64` - `DataLag float64` Number of seconds between current time and last processed event, i.e. how many seconds of data could be missing. - `Max map[string, float64]` Maximum result for each selected metrics across all data. - `Min map[string, float64]` Minimum result for each selected metrics across all data. - `Query AnalyticsEventSummaryGetResponseQuery` - `Dimensions []Dimension` Can be used to break down the data by given attributes. Options are: | Dimension | Name | Example | | --------- | ----------------------------- | ---------------------------------------------------------- | | event | Connection Event | connect, progress, disconnect, originError, clientFiltered | | appID | Application ID | 40d67c87c6cd4b889a4fd57805225e85 | | coloName | Colo Name | SFO | | ipVersion | IP version used by the client | 4, 6. | - `const DimensionEvent Dimension = "event"` - `const DimensionAppID Dimension = "appID"` - `const DimensionColoName Dimension = "coloName"` - `const DimensionIPVersion Dimension = "ipVersion"` - `Filters string` Used to filter rows by one or more dimensions. Filters can be combined using OR and AND boolean logic. AND takes precedence over OR in all the expressions. The OR operator is defined using a comma (,) or OR keyword surrounded by whitespace. The AND operator is defined using a semicolon (;) or AND keyword surrounded by whitespace. Note that the semicolon is a reserved character in URLs (rfc1738) and needs to be percent-encoded as %3B. Comparison options are: | Operator | Name | URL Encoded | | -------- | ------------------------ | ----------- | | == | Equals | %3D%3D | | != | Does not equals | !%3D | | \> | Greater Than | %3E | | < | Less Than | %3C | | \>= | Greater than or equal to | %3E%3D | | <= | Less than or equal to | %3C%3D | - `Limit float64` Limit number of returned metrics. - `Metrics []AnalyticsEventSummaryGetResponseQueryMetric` One or more metrics to compute. Options are: | Metric | Name | Example | Unit | | -------------- | ----------------------------------- | ------- | --------------------- | | count | Count of total events | 1000 | Count | | bytesIngress | Sum of ingress bytes | 1000 | Sum | | bytesEgress | Sum of egress bytes | 1000 | Sum | | durationAvg | Average connection duration | 1.0 | Time in milliseconds | | durationMedian | Median connection duration | 1.0 | Time in milliseconds | | duration90th | 90th percentile connection duration | 1.0 | Time in milliseconds | | duration99th | 99th percentile connection duration | 1.0 | Time in milliseconds. | - `const AnalyticsEventSummaryGetResponseQueryMetricCount AnalyticsEventSummaryGetResponseQueryMetric = "count"` - `const AnalyticsEventSummaryGetResponseQueryMetricBytesIngress AnalyticsEventSummaryGetResponseQueryMetric = "bytesIngress"` - `const AnalyticsEventSummaryGetResponseQueryMetricBytesEgress AnalyticsEventSummaryGetResponseQueryMetric = "bytesEgress"` - `const AnalyticsEventSummaryGetResponseQueryMetricDurationAvg AnalyticsEventSummaryGetResponseQueryMetric = "durationAvg"` - `const AnalyticsEventSummaryGetResponseQueryMetricDurationMedian AnalyticsEventSummaryGetResponseQueryMetric = "durationMedian"` - `const AnalyticsEventSummaryGetResponseQueryMetricDuration90th AnalyticsEventSummaryGetResponseQueryMetric = "duration90th"` - `const AnalyticsEventSummaryGetResponseQueryMetricDuration99th AnalyticsEventSummaryGetResponseQueryMetric = "duration99th"` - `Since Time` Start of time interval to query, defaults to `until` - 6 hours. Timestamp must be in RFC3339 format and uses UTC unless otherwise specified. - `Sort []string` The sort order for the result set; sort fields must be included in `metrics` or `dimensions`. - `Until Time` End of time interval to query, defaults to current time. Timestamp must be in RFC3339 format and uses UTC unless otherwise specified. - `Rows float64` Total number of rows in the result. - `Totals map[string, float64]` Total result for each selected metrics across all data. - `TimeIntervals [][]Time` List of time interval buckets: [start, end] ### 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"), ) summary, err := client.Spectrum.Analytics.Events.Summaries.Get(context.TODO(), spectrum.AnalyticsEventSummaryGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", summary.Data) } ``` #### 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": { "data": [ { "dimensions": [ "string" ], "metrics": [ 0 ] } ], "data_lag": 3, "max": { "bytesEgress": 100, "bytesIngress": 50 }, "min": { "bytesEgress": 100, "bytesIngress": 50 }, "query": { "dimensions": [ "event", "appID" ], "filters": "event==disconnect%20AND%20coloName!=SFO", "limit": 0, "metrics": [ "count", "bytesIngress" ], "since": "2014-01-01T05:20:00.12345Z", "sort": [ "+count", "-bytesIngress" ], "until": "2014-01-01T05:20:00.12345Z" }, "rows": 5, "totals": { "bytesEgress": 100, "bytesIngress": 50 }, "time_intervals": [ [ "2014-01-01T05:20:00.12345Z" ] ] } } ``` # Apps ## List Spectrum applications `client.Spectrum.Apps.List(ctx, params) (*V4PagePaginationArray[AppListResponse], error)` **get** `/zones/{zone_id}/spectrum/apps` Retrieves a list of currently existing Spectrum applications inside a zone. ### Parameters - `params AppListParams` - `ZoneID param.Field[string]` Path param: Zone identifier. - `Direction param.Field[AppListParamsDirection]` Query param: Sets the direction by which results are ordered. - `const AppListParamsDirectionAsc AppListParamsDirection = "asc"` - `const AppListParamsDirectionDesc AppListParamsDirection = "desc"` - `Order param.Field[AppListParamsOrder]` Query param: Application field by which results are ordered. - `const AppListParamsOrderProtocol AppListParamsOrder = "protocol"` - `const AppListParamsOrderAppID AppListParamsOrder = "app_id"` - `const AppListParamsOrderCreatedOn AppListParamsOrder = "created_on"` - `const AppListParamsOrderModifiedOn AppListParamsOrder = "modified_on"` - `const AppListParamsOrderDNS AppListParamsOrder = "dns"` - `Page param.Field[float64]` Query param: Page number of paginated results. This parameter is required in order to use other pagination parameters. If included in the query, `result_info` will be present in the response. - `PerPage param.Field[float64]` Query param: Sets the maximum number of results per page. ### Returns - `type AppListResponse interface{…}` - `type AppListResponseSpectrumConfigAppConfig 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 AppListResponseSpectrumConfigAppConfigTrafficType` 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 AppListResponseSpectrumConfigAppConfigTrafficTypeDirect AppListResponseSpectrumConfigAppConfigTrafficType = "direct"` - `const AppListResponseSpectrumConfigAppConfigTrafficTypeHTTP AppListResponseSpectrumConfigAppConfigTrafficType = "http"` - `const AppListResponseSpectrumConfigAppConfigTrafficTypeHTTPS AppListResponseSpectrumConfigAppConfigTrafficType = "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 AppListResponseSpectrumConfigAppConfigProxyProtocol` 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 AppListResponseSpectrumConfigAppConfigProxyProtocolOff AppListResponseSpectrumConfigAppConfigProxyProtocol = "off"` - `const AppListResponseSpectrumConfigAppConfigProxyProtocolV1 AppListResponseSpectrumConfigAppConfigProxyProtocol = "v1"` - `const AppListResponseSpectrumConfigAppConfigProxyProtocolV2 AppListResponseSpectrumConfigAppConfigProxyProtocol = "v2"` - `const AppListResponseSpectrumConfigAppConfigProxyProtocolSimple AppListResponseSpectrumConfigAppConfigProxyProtocol = "simple"` - `TLS AppListResponseSpectrumConfigAppConfigTLS` The type of TLS termination associated with the application. - `const AppListResponseSpectrumConfigAppConfigTLSOff AppListResponseSpectrumConfigAppConfigTLS = "off"` - `const AppListResponseSpectrumConfigAppConfigTLSFlexible AppListResponseSpectrumConfigAppConfigTLS = "flexible"` - `const AppListResponseSpectrumConfigAppConfigTLSFull AppListResponseSpectrumConfigAppConfigTLS = "full"` - `const AppListResponseSpectrumConfigAppConfigTLSStrict AppListResponseSpectrumConfigAppConfigTLS = "strict"` - `type AppListResponseSpectrumConfigPaygoAppConfig 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"), ) page, err := client.Spectrum.Apps.List(context.TODO(), spectrum.AppListParams{ ZoneID: 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_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" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Get Spectrum application configuration `client.Spectrum.Apps.Get(ctx, appID, query) (*AppGetResponse, error)` **get** `/zones/{zone_id}/spectrum/apps/{app_id}` Gets the application configuration of a specific application inside a zone. ### Parameters - `appID string` App identifier. - `query AppGetParams` - `ZoneID param.Field[string]` Zone identifier. ### Returns - `type AppGetResponse interface{…}` - `type AppGetResponseSpectrumConfigAppConfig 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 AppGetResponseSpectrumConfigAppConfigTrafficType` 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 AppGetResponseSpectrumConfigAppConfigTrafficTypeDirect AppGetResponseSpectrumConfigAppConfigTrafficType = "direct"` - `const AppGetResponseSpectrumConfigAppConfigTrafficTypeHTTP AppGetResponseSpectrumConfigAppConfigTrafficType = "http"` - `const AppGetResponseSpectrumConfigAppConfigTrafficTypeHTTPS AppGetResponseSpectrumConfigAppConfigTrafficType = "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 AppGetResponseSpectrumConfigAppConfigProxyProtocol` 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 AppGetResponseSpectrumConfigAppConfigProxyProtocolOff AppGetResponseSpectrumConfigAppConfigProxyProtocol = "off"` - `const AppGetResponseSpectrumConfigAppConfigProxyProtocolV1 AppGetResponseSpectrumConfigAppConfigProxyProtocol = "v1"` - `const AppGetResponseSpectrumConfigAppConfigProxyProtocolV2 AppGetResponseSpectrumConfigAppConfigProxyProtocol = "v2"` - `const AppGetResponseSpectrumConfigAppConfigProxyProtocolSimple AppGetResponseSpectrumConfigAppConfigProxyProtocol = "simple"` - `TLS AppGetResponseSpectrumConfigAppConfigTLS` The type of TLS termination associated with the application. - `const AppGetResponseSpectrumConfigAppConfigTLSOff AppGetResponseSpectrumConfigAppConfigTLS = "off"` - `const AppGetResponseSpectrumConfigAppConfigTLSFlexible AppGetResponseSpectrumConfigAppConfigTLS = "flexible"` - `const AppGetResponseSpectrumConfigAppConfigTLSFull AppGetResponseSpectrumConfigAppConfigTLS = "full"` - `const AppGetResponseSpectrumConfigAppConfigTLSStrict AppGetResponseSpectrumConfigAppConfigTLS = "strict"` - `type AppGetResponseSpectrumConfigPaygoAppConfig 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.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", spectrum.AppGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) 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" } } ``` ## Create Spectrum application using a name for the origin `client.Spectrum.Apps.New(ctx, params) (*AppNewResponse, error)` **post** `/zones/{zone_id}/spectrum/apps` Creates a new Spectrum application from a configuration using a name for the origin. ### Parameters - `params AppNewParams` - `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[AppNewParamsSpectrumConfigAppConfigTrafficType]` 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 AppNewParamsSpectrumConfigAppConfigTrafficTypeDirect AppNewParamsSpectrumConfigAppConfigTrafficType = "direct"` - `const AppNewParamsSpectrumConfigAppConfigTrafficTypeHTTP AppNewParamsSpectrumConfigAppConfigTrafficType = "http"` - `const AppNewParamsSpectrumConfigAppConfigTrafficTypeHTTPS AppNewParamsSpectrumConfigAppConfigTrafficType = "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[AppNewParamsSpectrumConfigAppConfigProxyProtocol]` 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 AppNewParamsSpectrumConfigAppConfigProxyProtocolOff AppNewParamsSpectrumConfigAppConfigProxyProtocol = "off"` - `const AppNewParamsSpectrumConfigAppConfigProxyProtocolV1 AppNewParamsSpectrumConfigAppConfigProxyProtocol = "v1"` - `const AppNewParamsSpectrumConfigAppConfigProxyProtocolV2 AppNewParamsSpectrumConfigAppConfigProxyProtocol = "v2"` - `const AppNewParamsSpectrumConfigAppConfigProxyProtocolSimple AppNewParamsSpectrumConfigAppConfigProxyProtocol = "simple"` - `TLS param.Field[AppNewParamsSpectrumConfigAppConfigTLS]` Body param: The type of TLS termination associated with the application. - `const AppNewParamsSpectrumConfigAppConfigTLSOff AppNewParamsSpectrumConfigAppConfigTLS = "off"` - `const AppNewParamsSpectrumConfigAppConfigTLSFlexible AppNewParamsSpectrumConfigAppConfigTLS = "flexible"` - `const AppNewParamsSpectrumConfigAppConfigTLSFull AppNewParamsSpectrumConfigAppConfigTLS = "full"` - `const AppNewParamsSpectrumConfigAppConfigTLSStrict AppNewParamsSpectrumConfigAppConfigTLS = "strict"` ### Returns - `type AppNewResponse interface{…}` - `type AppNewResponseSpectrumConfigAppConfig 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 AppNewResponseSpectrumConfigAppConfigTrafficType` 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 AppNewResponseSpectrumConfigAppConfigTrafficTypeDirect AppNewResponseSpectrumConfigAppConfigTrafficType = "direct"` - `const AppNewResponseSpectrumConfigAppConfigTrafficTypeHTTP AppNewResponseSpectrumConfigAppConfigTrafficType = "http"` - `const AppNewResponseSpectrumConfigAppConfigTrafficTypeHTTPS AppNewResponseSpectrumConfigAppConfigTrafficType = "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 AppNewResponseSpectrumConfigAppConfigProxyProtocol` 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 AppNewResponseSpectrumConfigAppConfigProxyProtocolOff AppNewResponseSpectrumConfigAppConfigProxyProtocol = "off"` - `const AppNewResponseSpectrumConfigAppConfigProxyProtocolV1 AppNewResponseSpectrumConfigAppConfigProxyProtocol = "v1"` - `const AppNewResponseSpectrumConfigAppConfigProxyProtocolV2 AppNewResponseSpectrumConfigAppConfigProxyProtocol = "v2"` - `const AppNewResponseSpectrumConfigAppConfigProxyProtocolSimple AppNewResponseSpectrumConfigAppConfigProxyProtocol = "simple"` - `TLS AppNewResponseSpectrumConfigAppConfigTLS` The type of TLS termination associated with the application. - `const AppNewResponseSpectrumConfigAppConfigTLSOff AppNewResponseSpectrumConfigAppConfigTLS = "off"` - `const AppNewResponseSpectrumConfigAppConfigTLSFlexible AppNewResponseSpectrumConfigAppConfigTLS = "flexible"` - `const AppNewResponseSpectrumConfigAppConfigTLSFull AppNewResponseSpectrumConfigAppConfigTLS = "full"` - `const AppNewResponseSpectrumConfigAppConfigTLSStrict AppNewResponseSpectrumConfigAppConfigTLS = "strict"` - `type AppNewResponseSpectrumConfigPaygoAppConfig 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.New(context.TODO(), spectrum.AppNewParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Body: spectrum.AppNewParamsBodySpectrumConfigAppConfig{ DNS: cloudflare.F(spectrum.DNSParam{ }), Protocol: cloudflare.F("tcp/22"), TrafficType: cloudflare.F(spectrum.AppNewParamsBodySpectrumConfigAppConfigTrafficTypeDirect), }, }) 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" } } ``` ## 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" } } ``` ## Delete Spectrum application `client.Spectrum.Apps.Delete(ctx, appID, body) (*AppDeleteResponse, error)` **delete** `/zones/{zone_id}/spectrum/apps/{app_id}` Deletes a previously existing application. ### Parameters - `appID string` App identifier. - `body AppDeleteParams` - `ZoneID param.Field[string]` Zone identifier. ### Returns - `type AppDeleteResponse struct{…}` - `ID string` Identifier. ### 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.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", spectrum.AppDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", app.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" } } ```