alicloud.pai.WorkspaceCodeSource
Explore with Pulumi AI
Provides a PAI Workspace Code Source resource.
For information about PAI Workspace Code Source and how to use it, see What is Code Source.
NOTE: Available since v1.236.0.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "terraform_example";
const defaultgklBnM = new alicloud.pai.WorkspaceWorkspace("defaultgklBnM", {
    description: "for-pop-example",
    displayName: "CodeSourceTest_1732796227",
    workspaceName: name,
    envTypes: ["prod"],
});
const _default = new alicloud.pai.WorkspaceCodeSource("default", {
    mountPath: "/mnt/code/dir_01/",
    codeRepo: "https://github.com/mattn/go-sqlite3.git",
    description: "desc-01",
    codeRepoAccessToken: "token-01",
    accessibility: "PRIVATE",
    displayName: "codesource-example-01",
    workspaceId: defaultgklBnM.id,
    codeBranch: "master",
    codeRepoUserName: "user-01",
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "terraform_example"
defaultgkl_bn_m = alicloud.pai.WorkspaceWorkspace("defaultgklBnM",
    description="for-pop-example",
    display_name="CodeSourceTest_1732796227",
    workspace_name=name,
    env_types=["prod"])
default = alicloud.pai.WorkspaceCodeSource("default",
    mount_path="/mnt/code/dir_01/",
    code_repo="https://github.com/mattn/go-sqlite3.git",
    description="desc-01",
    code_repo_access_token="token-01",
    accessibility="PRIVATE",
    display_name="codesource-example-01",
    workspace_id=defaultgkl_bn_m.id,
    code_branch="master",
    code_repo_user_name="user-01")
package main
import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/pai"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		name := "terraform_example"
		if param := cfg.Get("name"); param != "" {
			name = param
		}
		defaultgklBnM, err := pai.NewWorkspaceWorkspace(ctx, "defaultgklBnM", &pai.WorkspaceWorkspaceArgs{
			Description:   pulumi.String("for-pop-example"),
			DisplayName:   pulumi.String("CodeSourceTest_1732796227"),
			WorkspaceName: pulumi.String(name),
			EnvTypes: pulumi.StringArray{
				pulumi.String("prod"),
			},
		})
		if err != nil {
			return err
		}
		_, err = pai.NewWorkspaceCodeSource(ctx, "default", &pai.WorkspaceCodeSourceArgs{
			MountPath:           pulumi.String("/mnt/code/dir_01/"),
			CodeRepo:            pulumi.String("https://github.com/mattn/go-sqlite3.git"),
			Description:         pulumi.String("desc-01"),
			CodeRepoAccessToken: pulumi.String("token-01"),
			Accessibility:       pulumi.String("PRIVATE"),
			DisplayName:         pulumi.String("codesource-example-01"),
			WorkspaceId:         defaultgklBnM.ID(),
			CodeBranch:          pulumi.String("master"),
			CodeRepoUserName:    pulumi.String("user-01"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var name = config.Get("name") ?? "terraform_example";
    var defaultgklBnM = new AliCloud.Pai.WorkspaceWorkspace("defaultgklBnM", new()
    {
        Description = "for-pop-example",
        DisplayName = "CodeSourceTest_1732796227",
        WorkspaceName = name,
        EnvTypes = new[]
        {
            "prod",
        },
    });
    var @default = new AliCloud.Pai.WorkspaceCodeSource("default", new()
    {
        MountPath = "/mnt/code/dir_01/",
        CodeRepo = "https://github.com/mattn/go-sqlite3.git",
        Description = "desc-01",
        CodeRepoAccessToken = "token-01",
        Accessibility = "PRIVATE",
        DisplayName = "codesource-example-01",
        WorkspaceId = defaultgklBnM.Id,
        CodeBranch = "master",
        CodeRepoUserName = "user-01",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.pai.WorkspaceWorkspace;
import com.pulumi.alicloud.pai.WorkspaceWorkspaceArgs;
import com.pulumi.alicloud.pai.WorkspaceCodeSource;
import com.pulumi.alicloud.pai.WorkspaceCodeSourceArgs;
import java.util.List;
import java.util.ArrayList;
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) {
        final var config = ctx.config();
        final var name = config.get("name").orElse("terraform_example");
        var defaultgklBnM = new WorkspaceWorkspace("defaultgklBnM", WorkspaceWorkspaceArgs.builder()
            .description("for-pop-example")
            .displayName("CodeSourceTest_1732796227")
            .workspaceName(name)
            .envTypes("prod")
            .build());
        var default_ = new WorkspaceCodeSource("default", WorkspaceCodeSourceArgs.builder()
            .mountPath("/mnt/code/dir_01/")
            .codeRepo("https://github.com/mattn/go-sqlite3.git")
            .description("desc-01")
            .codeRepoAccessToken("token-01")
            .accessibility("PRIVATE")
            .displayName("codesource-example-01")
            .workspaceId(defaultgklBnM.id())
            .codeBranch("master")
            .codeRepoUserName("user-01")
            .build());
    }
}
configuration:
  name:
    type: string
    default: terraform_example
resources:
  defaultgklBnM:
    type: alicloud:pai:WorkspaceWorkspace
    properties:
      description: for-pop-example
      displayName: CodeSourceTest_1732796227
      workspaceName: ${name}
      envTypes:
        - prod
  default:
    type: alicloud:pai:WorkspaceCodeSource
    properties:
      mountPath: /mnt/code/dir_01/
      codeRepo: https://github.com/mattn/go-sqlite3.git
      description: desc-01
      codeRepoAccessToken: token-01
      accessibility: PRIVATE
      displayName: codesource-example-01
      workspaceId: ${defaultgklBnM.id}
      codeBranch: master
      codeRepoUserName: user-01
Create WorkspaceCodeSource Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new WorkspaceCodeSource(name: string, args: WorkspaceCodeSourceArgs, opts?: CustomResourceOptions);@overload
def WorkspaceCodeSource(resource_name: str,
                        args: WorkspaceCodeSourceArgs,
                        opts: Optional[ResourceOptions] = None)
@overload
def WorkspaceCodeSource(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        accessibility: Optional[str] = None,
                        code_repo: Optional[str] = None,
                        display_name: Optional[str] = None,
                        mount_path: Optional[str] = None,
                        workspace_id: Optional[str] = None,
                        code_branch: Optional[str] = None,
                        code_commit: Optional[str] = None,
                        code_repo_access_token: Optional[str] = None,
                        code_repo_user_name: Optional[str] = None,
                        description: Optional[str] = None)func NewWorkspaceCodeSource(ctx *Context, name string, args WorkspaceCodeSourceArgs, opts ...ResourceOption) (*WorkspaceCodeSource, error)public WorkspaceCodeSource(string name, WorkspaceCodeSourceArgs args, CustomResourceOptions? opts = null)
public WorkspaceCodeSource(String name, WorkspaceCodeSourceArgs args)
public WorkspaceCodeSource(String name, WorkspaceCodeSourceArgs args, CustomResourceOptions options)
type: alicloud:pai:WorkspaceCodeSource
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args WorkspaceCodeSourceArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args WorkspaceCodeSourceArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args WorkspaceCodeSourceArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args WorkspaceCodeSourceArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args WorkspaceCodeSourceArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var workspaceCodeSourceResource = new AliCloud.Pai.WorkspaceCodeSource("workspaceCodeSourceResource", new()
{
    Accessibility = "string",
    CodeRepo = "string",
    DisplayName = "string",
    MountPath = "string",
    WorkspaceId = "string",
    CodeBranch = "string",
    CodeCommit = "string",
    CodeRepoAccessToken = "string",
    CodeRepoUserName = "string",
    Description = "string",
});
example, err := pai.NewWorkspaceCodeSource(ctx, "workspaceCodeSourceResource", &pai.WorkspaceCodeSourceArgs{
	Accessibility:       pulumi.String("string"),
	CodeRepo:            pulumi.String("string"),
	DisplayName:         pulumi.String("string"),
	MountPath:           pulumi.String("string"),
	WorkspaceId:         pulumi.String("string"),
	CodeBranch:          pulumi.String("string"),
	CodeCommit:          pulumi.String("string"),
	CodeRepoAccessToken: pulumi.String("string"),
	CodeRepoUserName:    pulumi.String("string"),
	Description:         pulumi.String("string"),
})
var workspaceCodeSourceResource = new WorkspaceCodeSource("workspaceCodeSourceResource", WorkspaceCodeSourceArgs.builder()
    .accessibility("string")
    .codeRepo("string")
    .displayName("string")
    .mountPath("string")
    .workspaceId("string")
    .codeBranch("string")
    .codeCommit("string")
    .codeRepoAccessToken("string")
    .codeRepoUserName("string")
    .description("string")
    .build());
workspace_code_source_resource = alicloud.pai.WorkspaceCodeSource("workspaceCodeSourceResource",
    accessibility="string",
    code_repo="string",
    display_name="string",
    mount_path="string",
    workspace_id="string",
    code_branch="string",
    code_commit="string",
    code_repo_access_token="string",
    code_repo_user_name="string",
    description="string")
const workspaceCodeSourceResource = new alicloud.pai.WorkspaceCodeSource("workspaceCodeSourceResource", {
    accessibility: "string",
    codeRepo: "string",
    displayName: "string",
    mountPath: "string",
    workspaceId: "string",
    codeBranch: "string",
    codeCommit: "string",
    codeRepoAccessToken: "string",
    codeRepoUserName: "string",
    description: "string",
});
type: alicloud:pai:WorkspaceCodeSource
properties:
    accessibility: string
    codeBranch: string
    codeCommit: string
    codeRepo: string
    codeRepoAccessToken: string
    codeRepoUserName: string
    description: string
    displayName: string
    mountPath: string
    workspaceId: string
WorkspaceCodeSource Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The WorkspaceCodeSource resource accepts the following input properties:
- Accessibility string
- Visibility of the code configuration, possible values:- PRIVATE: In this workspace, it is only visible to you and the administrator.
- PUBLIC: In this workspace, it is visible to everyone.
 
- CodeRepo string
- Code repository address.
- DisplayName string
- Code source configuration name.
- MountPath string
- The local Mount Directory of the code.
- WorkspaceId string
- The ID of the workspace.
- CodeBranch string
- Code repository branch.
- CodeCommit string
- The code CommitId.
- CodeRepo stringAccess Token 
- The Token used to access the code repository.
- CodeRepo stringUser Name 
- The user name of the code repository.
- Description string
- A detailed description of the code configuration.
- Accessibility string
- Visibility of the code configuration, possible values:- PRIVATE: In this workspace, it is only visible to you and the administrator.
- PUBLIC: In this workspace, it is visible to everyone.
 
- CodeRepo string
- Code repository address.
- DisplayName string
- Code source configuration name.
- MountPath string
- The local Mount Directory of the code.
- WorkspaceId string
- The ID of the workspace.
- CodeBranch string
- Code repository branch.
- CodeCommit string
- The code CommitId.
- CodeRepo stringAccess Token 
- The Token used to access the code repository.
- CodeRepo stringUser Name 
- The user name of the code repository.
- Description string
- A detailed description of the code configuration.
- accessibility String
- Visibility of the code configuration, possible values:- PRIVATE: In this workspace, it is only visible to you and the administrator.
- PUBLIC: In this workspace, it is visible to everyone.
 
- codeRepo String
- Code repository address.
- displayName String
- Code source configuration name.
- mountPath String
- The local Mount Directory of the code.
- workspaceId String
- The ID of the workspace.
- codeBranch String
- Code repository branch.
- codeCommit String
- The code CommitId.
- codeRepo StringAccess Token 
- The Token used to access the code repository.
- codeRepo StringUser Name 
- The user name of the code repository.
- description String
- A detailed description of the code configuration.
- accessibility string
- Visibility of the code configuration, possible values:- PRIVATE: In this workspace, it is only visible to you and the administrator.
- PUBLIC: In this workspace, it is visible to everyone.
 
- codeRepo string
- Code repository address.
- displayName string
- Code source configuration name.
- mountPath string
- The local Mount Directory of the code.
- workspaceId string
- The ID of the workspace.
- codeBranch string
- Code repository branch.
- codeCommit string
- The code CommitId.
- codeRepo stringAccess Token 
- The Token used to access the code repository.
- codeRepo stringUser Name 
- The user name of the code repository.
- description string
- A detailed description of the code configuration.
- accessibility str
- Visibility of the code configuration, possible values:- PRIVATE: In this workspace, it is only visible to you and the administrator.
- PUBLIC: In this workspace, it is visible to everyone.
 
- code_repo str
- Code repository address.
- display_name str
- Code source configuration name.
- mount_path str
- The local Mount Directory of the code.
- workspace_id str
- The ID of the workspace.
- code_branch str
- Code repository branch.
- code_commit str
- The code CommitId.
- code_repo_ straccess_ token 
- The Token used to access the code repository.
- code_repo_ struser_ name 
- The user name of the code repository.
- description str
- A detailed description of the code configuration.
- accessibility String
- Visibility of the code configuration, possible values:- PRIVATE: In this workspace, it is only visible to you and the administrator.
- PUBLIC: In this workspace, it is visible to everyone.
 
- codeRepo String
- Code repository address.
- displayName String
- Code source configuration name.
- mountPath String
- The local Mount Directory of the code.
- workspaceId String
- The ID of the workspace.
- codeBranch String
- Code repository branch.
- codeCommit String
- The code CommitId.
- codeRepo StringAccess Token 
- The Token used to access the code repository.
- codeRepo StringUser Name 
- The user name of the code repository.
- description String
- A detailed description of the code configuration.
Outputs
All input properties are implicitly available as output properties. Additionally, the WorkspaceCodeSource resource produces the following output properties:
- CreateTime string
- The creation time of the resource
- Id string
- The provider-assigned unique ID for this managed resource.
- CreateTime string
- The creation time of the resource
- Id string
- The provider-assigned unique ID for this managed resource.
- createTime String
- The creation time of the resource
- id String
- The provider-assigned unique ID for this managed resource.
- createTime string
- The creation time of the resource
- id string
- The provider-assigned unique ID for this managed resource.
- create_time str
- The creation time of the resource
- id str
- The provider-assigned unique ID for this managed resource.
- createTime String
- The creation time of the resource
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing WorkspaceCodeSource Resource
Get an existing WorkspaceCodeSource resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: WorkspaceCodeSourceState, opts?: CustomResourceOptions): WorkspaceCodeSource@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        accessibility: Optional[str] = None,
        code_branch: Optional[str] = None,
        code_commit: Optional[str] = None,
        code_repo: Optional[str] = None,
        code_repo_access_token: Optional[str] = None,
        code_repo_user_name: Optional[str] = None,
        create_time: Optional[str] = None,
        description: Optional[str] = None,
        display_name: Optional[str] = None,
        mount_path: Optional[str] = None,
        workspace_id: Optional[str] = None) -> WorkspaceCodeSourcefunc GetWorkspaceCodeSource(ctx *Context, name string, id IDInput, state *WorkspaceCodeSourceState, opts ...ResourceOption) (*WorkspaceCodeSource, error)public static WorkspaceCodeSource Get(string name, Input<string> id, WorkspaceCodeSourceState? state, CustomResourceOptions? opts = null)public static WorkspaceCodeSource get(String name, Output<String> id, WorkspaceCodeSourceState state, CustomResourceOptions options)resources:  _:    type: alicloud:pai:WorkspaceCodeSource    get:      id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Accessibility string
- Visibility of the code configuration, possible values:- PRIVATE: In this workspace, it is only visible to you and the administrator.
- PUBLIC: In this workspace, it is visible to everyone.
 
- CodeBranch string
- Code repository branch.
- CodeCommit string
- The code CommitId.
- CodeRepo string
- Code repository address.
- CodeRepo stringAccess Token 
- The Token used to access the code repository.
- CodeRepo stringUser Name 
- The user name of the code repository.
- CreateTime string
- The creation time of the resource
- Description string
- A detailed description of the code configuration.
- DisplayName string
- Code source configuration name.
- MountPath string
- The local Mount Directory of the code.
- WorkspaceId string
- The ID of the workspace.
- Accessibility string
- Visibility of the code configuration, possible values:- PRIVATE: In this workspace, it is only visible to you and the administrator.
- PUBLIC: In this workspace, it is visible to everyone.
 
- CodeBranch string
- Code repository branch.
- CodeCommit string
- The code CommitId.
- CodeRepo string
- Code repository address.
- CodeRepo stringAccess Token 
- The Token used to access the code repository.
- CodeRepo stringUser Name 
- The user name of the code repository.
- CreateTime string
- The creation time of the resource
- Description string
- A detailed description of the code configuration.
- DisplayName string
- Code source configuration name.
- MountPath string
- The local Mount Directory of the code.
- WorkspaceId string
- The ID of the workspace.
- accessibility String
- Visibility of the code configuration, possible values:- PRIVATE: In this workspace, it is only visible to you and the administrator.
- PUBLIC: In this workspace, it is visible to everyone.
 
- codeBranch String
- Code repository branch.
- codeCommit String
- The code CommitId.
- codeRepo String
- Code repository address.
- codeRepo StringAccess Token 
- The Token used to access the code repository.
- codeRepo StringUser Name 
- The user name of the code repository.
- createTime String
- The creation time of the resource
- description String
- A detailed description of the code configuration.
- displayName String
- Code source configuration name.
- mountPath String
- The local Mount Directory of the code.
- workspaceId String
- The ID of the workspace.
- accessibility string
- Visibility of the code configuration, possible values:- PRIVATE: In this workspace, it is only visible to you and the administrator.
- PUBLIC: In this workspace, it is visible to everyone.
 
- codeBranch string
- Code repository branch.
- codeCommit string
- The code CommitId.
- codeRepo string
- Code repository address.
- codeRepo stringAccess Token 
- The Token used to access the code repository.
- codeRepo stringUser Name 
- The user name of the code repository.
- createTime string
- The creation time of the resource
- description string
- A detailed description of the code configuration.
- displayName string
- Code source configuration name.
- mountPath string
- The local Mount Directory of the code.
- workspaceId string
- The ID of the workspace.
- accessibility str
- Visibility of the code configuration, possible values:- PRIVATE: In this workspace, it is only visible to you and the administrator.
- PUBLIC: In this workspace, it is visible to everyone.
 
- code_branch str
- Code repository branch.
- code_commit str
- The code CommitId.
- code_repo str
- Code repository address.
- code_repo_ straccess_ token 
- The Token used to access the code repository.
- code_repo_ struser_ name 
- The user name of the code repository.
- create_time str
- The creation time of the resource
- description str
- A detailed description of the code configuration.
- display_name str
- Code source configuration name.
- mount_path str
- The local Mount Directory of the code.
- workspace_id str
- The ID of the workspace.
- accessibility String
- Visibility of the code configuration, possible values:- PRIVATE: In this workspace, it is only visible to you and the administrator.
- PUBLIC: In this workspace, it is visible to everyone.
 
- codeBranch String
- Code repository branch.
- codeCommit String
- The code CommitId.
- codeRepo String
- Code repository address.
- codeRepo StringAccess Token 
- The Token used to access the code repository.
- codeRepo StringUser Name 
- The user name of the code repository.
- createTime String
- The creation time of the resource
- description String
- A detailed description of the code configuration.
- displayName String
- Code source configuration name.
- mountPath String
- The local Mount Directory of the code.
- workspaceId String
- The ID of the workspace.
Import
PAI Workspace Code Source can be imported using the id, e.g.
$ pulumi import alicloud:pai/workspaceCodeSource:WorkspaceCodeSource example <id>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the alicloudTerraform Provider.