github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ram/resourceShareAccepter.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 ram 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 // Manage accepting a Resource Access Manager (RAM) Resource Share invitation. From a _receiver_ AWS account, accept an invitation to share resources that were shared by a _sender_ AWS account. To create a resource share in the _sender_, see the `ram.ResourceShare` resource. 16 // 17 // > **Note:** If both AWS accounts are in the same Organization and [RAM Sharing with AWS Organizations is enabled](https://docs.aws.amazon.com/ram/latest/userguide/getting-started-sharing.html#getting-started-sharing-orgs), this resource is not necessary as RAM Resource Share invitations are not used. 18 // 19 // ## Example Usage 20 // 21 // This configuration provides an example of using multiple AWS providers to configure two different AWS accounts. In the _sender_ account, the configuration creates a `ram.ResourceShare` and uses a data source in the _receiver_ account to create a `ram.PrincipalAssociation` resource with the _receiver's_ account ID. In the _receiver_ account, the configuration accepts the invitation to share resources with the `ram.ResourceShareAccepter`. 22 // 23 // <!--Start PulumiCodeChooser --> 24 // ```go 25 // package main 26 // 27 // import ( 28 // 29 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws" 30 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ram" 31 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 32 // 33 // ) 34 // 35 // func main() { 36 // pulumi.Run(func(ctx *pulumi.Context) error { 37 // senderShare, err := ram.NewResourceShare(ctx, "sender_share", &ram.ResourceShareArgs{ 38 // Name: pulumi.String("tf-test-resource-share"), 39 // AllowExternalPrincipals: pulumi.Bool(true), 40 // Tags: pulumi.StringMap{ 41 // "Name": pulumi.String("tf-test-resource-share"), 42 // }, 43 // }) 44 // if err != nil { 45 // return err 46 // } 47 // receiver, err := aws.GetCallerIdentity(ctx, nil, nil) 48 // if err != nil { 49 // return err 50 // } 51 // senderInvite, err := ram.NewPrincipalAssociation(ctx, "sender_invite", &ram.PrincipalAssociationArgs{ 52 // Principal: pulumi.String(receiver.AccountId), 53 // ResourceShareArn: senderShare.Arn, 54 // }) 55 // if err != nil { 56 // return err 57 // } 58 // _, err = ram.NewResourceShareAccepter(ctx, "receiver_accept", &ram.ResourceShareAccepterArgs{ 59 // ShareArn: senderInvite.ResourceShareArn, 60 // }) 61 // if err != nil { 62 // return err 63 // } 64 // return nil 65 // }) 66 // } 67 // 68 // ``` 69 // <!--End PulumiCodeChooser --> 70 // 71 // ## Import 72 // 73 // Using `pulumi import`, import resource share accepters using the resource share ARN. For example: 74 // 75 // ```sh 76 // $ pulumi import aws:ram/resourceShareAccepter:ResourceShareAccepter example arn:aws:ram:us-east-1:123456789012:resource-share/c4b56393-e8d9-89d9-6dc9-883752de4767 77 // ``` 78 type ResourceShareAccepter struct { 79 pulumi.CustomResourceState 80 81 // The ARN of the resource share invitation. 82 InvitationArn pulumi.StringOutput `pulumi:"invitationArn"` 83 // The account ID of the receiver account which accepts the invitation. 84 ReceiverAccountId pulumi.StringOutput `pulumi:"receiverAccountId"` 85 // A list of the resource ARNs shared via the resource share. 86 Resources pulumi.StringArrayOutput `pulumi:"resources"` 87 // The account ID of the sender account which submits the invitation. 88 SenderAccountId pulumi.StringOutput `pulumi:"senderAccountId"` 89 // The ARN of the resource share. 90 ShareArn pulumi.StringOutput `pulumi:"shareArn"` 91 // The ID of the resource share as displayed in the console. 92 ShareId pulumi.StringOutput `pulumi:"shareId"` 93 // The name of the resource share. 94 ShareName pulumi.StringOutput `pulumi:"shareName"` 95 // The status of the resource share (ACTIVE, PENDING, FAILED, DELETING, DELETED). 96 Status pulumi.StringOutput `pulumi:"status"` 97 } 98 99 // NewResourceShareAccepter registers a new resource with the given unique name, arguments, and options. 100 func NewResourceShareAccepter(ctx *pulumi.Context, 101 name string, args *ResourceShareAccepterArgs, opts ...pulumi.ResourceOption) (*ResourceShareAccepter, error) { 102 if args == nil { 103 return nil, errors.New("missing one or more required arguments") 104 } 105 106 if args.ShareArn == nil { 107 return nil, errors.New("invalid value for required argument 'ShareArn'") 108 } 109 opts = internal.PkgResourceDefaultOpts(opts) 110 var resource ResourceShareAccepter 111 err := ctx.RegisterResource("aws:ram/resourceShareAccepter:ResourceShareAccepter", name, args, &resource, opts...) 112 if err != nil { 113 return nil, err 114 } 115 return &resource, nil 116 } 117 118 // GetResourceShareAccepter gets an existing ResourceShareAccepter resource's state with the given name, ID, and optional 119 // state properties that are used to uniquely qualify the lookup (nil if not required). 120 func GetResourceShareAccepter(ctx *pulumi.Context, 121 name string, id pulumi.IDInput, state *ResourceShareAccepterState, opts ...pulumi.ResourceOption) (*ResourceShareAccepter, error) { 122 var resource ResourceShareAccepter 123 err := ctx.ReadResource("aws:ram/resourceShareAccepter:ResourceShareAccepter", name, id, state, &resource, opts...) 124 if err != nil { 125 return nil, err 126 } 127 return &resource, nil 128 } 129 130 // Input properties used for looking up and filtering ResourceShareAccepter resources. 131 type resourceShareAccepterState struct { 132 // The ARN of the resource share invitation. 133 InvitationArn *string `pulumi:"invitationArn"` 134 // The account ID of the receiver account which accepts the invitation. 135 ReceiverAccountId *string `pulumi:"receiverAccountId"` 136 // A list of the resource ARNs shared via the resource share. 137 Resources []string `pulumi:"resources"` 138 // The account ID of the sender account which submits the invitation. 139 SenderAccountId *string `pulumi:"senderAccountId"` 140 // The ARN of the resource share. 141 ShareArn *string `pulumi:"shareArn"` 142 // The ID of the resource share as displayed in the console. 143 ShareId *string `pulumi:"shareId"` 144 // The name of the resource share. 145 ShareName *string `pulumi:"shareName"` 146 // The status of the resource share (ACTIVE, PENDING, FAILED, DELETING, DELETED). 147 Status *string `pulumi:"status"` 148 } 149 150 type ResourceShareAccepterState struct { 151 // The ARN of the resource share invitation. 152 InvitationArn pulumi.StringPtrInput 153 // The account ID of the receiver account which accepts the invitation. 154 ReceiverAccountId pulumi.StringPtrInput 155 // A list of the resource ARNs shared via the resource share. 156 Resources pulumi.StringArrayInput 157 // The account ID of the sender account which submits the invitation. 158 SenderAccountId pulumi.StringPtrInput 159 // The ARN of the resource share. 160 ShareArn pulumi.StringPtrInput 161 // The ID of the resource share as displayed in the console. 162 ShareId pulumi.StringPtrInput 163 // The name of the resource share. 164 ShareName pulumi.StringPtrInput 165 // The status of the resource share (ACTIVE, PENDING, FAILED, DELETING, DELETED). 166 Status pulumi.StringPtrInput 167 } 168 169 func (ResourceShareAccepterState) ElementType() reflect.Type { 170 return reflect.TypeOf((*resourceShareAccepterState)(nil)).Elem() 171 } 172 173 type resourceShareAccepterArgs struct { 174 // The ARN of the resource share. 175 ShareArn string `pulumi:"shareArn"` 176 } 177 178 // The set of arguments for constructing a ResourceShareAccepter resource. 179 type ResourceShareAccepterArgs struct { 180 // The ARN of the resource share. 181 ShareArn pulumi.StringInput 182 } 183 184 func (ResourceShareAccepterArgs) ElementType() reflect.Type { 185 return reflect.TypeOf((*resourceShareAccepterArgs)(nil)).Elem() 186 } 187 188 type ResourceShareAccepterInput interface { 189 pulumi.Input 190 191 ToResourceShareAccepterOutput() ResourceShareAccepterOutput 192 ToResourceShareAccepterOutputWithContext(ctx context.Context) ResourceShareAccepterOutput 193 } 194 195 func (*ResourceShareAccepter) ElementType() reflect.Type { 196 return reflect.TypeOf((**ResourceShareAccepter)(nil)).Elem() 197 } 198 199 func (i *ResourceShareAccepter) ToResourceShareAccepterOutput() ResourceShareAccepterOutput { 200 return i.ToResourceShareAccepterOutputWithContext(context.Background()) 201 } 202 203 func (i *ResourceShareAccepter) ToResourceShareAccepterOutputWithContext(ctx context.Context) ResourceShareAccepterOutput { 204 return pulumi.ToOutputWithContext(ctx, i).(ResourceShareAccepterOutput) 205 } 206 207 // ResourceShareAccepterArrayInput is an input type that accepts ResourceShareAccepterArray and ResourceShareAccepterArrayOutput values. 208 // You can construct a concrete instance of `ResourceShareAccepterArrayInput` via: 209 // 210 // ResourceShareAccepterArray{ ResourceShareAccepterArgs{...} } 211 type ResourceShareAccepterArrayInput interface { 212 pulumi.Input 213 214 ToResourceShareAccepterArrayOutput() ResourceShareAccepterArrayOutput 215 ToResourceShareAccepterArrayOutputWithContext(context.Context) ResourceShareAccepterArrayOutput 216 } 217 218 type ResourceShareAccepterArray []ResourceShareAccepterInput 219 220 func (ResourceShareAccepterArray) ElementType() reflect.Type { 221 return reflect.TypeOf((*[]*ResourceShareAccepter)(nil)).Elem() 222 } 223 224 func (i ResourceShareAccepterArray) ToResourceShareAccepterArrayOutput() ResourceShareAccepterArrayOutput { 225 return i.ToResourceShareAccepterArrayOutputWithContext(context.Background()) 226 } 227 228 func (i ResourceShareAccepterArray) ToResourceShareAccepterArrayOutputWithContext(ctx context.Context) ResourceShareAccepterArrayOutput { 229 return pulumi.ToOutputWithContext(ctx, i).(ResourceShareAccepterArrayOutput) 230 } 231 232 // ResourceShareAccepterMapInput is an input type that accepts ResourceShareAccepterMap and ResourceShareAccepterMapOutput values. 233 // You can construct a concrete instance of `ResourceShareAccepterMapInput` via: 234 // 235 // ResourceShareAccepterMap{ "key": ResourceShareAccepterArgs{...} } 236 type ResourceShareAccepterMapInput interface { 237 pulumi.Input 238 239 ToResourceShareAccepterMapOutput() ResourceShareAccepterMapOutput 240 ToResourceShareAccepterMapOutputWithContext(context.Context) ResourceShareAccepterMapOutput 241 } 242 243 type ResourceShareAccepterMap map[string]ResourceShareAccepterInput 244 245 func (ResourceShareAccepterMap) ElementType() reflect.Type { 246 return reflect.TypeOf((*map[string]*ResourceShareAccepter)(nil)).Elem() 247 } 248 249 func (i ResourceShareAccepterMap) ToResourceShareAccepterMapOutput() ResourceShareAccepterMapOutput { 250 return i.ToResourceShareAccepterMapOutputWithContext(context.Background()) 251 } 252 253 func (i ResourceShareAccepterMap) ToResourceShareAccepterMapOutputWithContext(ctx context.Context) ResourceShareAccepterMapOutput { 254 return pulumi.ToOutputWithContext(ctx, i).(ResourceShareAccepterMapOutput) 255 } 256 257 type ResourceShareAccepterOutput struct{ *pulumi.OutputState } 258 259 func (ResourceShareAccepterOutput) ElementType() reflect.Type { 260 return reflect.TypeOf((**ResourceShareAccepter)(nil)).Elem() 261 } 262 263 func (o ResourceShareAccepterOutput) ToResourceShareAccepterOutput() ResourceShareAccepterOutput { 264 return o 265 } 266 267 func (o ResourceShareAccepterOutput) ToResourceShareAccepterOutputWithContext(ctx context.Context) ResourceShareAccepterOutput { 268 return o 269 } 270 271 // The ARN of the resource share invitation. 272 func (o ResourceShareAccepterOutput) InvitationArn() pulumi.StringOutput { 273 return o.ApplyT(func(v *ResourceShareAccepter) pulumi.StringOutput { return v.InvitationArn }).(pulumi.StringOutput) 274 } 275 276 // The account ID of the receiver account which accepts the invitation. 277 func (o ResourceShareAccepterOutput) ReceiverAccountId() pulumi.StringOutput { 278 return o.ApplyT(func(v *ResourceShareAccepter) pulumi.StringOutput { return v.ReceiverAccountId }).(pulumi.StringOutput) 279 } 280 281 // A list of the resource ARNs shared via the resource share. 282 func (o ResourceShareAccepterOutput) Resources() pulumi.StringArrayOutput { 283 return o.ApplyT(func(v *ResourceShareAccepter) pulumi.StringArrayOutput { return v.Resources }).(pulumi.StringArrayOutput) 284 } 285 286 // The account ID of the sender account which submits the invitation. 287 func (o ResourceShareAccepterOutput) SenderAccountId() pulumi.StringOutput { 288 return o.ApplyT(func(v *ResourceShareAccepter) pulumi.StringOutput { return v.SenderAccountId }).(pulumi.StringOutput) 289 } 290 291 // The ARN of the resource share. 292 func (o ResourceShareAccepterOutput) ShareArn() pulumi.StringOutput { 293 return o.ApplyT(func(v *ResourceShareAccepter) pulumi.StringOutput { return v.ShareArn }).(pulumi.StringOutput) 294 } 295 296 // The ID of the resource share as displayed in the console. 297 func (o ResourceShareAccepterOutput) ShareId() pulumi.StringOutput { 298 return o.ApplyT(func(v *ResourceShareAccepter) pulumi.StringOutput { return v.ShareId }).(pulumi.StringOutput) 299 } 300 301 // The name of the resource share. 302 func (o ResourceShareAccepterOutput) ShareName() pulumi.StringOutput { 303 return o.ApplyT(func(v *ResourceShareAccepter) pulumi.StringOutput { return v.ShareName }).(pulumi.StringOutput) 304 } 305 306 // The status of the resource share (ACTIVE, PENDING, FAILED, DELETING, DELETED). 307 func (o ResourceShareAccepterOutput) Status() pulumi.StringOutput { 308 return o.ApplyT(func(v *ResourceShareAccepter) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput) 309 } 310 311 type ResourceShareAccepterArrayOutput struct{ *pulumi.OutputState } 312 313 func (ResourceShareAccepterArrayOutput) ElementType() reflect.Type { 314 return reflect.TypeOf((*[]*ResourceShareAccepter)(nil)).Elem() 315 } 316 317 func (o ResourceShareAccepterArrayOutput) ToResourceShareAccepterArrayOutput() ResourceShareAccepterArrayOutput { 318 return o 319 } 320 321 func (o ResourceShareAccepterArrayOutput) ToResourceShareAccepterArrayOutputWithContext(ctx context.Context) ResourceShareAccepterArrayOutput { 322 return o 323 } 324 325 func (o ResourceShareAccepterArrayOutput) Index(i pulumi.IntInput) ResourceShareAccepterOutput { 326 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ResourceShareAccepter { 327 return vs[0].([]*ResourceShareAccepter)[vs[1].(int)] 328 }).(ResourceShareAccepterOutput) 329 } 330 331 type ResourceShareAccepterMapOutput struct{ *pulumi.OutputState } 332 333 func (ResourceShareAccepterMapOutput) ElementType() reflect.Type { 334 return reflect.TypeOf((*map[string]*ResourceShareAccepter)(nil)).Elem() 335 } 336 337 func (o ResourceShareAccepterMapOutput) ToResourceShareAccepterMapOutput() ResourceShareAccepterMapOutput { 338 return o 339 } 340 341 func (o ResourceShareAccepterMapOutput) ToResourceShareAccepterMapOutputWithContext(ctx context.Context) ResourceShareAccepterMapOutput { 342 return o 343 } 344 345 func (o ResourceShareAccepterMapOutput) MapIndex(k pulumi.StringInput) ResourceShareAccepterOutput { 346 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ResourceShareAccepter { 347 return vs[0].(map[string]*ResourceShareAccepter)[vs[1].(string)] 348 }).(ResourceShareAccepterOutput) 349 } 350 351 func init() { 352 pulumi.RegisterInputType(reflect.TypeOf((*ResourceShareAccepterInput)(nil)).Elem(), &ResourceShareAccepter{}) 353 pulumi.RegisterInputType(reflect.TypeOf((*ResourceShareAccepterArrayInput)(nil)).Elem(), ResourceShareAccepterArray{}) 354 pulumi.RegisterInputType(reflect.TypeOf((*ResourceShareAccepterMapInput)(nil)).Elem(), ResourceShareAccepterMap{}) 355 pulumi.RegisterOutputType(ResourceShareAccepterOutput{}) 356 pulumi.RegisterOutputType(ResourceShareAccepterArrayOutput{}) 357 pulumi.RegisterOutputType(ResourceShareAccepterMapOutput{}) 358 }