github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/vpcEndpointServiceAllowedPrinciple.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 ec2
     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 allow a principal to discover a VPC endpoint service.
    16  //
    17  // > **NOTE on VPC Endpoint Services and VPC Endpoint Service Allowed Principals:** This provider provides
    18  // both a standalone VPC Endpoint Service Allowed Principal resource
    19  // and a VPC Endpoint Service resource with an `allowedPrincipals` attribute. Do not use the same principal ARN in both
    20  // a VPC Endpoint Service resource and a VPC Endpoint Service Allowed Principal resource. Doing so will cause a conflict
    21  // and will overwrite the association.
    22  //
    23  // ## Example Usage
    24  //
    25  // Basic usage:
    26  //
    27  // <!--Start PulumiCodeChooser -->
    28  // ```go
    29  // package main
    30  //
    31  // import (
    32  //
    33  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
    34  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    35  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    36  //
    37  // )
    38  //
    39  //	func main() {
    40  //		pulumi.Run(func(ctx *pulumi.Context) error {
    41  //			current, err := aws.GetCallerIdentity(ctx, nil, nil)
    42  //			if err != nil {
    43  //				return err
    44  //			}
    45  //			_, err = ec2.NewVpcEndpointServiceAllowedPrinciple(ctx, "allow_me_to_foo", &ec2.VpcEndpointServiceAllowedPrincipleArgs{
    46  //				VpcEndpointServiceId: pulumi.Any(foo.Id),
    47  //				PrincipalArn:         pulumi.String(current.Arn),
    48  //			})
    49  //			if err != nil {
    50  //				return err
    51  //			}
    52  //			return nil
    53  //		})
    54  //	}
    55  //
    56  // ```
    57  // <!--End PulumiCodeChooser -->
    58  type VpcEndpointServiceAllowedPrinciple struct {
    59  	pulumi.CustomResourceState
    60  
    61  	// The ARN of the principal to allow permissions.
    62  	PrincipalArn pulumi.StringOutput `pulumi:"principalArn"`
    63  	// The ID of the VPC endpoint service to allow permission.
    64  	VpcEndpointServiceId pulumi.StringOutput `pulumi:"vpcEndpointServiceId"`
    65  }
    66  
    67  // NewVpcEndpointServiceAllowedPrinciple registers a new resource with the given unique name, arguments, and options.
    68  func NewVpcEndpointServiceAllowedPrinciple(ctx *pulumi.Context,
    69  	name string, args *VpcEndpointServiceAllowedPrincipleArgs, opts ...pulumi.ResourceOption) (*VpcEndpointServiceAllowedPrinciple, error) {
    70  	if args == nil {
    71  		return nil, errors.New("missing one or more required arguments")
    72  	}
    73  
    74  	if args.PrincipalArn == nil {
    75  		return nil, errors.New("invalid value for required argument 'PrincipalArn'")
    76  	}
    77  	if args.VpcEndpointServiceId == nil {
    78  		return nil, errors.New("invalid value for required argument 'VpcEndpointServiceId'")
    79  	}
    80  	opts = internal.PkgResourceDefaultOpts(opts)
    81  	var resource VpcEndpointServiceAllowedPrinciple
    82  	err := ctx.RegisterResource("aws:ec2/vpcEndpointServiceAllowedPrinciple:VpcEndpointServiceAllowedPrinciple", name, args, &resource, opts...)
    83  	if err != nil {
    84  		return nil, err
    85  	}
    86  	return &resource, nil
    87  }
    88  
    89  // GetVpcEndpointServiceAllowedPrinciple gets an existing VpcEndpointServiceAllowedPrinciple resource's state with the given name, ID, and optional
    90  // state properties that are used to uniquely qualify the lookup (nil if not required).
    91  func GetVpcEndpointServiceAllowedPrinciple(ctx *pulumi.Context,
    92  	name string, id pulumi.IDInput, state *VpcEndpointServiceAllowedPrincipleState, opts ...pulumi.ResourceOption) (*VpcEndpointServiceAllowedPrinciple, error) {
    93  	var resource VpcEndpointServiceAllowedPrinciple
    94  	err := ctx.ReadResource("aws:ec2/vpcEndpointServiceAllowedPrinciple:VpcEndpointServiceAllowedPrinciple", name, id, state, &resource, opts...)
    95  	if err != nil {
    96  		return nil, err
    97  	}
    98  	return &resource, nil
    99  }
   100  
   101  // Input properties used for looking up and filtering VpcEndpointServiceAllowedPrinciple resources.
   102  type vpcEndpointServiceAllowedPrincipleState struct {
   103  	// The ARN of the principal to allow permissions.
   104  	PrincipalArn *string `pulumi:"principalArn"`
   105  	// The ID of the VPC endpoint service to allow permission.
   106  	VpcEndpointServiceId *string `pulumi:"vpcEndpointServiceId"`
   107  }
   108  
   109  type VpcEndpointServiceAllowedPrincipleState struct {
   110  	// The ARN of the principal to allow permissions.
   111  	PrincipalArn pulumi.StringPtrInput
   112  	// The ID of the VPC endpoint service to allow permission.
   113  	VpcEndpointServiceId pulumi.StringPtrInput
   114  }
   115  
   116  func (VpcEndpointServiceAllowedPrincipleState) ElementType() reflect.Type {
   117  	return reflect.TypeOf((*vpcEndpointServiceAllowedPrincipleState)(nil)).Elem()
   118  }
   119  
   120  type vpcEndpointServiceAllowedPrincipleArgs struct {
   121  	// The ARN of the principal to allow permissions.
   122  	PrincipalArn string `pulumi:"principalArn"`
   123  	// The ID of the VPC endpoint service to allow permission.
   124  	VpcEndpointServiceId string `pulumi:"vpcEndpointServiceId"`
   125  }
   126  
   127  // The set of arguments for constructing a VpcEndpointServiceAllowedPrinciple resource.
   128  type VpcEndpointServiceAllowedPrincipleArgs struct {
   129  	// The ARN of the principal to allow permissions.
   130  	PrincipalArn pulumi.StringInput
   131  	// The ID of the VPC endpoint service to allow permission.
   132  	VpcEndpointServiceId pulumi.StringInput
   133  }
   134  
   135  func (VpcEndpointServiceAllowedPrincipleArgs) ElementType() reflect.Type {
   136  	return reflect.TypeOf((*vpcEndpointServiceAllowedPrincipleArgs)(nil)).Elem()
   137  }
   138  
   139  type VpcEndpointServiceAllowedPrincipleInput interface {
   140  	pulumi.Input
   141  
   142  	ToVpcEndpointServiceAllowedPrincipleOutput() VpcEndpointServiceAllowedPrincipleOutput
   143  	ToVpcEndpointServiceAllowedPrincipleOutputWithContext(ctx context.Context) VpcEndpointServiceAllowedPrincipleOutput
   144  }
   145  
   146  func (*VpcEndpointServiceAllowedPrinciple) ElementType() reflect.Type {
   147  	return reflect.TypeOf((**VpcEndpointServiceAllowedPrinciple)(nil)).Elem()
   148  }
   149  
   150  func (i *VpcEndpointServiceAllowedPrinciple) ToVpcEndpointServiceAllowedPrincipleOutput() VpcEndpointServiceAllowedPrincipleOutput {
   151  	return i.ToVpcEndpointServiceAllowedPrincipleOutputWithContext(context.Background())
   152  }
   153  
   154  func (i *VpcEndpointServiceAllowedPrinciple) ToVpcEndpointServiceAllowedPrincipleOutputWithContext(ctx context.Context) VpcEndpointServiceAllowedPrincipleOutput {
   155  	return pulumi.ToOutputWithContext(ctx, i).(VpcEndpointServiceAllowedPrincipleOutput)
   156  }
   157  
   158  // VpcEndpointServiceAllowedPrincipleArrayInput is an input type that accepts VpcEndpointServiceAllowedPrincipleArray and VpcEndpointServiceAllowedPrincipleArrayOutput values.
   159  // You can construct a concrete instance of `VpcEndpointServiceAllowedPrincipleArrayInput` via:
   160  //
   161  //	VpcEndpointServiceAllowedPrincipleArray{ VpcEndpointServiceAllowedPrincipleArgs{...} }
   162  type VpcEndpointServiceAllowedPrincipleArrayInput interface {
   163  	pulumi.Input
   164  
   165  	ToVpcEndpointServiceAllowedPrincipleArrayOutput() VpcEndpointServiceAllowedPrincipleArrayOutput
   166  	ToVpcEndpointServiceAllowedPrincipleArrayOutputWithContext(context.Context) VpcEndpointServiceAllowedPrincipleArrayOutput
   167  }
   168  
   169  type VpcEndpointServiceAllowedPrincipleArray []VpcEndpointServiceAllowedPrincipleInput
   170  
   171  func (VpcEndpointServiceAllowedPrincipleArray) ElementType() reflect.Type {
   172  	return reflect.TypeOf((*[]*VpcEndpointServiceAllowedPrinciple)(nil)).Elem()
   173  }
   174  
   175  func (i VpcEndpointServiceAllowedPrincipleArray) ToVpcEndpointServiceAllowedPrincipleArrayOutput() VpcEndpointServiceAllowedPrincipleArrayOutput {
   176  	return i.ToVpcEndpointServiceAllowedPrincipleArrayOutputWithContext(context.Background())
   177  }
   178  
   179  func (i VpcEndpointServiceAllowedPrincipleArray) ToVpcEndpointServiceAllowedPrincipleArrayOutputWithContext(ctx context.Context) VpcEndpointServiceAllowedPrincipleArrayOutput {
   180  	return pulumi.ToOutputWithContext(ctx, i).(VpcEndpointServiceAllowedPrincipleArrayOutput)
   181  }
   182  
   183  // VpcEndpointServiceAllowedPrincipleMapInput is an input type that accepts VpcEndpointServiceAllowedPrincipleMap and VpcEndpointServiceAllowedPrincipleMapOutput values.
   184  // You can construct a concrete instance of `VpcEndpointServiceAllowedPrincipleMapInput` via:
   185  //
   186  //	VpcEndpointServiceAllowedPrincipleMap{ "key": VpcEndpointServiceAllowedPrincipleArgs{...} }
   187  type VpcEndpointServiceAllowedPrincipleMapInput interface {
   188  	pulumi.Input
   189  
   190  	ToVpcEndpointServiceAllowedPrincipleMapOutput() VpcEndpointServiceAllowedPrincipleMapOutput
   191  	ToVpcEndpointServiceAllowedPrincipleMapOutputWithContext(context.Context) VpcEndpointServiceAllowedPrincipleMapOutput
   192  }
   193  
   194  type VpcEndpointServiceAllowedPrincipleMap map[string]VpcEndpointServiceAllowedPrincipleInput
   195  
   196  func (VpcEndpointServiceAllowedPrincipleMap) ElementType() reflect.Type {
   197  	return reflect.TypeOf((*map[string]*VpcEndpointServiceAllowedPrinciple)(nil)).Elem()
   198  }
   199  
   200  func (i VpcEndpointServiceAllowedPrincipleMap) ToVpcEndpointServiceAllowedPrincipleMapOutput() VpcEndpointServiceAllowedPrincipleMapOutput {
   201  	return i.ToVpcEndpointServiceAllowedPrincipleMapOutputWithContext(context.Background())
   202  }
   203  
   204  func (i VpcEndpointServiceAllowedPrincipleMap) ToVpcEndpointServiceAllowedPrincipleMapOutputWithContext(ctx context.Context) VpcEndpointServiceAllowedPrincipleMapOutput {
   205  	return pulumi.ToOutputWithContext(ctx, i).(VpcEndpointServiceAllowedPrincipleMapOutput)
   206  }
   207  
   208  type VpcEndpointServiceAllowedPrincipleOutput struct{ *pulumi.OutputState }
   209  
   210  func (VpcEndpointServiceAllowedPrincipleOutput) ElementType() reflect.Type {
   211  	return reflect.TypeOf((**VpcEndpointServiceAllowedPrinciple)(nil)).Elem()
   212  }
   213  
   214  func (o VpcEndpointServiceAllowedPrincipleOutput) ToVpcEndpointServiceAllowedPrincipleOutput() VpcEndpointServiceAllowedPrincipleOutput {
   215  	return o
   216  }
   217  
   218  func (o VpcEndpointServiceAllowedPrincipleOutput) ToVpcEndpointServiceAllowedPrincipleOutputWithContext(ctx context.Context) VpcEndpointServiceAllowedPrincipleOutput {
   219  	return o
   220  }
   221  
   222  // The ARN of the principal to allow permissions.
   223  func (o VpcEndpointServiceAllowedPrincipleOutput) PrincipalArn() pulumi.StringOutput {
   224  	return o.ApplyT(func(v *VpcEndpointServiceAllowedPrinciple) pulumi.StringOutput { return v.PrincipalArn }).(pulumi.StringOutput)
   225  }
   226  
   227  // The ID of the VPC endpoint service to allow permission.
   228  func (o VpcEndpointServiceAllowedPrincipleOutput) VpcEndpointServiceId() pulumi.StringOutput {
   229  	return o.ApplyT(func(v *VpcEndpointServiceAllowedPrinciple) pulumi.StringOutput { return v.VpcEndpointServiceId }).(pulumi.StringOutput)
   230  }
   231  
   232  type VpcEndpointServiceAllowedPrincipleArrayOutput struct{ *pulumi.OutputState }
   233  
   234  func (VpcEndpointServiceAllowedPrincipleArrayOutput) ElementType() reflect.Type {
   235  	return reflect.TypeOf((*[]*VpcEndpointServiceAllowedPrinciple)(nil)).Elem()
   236  }
   237  
   238  func (o VpcEndpointServiceAllowedPrincipleArrayOutput) ToVpcEndpointServiceAllowedPrincipleArrayOutput() VpcEndpointServiceAllowedPrincipleArrayOutput {
   239  	return o
   240  }
   241  
   242  func (o VpcEndpointServiceAllowedPrincipleArrayOutput) ToVpcEndpointServiceAllowedPrincipleArrayOutputWithContext(ctx context.Context) VpcEndpointServiceAllowedPrincipleArrayOutput {
   243  	return o
   244  }
   245  
   246  func (o VpcEndpointServiceAllowedPrincipleArrayOutput) Index(i pulumi.IntInput) VpcEndpointServiceAllowedPrincipleOutput {
   247  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *VpcEndpointServiceAllowedPrinciple {
   248  		return vs[0].([]*VpcEndpointServiceAllowedPrinciple)[vs[1].(int)]
   249  	}).(VpcEndpointServiceAllowedPrincipleOutput)
   250  }
   251  
   252  type VpcEndpointServiceAllowedPrincipleMapOutput struct{ *pulumi.OutputState }
   253  
   254  func (VpcEndpointServiceAllowedPrincipleMapOutput) ElementType() reflect.Type {
   255  	return reflect.TypeOf((*map[string]*VpcEndpointServiceAllowedPrinciple)(nil)).Elem()
   256  }
   257  
   258  func (o VpcEndpointServiceAllowedPrincipleMapOutput) ToVpcEndpointServiceAllowedPrincipleMapOutput() VpcEndpointServiceAllowedPrincipleMapOutput {
   259  	return o
   260  }
   261  
   262  func (o VpcEndpointServiceAllowedPrincipleMapOutput) ToVpcEndpointServiceAllowedPrincipleMapOutputWithContext(ctx context.Context) VpcEndpointServiceAllowedPrincipleMapOutput {
   263  	return o
   264  }
   265  
   266  func (o VpcEndpointServiceAllowedPrincipleMapOutput) MapIndex(k pulumi.StringInput) VpcEndpointServiceAllowedPrincipleOutput {
   267  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *VpcEndpointServiceAllowedPrinciple {
   268  		return vs[0].(map[string]*VpcEndpointServiceAllowedPrinciple)[vs[1].(string)]
   269  	}).(VpcEndpointServiceAllowedPrincipleOutput)
   270  }
   271  
   272  func init() {
   273  	pulumi.RegisterInputType(reflect.TypeOf((*VpcEndpointServiceAllowedPrincipleInput)(nil)).Elem(), &VpcEndpointServiceAllowedPrinciple{})
   274  	pulumi.RegisterInputType(reflect.TypeOf((*VpcEndpointServiceAllowedPrincipleArrayInput)(nil)).Elem(), VpcEndpointServiceAllowedPrincipleArray{})
   275  	pulumi.RegisterInputType(reflect.TypeOf((*VpcEndpointServiceAllowedPrincipleMapInput)(nil)).Elem(), VpcEndpointServiceAllowedPrincipleMap{})
   276  	pulumi.RegisterOutputType(VpcEndpointServiceAllowedPrincipleOutput{})
   277  	pulumi.RegisterOutputType(VpcEndpointServiceAllowedPrincipleArrayOutput{})
   278  	pulumi.RegisterOutputType(VpcEndpointServiceAllowedPrincipleMapOutput{})
   279  }