Skip to content

Commit

Permalink
OAS-9664 | Add notification fields (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajanikow authored May 31, 2024
1 parent a698175 commit 3dea35f
Show file tree
Hide file tree
Showing 12 changed files with 2,318 additions and 597 deletions.
1,418 changes: 1,022 additions & 396 deletions data/v1/data.pb.go

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions data/v1/data.proto
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,9 @@ message Deployment {
// If set to true, drop support for deprecated VST protocol and improve resilience.
// Defaults to false.
bool drop_vst_support = 617;

// Defines notifications attached to the Deployment
map<string, Notification> notifications = 618;
}

// NodeSize specifies the size constraints of different data nodes.
Expand Down Expand Up @@ -1395,6 +1398,36 @@ message DiskPerformance {
bool is_default = 4;
}

// NotificationSeverity keeps possible severities for notifications
enum NotificationSeverity {
// Defines Info level Notification Severity
NOTIFICATION_SEVERITY_INFO = 0;

// Defines Warning level Notification Severity
NOTIFICATION_SEVERITY_WARNING = 1;

// Defines Critical level Notification Severity
NOTIFICATION_SEVERITY_CRITICAL = 2;
}

// Define the Notification details
message Notification {
// String representation of the Notification
string notification = 1;

// Notification Severity
NotificationSeverity severity = 2;

// The timestamp of when the notification has been created.
google.protobuf.Timestamp created_at = 3;

// The timestamp of when the notification has been updated.
google.protobuf.Timestamp updated_at = 4;

// The timestamp of when the notification expires.
google.protobuf.Timestamp expires_at = 5;
}

// Request arguments for ListDeploymentsByFilter.
message ListDeploymentsByFilterRequest {
// Identifier of the organization to request the deployments for.
Expand Down
43 changes: 43 additions & 0 deletions data/v1/notification.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// DISCLAIMER
//
// Copyright 2024 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//

package v1

func (d *Deployment) Notification(id string) (*Notification, bool) {
v, ok := d.GetNotifications()[id]
return v, ok
}

func (d *Deployment) NotificationEquals(id string, notification string, severity NotificationSeverity) bool {
v, ok := d.GetNotifications()[id]
if !ok {
return false
}

return v.Equals(notification, severity)
}

func (n *Notification) Equals(notification string, severity NotificationSeverity) bool {
if n == nil {
return false
}

return n.Severity == severity && n.Notification == notification
}
4 changes: 2 additions & 2 deletions data/v1/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const (
// APIMajorVersion contains major version of this API
APIMajorVersion = 2
// APIMinorVersion contains minor version of this API
APIMinorVersion = 8
APIMinorVersion = 9
// APIPatchVersion contains patch version of this API
APIPatchVersion = 19
APIPatchVersion = 0
)
Loading

0 comments on commit 3dea35f

Please sign in to comment.