UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 8.91 kB
"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.CfnNotificationRule=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),cdk=require("../../core"),cfn_parse=require("../../core/lib/helpers-internal");function CfnNotificationRulePropsValidator(properties){if(!cdk.canInspect(properties))return cdk.VALIDATION_SUCCESS;const errors=new cdk.ValidationResults;return typeof properties!="object"&&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(CfnNotificationRule_TargetPropertyValidator))(properties.targets)),errors.wrap('supplied properties not correct for "CfnNotificationRuleProps"')}function cfnNotificationRulePropsToCloudFormation(properties){return cdk.canInspect(properties)?(CfnNotificationRulePropsValidator(properties).assertSuccess(),{DetailType:cdk.stringToCloudFormation(properties.detailType),EventTypeIds:cdk.listMapper(cdk.stringToCloudFormation)(properties.eventTypeIds),Name:cdk.stringToCloudFormation(properties.name),Resource:cdk.stringToCloudFormation(properties.resource),Targets:cdk.listMapper(cfnNotificationRuleTargetPropertyToCloudFormation)(properties.targets),CreatedBy:cdk.stringToCloudFormation(properties.createdBy),EventTypeId:cdk.stringToCloudFormation(properties.eventTypeId),Status:cdk.stringToCloudFormation(properties.status),Tags:cdk.hashMapper(cdk.stringToCloudFormation)(properties.tags),TargetAddress:cdk.stringToCloudFormation(properties.targetAddress)}):properties}function CfnNotificationRulePropsFromCloudFormation(properties){if(properties=properties??{},typeof properties!="object")return new cfn_parse.FromCloudFormationResult(properties);const ret=new cfn_parse.FromCloudFormationPropertyObject;return ret.addPropertyResult("detailType","DetailType",cfn_parse.FromCloudFormation.getString(properties.DetailType)),ret.addPropertyResult("eventTypeIds","EventTypeIds",cfn_parse.FromCloudFormation.getStringArray(properties.EventTypeIds)),ret.addPropertyResult("name","Name",cfn_parse.FromCloudFormation.getString(properties.Name)),ret.addPropertyResult("resource","Resource",cfn_parse.FromCloudFormation.getString(properties.Resource)),ret.addPropertyResult("targets","Targets",cfn_parse.FromCloudFormation.getArray(CfnNotificationRuleTargetPropertyFromCloudFormation)(properties.Targets)),ret.addPropertyResult("createdBy","CreatedBy",properties.CreatedBy!=null?cfn_parse.FromCloudFormation.getString(properties.CreatedBy):void 0),ret.addPropertyResult("eventTypeId","EventTypeId",properties.EventTypeId!=null?cfn_parse.FromCloudFormation.getString(properties.EventTypeId):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.addUnrecognizedPropertiesAsExtra(properties),ret}class CfnNotificationRule extends cdk.CfnResource{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.attrArn=cdk.Token.asString(this.getAtt("Arn",cdk.ResolutionTypeHint.STRING)),this.detailType=props.detailType,this.eventTypeIds=props.eventTypeIds,this.name=props.name,this.resource=props.resource,this.targets=props.targets,this.createdBy=props.createdBy,this.eventTypeId=props.eventTypeId,this.status=props.status,this.tags=new cdk.TagManager(cdk.TagType.MAP,"AWS::CodeStarNotifications::NotificationRule",props.tags,{tagPropertyName:"tags"}),this.targetAddress=props.targetAddress}static _fromCloudFormation(scope,id,resourceAttributes,options){resourceAttributes=resourceAttributes||{};const resourceProperties=options.parser.parseValue(resourceAttributes.Properties),propsResult=CfnNotificationRulePropsFromCloudFormation(resourceProperties),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}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:props",this.cfnProperties)}get cfnProperties(){return{detailType:this.detailType,eventTypeIds:this.eventTypeIds,name:this.name,resource:this.resource,targets:this.targets,createdBy:this.createdBy,eventTypeId:this.eventTypeId,status:this.status,tags:this.tags.renderTags(),targetAddress:this.targetAddress}}renderProperties(props){return cfnNotificationRulePropsToCloudFormation(props)}}exports.CfnNotificationRule=CfnNotificationRule,_a=JSII_RTTI_SYMBOL_1,CfnNotificationRule[_a]={fqn:"aws-cdk-lib.aws_codestarnotifications.CfnNotificationRule",version:"2.70.0"},CfnNotificationRule.CFN_RESOURCE_TYPE_NAME="AWS::CodeStarNotifications::NotificationRule";function CfnNotificationRule_TargetPropertyValidator(properties){if(!cdk.canInspect(properties))return cdk.VALIDATION_SUCCESS;const errors=new cdk.ValidationResults;return typeof properties!="object"&&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 cfnNotificationRuleTargetPropertyToCloudFormation(properties){return cdk.canInspect(properties)?(CfnNotificationRule_TargetPropertyValidator(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??{},typeof properties!="object")return new cfn_parse.FromCloudFormationResult(properties);const ret=new cfn_parse.FromCloudFormationPropertyObject;return ret.addPropertyResult("targetAddress","TargetAddress",cfn_parse.FromCloudFormation.getString(properties.TargetAddress)),ret.addPropertyResult("targetType","TargetType",cfn_parse.FromCloudFormation.getString(properties.TargetType)),ret.addUnrecognizedPropertiesAsExtra(properties),ret}