github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/networkmanager/getSites.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 networkmanager
     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  // Retrieve information about sites.
    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/networkmanager"
    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 := networkmanager.GetSites(ctx, &networkmanager.GetSitesArgs{
    32  //				GlobalNetworkId: globalNetworkId,
    33  //				Tags: map[string]interface{}{
    34  //					"Env": "test",
    35  //				},
    36  //			}, nil)
    37  //			if err != nil {
    38  //				return err
    39  //			}
    40  //			return nil
    41  //		})
    42  //	}
    43  //
    44  // ```
    45  // <!--End PulumiCodeChooser -->
    46  func GetSites(ctx *pulumi.Context, args *GetSitesArgs, opts ...pulumi.InvokeOption) (*GetSitesResult, error) {
    47  	opts = internal.PkgInvokeDefaultOpts(opts)
    48  	var rv GetSitesResult
    49  	err := ctx.Invoke("aws:networkmanager/getSites:getSites", args, &rv, opts...)
    50  	if err != nil {
    51  		return nil, err
    52  	}
    53  	return &rv, nil
    54  }
    55  
    56  // A collection of arguments for invoking getSites.
    57  type GetSitesArgs struct {
    58  	// ID of the Global Network of the sites to retrieve.
    59  	GlobalNetworkId string `pulumi:"globalNetworkId"`
    60  	// Restricts the list to the sites with these tags.
    61  	Tags map[string]string `pulumi:"tags"`
    62  }
    63  
    64  // A collection of values returned by getSites.
    65  type GetSitesResult struct {
    66  	GlobalNetworkId string `pulumi:"globalNetworkId"`
    67  	// The provider-assigned unique ID for this managed resource.
    68  	Id string `pulumi:"id"`
    69  	// IDs of the sites.
    70  	Ids  []string          `pulumi:"ids"`
    71  	Tags map[string]string `pulumi:"tags"`
    72  }
    73  
    74  func GetSitesOutput(ctx *pulumi.Context, args GetSitesOutputArgs, opts ...pulumi.InvokeOption) GetSitesResultOutput {
    75  	return pulumi.ToOutputWithContext(context.Background(), args).
    76  		ApplyT(func(v interface{}) (GetSitesResult, error) {
    77  			args := v.(GetSitesArgs)
    78  			r, err := GetSites(ctx, &args, opts...)
    79  			var s GetSitesResult
    80  			if r != nil {
    81  				s = *r
    82  			}
    83  			return s, err
    84  		}).(GetSitesResultOutput)
    85  }
    86  
    87  // A collection of arguments for invoking getSites.
    88  type GetSitesOutputArgs struct {
    89  	// ID of the Global Network of the sites to retrieve.
    90  	GlobalNetworkId pulumi.StringInput `pulumi:"globalNetworkId"`
    91  	// Restricts the list to the sites with these tags.
    92  	Tags pulumi.StringMapInput `pulumi:"tags"`
    93  }
    94  
    95  func (GetSitesOutputArgs) ElementType() reflect.Type {
    96  	return reflect.TypeOf((*GetSitesArgs)(nil)).Elem()
    97  }
    98  
    99  // A collection of values returned by getSites.
   100  type GetSitesResultOutput struct{ *pulumi.OutputState }
   101  
   102  func (GetSitesResultOutput) ElementType() reflect.Type {
   103  	return reflect.TypeOf((*GetSitesResult)(nil)).Elem()
   104  }
   105  
   106  func (o GetSitesResultOutput) ToGetSitesResultOutput() GetSitesResultOutput {
   107  	return o
   108  }
   109  
   110  func (o GetSitesResultOutput) ToGetSitesResultOutputWithContext(ctx context.Context) GetSitesResultOutput {
   111  	return o
   112  }
   113  
   114  func (o GetSitesResultOutput) GlobalNetworkId() pulumi.StringOutput {
   115  	return o.ApplyT(func(v GetSitesResult) string { return v.GlobalNetworkId }).(pulumi.StringOutput)
   116  }
   117  
   118  // The provider-assigned unique ID for this managed resource.
   119  func (o GetSitesResultOutput) Id() pulumi.StringOutput {
   120  	return o.ApplyT(func(v GetSitesResult) string { return v.Id }).(pulumi.StringOutput)
   121  }
   122  
   123  // IDs of the sites.
   124  func (o GetSitesResultOutput) Ids() pulumi.StringArrayOutput {
   125  	return o.ApplyT(func(v GetSitesResult) []string { return v.Ids }).(pulumi.StringArrayOutput)
   126  }
   127  
   128  func (o GetSitesResultOutput) Tags() pulumi.StringMapOutput {
   129  	return o.ApplyT(func(v GetSitesResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   130  }
   131  
   132  func init() {
   133  	pulumi.RegisterOutputType(GetSitesResultOutput{})
   134  }