Get a Notification policy
client.Alerting.Policies.Get(ctx, policyID, query) (*Policy, error)
GET/accounts/{account_id}/alerting/v3/policies/{policy_id}
Get details for a single policy.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
Example:
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Example:
Accepted Permissions (at least one required)
Get a Notification policy
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/alerting"
"github.com/cloudflare/cloudflare-go/option"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
policy, err := client.Alerting.Policies.Get(
context.TODO(),
"0da2b59ef118439d8097bdfb215203c9",
alerting.PolicyGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", policy.ID)
}
{
"errors": [
{
"message": "message",
"code": 1000
}
],
"messages": [
{
"message": "message",
"code": 1000
}
],
"success": true,
"result": {
"id": "0da2b59ef118439d8097bdfb215203c9",
"alert_interval": "30m",
"alert_type": "universal_ssl_event_type",
"created": "2014-01-01T05:20:00.12345Z",
"description": "Something describing the policy.",
"enabled": true,
"filters": {
"actions": [
"string"
],
"affected_asns": [
"string"
],
"affected_components": [
"string"
],
"affected_locations": [
"string"
],
"airport_code": [
"string"
],
"alert_trigger_preferences": [
"string"
],
"alert_trigger_preferences_value": [
"string"
],
"enabled": [
"string"
],
"environment": [
"string"
],
"event": [
"string"
],
"event_source": [
"string"
],
"event_type": [
"string"
],
"group_by": [
"string"
],
"health_check_id": [
"string"
],
"incident_impact": [
"INCIDENT_IMPACT_NONE"
],
"input_id": [
"string"
],
"insight_class": [
"string"
],
"limit": [
"string"
],
"logo_tag": [
"string"
],
"megabits_per_second": [
"string"
],
"new_health": [
"string"
],
"new_status": [
"string"
],
"packets_per_second": [
"string"
],
"pool_id": [
"string"
],
"pop_names": [
"string"
],
"product": [
"string"
],
"project_id": [
"string"
],
"protocol": [
"string"
],
"query_tag": [
"string"
],
"requests_per_second": [
"string"
],
"selectors": [
"string"
],
"services": [
"string"
],
"slo": [
"99.9"
],
"status": [
"string"
],
"target_hostname": [
"string"
],
"target_ip": [
"string"
],
"target_zone_name": [
"string"
],
"traffic_exclusions": [
"security_events"
],
"tunnel_id": [
"string"
],
"tunnel_name": [
"string"
],
"type": [
"string"
],
"where": [
"string"
],
"zones": [
"string"
]
},
"mechanisms": {
"email": [
{
"id": "id"
}
],
"pagerduty": [
{
"id": "f174e90afafe4643bbbc4a0ed4fc8415"
}
],
"webhooks": [
{
"id": "f174e90afafe4643bbbc4a0ed4fc8415"
}
]
},
"modified": "2014-01-01T05:20:00.12345Z",
"name": "SSL Notification Event Policy"
}
}Returns Examples
{
"errors": [
{
"message": "message",
"code": 1000
}
],
"messages": [
{
"message": "message",
"code": 1000
}
],
"success": true,
"result": {
"id": "0da2b59ef118439d8097bdfb215203c9",
"alert_interval": "30m",
"alert_type": "universal_ssl_event_type",
"created": "2014-01-01T05:20:00.12345Z",
"description": "Something describing the policy.",
"enabled": true,
"filters": {
"actions": [
"string"
],
"affected_asns": [
"string"
],
"affected_components": [
"string"
],
"affected_locations": [
"string"
],
"airport_code": [
"string"
],
"alert_trigger_preferences": [
"string"
],
"alert_trigger_preferences_value": [
"string"
],
"enabled": [
"string"
],
"environment": [
"string"
],
"event": [
"string"
],
"event_source": [
"string"
],
"event_type": [
"string"
],
"group_by": [
"string"
],
"health_check_id": [
"string"
],
"incident_impact": [
"INCIDENT_IMPACT_NONE"
],
"input_id": [
"string"
],
"insight_class": [
"string"
],
"limit": [
"string"
],
"logo_tag": [
"string"
],
"megabits_per_second": [
"string"
],
"new_health": [
"string"
],
"new_status": [
"string"
],
"packets_per_second": [
"string"
],
"pool_id": [
"string"
],
"pop_names": [
"string"
],
"product": [
"string"
],
"project_id": [
"string"
],
"protocol": [
"string"
],
"query_tag": [
"string"
],
"requests_per_second": [
"string"
],
"selectors": [
"string"
],
"services": [
"string"
],
"slo": [
"99.9"
],
"status": [
"string"
],
"target_hostname": [
"string"
],
"target_ip": [
"string"
],
"target_zone_name": [
"string"
],
"traffic_exclusions": [
"security_events"
],
"tunnel_id": [
"string"
],
"tunnel_name": [
"string"
],
"type": [
"string"
],
"where": [
"string"
],
"zones": [
"string"
]
},
"mechanisms": {
"email": [
{
"id": "id"
}
],
"pagerduty": [
{
"id": "f174e90afafe4643bbbc4a0ed4fc8415"
}
],
"webhooks": [
{
"id": "f174e90afafe4643bbbc4a0ed4fc8415"
}
]
},
"modified": "2014-01-01T05:20:00.12345Z",
"name": "SSL Notification Event Policy"
}
}