opsgenie / opsgenie-cloudformation-resources

Opsgenie Cloudformation Registry Resources

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to execute cfn-cli submit

ap-hyperbole opened this issue · comments

When running cfn-cli submit I am getting some schema valiation errors. Please see below.

➜  opsgenie_integration git:(master) pip freeze | grep cloudfo
cloudformation-cli==0.1.1
cloudformation-cli-java-plugin==0.1.1
➜  opsgenie_integration git:(master)
➜  opsgenie-cloudformation-resources git:(master) git remote -v
origin	https://github.com/opsgenie/opsgenie-cloudformation-resources.git (fetch)
origin	https://github.com/opsgenie/opsgenie-cloudformation-resources.git (push)
➜  opsgenie-cloudformation-resources git:(master) git pull
Already up to date.
➜  opsgenie-cloudformation-resources git:(master) cd opsgenie_integration
➜  opsgenie_integration git:(master) cfn-cli submit
Resource specification is invalid: 'additionalProperties' is a required property

Failed validating 'required' in schema:
    {'$id': 'provider.definition.schema.v1.json',
     '$schema': 'https://json-schema.org/draft-07/schema#',
     'additionalProperties': False,
     'definitions': {'handlerDefinition': {'additionalProperties': False,
                                           'description': 'Defines any '
                                                          'execution '
                                                          'operations '
                                                          'which can be '
                                                          'performed on '
                                                          'this resource '
                                                          'provider',
                                           'properties': {'permissions': {'additionalItems': False,
                                                                          'items': {'type': 'string'},
                                                                          'type': 'array'}},
                                           'required': ['permissions'],
                                           'type': 'object'},
                     'httpsUrl': {'maxLength': 4096,
                                  'pattern': '^https://[0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])(:[0-9]*)*([?/#].*)?$',
                                  'type': 'string'},
                     'jsonPointerArray': {'items': {'format': 'json-pointer',
                                                    'type': 'string'},
                                          'minItems': 1,
                                          'type': 'array'},
                     'properties': {'allOf': [{'$ref': '#/definitions/validations'},
                                              {'$comment': 'The following '
                                                           'subset of '
                                                           'draft-07 '
                                                           'property '
                                                           'references is '
                                                           'supported for '
                                                           'resource '
                                                           'definitions. '
                                                           'Nested '
                                                           'properties are '
                                                           'disallowed and '
                                                           'should be '
                                                           'specified as a '
                                                           '$ref to a '
                                                           'definitions '
                                                           'block.',
                                               'additionalProperties': False,
                                               'properties': {'$comment': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/$comment'},
                                                              '$ref': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/$ref'},
                                                              'additionalProperties': {'$comment': 'All '
                                                                                                   'properties '
                                                                                                   'of '
                                                                                                   'a '
                                                                                                   'resource '
                                                                                                   'must '
                                                                                                   'be '
                                                                                                   'expressed '
                                                                                                   'in '
                                                                                                   'the '
                                                                                                   'schema '
                                                                                                   '- '
                                                                                                   'arbitrary '
                                                                                                   'inputs '
                                                                                                   'are '
                                                                                                   'not '
                                                                                                   'allowed',
                                                                                       'const': False,
                                                                                       'type': 'boolean'},
                                                              'allOf': {'$ref': '#/definitions/schemaArray'},
                                                              'anyOf': {'$ref': '#/definitions/schemaArray'},
                                                              'const': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/const'},
                                                              'contains': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/contains'},
                                                              'default': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/default'},
                                                              'dependencies': {'$comment': 'Redefined '
                                                                                           'to '
                                                                                           'capture '
                                                                                           'our '
                                                                                           'properties '
                                                                                           'override.',
                                                                               'additionalProperties': {'anyOf': [{'$ref': '#/definitions/properties'},
                                                                                                                  {'$ref': 'https://json-schema.org/draft-07/schema#/definitions/stringArray'}]},
                                                                               'type': 'object'},
                                                              'description': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/description'},
                                                              'enum': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/enum'},
                                                              'examples': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/examples'},
                                                              'exclusiveMaximum': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/exclusiveMaximum'},
                                                              'exclusiveMinimum': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/exclusiveMinimum'},
                                                              'format': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/format'},
                                                              'insertionOrder': {'default': True,
                                                                                 'description': 'When '
                                                                                                'set '
                                                                                                'to '
                                                                                                'true, '
                                                                                                'this '
                                                                                                'flag '
                                                                                                'indicates '
                                                                                                'that '
                                                                                                'the '
                                                                                                'order '
                                                                                                'of '
                                                                                                'insertion '
                                                                                                'of '
                                                                                                'the '
                                                                                                'array '
                                                                                                'will '
                                                                                                'be '
                                                                                                'honored, '
                                                                                                'and '
                                                                                                'that '
                                                                                                'changing '
                                                                                                'the '
                                                                                                'order '
                                                                                                'of '
                                                                                                'the '
                                                                                                'array '
                                                                                                'would '
                                                                                                'indicate '
                                                                                                'a '
                                                                                                'diff',
                                                                                 'type': 'boolean'},
                                                              'items': {'$comment': 'Redefined '
                                                                                    'as '
                                                                                    'just '
                                                                                    'a '
                                                                                    'schema. '
                                                                                    'A '
                                                                                    'list '
                                                                                    'of '
                                                                                    'schemas '
                                                                                    'is '
                                                                                    'not '
                                                                                    'allowed',
                                                                        '$ref': '#/definitions/properties',
                                                                        'default': {}},
                                                              'maxItems': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/maxItems'},
                                                              'maxLength': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/maxLength'},
                                                              'maxProperties': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/maxProperties'},
                                                              'maximum': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/maximum'},
                                                              'minItems': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/minItems'},
                                                              'minLength': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/minLength'},
                                                              'minProperties': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/minProperties'},
                                                              'minimum': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/minimum'},
                                                              'multipleOf': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/multipleOf'},
                                                              'oneOf': {'$ref': '#/definitions/schemaArray'},
                                                              'pattern': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/pattern'},
                                                              'patternProperties': {'$comment': 'patternProperties '
                                                                                                'allow '
                                                                                                'providers '
                                                                                                'to '
                                                                                                'introduce '
                                                                                                'a '
                                                                                                'specification '
                                                                                                'for '
                                                                                                'key-value '
                                                                                                'pairs, '
                                                                                                'or '
                                                                                                'Map '
                                                                                                'inputs.',
                                                                                    'propertyNames': {'format': 'regex'},
                                                                                    'type': 'object'},
                                                              'properties': {'additionalProperties': False,
                                                                             'minProperties': 1,
                                                                             'patternProperties': {'^[A-Za-z0-9]{1,64}$': {'$ref': '#/definitions/properties'}},
                                                                             'type': 'object'},
                                                              'required': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/required'},
                                                              'title': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/title'},
                                                              'type': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/type'},
                                                              'uniqueItems': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/uniqueItems'}},
                                               'type': 'object'}]},
                     'schemaArray': {'items': {'$ref': '#/definitions/properties'},
                                     'minItems': 1,
                                     'type': 'array'},
                     'validations': {'dependencies': {'const': {'required': ['type']},
                                                      'enum': {'$comment': 'Enforce '
                                                                           'that '
                                                                           'properties '
                                                                           'are '
                                                                           'strongly '
                                                                           'typed '
                                                                           'when '
                                                                           'enum, '
                                                                           'or '
                                                                           'const '
                                                                           'is '
                                                                           'specified.',
                                                               'required': ['type']},
                                                      'properties': {'$comment': 'An '
                                                                                 'object '
                                                                                 'cannot '
                                                                                 'have '
                                                                                 'both '
                                                                                 'defined '
                                                                                 'and '
                                                                                 'undefined '
                                                                                 'properties; '
                                                                                 'therefore, '
                                                                                 'patternProperties '
                                                                                 'is '
                                                                                 'not '
                                                                                 'allowed '
                                                                                 'when '
                                                                                 'properties '
                                                                                 'is '
                                                                                 'specified.',
                                                                     'not': {'required': ['patternProperties']}}}}},
     'description': 'This schema validates a CloudFormation resource '
                    'provider definition.',
     'properties': {'$comment': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/$comment'},
                    '$schema': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/$schema'},
                    'additionalIdentifiers': {'description': 'An optional '
                                                             'list of '
                                                             'supplementary '
                                                             'identifiers, '
                                                             'each of '
                                                             'which '
                                                             'uniquely '
                                                             'identifies '
                                                             'an instance '
                                                             'of this '
                                                             'resource '
                                                             'type. An '
                                                             'identifier '
                                                             'is a '
                                                             'non-zero-length '
                                                             'list of JSON '
                                                             'pointers to '
                                                             'properties '
                                                             'that form a '
                                                             'single key. '
                                                             'An '
                                                             'identifier '
                                                             'can be a '
                                                             'single or '
                                                             'multiple '
                                                             'properties '
                                                             'to support '
                                                             'composite-key '
                                                             'identifiers.',
                                              'items': {'$ref': '#/definitions/jsonPointerArray'},
                                              'minItems': 1,
                                              'type': 'array'},
                    'additionalProperties': {'$comment': 'All properties '
                                                         'of a resource '
                                                         'must be '
                                                         'expressed in the '
                                                         'schema - '
                                                         'arbitrary inputs '
                                                         'are not allowed',
                                             'const': False,
                                             'type': 'boolean'},
                    'allOf': {'$ref': '#/definitions/schemaArray'},
                    'anyOf': {'$ref': '#/definitions/schemaArray'},
                    'createOnlyProperties': {'$ref': '#/definitions/jsonPointerArray',
                                             'description': 'A list of '
                                                            'JSON pointers '
                                                            'to properties '
                                                            'that are only '
                                                            'able to be '
                                                            'specified by '
                                                            'the customer '
                                                            'when creating '
                                                            'a resource. '
                                                            'Conversely, '
                                                            'any property '
                                                            '*not* in this '
                                                            'list can be '
                                                            'applied to an '
                                                            'Update '
                                                            'request.'},
                    'definitions': {'additionalProperties': False,
                                    'patternProperties': {'^[A-Za-z0-9]{1,64}$': {'$ref': '#/definitions/properties'}},
                                    'type': 'object'},
                    'deprecatedProperties': {'$ref': '#/definitions/jsonPointerArray',
                                             'description': 'A list of '
                                                            'JSON pointers '
                                                            'to properties '
                                                            'that have '
                                                            'been '
                                                            'deprecated by '
                                                            'the '
                                                            'underlying '
                                                            'service '
                                                            'provider. '
                                                            'These '
                                                            'properties '
                                                            'are still '
                                                            'accepted in '
                                                            'create & '
                                                            'update '
                                                            'operations, '
                                                            'however they '
                                                            'may be '
                                                            'ignored, or '
                                                            'converted to '
                                                            'a consistent '
                                                            'model on '
                                                            'application. '
                                                            'Deprecated '
                                                            'properties '
                                                            'are not '
                                                            'guaranteed to '
                                                            'be present in '
                                                            'read paths.'},
                    'description': {'$comment': 'A short description of '
                                                'the resource provider. '
                                                'This will be shown in the '
                                                'AWS CloudFormation '
                                                'console.',
                                    '$ref': 'https://json-schema.org/draft-07/schema#/properties/description'},
                    'documentationUrl': {'$comment': 'A page with '
                                                     'supplemental '
                                                     'documentation. The '
                                                     'property '
                                                     'documentation in '
                                                     'schemas should be '
                                                     'able to stand alone, '
                                                     'but this is an '
                                                     'opportunity for e.g. '
                                                     'rich examples or '
                                                     'more guided '
                                                     'documents.',
                                         '$ref': '#/definitions/httpsUrl',
                                         'examples': ['https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/CHAP_Using.html']},
                    'handlers': {'additionalProperties': False,
                                 'description': 'Defines the provisioning '
                                                'operations which can be '
                                                'performed on this '
                                                'resource type',
                                 'properties': {'create': {'$ref': '#/definitions/handlerDefinition'},
                                                'delete': {'$ref': '#/definitions/handlerDefinition'},
                                                'list': {'$ref': '#/definitions/handlerDefinition'},
                                                'read': {'$ref': '#/definitions/handlerDefinition'},
                                                'update': {'$ref': '#/definitions/handlerDefinition'}},
                                 'type': 'object'},
                    'oneOf': {'$ref': '#/definitions/schemaArray'},
                    'primaryIdentifier': {'$ref': '#/definitions/jsonPointerArray',
                                          'description': 'A required '
                                                         'identifier which '
                                                         'uniquely '
                                                         'identifies an '
                                                         'instance of this '
                                                         'resource type. '
                                                         'An identifier is '
                                                         'a '
                                                         'non-zero-length '
                                                         'list of JSON '
                                                         'pointers to '
                                                         'properties that '
                                                         'form a single '
                                                         'key. An '
                                                         'identifier can '
                                                         'be a single or '
                                                         'multiple '
                                                         'properties to '
                                                         'support '
                                                         'composite-key '
                                                         'identifiers.'},
                    'properties': {'additionalProperties': False,
                                   'minProperties': 1,
                                   'patternProperties': {'^[A-Za-z0-9]{1,64}$': {'$ref': '#/definitions/properties'}},
                                   'type': 'object'},
                    'readOnlyProperties': {'$ref': '#/definitions/jsonPointerArray',
                                           'description': 'A list of JSON '
                                                          'pointers to '
                                                          'properties that '
                                                          'are able to be '
                                                          'found in a Read '
                                                          'request but '
                                                          'unable to be '
                                                          'specified by '
                                                          'the customer'},
                    'remote': {'additionalProperties': False,
                               'description': 'Reserved for CloudFormation '
                                              'use. A namespace to inline '
                                              'remote schemas.',
                               'patternProperties': {'^schema[0-9]+$': {'additionalProperties': True,
                                                                        'description': 'Reserved '
                                                                                       'for '
                                                                                       'CloudFormation '
                                                                                       'use. '
                                                                                       'A '
                                                                                       'inlined '
                                                                                       'remote '
                                                                                       'schema.',
                                                                        'properties': {'$comment': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/$comment'},
                                                                                       'definitions': {'$ref': '#/properties/definitions'},
                                                                                       'properties': {'$ref': '#/properties/properties'}},
                                                                        'type': 'object'}},
                               'type': 'object'},
                    'required': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/required'},
                    'sourceUrl': {'$comment': 'The location of the source '
                                              'code for this resource '
                                              'provider, to help '
                                              'interested parties submit '
                                              'issues or improvements.',
                                  '$ref': '#/definitions/httpsUrl',
                                  'examples': ['https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-s3']},
                    'title': {'$ref': 'https://json-schema.org/draft-07/schema#/properties/title'},
                    'type': {'$comment': 'Resource Type',
                             'const': 'RESOURCE',
                             'type': 'string'},
                    'typeName': {'$comment': 'Resource Type Identifier',
                                 'examples': ['Organization::Service::Resource',
                                              'AWS::EC2::Instance',
                                              'Initech::TPS::Report'],
                                 'pattern': '^[a-zA-Z0-9]{2,64}::[a-zA-Z0-9]{2,64}::[a-zA-Z0-9]{2,64}$',
                                 'type': 'string'},
                    'writeOnlyProperties': {'$ref': '#/definitions/jsonPointerArray',
                                            'description': 'A list of JSON '
                                                           'pointers to '
                                                           'properties '
                                                           '(typically '
                                                           'sensitive) '
                                                           'that are able '
                                                           'to be '
                                                           'specified by '
                                                           'the customer '
                                                           'but unable to '
                                                           'be returned in '
                                                           'a Read '
                                                           'request'}},
     'required': ['typeName',
                  'properties',
                  'description',
                  'primaryIdentifier',
                  'additionalProperties'],
     'title': 'CloudFormation Resource Provider Definition MetaSchema',
     'type': 'object'}

On instance:
    {'createOnlyProperties': ['/properties/Id',
                              '/properties/IntegrationApiKey'],
     'definitions': {'respondersProperty': {'properties': {'name': {'description': 'Responder '
                                                                                   'name '
                                                                                   'if '
                                                                                   'available',
                                                                    'minLength': 1,
                                                                    'type': 'string'},
                                                           'type': {'description': 'Responder '
                                                                                   'type',
                                                                    'minLength': 1,
                                                                    'type': 'string'},
                                                           'username': {'description': 'Responder '
                                                                                       'username, '
                                                                                       'if '
                                                                                       'responder '
                                                                                       'type '
                                                                                       'is '
                                                                                       'user',
                                                                        'minLength': 1,
                                                                        'type': 'string'}},
                                            'type': 'object'}},
     'description': 'Opsgenie Integration Resource definition',
     'handlers': {'create': {'permissions': ['']},
                  'delete': {'permissions': ['']},
                  'list': {'permissions': ['']},
                  'read': {'permissions': ['']},
                  'update': {'permissions': ['']}},
     'primaryIdentifier': ['/properties/Id',
                           '/properties/IntegrationApiKey',
                           '/properties/OpsgenieApiKey',
                           '/properties/OpsgenieApiEndpoint'],
     'properties': {'AllowConfigurationAccess': {'description': 'This '
                                                                'parameter '
                                                                'is for '
                                                                'allowing '
                                                                'or '
                                                                'restricting '
                                                                'the '
                                                                'configuration '
                                                                'access.',
                                                 'minLength': 1,
                                                 'type': 'boolean'},
                    'AllowDeleteAccess': {'description': 'This parameter '
                                                         'is for '
                                                         'configuring the '
                                                         'delete access of '
                                                         'integration.',
                                          'minLength': 1,
                                          'type': 'boolean'},
                    'AllowReadAccess': {'description': 'This parameter is '
                                                       'for configuring '
                                                       'the read access of '
                                                       'integration',
                                        'minLength': 1,
                                        'type': 'boolean'},
                    'AllowWriteAccess': {'description': 'This parameter is '
                                                        'for configuring '
                                                        'the write access '
                                                        'of integration.',
                                         'minLength': 1,
                                         'type': 'boolean'},
                    'Enabled': {'description': 'Integration status, '
                                               'default is true',
                                'minLength': 1,
                                'type': 'boolean'},
                    'Id': {'type': 'string'},
                    'IntegrationApiKey': {'minLength': 1, 'type': 'string'},
                    'IntegrationType': {'description': 'Integration types, '
                                                       'only api '
                                                       'integration types '
                                                       'supported',
                                        'minLength': 1,
                                        'type': 'string'},
                    'Name': {'description': 'Integration name',
                             'minLength': 1,
                             'pattern': '^[a-zA-Z0-9- _.]+$',
                             'type': 'string'},
                    'OpsgenieApiEndpoint': {'minLength': 1,
                                            'pattern': '^https://api(\\.eu|\\.sandbox|)\\.opsgenie\\.com$',
                                            'type': 'string'},
                    'OpsgenieApiKey': {'minLength': 1,
                                       'pattern': '^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$',
                                       'type': 'string'},
                    'OwnerTeamId': {'description': 'Id of the integration '
                                                   'owner team.',
                                    'minLength': 1,
                                    'type': 'string'},
                    'OwnerTeamName': {'description': 'Name of the '
                                                     'integration owner '
                                                     'team.',
                                      'minLength': 1,
                                      'pattern': '^[a-zA-Z0-9-_.]+$',
                                      'type': 'string'},
                    'Responders': {'items': {'$ref': '#/definitions/respondersProperty'},
                                   'type': 'array'}},
     'readOnlyProperties': ['/properties/IntegrationApiKey',
                            '/properties/Id'],
     'required': ['OpsgenieApiEndpoint',
                  'OpsgenieApiKey',
                  'Enabled',
                  'IntegrationType',
                  'Name'],
     'sourceUrl': 'https://github.com/opsgenie/opsgenie-cloudformation-resources',
     'typeName': 'Atlassian::Opsgenie::Integration',
     'writeOnlyProperties': ['/properties/OpsgenieApiKey',
                             '/properties/OpsgenieApiEndpoint']}
➜  opsgenie_integration git:(master)


rpdk.log : 
[2019-12-04T09:56:39Z] DEBUG    - Logging set up successfully
[2019-12-04T09:56:39Z] DEBUG    - Running submit: Namespace(command=<function submit at 0x10cf95ea0>, dry_run=False, endpoint_url=None, region=None, role_arn=None, set_default=False, subparser_name='submit', use_role=True, verbose=0, version=False)
[2019-12-04T09:56:39Z] DEBUG    - Root directory: /Users/QYCX/repos/infra/opsgenie-cloudformation-resources/opsgenie_integration
[2019-12-04T09:56:39Z] DEBUG    - Loading project file '/Users/QYCX/repos/infra/opsgenie-cloudformation-resources/opsgenie_integration/.rpdk-config'
[2019-12-04T09:56:39Z] INFO     - Validating your resource specification...
[2019-12-04T09:56:39Z] DEBUG    - Resource spec validation failed
Traceback (most recent call last):
  File "/Users/QYCX/.pyenv/versions/3.7.2/lib/python3.7/site-packages/rpdk/core/data_loaders.py", line 102, in load_resource_spec
    validator.validate(resource_spec)
  File "/Users/QYCX/.pyenv/versions/3.7.2/lib/python3.7/site-packages/jsonschema/validators.py", line 353, in validate
    raise error
jsonschema.exceptions.ValidationError: 'additionalProperties' is a required property

This should be fixed thank you for raising up this issue