github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cloudwatch/getLogGroups.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 cloudwatch
     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 a list of AWS Cloudwatch Log Groups
    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/cloudwatch"
    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 := cloudwatch.GetLogGroups(ctx, &cloudwatch.GetLogGroupsArgs{
    32  //				LogGroupNamePrefix: pulumi.StringRef("/MyImportantLogs"),
    33  //			}, nil)
    34  //			if err != nil {
    35  //				return err
    36  //			}
    37  //			return nil
    38  //		})
    39  //	}
    40  //
    41  // ```
    42  // <!--End PulumiCodeChooser -->
    43  func GetLogGroups(ctx *pulumi.Context, args *GetLogGroupsArgs, opts ...pulumi.InvokeOption) (*GetLogGroupsResult, error) {
    44  	opts = internal.PkgInvokeDefaultOpts(opts)
    45  	var rv GetLogGroupsResult
    46  	err := ctx.Invoke("aws:cloudwatch/getLogGroups:getLogGroups", 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 getLogGroups.
    54  type GetLogGroupsArgs struct {
    55  	// Group prefix of the Cloudwatch log groups to list
    56  	LogGroupNamePrefix *string `pulumi:"logGroupNamePrefix"`
    57  }
    58  
    59  // A collection of values returned by getLogGroups.
    60  type GetLogGroupsResult struct {
    61  	// Set of ARNs of the Cloudwatch log groups
    62  	Arns []string `pulumi:"arns"`
    63  	// The provider-assigned unique ID for this managed resource.
    64  	Id                 string  `pulumi:"id"`
    65  	LogGroupNamePrefix *string `pulumi:"logGroupNamePrefix"`
    66  	// Set of names of the Cloudwatch log groups
    67  	LogGroupNames []string `pulumi:"logGroupNames"`
    68  }
    69  
    70  func GetLogGroupsOutput(ctx *pulumi.Context, args GetLogGroupsOutputArgs, opts ...pulumi.InvokeOption) GetLogGroupsResultOutput {
    71  	return pulumi.ToOutputWithContext(context.Background(), args).
    72  		ApplyT(func(v interface{}) (GetLogGroupsResult, error) {
    73  			args := v.(GetLogGroupsArgs)
    74  			r, err := GetLogGroups(ctx, &args, opts...)
    75  			var s GetLogGroupsResult
    76  			if r != nil {
    77  				s = *r
    78  			}
    79  			return s, err
    80  		}).(GetLogGroupsResultOutput)
    81  }
    82  
    83  // A collection of arguments for invoking getLogGroups.
    84  type GetLogGroupsOutputArgs struct {
    85  	// Group prefix of the Cloudwatch log groups to list
    86  	LogGroupNamePrefix pulumi.StringPtrInput `pulumi:"logGroupNamePrefix"`
    87  }
    88  
    89  func (GetLogGroupsOutputArgs) ElementType() reflect.Type {
    90  	return reflect.TypeOf((*GetLogGroupsArgs)(nil)).Elem()
    91  }
    92  
    93  // A collection of values returned by getLogGroups.
    94  type GetLogGroupsResultOutput struct{ *pulumi.OutputState }
    95  
    96  func (GetLogGroupsResultOutput) ElementType() reflect.Type {
    97  	return reflect.TypeOf((*GetLogGroupsResult)(nil)).Elem()
    98  }
    99  
   100  func (o GetLogGroupsResultOutput) ToGetLogGroupsResultOutput() GetLogGroupsResultOutput {
   101  	return o
   102  }
   103  
   104  func (o GetLogGroupsResultOutput) ToGetLogGroupsResultOutputWithContext(ctx context.Context) GetLogGroupsResultOutput {
   105  	return o
   106  }
   107  
   108  // Set of ARNs of the Cloudwatch log groups
   109  func (o GetLogGroupsResultOutput) Arns() pulumi.StringArrayOutput {
   110  	return o.ApplyT(func(v GetLogGroupsResult) []string { return v.Arns }).(pulumi.StringArrayOutput)
   111  }
   112  
   113  // The provider-assigned unique ID for this managed resource.
   114  func (o GetLogGroupsResultOutput) Id() pulumi.StringOutput {
   115  	return o.ApplyT(func(v GetLogGroupsResult) string { return v.Id }).(pulumi.StringOutput)
   116  }
   117  
   118  func (o GetLogGroupsResultOutput) LogGroupNamePrefix() pulumi.StringPtrOutput {
   119  	return o.ApplyT(func(v GetLogGroupsResult) *string { return v.LogGroupNamePrefix }).(pulumi.StringPtrOutput)
   120  }
   121  
   122  // Set of names of the Cloudwatch log groups
   123  func (o GetLogGroupsResultOutput) LogGroupNames() pulumi.StringArrayOutput {
   124  	return o.ApplyT(func(v GetLogGroupsResult) []string { return v.LogGroupNames }).(pulumi.StringArrayOutput)
   125  }
   126  
   127  func init() {
   128  	pulumi.RegisterOutputType(GetLogGroupsResultOutput{})
   129  }