@aws-cdk/aws-ssm
Version:
The CDK Construct Library for AWS::SSM
885 lines • 715 kB
JavaScript
"use strict";
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CfnResourcePolicy = exports.CfnResourceDataSync = exports.CfnPatchBaseline = exports.CfnParameter = exports.CfnMaintenanceWindowTask = exports.CfnMaintenanceWindowTarget = exports.CfnMaintenanceWindow = exports.CfnDocument = exports.CfnAssociation = void 0;
const jsiiDeprecationWarnings = require("../.warnings.jsii.js");
const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
// Copyright 2012-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// Generated from the AWS CloudFormation Resource Specification
// See: docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification.html
// @cfn2ts:meta@ {"generated":"2023-06-19T15:13:48.634Z","fingerprint":"0JH6KvN2PKfcuYsveGT+qJ5ATs1AdkP5U9G+qrOqzk8="}
/* eslint-disable max-len */ // This is generated code - line lengths are difficult to control
const cdk = require("@aws-cdk/core");
const cfn_parse = require("@aws-cdk/core/lib/helpers-internal");
/**
* Determine whether the given properties match those of a `CfnAssociationProps`
*
* @param properties - the TypeScript properties of a `CfnAssociationProps`
*
* @returns the result of the validation.
*/
function CfnAssociationPropsValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));
}
errors.collect(cdk.propertyValidator('applyOnlyAtCronInterval', cdk.validateBoolean)(properties.applyOnlyAtCronInterval));
errors.collect(cdk.propertyValidator('associationName', cdk.validateString)(properties.associationName));
errors.collect(cdk.propertyValidator('automationTargetParameterName', cdk.validateString)(properties.automationTargetParameterName));
errors.collect(cdk.propertyValidator('calendarNames', cdk.listValidator(cdk.validateString))(properties.calendarNames));
errors.collect(cdk.propertyValidator('complianceSeverity', cdk.validateString)(properties.complianceSeverity));
errors.collect(cdk.propertyValidator('documentVersion', cdk.validateString)(properties.documentVersion));
errors.collect(cdk.propertyValidator('instanceId', cdk.validateString)(properties.instanceId));
errors.collect(cdk.propertyValidator('maxConcurrency', cdk.validateString)(properties.maxConcurrency));
errors.collect(cdk.propertyValidator('maxErrors', cdk.validateString)(properties.maxErrors));
errors.collect(cdk.propertyValidator('name', cdk.requiredValidator)(properties.name));
errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name));
errors.collect(cdk.propertyValidator('outputLocation', CfnAssociation_InstanceAssociationOutputLocationPropertyValidator)(properties.outputLocation));
errors.collect(cdk.propertyValidator('parameters', cdk.validateObject)(properties.parameters));
errors.collect(cdk.propertyValidator('scheduleExpression', cdk.validateString)(properties.scheduleExpression));
errors.collect(cdk.propertyValidator('scheduleOffset', cdk.validateNumber)(properties.scheduleOffset));
errors.collect(cdk.propertyValidator('syncCompliance', cdk.validateString)(properties.syncCompliance));
errors.collect(cdk.propertyValidator('targets', cdk.listValidator(CfnAssociation_TargetPropertyValidator))(properties.targets));
errors.collect(cdk.propertyValidator('waitForSuccessTimeoutSeconds', cdk.validateNumber)(properties.waitForSuccessTimeoutSeconds));
return errors.wrap('supplied properties not correct for "CfnAssociationProps"');
}
/**
* Renders the AWS CloudFormation properties of an `AWS::SSM::Association` resource
*
* @param properties - the TypeScript properties of a `CfnAssociationProps`
*
* @returns the AWS CloudFormation properties of an `AWS::SSM::Association` resource.
*/
// @ts-ignore TS6133
function cfnAssociationPropsToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnAssociationPropsValidator(properties).assertSuccess();
return {
Name: cdk.stringToCloudFormation(properties.name),
ApplyOnlyAtCronInterval: cdk.booleanToCloudFormation(properties.applyOnlyAtCronInterval),
AssociationName: cdk.stringToCloudFormation(properties.associationName),
AutomationTargetParameterName: cdk.stringToCloudFormation(properties.automationTargetParameterName),
CalendarNames: cdk.listMapper(cdk.stringToCloudFormation)(properties.calendarNames),
ComplianceSeverity: cdk.stringToCloudFormation(properties.complianceSeverity),
DocumentVersion: cdk.stringToCloudFormation(properties.documentVersion),
InstanceId: cdk.stringToCloudFormation(properties.instanceId),
MaxConcurrency: cdk.stringToCloudFormation(properties.maxConcurrency),
MaxErrors: cdk.stringToCloudFormation(properties.maxErrors),
OutputLocation: cfnAssociationInstanceAssociationOutputLocationPropertyToCloudFormation(properties.outputLocation),
Parameters: cdk.objectToCloudFormation(properties.parameters),
ScheduleExpression: cdk.stringToCloudFormation(properties.scheduleExpression),
ScheduleOffset: cdk.numberToCloudFormation(properties.scheduleOffset),
SyncCompliance: cdk.stringToCloudFormation(properties.syncCompliance),
Targets: cdk.listMapper(cfnAssociationTargetPropertyToCloudFormation)(properties.targets),
WaitForSuccessTimeoutSeconds: cdk.numberToCloudFormation(properties.waitForSuccessTimeoutSeconds),
};
}
// @ts-ignore TS6133
function CfnAssociationPropsFromCloudFormation(properties) {
properties = properties == null ? {} : properties;
if (typeof properties !== 'object') {
return new cfn_parse.FromCloudFormationResult(properties);
}
const ret = new cfn_parse.FromCloudFormationPropertyObject();
ret.addPropertyResult('name', 'Name', cfn_parse.FromCloudFormation.getString(properties.Name));
ret.addPropertyResult('applyOnlyAtCronInterval', 'ApplyOnlyAtCronInterval', properties.ApplyOnlyAtCronInterval != null ? cfn_parse.FromCloudFormation.getBoolean(properties.ApplyOnlyAtCronInterval) : undefined);
ret.addPropertyResult('associationName', 'AssociationName', properties.AssociationName != null ? cfn_parse.FromCloudFormation.getString(properties.AssociationName) : undefined);
ret.addPropertyResult('automationTargetParameterName', 'AutomationTargetParameterName', properties.AutomationTargetParameterName != null ? cfn_parse.FromCloudFormation.getString(properties.AutomationTargetParameterName) : undefined);
ret.addPropertyResult('calendarNames', 'CalendarNames', properties.CalendarNames != null ? cfn_parse.FromCloudFormation.getStringArray(properties.CalendarNames) : undefined);
ret.addPropertyResult('complianceSeverity', 'ComplianceSeverity', properties.ComplianceSeverity != null ? cfn_parse.FromCloudFormation.getString(properties.ComplianceSeverity) : undefined);
ret.addPropertyResult('documentVersion', 'DocumentVersion', properties.DocumentVersion != null ? cfn_parse.FromCloudFormation.getString(properties.DocumentVersion) : undefined);
ret.addPropertyResult('instanceId', 'InstanceId', properties.InstanceId != null ? cfn_parse.FromCloudFormation.getString(properties.InstanceId) : undefined);
ret.addPropertyResult('maxConcurrency', 'MaxConcurrency', properties.MaxConcurrency != null ? cfn_parse.FromCloudFormation.getString(properties.MaxConcurrency) : undefined);
ret.addPropertyResult('maxErrors', 'MaxErrors', properties.MaxErrors != null ? cfn_parse.FromCloudFormation.getString(properties.MaxErrors) : undefined);
ret.addPropertyResult('outputLocation', 'OutputLocation', properties.OutputLocation != null ? CfnAssociationInstanceAssociationOutputLocationPropertyFromCloudFormation(properties.OutputLocation) : undefined);
ret.addPropertyResult('parameters', 'Parameters', properties.Parameters != null ? cfn_parse.FromCloudFormation.getAny(properties.Parameters) : undefined);
ret.addPropertyResult('scheduleExpression', 'ScheduleExpression', properties.ScheduleExpression != null ? cfn_parse.FromCloudFormation.getString(properties.ScheduleExpression) : undefined);
ret.addPropertyResult('scheduleOffset', 'ScheduleOffset', properties.ScheduleOffset != null ? cfn_parse.FromCloudFormation.getNumber(properties.ScheduleOffset) : undefined);
ret.addPropertyResult('syncCompliance', 'SyncCompliance', properties.SyncCompliance != null ? cfn_parse.FromCloudFormation.getString(properties.SyncCompliance) : undefined);
ret.addPropertyResult('targets', 'Targets', properties.Targets != null ? cfn_parse.FromCloudFormation.getArray(CfnAssociationTargetPropertyFromCloudFormation)(properties.Targets) : undefined);
ret.addPropertyResult('waitForSuccessTimeoutSeconds', 'WaitForSuccessTimeoutSeconds', properties.WaitForSuccessTimeoutSeconds != null ? cfn_parse.FromCloudFormation.getNumber(properties.WaitForSuccessTimeoutSeconds) : undefined);
ret.addUnrecognizedPropertiesAsExtra(properties);
return ret;
}
/**
* A CloudFormation `AWS::SSM::Association`
*
* The `AWS::SSM::Association` resource creates a State Manager association for your managed instances. A State Manager association defines the state that you want to maintain on your instances. For example, an association can specify that anti-virus software must be installed and running on your instances, or that certain ports must be closed. For static targets, the association specifies a schedule for when the configuration is reapplied. For dynamic targets, such as an AWS Resource Groups or an AWS Auto Scaling Group, State Manager applies the configuration when new instances are added to the group. The association also specifies actions to take when applying the configuration. For example, an association for anti-virus software might run once a day. If the software is not installed, then State Manager installs it. If the software is installed, but the service is not running, then the association might instruct State Manager to start the service.
*
* @cloudformationResource AWS::SSM::Association
* @stability external
*
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-association.html
*/
class CfnAssociation extends cdk.CfnResource {
/**
* Create a new `AWS::SSM::Association`.
*
* @param scope - scope in which this resource is defined
* @param id - scoped id of the resource
* @param props - resource properties
*/
constructor(scope, id, props) {
super(scope, id, { type: CfnAssociation.CFN_RESOURCE_TYPE_NAME, properties: props });
try {
jsiiDeprecationWarnings._aws_cdk_aws_ssm_CfnAssociationProps(props);
}
catch (error) {
if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
Error.captureStackTrace(error, CfnAssociation);
}
throw error;
}
cdk.requireProperty(props, 'name', this);
this.attrAssociationId = cdk.Token.asString(this.getAtt('AssociationId'));
this.name = props.name;
this.applyOnlyAtCronInterval = props.applyOnlyAtCronInterval;
this.associationName = props.associationName;
this.automationTargetParameterName = props.automationTargetParameterName;
this.calendarNames = props.calendarNames;
this.complianceSeverity = props.complianceSeverity;
this.documentVersion = props.documentVersion;
this.instanceId = props.instanceId;
this.maxConcurrency = props.maxConcurrency;
this.maxErrors = props.maxErrors;
this.outputLocation = props.outputLocation;
this.parameters = props.parameters;
this.scheduleExpression = props.scheduleExpression;
this.scheduleOffset = props.scheduleOffset;
this.syncCompliance = props.syncCompliance;
this.targets = props.targets;
this.waitForSuccessTimeoutSeconds = props.waitForSuccessTimeoutSeconds;
}
/**
* A factory method that creates a new instance of this class from an object
* containing the CloudFormation properties of this resource.
* Used in the @aws-cdk/cloudformation-include module.
*
* @internal
*/
static _fromCloudFormation(scope, id, resourceAttributes, options) {
resourceAttributes = resourceAttributes || {};
const resourceProperties = options.parser.parseValue(resourceAttributes.Properties);
const propsResult = CfnAssociationPropsFromCloudFormation(resourceProperties);
const ret = new CfnAssociation(scope, id, propsResult.value);
for (const [propKey, propVal] of Object.entries(propsResult.extraProperties)) {
ret.addPropertyOverride(propKey, propVal);
}
options.parser.handleAttributes(ret, resourceAttributes, id);
return ret;
}
/**
* Examines the CloudFormation resource and discloses attributes.
*
* @param inspector - tree inspector to collect and process attributes
*
*/
inspect(inspector) {
inspector.addAttribute("aws:cdk:cloudformation:type", CfnAssociation.CFN_RESOURCE_TYPE_NAME);
inspector.addAttribute("aws:cdk:cloudformation:props", this.cfnProperties);
}
get cfnProperties() {
return {
name: this.name,
applyOnlyAtCronInterval: this.applyOnlyAtCronInterval,
associationName: this.associationName,
automationTargetParameterName: this.automationTargetParameterName,
calendarNames: this.calendarNames,
complianceSeverity: this.complianceSeverity,
documentVersion: this.documentVersion,
instanceId: this.instanceId,
maxConcurrency: this.maxConcurrency,
maxErrors: this.maxErrors,
outputLocation: this.outputLocation,
parameters: this.parameters,
scheduleExpression: this.scheduleExpression,
scheduleOffset: this.scheduleOffset,
syncCompliance: this.syncCompliance,
targets: this.targets,
waitForSuccessTimeoutSeconds: this.waitForSuccessTimeoutSeconds,
};
}
renderProperties(props) {
return cfnAssociationPropsToCloudFormation(props);
}
}
exports.CfnAssociation = CfnAssociation;
_a = JSII_RTTI_SYMBOL_1;
CfnAssociation[_a] = { fqn: "@aws-cdk/aws-ssm.CfnAssociation", version: "1.204.0" };
/**
* The CloudFormation resource type name for this resource class.
*/
CfnAssociation.CFN_RESOURCE_TYPE_NAME = "AWS::SSM::Association";
/**
* Determine whether the given properties match those of a `InstanceAssociationOutputLocationProperty`
*
* @param properties - the TypeScript properties of a `InstanceAssociationOutputLocationProperty`
*
* @returns the result of the validation.
*/
function CfnAssociation_InstanceAssociationOutputLocationPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));
}
errors.collect(cdk.propertyValidator('s3Location', CfnAssociation_S3OutputLocationPropertyValidator)(properties.s3Location));
return errors.wrap('supplied properties not correct for "InstanceAssociationOutputLocationProperty"');
}
/**
* Renders the AWS CloudFormation properties of an `AWS::SSM::Association.InstanceAssociationOutputLocation` resource
*
* @param properties - the TypeScript properties of a `InstanceAssociationOutputLocationProperty`
*
* @returns the AWS CloudFormation properties of an `AWS::SSM::Association.InstanceAssociationOutputLocation` resource.
*/
// @ts-ignore TS6133
function cfnAssociationInstanceAssociationOutputLocationPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnAssociation_InstanceAssociationOutputLocationPropertyValidator(properties).assertSuccess();
return {
S3Location: cfnAssociationS3OutputLocationPropertyToCloudFormation(properties.s3Location),
};
}
// @ts-ignore TS6133
function CfnAssociationInstanceAssociationOutputLocationPropertyFromCloudFormation(properties) {
if (cdk.isResolvableObject(properties)) {
return new cfn_parse.FromCloudFormationResult(properties);
}
properties = properties == null ? {} : properties;
if (typeof properties !== 'object') {
return new cfn_parse.FromCloudFormationResult(properties);
}
const ret = new cfn_parse.FromCloudFormationPropertyObject();
ret.addPropertyResult('s3Location', 'S3Location', properties.S3Location != null ? CfnAssociationS3OutputLocationPropertyFromCloudFormation(properties.S3Location) : undefined);
ret.addUnrecognizedPropertiesAsExtra(properties);
return ret;
}
/**
* Determine whether the given properties match those of a `S3OutputLocationProperty`
*
* @param properties - the TypeScript properties of a `S3OutputLocationProperty`
*
* @returns the result of the validation.
*/
function CfnAssociation_S3OutputLocationPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));
}
errors.collect(cdk.propertyValidator('outputS3BucketName', cdk.validateString)(properties.outputS3BucketName));
errors.collect(cdk.propertyValidator('outputS3KeyPrefix', cdk.validateString)(properties.outputS3KeyPrefix));
errors.collect(cdk.propertyValidator('outputS3Region', cdk.validateString)(properties.outputS3Region));
return errors.wrap('supplied properties not correct for "S3OutputLocationProperty"');
}
/**
* Renders the AWS CloudFormation properties of an `AWS::SSM::Association.S3OutputLocation` resource
*
* @param properties - the TypeScript properties of a `S3OutputLocationProperty`
*
* @returns the AWS CloudFormation properties of an `AWS::SSM::Association.S3OutputLocation` resource.
*/
// @ts-ignore TS6133
function cfnAssociationS3OutputLocationPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnAssociation_S3OutputLocationPropertyValidator(properties).assertSuccess();
return {
OutputS3BucketName: cdk.stringToCloudFormation(properties.outputS3BucketName),
OutputS3KeyPrefix: cdk.stringToCloudFormation(properties.outputS3KeyPrefix),
OutputS3Region: cdk.stringToCloudFormation(properties.outputS3Region),
};
}
// @ts-ignore TS6133
function CfnAssociationS3OutputLocationPropertyFromCloudFormation(properties) {
if (cdk.isResolvableObject(properties)) {
return new cfn_parse.FromCloudFormationResult(properties);
}
properties = properties == null ? {} : properties;
if (typeof properties !== 'object') {
return new cfn_parse.FromCloudFormationResult(properties);
}
const ret = new cfn_parse.FromCloudFormationPropertyObject();
ret.addPropertyResult('outputS3BucketName', 'OutputS3BucketName', properties.OutputS3BucketName != null ? cfn_parse.FromCloudFormation.getString(properties.OutputS3BucketName) : undefined);
ret.addPropertyResult('outputS3KeyPrefix', 'OutputS3KeyPrefix', properties.OutputS3KeyPrefix != null ? cfn_parse.FromCloudFormation.getString(properties.OutputS3KeyPrefix) : undefined);
ret.addPropertyResult('outputS3Region', 'OutputS3Region', properties.OutputS3Region != null ? cfn_parse.FromCloudFormation.getString(properties.OutputS3Region) : undefined);
ret.addUnrecognizedPropertiesAsExtra(properties);
return ret;
}
/**
* Determine whether the given properties match those of a `TargetProperty`
*
* @param properties - the TypeScript properties of a `TargetProperty`
*
* @returns the result of the validation.
*/
function CfnAssociation_TargetPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));
}
errors.collect(cdk.propertyValidator('key', cdk.requiredValidator)(properties.key));
errors.collect(cdk.propertyValidator('key', cdk.validateString)(properties.key));
errors.collect(cdk.propertyValidator('values', cdk.requiredValidator)(properties.values));
errors.collect(cdk.propertyValidator('values', cdk.listValidator(cdk.validateString))(properties.values));
return errors.wrap('supplied properties not correct for "TargetProperty"');
}
/**
* Renders the AWS CloudFormation properties of an `AWS::SSM::Association.Target` resource
*
* @param properties - the TypeScript properties of a `TargetProperty`
*
* @returns the AWS CloudFormation properties of an `AWS::SSM::Association.Target` resource.
*/
// @ts-ignore TS6133
function cfnAssociationTargetPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnAssociation_TargetPropertyValidator(properties).assertSuccess();
return {
Key: cdk.stringToCloudFormation(properties.key),
Values: cdk.listMapper(cdk.stringToCloudFormation)(properties.values),
};
}
// @ts-ignore TS6133
function CfnAssociationTargetPropertyFromCloudFormation(properties) {
if (cdk.isResolvableObject(properties)) {
return new cfn_parse.FromCloudFormationResult(properties);
}
properties = properties == null ? {} : properties;
if (typeof properties !== 'object') {
return new cfn_parse.FromCloudFormationResult(properties);
}
const ret = new cfn_parse.FromCloudFormationPropertyObject();
ret.addPropertyResult('key', 'Key', cfn_parse.FromCloudFormation.getString(properties.Key));
ret.addPropertyResult('values', 'Values', cfn_parse.FromCloudFormation.getStringArray(properties.Values));
ret.addUnrecognizedPropertiesAsExtra(properties);
return ret;
}
/**
* Determine whether the given properties match those of a `CfnDocumentProps`
*
* @param properties - the TypeScript properties of a `CfnDocumentProps`
*
* @returns the result of the validation.
*/
function CfnDocumentPropsValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));
}
errors.collect(cdk.propertyValidator('attachments', cdk.listValidator(CfnDocument_AttachmentsSourcePropertyValidator))(properties.attachments));
errors.collect(cdk.propertyValidator('content', cdk.requiredValidator)(properties.content));
errors.collect(cdk.propertyValidator('content', cdk.validateObject)(properties.content));
errors.collect(cdk.propertyValidator('documentFormat', cdk.validateString)(properties.documentFormat));
errors.collect(cdk.propertyValidator('documentType', cdk.validateString)(properties.documentType));
errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name));
errors.collect(cdk.propertyValidator('requires', cdk.listValidator(CfnDocument_DocumentRequiresPropertyValidator))(properties.requires));
errors.collect(cdk.propertyValidator('tags', cdk.listValidator(cdk.validateCfnTag))(properties.tags));
errors.collect(cdk.propertyValidator('targetType', cdk.validateString)(properties.targetType));
errors.collect(cdk.propertyValidator('updateMethod', cdk.validateString)(properties.updateMethod));
errors.collect(cdk.propertyValidator('versionName', cdk.validateString)(properties.versionName));
return errors.wrap('supplied properties not correct for "CfnDocumentProps"');
}
/**
* Renders the AWS CloudFormation properties of an `AWS::SSM::Document` resource
*
* @param properties - the TypeScript properties of a `CfnDocumentProps`
*
* @returns the AWS CloudFormation properties of an `AWS::SSM::Document` resource.
*/
// @ts-ignore TS6133
function cfnDocumentPropsToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnDocumentPropsValidator(properties).assertSuccess();
return {
Content: cdk.objectToCloudFormation(properties.content),
Attachments: cdk.listMapper(cfnDocumentAttachmentsSourcePropertyToCloudFormation)(properties.attachments),
DocumentFormat: cdk.stringToCloudFormation(properties.documentFormat),
DocumentType: cdk.stringToCloudFormation(properties.documentType),
Name: cdk.stringToCloudFormation(properties.name),
Requires: cdk.listMapper(cfnDocumentDocumentRequiresPropertyToCloudFormation)(properties.requires),
Tags: cdk.listMapper(cdk.cfnTagToCloudFormation)(properties.tags),
TargetType: cdk.stringToCloudFormation(properties.targetType),
UpdateMethod: cdk.stringToCloudFormation(properties.updateMethod),
VersionName: cdk.stringToCloudFormation(properties.versionName),
};
}
// @ts-ignore TS6133
function CfnDocumentPropsFromCloudFormation(properties) {
properties = properties == null ? {} : properties;
if (typeof properties !== 'object') {
return new cfn_parse.FromCloudFormationResult(properties);
}
const ret = new cfn_parse.FromCloudFormationPropertyObject();
ret.addPropertyResult('content', 'Content', cfn_parse.FromCloudFormation.getAny(properties.Content));
ret.addPropertyResult('attachments', 'Attachments', properties.Attachments != null ? cfn_parse.FromCloudFormation.getArray(CfnDocumentAttachmentsSourcePropertyFromCloudFormation)(properties.Attachments) : undefined);
ret.addPropertyResult('documentFormat', 'DocumentFormat', properties.DocumentFormat != null ? cfn_parse.FromCloudFormation.getString(properties.DocumentFormat) : undefined);
ret.addPropertyResult('documentType', 'DocumentType', properties.DocumentType != null ? cfn_parse.FromCloudFormation.getString(properties.DocumentType) : undefined);
ret.addPropertyResult('name', 'Name', properties.Name != null ? cfn_parse.FromCloudFormation.getString(properties.Name) : undefined);
ret.addPropertyResult('requires', 'Requires', properties.Requires != null ? cfn_parse.FromCloudFormation.getArray(CfnDocumentDocumentRequiresPropertyFromCloudFormation)(properties.Requires) : undefined);
ret.addPropertyResult('tags', 'Tags', properties.Tags != null ? cfn_parse.FromCloudFormation.getArray(cfn_parse.FromCloudFormation.getCfnTag)(properties.Tags) : undefined);
ret.addPropertyResult('targetType', 'TargetType', properties.TargetType != null ? cfn_parse.FromCloudFormation.getString(properties.TargetType) : undefined);
ret.addPropertyResult('updateMethod', 'UpdateMethod', properties.UpdateMethod != null ? cfn_parse.FromCloudFormation.getString(properties.UpdateMethod) : undefined);
ret.addPropertyResult('versionName', 'VersionName', properties.VersionName != null ? cfn_parse.FromCloudFormation.getString(properties.VersionName) : undefined);
ret.addUnrecognizedPropertiesAsExtra(properties);
return ret;
}
/**
* A CloudFormation `AWS::SSM::Document`
*
* The `AWS::SSM::Document` resource creates a Systems Manager (SSM) document in AWS Systems Manager . This document defines the actions that Systems Manager performs on your AWS resources.
*
* > This resource does not support CloudFormation drift detection.
*
* @cloudformationResource AWS::SSM::Document
* @stability external
*
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-document.html
*/
class CfnDocument extends cdk.CfnResource {
/**
* Create a new `AWS::SSM::Document`.
*
* @param scope - scope in which this resource is defined
* @param id - scoped id of the resource
* @param props - resource properties
*/
constructor(scope, id, props) {
super(scope, id, { type: CfnDocument.CFN_RESOURCE_TYPE_NAME, properties: props });
try {
jsiiDeprecationWarnings._aws_cdk_aws_ssm_CfnDocumentProps(props);
}
catch (error) {
if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
Error.captureStackTrace(error, CfnDocument);
}
throw error;
}
cdk.requireProperty(props, 'content', this);
this.content = props.content;
this.attachments = props.attachments;
this.documentFormat = props.documentFormat;
this.documentType = props.documentType;
this.name = props.name;
this.requires = props.requires;
this.tags = new cdk.TagManager(cdk.TagType.STANDARD, "AWS::SSM::Document", props.tags, { tagPropertyName: 'tags' });
this.targetType = props.targetType;
this.updateMethod = props.updateMethod;
this.versionName = props.versionName;
}
/**
* A factory method that creates a new instance of this class from an object
* containing the CloudFormation properties of this resource.
* Used in the @aws-cdk/cloudformation-include module.
*
* @internal
*/
static _fromCloudFormation(scope, id, resourceAttributes, options) {
resourceAttributes = resourceAttributes || {};
const resourceProperties = options.parser.parseValue(resourceAttributes.Properties);
const propsResult = CfnDocumentPropsFromCloudFormation(resourceProperties);
const ret = new CfnDocument(scope, id, propsResult.value);
for (const [propKey, propVal] of Object.entries(propsResult.extraProperties)) {
ret.addPropertyOverride(propKey, propVal);
}
options.parser.handleAttributes(ret, resourceAttributes, id);
return ret;
}
/**
* Examines the CloudFormation resource and discloses attributes.
*
* @param inspector - tree inspector to collect and process attributes
*
*/
inspect(inspector) {
inspector.addAttribute("aws:cdk:cloudformation:type", CfnDocument.CFN_RESOURCE_TYPE_NAME);
inspector.addAttribute("aws:cdk:cloudformation:props", this.cfnProperties);
}
get cfnProperties() {
return {
content: this.content,
attachments: this.attachments,
documentFormat: this.documentFormat,
documentType: this.documentType,
name: this.name,
requires: this.requires,
tags: this.tags.renderTags(),
targetType: this.targetType,
updateMethod: this.updateMethod,
versionName: this.versionName,
};
}
renderProperties(props) {
return cfnDocumentPropsToCloudFormation(props);
}
}
exports.CfnDocument = CfnDocument;
_b = JSII_RTTI_SYMBOL_1;
CfnDocument[_b] = { fqn: "@aws-cdk/aws-ssm.CfnDocument", version: "1.204.0" };
/**
* The CloudFormation resource type name for this resource class.
*/
CfnDocument.CFN_RESOURCE_TYPE_NAME = "AWS::SSM::Document";
/**
* Determine whether the given properties match those of a `AttachmentsSourceProperty`
*
* @param properties - the TypeScript properties of a `AttachmentsSourceProperty`
*
* @returns the result of the validation.
*/
function CfnDocument_AttachmentsSourcePropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));
}
errors.collect(cdk.propertyValidator('key', cdk.validateString)(properties.key));
errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name));
errors.collect(cdk.propertyValidator('values', cdk.listValidator(cdk.validateString))(properties.values));
return errors.wrap('supplied properties not correct for "AttachmentsSourceProperty"');
}
/**
* Renders the AWS CloudFormation properties of an `AWS::SSM::Document.AttachmentsSource` resource
*
* @param properties - the TypeScript properties of a `AttachmentsSourceProperty`
*
* @returns the AWS CloudFormation properties of an `AWS::SSM::Document.AttachmentsSource` resource.
*/
// @ts-ignore TS6133
function cfnDocumentAttachmentsSourcePropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnDocument_AttachmentsSourcePropertyValidator(properties).assertSuccess();
return {
Key: cdk.stringToCloudFormation(properties.key),
Name: cdk.stringToCloudFormation(properties.name),
Values: cdk.listMapper(cdk.stringToCloudFormation)(properties.values),
};
}
// @ts-ignore TS6133
function CfnDocumentAttachmentsSourcePropertyFromCloudFormation(properties) {
if (cdk.isResolvableObject(properties)) {
return new cfn_parse.FromCloudFormationResult(properties);
}
properties = properties == null ? {} : properties;
if (typeof properties !== 'object') {
return new cfn_parse.FromCloudFormationResult(properties);
}
const ret = new cfn_parse.FromCloudFormationPropertyObject();
ret.addPropertyResult('key', 'Key', properties.Key != null ? cfn_parse.FromCloudFormation.getString(properties.Key) : undefined);
ret.addPropertyResult('name', 'Name', properties.Name != null ? cfn_parse.FromCloudFormation.getString(properties.Name) : undefined);
ret.addPropertyResult('values', 'Values', properties.Values != null ? cfn_parse.FromCloudFormation.getStringArray(properties.Values) : undefined);
ret.addUnrecognizedPropertiesAsExtra(properties);
return ret;
}
/**
* Determine whether the given properties match those of a `DocumentRequiresProperty`
*
* @param properties - the TypeScript properties of a `DocumentRequiresProperty`
*
* @returns the result of the validation.
*/
function CfnDocument_DocumentRequiresPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));
}
errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name));
errors.collect(cdk.propertyValidator('version', cdk.validateString)(properties.version));
return errors.wrap('supplied properties not correct for "DocumentRequiresProperty"');
}
/**
* Renders the AWS CloudFormation properties of an `AWS::SSM::Document.DocumentRequires` resource
*
* @param properties - the TypeScript properties of a `DocumentRequiresProperty`
*
* @returns the AWS CloudFormation properties of an `AWS::SSM::Document.DocumentRequires` resource.
*/
// @ts-ignore TS6133
function cfnDocumentDocumentRequiresPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnDocument_DocumentRequiresPropertyValidator(properties).assertSuccess();
return {
Name: cdk.stringToCloudFormation(properties.name),
Version: cdk.stringToCloudFormation(properties.version),
};
}
// @ts-ignore TS6133
function CfnDocumentDocumentRequiresPropertyFromCloudFormation(properties) {
if (cdk.isResolvableObject(properties)) {
return new cfn_parse.FromCloudFormationResult(properties);
}
properties = properties == null ? {} : properties;
if (typeof properties !== 'object') {
return new cfn_parse.FromCloudFormationResult(properties);
}
const ret = new cfn_parse.FromCloudFormationPropertyObject();
ret.addPropertyResult('name', 'Name', properties.Name != null ? cfn_parse.FromCloudFormation.getString(properties.Name) : undefined);
ret.addPropertyResult('version', 'Version', properties.Version != null ? cfn_parse.FromCloudFormation.getString(properties.Version) : undefined);
ret.addUnrecognizedPropertiesAsExtra(properties);
return ret;
}
/**
* Determine whether the given properties match those of a `CfnMaintenanceWindowProps`
*
* @param properties - the TypeScript properties of a `CfnMaintenanceWindowProps`
*
* @returns the result of the validation.
*/
function CfnMaintenanceWindowPropsValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));
}
errors.collect(cdk.propertyValidator('allowUnassociatedTargets', cdk.requiredValidator)(properties.allowUnassociatedTargets));
errors.collect(cdk.propertyValidator('allowUnassociatedTargets', cdk.validateBoolean)(properties.allowUnassociatedTargets));
errors.collect(cdk.propertyValidator('cutoff', cdk.requiredValidator)(properties.cutoff));
errors.collect(cdk.propertyValidator('cutoff', cdk.validateNumber)(properties.cutoff));
errors.collect(cdk.propertyValidator('description', cdk.validateString)(properties.description));
errors.collect(cdk.propertyValidator('duration', cdk.requiredValidator)(properties.duration));
errors.collect(cdk.propertyValidator('duration', cdk.validateNumber)(properties.duration));
errors.collect(cdk.propertyValidator('endDate', cdk.validateString)(properties.endDate));
errors.collect(cdk.propertyValidator('name', cdk.requiredValidator)(properties.name));
errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name));
errors.collect(cdk.propertyValidator('schedule', cdk.requiredValidator)(properties.schedule));
errors.collect(cdk.propertyValidator('schedule', cdk.validateString)(properties.schedule));
errors.collect(cdk.propertyValidator('scheduleOffset', cdk.validateNumber)(properties.scheduleOffset));
errors.collect(cdk.propertyValidator('scheduleTimezone', cdk.validateString)(properties.scheduleTimezone));
errors.collect(cdk.propertyValidator('startDate', cdk.validateString)(properties.startDate));
errors.collect(cdk.propertyValidator('tags', cdk.listValidator(cdk.validateCfnTag))(properties.tags));
return errors.wrap('supplied properties not correct for "CfnMaintenanceWindowProps"');
}
/**
* Renders the AWS CloudFormation properties of an `AWS::SSM::MaintenanceWindow` resource
*
* @param properties - the TypeScript properties of a `CfnMaintenanceWindowProps`
*
* @returns the AWS CloudFormation properties of an `AWS::SSM::MaintenanceWindow` resource.
*/
// @ts-ignore TS6133
function cfnMaintenanceWindowPropsToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnMaintenanceWindowPropsValidator(properties).assertSuccess();
return {
AllowUnassociatedTargets: cdk.booleanToCloudFormation(properties.allowUnassociatedTargets),
Cutoff: cdk.numberToCloudFormation(properties.cutoff),
Duration: cdk.numberToCloudFormation(properties.duration),
Name: cdk.stringToCloudFormation(properties.name),
Schedule: cdk.stringToCloudFormation(properties.schedule),
Description: cdk.stringToCloudFormation(properties.description),
EndDate: cdk.stringToCloudFormation(properties.endDate),
ScheduleOffset: cdk.numberToCloudFormation(properties.scheduleOffset),
ScheduleTimezone: cdk.stringToCloudFormation(properties.scheduleTimezone),
StartDate: cdk.stringToCloudFormation(properties.startDate),
Tags: cdk.listMapper(cdk.cfnTagToCloudFormation)(properties.tags),
};
}
// @ts-ignore TS6133
function CfnMaintenanceWindowPropsFromCloudFormation(properties) {
properties = properties == null ? {} : properties;
if (typeof properties !== 'object') {
return new cfn_parse.FromCloudFormationResult(properties);
}
const ret = new cfn_parse.FromCloudFormationPropertyObject();
ret.addPropertyResult('allowUnassociatedTargets', 'AllowUnassociatedTargets', cfn_parse.FromCloudFormation.getBoolean(properties.AllowUnassociatedTargets));
ret.addPropertyResult('cutoff', 'Cutoff', cfn_parse.FromCloudFormation.getNumber(properties.Cutoff));
ret.addPropertyResult('duration', 'Duration', cfn_parse.FromCloudFormation.getNumber(properties.Duration));
ret.addPropertyResult('name', 'Name', cfn_parse.FromCloudFormation.getString(properties.Name));
ret.addPropertyResult('schedule', 'Schedule', cfn_parse.FromCloudFormation.getString(properties.Schedule));
ret.addPropertyResult('description', 'Description', properties.Description != null ? cfn_parse.FromCloudFormation.getString(properties.Description) : undefined);
ret.addPropertyResult('endDate', 'EndDate', properties.EndDate != null ? cfn_parse.FromCloudFormation.getString(properties.EndDate) : undefined);
ret.addPropertyResult('scheduleOffset', 'ScheduleOffset', properties.ScheduleOffset != null ? cfn_parse.FromCloudFormation.getNumber(properties.ScheduleOffset) : undefined);
ret.addPropertyResult('scheduleTimezone', 'ScheduleTimezone', properties.ScheduleTimezone != null ? cfn_parse.FromCloudFormation.getString(properties.ScheduleTimezone) : undefined);
ret.addPropertyResult('startDate', 'StartDate', properties.StartDate != null ? cfn_parse.FromCloudFormation.getString(properties.StartDate) : undefined);
ret.addPropertyResult('tags', 'Tags', properties.Tags != null ? cfn_parse.FromCloudFormation.getArray(cfn_parse.FromCloudFormation.getCfnTag)(properties.Tags) : undefined);
ret.addUnrecognizedPropertiesAsExtra(properties);
return ret;
}
/**
* A CloudFormation `AWS::SSM::MaintenanceWindow`
*
* The `AWS::SSM::MaintenanceWindow` resource represents general information about a maintenance window for AWS Systems Manager . Maintenance Windows let you define a schedule for when to perform potentially disruptive actions on your instances, such as patching an operating system (OS), updating drivers, or installing software. Each maintenance window has a schedule, a duration, a set of registered targets, and a set of registered tasks.
*
* For more information, see [Systems Manager Maintenance Windows](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-maintenance.html) in the *AWS Systems Manager User Guide* and [CreateMaintenanceWindow](https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_CreateMaintenanceWindow.html) in the *AWS Systems Manager API Reference* .
*
* @cloudformationResource AWS::SSM::MaintenanceWindow
* @stability external
*
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-maintenancewindow.html
*/
class CfnMaintenanceWindow extends cdk.CfnResource {
/**
* Create a new `AWS::SSM::MaintenanceWindow`.
*
* @param scope - scope in which this resource is defined
* @param id - scoped id of the resource
* @param props - resource properties
*/
constructor(scope, id, props) {
super(scope, id, { type: CfnMaintenanceWindow.CFN_RESOURCE_TYPE_NAME, properties: props });
try {
jsiiDeprecationWarnings._aws_cdk_aws_ssm_CfnMaintenanceWindowProps(props);
}
catch (error) {
if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
Error.captureStackTrace(error, CfnMaintenanceWindow);
}
throw error;
}
cdk.requireProperty(props, 'allowUnassociatedTargets', this);
cdk.requireProperty(props, 'cutoff', this);
cdk.requireProperty(props, 'duration', this);
cdk.requireProperty(props, 'name', this);
cdk.requireProperty(props, 'schedule', this);
this.allowUnassociatedTargets = props.allowUnassociatedTargets;
this.cutoff = props.cutoff;
this.duration = props.duration;
this.name = props.name;
this.schedule = props.schedule;
this.description = props.description;
this.endDate = props.endDate;
this.scheduleOffset = props.scheduleOffset;
this.scheduleTimezone = props.scheduleTimezone;
this.startDate = props.startDate;
this.tags = new cdk.TagManager(cdk.TagType.STANDARD, "AWS::SSM::MaintenanceWindow", props.tags, { tagPropertyName: 'tags' });
}
/**
* A factory method that creates a new instance of this class from an object
* containing the CloudFormation properties of this resource.
* Used in the @aws-cdk/cloudformation-include module.
*
* @internal
*/
static _fromCloudFormation(scope, id, resourceAttributes, options) {
resourceAttributes = resourceAttributes || {};
const resourceProperties = options.parser.parseValue(resourceAttributes.Properties);
const propsResult = CfnMaintenanceWindowPropsFromCloudFormation(resourceProperties);
const ret = new CfnMaintenanceWindow(scope, id, propsResult.value);
for (const [propKey, propVal] of Object.entries(propsResult.extraProperties)) {
ret.addPropertyOverride(propKey, propVal);
}
options.parser.handleAttributes(ret, resourceAttributes, id);
return ret;
}
/**
* Examines the CloudFormation resource and discloses attributes.
*
* @param inspector - tree inspector to collect and process attributes
*
*/
inspect(inspector) {
inspector.addAttribute("aws:cdk:cloudformation:type", CfnMaintenanceWindow.CFN_RESOURCE_TYPE_NAME);
inspector.addAttribute("aws:cdk:cloudformation:props", this.cfnProperties);
}
get cfnProperties() {
return {
allowUnassociatedTargets: this.allowUnassociatedTargets,
cutoff: this.cutoff,
duration: this.duration,
name: this.name,
schedule: this.schedule,
description: this.description,
endDate: this.endDate,
scheduleOffset: this.scheduleOffset,
scheduleTimezone: this.scheduleTimezone,
startDate: this.startDate,
tags: this.tags.renderTags(),
};
}
renderProperties(props) {
return cfnMaintenanceWindowPropsToCloudFormation(props);
}
}
exports.CfnMaintenanceWindow = CfnMaintenanceWindow;
_c = JSII_RTTI_SYMBOL_1;
CfnMaintenanceWindow[_c] = { fqn: "@aws-cdk/aws-ssm.CfnMaintenanceWindow", version: "1.204.0" };
/**
* The CloudFormation resource type name for this resource class.
*/
CfnMaintenanceWindow.CFN_RESOURCE_TYPE_NAME = "AWS::SSM::MaintenanceWindow";
/**
* Determine whether the given properties match those of a `CfnMaintenanceWindowTargetProps`
*
* @param properties - the TypeScript properties of a `CfnMaintenanceWindowTargetProps`
*
* @returns the result of the validation.
*/
function CfnMaintenanceWindowTargetPropsValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));
}
errors.collect(cdk.propertyValidator('description', cdk.validateString)(properties.description));
errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name));
errors.collect(cdk.propertyValidator('ownerInformation', cdk.validateString)(properties.ownerInformation));
errors.collect(cdk.propertyValidator('resourceType', cdk.requiredValidator)(properties.resourceType));
errors.collect(cdk.propertyValidator('resourceType', cdk.validateString)(properties.resourceType));
errors.collect(cdk.propertyValidator('targets', cdk.requiredValidator)(properties.targets));
errors.collect(cdk.propertyValidator('targets', cdk.listValidator(CfnMaintenanceWindowTarget_TargetsPropertyValidator))(properties.targets));
errors.collect(cdk.propertyValidator('windowId', cdk.requiredValidator)(properties.windowId));
errors.collect(cdk.propertyValidator('windowId', cdk.validateString)(properties.windowId));
return errors.wrap('supplied properties not correct for "CfnMaintenanceWindowTargetProps"');
}
/**
* Renders the AWS CloudFormation properties of an `AWS::SSM::MaintenanceWindowTarget` resource
*
* @param properties - the TypeScript properties of a `CfnMaintenanceWindowTargetProps`
*
* @returns the AWS CloudFormation properties of an `AWS::SSM::MaintenanceWindowTarget` resource.
*/
// @ts-ignore TS6133
function cfnMaintenanceWindowTargetPropsToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnMaintenanceWindowTargetPropsValidator(properties).assertSuccess();
return {
ResourceType: cdk.stringToCloudFormation(properties.resourceType),
Targets: cdk.listMapper(cfnMaintenanceWindowTargetTargetsPropertyToCloudFormation)(properties.targets),
WindowId: cdk.stringToCloudFormation(properties.windowId),
Description: cdk.stringToCloudFormation(properties.description),
Name: cdk.stringToCloudFormation(properties.name),
OwnerInformation: cdk.stringToCloudFormation(properties.ownerInformation),
};
}
// @ts-ignore TS6133
function CfnMaintenanceWindowTargetPropsFromCloudFormation(properties)