docs(http): update NotificationEndpoint swagger definition to reflect reality
parent
21e14de7aa
commit
a8ad9e2615
|
@ -5811,7 +5811,7 @@ paths:
|
|||
$ref: "#/components/schemas/NotificationEndpoint"
|
||||
responses:
|
||||
'201':
|
||||
description: Notification rule created
|
||||
description: Notification endpoint created
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
|
@ -9714,7 +9714,7 @@ components:
|
|||
$ref: "#/components/schemas/Links"
|
||||
NotificationEndpointBase:
|
||||
type: object
|
||||
required: [type]
|
||||
required: [type, name]
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
|
@ -9742,6 +9742,27 @@ components:
|
|||
enum: ["active", "inactive"]
|
||||
labels:
|
||||
$ref: "#/components/schemas/Labels"
|
||||
links:
|
||||
type: object
|
||||
readOnly: true
|
||||
example:
|
||||
self: "/api/v2/notificationEndpoints/1"
|
||||
labels: "/api/v2/notificationEndpoints/1/labels"
|
||||
members: "/api/v2/notificationEndpoints/1/members"
|
||||
owners: "/api/v2/notificationEndpoints/1/owners"
|
||||
properties:
|
||||
self:
|
||||
description: URL for this endpoint
|
||||
$ref: "#/components/schemas/Link"
|
||||
labels:
|
||||
description: URL to retrieve labels for this endpoint
|
||||
$ref: "#/components/schemas/Link"
|
||||
members:
|
||||
description: URL to retrieve members for this endpoint
|
||||
$ref: "#/components/schemas/Link"
|
||||
owners:
|
||||
description: URL to retrieve owners for this endpoint
|
||||
$ref: "#/components/schemas/Link"
|
||||
type:
|
||||
$ref: "#/components/schemas/NotificationEndpointType"
|
||||
SlackNotificationEndpoint:
|
||||
|
@ -9749,11 +9770,12 @@ components:
|
|||
allOf:
|
||||
- $ref: "#/components/schemas/NotificationEndpointBase"
|
||||
- type: object
|
||||
required: [url, token]
|
||||
properties:
|
||||
url:
|
||||
description: specifies the URL of the slack endpoint; either URL or Token should be specified
|
||||
type: string
|
||||
token:
|
||||
description: specifies the api token string; either URL or Token should be specified
|
||||
type: string
|
||||
PagerDutyNotificationEndpoint:
|
||||
type: object
|
||||
|
|
|
@ -54,6 +54,22 @@ func TestValidEndpoint(t *testing.T) {
|
|||
Msg: "invalid status",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "empty name",
|
||||
src: &endpoint.PagerDuty{
|
||||
Base: endpoint.Base{
|
||||
ID: influxTesting.MustIDBase16(id1),
|
||||
OrgID: influxTesting.MustIDBase16(id3),
|
||||
Status: influxdb.Active,
|
||||
},
|
||||
ClientURL: "https://events.pagerduty.com/v2/enqueue",
|
||||
RoutingKey: influxdb.SecretField{Key: id1 + "-routing-key"},
|
||||
},
|
||||
err: &influxdb.Error{
|
||||
Code: influxdb.EInvalid,
|
||||
Msg: "Notification Endpoint Name can't be empty",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "empty slack url and token",
|
||||
src: &endpoint.Slack{
|
||||
|
@ -188,6 +204,22 @@ func TestJSON(t *testing.T) {
|
|||
Token: influxdb.SecretField{Key: "token-key-1"},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Slack without token",
|
||||
src: &endpoint.Slack{
|
||||
Base: endpoint.Base{
|
||||
ID: influxTesting.MustIDBase16(id1),
|
||||
Name: "name1",
|
||||
OrgID: influxTesting.MustIDBase16(id3),
|
||||
Status: influxdb.Active,
|
||||
CRUDLog: influxdb.CRUDLog{
|
||||
CreatedAt: timeGen1.Now(),
|
||||
UpdatedAt: timeGen2.Now(),
|
||||
},
|
||||
},
|
||||
URL: "https://hooks.slack.com/services/x/y/z",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "simple pagerduty",
|
||||
src: &endpoint.PagerDuty{
|
||||
|
|
Loading…
Reference in New Issue