github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cloud9/environmentMembership.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 cloud9 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 an environment member to an AWS Cloud9 development environment. 16 // 17 // ## Example Usage 18 // 19 // <!--Start PulumiCodeChooser --> 20 // ```go 21 // package main 22 // 23 // import ( 24 // 25 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloud9" 26 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 27 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 28 // 29 // ) 30 // 31 // func main() { 32 // pulumi.Run(func(ctx *pulumi.Context) error { 33 // test, err := cloud9.NewEnvironmentEC2(ctx, "test", &cloud9.EnvironmentEC2Args{ 34 // InstanceType: pulumi.String("t2.micro"), 35 // Name: pulumi.String("some-env"), 36 // }) 37 // if err != nil { 38 // return err 39 // } 40 // testUser, err := iam.NewUser(ctx, "test", &iam.UserArgs{ 41 // Name: pulumi.String("some-user"), 42 // }) 43 // if err != nil { 44 // return err 45 // } 46 // _, err = cloud9.NewEnvironmentMembership(ctx, "test", &cloud9.EnvironmentMembershipArgs{ 47 // EnvironmentId: test.ID(), 48 // Permissions: pulumi.String("read-only"), 49 // UserArn: testUser.Arn, 50 // }) 51 // if err != nil { 52 // return err 53 // } 54 // return nil 55 // }) 56 // } 57 // 58 // ``` 59 // <!--End PulumiCodeChooser --> 60 // 61 // ## Import 62 // 63 // Using `pulumi import`, import Cloud9 environment membership using the `environment-id#user-arn`. For example: 64 // 65 // ```sh 66 // $ pulumi import aws:cloud9/environmentMembership:EnvironmentMembership test environment-id#user-arn 67 // ``` 68 type EnvironmentMembership struct { 69 pulumi.CustomResourceState 70 71 // The ID of the environment that contains the environment member you want to add. 72 EnvironmentId pulumi.StringOutput `pulumi:"environmentId"` 73 // The type of environment member permissions you want to associate with this environment member. Allowed values are `read-only` and `read-write` . 74 Permissions pulumi.StringOutput `pulumi:"permissions"` 75 // The Amazon Resource Name (ARN) of the environment member you want to add. 76 UserArn pulumi.StringOutput `pulumi:"userArn"` 77 // he user ID in AWS Identity and Access Management (AWS IAM) of the environment member. 78 UserId pulumi.StringOutput `pulumi:"userId"` 79 } 80 81 // NewEnvironmentMembership registers a new resource with the given unique name, arguments, and options. 82 func NewEnvironmentMembership(ctx *pulumi.Context, 83 name string, args *EnvironmentMembershipArgs, opts ...pulumi.ResourceOption) (*EnvironmentMembership, error) { 84 if args == nil { 85 return nil, errors.New("missing one or more required arguments") 86 } 87 88 if args.EnvironmentId == nil { 89 return nil, errors.New("invalid value for required argument 'EnvironmentId'") 90 } 91 if args.Permissions == nil { 92 return nil, errors.New("invalid value for required argument 'Permissions'") 93 } 94 if args.UserArn == nil { 95 return nil, errors.New("invalid value for required argument 'UserArn'") 96 } 97 opts = internal.PkgResourceDefaultOpts(opts) 98 var resource EnvironmentMembership 99 err := ctx.RegisterResource("aws:cloud9/environmentMembership:EnvironmentMembership", name, args, &resource, opts...) 100 if err != nil { 101 return nil, err 102 } 103 return &resource, nil 104 } 105 106 // GetEnvironmentMembership gets an existing EnvironmentMembership resource's state with the given name, ID, and optional 107 // state properties that are used to uniquely qualify the lookup (nil if not required). 108 func GetEnvironmentMembership(ctx *pulumi.Context, 109 name string, id pulumi.IDInput, state *EnvironmentMembershipState, opts ...pulumi.ResourceOption) (*EnvironmentMembership, error) { 110 var resource EnvironmentMembership 111 err := ctx.ReadResource("aws:cloud9/environmentMembership:EnvironmentMembership", name, id, state, &resource, opts...) 112 if err != nil { 113 return nil, err 114 } 115 return &resource, nil 116 } 117 118 // Input properties used for looking up and filtering EnvironmentMembership resources. 119 type environmentMembershipState struct { 120 // The ID of the environment that contains the environment member you want to add. 121 EnvironmentId *string `pulumi:"environmentId"` 122 // The type of environment member permissions you want to associate with this environment member. Allowed values are `read-only` and `read-write` . 123 Permissions *string `pulumi:"permissions"` 124 // The Amazon Resource Name (ARN) of the environment member you want to add. 125 UserArn *string `pulumi:"userArn"` 126 // he user ID in AWS Identity and Access Management (AWS IAM) of the environment member. 127 UserId *string `pulumi:"userId"` 128 } 129 130 type EnvironmentMembershipState struct { 131 // The ID of the environment that contains the environment member you want to add. 132 EnvironmentId pulumi.StringPtrInput 133 // The type of environment member permissions you want to associate with this environment member. Allowed values are `read-only` and `read-write` . 134 Permissions pulumi.StringPtrInput 135 // The Amazon Resource Name (ARN) of the environment member you want to add. 136 UserArn pulumi.StringPtrInput 137 // he user ID in AWS Identity and Access Management (AWS IAM) of the environment member. 138 UserId pulumi.StringPtrInput 139 } 140 141 func (EnvironmentMembershipState) ElementType() reflect.Type { 142 return reflect.TypeOf((*environmentMembershipState)(nil)).Elem() 143 } 144 145 type environmentMembershipArgs struct { 146 // The ID of the environment that contains the environment member you want to add. 147 EnvironmentId string `pulumi:"environmentId"` 148 // The type of environment member permissions you want to associate with this environment member. Allowed values are `read-only` and `read-write` . 149 Permissions string `pulumi:"permissions"` 150 // The Amazon Resource Name (ARN) of the environment member you want to add. 151 UserArn string `pulumi:"userArn"` 152 } 153 154 // The set of arguments for constructing a EnvironmentMembership resource. 155 type EnvironmentMembershipArgs struct { 156 // The ID of the environment that contains the environment member you want to add. 157 EnvironmentId pulumi.StringInput 158 // The type of environment member permissions you want to associate with this environment member. Allowed values are `read-only` and `read-write` . 159 Permissions pulumi.StringInput 160 // The Amazon Resource Name (ARN) of the environment member you want to add. 161 UserArn pulumi.StringInput 162 } 163 164 func (EnvironmentMembershipArgs) ElementType() reflect.Type { 165 return reflect.TypeOf((*environmentMembershipArgs)(nil)).Elem() 166 } 167 168 type EnvironmentMembershipInput interface { 169 pulumi.Input 170 171 ToEnvironmentMembershipOutput() EnvironmentMembershipOutput 172 ToEnvironmentMembershipOutputWithContext(ctx context.Context) EnvironmentMembershipOutput 173 } 174 175 func (*EnvironmentMembership) ElementType() reflect.Type { 176 return reflect.TypeOf((**EnvironmentMembership)(nil)).Elem() 177 } 178 179 func (i *EnvironmentMembership) ToEnvironmentMembershipOutput() EnvironmentMembershipOutput { 180 return i.ToEnvironmentMembershipOutputWithContext(context.Background()) 181 } 182 183 func (i *EnvironmentMembership) ToEnvironmentMembershipOutputWithContext(ctx context.Context) EnvironmentMembershipOutput { 184 return pulumi.ToOutputWithContext(ctx, i).(EnvironmentMembershipOutput) 185 } 186 187 // EnvironmentMembershipArrayInput is an input type that accepts EnvironmentMembershipArray and EnvironmentMembershipArrayOutput values. 188 // You can construct a concrete instance of `EnvironmentMembershipArrayInput` via: 189 // 190 // EnvironmentMembershipArray{ EnvironmentMembershipArgs{...} } 191 type EnvironmentMembershipArrayInput interface { 192 pulumi.Input 193 194 ToEnvironmentMembershipArrayOutput() EnvironmentMembershipArrayOutput 195 ToEnvironmentMembershipArrayOutputWithContext(context.Context) EnvironmentMembershipArrayOutput 196 } 197 198 type EnvironmentMembershipArray []EnvironmentMembershipInput 199 200 func (EnvironmentMembershipArray) ElementType() reflect.Type { 201 return reflect.TypeOf((*[]*EnvironmentMembership)(nil)).Elem() 202 } 203 204 func (i EnvironmentMembershipArray) ToEnvironmentMembershipArrayOutput() EnvironmentMembershipArrayOutput { 205 return i.ToEnvironmentMembershipArrayOutputWithContext(context.Background()) 206 } 207 208 func (i EnvironmentMembershipArray) ToEnvironmentMembershipArrayOutputWithContext(ctx context.Context) EnvironmentMembershipArrayOutput { 209 return pulumi.ToOutputWithContext(ctx, i).(EnvironmentMembershipArrayOutput) 210 } 211 212 // EnvironmentMembershipMapInput is an input type that accepts EnvironmentMembershipMap and EnvironmentMembershipMapOutput values. 213 // You can construct a concrete instance of `EnvironmentMembershipMapInput` via: 214 // 215 // EnvironmentMembershipMap{ "key": EnvironmentMembershipArgs{...} } 216 type EnvironmentMembershipMapInput interface { 217 pulumi.Input 218 219 ToEnvironmentMembershipMapOutput() EnvironmentMembershipMapOutput 220 ToEnvironmentMembershipMapOutputWithContext(context.Context) EnvironmentMembershipMapOutput 221 } 222 223 type EnvironmentMembershipMap map[string]EnvironmentMembershipInput 224 225 func (EnvironmentMembershipMap) ElementType() reflect.Type { 226 return reflect.TypeOf((*map[string]*EnvironmentMembership)(nil)).Elem() 227 } 228 229 func (i EnvironmentMembershipMap) ToEnvironmentMembershipMapOutput() EnvironmentMembershipMapOutput { 230 return i.ToEnvironmentMembershipMapOutputWithContext(context.Background()) 231 } 232 233 func (i EnvironmentMembershipMap) ToEnvironmentMembershipMapOutputWithContext(ctx context.Context) EnvironmentMembershipMapOutput { 234 return pulumi.ToOutputWithContext(ctx, i).(EnvironmentMembershipMapOutput) 235 } 236 237 type EnvironmentMembershipOutput struct{ *pulumi.OutputState } 238 239 func (EnvironmentMembershipOutput) ElementType() reflect.Type { 240 return reflect.TypeOf((**EnvironmentMembership)(nil)).Elem() 241 } 242 243 func (o EnvironmentMembershipOutput) ToEnvironmentMembershipOutput() EnvironmentMembershipOutput { 244 return o 245 } 246 247 func (o EnvironmentMembershipOutput) ToEnvironmentMembershipOutputWithContext(ctx context.Context) EnvironmentMembershipOutput { 248 return o 249 } 250 251 // The ID of the environment that contains the environment member you want to add. 252 func (o EnvironmentMembershipOutput) EnvironmentId() pulumi.StringOutput { 253 return o.ApplyT(func(v *EnvironmentMembership) pulumi.StringOutput { return v.EnvironmentId }).(pulumi.StringOutput) 254 } 255 256 // The type of environment member permissions you want to associate with this environment member. Allowed values are `read-only` and `read-write` . 257 func (o EnvironmentMembershipOutput) Permissions() pulumi.StringOutput { 258 return o.ApplyT(func(v *EnvironmentMembership) pulumi.StringOutput { return v.Permissions }).(pulumi.StringOutput) 259 } 260 261 // The Amazon Resource Name (ARN) of the environment member you want to add. 262 func (o EnvironmentMembershipOutput) UserArn() pulumi.StringOutput { 263 return o.ApplyT(func(v *EnvironmentMembership) pulumi.StringOutput { return v.UserArn }).(pulumi.StringOutput) 264 } 265 266 // he user ID in AWS Identity and Access Management (AWS IAM) of the environment member. 267 func (o EnvironmentMembershipOutput) UserId() pulumi.StringOutput { 268 return o.ApplyT(func(v *EnvironmentMembership) pulumi.StringOutput { return v.UserId }).(pulumi.StringOutput) 269 } 270 271 type EnvironmentMembershipArrayOutput struct{ *pulumi.OutputState } 272 273 func (EnvironmentMembershipArrayOutput) ElementType() reflect.Type { 274 return reflect.TypeOf((*[]*EnvironmentMembership)(nil)).Elem() 275 } 276 277 func (o EnvironmentMembershipArrayOutput) ToEnvironmentMembershipArrayOutput() EnvironmentMembershipArrayOutput { 278 return o 279 } 280 281 func (o EnvironmentMembershipArrayOutput) ToEnvironmentMembershipArrayOutputWithContext(ctx context.Context) EnvironmentMembershipArrayOutput { 282 return o 283 } 284 285 func (o EnvironmentMembershipArrayOutput) Index(i pulumi.IntInput) EnvironmentMembershipOutput { 286 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *EnvironmentMembership { 287 return vs[0].([]*EnvironmentMembership)[vs[1].(int)] 288 }).(EnvironmentMembershipOutput) 289 } 290 291 type EnvironmentMembershipMapOutput struct{ *pulumi.OutputState } 292 293 func (EnvironmentMembershipMapOutput) ElementType() reflect.Type { 294 return reflect.TypeOf((*map[string]*EnvironmentMembership)(nil)).Elem() 295 } 296 297 func (o EnvironmentMembershipMapOutput) ToEnvironmentMembershipMapOutput() EnvironmentMembershipMapOutput { 298 return o 299 } 300 301 func (o EnvironmentMembershipMapOutput) ToEnvironmentMembershipMapOutputWithContext(ctx context.Context) EnvironmentMembershipMapOutput { 302 return o 303 } 304 305 func (o EnvironmentMembershipMapOutput) MapIndex(k pulumi.StringInput) EnvironmentMembershipOutput { 306 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *EnvironmentMembership { 307 return vs[0].(map[string]*EnvironmentMembership)[vs[1].(string)] 308 }).(EnvironmentMembershipOutput) 309 } 310 311 func init() { 312 pulumi.RegisterInputType(reflect.TypeOf((*EnvironmentMembershipInput)(nil)).Elem(), &EnvironmentMembership{}) 313 pulumi.RegisterInputType(reflect.TypeOf((*EnvironmentMembershipArrayInput)(nil)).Elem(), EnvironmentMembershipArray{}) 314 pulumi.RegisterInputType(reflect.TypeOf((*EnvironmentMembershipMapInput)(nil)).Elem(), EnvironmentMembershipMap{}) 315 pulumi.RegisterOutputType(EnvironmentMembershipOutput{}) 316 pulumi.RegisterOutputType(EnvironmentMembershipArrayOutput{}) 317 pulumi.RegisterOutputType(EnvironmentMembershipMapOutput{}) 318 }