-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add resource type "metric filter" (aws-cloudformation#33)
- Loading branch information
Maria Ines Parnisari
authored
May 19, 2020
1 parent
b2b6b83
commit 6db90de
Showing
27 changed files
with
2,107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# macOS | ||
.DS_Store | ||
._* | ||
|
||
# Maven outputs | ||
.classpath | ||
|
||
# IntelliJ | ||
*.iml | ||
.idea/ | ||
out.java | ||
out/ | ||
.settings | ||
.project | ||
|
||
# auto-generated files | ||
target/ | ||
|
||
# our logs | ||
rpdk.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"typeName": "AWS::Logs::MetricFilter", | ||
"language": "java", | ||
"runtime": "java8", | ||
"entrypoint": "software.amazon.logs.metricfilter.HandlerWrapper::handleRequest", | ||
"testEntrypoint": "software.amazon.logs.metricfilter.HandlerWrapper::testEntrypoint", | ||
"settings": { | ||
"namespace": [ | ||
"software", | ||
"amazon", | ||
"logs", | ||
"metricfilter" | ||
], | ||
"codegen_template_path": "guided_aws" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# AWS::Logs::MetricFilter | ||
|
||
Congratulations on starting development! Next steps: | ||
|
||
1. Write the JSON schema describing your resource, `aws-logs-metricfilter.json` | ||
1. Implement your resource handlers. | ||
|
||
The RPDK will automatically generate the correct resource model from the schema whenever the project is built via Maven. You can also do this manually with the following command: `cfn generate`. | ||
|
||
> Please don't modify files under `target/generated-sources/rpdk`, as they will be automatically overwritten. | ||
The code uses [Lombok](https://projectlombok.org/), and [you may have to install IDE integrations](https://projectlombok.org/setup/overview) to enable auto-complete for Lombok-annotated classes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
{ | ||
"typeName": "AWS::Logs::MetricFilter", | ||
"resourceLink": { | ||
"templateUri": "/cloudwatch/home?region=${awsRegion}#logsV2:log-groups/log-group/${LogGroupName}/edit-metric-filter/${MetricName}", | ||
"mappings": { | ||
"MetricName": "/MetricName", | ||
"LogGroupName": "/LogGroupName" | ||
} | ||
}, | ||
"description": "Specifies a metric filter that describes how CloudWatch Logs extracts information from logs and transforms it into Amazon CloudWatch metrics.", | ||
"sourceUrl": "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-logs.git", | ||
"definitions": { | ||
"MetricTransformation": { | ||
"type": "object", | ||
"properties": { | ||
"DefaultValue": { | ||
"description": "The value to emit when a filter pattern does not match a log event. This value can be null.", | ||
"type": "number" | ||
}, | ||
"MetricName": { | ||
"description": "The name of the CloudWatch metric. Metric name must be in ASCII format.", | ||
"type": "string", | ||
"minLength": 1, | ||
"maxLength": 255, | ||
"pattern": "^((?![:*$])[\\x00-\\x7F]){1,255}" | ||
}, | ||
"MetricNamespace": { | ||
"$comment": "Namespaces can be up to 256 characters long; valid characters include 0-9A-Za-z.-_/#", | ||
"description": "The namespace of the CloudWatch metric.", | ||
"type": "string", | ||
"minLength": 1, | ||
"maxLength": 256, | ||
"pattern": "^[0-9a-zA-Z\\.\\-_\\/#]{1,256}" | ||
}, | ||
"MetricValue": { | ||
"description": "The value to publish to the CloudWatch metric when a filter pattern matches a log event.", | ||
"type": "string", | ||
"minLength": 1, | ||
"maxLength": 100 | ||
} | ||
}, | ||
"required": [ | ||
"MetricName", | ||
"MetricNamespace", | ||
"MetricValue" | ||
], | ||
"additionalProperties": false | ||
} | ||
}, | ||
"properties": { | ||
"FilterName": { | ||
"description": "A name for the metric filter.", | ||
"type": "string", | ||
"minLength": 1, | ||
"maxLength": 512, | ||
"pattern": "^[^:*]{1,512}" | ||
}, | ||
"FilterPattern": { | ||
"description": "Pattern that Logs follows to interpret each entry in a log.", | ||
"type": "string", | ||
"maxLength": 1024 | ||
}, | ||
"LogGroupName": { | ||
"description": "Existing log group that you want to associate with this filter.", | ||
"type": "string", | ||
"minLength": 1, | ||
"maxLength": 512, | ||
"pattern": "^[.\\-_/#A-Za-z0-9]{1,512}" | ||
}, | ||
"MetricTransformations": { | ||
"description": "A collection of information that defines how metric data gets emitted.", | ||
"type": "array", | ||
"minItems": 1, | ||
"maxItems": 1, | ||
"items": { | ||
"$ref": "#/definitions/MetricTransformation" | ||
} | ||
} | ||
}, | ||
"handlers": { | ||
"create": { | ||
"permissions": [ | ||
"logs:PutMetricFilter", | ||
"logs:DescribeMetricFilters" | ||
] | ||
}, | ||
"read": { | ||
"permissions": [ | ||
"logs:DescribeMetricFilters" | ||
] | ||
}, | ||
"update": { | ||
"permissions": [ | ||
"logs:PutMetricFilter", | ||
"logs:DescribeMetricFilters" | ||
] | ||
}, | ||
"delete": { | ||
"permissions": [ | ||
"logs:DeleteMetricFilter" | ||
] | ||
}, | ||
"list": { | ||
"permissions": [ | ||
"logs:DescribeMetricFilters" | ||
] | ||
} | ||
}, | ||
"required": [ | ||
"FilterPattern", | ||
"LogGroupName", | ||
"MetricTransformations" | ||
], | ||
"createOnlyProperties": [ | ||
"/properties/FilterName", | ||
"/properties/LogGroupName" | ||
], | ||
"primaryIdentifier": [ | ||
"/properties/LogGroupName", | ||
"/properties/FilterName" | ||
], | ||
"additionalProperties": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lombok.addLombokGeneratedAnnotation = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"CREATE": { | ||
"/LogGroupName": "this-is-a-random-loggroup", | ||
"/FilterName": "my-metric-filter", | ||
"/FilterPattern": "[size]", | ||
"/MetricTransformations": [ | ||
{ | ||
"MetricValue": 10, | ||
"MetricNamespace": "my-namespace", | ||
"MetricName": "metric-name" | ||
} | ||
] | ||
} | ||
} |
Oops, something went wrong.