Skip to content

Commit

Permalink
Add support for AWS::Iot::ScheduledAudit (#16)
Browse files Browse the repository at this point in the history
* Add support for AWS::Iot::ScheduledAudit

* Add improvements for the second revision for ScheduledAudit PR

* Add improvements for the third revision for ScheduledAudit PR

* Add improvements for the fourth revision for ScheduledAudit PR

* Add improvements for the fifth revision for ScheduledAudit PR

* Add improvements for the fifth revision for ScheduledAudit PR

* Add improvements for the sixth revision for ScheduledAudit PR

* Use ProgressEvents instead of Cfn exceptions

Co-authored-by: Saurabh Singh <[email protected]>
  • Loading branch information
saurabh14rajput and Saurabh Singh authored Dec 16, 2020
1 parent 2ab36d7 commit 8d18680
Show file tree
Hide file tree
Showing 28 changed files with 2,104 additions and 0 deletions.
23 changes: 23 additions & 0 deletions aws-iot-scheduledaudit/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# macOS
.DS_Store
._*

# Maven outputs
.classpath

# IntelliJ
*.iml
.idea
out.java
out/
.settings
.project

# auto-generated files
target/

# our logs
rpdk.log

# contains credentials
sam-tests/
17 changes: 17 additions & 0 deletions aws-iot-scheduledaudit/.rpdk-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"typeName": "AWS::IoT::ScheduledAudit",
"language": "java",
"runtime": "java8",
"entrypoint": "com.amazonaws.iot.scheduledaudit.HandlerWrapper::handleRequest",
"testEntrypoint": "com.amazonaws.iot.scheduledaudit.HandlerWrapper::testEntrypoint",
"settings": {
"namespace": [
"com",
"amazonaws",
"iot",
"scheduledaudit"
],
"codegen_template_path": "guided_aws",
"protocolVersion": "2.0.0"
}
}
138 changes: 138 additions & 0 deletions aws-iot-scheduledaudit/aws-iot-scheduledaudit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
{
"typeName": "AWS::IoT::ScheduledAudit",
"description": "Scheduled audits can be used to specify the checks you want to perform during an audit and how often the audit should be run.",
"sourceUrl": "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-iot.git",
"definitions": {
"Tag": {
"description": "A key-value pair to associate with a resource.",
"type": "object",
"properties": {
"Key": {
"type": "string",
"description": "The tag's key.",
"minLength": 1,
"maxLength": 128
},
"Value": {
"type": "string",
"description": "The tag's value.",
"minLength": 1,
"maxLength": 256
}
},
"required": [
"Value",
"Key"
],
"additionalProperties": false
}
},
"properties": {
"ScheduledAuditName": {
"description": "The name you want to give to the scheduled audit.",
"type": "string",
"pattern": "[a-zA-Z0-9:_-]+",
"minLength": 1,
"maxLength": 128
},
"Frequency": {
"description": "How often the scheduled audit takes place. Can be one of DAILY, WEEKLY, BIWEEKLY, or MONTHLY.",
"type": "string",
"enum": [
"DAILY",
"WEEKLY",
"BIWEEKLY",
"MONTHLY"
]
},
"DayOfMonth": {
"description": "The day of the month on which the scheduled audit takes place. Can be 1 through 31 or LAST. This field is required if the frequency parameter is set to MONTHLY.",
"type": "string",
"pattern": "^([1-9]|[12][0-9]|3[01])$|^LAST$"
},
"DayOfWeek": {
"description": "The day of the week on which the scheduled audit takes place. Can be one of SUN, MON, TUE,WED, THU, FRI, or SAT. This field is required if the frequency parameter is set to WEEKLY or BIWEEKLY.",
"type": "string",
"enum": [
"SUN",
"MON",
"TUE",
"WED",
"THU",
"FRI",
"SAT"
]
},
"TargetCheckNames": {
"description": "Which checks are performed during the scheduled audit. Checks must be enabled for your account.",
"type": "array",
"uniqueItems": true,
"insertionOrder": false,
"items": {
"type": "string"
}
},
"ScheduledAuditArn": {
"description": "The ARN (Amazon resource name) of the scheduled audit.",
"type": "string",
"minLength": 20,
"maxLength": 2048
},
"Tags": {
"type": "array",
"maxItems": 50,
"uniqueItems": true,
"insertionOrder": false,
"description": "An array of key-value pairs to apply to this resource.",
"items": {
"$ref": "#/definitions/Tag"
}
}
},
"additionalProperties": false,
"primaryIdentifier": [
"/properties/ScheduledAuditName"
],
"required": [
"Frequency",
"TargetCheckNames"
],
"createOnlyProperties": [
"/properties/ScheduledAuditName"
],
"readOnlyProperties": [
"/properties/ScheduledAuditArn"
],
"handlers": {
"create": {
"permissions": [
"iot:CreateScheduledAudit"
]
},
"read": {
"permissions": [
"iot:DescribeScheduledAudit",
"iot:ListTagsForResource"
]
},
"update": {
"permissions": [
"iot:UpdateScheduledAudit",
"iot:ListTagsForResource",
"iot:UntagResource",
"iot:TagResource"
]
},
"delete": {
"permissions": [
"iot:DescribeScheduledAudit",
"iot:DeleteScheduledAudit"
]
},
"list": {
"permissions": [
"iot:ListScheduledAudits"
]
}
}
}
14 changes: 14 additions & 0 deletions aws-iot-scheduledaudit/inputs/inputs_1_create.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"ScheduledAuditName": "CfnContractTest",
"Frequency": "DAILY",
"TargetCheckNames": [
"CA_CERTIFICATE_EXPIRING_CHECK",
"DEVICE_CERTIFICATE_EXPIRING_CHECK"
],
"Tags": [
{
"Key": "testTagKey",
"Value": "tagValue"
}
]
}
15 changes: 15 additions & 0 deletions aws-iot-scheduledaudit/inputs/inputs_1_invalid.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"ScheduledAuditName": "CfnContractTest",
"Frequency": "DAILY",
"TargetCheckNames": [
"DEVICE_CERTIFICATE_SHARED_CHECK",
"REVOKED_CA_CERT_CHECK"
],
"Tags": [
{
"Key": "testTagKey",
"Value": "tagValue"
}
],
"ScheduledAuditArn": "Arn is read only"
}
14 changes: 14 additions & 0 deletions aws-iot-scheduledaudit/inputs/inputs_1_update.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"ScheduledAuditName": "CfnContractTest",
"Frequency": "MONTHLY",
"DayOfMonth": "LAST",
"TargetCheckNames": [
"CA_CERTIFICATE_EXPIRING_CHECK"
],
"Tags": [
{
"Key": "testTagKey",
"Value": "tagValue"
}
]
}
1 change: 1 addition & 0 deletions aws-iot-scheduledaudit/lombok.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lombok.addLombokGeneratedAnnotation = true
Loading

0 comments on commit 8d18680

Please sign in to comment.