github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/getVpcEndpointService.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  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // The VPC Endpoint Service data source details about a specific service that
    15  // can be specified when creating a VPC endpoint within the region configured in the provider.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### AWS Service
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			// Declare the data source
    35  //			s3, err := ec2.LookupVpcEndpointService(ctx, &ec2.LookupVpcEndpointServiceArgs{
    36  //				Service:     pulumi.StringRef("s3"),
    37  //				ServiceType: pulumi.StringRef("Gateway"),
    38  //			}, nil)
    39  //			if err != nil {
    40  //				return err
    41  //			}
    42  //			// Create a VPC
    43  //			foo, err := ec2.NewVpc(ctx, "foo", &ec2.VpcArgs{
    44  //				CidrBlock: pulumi.String("10.0.0.0/16"),
    45  //			})
    46  //			if err != nil {
    47  //				return err
    48  //			}
    49  //			// Create a VPC endpoint
    50  //			_, err = ec2.NewVpcEndpoint(ctx, "ep", &ec2.VpcEndpointArgs{
    51  //				VpcId:       foo.ID(),
    52  //				ServiceName: pulumi.String(s3.ServiceName),
    53  //			})
    54  //			if err != nil {
    55  //				return err
    56  //			}
    57  //			return nil
    58  //		})
    59  //	}
    60  //
    61  // ```
    62  // <!--End PulumiCodeChooser -->
    63  //
    64  // ### Non-AWS Service
    65  //
    66  // <!--Start PulumiCodeChooser -->
    67  // ```go
    68  // package main
    69  //
    70  // import (
    71  //
    72  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    73  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    74  //
    75  // )
    76  //
    77  //	func main() {
    78  //		pulumi.Run(func(ctx *pulumi.Context) error {
    79  //			_, err := ec2.LookupVpcEndpointService(ctx, &ec2.LookupVpcEndpointServiceArgs{
    80  //				ServiceName: pulumi.StringRef("com.amazonaws.vpce.us-west-2.vpce-svc-0e87519c997c63cd8"),
    81  //			}, nil)
    82  //			if err != nil {
    83  //				return err
    84  //			}
    85  //			return nil
    86  //		})
    87  //	}
    88  //
    89  // ```
    90  // <!--End PulumiCodeChooser -->
    91  //
    92  // ### Filter
    93  //
    94  // <!--Start PulumiCodeChooser -->
    95  // ```go
    96  // package main
    97  //
    98  // import (
    99  //
   100  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
   101  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
   102  //
   103  // )
   104  //
   105  //	func main() {
   106  //		pulumi.Run(func(ctx *pulumi.Context) error {
   107  //			_, err := ec2.LookupVpcEndpointService(ctx, &ec2.LookupVpcEndpointServiceArgs{
   108  //				Filters: []ec2.GetVpcEndpointServiceFilter{
   109  //					{
   110  //						Name: "service-name",
   111  //						Values: []string{
   112  //							"some-service",
   113  //						},
   114  //					},
   115  //				},
   116  //			}, nil)
   117  //			if err != nil {
   118  //				return err
   119  //			}
   120  //			return nil
   121  //		})
   122  //	}
   123  //
   124  // ```
   125  // <!--End PulumiCodeChooser -->
   126  func LookupVpcEndpointService(ctx *pulumi.Context, args *LookupVpcEndpointServiceArgs, opts ...pulumi.InvokeOption) (*LookupVpcEndpointServiceResult, error) {
   127  	opts = internal.PkgInvokeDefaultOpts(opts)
   128  	var rv LookupVpcEndpointServiceResult
   129  	err := ctx.Invoke("aws:ec2/getVpcEndpointService:getVpcEndpointService", args, &rv, opts...)
   130  	if err != nil {
   131  		return nil, err
   132  	}
   133  	return &rv, nil
   134  }
   135  
   136  // A collection of arguments for invoking getVpcEndpointService.
   137  type LookupVpcEndpointServiceArgs struct {
   138  	// Configuration block(s) for filtering. Detailed below.
   139  	Filters []GetVpcEndpointServiceFilter `pulumi:"filters"`
   140  	// Common name of an AWS service (e.g., `s3`).
   141  	Service *string `pulumi:"service"`
   142  	// Service name that is specified when creating a VPC endpoint. For AWS services the service name is usually in the form `com.amazonaws.<region>.<service>` (the SageMaker Notebook service is an exception to this rule, the service name is in the form `aws.sagemaker.<region>.notebook`).
   143  	ServiceName *string `pulumi:"serviceName"`
   144  	// Service type, `Gateway` or `Interface`.
   145  	ServiceType *string `pulumi:"serviceType"`
   146  	// Map of tags, each pair of which must exactly match a pair on the desired VPC Endpoint Service.
   147  	//
   148  	// > **NOTE:** Specifying `service` will not work for non-AWS services or AWS services that don't follow the standard `serviceName` pattern of `com.amazonaws.<region>.<service>`.
   149  	Tags map[string]string `pulumi:"tags"`
   150  }
   151  
   152  // A collection of values returned by getVpcEndpointService.
   153  type LookupVpcEndpointServiceResult struct {
   154  	// Whether or not VPC endpoint connection requests to the service must be accepted by the service owner - `true` or `false`.
   155  	AcceptanceRequired bool `pulumi:"acceptanceRequired"`
   156  	// ARN of the VPC endpoint service.
   157  	Arn string `pulumi:"arn"`
   158  	// Availability Zones in which the service is available.
   159  	AvailabilityZones []string `pulumi:"availabilityZones"`
   160  	// The DNS names for the service.
   161  	BaseEndpointDnsNames []string                      `pulumi:"baseEndpointDnsNames"`
   162  	Filters              []GetVpcEndpointServiceFilter `pulumi:"filters"`
   163  	// The provider-assigned unique ID for this managed resource.
   164  	Id string `pulumi:"id"`
   165  	// Whether or not the service manages its VPC endpoints - `true` or `false`.
   166  	ManagesVpcEndpoints bool `pulumi:"managesVpcEndpoints"`
   167  	// AWS account ID of the service owner or `amazon`.
   168  	Owner string `pulumi:"owner"`
   169  	// Private DNS name for the service.
   170  	PrivateDnsName string  `pulumi:"privateDnsName"`
   171  	Service        *string `pulumi:"service"`
   172  	// ID of the endpoint service.
   173  	ServiceId   string `pulumi:"serviceId"`
   174  	ServiceName string `pulumi:"serviceName"`
   175  	ServiceType string `pulumi:"serviceType"`
   176  	// The supported IP address types.
   177  	SupportedIpAddressTypes []string `pulumi:"supportedIpAddressTypes"`
   178  	// Map of tags assigned to the resource.
   179  	Tags map[string]string `pulumi:"tags"`
   180  	// Whether or not the service supports endpoint policies - `true` or `false`.
   181  	VpcEndpointPolicySupported bool `pulumi:"vpcEndpointPolicySupported"`
   182  }
   183  
   184  func LookupVpcEndpointServiceOutput(ctx *pulumi.Context, args LookupVpcEndpointServiceOutputArgs, opts ...pulumi.InvokeOption) LookupVpcEndpointServiceResultOutput {
   185  	return pulumi.ToOutputWithContext(context.Background(), args).
   186  		ApplyT(func(v interface{}) (LookupVpcEndpointServiceResult, error) {
   187  			args := v.(LookupVpcEndpointServiceArgs)
   188  			r, err := LookupVpcEndpointService(ctx, &args, opts...)
   189  			var s LookupVpcEndpointServiceResult
   190  			if r != nil {
   191  				s = *r
   192  			}
   193  			return s, err
   194  		}).(LookupVpcEndpointServiceResultOutput)
   195  }
   196  
   197  // A collection of arguments for invoking getVpcEndpointService.
   198  type LookupVpcEndpointServiceOutputArgs struct {
   199  	// Configuration block(s) for filtering. Detailed below.
   200  	Filters GetVpcEndpointServiceFilterArrayInput `pulumi:"filters"`
   201  	// Common name of an AWS service (e.g., `s3`).
   202  	Service pulumi.StringPtrInput `pulumi:"service"`
   203  	// Service name that is specified when creating a VPC endpoint. For AWS services the service name is usually in the form `com.amazonaws.<region>.<service>` (the SageMaker Notebook service is an exception to this rule, the service name is in the form `aws.sagemaker.<region>.notebook`).
   204  	ServiceName pulumi.StringPtrInput `pulumi:"serviceName"`
   205  	// Service type, `Gateway` or `Interface`.
   206  	ServiceType pulumi.StringPtrInput `pulumi:"serviceType"`
   207  	// Map of tags, each pair of which must exactly match a pair on the desired VPC Endpoint Service.
   208  	//
   209  	// > **NOTE:** Specifying `service` will not work for non-AWS services or AWS services that don't follow the standard `serviceName` pattern of `com.amazonaws.<region>.<service>`.
   210  	Tags pulumi.StringMapInput `pulumi:"tags"`
   211  }
   212  
   213  func (LookupVpcEndpointServiceOutputArgs) ElementType() reflect.Type {
   214  	return reflect.TypeOf((*LookupVpcEndpointServiceArgs)(nil)).Elem()
   215  }
   216  
   217  // A collection of values returned by getVpcEndpointService.
   218  type LookupVpcEndpointServiceResultOutput struct{ *pulumi.OutputState }
   219  
   220  func (LookupVpcEndpointServiceResultOutput) ElementType() reflect.Type {
   221  	return reflect.TypeOf((*LookupVpcEndpointServiceResult)(nil)).Elem()
   222  }
   223  
   224  func (o LookupVpcEndpointServiceResultOutput) ToLookupVpcEndpointServiceResultOutput() LookupVpcEndpointServiceResultOutput {
   225  	return o
   226  }
   227  
   228  func (o LookupVpcEndpointServiceResultOutput) ToLookupVpcEndpointServiceResultOutputWithContext(ctx context.Context) LookupVpcEndpointServiceResultOutput {
   229  	return o
   230  }
   231  
   232  // Whether or not VPC endpoint connection requests to the service must be accepted by the service owner - `true` or `false`.
   233  func (o LookupVpcEndpointServiceResultOutput) AcceptanceRequired() pulumi.BoolOutput {
   234  	return o.ApplyT(func(v LookupVpcEndpointServiceResult) bool { return v.AcceptanceRequired }).(pulumi.BoolOutput)
   235  }
   236  
   237  // ARN of the VPC endpoint service.
   238  func (o LookupVpcEndpointServiceResultOutput) Arn() pulumi.StringOutput {
   239  	return o.ApplyT(func(v LookupVpcEndpointServiceResult) string { return v.Arn }).(pulumi.StringOutput)
   240  }
   241  
   242  // Availability Zones in which the service is available.
   243  func (o LookupVpcEndpointServiceResultOutput) AvailabilityZones() pulumi.StringArrayOutput {
   244  	return o.ApplyT(func(v LookupVpcEndpointServiceResult) []string { return v.AvailabilityZones }).(pulumi.StringArrayOutput)
   245  }
   246  
   247  // The DNS names for the service.
   248  func (o LookupVpcEndpointServiceResultOutput) BaseEndpointDnsNames() pulumi.StringArrayOutput {
   249  	return o.ApplyT(func(v LookupVpcEndpointServiceResult) []string { return v.BaseEndpointDnsNames }).(pulumi.StringArrayOutput)
   250  }
   251  
   252  func (o LookupVpcEndpointServiceResultOutput) Filters() GetVpcEndpointServiceFilterArrayOutput {
   253  	return o.ApplyT(func(v LookupVpcEndpointServiceResult) []GetVpcEndpointServiceFilter { return v.Filters }).(GetVpcEndpointServiceFilterArrayOutput)
   254  }
   255  
   256  // The provider-assigned unique ID for this managed resource.
   257  func (o LookupVpcEndpointServiceResultOutput) Id() pulumi.StringOutput {
   258  	return o.ApplyT(func(v LookupVpcEndpointServiceResult) string { return v.Id }).(pulumi.StringOutput)
   259  }
   260  
   261  // Whether or not the service manages its VPC endpoints - `true` or `false`.
   262  func (o LookupVpcEndpointServiceResultOutput) ManagesVpcEndpoints() pulumi.BoolOutput {
   263  	return o.ApplyT(func(v LookupVpcEndpointServiceResult) bool { return v.ManagesVpcEndpoints }).(pulumi.BoolOutput)
   264  }
   265  
   266  // AWS account ID of the service owner or `amazon`.
   267  func (o LookupVpcEndpointServiceResultOutput) Owner() pulumi.StringOutput {
   268  	return o.ApplyT(func(v LookupVpcEndpointServiceResult) string { return v.Owner }).(pulumi.StringOutput)
   269  }
   270  
   271  // Private DNS name for the service.
   272  func (o LookupVpcEndpointServiceResultOutput) PrivateDnsName() pulumi.StringOutput {
   273  	return o.ApplyT(func(v LookupVpcEndpointServiceResult) string { return v.PrivateDnsName }).(pulumi.StringOutput)
   274  }
   275  
   276  func (o LookupVpcEndpointServiceResultOutput) Service() pulumi.StringPtrOutput {
   277  	return o.ApplyT(func(v LookupVpcEndpointServiceResult) *string { return v.Service }).(pulumi.StringPtrOutput)
   278  }
   279  
   280  // ID of the endpoint service.
   281  func (o LookupVpcEndpointServiceResultOutput) ServiceId() pulumi.StringOutput {
   282  	return o.ApplyT(func(v LookupVpcEndpointServiceResult) string { return v.ServiceId }).(pulumi.StringOutput)
   283  }
   284  
   285  func (o LookupVpcEndpointServiceResultOutput) ServiceName() pulumi.StringOutput {
   286  	return o.ApplyT(func(v LookupVpcEndpointServiceResult) string { return v.ServiceName }).(pulumi.StringOutput)
   287  }
   288  
   289  func (o LookupVpcEndpointServiceResultOutput) ServiceType() pulumi.StringOutput {
   290  	return o.ApplyT(func(v LookupVpcEndpointServiceResult) string { return v.ServiceType }).(pulumi.StringOutput)
   291  }
   292  
   293  // The supported IP address types.
   294  func (o LookupVpcEndpointServiceResultOutput) SupportedIpAddressTypes() pulumi.StringArrayOutput {
   295  	return o.ApplyT(func(v LookupVpcEndpointServiceResult) []string { return v.SupportedIpAddressTypes }).(pulumi.StringArrayOutput)
   296  }
   297  
   298  // Map of tags assigned to the resource.
   299  func (o LookupVpcEndpointServiceResultOutput) Tags() pulumi.StringMapOutput {
   300  	return o.ApplyT(func(v LookupVpcEndpointServiceResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   301  }
   302  
   303  // Whether or not the service supports endpoint policies - `true` or `false`.
   304  func (o LookupVpcEndpointServiceResultOutput) VpcEndpointPolicySupported() pulumi.BoolOutput {
   305  	return o.ApplyT(func(v LookupVpcEndpointServiceResult) bool { return v.VpcEndpointPolicySupported }).(pulumi.BoolOutput)
   306  }
   307  
   308  func init() {
   309  	pulumi.RegisterOutputType(LookupVpcEndpointServiceResultOutput{})
   310  }