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

Implementation for AWS::GreengrassV2::Cluster #19

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions aws-greengrassv2-cluster/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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/

# python tests
.pytest_cache

.hypothesis
24 changes: 24 additions & 0 deletions aws-greengrassv2-cluster/.rpdk-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"artifact_type": "RESOURCE",
"typeName": "AWS::GreengrassV2::Cluster",
"language": "java",
"runtime": "java8",
"entrypoint": "software.amazon.greengrassv2.cluster.HandlerWrapper::handleRequest",
"testEntrypoint": "software.amazon.greengrassv2.cluster.HandlerWrapper::testEntrypoint",
"settings": {
"version": false,
"subparser_name": null,
"verbose": 0,
"force": false,
"type_name": null,
"namespace": [
"software",
"amazon",
"greengrassv2",
"cluster"
],
"codegen_template_path": "guided_aws",
"protocolVersion": "2.0.0"
},
"executableEntrypoint": "software.amazon.greengrassv2.cluster.HandlerWrapperExecutable"
}
12 changes: 12 additions & 0 deletions aws-greengrassv2-cluster/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# AWS::GreengrassV2::Clsuter

Congratulations on starting development! Next steps:

1. Write the JSON schema describing your resource, `aws-greengrassv2-cluster.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.
130 changes: 130 additions & 0 deletions aws-greengrassv2-cluster/aws-greengrassv2-cluster.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{
"typeName": "AWS::GreengrassV2::Cluster",
"description": "Resource for Greengrass V2 cluster.",
"definitions": {
"ClusterConfiguration": {
"type": "object",
"properties": {
"MinimumLeaderElectionTimeout": {
"$ref": "#/definitions/ElectionTimeout"
},
"MaximumLeaderElectionTimeout": {
"$ref": "#/definitions/ElectionTimeout"
},
"MinimumHealthyNodes": {
"type": "integer",
"minimum": 0,
"maximum": 10
},
"ClusterServerPort": {
"$ref": "#/definitions/ClusterPort"

},
"ClusterClientPort": {
"$ref": "#/definitions/ClusterPort"
}
},
"additionalProperties": false
},
"ElectionTimeout": {
"type": "integer",
"minimum": 0
},
"ClusterPort": {
"type": "integer",
"minimum": 0,
"maximum": 65353
},
"AssociatedMember": {
"type": "string",
"minLength": 1,
"maxLength": 128
}
},
"properties": {
"ClusterName": {
"type": "string",
"pattern": "^[a-zA-Z0-9_-]+$",
"minLength": 1,
"maxLength": 128
},
"ClusterArn": {
"type": "string",
"pattern": "arn:[^:]*:greengrass:[^:]*:[0-9]+:clusters:[^:]+"
},
"ClusterConfiguration": {
"$ref": "#/definitions/ClusterConfiguration"
},
"AssociatedMembers": {
"type": "array",
"items": {
"$ref": "#/definitions/AssociatedMember"
},
"minItems": 1,
"maxItems": 10,
"uniqueItems": true
},
"Tags": {
"type": "object",
"patternProperties": {
".*": {
"type": "string",
"maxLength": 256
}
},
"maxProperties": 200,
"additionalProperties": false
}
},
"required": [
"ClusterName"
],
"primaryIdentifier": [
"/properties/ClusterArn"
],
"additionalProperties": false,
"readOnlyProperties": [
"/properties/ClusterArn"
],
"createOnlyProperties": [
"/properties/ClusterName"
],
"handlers": {
"create": {
"permissions": [
"greengrass:CreateCluster",
"greengrass:GetCluster"
]
},
"read": {
"permissions": [
"greengrass:GetCluster"
]
},
"update": {
"permissions": [
"greengrass:UpdateCluster",
"greengrass:TagResource",
"greengrass:UntagResource"
]
},
"delete": {
"permissions": [
"greengrass:DisassociateCoreDevicesFromCluster",
"greengrass:DeleteCluster"
]
},
"list": {
"permissions": [
"greengrass:ListClusters"
]
}
},
"tagging": {
"taggable": true,
"tagOnCreate": true,
"tagUpdatable": true,
"cloudFormationSystemTags": false,
"tagProperty": "/properties/Tags"
}
}
90 changes: 90 additions & 0 deletions aws-greengrassv2-cluster/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# AWS::GreengrassV2::Cluster

Resource for Greengrass V2 cluster.

## Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

### JSON

<pre>
{
"Type" : "AWS::GreengrassV2::Cluster",
"Properties" : {
"<a href="#clustername" title="ClusterName">ClusterName</a>" : <i>String</i>,
"<a href="#clusterconfiguration" title="ClusterConfiguration">ClusterConfiguration</a>" : <i><a href="clusterconfiguration.md">ClusterConfiguration</a></i>,
"<a href="#associatedmembers" title="AssociatedMembers">AssociatedMembers</a>" : <i>[ String, ... ]</i>,
"<a href="#tags" title="Tags">Tags</a>" : <i><a href="tags.md">Tags</a></i>
}
}
</pre>

### YAML

<pre>
Type: AWS::GreengrassV2::Cluster
Properties:
<a href="#clustername" title="ClusterName">ClusterName</a>: <i>String</i>
<a href="#clusterconfiguration" title="ClusterConfiguration">ClusterConfiguration</a>: <i><a href="clusterconfiguration.md">ClusterConfiguration</a></i>
<a href="#associatedmembers" title="AssociatedMembers">AssociatedMembers</a>: <i>
- String</i>
<a href="#tags" title="Tags">Tags</a>: <i><a href="tags.md">Tags</a></i>
</pre>

## Properties

#### ClusterName

_Required_: Yes

_Type_: String

_Minimum Length_: <code>1</code>

_Maximum Length_: <code>128</code>

_Pattern_: <code>^[a-zA-Z0-9_-]+$</code>

_Update requires_: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

#### ClusterConfiguration

_Required_: No

_Type_: <a href="clusterconfiguration.md">ClusterConfiguration</a>

_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

#### AssociatedMembers

_Required_: No

_Type_: List of String

_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

#### Tags

_Required_: No

_Type_: <a href="tags.md">Tags</a>

_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## Return Values

### Ref

When you pass the logical ID of this resource to the intrinsic `Ref` function, Ref returns the ClusterArn.

### Fn::GetAtt

The `Fn::GetAtt` intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the `Fn::GetAtt` intrinsic function, see [Fn::GetAtt](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html).

#### ClusterArn

Returns the <code>ClusterArn</code> value.

70 changes: 70 additions & 0 deletions aws-greengrassv2-cluster/docs/clusterconfiguration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# AWS::GreengrassV2::Cluster ClusterConfiguration

## Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

### JSON

<pre>
{
"<a href="#minimumleaderelectiontimeout" title="MinimumLeaderElectionTimeout">MinimumLeaderElectionTimeout</a>" : <i>Integer</i>,
"<a href="#maximumleaderelectiontimeout" title="MaximumLeaderElectionTimeout">MaximumLeaderElectionTimeout</a>" : <i>Integer</i>,
"<a href="#minimumhealthynodes" title="MinimumHealthyNodes">MinimumHealthyNodes</a>" : <i>Integer</i>,
"<a href="#clusterserverport" title="ClusterServerPort">ClusterServerPort</a>" : <i>Integer</i>,
"<a href="#clusterclientport" title="ClusterClientPort">ClusterClientPort</a>" : <i>Integer</i>
}
</pre>

### YAML

<pre>
<a href="#minimumleaderelectiontimeout" title="MinimumLeaderElectionTimeout">MinimumLeaderElectionTimeout</a>: <i>Integer</i>
<a href="#maximumleaderelectiontimeout" title="MaximumLeaderElectionTimeout">MaximumLeaderElectionTimeout</a>: <i>Integer</i>
<a href="#minimumhealthynodes" title="MinimumHealthyNodes">MinimumHealthyNodes</a>: <i>Integer</i>
<a href="#clusterserverport" title="ClusterServerPort">ClusterServerPort</a>: <i>Integer</i>
<a href="#clusterclientport" title="ClusterClientPort">ClusterClientPort</a>: <i>Integer</i>
</pre>

## Properties

#### MinimumLeaderElectionTimeout

_Required_: No

_Type_: Integer

_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

#### MaximumLeaderElectionTimeout

_Required_: No

_Type_: Integer

_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

#### MinimumHealthyNodes

_Required_: No

_Type_: Integer

_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

#### ClusterServerPort

_Required_: No

_Type_: Integer

_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

#### ClusterClientPort

_Required_: No

_Type_: Integer

_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

32 changes: 32 additions & 0 deletions aws-greengrassv2-cluster/docs/tags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# AWS::GreengrassV2::Cluster Tags

## Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

### JSON

<pre>
{
"<a href="#.*" title=".*">.*</a>" : <i>String</i>
}
</pre>

### YAML

<pre>
<a href="#.*" title=".*">.*</a>: <i>String</i>
</pre>

## Properties

#### \.*

_Required_: No

_Type_: String

_Maximum Length_: <code>256</code>

_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

1 change: 1 addition & 0 deletions aws-greengrassv2-cluster/lombok.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lombok.addLombokGeneratedAnnotation = true
Loading