Skip to content

Commit

Permalink
feat: add support for updateMethod on document (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZachBien authored Nov 14, 2022
1 parent 858786a commit d25df44
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
51 changes: 51 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -16524,6 +16524,7 @@ const automationDocumentProps: AutomationDocumentProps = { ... }
| <code><a href="#@cdklabs/cdk-ssm-documents.AutomationDocumentProps.property.requires">requires</a></code> | <code>aws-cdk-lib.IResolvable \| aws-cdk-lib.aws_ssm.CfnDocument.DocumentRequiresProperty \| aws-cdk-lib.IResolvable[]</code> | `AWS::SSM::Document.Requires`. |
| <code><a href="#@cdklabs/cdk-ssm-documents.AutomationDocumentProps.property.tags">tags</a></code> | <code>aws-cdk-lib.CfnTag[]</code> | `AWS::SSM::Document.Tags`. |
| <code><a href="#@cdklabs/cdk-ssm-documents.AutomationDocumentProps.property.targetType">targetType</a></code> | <code>string</code> | `AWS::SSM::Document.TargetType`. |
| <code><a href="#@cdklabs/cdk-ssm-documents.AutomationDocumentProps.property.updateMethod">updateMethod</a></code> | <code>string</code> | If the document resource you specify in your template already exists, this parameter determines whether a new version of the existing document is created, or the existing document is replaced. |
| <code><a href="#@cdklabs/cdk-ssm-documents.AutomationDocumentProps.property.versionName">versionName</a></code> | <code>string</code> | `AWS::SSM::Document.VersionName`. |

---
Expand Down Expand Up @@ -16666,6 +16667,22 @@ public readonly targetType: string;

---

##### `updateMethod`<sup>Optional</sup> <a name="updateMethod" id="@cdklabs/cdk-ssm-documents.AutomationDocumentProps.property.updateMethod"></a>

```typescript
public readonly updateMethod: string;
```

- *Type:* string

If the document resource you specify in your template already exists, this parameter determines whether a new version of the existing document is created, or the existing document is replaced.

`Replace` is the default method. If you specify `NewVersion` for the `UpdateMethod` parameter, and the `Name` of the document does not match an existing resource, a new document is created. When you specify `NewVersion` , the default version of the document is changed to the newly created version.

> [http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-document.html#cfn-ssm-document-updatemethod](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-document.html#cfn-ssm-document-updatemethod)

---

##### `versionName`<sup>Optional</sup> <a name="versionName" id="@cdklabs/cdk-ssm-documents.AutomationDocumentProps.property.versionName"></a>

```typescript
Expand Down Expand Up @@ -18360,6 +18377,7 @@ const commandDocumentProps: CommandDocumentProps = { ... }
| <code><a href="#@cdklabs/cdk-ssm-documents.CommandDocumentProps.property.requires">requires</a></code> | <code>aws-cdk-lib.IResolvable \| aws-cdk-lib.aws_ssm.CfnDocument.DocumentRequiresProperty \| aws-cdk-lib.IResolvable[]</code> | `AWS::SSM::Document.Requires`. |
| <code><a href="#@cdklabs/cdk-ssm-documents.CommandDocumentProps.property.tags">tags</a></code> | <code>aws-cdk-lib.CfnTag[]</code> | `AWS::SSM::Document.Tags`. |
| <code><a href="#@cdklabs/cdk-ssm-documents.CommandDocumentProps.property.targetType">targetType</a></code> | <code>string</code> | `AWS::SSM::Document.TargetType`. |
| <code><a href="#@cdklabs/cdk-ssm-documents.CommandDocumentProps.property.updateMethod">updateMethod</a></code> | <code>string</code> | If the document resource you specify in your template already exists, this parameter determines whether a new version of the existing document is created, or the existing document is replaced. |
| <code><a href="#@cdklabs/cdk-ssm-documents.CommandDocumentProps.property.versionName">versionName</a></code> | <code>string</code> | `AWS::SSM::Document.VersionName`. |

---
Expand Down Expand Up @@ -18502,6 +18520,22 @@ public readonly targetType: string;

---

##### `updateMethod`<sup>Optional</sup> <a name="updateMethod" id="@cdklabs/cdk-ssm-documents.CommandDocumentProps.property.updateMethod"></a>

```typescript
public readonly updateMethod: string;
```

- *Type:* string

If the document resource you specify in your template already exists, this parameter determines whether a new version of the existing document is created, or the existing document is replaced.

`Replace` is the default method. If you specify `NewVersion` for the `UpdateMethod` parameter, and the `Name` of the document does not match an existing resource, a new document is created. When you specify `NewVersion` , the default version of the document is changed to the newly created version.

> [http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-document.html#cfn-ssm-document-updatemethod](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-document.html#cfn-ssm-document-updatemethod)

---

##### `versionName`<sup>Optional</sup> <a name="versionName" id="@cdklabs/cdk-ssm-documents.CommandDocumentProps.property.versionName"></a>

```typescript
Expand Down Expand Up @@ -27133,6 +27167,7 @@ const ssmDocumentProps: SsmDocumentProps = { ... }
| <code><a href="#@cdklabs/cdk-ssm-documents.SsmDocumentProps.property.requires">requires</a></code> | <code>aws-cdk-lib.IResolvable \| aws-cdk-lib.aws_ssm.CfnDocument.DocumentRequiresProperty \| aws-cdk-lib.IResolvable[]</code> | `AWS::SSM::Document.Requires`. |
| <code><a href="#@cdklabs/cdk-ssm-documents.SsmDocumentProps.property.tags">tags</a></code> | <code>aws-cdk-lib.CfnTag[]</code> | `AWS::SSM::Document.Tags`. |
| <code><a href="#@cdklabs/cdk-ssm-documents.SsmDocumentProps.property.targetType">targetType</a></code> | <code>string</code> | `AWS::SSM::Document.TargetType`. |
| <code><a href="#@cdklabs/cdk-ssm-documents.SsmDocumentProps.property.updateMethod">updateMethod</a></code> | <code>string</code> | If the document resource you specify in your template already exists, this parameter determines whether a new version of the existing document is created, or the existing document is replaced. |
| <code><a href="#@cdklabs/cdk-ssm-documents.SsmDocumentProps.property.versionName">versionName</a></code> | <code>string</code> | `AWS::SSM::Document.VersionName`. |

---
Expand Down Expand Up @@ -27275,6 +27310,22 @@ public readonly targetType: string;

---

##### `updateMethod`<sup>Optional</sup> <a name="updateMethod" id="@cdklabs/cdk-ssm-documents.SsmDocumentProps.property.updateMethod"></a>

```typescript
public readonly updateMethod: string;
```

- *Type:* string

If the document resource you specify in your template already exists, this parameter determines whether a new version of the existing document is created, or the existing document is replaced.

`Replace` is the default method. If you specify `NewVersion` for the `UpdateMethod` parameter, and the `Name` of the document does not match an existing resource, a new document is created. When you specify `NewVersion` , the default version of the document is changed to the newly created version.

> [http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-document.html#cfn-ssm-document-updatemethod](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-document.html#cfn-ssm-document-updatemethod)

---

##### `versionName`<sup>Optional</sup> <a name="versionName" id="@cdklabs/cdk-ssm-documents.SsmDocumentProps.property.versionName"></a>

```typescript
Expand Down
8 changes: 7 additions & 1 deletion src/document/ssm-document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ export interface SsmDocumentProps {
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-document.html#cfn-ssm-document-targettype
*/
readonly targetType?: string;
/**
* If the document resource you specify in your template already exists, this parameter determines whether a new version of the existing document is created, or the existing document is replaced. `Replace` is the default method. If you specify `NewVersion` for the `UpdateMethod` parameter, and the `Name` of the document does not match an existing resource, a new document is created. When you specify `NewVersion` , the default version of the document is changed to the newly created version.
*
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-document.html#cfn-ssm-document-updatemethod
*/
readonly updateMethod?: string;
/**
* `AWS::SSM::Document.VersionName`.
*
Expand Down Expand Up @@ -112,7 +118,7 @@ export abstract class SsmDocument extends Construct {
return JSON.parse(JSON.stringify(doc));
},
}),
name: this.documentName,
name: this.props.documentName,
documentFormat: isYaml ? 'YAML' : 'JSON',
documentType: this.documentType(),
tags: [{ key: 'CdkGenerated', value: 'true' }, ...(this.props.tags || [])],
Expand Down

0 comments on commit d25df44

Please sign in to comment.