CodeRepository class
Provides a SageMaker AI Code Repository resource.
Example Usage
Basic usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.sagemaker.CodeRepository("example", {
gitConfig: {
repositoryUrl: "https://github.com/github/docs.git",
},
codeRepositoryName: "example",
});
import pulumi
import pulumi_aws as aws
example = aws.sagemaker.CodeRepository("example",
git_config={
"repository_url": "https://github.com/github/docs.git",
},
code_repository_name="example")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Sagemaker.CodeRepository("example", new()
{
GitConfig = new Aws.Sagemaker.Inputs.CodeRepositoryGitConfigArgs
{
RepositoryUrl = "https://github.com/github/docs.git",
},
CodeRepositoryName = "example",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/sagemaker"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := sagemaker.NewCodeRepository(ctx, "example", &sagemaker.CodeRepositoryArgs{
GitConfig: &sagemaker.CodeRepositoryGitConfigArgs{
RepositoryUrl: pulumi.String("https://github.com/github/docs.git"),
},
CodeRepositoryName: pulumi.String("example"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_sagemaker_coderepository" "example" {
git_config = {
repository_url = "https://github.com/github/docs.git"
}
code_repository_name = "example"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sagemaker.CodeRepository;
import com.pulumi.aws.sagemaker.CodeRepositoryArgs;
import com.pulumi.aws.sagemaker.inputs.CodeRepositoryGitConfigArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new CodeRepository("example", CodeRepositoryArgs.builder()
.gitConfig(CodeRepositoryGitConfigArgs.builder()
.repositoryUrl("https://github.com/github/docs.git")
.build())
.codeRepositoryName("example")
.build());
}
}
resources:
example:
type: aws:sagemaker:CodeRepository
properties:
gitConfig:
repositoryUrl: https://github.com/github/docs.git
codeRepositoryName: example
Example with Secret
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.secretsmanager.Secret("example", {name: "example"});
const exampleSecretVersion = new aws.secretsmanager.SecretVersion("example", {
secretId: example.id,
secretString: JSON.stringify({
username: "example",
password: "example",
}),
});
const exampleCodeRepository = new aws.sagemaker.CodeRepository("example", {
gitConfig: {
repositoryUrl: "https://github.com/github/docs.git",
secretArn: example.arn,
},
codeRepositoryName: "example",
}, {
dependsOn: [exampleSecretVersion],
});
import pulumi
import json
import pulumi_aws as aws
example = aws.secretsmanager.Secret("example", name="example")
example_secret_version = aws.secretsmanager.SecretVersion("example",
secret_id=example.id,
secret_string=json.dumps({
"username": "example",
"password": "example",
}))
example_code_repository = aws.sagemaker.CodeRepository("example",
git_config={
"repository_url": "https://github.com/github/docs.git",
"secret_arn": example.arn,
},
code_repository_name="example",
opts = pulumi.ResourceOptions(depends_on=[example_secret_version]))
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.SecretsManager.Secret("example", new()
{
Name = "example",
});
var exampleSecretVersion = new Aws.SecretsManager.SecretVersion("example", new()
{
SecretId = example.Id,
SecretString = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["username"] = "example",
["password"] = "example",
}),
});
var exampleCodeRepository = new Aws.Sagemaker.CodeRepository("example", new()
{
GitConfig = new Aws.Sagemaker.Inputs.CodeRepositoryGitConfigArgs
{
RepositoryUrl = "https://github.com/github/docs.git",
SecretArn = example.Arn,
},
CodeRepositoryName = "example",
}, new CustomResourceOptions
{
DependsOn =
{
exampleSecretVersion,
},
});
});
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/sagemaker"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/secretsmanager"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := secretsmanager.NewSecret(ctx, "example", &secretsmanager.SecretArgs{
Name: pulumi.String("example"),
})
if err != nil {
return err
}
tmpJSON0, err := json.Marshal(map[string]string{
"username": "example",
"password": "example",
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
exampleSecretVersion, err := secretsmanager.NewSecretVersion(ctx, "example", &secretsmanager.SecretVersionArgs{
SecretId: example.ID().ToIDOutput().ToStringOutput(),
SecretString: pulumi.String(json0),
})
if err != nil {
return err
}
_, err = sagemaker.NewCodeRepository(ctx, "example", &sagemaker.CodeRepositoryArgs{
GitConfig: &sagemaker.CodeRepositoryGitConfigArgs{
RepositoryUrl: pulumi.String("https://github.com/github/docs.git"),
SecretArn: example.Arn,
},
CodeRepositoryName: pulumi.String("example"),
}, pulumi.DependsOn([]pulumi.Resource{
exampleSecretVersion,
}))
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_secretsmanager_secret" "example" {
name = "example"
}
resource "aws_secretsmanager_secretversion" "example" {
secret_id = aws_secretsmanager_secret.example.id
secret_string = jsonencode({
"username" = "example"
"password" = "example"
})
}
resource "aws_sagemaker_coderepository" "example" {
depends_on = [aws_secretsmanager_secretversion.example]
git_config = {
repository_url = "https://github.com/github/docs.git"
secret_arn = aws_secretsmanager_secret.example.arn
}
code_repository_name = "example"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.secretsmanager.Secret;
import com.pulumi.aws.secretsmanager.SecretArgs;
import com.pulumi.aws.secretsmanager.SecretVersion;
import com.pulumi.aws.secretsmanager.SecretVersionArgs;
import com.pulumi.aws.sagemaker.CodeRepository;
import com.pulumi.aws.sagemaker.CodeRepositoryArgs;
import com.pulumi.aws.sagemaker.inputs.CodeRepositoryGitConfigArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import com.pulumi.resources.CustomResourceOptions;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new Secret("example", SecretArgs.builder()
.name("example")
.build());
var exampleSecretVersion = new SecretVersion("exampleSecretVersion", SecretVersionArgs.builder()
.secretId(example.id())
.secretString(serializeJson(
jsonObject(
jsonProperty("username", "example"),
jsonProperty("password", "example")
)))
.build());
var exampleCodeRepository = new CodeRepository("exampleCodeRepository", CodeRepositoryArgs.builder()
.gitConfig(CodeRepositoryGitConfigArgs.builder()
.repositoryUrl("https://github.com/github/docs.git")
.secretArn(example.arn())
.build())
.codeRepositoryName("example")
.build(), CustomResourceOptions.builder()
.dependsOn(exampleSecretVersion)
.build());
}
}
resources:
example:
type: aws:secretsmanager:Secret
properties:
name: example
exampleSecretVersion:
type: aws:secretsmanager:SecretVersion
name: example
properties:
secretId: ${example.id}
secretString:
fn::toJSON:
username: example
password: example
exampleCodeRepository:
type: aws:sagemaker:CodeRepository
name: example
properties:
gitConfig:
repositoryUrl: https://github.com/github/docs.git
secretArn: ${example.arn}
codeRepositoryName: example
options:
dependsOn:
- ${exampleSecretVersion}
Import
Using pulumi import, import SageMaker AI Code Repositories using the name. For example:
$ pulumi import aws:sagemaker/codeRepository:CodeRepository test_code_repository my-code-repo
Constructors
- CodeRepository(String name, {CodeRepositoryArgs? args, CustomResourceOptions? options})
-
Creates a new CodeRepository.
nameThe Pulumi resource name.argsArguments used to configure this CodeRepository. The set of arguments for CodeRepository.optionsResource options controlling this resource's behavior. - CodeRepository.reference(String urn)
- Creates a typed reference to an existing CodeRepository resource.
Properties
-
arn
↔ Output<
String> -
ARN assigned by AWS to this Code Repository.
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
codeRepositoryName
↔ Output<
String> -
The name of the Code Repository (must be unique).
latefinal
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
gitConfig
↔ Output<
CodeRepositoryGitConfig> -
Specifies details about the repository. see Git Config details below.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
A map of tags to assign to the resource. If configured with a provider
defaultTagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.latefinal -
A map of tags assigned to the resource, including those inherited from the provider
defaultTagsconfiguration block.latefinal -
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {CodeRepositoryState? state, CustomResourceOptions? options}) → CodeRepository -
Gets an existing CodeRepository resource's state with the given
nameandid.