UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 8.86 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CfnSpendingLimit=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 CfnSpendingLimit extends cdk().CfnResource{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_braket.CfnSpendingLimit",version:"2.251.0"};static CFN_RESOURCE_TYPE_NAME="AWS::Braket::SpendingLimit";static _fromCloudFormation(scope,id,resourceAttributes,options){resourceAttributes=resourceAttributes||{};const resourceProperties=options.parser.parseValue(resourceAttributes.Properties),propsResult=CfnSpendingLimitPropsFromCloudFormation(resourceProperties);if(cdk().isResolvableObject(propsResult.value))throw new(cdk_errors()).ValidationError(cfn_parse().lit`UnexpectedIResolvable`,"Unexpected IResolvable",scope);const ret=new CfnSpendingLimit(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 isCfnSpendingLimit(x){return cdk().CfnResource.isCfnResource(x)&&x.cfnResourceType===CfnSpendingLimit.CFN_RESOURCE_TYPE_NAME}static arnForSpendingLimit(resource){try{jsiiDeprecationWarnings().aws_cdk_lib_interfaces_aws_braket_ISpendingLimitRef(resource)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.arnForSpendingLimit),error}return resource.spendingLimitRef.spendingLimitArn}cdkTagManager;_deviceArn;_spendingLimit;_tags;_timePeriod;constructor(scope,id,props){super(scope,id,{type:CfnSpendingLimit.CFN_RESOURCE_TYPE_NAME,properties:props});try{jsiiDeprecationWarnings().aws_cdk_lib_aws_braket_CfnSpendingLimitProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,CfnSpendingLimit),error}cdk().requireProperty(props,"deviceArn",this),cdk().requireProperty(props,"spendingLimit",this),this.cdkTagManager=new(cdk()).TagManager(cdk().TagType.STANDARD,"AWS::Braket::SpendingLimit",void 0,{tagPropertyName:"tags"}),this._deviceArn=props.deviceArn,this._spendingLimit=props.spendingLimit,this._tags=props.tags,this._timePeriod=props.timePeriod}get spendingLimitRef(){return{spendingLimitArn:this.ref}}get deviceArn(){return this._deviceArn}set deviceArn(value){cdk().traceProperty(this.node,"DeviceArn"),this._deviceArn=value}get spendingLimit(){return this._spendingLimit}set spendingLimit(value){cdk().traceProperty(this.node,"SpendingLimit"),this._spendingLimit=value}get tags(){return this._tags}set tags(value){cdk().traceProperty(this.node,"Tags"),this._tags=value}get timePeriod(){return this._timePeriod}set timePeriod(value){cdk().traceProperty(this.node,"TimePeriod"),this._timePeriod=value}get attrCreatedAt(){return cdk().Token.asString(this.getAtt("CreatedAt",cdk().ResolutionTypeHint.STRING))}get attrQueuedSpend(){return cdk().Token.asString(this.getAtt("QueuedSpend",cdk().ResolutionTypeHint.STRING))}get attrSpendingLimitArn(){return cdk().Token.asString(this.getAtt("SpendingLimitArn",cdk().ResolutionTypeHint.STRING))}get attrTotalSpend(){return cdk().Token.asString(this.getAtt("TotalSpend",cdk().ResolutionTypeHint.STRING))}get attrUpdatedAt(){return cdk().Token.asString(this.getAtt("UpdatedAt",cdk().ResolutionTypeHint.STRING))}get cfnProperties(){return{tags:this.cdkTagManager.renderTags(this._tags),deviceArn:this._deviceArn,spendingLimit:this._spendingLimit,timePeriod:this._timePeriod}}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",CfnSpendingLimit.CFN_RESOURCE_TYPE_NAME),inspector.addAttribute("aws:cdk:cloudformation:logicalId",this._synthesizeLogicalId()),inspector.addAttribute("aws:cdk:cloudformation:props",this.cfnProperties)}renderProperties(props){return convertCfnSpendingLimitPropsToCloudFormation(props)}}exports.CfnSpendingLimit=CfnSpendingLimit;function CfnSpendingLimitTimePeriodPropertyValidator(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("endAt",cdk().requiredValidator)(properties.endAt)),errors.collect(cdk().propertyValidator("endAt",cdk().validateString)(properties.endAt)),errors.collect(cdk().propertyValidator("startAt",cdk().requiredValidator)(properties.startAt)),errors.collect(cdk().propertyValidator("startAt",cdk().validateString)(properties.startAt)),errors.wrap('supplied properties not correct for "TimePeriodProperty"')}function convertCfnSpendingLimitTimePeriodPropertyToCloudFormation(properties){return cdk().canInspect(properties)?(CfnSpendingLimitTimePeriodPropertyValidator(properties).assertSuccess(),{EndAt:cdk().stringToCloudFormation(properties.endAt),StartAt:cdk().stringToCloudFormation(properties.startAt)}):properties}function CfnSpendingLimitTimePeriodPropertyFromCloudFormation(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("endAt","EndAt",properties.EndAt!=null?cfn_parse().FromCloudFormation.getString(properties.EndAt):void 0),ret.addPropertyResult("startAt","StartAt",properties.StartAt!=null?cfn_parse().FromCloudFormation.getString(properties.StartAt):void 0),ret.addUnrecognizedPropertiesAsExtra(properties),ret}function CfnSpendingLimitPropsValidator(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("deviceArn",cdk().requiredValidator)(properties.deviceArn)),errors.collect(cdk().propertyValidator("deviceArn",cdk().validateString)(properties.deviceArn)),errors.collect(cdk().propertyValidator("spendingLimit",cdk().requiredValidator)(properties.spendingLimit)),errors.collect(cdk().propertyValidator("spendingLimit",cdk().validateString)(properties.spendingLimit)),errors.collect(cdk().propertyValidator("tags",cdk().listValidator(cdk().validateCfnTag))(properties.tags)),errors.collect(cdk().propertyValidator("timePeriod",CfnSpendingLimitTimePeriodPropertyValidator)(properties.timePeriod)),errors.wrap('supplied properties not correct for "CfnSpendingLimitProps"')}function convertCfnSpendingLimitPropsToCloudFormation(properties){return cdk().canInspect(properties)?(CfnSpendingLimitPropsValidator(properties).assertSuccess(),{DeviceArn:cdk().stringToCloudFormation(properties.deviceArn),SpendingLimit:cdk().stringToCloudFormation(properties.spendingLimit),Tags:cdk().listMapper(cdk().cfnTagToCloudFormation)(properties.tags),TimePeriod:convertCfnSpendingLimitTimePeriodPropertyToCloudFormation(properties.timePeriod)}):properties}function CfnSpendingLimitPropsFromCloudFormation(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("deviceArn","DeviceArn",properties.DeviceArn!=null?cfn_parse().FromCloudFormation.getString(properties.DeviceArn):void 0),ret.addPropertyResult("spendingLimit","SpendingLimit",properties.SpendingLimit!=null?cfn_parse().FromCloudFormation.getString(properties.SpendingLimit):void 0),ret.addPropertyResult("tags","Tags",properties.Tags!=null?cfn_parse().FromCloudFormation.getArray(cfn_parse().FromCloudFormation.getCfnTag)(properties.Tags):void 0),ret.addPropertyResult("timePeriod","TimePeriod",properties.TimePeriod!=null?CfnSpendingLimitTimePeriodPropertyFromCloudFormation(properties.TimePeriod):void 0),ret.addUnrecognizedPropertiesAsExtra(properties),ret}