UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 12.1 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CfnNotificationRule=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 CfnNotificationRule extends cdk().CfnResource{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_codestarnotifications.CfnNotificationRule",version:"2.251.0"};static CFN_RESOURCE_TYPE_NAME="AWS::CodeStarNotifications::NotificationRule";static _fromCloudFormation(scope,id,resourceAttributes,options){resourceAttributes=resourceAttributes||{};const resourceProperties=options.parser.parseValue(resourceAttributes.Properties),propsResult=CfnNotificationRulePropsFromCloudFormation(resourceProperties);if(cdk().isResolvableObject(propsResult.value))throw new(cdk_errors()).ValidationError(cfn_parse().lit`UnexpectedIResolvable`,"Unexpected IResolvable",scope);const ret=new CfnNotificationRule(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 isCfnNotificationRule(x){return cdk().CfnResource.isCfnResource(x)&&x.cfnResourceType===CfnNotificationRule.CFN_RESOURCE_TYPE_NAME}static arnForNotificationRule(resource){try{jsiiDeprecationWarnings().aws_cdk_lib_interfaces_aws_codestarnotifications_INotificationRuleRef(resource)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.arnForNotificationRule),error}return resource.notificationRuleRef.notificationRuleArn}_createdBy;_detailType;_eventTypeId;_eventTypeIds;_name;_resource;_status;tags;_tagsRaw;_targetAddress;_targets;constructor(scope,id,props){super(scope,id,{type:CfnNotificationRule.CFN_RESOURCE_TYPE_NAME,properties:props});try{jsiiDeprecationWarnings().aws_cdk_lib_aws_codestarnotifications_CfnNotificationRuleProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,CfnNotificationRule),error}cdk().requireProperty(props,"detailType",this),cdk().requireProperty(props,"eventTypeIds",this),cdk().requireProperty(props,"name",this),cdk().requireProperty(props,"resource",this),cdk().requireProperty(props,"targets",this),this._createdBy=props.createdBy,this._detailType=props.detailType,this._eventTypeId=props.eventTypeId,this._eventTypeIds=props.eventTypeIds,this._name=props.name,this._resource=props.resource,this._status=props.status,this.tags=new(cdk()).TagManager(cdk().TagType.MAP,"AWS::CodeStarNotifications::NotificationRule",props.tags,{tagPropertyName:"tags"}),this._tagsRaw=props.tags,this._targetAddress=props.targetAddress,this._targets=props.targets}get notificationRuleRef(){return{notificationRuleArn:this.ref}}get createdBy(){return this._createdBy}set createdBy(value){cdk().traceProperty(this.node,"CreatedBy"),this._createdBy=value}get detailType(){return this._detailType}set detailType(value){cdk().traceProperty(this.node,"DetailType"),this._detailType=value}get eventTypeId(){return this._eventTypeId}set eventTypeId(value){cdk().traceProperty(this.node,"EventTypeId"),this._eventTypeId=value}get eventTypeIds(){return this._eventTypeIds}set eventTypeIds(value){cdk().traceProperty(this.node,"EventTypeIds"),this._eventTypeIds=value}get name(){return this._name}set name(value){cdk().traceProperty(this.node,"Name"),this._name=value}get resource(){return this._resource}set resource(value){cdk().traceProperty(this.node,"Resource"),this._resource=value}get status(){return this._status}set status(value){cdk().traceProperty(this.node,"Status"),this._status=value}get tagsRaw(){return this._tagsRaw}set tagsRaw(value){cdk().traceProperty(this.node,"Tags"),this._tagsRaw=value}get targetAddress(){return this._targetAddress}set targetAddress(value){cdk().traceProperty(this.node,"TargetAddress"),this._targetAddress=value}get targets(){return this._targets}set targets(value){cdk().traceProperty(this.node,"Targets"),this._targets=value}get attrArn(){return cdk().Token.asString(this.getAtt("Arn",cdk().ResolutionTypeHint.STRING))}get cfnProperties(){return{createdBy:this._createdBy,detailType:this._detailType,eventTypeId:this._eventTypeId,eventTypeIds:this._eventTypeIds,name:this._name,resource:this._resource,status:this._status,tags:this.tags.renderTags(),targetAddress:this._targetAddress,targets:this._targets}}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",CfnNotificationRule.CFN_RESOURCE_TYPE_NAME),inspector.addAttribute("aws:cdk:cloudformation:logicalId",this._synthesizeLogicalId()),inspector.addAttribute("aws:cdk:cloudformation:props",this.cfnProperties)}renderProperties(props){return convertCfnNotificationRulePropsToCloudFormation(props)}}exports.CfnNotificationRule=CfnNotificationRule;function CfnNotificationRuleTargetPropertyValidator(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("targetAddress",cdk().requiredValidator)(properties.targetAddress)),errors.collect(cdk().propertyValidator("targetAddress",cdk().validateString)(properties.targetAddress)),errors.collect(cdk().propertyValidator("targetType",cdk().requiredValidator)(properties.targetType)),errors.collect(cdk().propertyValidator("targetType",cdk().validateString)(properties.targetType)),errors.wrap('supplied properties not correct for "TargetProperty"')}function convertCfnNotificationRuleTargetPropertyToCloudFormation(properties){return cdk().canInspect(properties)?(CfnNotificationRuleTargetPropertyValidator(properties).assertSuccess(),{TargetAddress:cdk().stringToCloudFormation(properties.targetAddress),TargetType:cdk().stringToCloudFormation(properties.targetType)}):properties}function CfnNotificationRuleTargetPropertyFromCloudFormation(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("targetAddress","TargetAddress",properties.TargetAddress!=null?cfn_parse().FromCloudFormation.getString(properties.TargetAddress):void 0),ret.addPropertyResult("targetType","TargetType",properties.TargetType!=null?cfn_parse().FromCloudFormation.getString(properties.TargetType):void 0),ret.addUnrecognizedPropertiesAsExtra(properties),ret}function CfnNotificationRulePropsValidator(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("createdBy",cdk().validateString)(properties.createdBy)),errors.collect(cdk().propertyValidator("detailType",cdk().requiredValidator)(properties.detailType)),errors.collect(cdk().propertyValidator("detailType",cdk().validateString)(properties.detailType)),errors.collect(cdk().propertyValidator("eventTypeId",cdk().validateString)(properties.eventTypeId)),errors.collect(cdk().propertyValidator("eventTypeIds",cdk().requiredValidator)(properties.eventTypeIds)),errors.collect(cdk().propertyValidator("eventTypeIds",cdk().listValidator(cdk().validateString))(properties.eventTypeIds)),errors.collect(cdk().propertyValidator("name",cdk().requiredValidator)(properties.name)),errors.collect(cdk().propertyValidator("name",cdk().validateString)(properties.name)),errors.collect(cdk().propertyValidator("resource",cdk().requiredValidator)(properties.resource)),errors.collect(cdk().propertyValidator("resource",cdk().validateString)(properties.resource)),errors.collect(cdk().propertyValidator("status",cdk().validateString)(properties.status)),errors.collect(cdk().propertyValidator("tags",cdk().hashValidator(cdk().validateString))(properties.tags)),errors.collect(cdk().propertyValidator("targetAddress",cdk().validateString)(properties.targetAddress)),errors.collect(cdk().propertyValidator("targets",cdk().requiredValidator)(properties.targets)),errors.collect(cdk().propertyValidator("targets",cdk().listValidator(CfnNotificationRuleTargetPropertyValidator))(properties.targets)),errors.wrap('supplied properties not correct for "CfnNotificationRuleProps"')}function convertCfnNotificationRulePropsToCloudFormation(properties){return cdk().canInspect(properties)?(CfnNotificationRulePropsValidator(properties).assertSuccess(),{CreatedBy:cdk().stringToCloudFormation(properties.createdBy),DetailType:cdk().stringToCloudFormation(properties.detailType),EventTypeId:cdk().stringToCloudFormation(properties.eventTypeId),EventTypeIds:cdk().listMapper(cdk().stringToCloudFormation)(properties.eventTypeIds),Name:cdk().stringToCloudFormation(properties.name),Resource:cdk().stringToCloudFormation(properties.resource),Status:cdk().stringToCloudFormation(properties.status),Tags:cdk().hashMapper(cdk().stringToCloudFormation)(properties.tags),TargetAddress:cdk().stringToCloudFormation(properties.targetAddress),Targets:cdk().listMapper(convertCfnNotificationRuleTargetPropertyToCloudFormation)(properties.targets)}):properties}function CfnNotificationRulePropsFromCloudFormation(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("createdBy","CreatedBy",properties.CreatedBy!=null?cfn_parse().FromCloudFormation.getString(properties.CreatedBy):void 0),ret.addPropertyResult("detailType","DetailType",properties.DetailType!=null?cfn_parse().FromCloudFormation.getString(properties.DetailType):void 0),ret.addPropertyResult("eventTypeId","EventTypeId",properties.EventTypeId!=null?cfn_parse().FromCloudFormation.getString(properties.EventTypeId):void 0),ret.addPropertyResult("eventTypeIds","EventTypeIds",properties.EventTypeIds!=null?cfn_parse().FromCloudFormation.getArray(cfn_parse().FromCloudFormation.getString)(properties.EventTypeIds):void 0),ret.addPropertyResult("name","Name",properties.Name!=null?cfn_parse().FromCloudFormation.getString(properties.Name):void 0),ret.addPropertyResult("resource","Resource",properties.Resource!=null?cfn_parse().FromCloudFormation.getString(properties.Resource):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.getMap(cfn_parse().FromCloudFormation.getString)(properties.Tags):void 0),ret.addPropertyResult("targetAddress","TargetAddress",properties.TargetAddress!=null?cfn_parse().FromCloudFormation.getString(properties.TargetAddress):void 0),ret.addPropertyResult("targets","Targets",properties.Targets!=null?cfn_parse().FromCloudFormation.getArray(CfnNotificationRuleTargetPropertyFromCloudFormation)(properties.Targets):void 0),ret.addUnrecognizedPropertiesAsExtra(properties),ret}