github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/workspaces/workspace.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package workspaces 5 6 import ( 7 "context" 8 "reflect" 9 10 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Provides a workspace in [AWS Workspaces](https://docs.aws.amazon.com/workspaces/latest/adminguide/amazon-workspaces.html) Service 16 // 17 // > **NOTE:** AWS WorkSpaces service requires [`workspaces_DefaultRole`](https://docs.aws.amazon.com/workspaces/latest/adminguide/workspaces-access-control.html#create-default-role) IAM role to operate normally. 18 // 19 // ## Example Usage 20 // 21 // <!--Start PulumiCodeChooser --> 22 // ```go 23 // package main 24 // 25 // import ( 26 // 27 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/kms" 28 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/workspaces" 29 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 30 // 31 // ) 32 // 33 // func main() { 34 // pulumi.Run(func(ctx *pulumi.Context) error { 35 // valueWindows10, err := workspaces.GetBundle(ctx, &workspaces.GetBundleArgs{ 36 // BundleId: pulumi.StringRef("wsb-bh8rsxt14"), 37 // }, nil) 38 // if err != nil { 39 // return err 40 // } 41 // workspaces, err := kms.LookupKey(ctx, &kms.LookupKeyArgs{ 42 // KeyId: "alias/aws/workspaces", 43 // }, nil) 44 // if err != nil { 45 // return err 46 // } 47 // _, err = workspaces.NewWorkspace(ctx, "example", &workspaces.WorkspaceArgs{ 48 // DirectoryId: pulumi.Any(exampleAwsWorkspacesDirectory.Id), 49 // BundleId: pulumi.String(valueWindows10.Id), 50 // UserName: pulumi.String("john.doe"), 51 // RootVolumeEncryptionEnabled: pulumi.Bool(true), 52 // UserVolumeEncryptionEnabled: pulumi.Bool(true), 53 // VolumeEncryptionKey: pulumi.String(workspaces.Arn), 54 // WorkspaceProperties: &workspaces.WorkspaceWorkspacePropertiesArgs{ 55 // ComputeTypeName: pulumi.String("VALUE"), 56 // UserVolumeSizeGib: pulumi.Int(10), 57 // RootVolumeSizeGib: pulumi.Int(80), 58 // RunningMode: pulumi.String("AUTO_STOP"), 59 // RunningModeAutoStopTimeoutInMinutes: pulumi.Int(60), 60 // }, 61 // Tags: pulumi.StringMap{ 62 // "Department": pulumi.String("IT"), 63 // }, 64 // }) 65 // if err != nil { 66 // return err 67 // } 68 // return nil 69 // }) 70 // } 71 // 72 // ``` 73 // <!--End PulumiCodeChooser --> 74 // 75 // ## Import 76 // 77 // Using `pulumi import`, import Workspaces using their ID. For example: 78 // 79 // ```sh 80 // $ pulumi import aws:workspaces/workspace:Workspace example ws-9z9zmbkhv 81 // ``` 82 type Workspace struct { 83 pulumi.CustomResourceState 84 85 // The ID of the bundle for the WorkSpace. 86 BundleId pulumi.StringOutput `pulumi:"bundleId"` 87 // The name of the WorkSpace, as seen by the operating system. 88 ComputerName pulumi.StringOutput `pulumi:"computerName"` 89 // The ID of the directory for the WorkSpace. 90 DirectoryId pulumi.StringOutput `pulumi:"directoryId"` 91 // The IP address of the WorkSpace. 92 IpAddress pulumi.StringOutput `pulumi:"ipAddress"` 93 // Indicates whether the data stored on the root volume is encrypted. 94 RootVolumeEncryptionEnabled pulumi.BoolPtrOutput `pulumi:"rootVolumeEncryptionEnabled"` 95 // The operational state of the WorkSpace. 96 State pulumi.StringOutput `pulumi:"state"` 97 // The tags for the WorkSpace. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 98 Tags pulumi.StringMapOutput `pulumi:"tags"` 99 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 100 // 101 // Deprecated: Please use `tags` instead. 102 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 103 // The user name of the user for the WorkSpace. This user name must exist in the directory for the WorkSpace. 104 UserName pulumi.StringOutput `pulumi:"userName"` 105 // Indicates whether the data stored on the user volume is encrypted. 106 UserVolumeEncryptionEnabled pulumi.BoolPtrOutput `pulumi:"userVolumeEncryptionEnabled"` 107 // The ARN of a symmetric AWS KMS customer master key (CMK) used to encrypt data stored on your WorkSpace. Amazon WorkSpaces does not support asymmetric CMKs. 108 VolumeEncryptionKey pulumi.StringPtrOutput `pulumi:"volumeEncryptionKey"` 109 // The WorkSpace properties. 110 WorkspaceProperties WorkspaceWorkspacePropertiesOutput `pulumi:"workspaceProperties"` 111 } 112 113 // NewWorkspace registers a new resource with the given unique name, arguments, and options. 114 func NewWorkspace(ctx *pulumi.Context, 115 name string, args *WorkspaceArgs, opts ...pulumi.ResourceOption) (*Workspace, error) { 116 if args == nil { 117 return nil, errors.New("missing one or more required arguments") 118 } 119 120 if args.BundleId == nil { 121 return nil, errors.New("invalid value for required argument 'BundleId'") 122 } 123 if args.DirectoryId == nil { 124 return nil, errors.New("invalid value for required argument 'DirectoryId'") 125 } 126 if args.UserName == nil { 127 return nil, errors.New("invalid value for required argument 'UserName'") 128 } 129 opts = internal.PkgResourceDefaultOpts(opts) 130 var resource Workspace 131 err := ctx.RegisterResource("aws:workspaces/workspace:Workspace", name, args, &resource, opts...) 132 if err != nil { 133 return nil, err 134 } 135 return &resource, nil 136 } 137 138 // GetWorkspace gets an existing Workspace resource's state with the given name, ID, and optional 139 // state properties that are used to uniquely qualify the lookup (nil if not required). 140 func GetWorkspace(ctx *pulumi.Context, 141 name string, id pulumi.IDInput, state *WorkspaceState, opts ...pulumi.ResourceOption) (*Workspace, error) { 142 var resource Workspace 143 err := ctx.ReadResource("aws:workspaces/workspace:Workspace", name, id, state, &resource, opts...) 144 if err != nil { 145 return nil, err 146 } 147 return &resource, nil 148 } 149 150 // Input properties used for looking up and filtering Workspace resources. 151 type workspaceState struct { 152 // The ID of the bundle for the WorkSpace. 153 BundleId *string `pulumi:"bundleId"` 154 // The name of the WorkSpace, as seen by the operating system. 155 ComputerName *string `pulumi:"computerName"` 156 // The ID of the directory for the WorkSpace. 157 DirectoryId *string `pulumi:"directoryId"` 158 // The IP address of the WorkSpace. 159 IpAddress *string `pulumi:"ipAddress"` 160 // Indicates whether the data stored on the root volume is encrypted. 161 RootVolumeEncryptionEnabled *bool `pulumi:"rootVolumeEncryptionEnabled"` 162 // The operational state of the WorkSpace. 163 State *string `pulumi:"state"` 164 // The tags for the WorkSpace. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 165 Tags map[string]string `pulumi:"tags"` 166 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 167 // 168 // Deprecated: Please use `tags` instead. 169 TagsAll map[string]string `pulumi:"tagsAll"` 170 // The user name of the user for the WorkSpace. This user name must exist in the directory for the WorkSpace. 171 UserName *string `pulumi:"userName"` 172 // Indicates whether the data stored on the user volume is encrypted. 173 UserVolumeEncryptionEnabled *bool `pulumi:"userVolumeEncryptionEnabled"` 174 // The ARN of a symmetric AWS KMS customer master key (CMK) used to encrypt data stored on your WorkSpace. Amazon WorkSpaces does not support asymmetric CMKs. 175 VolumeEncryptionKey *string `pulumi:"volumeEncryptionKey"` 176 // The WorkSpace properties. 177 WorkspaceProperties *WorkspaceWorkspaceProperties `pulumi:"workspaceProperties"` 178 } 179 180 type WorkspaceState struct { 181 // The ID of the bundle for the WorkSpace. 182 BundleId pulumi.StringPtrInput 183 // The name of the WorkSpace, as seen by the operating system. 184 ComputerName pulumi.StringPtrInput 185 // The ID of the directory for the WorkSpace. 186 DirectoryId pulumi.StringPtrInput 187 // The IP address of the WorkSpace. 188 IpAddress pulumi.StringPtrInput 189 // Indicates whether the data stored on the root volume is encrypted. 190 RootVolumeEncryptionEnabled pulumi.BoolPtrInput 191 // The operational state of the WorkSpace. 192 State pulumi.StringPtrInput 193 // The tags for the WorkSpace. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 194 Tags pulumi.StringMapInput 195 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 196 // 197 // Deprecated: Please use `tags` instead. 198 TagsAll pulumi.StringMapInput 199 // The user name of the user for the WorkSpace. This user name must exist in the directory for the WorkSpace. 200 UserName pulumi.StringPtrInput 201 // Indicates whether the data stored on the user volume is encrypted. 202 UserVolumeEncryptionEnabled pulumi.BoolPtrInput 203 // The ARN of a symmetric AWS KMS customer master key (CMK) used to encrypt data stored on your WorkSpace. Amazon WorkSpaces does not support asymmetric CMKs. 204 VolumeEncryptionKey pulumi.StringPtrInput 205 // The WorkSpace properties. 206 WorkspaceProperties WorkspaceWorkspacePropertiesPtrInput 207 } 208 209 func (WorkspaceState) ElementType() reflect.Type { 210 return reflect.TypeOf((*workspaceState)(nil)).Elem() 211 } 212 213 type workspaceArgs struct { 214 // The ID of the bundle for the WorkSpace. 215 BundleId string `pulumi:"bundleId"` 216 // The ID of the directory for the WorkSpace. 217 DirectoryId string `pulumi:"directoryId"` 218 // Indicates whether the data stored on the root volume is encrypted. 219 RootVolumeEncryptionEnabled *bool `pulumi:"rootVolumeEncryptionEnabled"` 220 // The tags for the WorkSpace. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 221 Tags map[string]string `pulumi:"tags"` 222 // The user name of the user for the WorkSpace. This user name must exist in the directory for the WorkSpace. 223 UserName string `pulumi:"userName"` 224 // Indicates whether the data stored on the user volume is encrypted. 225 UserVolumeEncryptionEnabled *bool `pulumi:"userVolumeEncryptionEnabled"` 226 // The ARN of a symmetric AWS KMS customer master key (CMK) used to encrypt data stored on your WorkSpace. Amazon WorkSpaces does not support asymmetric CMKs. 227 VolumeEncryptionKey *string `pulumi:"volumeEncryptionKey"` 228 // The WorkSpace properties. 229 WorkspaceProperties *WorkspaceWorkspaceProperties `pulumi:"workspaceProperties"` 230 } 231 232 // The set of arguments for constructing a Workspace resource. 233 type WorkspaceArgs struct { 234 // The ID of the bundle for the WorkSpace. 235 BundleId pulumi.StringInput 236 // The ID of the directory for the WorkSpace. 237 DirectoryId pulumi.StringInput 238 // Indicates whether the data stored on the root volume is encrypted. 239 RootVolumeEncryptionEnabled pulumi.BoolPtrInput 240 // The tags for the WorkSpace. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 241 Tags pulumi.StringMapInput 242 // The user name of the user for the WorkSpace. This user name must exist in the directory for the WorkSpace. 243 UserName pulumi.StringInput 244 // Indicates whether the data stored on the user volume is encrypted. 245 UserVolumeEncryptionEnabled pulumi.BoolPtrInput 246 // The ARN of a symmetric AWS KMS customer master key (CMK) used to encrypt data stored on your WorkSpace. Amazon WorkSpaces does not support asymmetric CMKs. 247 VolumeEncryptionKey pulumi.StringPtrInput 248 // The WorkSpace properties. 249 WorkspaceProperties WorkspaceWorkspacePropertiesPtrInput 250 } 251 252 func (WorkspaceArgs) ElementType() reflect.Type { 253 return reflect.TypeOf((*workspaceArgs)(nil)).Elem() 254 } 255 256 type WorkspaceInput interface { 257 pulumi.Input 258 259 ToWorkspaceOutput() WorkspaceOutput 260 ToWorkspaceOutputWithContext(ctx context.Context) WorkspaceOutput 261 } 262 263 func (*Workspace) ElementType() reflect.Type { 264 return reflect.TypeOf((**Workspace)(nil)).Elem() 265 } 266 267 func (i *Workspace) ToWorkspaceOutput() WorkspaceOutput { 268 return i.ToWorkspaceOutputWithContext(context.Background()) 269 } 270 271 func (i *Workspace) ToWorkspaceOutputWithContext(ctx context.Context) WorkspaceOutput { 272 return pulumi.ToOutputWithContext(ctx, i).(WorkspaceOutput) 273 } 274 275 // WorkspaceArrayInput is an input type that accepts WorkspaceArray and WorkspaceArrayOutput values. 276 // You can construct a concrete instance of `WorkspaceArrayInput` via: 277 // 278 // WorkspaceArray{ WorkspaceArgs{...} } 279 type WorkspaceArrayInput interface { 280 pulumi.Input 281 282 ToWorkspaceArrayOutput() WorkspaceArrayOutput 283 ToWorkspaceArrayOutputWithContext(context.Context) WorkspaceArrayOutput 284 } 285 286 type WorkspaceArray []WorkspaceInput 287 288 func (WorkspaceArray) ElementType() reflect.Type { 289 return reflect.TypeOf((*[]*Workspace)(nil)).Elem() 290 } 291 292 func (i WorkspaceArray) ToWorkspaceArrayOutput() WorkspaceArrayOutput { 293 return i.ToWorkspaceArrayOutputWithContext(context.Background()) 294 } 295 296 func (i WorkspaceArray) ToWorkspaceArrayOutputWithContext(ctx context.Context) WorkspaceArrayOutput { 297 return pulumi.ToOutputWithContext(ctx, i).(WorkspaceArrayOutput) 298 } 299 300 // WorkspaceMapInput is an input type that accepts WorkspaceMap and WorkspaceMapOutput values. 301 // You can construct a concrete instance of `WorkspaceMapInput` via: 302 // 303 // WorkspaceMap{ "key": WorkspaceArgs{...} } 304 type WorkspaceMapInput interface { 305 pulumi.Input 306 307 ToWorkspaceMapOutput() WorkspaceMapOutput 308 ToWorkspaceMapOutputWithContext(context.Context) WorkspaceMapOutput 309 } 310 311 type WorkspaceMap map[string]WorkspaceInput 312 313 func (WorkspaceMap) ElementType() reflect.Type { 314 return reflect.TypeOf((*map[string]*Workspace)(nil)).Elem() 315 } 316 317 func (i WorkspaceMap) ToWorkspaceMapOutput() WorkspaceMapOutput { 318 return i.ToWorkspaceMapOutputWithContext(context.Background()) 319 } 320 321 func (i WorkspaceMap) ToWorkspaceMapOutputWithContext(ctx context.Context) WorkspaceMapOutput { 322 return pulumi.ToOutputWithContext(ctx, i).(WorkspaceMapOutput) 323 } 324 325 type WorkspaceOutput struct{ *pulumi.OutputState } 326 327 func (WorkspaceOutput) ElementType() reflect.Type { 328 return reflect.TypeOf((**Workspace)(nil)).Elem() 329 } 330 331 func (o WorkspaceOutput) ToWorkspaceOutput() WorkspaceOutput { 332 return o 333 } 334 335 func (o WorkspaceOutput) ToWorkspaceOutputWithContext(ctx context.Context) WorkspaceOutput { 336 return o 337 } 338 339 // The ID of the bundle for the WorkSpace. 340 func (o WorkspaceOutput) BundleId() pulumi.StringOutput { 341 return o.ApplyT(func(v *Workspace) pulumi.StringOutput { return v.BundleId }).(pulumi.StringOutput) 342 } 343 344 // The name of the WorkSpace, as seen by the operating system. 345 func (o WorkspaceOutput) ComputerName() pulumi.StringOutput { 346 return o.ApplyT(func(v *Workspace) pulumi.StringOutput { return v.ComputerName }).(pulumi.StringOutput) 347 } 348 349 // The ID of the directory for the WorkSpace. 350 func (o WorkspaceOutput) DirectoryId() pulumi.StringOutput { 351 return o.ApplyT(func(v *Workspace) pulumi.StringOutput { return v.DirectoryId }).(pulumi.StringOutput) 352 } 353 354 // The IP address of the WorkSpace. 355 func (o WorkspaceOutput) IpAddress() pulumi.StringOutput { 356 return o.ApplyT(func(v *Workspace) pulumi.StringOutput { return v.IpAddress }).(pulumi.StringOutput) 357 } 358 359 // Indicates whether the data stored on the root volume is encrypted. 360 func (o WorkspaceOutput) RootVolumeEncryptionEnabled() pulumi.BoolPtrOutput { 361 return o.ApplyT(func(v *Workspace) pulumi.BoolPtrOutput { return v.RootVolumeEncryptionEnabled }).(pulumi.BoolPtrOutput) 362 } 363 364 // The operational state of the WorkSpace. 365 func (o WorkspaceOutput) State() pulumi.StringOutput { 366 return o.ApplyT(func(v *Workspace) pulumi.StringOutput { return v.State }).(pulumi.StringOutput) 367 } 368 369 // The tags for the WorkSpace. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 370 func (o WorkspaceOutput) Tags() pulumi.StringMapOutput { 371 return o.ApplyT(func(v *Workspace) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 372 } 373 374 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 375 // 376 // Deprecated: Please use `tags` instead. 377 func (o WorkspaceOutput) TagsAll() pulumi.StringMapOutput { 378 return o.ApplyT(func(v *Workspace) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 379 } 380 381 // The user name of the user for the WorkSpace. This user name must exist in the directory for the WorkSpace. 382 func (o WorkspaceOutput) UserName() pulumi.StringOutput { 383 return o.ApplyT(func(v *Workspace) pulumi.StringOutput { return v.UserName }).(pulumi.StringOutput) 384 } 385 386 // Indicates whether the data stored on the user volume is encrypted. 387 func (o WorkspaceOutput) UserVolumeEncryptionEnabled() pulumi.BoolPtrOutput { 388 return o.ApplyT(func(v *Workspace) pulumi.BoolPtrOutput { return v.UserVolumeEncryptionEnabled }).(pulumi.BoolPtrOutput) 389 } 390 391 // The ARN of a symmetric AWS KMS customer master key (CMK) used to encrypt data stored on your WorkSpace. Amazon WorkSpaces does not support asymmetric CMKs. 392 func (o WorkspaceOutput) VolumeEncryptionKey() pulumi.StringPtrOutput { 393 return o.ApplyT(func(v *Workspace) pulumi.StringPtrOutput { return v.VolumeEncryptionKey }).(pulumi.StringPtrOutput) 394 } 395 396 // The WorkSpace properties. 397 func (o WorkspaceOutput) WorkspaceProperties() WorkspaceWorkspacePropertiesOutput { 398 return o.ApplyT(func(v *Workspace) WorkspaceWorkspacePropertiesOutput { return v.WorkspaceProperties }).(WorkspaceWorkspacePropertiesOutput) 399 } 400 401 type WorkspaceArrayOutput struct{ *pulumi.OutputState } 402 403 func (WorkspaceArrayOutput) ElementType() reflect.Type { 404 return reflect.TypeOf((*[]*Workspace)(nil)).Elem() 405 } 406 407 func (o WorkspaceArrayOutput) ToWorkspaceArrayOutput() WorkspaceArrayOutput { 408 return o 409 } 410 411 func (o WorkspaceArrayOutput) ToWorkspaceArrayOutputWithContext(ctx context.Context) WorkspaceArrayOutput { 412 return o 413 } 414 415 func (o WorkspaceArrayOutput) Index(i pulumi.IntInput) WorkspaceOutput { 416 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Workspace { 417 return vs[0].([]*Workspace)[vs[1].(int)] 418 }).(WorkspaceOutput) 419 } 420 421 type WorkspaceMapOutput struct{ *pulumi.OutputState } 422 423 func (WorkspaceMapOutput) ElementType() reflect.Type { 424 return reflect.TypeOf((*map[string]*Workspace)(nil)).Elem() 425 } 426 427 func (o WorkspaceMapOutput) ToWorkspaceMapOutput() WorkspaceMapOutput { 428 return o 429 } 430 431 func (o WorkspaceMapOutput) ToWorkspaceMapOutputWithContext(ctx context.Context) WorkspaceMapOutput { 432 return o 433 } 434 435 func (o WorkspaceMapOutput) MapIndex(k pulumi.StringInput) WorkspaceOutput { 436 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Workspace { 437 return vs[0].(map[string]*Workspace)[vs[1].(string)] 438 }).(WorkspaceOutput) 439 } 440 441 func init() { 442 pulumi.RegisterInputType(reflect.TypeOf((*WorkspaceInput)(nil)).Elem(), &Workspace{}) 443 pulumi.RegisterInputType(reflect.TypeOf((*WorkspaceArrayInput)(nil)).Elem(), WorkspaceArray{}) 444 pulumi.RegisterInputType(reflect.TypeOf((*WorkspaceMapInput)(nil)).Elem(), WorkspaceMap{}) 445 pulumi.RegisterOutputType(WorkspaceOutput{}) 446 pulumi.RegisterOutputType(WorkspaceArrayOutput{}) 447 pulumi.RegisterOutputType(WorkspaceMapOutput{}) 448 }