Esempio n. 1
0
    def put(self, destination_id, data=None):
        """
        .. http:put:: /destinations/1

           Updates an account

           **Example request**:

           .. sourcecode:: http

              POST /destinations/1 HTTP/1.1
              Host: example.com
              Accept: application/json, text/javascript


              {
                "description": "test33",
                "options": [{
                    "name": "accountNumber",
                    "required": true,
                    "value": "34324324",
                    "helpMessage": "Must be a valid AWS account number!",
                    "validation": "/^[0-9]{12,12}$/",
                    "type": "str"
                }],
                "id": 4,
                "plugin": {
                    "pluginOptions": [{
                        "name": "accountNumber",
                        "required": true,
                        "value": "34324324",
                        "helpMessage": "Must be a valid AWS account number!",
                        "validation": "/^[0-9]{12,12}$/",
                        "type": "str"
                    }],
                    "description": "Allow the uploading of certificates to AWS IAM",
                    "slug": "aws-destination",
                    "title": "AWS"
                },
                "label": "test546"
              }


           **Example response**:

           .. sourcecode:: http

              HTTP/1.1 200 OK
              Vary: Accept
              Content-Type: text/javascript

              {
                "description": "test",
                "options": [{
                    "name": "accountNumber",
                    "required": true,
                    "value": "111111111111111",
                    "helpMessage": "Must be a valid AWS account number!",
                    "validation": "/^[0-9]{12,12}$/",
                    "type": "str"
                }],
                "id": 4,
                "plugin": {
                    "pluginOptions": [{
                        "name": "accountNumber",
                        "required": true,
                        "value": "111111111111111",
                        "helpMessage": "Must be a valid AWS account number!",
                        "validation": "/^[0-9]{12,12}$/",
                        "type": "str"
                    }],
                    "description": "Allow the uploading of certificates to AWS IAM",
                    "slug": "aws-destination",
                    "title": "AWS"
                },
                "label": "test546"
              }

           :arg accountNumber: aws account number
           :arg label: human readable account label
           :arg description: some description about the account
           :reqheader Authorization: OAuth token to authenticate
           :statuscode 200: no error
        """
        return service.update(destination_id, data['label'], data['plugin']['plugin_options'], data['description'])
Esempio n. 2
0
    def put(self, destination_id, data=None):
        """
        .. http:put:: /destinations/1

           Updates an account

           **Example request**:

           .. sourcecode:: http

              POST /destinations/1 HTTP/1.1
              Host: example.com
              Accept: application/json, text/javascript


              {
                "description": "test33",
                "options": [{
                    "name": "accountNumber",
                    "required": true,
                    "value": "34324324",
                    "helpMessage": "Must be a valid AWS account number!",
                    "validation": "/^[0-9]{12,12}$/",
                    "type": "str"
                }],
                "id": 4,
                "plugin": {
                    "pluginOptions": [{
                        "name": "accountNumber",
                        "required": true,
                        "value": "34324324",
                        "helpMessage": "Must be a valid AWS account number!",
                        "validation": "/^[0-9]{12,12}$/",
                        "type": "str"
                    }],
                    "description": "Allow the uploading of certificates to AWS IAM",
                    "slug": "aws-destination",
                    "title": "AWS"
                },
                "label": "test546"
              }


           **Example response**:

           .. sourcecode:: http

              HTTP/1.1 200 OK
              Vary: Accept
              Content-Type: text/javascript

              {
                "description": "test",
                "options": [{
                    "name": "accountNumber",
                    "required": true,
                    "value": "111111111111111",
                    "helpMessage": "Must be a valid AWS account number!",
                    "validation": "/^[0-9]{12,12}$/",
                    "type": "str"
                }],
                "id": 4,
                "plugin": {
                    "pluginOptions": [{
                        "name": "accountNumber",
                        "required": true,
                        "value": "111111111111111",
                        "helpMessage": "Must be a valid AWS account number!",
                        "validation": "/^[0-9]{12,12}$/",
                        "type": "str"
                    }],
                    "description": "Allow the uploading of certificates to AWS IAM",
                    "slug": "aws-destination",
                    "title": "AWS"
                },
                "label": "test546"
              }

           :arg accountNumber: aws account number
           :arg label: human readable account label
           :arg description: some description about the account
           :reqheader Authorization: OAuth token to authenticate
           :statuscode 200: no error
        """
        return service.update(destination_id, data['label'],
                              data['plugin']['plugin_options'],
                              data['description'])
Esempio n. 3
0
    def put(self, destination_id):
        """
        .. http:put:: /destinations/1

           Updates an account

           **Example request**:

           .. sourcecode:: http

              POST /destinations/1 HTTP/1.1
              Host: example.com
              Accept: application/json, text/javascript

              {
                "destinationOptions": [
                    {
                        "name": "accountNumber",
                        "required": true,
                        "value": 111111111112,
                        "helpMessage": "Must be a valid AWS account number!",
                        "validation": "/^[0-9]{12,12}$/",
                        "type": "int"
                    }
                ],
                "pluginName": "aws-destination",
                "id": 3,
                "description": "test",
                "label": "test"
              }

           **Example response**:

           .. sourcecode:: http

              HTTP/1.1 200 OK
              Vary: Accept
              Content-Type: text/javascript

              {
                "destinationOptions": [
                    {
                        "name": "accountNumber",
                        "required": true,
                        "value": 111111111112,
                        "helpMessage": "Must be a valid AWS account number!",
                        "validation": "/^[0-9]{12,12}$/",
                        "type": "int"
                    }
                ],
                "pluginName": "aws-destination",
                "id": 3,
                "description": "test",
                "label": "test"
              }

           :arg accountNumber: aws account number
           :arg label: human readable account label
           :arg description: 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')

        args = self.reqparse.parse_args()
        return service.update(destination_id, args['label'], args['plugin']['pluginOptions'], args['description'])