Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aws cloudwatchlog event schema #8228

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 12 additions & 2 deletions lib/plugins/aws/package/compile/events/cloudWatchLog/index.js
Expand Up @@ -11,9 +11,19 @@ class AwsCompileCloudWatchLogEvents {
'package:compileEvents': this.compileCloudWatchLogEvents.bind(this),
};

// TODO: Complete schema, see https://github.com/serverless/serverless/issues/8027
this.serverless.configSchemaHandler.defineFunctionEvent('aws', 'cloudwatchLog', {
anyOf: [{ type: 'string' }, { type: 'object' }],
anyOf: [
{ $ref: '#/definitions/awsLogGroupName' },
{
type: 'object',
properties: {
logGroup: { $ref: '#/definitions/awsLogGroupName' },
filter: { type: 'string' },
},
required: ['logGroup'],
additionalProperties: false,
},
],
});
}

Expand Down
4 changes: 4 additions & 0 deletions lib/plugins/aws/provider/awsProvider.js
Expand Up @@ -233,6 +233,10 @@ class AwsProvider {
UpdateReplacePolicy: { type: 'string' },
Condition: { type: 'string' },
},
awsLogGroupName: {
type: 'string',
pattern: '[.-_/#A-Za-z0-9]+',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we should either escape - or put it as last character, as otherwise it'll expand to range between . and _ chars.

Also regex should be enclosed into ^ and $, as otherwise we confirm that any part in strings matches and not string as a whole

},
},
provider: {
properties: {
Expand Down