github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/sqs/getQueue.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 sqs
     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 get the ARN and URL of queue in AWS Simple Queue Service (SQS).
    15  // By using this data source, you can reference SQS queues without having to hardcode
    16  // the ARNs as input.
    17  //
    18  // ## Example Usage
    19  //
    20  // <!--Start PulumiCodeChooser -->
    21  // ```go
    22  // package main
    23  //
    24  // import (
    25  //
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sqs"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			_, err := sqs.LookupQueue(ctx, &sqs.LookupQueueArgs{
    34  //				Name: "queue",
    35  //			}, nil)
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			return nil
    40  //		})
    41  //	}
    42  //
    43  // ```
    44  // <!--End PulumiCodeChooser -->
    45  func LookupQueue(ctx *pulumi.Context, args *LookupQueueArgs, opts ...pulumi.InvokeOption) (*LookupQueueResult, error) {
    46  	opts = internal.PkgInvokeDefaultOpts(opts)
    47  	var rv LookupQueueResult
    48  	err := ctx.Invoke("aws:sqs/getQueue:getQueue", args, &rv, opts...)
    49  	if err != nil {
    50  		return nil, err
    51  	}
    52  	return &rv, nil
    53  }
    54  
    55  // A collection of arguments for invoking getQueue.
    56  type LookupQueueArgs struct {
    57  	// Name of the queue to match.
    58  	Name string `pulumi:"name"`
    59  	// Map of tags for the resource.
    60  	Tags map[string]string `pulumi:"tags"`
    61  }
    62  
    63  // A collection of values returned by getQueue.
    64  type LookupQueueResult struct {
    65  	// ARN of the queue.
    66  	Arn string `pulumi:"arn"`
    67  	// The provider-assigned unique ID for this managed resource.
    68  	Id   string `pulumi:"id"`
    69  	Name string `pulumi:"name"`
    70  	// Map of tags for the resource.
    71  	Tags map[string]string `pulumi:"tags"`
    72  	// URL of the queue.
    73  	Url string `pulumi:"url"`
    74  }
    75  
    76  func LookupQueueOutput(ctx *pulumi.Context, args LookupQueueOutputArgs, opts ...pulumi.InvokeOption) LookupQueueResultOutput {
    77  	return pulumi.ToOutputWithContext(context.Background(), args).
    78  		ApplyT(func(v interface{}) (LookupQueueResult, error) {
    79  			args := v.(LookupQueueArgs)
    80  			r, err := LookupQueue(ctx, &args, opts...)
    81  			var s LookupQueueResult
    82  			if r != nil {
    83  				s = *r
    84  			}
    85  			return s, err
    86  		}).(LookupQueueResultOutput)
    87  }
    88  
    89  // A collection of arguments for invoking getQueue.
    90  type LookupQueueOutputArgs struct {
    91  	// Name of the queue to match.
    92  	Name pulumi.StringInput `pulumi:"name"`
    93  	// Map of tags for the resource.
    94  	Tags pulumi.StringMapInput `pulumi:"tags"`
    95  }
    96  
    97  func (LookupQueueOutputArgs) ElementType() reflect.Type {
    98  	return reflect.TypeOf((*LookupQueueArgs)(nil)).Elem()
    99  }
   100  
   101  // A collection of values returned by getQueue.
   102  type LookupQueueResultOutput struct{ *pulumi.OutputState }
   103  
   104  func (LookupQueueResultOutput) ElementType() reflect.Type {
   105  	return reflect.TypeOf((*LookupQueueResult)(nil)).Elem()
   106  }
   107  
   108  func (o LookupQueueResultOutput) ToLookupQueueResultOutput() LookupQueueResultOutput {
   109  	return o
   110  }
   111  
   112  func (o LookupQueueResultOutput) ToLookupQueueResultOutputWithContext(ctx context.Context) LookupQueueResultOutput {
   113  	return o
   114  }
   115  
   116  // ARN of the queue.
   117  func (o LookupQueueResultOutput) Arn() pulumi.StringOutput {
   118  	return o.ApplyT(func(v LookupQueueResult) string { return v.Arn }).(pulumi.StringOutput)
   119  }
   120  
   121  // The provider-assigned unique ID for this managed resource.
   122  func (o LookupQueueResultOutput) Id() pulumi.StringOutput {
   123  	return o.ApplyT(func(v LookupQueueResult) string { return v.Id }).(pulumi.StringOutput)
   124  }
   125  
   126  func (o LookupQueueResultOutput) Name() pulumi.StringOutput {
   127  	return o.ApplyT(func(v LookupQueueResult) string { return v.Name }).(pulumi.StringOutput)
   128  }
   129  
   130  // Map of tags for the resource.
   131  func (o LookupQueueResultOutput) Tags() pulumi.StringMapOutput {
   132  	return o.ApplyT(func(v LookupQueueResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   133  }
   134  
   135  // URL of the queue.
   136  func (o LookupQueueResultOutput) Url() pulumi.StringOutput {
   137  	return o.ApplyT(func(v LookupQueueResult) string { return v.Url }).(pulumi.StringOutput)
   138  }
   139  
   140  func init() {
   141  	pulumi.RegisterOutputType(LookupQueueResultOutput{})
   142  }