Skip to content
v2.276.0

CodeRepositoryProperty Struct ​

Describes a source code repository.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_apprunner as apprunner } from 'aws-cdk-lib';
const codeRepositoryProperty: apprunner.CfnService.CodeRepositoryProperty = {
  repositoryUrl: 'repositoryUrl',
  sourceCodeVersion: {
    type: 'type',
    value: 'value',
  },

  // the properties below are optional
  codeConfiguration: {
    configurationSource: 'configurationSource',

    // the properties below are optional
    codeConfigurationValues: {
      runtime: 'runtime',

      // the properties below are optional
      buildCommand: 'buildCommand',
      port: 'port',
      runtimeEnvironmentSecrets: [{
        name: 'name',
        value: 'value',
      }],
      runtimeEnvironmentVariables: [{
        name: 'name',
        value: 'value',
      }],
      startCommand: 'startCommand',
    },
  },
  sourceDirectory: 'sourceDirectory',
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_apprunner as apprunner

code_repository_property = apprunner.CfnService.CodeRepositoryProperty(
    repository_url="repositoryUrl",
    source_code_version=apprunner.CfnService.SourceCodeVersionProperty(
        type="type",
        value="value"
    ),

    # the properties below are optional
    code_configuration=apprunner.CfnService.CodeConfigurationProperty(
        configuration_source="configurationSource",

        # the properties below are optional
        code_configuration_values=apprunner.CfnService.CodeConfigurationValuesProperty(
            runtime="runtime",

            # the properties below are optional
            build_command="buildCommand",
            port="port",
            runtime_environment_secrets=[apprunner.CfnService.KeyValuePairProperty(
                name="name",
                value="value"
            )],
            runtime_environment_variables=[apprunner.CfnService.KeyValuePairProperty(
                name="name",
                value="value"
            )],
            start_command="startCommand"
        )
    ),
    source_directory="sourceDirectory"
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.apprunner.*;

CodeRepositoryProperty codeRepositoryProperty = CodeRepositoryProperty.builder()
        .repositoryUrl("repositoryUrl")
        .sourceCodeVersion(SourceCodeVersionProperty.builder()
                .type("type")
                .value("value")
                .build())

        // the properties below are optional
        .codeConfiguration(CodeConfigurationProperty.builder()
                .configurationSource("configurationSource")

                // the properties below are optional
                .codeConfigurationValues(CodeConfigurationValuesProperty.builder()
                        .runtime("runtime")

                        // the properties below are optional
                        .buildCommand("buildCommand")
                        .port("port")
                        .runtimeEnvironmentSecrets(List.of(KeyValuePairProperty.builder()
                                .name("name")
                                .value("value")
                                .build()))
                        .runtimeEnvironmentVariables(List.of(KeyValuePairProperty.builder()
                                .name("name")
                                .value("value")
                                .build()))
                        .startCommand("startCommand")
                        .build())
                .build())
        .sourceDirectory("sourceDirectory")
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.AppRunner;

var codeRepositoryProperty = new CodeRepositoryProperty {
    RepositoryUrl = "repositoryUrl",
    SourceCodeVersion = new SourceCodeVersionProperty {
        Type = "type",
        Value = "value"
    },

    // the properties below are optional
    CodeConfiguration = new CodeConfigurationProperty {
        ConfigurationSource = "configurationSource",

        // the properties below are optional
        CodeConfigurationValues = new CodeConfigurationValuesProperty {
            Runtime = "runtime",

            // the properties below are optional
            BuildCommand = "buildCommand",
            Port = "port",
            RuntimeEnvironmentSecrets = new [] { new KeyValuePairProperty {
                Name = "name",
                Value = "value"
            } },
            RuntimeEnvironmentVariables = new [] { new KeyValuePairProperty {
                Name = "name",
                Value = "value"
            } },
            StartCommand = "startCommand"
        }
    },
    SourceDirectory = "sourceDirectory"
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

codeRepositoryProperty := &CodeRepositoryProperty{
	RepositoryUrl: jsii.String("repositoryUrl"),
	SourceCodeVersion: &SourceCodeVersionProperty{
		Type: jsii.String("type"),
		Value: jsii.String("value"),
	},

	// the properties below are optional
	CodeConfiguration: &CodeConfigurationProperty{
		ConfigurationSource: jsii.String("configurationSource"),

		// the properties below are optional
		CodeConfigurationValues: &CodeConfigurationValuesProperty{
			Runtime: jsii.String("runtime"),

			// the properties below are optional
			BuildCommand: jsii.String("buildCommand"),
			Port: jsii.String("port"),
			RuntimeEnvironmentSecrets: []interface{}{
				&KeyValuePairProperty{
					Name: jsii.String("name"),
					Value: jsii.String("value"),
				},
			},
			RuntimeEnvironmentVariables: []interface{}{
				&KeyValuePairProperty{
					Name: jsii.String("name"),
					Value: jsii.String("value"),
				},
			},
			StartCommand: jsii.String("startCommand"),
		},
	},
	SourceDirectory: jsii.String("sourceDirectory"),
}

Properties ​

codeConfigurationoptionalIResolvable | CfnService.CodeConfigurationPropertycode_configurationoptionaltyping.Union[IResolvable, CodeConfigurationProperty]codeConfigurationoptionalIResolvableCodeConfigurationoptionalIResolvableCodeConfigurationoptionalinterface{}#
Configuration for building and running the service from a source code repository.

CodeConfiguration is required only for CreateService request.

repositoryUrlstringrepository_urlstrrepositoryUrlStringRepositoryUrlstringRepositoryUrl*stringrequired#
The location of the repository that contains the source code.
sourceCodeVersionIResolvable | CfnService.SourceCodeVersionPropertysource_code_versiontyping.Union[IResolvable, SourceCodeVersionProperty]sourceCodeVersionIResolvableSourceCodeVersionIResolvableSourceCodeVersioninterface{}required#
The version that should be used within the source code repository.
sourceDirectoryoptionalstringsource_directoryoptionalstrsourceDirectoryoptionalStringSourceDirectoryoptionalstringSourceDirectoryoptional*string#
The path of the directory that stores source code and configuration files.

The build and start commands also execute from here. The path is absolute from root and, if not specified, defaults to the repository root.