github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cloudfront/getDistribution.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 cloudfront
     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  // Use this data source to retrieve information about a CloudFront distribution.
    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/cloudfront"
    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 := cloudfront.LookupDistribution(ctx, &cloudfront.LookupDistributionArgs{
    32  //				Id: "EDFDVBD632BHDS5",
    33  //			}, nil)
    34  //			if err != nil {
    35  //				return err
    36  //			}
    37  //			return nil
    38  //		})
    39  //	}
    40  //
    41  // ```
    42  // <!--End PulumiCodeChooser -->
    43  func LookupDistribution(ctx *pulumi.Context, args *LookupDistributionArgs, opts ...pulumi.InvokeOption) (*LookupDistributionResult, error) {
    44  	opts = internal.PkgInvokeDefaultOpts(opts)
    45  	var rv LookupDistributionResult
    46  	err := ctx.Invoke("aws:cloudfront/getDistribution:getDistribution", args, &rv, opts...)
    47  	if err != nil {
    48  		return nil, err
    49  	}
    50  	return &rv, nil
    51  }
    52  
    53  // A collection of arguments for invoking getDistribution.
    54  type LookupDistributionArgs struct {
    55  	// Identifier for the distribution. For example: `EDFDVBD632BHDS5`.
    56  	Id   string            `pulumi:"id"`
    57  	Tags map[string]string `pulumi:"tags"`
    58  }
    59  
    60  // A collection of values returned by getDistribution.
    61  type LookupDistributionResult struct {
    62  	// List that contains information about CNAMEs (alternate domain names), if any, for this distribution.
    63  	Aliases []string `pulumi:"aliases"`
    64  	// ARN (Amazon Resource Name) for the distribution. For example: arn:aws:cloudfront::123456789012:distribution/EDFDVBD632BHDS5, where 123456789012 is your AWS account ID.
    65  	Arn string `pulumi:"arn"`
    66  	// Domain name corresponding to the distribution. For
    67  	// example: `d604721fxaaqy9.cloudfront.net`.
    68  	DomainName string `pulumi:"domainName"`
    69  	Enabled    bool   `pulumi:"enabled"`
    70  	// Current version of the distribution's information. For example:
    71  	// `E2QWRUHAPOMQZL`.
    72  	Etag string `pulumi:"etag"`
    73  	// CloudFront Route 53 zone ID that can be used to
    74  	// route an [Alias Resource Record Set][7] to. This attribute is simply an
    75  	// alias for the zone ID `Z2FDTNDATAQYW2`.
    76  	HostedZoneId string `pulumi:"hostedZoneId"`
    77  	// Identifier for the distribution. For example: `EDFDVBD632BHDS5`.
    78  	Id string `pulumi:"id"`
    79  	// The number of invalidation batches
    80  	// currently in progress.
    81  	InProgressValidationBatches int `pulumi:"inProgressValidationBatches"`
    82  	// Date and time the distribution was last modified.
    83  	LastModifiedTime string `pulumi:"lastModifiedTime"`
    84  	// Current status of the distribution. `Deployed` if the
    85  	// distribution's information is fully propagated throughout the Amazon
    86  	// CloudFront system.
    87  	Status string            `pulumi:"status"`
    88  	Tags   map[string]string `pulumi:"tags"`
    89  	// AWS WAF web ACL associated with this distribution.
    90  	WebAclId string `pulumi:"webAclId"`
    91  }
    92  
    93  func LookupDistributionOutput(ctx *pulumi.Context, args LookupDistributionOutputArgs, opts ...pulumi.InvokeOption) LookupDistributionResultOutput {
    94  	return pulumi.ToOutputWithContext(context.Background(), args).
    95  		ApplyT(func(v interface{}) (LookupDistributionResult, error) {
    96  			args := v.(LookupDistributionArgs)
    97  			r, err := LookupDistribution(ctx, &args, opts...)
    98  			var s LookupDistributionResult
    99  			if r != nil {
   100  				s = *r
   101  			}
   102  			return s, err
   103  		}).(LookupDistributionResultOutput)
   104  }
   105  
   106  // A collection of arguments for invoking getDistribution.
   107  type LookupDistributionOutputArgs struct {
   108  	// Identifier for the distribution. For example: `EDFDVBD632BHDS5`.
   109  	Id   pulumi.StringInput    `pulumi:"id"`
   110  	Tags pulumi.StringMapInput `pulumi:"tags"`
   111  }
   112  
   113  func (LookupDistributionOutputArgs) ElementType() reflect.Type {
   114  	return reflect.TypeOf((*LookupDistributionArgs)(nil)).Elem()
   115  }
   116  
   117  // A collection of values returned by getDistribution.
   118  type LookupDistributionResultOutput struct{ *pulumi.OutputState }
   119  
   120  func (LookupDistributionResultOutput) ElementType() reflect.Type {
   121  	return reflect.TypeOf((*LookupDistributionResult)(nil)).Elem()
   122  }
   123  
   124  func (o LookupDistributionResultOutput) ToLookupDistributionResultOutput() LookupDistributionResultOutput {
   125  	return o
   126  }
   127  
   128  func (o LookupDistributionResultOutput) ToLookupDistributionResultOutputWithContext(ctx context.Context) LookupDistributionResultOutput {
   129  	return o
   130  }
   131  
   132  // List that contains information about CNAMEs (alternate domain names), if any, for this distribution.
   133  func (o LookupDistributionResultOutput) Aliases() pulumi.StringArrayOutput {
   134  	return o.ApplyT(func(v LookupDistributionResult) []string { return v.Aliases }).(pulumi.StringArrayOutput)
   135  }
   136  
   137  // ARN (Amazon Resource Name) for the distribution. For example: arn:aws:cloudfront::123456789012:distribution/EDFDVBD632BHDS5, where 123456789012 is your AWS account ID.
   138  func (o LookupDistributionResultOutput) Arn() pulumi.StringOutput {
   139  	return o.ApplyT(func(v LookupDistributionResult) string { return v.Arn }).(pulumi.StringOutput)
   140  }
   141  
   142  // Domain name corresponding to the distribution. For
   143  // example: `d604721fxaaqy9.cloudfront.net`.
   144  func (o LookupDistributionResultOutput) DomainName() pulumi.StringOutput {
   145  	return o.ApplyT(func(v LookupDistributionResult) string { return v.DomainName }).(pulumi.StringOutput)
   146  }
   147  
   148  func (o LookupDistributionResultOutput) Enabled() pulumi.BoolOutput {
   149  	return o.ApplyT(func(v LookupDistributionResult) bool { return v.Enabled }).(pulumi.BoolOutput)
   150  }
   151  
   152  // Current version of the distribution's information. For example:
   153  // `E2QWRUHAPOMQZL`.
   154  func (o LookupDistributionResultOutput) Etag() pulumi.StringOutput {
   155  	return o.ApplyT(func(v LookupDistributionResult) string { return v.Etag }).(pulumi.StringOutput)
   156  }
   157  
   158  // CloudFront Route 53 zone ID that can be used to
   159  // route an [Alias Resource Record Set][7] to. This attribute is simply an
   160  // alias for the zone ID `Z2FDTNDATAQYW2`.
   161  func (o LookupDistributionResultOutput) HostedZoneId() pulumi.StringOutput {
   162  	return o.ApplyT(func(v LookupDistributionResult) string { return v.HostedZoneId }).(pulumi.StringOutput)
   163  }
   164  
   165  // Identifier for the distribution. For example: `EDFDVBD632BHDS5`.
   166  func (o LookupDistributionResultOutput) Id() pulumi.StringOutput {
   167  	return o.ApplyT(func(v LookupDistributionResult) string { return v.Id }).(pulumi.StringOutput)
   168  }
   169  
   170  // The number of invalidation batches
   171  // currently in progress.
   172  func (o LookupDistributionResultOutput) InProgressValidationBatches() pulumi.IntOutput {
   173  	return o.ApplyT(func(v LookupDistributionResult) int { return v.InProgressValidationBatches }).(pulumi.IntOutput)
   174  }
   175  
   176  // Date and time the distribution was last modified.
   177  func (o LookupDistributionResultOutput) LastModifiedTime() pulumi.StringOutput {
   178  	return o.ApplyT(func(v LookupDistributionResult) string { return v.LastModifiedTime }).(pulumi.StringOutput)
   179  }
   180  
   181  // Current status of the distribution. `Deployed` if the
   182  // distribution's information is fully propagated throughout the Amazon
   183  // CloudFront system.
   184  func (o LookupDistributionResultOutput) Status() pulumi.StringOutput {
   185  	return o.ApplyT(func(v LookupDistributionResult) string { return v.Status }).(pulumi.StringOutput)
   186  }
   187  
   188  func (o LookupDistributionResultOutput) Tags() pulumi.StringMapOutput {
   189  	return o.ApplyT(func(v LookupDistributionResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   190  }
   191  
   192  // AWS WAF web ACL associated with this distribution.
   193  func (o LookupDistributionResultOutput) WebAclId() pulumi.StringOutput {
   194  	return o.ApplyT(func(v LookupDistributionResult) string { return v.WebAclId }).(pulumi.StringOutput)
   195  }
   196  
   197  func init() {
   198  	pulumi.RegisterOutputType(LookupDistributionResultOutput{})
   199  }