def post(self): """ .. http:post:: /notifications Creates a new account **Example request**: .. sourcecode:: http POST /notifications HTTP/1.1 Host: example.com Accept: application/json, text/javascript { "description": "a test", "notificationOptions": [ { "name": "interval", "required": true, "value": 5, "helpMessage": "Number of days to be alert before expiration.", "validation": "^\\d+$", "type": "int" }, { "available": [ "days", "weeks", "months" ], "name": "unit", "required": true, "value": "weeks", "helpMessage": "Interval unit", "validation": "", "type": "select" }, { "name": "recipients", "required": true, "value": "[email protected],[email protected]", "helpMessage": "Comma delimited list of email addresses", "validation": "^([\\w+-.%]+@[\\w-.]+\\.[A-Za-z]{2,4},?)+$", "type": "str" } ], "label": "test", "pluginName": "email-notification", "active": true, "id": 2 } **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: text/javascript { "description": "a test", "notificationOptions": [ { "name": "interval", "required": true, "value": 5, "helpMessage": "Number of days to be alert before expiration.", "validation": "^\\d+$", "type": "int" }, { "available": [ "days", "weeks", "months" ], "name": "unit", "required": true, "value": "weeks", "helpMessage": "Interval unit", "validation": "", "type": "select" }, { "name": "recipients", "required": true, "value": "[email protected],[email protected]", "helpMessage": "Comma delimited list of email addresses", "validation": "^([\\w+-.%]+@[\\w-.]+\\.[A-Za-z]{2,4},?)+$", "type": "str" } ], "label": "test", "pluginName": "email-notification", "active": true, "id": 2 } :arg accountNumber: aws account number :arg label: human readable account label :arg comments: some description about the account :reqheader Authorization: OAuth token to authenticate :statuscode 200: no error """ self.reqparse.add_argument('label', type=str, location='json', required=True) self.reqparse.add_argument('plugin', type=dict, location='json', required=True) self.reqparse.add_argument('description', type=str, location='json') self.reqparse.add_argument('certificates', type=list, default=[], location='json') args = self.reqparse.parse_args() return service.create( args['label'], args['plugin']['slug'], args['plugin']['pluginOptions'], args['description'], args['certificates'] )
def post(self, data=None): """ .. http:post:: /notifications Creates a new account **Example request**: .. sourcecode:: http POST /notifications HTTP/1.1 Host: example.com Accept: application/json, text/javascript { "description": "a test", "options": [ { "name": "interval", "required": true, "value": 5, "helpMessage": "Number of days to be alert before expiration.", "validation": "^\\d+$", "type": "int" }, { "available": [ "days", "weeks", "months" ], "name": "unit", "required": true, "value": "weeks", "helpMessage": "Interval unit", "validation": "", "type": "select" }, { "name": "recipients", "required": true, "value": "[email protected],[email protected]", "helpMessage": "Comma delimited list of email addresses", "validation": "^([\\w+-.%]+@[\\w-.]+\\.[A-Za-z]{2,4},?)+$", "type": "str" } ], "label": "test", "pluginName": "email-notification", "active": true, "id": 2 } **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: text/javascript { "description": "a test", "options": [ { "name": "interval", "required": true, "value": 5, "helpMessage": "Number of days to be alert before expiration.", "validation": "^\\d+$", "type": "int" }, { "available": [ "days", "weeks", "months" ], "name": "unit", "required": true, "value": "weeks", "helpMessage": "Interval unit", "validation": "", "type": "select" }, { "name": "recipients", "required": true, "value": "[email protected],[email protected]", "helpMessage": "Comma delimited list of email addresses", "validation": "^([\\w+-.%]+@[\\w-.]+\\.[A-Za-z]{2,4},?)+$", "type": "str" } ], "label": "test", "pluginName": "email-notification", "active": true, "id": 2 } :arg accountNumber: aws account number :arg label: human readable account label :arg comments: some description about the account :reqheader Authorization: OAuth token to authenticate :statuscode 200: no error """ return service.create(data['label'], data['plugin']['slug'], data['plugin']['plugin_options'], data['description'], data['certificates'])
def post(self, data=None): """ .. http:post:: /notifications Creates a new notification **Example request**: .. sourcecode:: http POST /notifications HTTP/1.1 Host: example.com Accept: application/json, text/javascript Content-Type: application/json;charset=UTF-8 { "description": "a test", "options": [ { "name": "interval", "required": true, "value": 5, "helpMessage": "Number of days to be alert before expiration.", "validation": "^\\d+$", "type": "int" }, { "available": [ "days", "weeks", "months" ], "name": "unit", "required": true, "value": "weeks", "helpMessage": "Interval unit", "validation": "", "type": "select" }, { "name": "recipients", "required": true, "value": "[email protected],[email protected]", "helpMessage": "Comma delimited list of email addresses", "validation": "^([\\w+-.%]+@[-\\w.]+\\.[A-Za-z]{2,4},?)+$", "type": "str" } ], "label": "test", "pluginName": "email-notification", "active": true, "id": 2 } **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: text/javascript { "description": "a test", "options": [ { "name": "interval", "required": true, "value": 5, "helpMessage": "Number of days to be alert before expiration.", "validation": "^\\d+$", "type": "int" }, { "available": [ "days", "weeks", "months" ], "name": "unit", "required": true, "value": "weeks", "helpMessage": "Interval unit", "validation": "", "type": "select" }, { "name": "recipients", "required": true, "value": "[email protected],[email protected]", "helpMessage": "Comma delimited list of email addresses", "validation": "^([\\w+-.%]+@[-\\w.]+\\.[A-Za-z]{2,4},?)+$", "type": "str" } ], "label": "test", "pluginName": "email-notification", "active": true, "id": 2 } :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 """ return service.create( data["label"], data["plugin"]["slug"], data["plugin"]["plugin_options"], data["description"], data["certificates"], )