aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 17 kB
JavaScript
"use strict";var _a,_b,_c;Object.defineProperty(exports,"__esModule",{value:!0}),exports.CfnProject=exports.CfnPlacement=exports.CfnDevice=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");return cdk=()=>tmp,tmp},cfn_parse=()=>{var tmp=require("../../core/lib/helpers-internal");return cfn_parse=()=>tmp,tmp};class CfnDevice extends cdk().CfnResource{static _fromCloudFormation(scope,id,resourceAttributes,options){resourceAttributes=resourceAttributes||{};const resourceProperties=options.parser.parseValue(resourceAttributes.Properties),propsResult=CfnDevicePropsFromCloudFormation(resourceProperties);if(cdk().isResolvableObject(propsResult.value))throw new Error("Unexpected IResolvable");const ret=new CfnDevice(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}constructor(scope,id,props){super(scope,id,{type:CfnDevice.CFN_RESOURCE_TYPE_NAME,properties:props});try{jsiiDeprecationWarnings().aws_cdk_lib_aws_iot1click_CfnDeviceProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,CfnDevice),error}cdk().requireProperty(props,"deviceId",this),cdk().requireProperty(props,"enabled",this),this.attrArn=cdk().Token.asString(this.getAtt("Arn",cdk().ResolutionTypeHint.STRING)),this.attrDeviceId=cdk().Token.asString(this.getAtt("DeviceId",cdk().ResolutionTypeHint.STRING)),this.attrEnabled=this.getAtt("Enabled"),this.deviceId=props.deviceId,this.enabled=props.enabled}get cfnProperties(){return{deviceId:this.deviceId,enabled:this.enabled}}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",CfnDevice.CFN_RESOURCE_TYPE_NAME),inspector.addAttribute("aws:cdk:cloudformation:props",this.cfnProperties)}renderProperties(props){return convertCfnDevicePropsToCloudFormation(props)}}exports.CfnDevice=CfnDevice,_a=JSII_RTTI_SYMBOL_1,CfnDevice[_a]={fqn:"aws-cdk-lib.aws_iot1click.CfnDevice",version:"2.160.0"},CfnDevice.CFN_RESOURCE_TYPE_NAME="AWS::IoT1Click::Device";function CfnDevicePropsValidator(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("deviceId",cdk().requiredValidator)(properties.deviceId)),errors.collect(cdk().propertyValidator("deviceId",cdk().validateString)(properties.deviceId)),errors.collect(cdk().propertyValidator("enabled",cdk().requiredValidator)(properties.enabled)),errors.collect(cdk().propertyValidator("enabled",cdk().validateBoolean)(properties.enabled)),errors.wrap('supplied properties not correct for "CfnDeviceProps"')}function convertCfnDevicePropsToCloudFormation(properties){return cdk().canInspect(properties)?(CfnDevicePropsValidator(properties).assertSuccess(),{DeviceId:cdk().stringToCloudFormation(properties.deviceId),Enabled:cdk().booleanToCloudFormation(properties.enabled)}):properties}function CfnDevicePropsFromCloudFormation(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("deviceId","DeviceId",properties.DeviceId!=null?cfn_parse().FromCloudFormation.getString(properties.DeviceId):void 0),ret.addPropertyResult("enabled","Enabled",properties.Enabled!=null?cfn_parse().FromCloudFormation.getBoolean(properties.Enabled):void 0),ret.addUnrecognizedPropertiesAsExtra(properties),ret}class CfnPlacement extends cdk().CfnResource{static _fromCloudFormation(scope,id,resourceAttributes,options){resourceAttributes=resourceAttributes||{};const resourceProperties=options.parser.parseValue(resourceAttributes.Properties),propsResult=CfnPlacementPropsFromCloudFormation(resourceProperties);if(cdk().isResolvableObject(propsResult.value))throw new Error("Unexpected IResolvable");const ret=new CfnPlacement(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}constructor(scope,id,props){super(scope,id,{type:CfnPlacement.CFN_RESOURCE_TYPE_NAME,properties:props});try{jsiiDeprecationWarnings().aws_cdk_lib_aws_iot1click_CfnPlacementProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,CfnPlacement),error}cdk().requireProperty(props,"projectName",this),this.attrId=cdk().Token.asString(this.getAtt("Id",cdk().ResolutionTypeHint.STRING)),this.attrPlacementName=cdk().Token.asString(this.getAtt("PlacementName",cdk().ResolutionTypeHint.STRING)),this.attrProjectName=cdk().Token.asString(this.getAtt("ProjectName",cdk().ResolutionTypeHint.STRING)),this.associatedDevices=props.associatedDevices,this.attributes=props.attributes,this.placementName=props.placementName,this.projectName=props.projectName}get cfnProperties(){return{associatedDevices:this.associatedDevices,attributes:this.attributes,placementName:this.placementName,projectName:this.projectName}}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",CfnPlacement.CFN_RESOURCE_TYPE_NAME),inspector.addAttribute("aws:cdk:cloudformation:props",this.cfnProperties)}renderProperties(props){return convertCfnPlacementPropsToCloudFormation(props)}}exports.CfnPlacement=CfnPlacement,_b=JSII_RTTI_SYMBOL_1,CfnPlacement[_b]={fqn:"aws-cdk-lib.aws_iot1click.CfnPlacement",version:"2.160.0"},CfnPlacement.CFN_RESOURCE_TYPE_NAME="AWS::IoT1Click::Placement";function CfnPlacementPropsValidator(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("associatedDevices",cdk().validateObject)(properties.associatedDevices)),errors.collect(cdk().propertyValidator("attributes",cdk().validateObject)(properties.attributes)),errors.collect(cdk().propertyValidator("placementName",cdk().validateString)(properties.placementName)),errors.collect(cdk().propertyValidator("projectName",cdk().requiredValidator)(properties.projectName)),errors.collect(cdk().propertyValidator("projectName",cdk().validateString)(properties.projectName)),errors.wrap('supplied properties not correct for "CfnPlacementProps"')}function convertCfnPlacementPropsToCloudFormation(properties){return cdk().canInspect(properties)?(CfnPlacementPropsValidator(properties).assertSuccess(),{AssociatedDevices:cdk().objectToCloudFormation(properties.associatedDevices),Attributes:cdk().objectToCloudFormation(properties.attributes),PlacementName:cdk().stringToCloudFormation(properties.placementName),ProjectName:cdk().stringToCloudFormation(properties.projectName)}):properties}function CfnPlacementPropsFromCloudFormation(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("associatedDevices","AssociatedDevices",properties.AssociatedDevices!=null?cfn_parse().FromCloudFormation.getAny(properties.AssociatedDevices):void 0),ret.addPropertyResult("attributes","Attributes",properties.Attributes!=null?cfn_parse().FromCloudFormation.getAny(properties.Attributes):void 0),ret.addPropertyResult("placementName","PlacementName",properties.PlacementName!=null?cfn_parse().FromCloudFormation.getString(properties.PlacementName):void 0),ret.addPropertyResult("projectName","ProjectName",properties.ProjectName!=null?cfn_parse().FromCloudFormation.getString(properties.ProjectName):void 0),ret.addUnrecognizedPropertiesAsExtra(properties),ret}class CfnProject extends cdk().CfnResource{static _fromCloudFormation(scope,id,resourceAttributes,options){resourceAttributes=resourceAttributes||{};const resourceProperties=options.parser.parseValue(resourceAttributes.Properties),propsResult=CfnProjectPropsFromCloudFormation(resourceProperties);if(cdk().isResolvableObject(propsResult.value))throw new Error("Unexpected IResolvable");const ret=new CfnProject(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}constructor(scope,id,props){super(scope,id,{type:CfnProject.CFN_RESOURCE_TYPE_NAME,properties:props});try{jsiiDeprecationWarnings().aws_cdk_lib_aws_iot1click_CfnProjectProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,CfnProject),error}cdk().requireProperty(props,"placementTemplate",this),this.attrArn=cdk().Token.asString(this.getAtt("Arn",cdk().ResolutionTypeHint.STRING)),this.attrId=cdk().Token.asString(this.getAtt("Id",cdk().ResolutionTypeHint.STRING)),this.attrProjectName=cdk().Token.asString(this.getAtt("ProjectName",cdk().ResolutionTypeHint.STRING)),this.description=props.description,this.placementTemplate=props.placementTemplate,this.projectName=props.projectName}get cfnProperties(){return{description:this.description,placementTemplate:this.placementTemplate,projectName:this.projectName}}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",CfnProject.CFN_RESOURCE_TYPE_NAME),inspector.addAttribute("aws:cdk:cloudformation:props",this.cfnProperties)}renderProperties(props){return convertCfnProjectPropsToCloudFormation(props)}}exports.CfnProject=CfnProject,_c=JSII_RTTI_SYMBOL_1,CfnProject[_c]={fqn:"aws-cdk-lib.aws_iot1click.CfnProject",version:"2.160.0"},CfnProject.CFN_RESOURCE_TYPE_NAME="AWS::IoT1Click::Project";function CfnProjectDeviceTemplatePropertyValidator(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("callbackOverrides",cdk().validateObject)(properties.callbackOverrides)),errors.collect(cdk().propertyValidator("deviceType",cdk().validateString)(properties.deviceType)),errors.wrap('supplied properties not correct for "DeviceTemplateProperty"')}function convertCfnProjectDeviceTemplatePropertyToCloudFormation(properties){return cdk().canInspect(properties)?(CfnProjectDeviceTemplatePropertyValidator(properties).assertSuccess(),{CallbackOverrides:cdk().objectToCloudFormation(properties.callbackOverrides),DeviceType:cdk().stringToCloudFormation(properties.deviceType)}):properties}function CfnProjectDeviceTemplatePropertyFromCloudFormation(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("callbackOverrides","CallbackOverrides",properties.CallbackOverrides!=null?cfn_parse().FromCloudFormation.getAny(properties.CallbackOverrides):void 0),ret.addPropertyResult("deviceType","DeviceType",properties.DeviceType!=null?cfn_parse().FromCloudFormation.getString(properties.DeviceType):void 0),ret.addUnrecognizedPropertiesAsExtra(properties),ret}function CfnProjectPlacementTemplatePropertyValidator(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("defaultAttributes",cdk().validateObject)(properties.defaultAttributes)),errors.collect(cdk().propertyValidator("deviceTemplates",cdk().hashValidator(CfnProjectDeviceTemplatePropertyValidator))(properties.deviceTemplates)),errors.wrap('supplied properties not correct for "PlacementTemplateProperty"')}function convertCfnProjectPlacementTemplatePropertyToCloudFormation(properties){return cdk().canInspect(properties)?(CfnProjectPlacementTemplatePropertyValidator(properties).assertSuccess(),{DefaultAttributes:cdk().objectToCloudFormation(properties.defaultAttributes),DeviceTemplates:cdk().hashMapper(convertCfnProjectDeviceTemplatePropertyToCloudFormation)(properties.deviceTemplates)}):properties}function CfnProjectPlacementTemplatePropertyFromCloudFormation(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("defaultAttributes","DefaultAttributes",properties.DefaultAttributes!=null?cfn_parse().FromCloudFormation.getAny(properties.DefaultAttributes):void 0),ret.addPropertyResult("deviceTemplates","DeviceTemplates",properties.DeviceTemplates!=null?cfn_parse().FromCloudFormation.getMap(CfnProjectDeviceTemplatePropertyFromCloudFormation)(properties.DeviceTemplates):void 0),ret.addUnrecognizedPropertiesAsExtra(properties),ret}function CfnProjectPropsValidator(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("placementTemplate",cdk().requiredValidator)(properties.placementTemplate)),errors.collect(cdk().propertyValidator("placementTemplate",CfnProjectPlacementTemplatePropertyValidator)(properties.placementTemplate)),errors.collect(cdk().propertyValidator("projectName",cdk().validateString)(properties.projectName)),errors.wrap('supplied properties not correct for "CfnProjectProps"')}function convertCfnProjectPropsToCloudFormation(properties){return cdk().canInspect(properties)?(CfnProjectPropsValidator(properties).assertSuccess(),{Description:cdk().stringToCloudFormation(properties.description),PlacementTemplate:convertCfnProjectPlacementTemplatePropertyToCloudFormation(properties.placementTemplate),ProjectName:cdk().stringToCloudFormation(properties.projectName)}):properties}function CfnProjectPropsFromCloudFormation(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("placementTemplate","PlacementTemplate",properties.PlacementTemplate!=null?CfnProjectPlacementTemplatePropertyFromCloudFormation(properties.PlacementTemplate):void 0),ret.addPropertyResult("projectName","ProjectName",properties.ProjectName!=null?cfn_parse().FromCloudFormation.getString(properties.ProjectName):void 0),ret.addUnrecognizedPropertiesAsExtra(properties),ret}