From 1397042e0efe4cb2da546d8a705983f0298870e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Barthelet?= Date: Wed, 16 Sep 2020 15:43:12 +0200 Subject: [PATCH] Sort awsProviders properties new keys --- lib/plugins/aws/provider/awsProvider.js | 134 ++++++++++++------------ 1 file changed, 66 insertions(+), 68 deletions(-) diff --git a/lib/plugins/aws/provider/awsProvider.js b/lib/plugins/aws/provider/awsProvider.js index 842e2cc491a0..e8115839b9f3 100644 --- a/lib/plugins/aws/provider/awsProvider.js +++ b/lib/plugins/aws/provider/awsProvider.js @@ -141,14 +141,6 @@ class AwsProvider { // TODO: Complete schema, see https://github.com/serverless/serverless/issues/8016 serverless.configSchemaHandler.defineProvider('aws', { definitions: { - awsSnsArnString: { - type: 'string', - pattern: '^arn:aws[a-z-]*:sns', - }, - awsKmsArnString: { - type: 'string', - pattern: '^arn:aws[a-z-]*:kms', - }, awsArn: { oneOf: [ { $ref: '#/definitions/awsArnString' }, @@ -158,20 +150,6 @@ class AwsProvider { awsArnString: { type: 'string', pattern: '^arn:', - awsSnsArn: { - oneOf: [ - { $ref: '#/definitions/awsSnsArnString' }, - { $ref: '#/definitions/awsCfFunction' }, - ], - }, - awsKmsArn: { - oneOf: [ - { $ref: '#/definitions/awsKmsArnString' }, - { $ref: '#/definitions/awsCfFunction' }, - ], - }, - awsCfInstruction: { - oneOf: [{ type: 'string', minLength: 1 }, { $ref: '#/definitions/awsCfFunction' }], }, awsCfFunction: { oneOf: [ @@ -244,20 +222,35 @@ class AwsProvider { required: ['Fn::Sub'], additionalProperties: false, }, - awsResourceProperties: { - Properties: { type: 'object' }, - CreationPolicy: { type: 'object' }, - DeletionPolicy: { type: 'string' }, - DependsOn: { - oneOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }], - }, - Metadata: { type: 'object' }, - UpdatePolicy: { type: 'object' }, - UpdateReplacePolicy: { type: 'string' }, - Condition: { type: 'string' }, + awsKmsArn: { + oneOf: [ + { $ref: '#/definitions/awsKmsArnString' }, + { $ref: '#/definitions/awsCfFunction' }, + ], + }, + awsKmsArnString: { + type: 'string', + pattern: '^arn:aws[a-z-]*:kms', + }, + awsLambdaLayers: { + type: 'array', + items: { $ref: '#/definitions/awsArn' }, }, awsLambdaMemorySize: { type: 'integer', multipleOf: 64, minimum: 128, maximum: 3008 }, - awsLambdaTimeout: { type: 'integer', minimum: 1, maximum: 900 }, + awsLambdaEnvironment: { + type: 'object', + patternProperties: { + '^[A-Za-z_][a-zA-Z0-9_]*$': { $ref: '#/definitions/awsCfInstruction' }, + }, + additionalProperties: false, + }, + awsLambdaRole: { + anyOf: [ + { type: 'string', minLength: 1 }, + { $ref: '#/definitions/awsCfImport' }, + { $ref: '#/definitions/awsCfGetAtt' }, + ], + }, awsLambdaRuntime: { enum: [ 'dotnetcore2.1', @@ -278,21 +271,9 @@ class AwsProvider { 'ruby2.7', ], }, + awsLambdaTimeout: { type: 'integer', minimum: 1, maximum: 900 }, awsLambdaTracing: { anyOf: [{ enum: ['Active', 'PassThrough'] }, { type: 'boolean' }] }, - awsLambdaEnvironment: { - type: 'object', - patternProperties: { - '^[A-Za-z_][a-zA-Z0-9_]*$': { $ref: '#/definitions/awsCfInstruction' }, - }, - additionalProperties: false, - }, - awsLambdaRole: { - anyOf: [ - { type: 'string', minLength: 1 }, - { $ref: '#/definitions/awsCfImport' }, - { $ref: '#/definitions/awsCfGetAtt' }, - ], - }, + awsLambdaVersionning: { type: 'boolean' }, awsLambdaVpcConfig: { type: 'object', properties: { @@ -312,11 +293,18 @@ class AwsProvider { }, }, }, - awsLambdaLayers: { - type: 'array', - items: { $ref: '#/definitions/awsArn' }, + awsResourceProperties: { + Properties: { type: 'object' }, + CreationPolicy: { type: 'object' }, + DeletionPolicy: { type: 'string' }, + DependsOn: { + oneOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }], + }, + Metadata: { type: 'object' }, + UpdatePolicy: { type: 'object' }, + UpdateReplacePolicy: { type: 'string' }, + Condition: { type: 'string' }, }, - awsLambdaVersionning: { type: 'boolean' }, awsResourceTags: { type: 'object', patternProperties: { @@ -327,9 +315,20 @@ class AwsProvider { }, additionalProperties: false, }, + awsSnsArn: { + oneOf: [ + { $ref: '#/definitions/awsSnsArnString' }, + { $ref: '#/definitions/awsCfFunction' }, + ], + }, + awsSnsArnString: { + type: 'string', + pattern: '^arn:aws[a-z-]*:sns', + }, }, provider: { properties: { + environment: { $ref: '#/definitions/awsLambdaEnvironment' }, httpApi: { type: 'object', properties: { @@ -392,6 +391,7 @@ class AwsProvider { }, additionalProperties: false, }, + layers: { $ref: '#/definitions/awsLambdaLayers' }, logs: { type: 'object', properties: { @@ -409,16 +409,17 @@ class AwsProvider { }, }, }, + memorySize: { $ref: '#/definitions/awsLambdaMemorySize' }, resourcePolicy: { type: 'array', items: { type: 'object', }, }, - memorySize: { $ref: '#/definitions/awsLambdaMemorySize' }, - timeout: { $ref: '#/definitions/awsLambdaTimeout' }, + role: { $ref: '#/definitions/awsLambdaRole' }, runtime: { $ref: '#/definitions/awsLambdaRuntime' }, tags: { $ref: '#/definitions/awsResourceTags' }, + timeout: { $ref: '#/definitions/awsLambdaTimeout' }, tracing: { type: 'object', properties: { @@ -427,15 +428,16 @@ class AwsProvider { }, additionalProperties: false, }, - environment: { $ref: '#/definitions/awsLambdaEnvironment' }, - role: { $ref: '#/definitions/awsLambdaRole' }, vpc: { $ref: '#/definitions/awsLambdaVpcConfig' }, - layers: { $ref: '#/definitions/awsLambdaLayers' }, versionFunctions: { $ref: '#/definitions/awsLambdaVersionning' }, }, }, function: { properties: { + awsKmsKeyArn: { $ref: '#/definitions/awsKmsArn' }, + description: { type: 'string', maxLength: 256 }, + disableLogs: { type: 'boolean' }, + environment: { $ref: '#/definitions/awsLambdaEnvironment' }, fileSystemConfig: { type: 'object', properties: { @@ -450,22 +452,18 @@ class AwsProvider { required: ['localMountPath', 'arn'], }, handler: { type: 'string' }, + layers: { $ref: '#/definitions/awsLambdaLayers' }, memorySize: { $ref: '#/definitions/awsLambdaMemorySize' }, - timeout: { $ref: '#/definitions/awsLambdaTimeout' }, + onError: { $ref: '#/definitions/awsSnsArn' }, + provisionedConcurrency: { type: 'integer', minimum: 0 }, + reservedConcurrency: { type: 'integer', minimum: 0 }, + role: { $ref: '#/definitions/awsLambdaRole' }, runtime: { $ref: '#/definitions/awsLambdaRuntime' }, - description: { type: 'string', maxLength: 256 }, tags: { $ref: '#/definitions/awsResourceTags' }, - onError: { $ref: '#/definitions/awsSnsArn' }, - awsKmsKeyArn: { $ref: '#/definitions/awsKmsArn' }, + timeout: { $ref: '#/definitions/awsLambdaTimeout' }, tracing: { $ref: '#/definitions/awsLambdaTracing' }, - environment: { $ref: '#/definitions/awsLambdaEnvironment' }, - role: { $ref: '#/definitions/awsLambdaRole' }, - vpc: { $ref: '#/definitions/awsLambdaVpcConfig' }, - reservedConcurrency: { type: 'integer', minimum: 0 }, - provisionedConcurrency: { type: 'integer', minimum: 0 }, - disableLogs: { type: 'boolean' }, - layers: { $ref: '#/definitions/awsLambdaLayers' }, versionFunction: { $ref: '#/definitions/awsLambdaVersionning' }, + vpc: { $ref: '#/definitions/awsLambdaVpcConfig' }, }, }, resources: {