UNPKG

@aws-cdk/aws-codebuild

Version:

The CDK Construct Library for AWS::CodeBuild

857 lines 464 kB
"use strict"; var _a, _b, _c; Object.defineProperty(exports, "__esModule", { value: true }); exports.CfnSourceCredential = exports.CfnReportGroup = exports.CfnProject = void 0; const jsiiDeprecationWarnings = require("../.warnings.jsii.js"); const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti"); // Copyright 2012-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. // Generated from the AWS CloudFormation Resource Specification // See: docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification.html // @cfn2ts:meta@ {"generated":"2023-06-19T15:17:57.619Z","fingerprint":"PWpXHjw4m9IvFihByEFnTLssDcObEP34cK6lGuVeAAk="} /* eslint-disable max-len */ // This is generated code - line lengths are difficult to control const cdk = require("@aws-cdk/core"); const cfn_parse = require("@aws-cdk/core/lib/helpers-internal"); /** * Determine whether the given properties match those of a `CfnProjectProps` * * @param properties - the TypeScript properties of a `CfnProjectProps` * * @returns the result of the validation. */ function CfnProjectPropsValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('artifacts', cdk.requiredValidator)(properties.artifacts)); errors.collect(cdk.propertyValidator('artifacts', CfnProject_ArtifactsPropertyValidator)(properties.artifacts)); errors.collect(cdk.propertyValidator('badgeEnabled', cdk.validateBoolean)(properties.badgeEnabled)); errors.collect(cdk.propertyValidator('buildBatchConfig', CfnProject_ProjectBuildBatchConfigPropertyValidator)(properties.buildBatchConfig)); errors.collect(cdk.propertyValidator('cache', CfnProject_ProjectCachePropertyValidator)(properties.cache)); errors.collect(cdk.propertyValidator('concurrentBuildLimit', cdk.validateNumber)(properties.concurrentBuildLimit)); errors.collect(cdk.propertyValidator('description', cdk.validateString)(properties.description)); errors.collect(cdk.propertyValidator('encryptionKey', cdk.validateString)(properties.encryptionKey)); errors.collect(cdk.propertyValidator('environment', cdk.requiredValidator)(properties.environment)); errors.collect(cdk.propertyValidator('environment', CfnProject_EnvironmentPropertyValidator)(properties.environment)); errors.collect(cdk.propertyValidator('fileSystemLocations', cdk.listValidator(CfnProject_ProjectFileSystemLocationPropertyValidator))(properties.fileSystemLocations)); errors.collect(cdk.propertyValidator('logsConfig', CfnProject_LogsConfigPropertyValidator)(properties.logsConfig)); errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name)); errors.collect(cdk.propertyValidator('queuedTimeoutInMinutes', cdk.validateNumber)(properties.queuedTimeoutInMinutes)); errors.collect(cdk.propertyValidator('resourceAccessRole', cdk.validateString)(properties.resourceAccessRole)); errors.collect(cdk.propertyValidator('secondaryArtifacts', cdk.listValidator(CfnProject_ArtifactsPropertyValidator))(properties.secondaryArtifacts)); errors.collect(cdk.propertyValidator('secondarySourceVersions', cdk.listValidator(CfnProject_ProjectSourceVersionPropertyValidator))(properties.secondarySourceVersions)); errors.collect(cdk.propertyValidator('secondarySources', cdk.listValidator(CfnProject_SourcePropertyValidator))(properties.secondarySources)); errors.collect(cdk.propertyValidator('serviceRole', cdk.requiredValidator)(properties.serviceRole)); errors.collect(cdk.propertyValidator('serviceRole', cdk.validateString)(properties.serviceRole)); errors.collect(cdk.propertyValidator('source', cdk.requiredValidator)(properties.source)); errors.collect(cdk.propertyValidator('source', CfnProject_SourcePropertyValidator)(properties.source)); errors.collect(cdk.propertyValidator('sourceVersion', cdk.validateString)(properties.sourceVersion)); errors.collect(cdk.propertyValidator('tags', cdk.listValidator(cdk.validateCfnTag))(properties.tags)); errors.collect(cdk.propertyValidator('timeoutInMinutes', cdk.validateNumber)(properties.timeoutInMinutes)); errors.collect(cdk.propertyValidator('triggers', CfnProject_ProjectTriggersPropertyValidator)(properties.triggers)); errors.collect(cdk.propertyValidator('visibility', cdk.validateString)(properties.visibility)); errors.collect(cdk.propertyValidator('vpcConfig', CfnProject_VpcConfigPropertyValidator)(properties.vpcConfig)); return errors.wrap('supplied properties not correct for "CfnProjectProps"'); } /** * Renders the AWS CloudFormation properties of an `AWS::CodeBuild::Project` resource * * @param properties - the TypeScript properties of a `CfnProjectProps` * * @returns the AWS CloudFormation properties of an `AWS::CodeBuild::Project` resource. */ // @ts-ignore TS6133 function cfnProjectPropsToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnProjectPropsValidator(properties).assertSuccess(); return { Artifacts: cfnProjectArtifactsPropertyToCloudFormation(properties.artifacts), Environment: cfnProjectEnvironmentPropertyToCloudFormation(properties.environment), ServiceRole: cdk.stringToCloudFormation(properties.serviceRole), Source: cfnProjectSourcePropertyToCloudFormation(properties.source), BadgeEnabled: cdk.booleanToCloudFormation(properties.badgeEnabled), BuildBatchConfig: cfnProjectProjectBuildBatchConfigPropertyToCloudFormation(properties.buildBatchConfig), Cache: cfnProjectProjectCachePropertyToCloudFormation(properties.cache), ConcurrentBuildLimit: cdk.numberToCloudFormation(properties.concurrentBuildLimit), Description: cdk.stringToCloudFormation(properties.description), EncryptionKey: cdk.stringToCloudFormation(properties.encryptionKey), FileSystemLocations: cdk.listMapper(cfnProjectProjectFileSystemLocationPropertyToCloudFormation)(properties.fileSystemLocations), LogsConfig: cfnProjectLogsConfigPropertyToCloudFormation(properties.logsConfig), Name: cdk.stringToCloudFormation(properties.name), QueuedTimeoutInMinutes: cdk.numberToCloudFormation(properties.queuedTimeoutInMinutes), ResourceAccessRole: cdk.stringToCloudFormation(properties.resourceAccessRole), SecondaryArtifacts: cdk.listMapper(cfnProjectArtifactsPropertyToCloudFormation)(properties.secondaryArtifacts), SecondarySources: cdk.listMapper(cfnProjectSourcePropertyToCloudFormation)(properties.secondarySources), SecondarySourceVersions: cdk.listMapper(cfnProjectProjectSourceVersionPropertyToCloudFormation)(properties.secondarySourceVersions), SourceVersion: cdk.stringToCloudFormation(properties.sourceVersion), Tags: cdk.listMapper(cdk.cfnTagToCloudFormation)(properties.tags), TimeoutInMinutes: cdk.numberToCloudFormation(properties.timeoutInMinutes), Triggers: cfnProjectProjectTriggersPropertyToCloudFormation(properties.triggers), Visibility: cdk.stringToCloudFormation(properties.visibility), VpcConfig: cfnProjectVpcConfigPropertyToCloudFormation(properties.vpcConfig), }; } // @ts-ignore TS6133 function CfnProjectPropsFromCloudFormation(properties) { properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('artifacts', 'Artifacts', CfnProjectArtifactsPropertyFromCloudFormation(properties.Artifacts)); ret.addPropertyResult('environment', 'Environment', CfnProjectEnvironmentPropertyFromCloudFormation(properties.Environment)); ret.addPropertyResult('serviceRole', 'ServiceRole', cfn_parse.FromCloudFormation.getString(properties.ServiceRole)); ret.addPropertyResult('source', 'Source', CfnProjectSourcePropertyFromCloudFormation(properties.Source)); ret.addPropertyResult('badgeEnabled', 'BadgeEnabled', properties.BadgeEnabled != null ? cfn_parse.FromCloudFormation.getBoolean(properties.BadgeEnabled) : undefined); ret.addPropertyResult('buildBatchConfig', 'BuildBatchConfig', properties.BuildBatchConfig != null ? CfnProjectProjectBuildBatchConfigPropertyFromCloudFormation(properties.BuildBatchConfig) : undefined); ret.addPropertyResult('cache', 'Cache', properties.Cache != null ? CfnProjectProjectCachePropertyFromCloudFormation(properties.Cache) : undefined); ret.addPropertyResult('concurrentBuildLimit', 'ConcurrentBuildLimit', properties.ConcurrentBuildLimit != null ? cfn_parse.FromCloudFormation.getNumber(properties.ConcurrentBuildLimit) : undefined); ret.addPropertyResult('description', 'Description', properties.Description != null ? cfn_parse.FromCloudFormation.getString(properties.Description) : undefined); ret.addPropertyResult('encryptionKey', 'EncryptionKey', properties.EncryptionKey != null ? cfn_parse.FromCloudFormation.getString(properties.EncryptionKey) : undefined); ret.addPropertyResult('fileSystemLocations', 'FileSystemLocations', properties.FileSystemLocations != null ? cfn_parse.FromCloudFormation.getArray(CfnProjectProjectFileSystemLocationPropertyFromCloudFormation)(properties.FileSystemLocations) : undefined); ret.addPropertyResult('logsConfig', 'LogsConfig', properties.LogsConfig != null ? CfnProjectLogsConfigPropertyFromCloudFormation(properties.LogsConfig) : undefined); ret.addPropertyResult('name', 'Name', properties.Name != null ? cfn_parse.FromCloudFormation.getString(properties.Name) : undefined); ret.addPropertyResult('queuedTimeoutInMinutes', 'QueuedTimeoutInMinutes', properties.QueuedTimeoutInMinutes != null ? cfn_parse.FromCloudFormation.getNumber(properties.QueuedTimeoutInMinutes) : undefined); ret.addPropertyResult('resourceAccessRole', 'ResourceAccessRole', properties.ResourceAccessRole != null ? cfn_parse.FromCloudFormation.getString(properties.ResourceAccessRole) : undefined); ret.addPropertyResult('secondaryArtifacts', 'SecondaryArtifacts', properties.SecondaryArtifacts != null ? cfn_parse.FromCloudFormation.getArray(CfnProjectArtifactsPropertyFromCloudFormation)(properties.SecondaryArtifacts) : undefined); ret.addPropertyResult('secondarySources', 'SecondarySources', properties.SecondarySources != null ? cfn_parse.FromCloudFormation.getArray(CfnProjectSourcePropertyFromCloudFormation)(properties.SecondarySources) : undefined); ret.addPropertyResult('secondarySourceVersions', 'SecondarySourceVersions', properties.SecondarySourceVersions != null ? cfn_parse.FromCloudFormation.getArray(CfnProjectProjectSourceVersionPropertyFromCloudFormation)(properties.SecondarySourceVersions) : undefined); ret.addPropertyResult('sourceVersion', 'SourceVersion', properties.SourceVersion != null ? cfn_parse.FromCloudFormation.getString(properties.SourceVersion) : undefined); ret.addPropertyResult('tags', 'Tags', properties.Tags != null ? cfn_parse.FromCloudFormation.getArray(cfn_parse.FromCloudFormation.getCfnTag)(properties.Tags) : undefined); ret.addPropertyResult('timeoutInMinutes', 'TimeoutInMinutes', properties.TimeoutInMinutes != null ? cfn_parse.FromCloudFormation.getNumber(properties.TimeoutInMinutes) : undefined); ret.addPropertyResult('triggers', 'Triggers', properties.Triggers != null ? CfnProjectProjectTriggersPropertyFromCloudFormation(properties.Triggers) : undefined); ret.addPropertyResult('visibility', 'Visibility', properties.Visibility != null ? cfn_parse.FromCloudFormation.getString(properties.Visibility) : undefined); ret.addPropertyResult('vpcConfig', 'VpcConfig', properties.VpcConfig != null ? CfnProjectVpcConfigPropertyFromCloudFormation(properties.VpcConfig) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * A CloudFormation `AWS::CodeBuild::Project` * * The `AWS::CodeBuild::Project` resource configures how AWS CodeBuild builds your source code. For example, it tells CodeBuild where to get the source code and which build environment to use. * * > To unset or remove a project value via CFN, explicitly provide the attribute with value as empty input. * * @cloudformationResource AWS::CodeBuild::Project * @stability external * * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html */ class CfnProject extends cdk.CfnResource { /** * Create a new `AWS::CodeBuild::Project`. * * @param scope - scope in which this resource is defined * @param id - scoped id of the resource * @param props - resource properties */ constructor(scope, id, props) { super(scope, id, { type: CfnProject.CFN_RESOURCE_TYPE_NAME, properties: props }); try { jsiiDeprecationWarnings._aws_cdk_aws_codebuild_CfnProjectProps(props); } catch (error) { if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") { Error.captureStackTrace(error, CfnProject); } throw error; } cdk.requireProperty(props, 'artifacts', this); cdk.requireProperty(props, 'environment', this); cdk.requireProperty(props, 'serviceRole', this); cdk.requireProperty(props, 'source', this); this.attrArn = cdk.Token.asString(this.getAtt('Arn')); this.artifacts = props.artifacts; this.environment = props.environment; this.serviceRole = props.serviceRole; this.source = props.source; this.badgeEnabled = props.badgeEnabled; this.buildBatchConfig = props.buildBatchConfig; this.cache = props.cache; this.concurrentBuildLimit = props.concurrentBuildLimit; this.description = props.description; this.encryptionKey = props.encryptionKey; this.fileSystemLocations = props.fileSystemLocations; this.logsConfig = props.logsConfig; this.name = props.name; this.queuedTimeoutInMinutes = props.queuedTimeoutInMinutes; this.resourceAccessRole = props.resourceAccessRole; this.secondaryArtifacts = props.secondaryArtifacts; this.secondarySources = props.secondarySources; this.secondarySourceVersions = props.secondarySourceVersions; this.sourceVersion = props.sourceVersion; this.tags = new cdk.TagManager(cdk.TagType.STANDARD, "AWS::CodeBuild::Project", props.tags, { tagPropertyName: 'tags' }); this.timeoutInMinutes = props.timeoutInMinutes; this.triggers = props.triggers; this.visibility = props.visibility; this.vpcConfig = props.vpcConfig; } /** * A factory method that creates a new instance of this class from an object * containing the CloudFormation properties of this resource. * Used in the @aws-cdk/cloudformation-include module. * * @internal */ static _fromCloudFormation(scope, id, resourceAttributes, options) { resourceAttributes = resourceAttributes || {}; const resourceProperties = options.parser.parseValue(resourceAttributes.Properties); const propsResult = CfnProjectPropsFromCloudFormation(resourceProperties); const ret = new CfnProject(scope, id, propsResult.value); for (const [propKey, propVal] of Object.entries(propsResult.extraProperties)) { ret.addPropertyOverride(propKey, propVal); } options.parser.handleAttributes(ret, resourceAttributes, id); return ret; } /** * Examines the CloudFormation resource and discloses attributes. * * @param inspector - tree inspector to collect and process attributes * */ inspect(inspector) { inspector.addAttribute("aws:cdk:cloudformation:type", CfnProject.CFN_RESOURCE_TYPE_NAME); inspector.addAttribute("aws:cdk:cloudformation:props", this.cfnProperties); } get cfnProperties() { return { artifacts: this.artifacts, environment: this.environment, serviceRole: this.serviceRole, source: this.source, badgeEnabled: this.badgeEnabled, buildBatchConfig: this.buildBatchConfig, cache: this.cache, concurrentBuildLimit: this.concurrentBuildLimit, description: this.description, encryptionKey: this.encryptionKey, fileSystemLocations: this.fileSystemLocations, logsConfig: this.logsConfig, name: this.name, queuedTimeoutInMinutes: this.queuedTimeoutInMinutes, resourceAccessRole: this.resourceAccessRole, secondaryArtifacts: this.secondaryArtifacts, secondarySources: this.secondarySources, secondarySourceVersions: this.secondarySourceVersions, sourceVersion: this.sourceVersion, tags: this.tags.renderTags(), timeoutInMinutes: this.timeoutInMinutes, triggers: this.triggers, visibility: this.visibility, vpcConfig: this.vpcConfig, }; } renderProperties(props) { return cfnProjectPropsToCloudFormation(props); } } exports.CfnProject = CfnProject; _a = JSII_RTTI_SYMBOL_1; CfnProject[_a] = { fqn: "@aws-cdk/aws-codebuild.CfnProject", version: "1.204.0" }; /** * The CloudFormation resource type name for this resource class. */ CfnProject.CFN_RESOURCE_TYPE_NAME = "AWS::CodeBuild::Project"; /** * Determine whether the given properties match those of a `ArtifactsProperty` * * @param properties - the TypeScript properties of a `ArtifactsProperty` * * @returns the result of the validation. */ function CfnProject_ArtifactsPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('artifactIdentifier', cdk.validateString)(properties.artifactIdentifier)); errors.collect(cdk.propertyValidator('encryptionDisabled', cdk.validateBoolean)(properties.encryptionDisabled)); errors.collect(cdk.propertyValidator('location', cdk.validateString)(properties.location)); errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name)); errors.collect(cdk.propertyValidator('namespaceType', cdk.validateString)(properties.namespaceType)); errors.collect(cdk.propertyValidator('overrideArtifactName', cdk.validateBoolean)(properties.overrideArtifactName)); errors.collect(cdk.propertyValidator('packaging', cdk.validateString)(properties.packaging)); errors.collect(cdk.propertyValidator('path', cdk.validateString)(properties.path)); errors.collect(cdk.propertyValidator('type', cdk.requiredValidator)(properties.type)); errors.collect(cdk.propertyValidator('type', cdk.validateString)(properties.type)); return errors.wrap('supplied properties not correct for "ArtifactsProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::CodeBuild::Project.Artifacts` resource * * @param properties - the TypeScript properties of a `ArtifactsProperty` * * @returns the AWS CloudFormation properties of an `AWS::CodeBuild::Project.Artifacts` resource. */ // @ts-ignore TS6133 function cfnProjectArtifactsPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnProject_ArtifactsPropertyValidator(properties).assertSuccess(); return { ArtifactIdentifier: cdk.stringToCloudFormation(properties.artifactIdentifier), EncryptionDisabled: cdk.booleanToCloudFormation(properties.encryptionDisabled), Location: cdk.stringToCloudFormation(properties.location), Name: cdk.stringToCloudFormation(properties.name), NamespaceType: cdk.stringToCloudFormation(properties.namespaceType), OverrideArtifactName: cdk.booleanToCloudFormation(properties.overrideArtifactName), Packaging: cdk.stringToCloudFormation(properties.packaging), Path: cdk.stringToCloudFormation(properties.path), Type: cdk.stringToCloudFormation(properties.type), }; } // @ts-ignore TS6133 function CfnProjectArtifactsPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('artifactIdentifier', 'ArtifactIdentifier', properties.ArtifactIdentifier != null ? cfn_parse.FromCloudFormation.getString(properties.ArtifactIdentifier) : undefined); ret.addPropertyResult('encryptionDisabled', 'EncryptionDisabled', properties.EncryptionDisabled != null ? cfn_parse.FromCloudFormation.getBoolean(properties.EncryptionDisabled) : undefined); ret.addPropertyResult('location', 'Location', properties.Location != null ? cfn_parse.FromCloudFormation.getString(properties.Location) : undefined); ret.addPropertyResult('name', 'Name', properties.Name != null ? cfn_parse.FromCloudFormation.getString(properties.Name) : undefined); ret.addPropertyResult('namespaceType', 'NamespaceType', properties.NamespaceType != null ? cfn_parse.FromCloudFormation.getString(properties.NamespaceType) : undefined); ret.addPropertyResult('overrideArtifactName', 'OverrideArtifactName', properties.OverrideArtifactName != null ? cfn_parse.FromCloudFormation.getBoolean(properties.OverrideArtifactName) : undefined); ret.addPropertyResult('packaging', 'Packaging', properties.Packaging != null ? cfn_parse.FromCloudFormation.getString(properties.Packaging) : undefined); ret.addPropertyResult('path', 'Path', properties.Path != null ? cfn_parse.FromCloudFormation.getString(properties.Path) : undefined); ret.addPropertyResult('type', 'Type', cfn_parse.FromCloudFormation.getString(properties.Type)); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `BatchRestrictionsProperty` * * @param properties - the TypeScript properties of a `BatchRestrictionsProperty` * * @returns the result of the validation. */ function CfnProject_BatchRestrictionsPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('computeTypesAllowed', cdk.listValidator(cdk.validateString))(properties.computeTypesAllowed)); errors.collect(cdk.propertyValidator('maximumBuildsAllowed', cdk.validateNumber)(properties.maximumBuildsAllowed)); return errors.wrap('supplied properties not correct for "BatchRestrictionsProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::CodeBuild::Project.BatchRestrictions` resource * * @param properties - the TypeScript properties of a `BatchRestrictionsProperty` * * @returns the AWS CloudFormation properties of an `AWS::CodeBuild::Project.BatchRestrictions` resource. */ // @ts-ignore TS6133 function cfnProjectBatchRestrictionsPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnProject_BatchRestrictionsPropertyValidator(properties).assertSuccess(); return { ComputeTypesAllowed: cdk.listMapper(cdk.stringToCloudFormation)(properties.computeTypesAllowed), MaximumBuildsAllowed: cdk.numberToCloudFormation(properties.maximumBuildsAllowed), }; } // @ts-ignore TS6133 function CfnProjectBatchRestrictionsPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('computeTypesAllowed', 'ComputeTypesAllowed', properties.ComputeTypesAllowed != null ? cfn_parse.FromCloudFormation.getStringArray(properties.ComputeTypesAllowed) : undefined); ret.addPropertyResult('maximumBuildsAllowed', 'MaximumBuildsAllowed', properties.MaximumBuildsAllowed != null ? cfn_parse.FromCloudFormation.getNumber(properties.MaximumBuildsAllowed) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `BuildStatusConfigProperty` * * @param properties - the TypeScript properties of a `BuildStatusConfigProperty` * * @returns the result of the validation. */ function CfnProject_BuildStatusConfigPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('context', cdk.validateString)(properties.context)); errors.collect(cdk.propertyValidator('targetUrl', cdk.validateString)(properties.targetUrl)); return errors.wrap('supplied properties not correct for "BuildStatusConfigProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::CodeBuild::Project.BuildStatusConfig` resource * * @param properties - the TypeScript properties of a `BuildStatusConfigProperty` * * @returns the AWS CloudFormation properties of an `AWS::CodeBuild::Project.BuildStatusConfig` resource. */ // @ts-ignore TS6133 function cfnProjectBuildStatusConfigPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnProject_BuildStatusConfigPropertyValidator(properties).assertSuccess(); return { Context: cdk.stringToCloudFormation(properties.context), TargetUrl: cdk.stringToCloudFormation(properties.targetUrl), }; } // @ts-ignore TS6133 function CfnProjectBuildStatusConfigPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('context', 'Context', properties.Context != null ? cfn_parse.FromCloudFormation.getString(properties.Context) : undefined); ret.addPropertyResult('targetUrl', 'TargetUrl', properties.TargetUrl != null ? cfn_parse.FromCloudFormation.getString(properties.TargetUrl) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `CloudWatchLogsConfigProperty` * * @param properties - the TypeScript properties of a `CloudWatchLogsConfigProperty` * * @returns the result of the validation. */ function CfnProject_CloudWatchLogsConfigPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('groupName', cdk.validateString)(properties.groupName)); errors.collect(cdk.propertyValidator('status', cdk.requiredValidator)(properties.status)); errors.collect(cdk.propertyValidator('status', cdk.validateString)(properties.status)); errors.collect(cdk.propertyValidator('streamName', cdk.validateString)(properties.streamName)); return errors.wrap('supplied properties not correct for "CloudWatchLogsConfigProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::CodeBuild::Project.CloudWatchLogsConfig` resource * * @param properties - the TypeScript properties of a `CloudWatchLogsConfigProperty` * * @returns the AWS CloudFormation properties of an `AWS::CodeBuild::Project.CloudWatchLogsConfig` resource. */ // @ts-ignore TS6133 function cfnProjectCloudWatchLogsConfigPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnProject_CloudWatchLogsConfigPropertyValidator(properties).assertSuccess(); return { GroupName: cdk.stringToCloudFormation(properties.groupName), Status: cdk.stringToCloudFormation(properties.status), StreamName: cdk.stringToCloudFormation(properties.streamName), }; } // @ts-ignore TS6133 function CfnProjectCloudWatchLogsConfigPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('groupName', 'GroupName', properties.GroupName != null ? cfn_parse.FromCloudFormation.getString(properties.GroupName) : undefined); ret.addPropertyResult('status', 'Status', cfn_parse.FromCloudFormation.getString(properties.Status)); ret.addPropertyResult('streamName', 'StreamName', properties.StreamName != null ? cfn_parse.FromCloudFormation.getString(properties.StreamName) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `EnvironmentProperty` * * @param properties - the TypeScript properties of a `EnvironmentProperty` * * @returns the result of the validation. */ function CfnProject_EnvironmentPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('certificate', cdk.validateString)(properties.certificate)); errors.collect(cdk.propertyValidator('computeType', cdk.requiredValidator)(properties.computeType)); errors.collect(cdk.propertyValidator('computeType', cdk.validateString)(properties.computeType)); errors.collect(cdk.propertyValidator('environmentVariables', cdk.listValidator(CfnProject_EnvironmentVariablePropertyValidator))(properties.environmentVariables)); errors.collect(cdk.propertyValidator('image', cdk.requiredValidator)(properties.image)); errors.collect(cdk.propertyValidator('image', cdk.validateString)(properties.image)); errors.collect(cdk.propertyValidator('imagePullCredentialsType', cdk.validateString)(properties.imagePullCredentialsType)); errors.collect(cdk.propertyValidator('privilegedMode', cdk.validateBoolean)(properties.privilegedMode)); errors.collect(cdk.propertyValidator('registryCredential', CfnProject_RegistryCredentialPropertyValidator)(properties.registryCredential)); errors.collect(cdk.propertyValidator('type', cdk.requiredValidator)(properties.type)); errors.collect(cdk.propertyValidator('type', cdk.validateString)(properties.type)); return errors.wrap('supplied properties not correct for "EnvironmentProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::CodeBuild::Project.Environment` resource * * @param properties - the TypeScript properties of a `EnvironmentProperty` * * @returns the AWS CloudFormation properties of an `AWS::CodeBuild::Project.Environment` resource. */ // @ts-ignore TS6133 function cfnProjectEnvironmentPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnProject_EnvironmentPropertyValidator(properties).assertSuccess(); return { Certificate: cdk.stringToCloudFormation(properties.certificate), ComputeType: cdk.stringToCloudFormation(properties.computeType), EnvironmentVariables: cdk.listMapper(cfnProjectEnvironmentVariablePropertyToCloudFormation)(properties.environmentVariables), Image: cdk.stringToCloudFormation(properties.image), ImagePullCredentialsType: cdk.stringToCloudFormation(properties.imagePullCredentialsType), PrivilegedMode: cdk.booleanToCloudFormation(properties.privilegedMode), RegistryCredential: cfnProjectRegistryCredentialPropertyToCloudFormation(properties.registryCredential), Type: cdk.stringToCloudFormation(properties.type), }; } // @ts-ignore TS6133 function CfnProjectEnvironmentPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('certificate', 'Certificate', properties.Certificate != null ? cfn_parse.FromCloudFormation.getString(properties.Certificate) : undefined); ret.addPropertyResult('computeType', 'ComputeType', cfn_parse.FromCloudFormation.getString(properties.ComputeType)); ret.addPropertyResult('environmentVariables', 'EnvironmentVariables', properties.EnvironmentVariables != null ? cfn_parse.FromCloudFormation.getArray(CfnProjectEnvironmentVariablePropertyFromCloudFormation)(properties.EnvironmentVariables) : undefined); ret.addPropertyResult('image', 'Image', cfn_parse.FromCloudFormation.getString(properties.Image)); ret.addPropertyResult('imagePullCredentialsType', 'ImagePullCredentialsType', properties.ImagePullCredentialsType != null ? cfn_parse.FromCloudFormation.getString(properties.ImagePullCredentialsType) : undefined); ret.addPropertyResult('privilegedMode', 'PrivilegedMode', properties.PrivilegedMode != null ? cfn_parse.FromCloudFormation.getBoolean(properties.PrivilegedMode) : undefined); ret.addPropertyResult('registryCredential', 'RegistryCredential', properties.RegistryCredential != null ? CfnProjectRegistryCredentialPropertyFromCloudFormation(properties.RegistryCredential) : undefined); ret.addPropertyResult('type', 'Type', cfn_parse.FromCloudFormation.getString(properties.Type)); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `EnvironmentVariableProperty` * * @param properties - the TypeScript properties of a `EnvironmentVariableProperty` * * @returns the result of the validation. */ function CfnProject_EnvironmentVariablePropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('name', cdk.requiredValidator)(properties.name)); errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name)); errors.collect(cdk.propertyValidator('type', cdk.validateString)(properties.type)); errors.collect(cdk.propertyValidator('value', cdk.requiredValidator)(properties.value)); errors.collect(cdk.propertyValidator('value', cdk.validateString)(properties.value)); return errors.wrap('supplied properties not correct for "EnvironmentVariableProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::CodeBuild::Project.EnvironmentVariable` resource * * @param properties - the TypeScript properties of a `EnvironmentVariableProperty` * * @returns the AWS CloudFormation properties of an `AWS::CodeBuild::Project.EnvironmentVariable` resource. */ // @ts-ignore TS6133 function cfnProjectEnvironmentVariablePropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnProject_EnvironmentVariablePropertyValidator(properties).assertSuccess(); return { Name: cdk.stringToCloudFormation(properties.name), Type: cdk.stringToCloudFormation(properties.type), Value: cdk.stringToCloudFormation(properties.value), }; } // @ts-ignore TS6133 function CfnProjectEnvironmentVariablePropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('name', 'Name', cfn_parse.FromCloudFormation.getString(properties.Name)); ret.addPropertyResult('type', 'Type', properties.Type != null ? cfn_parse.FromCloudFormation.getString(properties.Type) : undefined); ret.addPropertyResult('value', 'Value', cfn_parse.FromCloudFormation.getString(properties.Value)); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `GitSubmodulesConfigProperty` * * @param properties - the TypeScript properties of a `GitSubmodulesConfigProperty` * * @returns the result of the validation. */ function CfnProject_GitSubmodulesConfigPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('fetchSubmodules', cdk.requiredValidator)(properties.fetchSubmodules)); errors.collect(cdk.propertyValidator('fetchSubmodules', cdk.validateBoolean)(properties.fetchSubmodules)); return errors.wrap('supplied properties not correct for "GitSubmodulesConfigProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::CodeBuild::Project.GitSubmodulesConfig` resource * * @param properties - the TypeScript properties of a `GitSubmodulesConfigProperty` * * @returns the AWS CloudFormation properties of an `AWS::CodeBuild::Project.GitSubmodulesConfig` resource. */ // @ts-ignore TS6133 function cfnProjectGitSubmodulesConfigPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnProject_GitSubmodulesConfigPropertyValidator(properties).assertSuccess(); return { FetchSubmodules: cdk.booleanToCloudFormation(properties.fetchSubmodules), }; } // @ts-ignore TS6133 function CfnProjectGitSubmodulesConfigPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('fetchSubmodules', 'FetchSubmodules', cfn_parse.FromCloudFormation.getBoolean(properties.FetchSubmodules)); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `LogsConfigProperty` * * @param properties - the TypeScript properties of a `LogsConfigProperty` * * @returns the result of the validation. */ function CfnProject_LogsConfigPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('cloudWatchLogs', CfnProject_CloudWatchLogsConfigPropertyValidator)(properties.cloudWatchLogs)); errors.collect(cdk.propertyValidator('s3Logs', CfnProject_S3LogsConfigPropertyValidator)(properties.s3Logs)); return errors.wrap('supplied properties not correct for "LogsConfigProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::CodeBuild::Project.LogsConfig` resource * * @param properties - the TypeScript properties of a `LogsConfigProperty` * * @returns the AWS CloudFormation properties of an `AWS::CodeBuild::Project.LogsConfig` resource. */ // @ts-ignore TS6133 function cfnProjectLogsConfigPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnProject_LogsConfigPropertyValidator(properties).assertSuccess(); return { CloudWatchLogs: cfnProjectCloudWatchLogsConfigPropertyToCloudFormation(properties.cloudWatchLogs), S3Logs: cfnProjectS3LogsConfigPropertyToCloudFormation(properties.s3Logs), }; } // @ts-ignore TS6133 function CfnProjectLogsConfigPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('cloudWatchLogs', 'CloudWatchLogs', properties.CloudWatchLogs != null ? CfnProjectCloudWatchLogsConfigPropertyFromCloudFormation(properties.CloudWatchLogs) : undefined); ret.addPropertyResult('s3Logs', 'S3Logs', properties.S3Logs != null ? CfnProjectS3LogsConfigPropertyFromCloudFormation(properties.S3Logs) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `ProjectBuildBatchConfigProperty` * * @param properties - the TypeScript properties of a `ProjectBuildBatchConfigProperty` * * @returns the result of the validation. */ function CfnProject_ProjectBuildBatchConfigPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('batchReportMode', cdk.validateString)(properties.batchReportMode)); errors.collect(cdk.propertyValidator('combineArtifacts', cdk.validateBoolean)(properties.combineArtifacts)); errors.collect(cdk.propertyValidator('restrictions', CfnProject_BatchRestrictionsPropertyValidator)(properties.restrictions)); errors.collect(cdk.propertyValidator('serviceRole', cdk.validateString)(properties.serviceRole)); errors.collect(cdk.propertyValidator('timeoutInMins', cdk.validateNumber)(properties.timeoutInMins)); return errors.wrap('supplied properties not correct for "ProjectBuildBatchConfigProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::CodeBuild::Project.ProjectBuildBatchConfig` resource * * @param properties - the TypeScript properties of a `ProjectBuildBatchConfigProperty` * * @returns the AWS CloudFormation properties of an `AWS::CodeBuild::Project.ProjectBuildBatchConfig` resource. */ // @ts-ignore TS6133 function cfnProjectProjectBuildBatchConfigPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnProject_ProjectBuildBatchConfigPropertyValidator(properties).assertSuccess(); return { BatchReportMode: cdk.stringToCloudFormation(properties.batchReportMode), CombineArtifacts: cdk.booleanToCloudFormation(properties.combineArtifacts), Restrictions: cfnProjectBatchRestrictionsPropertyToCloudFormation(properties.restrictions), ServiceRole: cdk.stringToCloudFormation(properties.serviceRole), TimeoutInMins: cdk.numberToCloudFormation(properties.timeoutInMins), }; } // @ts-ignore TS6133 function CfnProjectProjectBuildBatchConfigPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('batchReportMode', 'BatchReportMode', properties.BatchReportMode != null ? cfn_parse.FromCloudFormation.getString(properties.BatchReportMode) : undefined); ret.addPropertyResult('combineArtifacts', 'CombineArtifacts', properties.CombineArtifacts != null ? cfn_parse.FromCloudFormation.getBoolean(properties.CombineArtifacts) : undefined); ret.addPropertyResult('restrictions', 'Restrictions', properties.Restrictions != null ? CfnProjectBatchRestrictionsPropertyFromCloudFormation(properties.Restrictions) : undefined); ret.addPropertyResult('serviceRole', 'ServiceRole', properties.ServiceRole != null ? cfn_parse.FromCloudFormation.getString(properties.ServiceRole) : undefined); ret.addPropertyResult('timeoutInMins', 'TimeoutInMins', properties.TimeoutInMins != null ? cfn_parse.FromCloudFormation.getNumber(properties.TimeoutInMins) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `ProjectCacheProperty` * * @param properties - the TypeScript properties of a `ProjectCacheProperty` * * @returns the result of the validation. */ function CfnProject_ProjectCachePropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('location', cdk.validateString)(properties.location)); errors.collect(cdk.propertyValidator('modes', cdk.listValidator(cdk.validateString))(properties.modes)); errors.collect(cdk.propertyValidator('type', cdk.requiredValidator)(properties.type)); errors.collect(cdk.propertyValidator('type', cdk.validateString)(properties.type)); return errors.wrap('supplied properties not correct for "ProjectCacheProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::CodeBuild::Project.ProjectCache` resource * * @param properties - the TypeScript properties of a `ProjectCacheProperty` * * @returns the AWS CloudFormation properties of an `AWS::CodeBuild::Project.ProjectCache` resource. */ // @ts-ignore TS6133 function cfnProjectProjectCachePropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnProject_ProjectCachePropertyValidator(properties).assertSuccess(); return { Location: cdk.stringToCloudFormation(properties.location), Modes: cdk.listMapper(cdk.stringToCloudFormation)(properties.modes), Type: cdk.stringToCloudFormation(properties.type), }; } // @ts-ignore TS6133 function CfnProjectProjectCachePropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('location', 'Location', properties.Location != null ? cfn_parse.FromCloudFormation.getString(properties.Location) : undefined); ret.addPropertyResult('modes', 'Modes', properties.Modes != null ? cfn_parse.FromCloudFormation.getStringArray(properties.Modes) : undefined); ret.addPropertyResult('type', 'Type', cfn_parse.FromCloudFormation.getString(properties.Type)); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `ProjectFileSystemLocationProperty` * * @param properties - the TypeScript properties of a `ProjectFileSystemLocationProperty` * * @returns the result of the validation. */ function CfnProject_ProjectFileSystemLocationPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, b