alicloud.pai.WorkspaceMember
Explore with Pulumi AI
Provides a PAI Workspace Member resource.
For information about PAI Workspace Member and how to use it, see What is Member.
NOTE: Available since v1.249.0.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as random from "@pulumi/random";
const config = new pulumi.Config();
const name = config.get("name") || "terraform_example";
const _default = new random.index.Integer("default", {
min: 10000,
max: 99999,
});
const workspace = new alicloud.pai.WorkspaceWorkspace("Workspace", {
description: "156",
displayName: name,
workspaceName: `${name}_${_default.result}`,
envTypes: ["prod"],
});
const defaultUser = new alicloud.ram.User("default", {name: `${name}-${_default.result}`});
const defaultWorkspaceMember = new alicloud.pai.WorkspaceMember("default", {
userId: defaultUser.id,
workspaceId: workspace.id,
roles: [
"PAI.AlgoDeveloper",
"PAI.AlgoOperator",
"PAI.LabelManager",
],
});
import pulumi
import pulumi_alicloud as alicloud
import pulumi_random as random
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform_example"
default = random.index.Integer("default",
min=10000,
max=99999)
workspace = alicloud.pai.WorkspaceWorkspace("Workspace",
description="156",
display_name=name,
workspace_name=f"{name}_{default['result']}",
env_types=["prod"])
default_user = alicloud.ram.User("default", name=f"{name}-{default['result']}")
default_workspace_member = alicloud.pai.WorkspaceMember("default",
user_id=default_user.id,
workspace_id=workspace.id,
roles=[
"PAI.AlgoDeveloper",
"PAI.AlgoOperator",
"PAI.LabelManager",
])
package main
import (
"fmt"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/pai"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ram"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"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
}
_default, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
Min: 10000,
Max: 99999,
})
if err != nil {
return err
}
workspace, err := pai.NewWorkspaceWorkspace(ctx, "Workspace", &pai.WorkspaceWorkspaceArgs{
Description: pulumi.String("156"),
DisplayName: pulumi.String(name),
WorkspaceName: pulumi.Sprintf("%v_%v", name, _default.Result),
EnvTypes: pulumi.StringArray{
pulumi.String("prod"),
},
})
if err != nil {
return err
}
defaultUser, err := ram.NewUser(ctx, "default", &ram.UserArgs{
Name: pulumi.Sprintf("%v-%v", name, _default.Result),
})
if err != nil {
return err
}
_, err = pai.NewWorkspaceMember(ctx, "default", &pai.WorkspaceMemberArgs{
UserId: defaultUser.ID(),
WorkspaceId: workspace.ID(),
Roles: pulumi.StringArray{
pulumi.String("PAI.AlgoDeveloper"),
pulumi.String("PAI.AlgoOperator"),
pulumi.String("PAI.LabelManager"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "terraform_example";
var @default = new Random.Index.Integer("default", new()
{
Min = 10000,
Max = 99999,
});
var workspace = new AliCloud.Pai.WorkspaceWorkspace("Workspace", new()
{
Description = "156",
DisplayName = name,
WorkspaceName = $"{name}_{@default.Result}",
EnvTypes = new[]
{
"prod",
},
});
var defaultUser = new AliCloud.Ram.User("default", new()
{
Name = $"{name}-{@default.Result}",
});
var defaultWorkspaceMember = new AliCloud.Pai.WorkspaceMember("default", new()
{
UserId = defaultUser.Id,
WorkspaceId = workspace.Id,
Roles = new[]
{
"PAI.AlgoDeveloper",
"PAI.AlgoOperator",
"PAI.LabelManager",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.integer;
import com.pulumi.random.integerArgs;
import com.pulumi.alicloud.pai.WorkspaceWorkspace;
import com.pulumi.alicloud.pai.WorkspaceWorkspaceArgs;
import com.pulumi.alicloud.ram.User;
import com.pulumi.alicloud.ram.UserArgs;
import com.pulumi.alicloud.pai.WorkspaceMember;
import com.pulumi.alicloud.pai.WorkspaceMemberArgs;
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 default_ = new Integer("default", IntegerArgs.builder()
.min(10000)
.max(99999)
.build());
var workspace = new WorkspaceWorkspace("workspace", WorkspaceWorkspaceArgs.builder()
.description("156")
.displayName(name)
.workspaceName(String.format("%s_%s", name,default_.result()))
.envTypes("prod")
.build());
var defaultUser = new User("defaultUser", UserArgs.builder()
.name(String.format("%s-%s", name,default_.result()))
.build());
var defaultWorkspaceMember = new WorkspaceMember("defaultWorkspaceMember", WorkspaceMemberArgs.builder()
.userId(defaultUser.id())
.workspaceId(workspace.id())
.roles(
"PAI.AlgoDeveloper",
"PAI.AlgoOperator",
"PAI.LabelManager")
.build());
}
}
configuration:
name:
type: string
default: terraform_example
resources:
default:
type: random:integer
properties:
min: 10000
max: 99999
workspace:
type: alicloud:pai:WorkspaceWorkspace
name: Workspace
properties:
description: '156'
displayName: ${name}
workspaceName: ${name}_${default.result}
envTypes:
- prod
defaultUser:
type: alicloud:ram:User
name: default
properties:
name: ${name}-${default.result}
defaultWorkspaceMember:
type: alicloud:pai:WorkspaceMember
name: default
properties:
userId: ${defaultUser.id}
workspaceId: ${workspace.id}
roles:
- PAI.AlgoDeveloper
- PAI.AlgoOperator
- PAI.LabelManager
Create WorkspaceMember Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new WorkspaceMember(name: string, args: WorkspaceMemberArgs, opts?: CustomResourceOptions);
@overload
def WorkspaceMember(resource_name: str,
args: WorkspaceMemberArgs,
opts: Optional[ResourceOptions] = None)
@overload
def WorkspaceMember(resource_name: str,
opts: Optional[ResourceOptions] = None,
roles: Optional[Sequence[str]] = None,
user_id: Optional[str] = None,
workspace_id: Optional[str] = None)
func NewWorkspaceMember(ctx *Context, name string, args WorkspaceMemberArgs, opts ...ResourceOption) (*WorkspaceMember, error)
public WorkspaceMember(string name, WorkspaceMemberArgs args, CustomResourceOptions? opts = null)
public WorkspaceMember(String name, WorkspaceMemberArgs args)
public WorkspaceMember(String name, WorkspaceMemberArgs args, CustomResourceOptions options)
type: alicloud:pai:WorkspaceMember
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 WorkspaceMemberArgs
- 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 WorkspaceMemberArgs
- 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 WorkspaceMemberArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args WorkspaceMemberArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args WorkspaceMemberArgs
- 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 workspaceMemberResource = new AliCloud.Pai.WorkspaceMember("workspaceMemberResource", new()
{
Roles = new[]
{
"string",
},
UserId = "string",
WorkspaceId = "string",
});
example, err := pai.NewWorkspaceMember(ctx, "workspaceMemberResource", &pai.WorkspaceMemberArgs{
Roles: pulumi.StringArray{
pulumi.String("string"),
},
UserId: pulumi.String("string"),
WorkspaceId: pulumi.String("string"),
})
var workspaceMemberResource = new WorkspaceMember("workspaceMemberResource", WorkspaceMemberArgs.builder()
.roles("string")
.userId("string")
.workspaceId("string")
.build());
workspace_member_resource = alicloud.pai.WorkspaceMember("workspaceMemberResource",
roles=["string"],
user_id="string",
workspace_id="string")
const workspaceMemberResource = new alicloud.pai.WorkspaceMember("workspaceMemberResource", {
roles: ["string"],
userId: "string",
workspaceId: "string",
});
type: alicloud:pai:WorkspaceMember
properties:
roles:
- string
userId: string
workspaceId: string
WorkspaceMember 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 WorkspaceMember resource accepts the following input properties:
- Roles List<string>
- The list of roles. see how to use it.
- User
Id string - The ID of the User.
- Workspace
Id string - The ID of the Workspace.
- Roles []string
- The list of roles. see how to use it.
- User
Id string - The ID of the User.
- Workspace
Id string - The ID of the Workspace.
- roles List<String>
- The list of roles. see how to use it.
- user
Id String - The ID of the User.
- workspace
Id String - The ID of the Workspace.
- roles string[]
- The list of roles. see how to use it.
- user
Id string - The ID of the User.
- workspace
Id string - The ID of the Workspace.
- roles Sequence[str]
- The list of roles. see how to use it.
- user_
id str - The ID of the User.
- workspace_
id str - The ID of the Workspace.
- roles List<String>
- The list of roles. see how to use it.
- user
Id String - The ID of the User.
- workspace
Id String - The ID of the Workspace.
Outputs
All input properties are implicitly available as output properties. Additionally, the WorkspaceMember resource produces the following output properties:
- Create
Time string - The time when the workspace is created, in UTC. The time follows the ISO 8601 standard.
- Id string
- The provider-assigned unique ID for this managed resource.
- Member
Id string - The member ID.
- Create
Time string - The time when the workspace is created, in UTC. The time follows the ISO 8601 standard.
- Id string
- The provider-assigned unique ID for this managed resource.
- Member
Id string - The member ID.
- create
Time String - The time when the workspace is created, in UTC. The time follows the ISO 8601 standard.
- id String
- The provider-assigned unique ID for this managed resource.
- member
Id String - The member ID.
- create
Time string - The time when the workspace is created, in UTC. The time follows the ISO 8601 standard.
- id string
- The provider-assigned unique ID for this managed resource.
- member
Id string - The member ID.
- create_
time str - The time when the workspace is created, in UTC. The time follows the ISO 8601 standard.
- id str
- The provider-assigned unique ID for this managed resource.
- member_
id str - The member ID.
- create
Time String - The time when the workspace is created, in UTC. The time follows the ISO 8601 standard.
- id String
- The provider-assigned unique ID for this managed resource.
- member
Id String - The member ID.
Look up Existing WorkspaceMember Resource
Get an existing WorkspaceMember 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?: WorkspaceMemberState, opts?: CustomResourceOptions): WorkspaceMember
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
create_time: Optional[str] = None,
member_id: Optional[str] = None,
roles: Optional[Sequence[str]] = None,
user_id: Optional[str] = None,
workspace_id: Optional[str] = None) -> WorkspaceMember
func GetWorkspaceMember(ctx *Context, name string, id IDInput, state *WorkspaceMemberState, opts ...ResourceOption) (*WorkspaceMember, error)
public static WorkspaceMember Get(string name, Input<string> id, WorkspaceMemberState? state, CustomResourceOptions? opts = null)
public static WorkspaceMember get(String name, Output<String> id, WorkspaceMemberState state, CustomResourceOptions options)
resources: _: type: alicloud:pai:WorkspaceMember 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.
- Create
Time string - The time when the workspace is created, in UTC. The time follows the ISO 8601 standard.
- Member
Id string - The member ID.
- Roles List<string>
- The list of roles. see how to use it.
- User
Id string - The ID of the User.
- Workspace
Id string - The ID of the Workspace.
- Create
Time string - The time when the workspace is created, in UTC. The time follows the ISO 8601 standard.
- Member
Id string - The member ID.
- Roles []string
- The list of roles. see how to use it.
- User
Id string - The ID of the User.
- Workspace
Id string - The ID of the Workspace.
- create
Time String - The time when the workspace is created, in UTC. The time follows the ISO 8601 standard.
- member
Id String - The member ID.
- roles List<String>
- The list of roles. see how to use it.
- user
Id String - The ID of the User.
- workspace
Id String - The ID of the Workspace.
- create
Time string - The time when the workspace is created, in UTC. The time follows the ISO 8601 standard.
- member
Id string - The member ID.
- roles string[]
- The list of roles. see how to use it.
- user
Id string - The ID of the User.
- workspace
Id string - The ID of the Workspace.
- create_
time str - The time when the workspace is created, in UTC. The time follows the ISO 8601 standard.
- member_
id str - The member ID.
- roles Sequence[str]
- The list of roles. see how to use it.
- user_
id str - The ID of the User.
- workspace_
id str - The ID of the Workspace.
- create
Time String - The time when the workspace is created, in UTC. The time follows the ISO 8601 standard.
- member
Id String - The member ID.
- roles List<String>
- The list of roles. see how to use it.
- user
Id String - The ID of the User.
- workspace
Id String - The ID of the Workspace.
Import
PAI Workspace Member can be imported using the id, e.g.
$ pulumi import alicloud:pai/workspaceMember:WorkspaceMember example <workspace_id>:<member_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
alicloud
Terraform Provider.