aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 15.1 kB
JavaScript
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CfnRule=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var cdk=()=>{var tmp=require("../../core/lib");return cdk=()=>tmp,tmp},cfn_parse=()=>{var tmp=require("../../core/lib/helpers-internal");return cfn_parse=()=>tmp,tmp},cdk_errors=()=>{var tmp=require("../../core/lib/errors");return cdk_errors=()=>tmp,tmp};class CfnRule extends cdk().CfnResource{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_rbin.CfnRule",version:"2.251.0"};static CFN_RESOURCE_TYPE_NAME="AWS::Rbin::Rule";static _fromCloudFormation(scope,id,resourceAttributes,options){resourceAttributes=resourceAttributes||{};const resourceProperties=options.parser.parseValue(resourceAttributes.Properties),propsResult=CfnRulePropsFromCloudFormation(resourceProperties);if(cdk().isResolvableObject(propsResult.value))throw new(cdk_errors()).ValidationError(cfn_parse().lit`UnexpectedIResolvable`,"Unexpected IResolvable",scope);const ret=new CfnRule(scope,id,propsResult.value);for(const[propKey,propVal]of Object.entries(propsResult.extraProperties))ret.addPropertyOverride(propKey,propVal);return options.parser.handleAttributes(ret,resourceAttributes,id),ret}static isCfnRule(x){return cdk().CfnResource.isCfnResource(x)&&x.cfnResourceType===CfnRule.CFN_RESOURCE_TYPE_NAME}static arnForRule(resource){try{jsiiDeprecationWarnings().aws_cdk_lib_interfaces_aws_rbin_IRuleRef(resource)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.arnForRule),error}return resource.ruleRef.ruleArn}cdkTagManager;_description;_excludeResourceTags;_lockConfiguration;_resourceTags;_resourceType;_retentionPeriod;_status;_tags;constructor(scope,id,props){super(scope,id,{type:CfnRule.CFN_RESOURCE_TYPE_NAME,properties:props});try{jsiiDeprecationWarnings().aws_cdk_lib_aws_rbin_CfnRuleProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,CfnRule),error}cdk().requireProperty(props,"resourceType",this),cdk().requireProperty(props,"retentionPeriod",this),this.cdkTagManager=new(cdk()).TagManager(cdk().TagType.STANDARD,"AWS::Rbin::Rule",void 0,{tagPropertyName:"tags"}),this._description=props.description,this._excludeResourceTags=props.excludeResourceTags,this._lockConfiguration=props.lockConfiguration,this._resourceTags=props.resourceTags,this._resourceType=props.resourceType,this._retentionPeriod=props.retentionPeriod,this._status=props.status,this._tags=props.tags}get ruleRef(){return{ruleArn:this.ref}}get description(){return this._description}set description(value){cdk().traceProperty(this.node,"Description"),this._description=value}get excludeResourceTags(){return this._excludeResourceTags}set excludeResourceTags(value){cdk().traceProperty(this.node,"ExcludeResourceTags"),this._excludeResourceTags=value}get lockConfiguration(){return this._lockConfiguration}set lockConfiguration(value){cdk().traceProperty(this.node,"LockConfiguration"),this._lockConfiguration=value}get resourceTags(){return this._resourceTags}set resourceTags(value){cdk().traceProperty(this.node,"ResourceTags"),this._resourceTags=value}get resourceType(){return this._resourceType}set resourceType(value){cdk().traceProperty(this.node,"ResourceType"),this._resourceType=value}get retentionPeriod(){return this._retentionPeriod}set retentionPeriod(value){cdk().traceProperty(this.node,"RetentionPeriod"),this._retentionPeriod=value}get status(){return this._status}set status(value){cdk().traceProperty(this.node,"Status"),this._status=value}get tags(){return this._tags}set tags(value){cdk().traceProperty(this.node,"Tags"),this._tags=value}get attrArn(){return cdk().Token.asString(this.getAtt("Arn",cdk().ResolutionTypeHint.STRING))}get attrIdentifier(){return cdk().Token.asString(this.getAtt("Identifier",cdk().ResolutionTypeHint.STRING))}get attrLockState(){return cdk().Token.asString(this.getAtt("LockState",cdk().ResolutionTypeHint.STRING))}get cfnProperties(){return{tags:this.cdkTagManager.renderTags(this._tags),description:this._description,excludeResourceTags:this._excludeResourceTags,lockConfiguration:this._lockConfiguration,resourceTags:this._resourceTags,resourceType:this._resourceType,retentionPeriod:this._retentionPeriod,status:this._status}}inspect(inspector){try{jsiiDeprecationWarnings().aws_cdk_lib_TreeInspector(inspector)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.inspect),error}inspector.addAttribute("aws:cdk:cloudformation:type",CfnRule.CFN_RESOURCE_TYPE_NAME),inspector.addAttribute("aws:cdk:cloudformation:logicalId",this._synthesizeLogicalId()),inspector.addAttribute("aws:cdk:cloudformation:props",this.cfnProperties)}renderProperties(props){return convertCfnRulePropsToCloudFormation(props)}}exports.CfnRule=CfnRule;function CfnRuleResourceTagPropertyValidator(properties){if(!cdk().canInspect(properties))return cdk().VALIDATION_SUCCESS;const errors=new(cdk()).ValidationResults;return properties&&typeof properties=="object"&&!Array.isArray(properties)||errors.collect(new(cdk()).ValidationResult("Expected an object, but received: "+JSON.stringify(properties))),errors.collect(cdk().propertyValidator("resourceTagKey",cdk().requiredValidator)(properties.resourceTagKey)),errors.collect(cdk().propertyValidator("resourceTagKey",cdk().validateString)(properties.resourceTagKey)),errors.collect(cdk().propertyValidator("resourceTagValue",cdk().requiredValidator)(properties.resourceTagValue)),errors.collect(cdk().propertyValidator("resourceTagValue",cdk().validateString)(properties.resourceTagValue)),errors.wrap('supplied properties not correct for "ResourceTagProperty"')}function convertCfnRuleResourceTagPropertyToCloudFormation(properties){return cdk().canInspect(properties)?(CfnRuleResourceTagPropertyValidator(properties).assertSuccess(),{ResourceTagKey:cdk().stringToCloudFormation(properties.resourceTagKey),ResourceTagValue:cdk().stringToCloudFormation(properties.resourceTagValue)}):properties}function CfnRuleResourceTagPropertyFromCloudFormation(properties){if(cdk().isResolvableObject(properties))return new(cfn_parse()).FromCloudFormationResult(properties);if(properties=properties??{},!(properties&&typeof properties=="object"&&!Array.isArray(properties)))return new(cfn_parse()).FromCloudFormationResult(properties);const ret=new(cfn_parse()).FromCloudFormationPropertyObject;return ret.addPropertyResult("resourceTagKey","ResourceTagKey",properties.ResourceTagKey!=null?cfn_parse().FromCloudFormation.getString(properties.ResourceTagKey):void 0),ret.addPropertyResult("resourceTagValue","ResourceTagValue",properties.ResourceTagValue!=null?cfn_parse().FromCloudFormation.getString(properties.ResourceTagValue):void 0),ret.addUnrecognizedPropertiesAsExtra(properties),ret}function CfnRuleRetentionPeriodPropertyValidator(properties){if(!cdk().canInspect(properties))return cdk().VALIDATION_SUCCESS;const errors=new(cdk()).ValidationResults;return properties&&typeof properties=="object"&&!Array.isArray(properties)||errors.collect(new(cdk()).ValidationResult("Expected an object, but received: "+JSON.stringify(properties))),errors.collect(cdk().propertyValidator("retentionPeriodUnit",cdk().requiredValidator)(properties.retentionPeriodUnit)),errors.collect(cdk().propertyValidator("retentionPeriodUnit",cdk().validateString)(properties.retentionPeriodUnit)),errors.collect(cdk().propertyValidator("retentionPeriodValue",cdk().requiredValidator)(properties.retentionPeriodValue)),errors.collect(cdk().propertyValidator("retentionPeriodValue",cdk().validateNumber)(properties.retentionPeriodValue)),errors.wrap('supplied properties not correct for "RetentionPeriodProperty"')}function convertCfnRuleRetentionPeriodPropertyToCloudFormation(properties){return cdk().canInspect(properties)?(CfnRuleRetentionPeriodPropertyValidator(properties).assertSuccess(),{RetentionPeriodUnit:cdk().stringToCloudFormation(properties.retentionPeriodUnit),RetentionPeriodValue:cdk().numberToCloudFormation(properties.retentionPeriodValue)}):properties}function CfnRuleRetentionPeriodPropertyFromCloudFormation(properties){if(cdk().isResolvableObject(properties))return new(cfn_parse()).FromCloudFormationResult(properties);if(properties=properties??{},!(properties&&typeof properties=="object"&&!Array.isArray(properties)))return new(cfn_parse()).FromCloudFormationResult(properties);const ret=new(cfn_parse()).FromCloudFormationPropertyObject;return ret.addPropertyResult("retentionPeriodUnit","RetentionPeriodUnit",properties.RetentionPeriodUnit!=null?cfn_parse().FromCloudFormation.getString(properties.RetentionPeriodUnit):void 0),ret.addPropertyResult("retentionPeriodValue","RetentionPeriodValue",properties.RetentionPeriodValue!=null?cfn_parse().FromCloudFormation.getNumber(properties.RetentionPeriodValue):void 0),ret.addUnrecognizedPropertiesAsExtra(properties),ret}function CfnRuleUnlockDelayPropertyValidator(properties){if(!cdk().canInspect(properties))return cdk().VALIDATION_SUCCESS;const errors=new(cdk()).ValidationResults;return properties&&typeof properties=="object"&&!Array.isArray(properties)||errors.collect(new(cdk()).ValidationResult("Expected an object, but received: "+JSON.stringify(properties))),errors.collect(cdk().propertyValidator("unlockDelayUnit",cdk().validateString)(properties.unlockDelayUnit)),errors.collect(cdk().propertyValidator("unlockDelayValue",cdk().validateNumber)(properties.unlockDelayValue)),errors.wrap('supplied properties not correct for "UnlockDelayProperty"')}function convertCfnRuleUnlockDelayPropertyToCloudFormation(properties){return cdk().canInspect(properties)?(CfnRuleUnlockDelayPropertyValidator(properties).assertSuccess(),{UnlockDelayUnit:cdk().stringToCloudFormation(properties.unlockDelayUnit),UnlockDelayValue:cdk().numberToCloudFormation(properties.unlockDelayValue)}):properties}function CfnRuleUnlockDelayPropertyFromCloudFormation(properties){if(cdk().isResolvableObject(properties))return new(cfn_parse()).FromCloudFormationResult(properties);if(properties=properties??{},!(properties&&typeof properties=="object"&&!Array.isArray(properties)))return new(cfn_parse()).FromCloudFormationResult(properties);const ret=new(cfn_parse()).FromCloudFormationPropertyObject;return ret.addPropertyResult("unlockDelayUnit","UnlockDelayUnit",properties.UnlockDelayUnit!=null?cfn_parse().FromCloudFormation.getString(properties.UnlockDelayUnit):void 0),ret.addPropertyResult("unlockDelayValue","UnlockDelayValue",properties.UnlockDelayValue!=null?cfn_parse().FromCloudFormation.getNumber(properties.UnlockDelayValue):void 0),ret.addUnrecognizedPropertiesAsExtra(properties),ret}function CfnRulePropsValidator(properties){if(!cdk().canInspect(properties))return cdk().VALIDATION_SUCCESS;const errors=new(cdk()).ValidationResults;return properties&&typeof properties=="object"&&!Array.isArray(properties)||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("excludeResourceTags",cdk().listValidator(CfnRuleResourceTagPropertyValidator))(properties.excludeResourceTags)),errors.collect(cdk().propertyValidator("lockConfiguration",CfnRuleUnlockDelayPropertyValidator)(properties.lockConfiguration)),errors.collect(cdk().propertyValidator("resourceTags",cdk().listValidator(CfnRuleResourceTagPropertyValidator))(properties.resourceTags)),errors.collect(cdk().propertyValidator("resourceType",cdk().requiredValidator)(properties.resourceType)),errors.collect(cdk().propertyValidator("resourceType",cdk().validateString)(properties.resourceType)),errors.collect(cdk().propertyValidator("retentionPeriod",cdk().requiredValidator)(properties.retentionPeriod)),errors.collect(cdk().propertyValidator("retentionPeriod",CfnRuleRetentionPeriodPropertyValidator)(properties.retentionPeriod)),errors.collect(cdk().propertyValidator("status",cdk().validateString)(properties.status)),errors.collect(cdk().propertyValidator("tags",cdk().listValidator(cdk().validateCfnTag))(properties.tags)),errors.wrap('supplied properties not correct for "CfnRuleProps"')}function convertCfnRulePropsToCloudFormation(properties){return cdk().canInspect(properties)?(CfnRulePropsValidator(properties).assertSuccess(),{Description:cdk().stringToCloudFormation(properties.description),ExcludeResourceTags:cdk().listMapper(convertCfnRuleResourceTagPropertyToCloudFormation)(properties.excludeResourceTags),LockConfiguration:convertCfnRuleUnlockDelayPropertyToCloudFormation(properties.lockConfiguration),ResourceTags:cdk().listMapper(convertCfnRuleResourceTagPropertyToCloudFormation)(properties.resourceTags),ResourceType:cdk().stringToCloudFormation(properties.resourceType),RetentionPeriod:convertCfnRuleRetentionPeriodPropertyToCloudFormation(properties.retentionPeriod),Status:cdk().stringToCloudFormation(properties.status),Tags:cdk().listMapper(cdk().cfnTagToCloudFormation)(properties.tags)}):properties}function CfnRulePropsFromCloudFormation(properties){if(cdk().isResolvableObject(properties))return new(cfn_parse()).FromCloudFormationResult(properties);if(properties=properties??{},!(properties&&typeof properties=="object"&&!Array.isArray(properties)))return new(cfn_parse()).FromCloudFormationResult(properties);const ret=new(cfn_parse()).FromCloudFormationPropertyObject;return ret.addPropertyResult("description","Description",properties.Description!=null?cfn_parse().FromCloudFormation.getString(properties.Description):void 0),ret.addPropertyResult("excludeResourceTags","ExcludeResourceTags",properties.ExcludeResourceTags!=null?cfn_parse().FromCloudFormation.getArray(CfnRuleResourceTagPropertyFromCloudFormation)(properties.ExcludeResourceTags):void 0),ret.addPropertyResult("lockConfiguration","LockConfiguration",properties.LockConfiguration!=null?CfnRuleUnlockDelayPropertyFromCloudFormation(properties.LockConfiguration):void 0),ret.addPropertyResult("resourceTags","ResourceTags",properties.ResourceTags!=null?cfn_parse().FromCloudFormation.getArray(CfnRuleResourceTagPropertyFromCloudFormation)(properties.ResourceTags):void 0),ret.addPropertyResult("resourceType","ResourceType",properties.ResourceType!=null?cfn_parse().FromCloudFormation.getString(properties.ResourceType):void 0),ret.addPropertyResult("retentionPeriod","RetentionPeriod",properties.RetentionPeriod!=null?CfnRuleRetentionPeriodPropertyFromCloudFormation(properties.RetentionPeriod):void 0),ret.addPropertyResult("status","Status",properties.Status!=null?cfn_parse().FromCloudFormation.getString(properties.Status):void 0),ret.addPropertyResult("tags","Tags",properties.Tags!=null?cfn_parse().FromCloudFormation.getArray(cfn_parse().FromCloudFormation.getCfnTag)(properties.Tags):void 0),ret.addUnrecognizedPropertiesAsExtra(properties),ret}