github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/s3control/accessGrant.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 s3control 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 resource to manage an S3 Access Grant. 16 // Each access grant has its own ID and gives an IAM user or role or a directory user, or group (the grantee) access to a registered location. You determine the level of access, such as `READ` or `READWRITE`. 17 // Before you can create a grant, you must have an S3 Access Grants instance in the same Region as the S3 data. 18 // 19 // ## Example Usage 20 // 21 // <!--Start PulumiCodeChooser --> 22 // ```go 23 // package main 24 // 25 // import ( 26 // 27 // "fmt" 28 // 29 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3control" 30 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 31 // 32 // ) 33 // 34 // func main() { 35 // pulumi.Run(func(ctx *pulumi.Context) error { 36 // example, err := s3control.NewAccessGrantsInstance(ctx, "example", nil) 37 // if err != nil { 38 // return err 39 // } 40 // exampleAccessGrantsLocation, err := s3control.NewAccessGrantsLocation(ctx, "example", &s3control.AccessGrantsLocationArgs{ 41 // IamRoleArn: pulumi.Any(exampleAwsIamRole.Arn), 42 // LocationScope: pulumi.String(fmt.Sprintf("s3://%v/prefixA*", exampleAwsS3Bucket.Bucket)), 43 // }, pulumi.DependsOn([]pulumi.Resource{ 44 // example, 45 // })) 46 // if err != nil { 47 // return err 48 // } 49 // _, err = s3control.NewAccessGrant(ctx, "example", &s3control.AccessGrantArgs{ 50 // AccessGrantsLocationId: exampleAccessGrantsLocation.AccessGrantsLocationId, 51 // Permission: pulumi.String("READ"), 52 // AccessGrantsLocationConfiguration: &s3control.AccessGrantAccessGrantsLocationConfigurationArgs{ 53 // S3SubPrefix: pulumi.String("prefixB*"), 54 // }, 55 // Grantee: &s3control.AccessGrantGranteeArgs{ 56 // GranteeType: pulumi.String("IAM"), 57 // GranteeIdentifier: pulumi.Any(exampleAwsIamUser.Arn), 58 // }, 59 // }) 60 // if err != nil { 61 // return err 62 // } 63 // return nil 64 // }) 65 // } 66 // 67 // ``` 68 // <!--End PulumiCodeChooser --> 69 // 70 // ## Import 71 // 72 // Using `pulumi import`, import S3 Access Grants using the `account_id` and `access_grant_id`, separated by a comma (`,`). For example: 73 // 74 // ```sh 75 // $ pulumi import aws:s3control/accessGrant:AccessGrant example 123456789012,04549c5e-2f3c-4a07-824d-2cafe720aa22 76 // ``` 77 type AccessGrant struct { 78 pulumi.CustomResourceState 79 80 // Amazon Resource Name (ARN) of the S3 Access Grant. 81 AccessGrantArn pulumi.StringOutput `pulumi:"accessGrantArn"` 82 // Unique ID of the S3 Access Grant. 83 AccessGrantId pulumi.StringOutput `pulumi:"accessGrantId"` 84 // See Location Configuration below for more details. 85 AccessGrantsLocationConfiguration AccessGrantAccessGrantsLocationConfigurationPtrOutput `pulumi:"accessGrantsLocationConfiguration"` 86 // The ID of the S3 Access Grants location to with the access grant is giving access. 87 AccessGrantsLocationId pulumi.StringOutput `pulumi:"accessGrantsLocationId"` 88 AccountId pulumi.StringOutput `pulumi:"accountId"` 89 // The access grant's scope. 90 GrantScope pulumi.StringOutput `pulumi:"grantScope"` 91 // See Grantee below for more details. 92 Grantee AccessGrantGranteePtrOutput `pulumi:"grantee"` 93 // The access grant's level of access. Valid values: `READ`, `WRITE`, `READWRITE`. 94 Permission pulumi.StringOutput `pulumi:"permission"` 95 // If you are creating an access grant that grants access to only one object, set this to `Object`. Valid values: `Object`. 96 S3PrefixType pulumi.StringPtrOutput `pulumi:"s3PrefixType"` 97 // Key-value map of resource tags. 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 } 104 105 // NewAccessGrant registers a new resource with the given unique name, arguments, and options. 106 func NewAccessGrant(ctx *pulumi.Context, 107 name string, args *AccessGrantArgs, opts ...pulumi.ResourceOption) (*AccessGrant, error) { 108 if args == nil { 109 return nil, errors.New("missing one or more required arguments") 110 } 111 112 if args.AccessGrantsLocationId == nil { 113 return nil, errors.New("invalid value for required argument 'AccessGrantsLocationId'") 114 } 115 if args.Permission == nil { 116 return nil, errors.New("invalid value for required argument 'Permission'") 117 } 118 opts = internal.PkgResourceDefaultOpts(opts) 119 var resource AccessGrant 120 err := ctx.RegisterResource("aws:s3control/accessGrant:AccessGrant", name, args, &resource, opts...) 121 if err != nil { 122 return nil, err 123 } 124 return &resource, nil 125 } 126 127 // GetAccessGrant gets an existing AccessGrant resource's state with the given name, ID, and optional 128 // state properties that are used to uniquely qualify the lookup (nil if not required). 129 func GetAccessGrant(ctx *pulumi.Context, 130 name string, id pulumi.IDInput, state *AccessGrantState, opts ...pulumi.ResourceOption) (*AccessGrant, error) { 131 var resource AccessGrant 132 err := ctx.ReadResource("aws:s3control/accessGrant:AccessGrant", name, id, state, &resource, opts...) 133 if err != nil { 134 return nil, err 135 } 136 return &resource, nil 137 } 138 139 // Input properties used for looking up and filtering AccessGrant resources. 140 type accessGrantState struct { 141 // Amazon Resource Name (ARN) of the S3 Access Grant. 142 AccessGrantArn *string `pulumi:"accessGrantArn"` 143 // Unique ID of the S3 Access Grant. 144 AccessGrantId *string `pulumi:"accessGrantId"` 145 // See Location Configuration below for more details. 146 AccessGrantsLocationConfiguration *AccessGrantAccessGrantsLocationConfiguration `pulumi:"accessGrantsLocationConfiguration"` 147 // The ID of the S3 Access Grants location to with the access grant is giving access. 148 AccessGrantsLocationId *string `pulumi:"accessGrantsLocationId"` 149 AccountId *string `pulumi:"accountId"` 150 // The access grant's scope. 151 GrantScope *string `pulumi:"grantScope"` 152 // See Grantee below for more details. 153 Grantee *AccessGrantGrantee `pulumi:"grantee"` 154 // The access grant's level of access. Valid values: `READ`, `WRITE`, `READWRITE`. 155 Permission *string `pulumi:"permission"` 156 // If you are creating an access grant that grants access to only one object, set this to `Object`. Valid values: `Object`. 157 S3PrefixType *string `pulumi:"s3PrefixType"` 158 // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 159 Tags map[string]string `pulumi:"tags"` 160 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 161 // 162 // Deprecated: Please use `tags` instead. 163 TagsAll map[string]string `pulumi:"tagsAll"` 164 } 165 166 type AccessGrantState struct { 167 // Amazon Resource Name (ARN) of the S3 Access Grant. 168 AccessGrantArn pulumi.StringPtrInput 169 // Unique ID of the S3 Access Grant. 170 AccessGrantId pulumi.StringPtrInput 171 // See Location Configuration below for more details. 172 AccessGrantsLocationConfiguration AccessGrantAccessGrantsLocationConfigurationPtrInput 173 // The ID of the S3 Access Grants location to with the access grant is giving access. 174 AccessGrantsLocationId pulumi.StringPtrInput 175 AccountId pulumi.StringPtrInput 176 // The access grant's scope. 177 GrantScope pulumi.StringPtrInput 178 // See Grantee below for more details. 179 Grantee AccessGrantGranteePtrInput 180 // The access grant's level of access. Valid values: `READ`, `WRITE`, `READWRITE`. 181 Permission pulumi.StringPtrInput 182 // If you are creating an access grant that grants access to only one object, set this to `Object`. Valid values: `Object`. 183 S3PrefixType pulumi.StringPtrInput 184 // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 185 Tags pulumi.StringMapInput 186 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 187 // 188 // Deprecated: Please use `tags` instead. 189 TagsAll pulumi.StringMapInput 190 } 191 192 func (AccessGrantState) ElementType() reflect.Type { 193 return reflect.TypeOf((*accessGrantState)(nil)).Elem() 194 } 195 196 type accessGrantArgs struct { 197 // See Location Configuration below for more details. 198 AccessGrantsLocationConfiguration *AccessGrantAccessGrantsLocationConfiguration `pulumi:"accessGrantsLocationConfiguration"` 199 // The ID of the S3 Access Grants location to with the access grant is giving access. 200 AccessGrantsLocationId string `pulumi:"accessGrantsLocationId"` 201 AccountId *string `pulumi:"accountId"` 202 // See Grantee below for more details. 203 Grantee *AccessGrantGrantee `pulumi:"grantee"` 204 // The access grant's level of access. Valid values: `READ`, `WRITE`, `READWRITE`. 205 Permission string `pulumi:"permission"` 206 // If you are creating an access grant that grants access to only one object, set this to `Object`. Valid values: `Object`. 207 S3PrefixType *string `pulumi:"s3PrefixType"` 208 // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 209 Tags map[string]string `pulumi:"tags"` 210 } 211 212 // The set of arguments for constructing a AccessGrant resource. 213 type AccessGrantArgs struct { 214 // See Location Configuration below for more details. 215 AccessGrantsLocationConfiguration AccessGrantAccessGrantsLocationConfigurationPtrInput 216 // The ID of the S3 Access Grants location to with the access grant is giving access. 217 AccessGrantsLocationId pulumi.StringInput 218 AccountId pulumi.StringPtrInput 219 // See Grantee below for more details. 220 Grantee AccessGrantGranteePtrInput 221 // The access grant's level of access. Valid values: `READ`, `WRITE`, `READWRITE`. 222 Permission pulumi.StringInput 223 // If you are creating an access grant that grants access to only one object, set this to `Object`. Valid values: `Object`. 224 S3PrefixType pulumi.StringPtrInput 225 // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 226 Tags pulumi.StringMapInput 227 } 228 229 func (AccessGrantArgs) ElementType() reflect.Type { 230 return reflect.TypeOf((*accessGrantArgs)(nil)).Elem() 231 } 232 233 type AccessGrantInput interface { 234 pulumi.Input 235 236 ToAccessGrantOutput() AccessGrantOutput 237 ToAccessGrantOutputWithContext(ctx context.Context) AccessGrantOutput 238 } 239 240 func (*AccessGrant) ElementType() reflect.Type { 241 return reflect.TypeOf((**AccessGrant)(nil)).Elem() 242 } 243 244 func (i *AccessGrant) ToAccessGrantOutput() AccessGrantOutput { 245 return i.ToAccessGrantOutputWithContext(context.Background()) 246 } 247 248 func (i *AccessGrant) ToAccessGrantOutputWithContext(ctx context.Context) AccessGrantOutput { 249 return pulumi.ToOutputWithContext(ctx, i).(AccessGrantOutput) 250 } 251 252 // AccessGrantArrayInput is an input type that accepts AccessGrantArray and AccessGrantArrayOutput values. 253 // You can construct a concrete instance of `AccessGrantArrayInput` via: 254 // 255 // AccessGrantArray{ AccessGrantArgs{...} } 256 type AccessGrantArrayInput interface { 257 pulumi.Input 258 259 ToAccessGrantArrayOutput() AccessGrantArrayOutput 260 ToAccessGrantArrayOutputWithContext(context.Context) AccessGrantArrayOutput 261 } 262 263 type AccessGrantArray []AccessGrantInput 264 265 func (AccessGrantArray) ElementType() reflect.Type { 266 return reflect.TypeOf((*[]*AccessGrant)(nil)).Elem() 267 } 268 269 func (i AccessGrantArray) ToAccessGrantArrayOutput() AccessGrantArrayOutput { 270 return i.ToAccessGrantArrayOutputWithContext(context.Background()) 271 } 272 273 func (i AccessGrantArray) ToAccessGrantArrayOutputWithContext(ctx context.Context) AccessGrantArrayOutput { 274 return pulumi.ToOutputWithContext(ctx, i).(AccessGrantArrayOutput) 275 } 276 277 // AccessGrantMapInput is an input type that accepts AccessGrantMap and AccessGrantMapOutput values. 278 // You can construct a concrete instance of `AccessGrantMapInput` via: 279 // 280 // AccessGrantMap{ "key": AccessGrantArgs{...} } 281 type AccessGrantMapInput interface { 282 pulumi.Input 283 284 ToAccessGrantMapOutput() AccessGrantMapOutput 285 ToAccessGrantMapOutputWithContext(context.Context) AccessGrantMapOutput 286 } 287 288 type AccessGrantMap map[string]AccessGrantInput 289 290 func (AccessGrantMap) ElementType() reflect.Type { 291 return reflect.TypeOf((*map[string]*AccessGrant)(nil)).Elem() 292 } 293 294 func (i AccessGrantMap) ToAccessGrantMapOutput() AccessGrantMapOutput { 295 return i.ToAccessGrantMapOutputWithContext(context.Background()) 296 } 297 298 func (i AccessGrantMap) ToAccessGrantMapOutputWithContext(ctx context.Context) AccessGrantMapOutput { 299 return pulumi.ToOutputWithContext(ctx, i).(AccessGrantMapOutput) 300 } 301 302 type AccessGrantOutput struct{ *pulumi.OutputState } 303 304 func (AccessGrantOutput) ElementType() reflect.Type { 305 return reflect.TypeOf((**AccessGrant)(nil)).Elem() 306 } 307 308 func (o AccessGrantOutput) ToAccessGrantOutput() AccessGrantOutput { 309 return o 310 } 311 312 func (o AccessGrantOutput) ToAccessGrantOutputWithContext(ctx context.Context) AccessGrantOutput { 313 return o 314 } 315 316 // Amazon Resource Name (ARN) of the S3 Access Grant. 317 func (o AccessGrantOutput) AccessGrantArn() pulumi.StringOutput { 318 return o.ApplyT(func(v *AccessGrant) pulumi.StringOutput { return v.AccessGrantArn }).(pulumi.StringOutput) 319 } 320 321 // Unique ID of the S3 Access Grant. 322 func (o AccessGrantOutput) AccessGrantId() pulumi.StringOutput { 323 return o.ApplyT(func(v *AccessGrant) pulumi.StringOutput { return v.AccessGrantId }).(pulumi.StringOutput) 324 } 325 326 // See Location Configuration below for more details. 327 func (o AccessGrantOutput) AccessGrantsLocationConfiguration() AccessGrantAccessGrantsLocationConfigurationPtrOutput { 328 return o.ApplyT(func(v *AccessGrant) AccessGrantAccessGrantsLocationConfigurationPtrOutput { 329 return v.AccessGrantsLocationConfiguration 330 }).(AccessGrantAccessGrantsLocationConfigurationPtrOutput) 331 } 332 333 // The ID of the S3 Access Grants location to with the access grant is giving access. 334 func (o AccessGrantOutput) AccessGrantsLocationId() pulumi.StringOutput { 335 return o.ApplyT(func(v *AccessGrant) pulumi.StringOutput { return v.AccessGrantsLocationId }).(pulumi.StringOutput) 336 } 337 338 func (o AccessGrantOutput) AccountId() pulumi.StringOutput { 339 return o.ApplyT(func(v *AccessGrant) pulumi.StringOutput { return v.AccountId }).(pulumi.StringOutput) 340 } 341 342 // The access grant's scope. 343 func (o AccessGrantOutput) GrantScope() pulumi.StringOutput { 344 return o.ApplyT(func(v *AccessGrant) pulumi.StringOutput { return v.GrantScope }).(pulumi.StringOutput) 345 } 346 347 // See Grantee below for more details. 348 func (o AccessGrantOutput) Grantee() AccessGrantGranteePtrOutput { 349 return o.ApplyT(func(v *AccessGrant) AccessGrantGranteePtrOutput { return v.Grantee }).(AccessGrantGranteePtrOutput) 350 } 351 352 // The access grant's level of access. Valid values: `READ`, `WRITE`, `READWRITE`. 353 func (o AccessGrantOutput) Permission() pulumi.StringOutput { 354 return o.ApplyT(func(v *AccessGrant) pulumi.StringOutput { return v.Permission }).(pulumi.StringOutput) 355 } 356 357 // If you are creating an access grant that grants access to only one object, set this to `Object`. Valid values: `Object`. 358 func (o AccessGrantOutput) S3PrefixType() pulumi.StringPtrOutput { 359 return o.ApplyT(func(v *AccessGrant) pulumi.StringPtrOutput { return v.S3PrefixType }).(pulumi.StringPtrOutput) 360 } 361 362 // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 363 func (o AccessGrantOutput) Tags() pulumi.StringMapOutput { 364 return o.ApplyT(func(v *AccessGrant) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 365 } 366 367 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 368 // 369 // Deprecated: Please use `tags` instead. 370 func (o AccessGrantOutput) TagsAll() pulumi.StringMapOutput { 371 return o.ApplyT(func(v *AccessGrant) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 372 } 373 374 type AccessGrantArrayOutput struct{ *pulumi.OutputState } 375 376 func (AccessGrantArrayOutput) ElementType() reflect.Type { 377 return reflect.TypeOf((*[]*AccessGrant)(nil)).Elem() 378 } 379 380 func (o AccessGrantArrayOutput) ToAccessGrantArrayOutput() AccessGrantArrayOutput { 381 return o 382 } 383 384 func (o AccessGrantArrayOutput) ToAccessGrantArrayOutputWithContext(ctx context.Context) AccessGrantArrayOutput { 385 return o 386 } 387 388 func (o AccessGrantArrayOutput) Index(i pulumi.IntInput) AccessGrantOutput { 389 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *AccessGrant { 390 return vs[0].([]*AccessGrant)[vs[1].(int)] 391 }).(AccessGrantOutput) 392 } 393 394 type AccessGrantMapOutput struct{ *pulumi.OutputState } 395 396 func (AccessGrantMapOutput) ElementType() reflect.Type { 397 return reflect.TypeOf((*map[string]*AccessGrant)(nil)).Elem() 398 } 399 400 func (o AccessGrantMapOutput) ToAccessGrantMapOutput() AccessGrantMapOutput { 401 return o 402 } 403 404 func (o AccessGrantMapOutput) ToAccessGrantMapOutputWithContext(ctx context.Context) AccessGrantMapOutput { 405 return o 406 } 407 408 func (o AccessGrantMapOutput) MapIndex(k pulumi.StringInput) AccessGrantOutput { 409 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *AccessGrant { 410 return vs[0].(map[string]*AccessGrant)[vs[1].(string)] 411 }).(AccessGrantOutput) 412 } 413 414 func init() { 415 pulumi.RegisterInputType(reflect.TypeOf((*AccessGrantInput)(nil)).Elem(), &AccessGrant{}) 416 pulumi.RegisterInputType(reflect.TypeOf((*AccessGrantArrayInput)(nil)).Elem(), AccessGrantArray{}) 417 pulumi.RegisterInputType(reflect.TypeOf((*AccessGrantMapInput)(nil)).Elem(), AccessGrantMap{}) 418 pulumi.RegisterOutputType(AccessGrantOutput{}) 419 pulumi.RegisterOutputType(AccessGrantArrayOutput{}) 420 pulumi.RegisterOutputType(AccessGrantMapOutput{}) 421 }