Skip to content

Commit

Permalink
alert.v1: Add azure oauth for webhook
Browse files Browse the repository at this point in the history
Change-Id: Ibd1b9057ebe3f6d4c484dc264c2ab2db3b062aef
  • Loading branch information
rfockema-arista committed Jun 19, 2024
1 parent 86c68ad commit 174e367
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 80 deletions.
5 changes: 5 additions & 0 deletions arista/alert.v1/alert-changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
# New entries go on top.

Changes:
- date: 2024-06-17
description: Add Azure OAuth settings for webhook
version: 1.10.0
onprem: true
cvaas: true
- date: 2024-06-12
description: Update Rule struct with debouncing field
version: 1.9.1
Expand Down
18 changes: 16 additions & 2 deletions arista/alert.v1/alert.proto
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ message Settings {
google.protobuf.BoolValue hide_tags = 18;
// zoom is the global default settings for zoom
ZoomSettings zoom = 19;
// webhook is the auth settings for webhook
WebhookSettings webhook = 20;
}


Expand All @@ -203,7 +205,7 @@ message EmailSettings {
// notification, the email will only have a single notification, the format will also be different
google.protobuf.BoolValue single_alert_per_email = 6;
// azure_o_auth used for auth when using an Azure smtp server
// uses auth_username
// uses auth_username, scopes is not required as we use https://outlook.office365.com/.default
AzureOAuth azure_o_auth = 7;
}

Expand All @@ -216,7 +218,11 @@ message AzureOAuth {
// client_secret is a user generated secret key used for auth
google.protobuf.StringValue client_secret = 3;
// auth_uri is the URI used for OAuth
// this should always be https://login.microsoftonline.com/ unless using a very custom
// set up, where the Azure enviroment is not running on microsoft servers
google.protobuf.StringValue auth_uri = 4;
// scopes are the scopes that auth is granted for
fmp.RepeatedString scopes = 5;
}

// HttpSettings are the settings to be used when sending various message over a http connection
Expand Down Expand Up @@ -290,6 +296,13 @@ message MsTeamsSettings {
google.protobuf.StringValue url = 1;
}

// WebhookSettings contain the settings for sending alerts to a Webhook
message WebhookSettings {
// azure_o_auth used for auth when using an Azure smtp server
// uses auth_username
AzureOAuth azure_o_auth = 1;
}


// SyslogSettings contain the settings for sending alerts with syslog
message SyslogSettings {
Expand Down Expand Up @@ -795,7 +808,8 @@ message WebhookEndpoint {
// single_alert is a boolean flag that will cause an individual webhook message to be sent per
// alert when true.
google.protobuf.BoolValue single_alert = 5;
// Webhook does not have a settings override
// settings_override is the override for the webhook global endpoint settings
WebhookSettings settings_override = 6;
}


Expand Down
75 changes: 0 additions & 75 deletions arista/alert.v1/services.gen.proto
Original file line number Diff line number Diff line change
Expand Up @@ -87,48 +87,11 @@ message AlertStreamResponse {
arista.subscriptions.Operation type = 3;
};

message AlertBatchedStreamRequest {

// TimeRange allows limiting response data to within a specified time window.
// If this field is populated, at least one of the two time fields are required.
//
// For GetAll, the fields start and end can be used as follows:
//
// * end: Returns the state of each Alert at end.
// * Each Alert response is fully-specified (all fields set).
// * start: Returns the state of each Alert at start, followed by updates until now.
// * Each Alert response at start is fully-specified, but updates may be partial.
// * start and end: Returns the state of each Alert at start, followed by updates
// until end.
// * Each Alert response at start is fully-specified, but updates until end may
// be partial.
//
// This field is not allowed in the Subscribe RPC.
arista.time.TimeBounds time = 3;

// MaxMessages limits the maximum number of messages that can be contained in one batch.
// MaxMessages is required to be at least 1.
// The maximum number of messages in a batch is min(max_messages, INTERNAL_BATCH_LIMIT)
// INTERNAL_BATCH_LIMIT is set based on the maximum message size.
google.protobuf.UInt32Value max_messages = 4;
};

message AlertBatchedStreamResponse {
// Values are the values deemed relevant to the initiating request.
// The length of this structure is guaranteed to be between (inclusive) 1 and
// min(req.max_messages, INTERNAL_BATCH_LIMIT).
repeated AlertStreamResponse responses = 1;
};

service AlertService {
rpc GetOne (AlertRequest) returns (AlertResponse);

rpc GetAll (AlertStreamRequest) returns (stream AlertStreamResponse);
rpc Subscribe (AlertStreamRequest) returns (stream AlertStreamResponse);

rpc SubscribeMeta (AlertStreamRequest) returns (stream MetaResponse);
rpc GetAllBatched (AlertBatchedStreamRequest) returns (stream AlertBatchedStreamResponse);
rpc SubscribeBatched (AlertBatchedStreamRequest) returns (stream AlertBatchedStreamResponse);
}

message AlertConfigRequest {
Expand Down Expand Up @@ -186,39 +149,6 @@ message AlertConfigStreamResponse {
arista.subscriptions.Operation type = 3;
};

message AlertConfigBatchedStreamRequest {

// TimeRange allows limiting response data to within a specified time window.
// If this field is populated, at least one of the two time fields are required.
//
// For GetAll, the fields start and end can be used as follows:
//
// * end: Returns the state of each AlertConfig at end.
// * Each AlertConfig response is fully-specified (all fields set).
// * start: Returns the state of each AlertConfig at start, followed by updates until now.
// * Each AlertConfig response at start is fully-specified, but updates may be partial.
// * start and end: Returns the state of each AlertConfig at start, followed by updates
// until end.
// * Each AlertConfig response at start is fully-specified, but updates until end may
// be partial.
//
// This field is not allowed in the Subscribe RPC.
arista.time.TimeBounds time = 3;

// MaxMessages limits the maximum number of messages that can be contained in one batch.
// MaxMessages is required to be at least 1.
// The maximum number of messages in a batch is min(max_messages, INTERNAL_BATCH_LIMIT)
// INTERNAL_BATCH_LIMIT is set based on the maximum message size.
google.protobuf.UInt32Value max_messages = 4;
};

message AlertConfigBatchedStreamResponse {
// Values are the values deemed relevant to the initiating request.
// The length of this structure is guaranteed to be between (inclusive) 1 and
// min(req.max_messages, INTERNAL_BATCH_LIMIT).
repeated AlertConfigStreamResponse responses = 1;
};

message AlertConfigSetRequest {
// AlertConfig carries the value to set into the datastore.
// See the documentation on the AlertConfig struct for which fields are required.
Expand All @@ -241,16 +171,11 @@ message AlertConfigSetResponse {

service AlertConfigService {
rpc GetOne (AlertConfigRequest) returns (AlertConfigResponse);

rpc GetAll (AlertConfigStreamRequest) returns (stream AlertConfigStreamResponse);
rpc Subscribe (AlertConfigStreamRequest) returns (stream AlertConfigStreamResponse);

rpc SubscribeMeta (AlertConfigStreamRequest) returns (stream MetaResponse);
rpc Set (AlertConfigSetRequest) returns (AlertConfigSetResponse);


rpc GetAllBatched (AlertConfigBatchedStreamRequest) returns (stream AlertConfigBatchedStreamResponse);
rpc SubscribeBatched (AlertConfigBatchedStreamRequest) returns (stream AlertConfigBatchedStreamResponse);
}

message DefaultTemplateRequest {
Expand Down
28 changes: 25 additions & 3 deletions arista/alert.v1/services.gen.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1505,7 +1505,11 @@
},
"authUri": {
"type": "string",
"title": "auth_uri is the URI used for OAuth"
"title": "auth_uri is the URI used for OAuth\nthis should always be https://login.microsoftonline.com/ unless using a very custom\nset up, where the Azure enviroment is not running on microsoft servers"
},
"scopes": {
"$ref": "#/definitions/fmp.RepeatedString",
"title": "scopes are the scopes that auth is granted for"
}
},
"title": "AzureOAuth contains the settings for the sending of emails on Azure smtp server"
Expand Down Expand Up @@ -2065,7 +2069,7 @@
},
"azureOAuth": {
"$ref": "#/definitions/arista.alert.v1.AzureOAuth",
"title": "azure_o_auth used for auth when using an Azure smtp server\nuses auth_username"
"title": "azure_o_auth used for auth when using an Azure smtp server\nuses auth_username, scopes is not required as we use https://outlook.office365.com/.default"
}
},
"title": "EmailSettings contain the settings for the sending of emails"
Expand Down Expand Up @@ -2790,6 +2794,10 @@
"zoom": {
"$ref": "#/definitions/arista.alert.v1.ZoomSettings",
"title": "zoom is the global default settings for zoom"
},
"webhook": {
"$ref": "#/definitions/arista.alert.v1.WebhookSettings",
"title": "webhook is the auth settings for webhook"
}
},
"title": "Settings portion of config, a list of default global settings used by broadcast groups"
Expand Down Expand Up @@ -3225,7 +3233,11 @@
},
"singleAlert": {
"type": "boolean",
"description": "single_alert is a boolean flag that will cause an individual webhook message to be sent per\nalert when true.\n\nWebhook does not have a settings override"
"description": "single_alert is a boolean flag that will cause an individual webhook message to be sent per\nalert when true."
},
"settingsOverride": {
"$ref": "#/definitions/arista.alert.v1.WebhookSettings",
"title": "settings_override is the override for the webhook global endpoint settings"
}
},
"title": "WebhookEndpoint contains the required information for an alert to be sent to a webhook endpoint"
Expand All @@ -3244,6 +3256,16 @@
},
"title": "WebhookEndpoints is a set of webhook endpoints"
},
"arista.alert.v1.WebhookSettings": {
"type": "object",
"properties": {
"azureOAuth": {
"$ref": "#/definitions/arista.alert.v1.AzureOAuth",
"title": "azure_o_auth used for auth when using an Azure smtp server\nuses auth_username"
}
},
"title": "WebhookSettings contain the settings for sending alerts to a Webhook"
},
"arista.alert.v1.ZoomEndpoint": {
"type": "object",
"properties": {
Expand Down

0 comments on commit 174e367

Please sign in to comment.