github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ram/resourceShare.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  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // Manages a Resource Access Manager (RAM) Resource Share. To associate principals with the share, see the `ram.PrincipalAssociation` resource. To associate resources with the share, see the `ram.ResourceAssociation` resource.
    15  //
    16  // ## Example Usage
    17  //
    18  // <!--Start PulumiCodeChooser -->
    19  // ```go
    20  // package main
    21  //
    22  // import (
    23  //
    24  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ram"
    25  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    26  //
    27  // )
    28  //
    29  //	func main() {
    30  //		pulumi.Run(func(ctx *pulumi.Context) error {
    31  //			_, err := ram.NewResourceShare(ctx, "example", &ram.ResourceShareArgs{
    32  //				Name:                    pulumi.String("example"),
    33  //				AllowExternalPrincipals: pulumi.Bool(true),
    34  //				Tags: pulumi.StringMap{
    35  //					"Environment": pulumi.String("Production"),
    36  //				},
    37  //			})
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			return nil
    42  //		})
    43  //	}
    44  //
    45  // ```
    46  // <!--End PulumiCodeChooser -->
    47  //
    48  // ## Import
    49  //
    50  // Using `pulumi import`, import resource shares using the `arn` of the resource share. For example:
    51  //
    52  // ```sh
    53  // $ pulumi import aws:ram/resourceShare:ResourceShare example arn:aws:ram:eu-west-1:123456789012:resource-share/73da1ab9-b94a-4ba3-8eb4-45917f7f4b12
    54  // ```
    55  type ResourceShare struct {
    56  	pulumi.CustomResourceState
    57  
    58  	// Indicates whether principals outside your organization can be associated with a resource share.
    59  	AllowExternalPrincipals pulumi.BoolPtrOutput `pulumi:"allowExternalPrincipals"`
    60  	// The Amazon Resource Name (ARN) of the resource share.
    61  	Arn pulumi.StringOutput `pulumi:"arn"`
    62  	// The name of the resource share.
    63  	Name pulumi.StringOutput `pulumi:"name"`
    64  	// Specifies the Amazon Resource Names (ARNs) of the RAM permission to associate with the resource share. If you do not specify an ARN for the permission, RAM automatically attaches the default version of the permission for each resource type. You can associate only one permission with each resource type included in the resource share.
    65  	PermissionArns pulumi.StringArrayOutput `pulumi:"permissionArns"`
    66  	// A map of tags to assign to the resource share. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    67  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    68  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    69  	//
    70  	// Deprecated: Please use `tags` instead.
    71  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    72  }
    73  
    74  // NewResourceShare registers a new resource with the given unique name, arguments, and options.
    75  func NewResourceShare(ctx *pulumi.Context,
    76  	name string, args *ResourceShareArgs, opts ...pulumi.ResourceOption) (*ResourceShare, error) {
    77  	if args == nil {
    78  		args = &ResourceShareArgs{}
    79  	}
    80  
    81  	opts = internal.PkgResourceDefaultOpts(opts)
    82  	var resource ResourceShare
    83  	err := ctx.RegisterResource("aws:ram/resourceShare:ResourceShare", name, args, &resource, opts...)
    84  	if err != nil {
    85  		return nil, err
    86  	}
    87  	return &resource, nil
    88  }
    89  
    90  // GetResourceShare gets an existing ResourceShare resource's state with the given name, ID, and optional
    91  // state properties that are used to uniquely qualify the lookup (nil if not required).
    92  func GetResourceShare(ctx *pulumi.Context,
    93  	name string, id pulumi.IDInput, state *ResourceShareState, opts ...pulumi.ResourceOption) (*ResourceShare, error) {
    94  	var resource ResourceShare
    95  	err := ctx.ReadResource("aws:ram/resourceShare:ResourceShare", name, id, state, &resource, opts...)
    96  	if err != nil {
    97  		return nil, err
    98  	}
    99  	return &resource, nil
   100  }
   101  
   102  // Input properties used for looking up and filtering ResourceShare resources.
   103  type resourceShareState struct {
   104  	// Indicates whether principals outside your organization can be associated with a resource share.
   105  	AllowExternalPrincipals *bool `pulumi:"allowExternalPrincipals"`
   106  	// The Amazon Resource Name (ARN) of the resource share.
   107  	Arn *string `pulumi:"arn"`
   108  	// The name of the resource share.
   109  	Name *string `pulumi:"name"`
   110  	// Specifies the Amazon Resource Names (ARNs) of the RAM permission to associate with the resource share. If you do not specify an ARN for the permission, RAM automatically attaches the default version of the permission for each resource type. You can associate only one permission with each resource type included in the resource share.
   111  	PermissionArns []string `pulumi:"permissionArns"`
   112  	// A map of tags to assign to the resource share. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   113  	Tags map[string]string `pulumi:"tags"`
   114  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   115  	//
   116  	// Deprecated: Please use `tags` instead.
   117  	TagsAll map[string]string `pulumi:"tagsAll"`
   118  }
   119  
   120  type ResourceShareState struct {
   121  	// Indicates whether principals outside your organization can be associated with a resource share.
   122  	AllowExternalPrincipals pulumi.BoolPtrInput
   123  	// The Amazon Resource Name (ARN) of the resource share.
   124  	Arn pulumi.StringPtrInput
   125  	// The name of the resource share.
   126  	Name pulumi.StringPtrInput
   127  	// Specifies the Amazon Resource Names (ARNs) of the RAM permission to associate with the resource share. If you do not specify an ARN for the permission, RAM automatically attaches the default version of the permission for each resource type. You can associate only one permission with each resource type included in the resource share.
   128  	PermissionArns pulumi.StringArrayInput
   129  	// A map of tags to assign to the resource share. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   130  	Tags pulumi.StringMapInput
   131  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   132  	//
   133  	// Deprecated: Please use `tags` instead.
   134  	TagsAll pulumi.StringMapInput
   135  }
   136  
   137  func (ResourceShareState) ElementType() reflect.Type {
   138  	return reflect.TypeOf((*resourceShareState)(nil)).Elem()
   139  }
   140  
   141  type resourceShareArgs struct {
   142  	// Indicates whether principals outside your organization can be associated with a resource share.
   143  	AllowExternalPrincipals *bool `pulumi:"allowExternalPrincipals"`
   144  	// The name of the resource share.
   145  	Name *string `pulumi:"name"`
   146  	// Specifies the Amazon Resource Names (ARNs) of the RAM permission to associate with the resource share. If you do not specify an ARN for the permission, RAM automatically attaches the default version of the permission for each resource type. You can associate only one permission with each resource type included in the resource share.
   147  	PermissionArns []string `pulumi:"permissionArns"`
   148  	// A map of tags to assign to the resource share. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   149  	Tags map[string]string `pulumi:"tags"`
   150  }
   151  
   152  // The set of arguments for constructing a ResourceShare resource.
   153  type ResourceShareArgs struct {
   154  	// Indicates whether principals outside your organization can be associated with a resource share.
   155  	AllowExternalPrincipals pulumi.BoolPtrInput
   156  	// The name of the resource share.
   157  	Name pulumi.StringPtrInput
   158  	// Specifies the Amazon Resource Names (ARNs) of the RAM permission to associate with the resource share. If you do not specify an ARN for the permission, RAM automatically attaches the default version of the permission for each resource type. You can associate only one permission with each resource type included in the resource share.
   159  	PermissionArns pulumi.StringArrayInput
   160  	// A map of tags to assign to the resource share. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   161  	Tags pulumi.StringMapInput
   162  }
   163  
   164  func (ResourceShareArgs) ElementType() reflect.Type {
   165  	return reflect.TypeOf((*resourceShareArgs)(nil)).Elem()
   166  }
   167  
   168  type ResourceShareInput interface {
   169  	pulumi.Input
   170  
   171  	ToResourceShareOutput() ResourceShareOutput
   172  	ToResourceShareOutputWithContext(ctx context.Context) ResourceShareOutput
   173  }
   174  
   175  func (*ResourceShare) ElementType() reflect.Type {
   176  	return reflect.TypeOf((**ResourceShare)(nil)).Elem()
   177  }
   178  
   179  func (i *ResourceShare) ToResourceShareOutput() ResourceShareOutput {
   180  	return i.ToResourceShareOutputWithContext(context.Background())
   181  }
   182  
   183  func (i *ResourceShare) ToResourceShareOutputWithContext(ctx context.Context) ResourceShareOutput {
   184  	return pulumi.ToOutputWithContext(ctx, i).(ResourceShareOutput)
   185  }
   186  
   187  // ResourceShareArrayInput is an input type that accepts ResourceShareArray and ResourceShareArrayOutput values.
   188  // You can construct a concrete instance of `ResourceShareArrayInput` via:
   189  //
   190  //	ResourceShareArray{ ResourceShareArgs{...} }
   191  type ResourceShareArrayInput interface {
   192  	pulumi.Input
   193  
   194  	ToResourceShareArrayOutput() ResourceShareArrayOutput
   195  	ToResourceShareArrayOutputWithContext(context.Context) ResourceShareArrayOutput
   196  }
   197  
   198  type ResourceShareArray []ResourceShareInput
   199  
   200  func (ResourceShareArray) ElementType() reflect.Type {
   201  	return reflect.TypeOf((*[]*ResourceShare)(nil)).Elem()
   202  }
   203  
   204  func (i ResourceShareArray) ToResourceShareArrayOutput() ResourceShareArrayOutput {
   205  	return i.ToResourceShareArrayOutputWithContext(context.Background())
   206  }
   207  
   208  func (i ResourceShareArray) ToResourceShareArrayOutputWithContext(ctx context.Context) ResourceShareArrayOutput {
   209  	return pulumi.ToOutputWithContext(ctx, i).(ResourceShareArrayOutput)
   210  }
   211  
   212  // ResourceShareMapInput is an input type that accepts ResourceShareMap and ResourceShareMapOutput values.
   213  // You can construct a concrete instance of `ResourceShareMapInput` via:
   214  //
   215  //	ResourceShareMap{ "key": ResourceShareArgs{...} }
   216  type ResourceShareMapInput interface {
   217  	pulumi.Input
   218  
   219  	ToResourceShareMapOutput() ResourceShareMapOutput
   220  	ToResourceShareMapOutputWithContext(context.Context) ResourceShareMapOutput
   221  }
   222  
   223  type ResourceShareMap map[string]ResourceShareInput
   224  
   225  func (ResourceShareMap) ElementType() reflect.Type {
   226  	return reflect.TypeOf((*map[string]*ResourceShare)(nil)).Elem()
   227  }
   228  
   229  func (i ResourceShareMap) ToResourceShareMapOutput() ResourceShareMapOutput {
   230  	return i.ToResourceShareMapOutputWithContext(context.Background())
   231  }
   232  
   233  func (i ResourceShareMap) ToResourceShareMapOutputWithContext(ctx context.Context) ResourceShareMapOutput {
   234  	return pulumi.ToOutputWithContext(ctx, i).(ResourceShareMapOutput)
   235  }
   236  
   237  type ResourceShareOutput struct{ *pulumi.OutputState }
   238  
   239  func (ResourceShareOutput) ElementType() reflect.Type {
   240  	return reflect.TypeOf((**ResourceShare)(nil)).Elem()
   241  }
   242  
   243  func (o ResourceShareOutput) ToResourceShareOutput() ResourceShareOutput {
   244  	return o
   245  }
   246  
   247  func (o ResourceShareOutput) ToResourceShareOutputWithContext(ctx context.Context) ResourceShareOutput {
   248  	return o
   249  }
   250  
   251  // Indicates whether principals outside your organization can be associated with a resource share.
   252  func (o ResourceShareOutput) AllowExternalPrincipals() pulumi.BoolPtrOutput {
   253  	return o.ApplyT(func(v *ResourceShare) pulumi.BoolPtrOutput { return v.AllowExternalPrincipals }).(pulumi.BoolPtrOutput)
   254  }
   255  
   256  // The Amazon Resource Name (ARN) of the resource share.
   257  func (o ResourceShareOutput) Arn() pulumi.StringOutput {
   258  	return o.ApplyT(func(v *ResourceShare) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   259  }
   260  
   261  // The name of the resource share.
   262  func (o ResourceShareOutput) Name() pulumi.StringOutput {
   263  	return o.ApplyT(func(v *ResourceShare) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   264  }
   265  
   266  // Specifies the Amazon Resource Names (ARNs) of the RAM permission to associate with the resource share. If you do not specify an ARN for the permission, RAM automatically attaches the default version of the permission for each resource type. You can associate only one permission with each resource type included in the resource share.
   267  func (o ResourceShareOutput) PermissionArns() pulumi.StringArrayOutput {
   268  	return o.ApplyT(func(v *ResourceShare) pulumi.StringArrayOutput { return v.PermissionArns }).(pulumi.StringArrayOutput)
   269  }
   270  
   271  // A map of tags to assign to the resource share. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   272  func (o ResourceShareOutput) Tags() pulumi.StringMapOutput {
   273  	return o.ApplyT(func(v *ResourceShare) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   274  }
   275  
   276  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   277  //
   278  // Deprecated: Please use `tags` instead.
   279  func (o ResourceShareOutput) TagsAll() pulumi.StringMapOutput {
   280  	return o.ApplyT(func(v *ResourceShare) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   281  }
   282  
   283  type ResourceShareArrayOutput struct{ *pulumi.OutputState }
   284  
   285  func (ResourceShareArrayOutput) ElementType() reflect.Type {
   286  	return reflect.TypeOf((*[]*ResourceShare)(nil)).Elem()
   287  }
   288  
   289  func (o ResourceShareArrayOutput) ToResourceShareArrayOutput() ResourceShareArrayOutput {
   290  	return o
   291  }
   292  
   293  func (o ResourceShareArrayOutput) ToResourceShareArrayOutputWithContext(ctx context.Context) ResourceShareArrayOutput {
   294  	return o
   295  }
   296  
   297  func (o ResourceShareArrayOutput) Index(i pulumi.IntInput) ResourceShareOutput {
   298  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ResourceShare {
   299  		return vs[0].([]*ResourceShare)[vs[1].(int)]
   300  	}).(ResourceShareOutput)
   301  }
   302  
   303  type ResourceShareMapOutput struct{ *pulumi.OutputState }
   304  
   305  func (ResourceShareMapOutput) ElementType() reflect.Type {
   306  	return reflect.TypeOf((*map[string]*ResourceShare)(nil)).Elem()
   307  }
   308  
   309  func (o ResourceShareMapOutput) ToResourceShareMapOutput() ResourceShareMapOutput {
   310  	return o
   311  }
   312  
   313  func (o ResourceShareMapOutput) ToResourceShareMapOutputWithContext(ctx context.Context) ResourceShareMapOutput {
   314  	return o
   315  }
   316  
   317  func (o ResourceShareMapOutput) MapIndex(k pulumi.StringInput) ResourceShareOutput {
   318  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ResourceShare {
   319  		return vs[0].(map[string]*ResourceShare)[vs[1].(string)]
   320  	}).(ResourceShareOutput)
   321  }
   322  
   323  func init() {
   324  	pulumi.RegisterInputType(reflect.TypeOf((*ResourceShareInput)(nil)).Elem(), &ResourceShare{})
   325  	pulumi.RegisterInputType(reflect.TypeOf((*ResourceShareArrayInput)(nil)).Elem(), ResourceShareArray{})
   326  	pulumi.RegisterInputType(reflect.TypeOf((*ResourceShareMapInput)(nil)).Elem(), ResourceShareMap{})
   327  	pulumi.RegisterOutputType(ResourceShareOutput{})
   328  	pulumi.RegisterOutputType(ResourceShareArrayOutput{})
   329  	pulumi.RegisterOutputType(ResourceShareMapOutput{})
   330  }