Ignore submitted certificates
This commit is contained in:
parent
1918b911b3
commit
85b053ed98
@ -20,7 +20,6 @@ class NotificationInputSchema(LemurInputSchema):
|
||||
description = fields.String()
|
||||
active = fields.Boolean()
|
||||
plugin = fields.Nested(PluginInputSchema, required=True)
|
||||
certificates = fields.Nested(AssociatedCertificateSchema, many=True, missing=[])
|
||||
added_certificates = fields.Nested(AssociatedCertificateSchema, many=True, missing=[])
|
||||
removed_certificates = fields.Nested(AssociatedCertificateSchema, many=True, missing=[])
|
||||
|
||||
|
@ -104,7 +104,7 @@ def create(label, plugin_name, options, description, certificates):
|
||||
return database.create(notification)
|
||||
|
||||
|
||||
def update(notification_id, label, plugin_name, options, description, active, certificates, added_certificates, removed_certificates):
|
||||
def update(notification_id, label, plugin_name, options, description, active, added_certificates, removed_certificates):
|
||||
"""
|
||||
Updates an existing notification.
|
||||
|
||||
@ -114,7 +114,6 @@ def update(notification_id, label, plugin_name, options, description, active, ce
|
||||
:param options:
|
||||
:param description:
|
||||
:param active:
|
||||
:param certificates:
|
||||
:param added_certificates:
|
||||
:param removed_certificates:
|
||||
:rtype: Notification
|
||||
@ -127,11 +126,8 @@ def update(notification_id, label, plugin_name, options, description, active, ce
|
||||
notification.options = options
|
||||
notification.description = description
|
||||
notification.active = active
|
||||
if certificates:
|
||||
notification.certificates = certificates
|
||||
else:
|
||||
notification.certificates = notification.certificates + added_certificates
|
||||
notification.certificates = [c for c in notification.certificates if c not in removed_certificates]
|
||||
notification.certificates = notification.certificates + added_certificates
|
||||
notification.certificates = [c for c in notification.certificates if c not in removed_certificates]
|
||||
|
||||
return database.update(notification)
|
||||
|
||||
|
@ -117,7 +117,7 @@ class NotificationsList(AuthenticatedResource):
|
||||
"""
|
||||
.. http:post:: /notifications
|
||||
|
||||
Creates a new account
|
||||
Creates a new notification
|
||||
|
||||
**Example request**:
|
||||
|
||||
@ -214,9 +214,12 @@ class NotificationsList(AuthenticatedResource):
|
||||
"id": 2
|
||||
}
|
||||
|
||||
:arg accountNumber: aws account number
|
||||
:arg label: human readable account label
|
||||
:arg comments: some description about the account
|
||||
:label label: notification name
|
||||
:label slug: notification plugin slug
|
||||
:label plugin_options: notification plugin options
|
||||
:label description: notification description
|
||||
:label active: whether or not the notification is active/enabled
|
||||
:label certificates: certificates to attach to notification
|
||||
:reqheader Authorization: OAuth token to authenticate
|
||||
:statuscode 200: no error
|
||||
"""
|
||||
@ -306,17 +309,29 @@ class Notifications(AuthenticatedResource):
|
||||
"""
|
||||
.. http:put:: /notifications/1
|
||||
|
||||
Updates an account
|
||||
Updates a notification
|
||||
|
||||
**Example request**:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
POST /notifications/1 HTTP/1.1
|
||||
PUT /notifications/1 HTTP/1.1
|
||||
Host: example.com
|
||||
Accept: application/json, text/javascript
|
||||
Content-Type: application/json;charset=UTF-8
|
||||
|
||||
{
|
||||
"label": "labelChanged",
|
||||
"plugin": {
|
||||
"slug": "email-notification",
|
||||
"plugin_options": "???"
|
||||
},
|
||||
"description": "Sample notification",
|
||||
"active": "true",
|
||||
"added_certificates": "???",
|
||||
"removed_certificates": "???"
|
||||
}
|
||||
|
||||
|
||||
**Example response**:
|
||||
|
||||
@ -328,14 +343,24 @@ class Notifications(AuthenticatedResource):
|
||||
|
||||
{
|
||||
"id": 1,
|
||||
"accountNumber": 11111111111,
|
||||
"label": "labelChanged",
|
||||
"comments": "this is a thing"
|
||||
"plugin": {
|
||||
"slug": "email-notification",
|
||||
"plugin_options": "???"
|
||||
},
|
||||
"description": "Sample notification",
|
||||
"active": "true",
|
||||
"added_certificates": "???",
|
||||
"removed_certificates": "???"
|
||||
}
|
||||
|
||||
:arg accountNumber: aws account number
|
||||
:arg label: human readable account label
|
||||
:arg comments: some description about the account
|
||||
:label label: notification name
|
||||
:label slug: notification plugin slug
|
||||
:label plugin_options: notification plugin options
|
||||
:label description: notification description
|
||||
:label active: whether or not the notification is active/enabled
|
||||
:label added_certificates: certificates to add
|
||||
:label removed_certificates: certificates to remove
|
||||
:reqheader Authorization: OAuth token to authenticate
|
||||
:statuscode 200: no error
|
||||
"""
|
||||
@ -346,7 +371,6 @@ class Notifications(AuthenticatedResource):
|
||||
data["plugin"]["plugin_options"],
|
||||
data["description"],
|
||||
data["active"],
|
||||
data["certificates"],
|
||||
data["added_certificates"],
|
||||
data["removed_certificates"],
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user