github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cloudwatch/getLogGroup.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 information about an AWS Cloudwatch Log Group
    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.LookupLogGroup(ctx, &cloudwatch.LookupLogGroupArgs{
    32  //				Name: "MyImportantLogs",
    33  //			}, nil)
    34  //			if err != nil {
    35  //				return err
    36  //			}
    37  //			return nil
    38  //		})
    39  //	}
    40  //
    41  // ```
    42  // <!--End PulumiCodeChooser -->
    43  func LookupLogGroup(ctx *pulumi.Context, args *LookupLogGroupArgs, opts ...pulumi.InvokeOption) (*LookupLogGroupResult, error) {
    44  	opts = internal.PkgInvokeDefaultOpts(opts)
    45  	var rv LookupLogGroupResult
    46  	err := ctx.Invoke("aws:cloudwatch/getLogGroup:getLogGroup", 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 getLogGroup.
    54  type LookupLogGroupArgs struct {
    55  	// Name of the Cloudwatch log group
    56  	Name string `pulumi:"name"`
    57  	// Map of tags to assign to the resource.
    58  	Tags map[string]string `pulumi:"tags"`
    59  }
    60  
    61  // A collection of values returned by getLogGroup.
    62  type LookupLogGroupResult struct {
    63  	// ARN of the Cloudwatch log group. Any `:*` suffix added by the API, denoting all CloudWatch Log Streams under the CloudWatch Log Group, is removed for greater compatibility with other AWS services that do not accept the suffix.
    64  	Arn string `pulumi:"arn"`
    65  	// Creation time of the log group, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.
    66  	CreationTime int `pulumi:"creationTime"`
    67  	// The provider-assigned unique ID for this managed resource.
    68  	Id string `pulumi:"id"`
    69  	// ARN of the KMS Key to use when encrypting log data.
    70  	KmsKeyId string `pulumi:"kmsKeyId"`
    71  	// The log class of the log group.
    72  	LogGroupClass string `pulumi:"logGroupClass"`
    73  	Name          string `pulumi:"name"`
    74  	// Number of days log events retained in the specified log group.
    75  	RetentionInDays int `pulumi:"retentionInDays"`
    76  	// Map of tags to assign to the resource.
    77  	Tags map[string]string `pulumi:"tags"`
    78  }
    79  
    80  func LookupLogGroupOutput(ctx *pulumi.Context, args LookupLogGroupOutputArgs, opts ...pulumi.InvokeOption) LookupLogGroupResultOutput {
    81  	return pulumi.ToOutputWithContext(context.Background(), args).
    82  		ApplyT(func(v interface{}) (LookupLogGroupResult, error) {
    83  			args := v.(LookupLogGroupArgs)
    84  			r, err := LookupLogGroup(ctx, &args, opts...)
    85  			var s LookupLogGroupResult
    86  			if r != nil {
    87  				s = *r
    88  			}
    89  			return s, err
    90  		}).(LookupLogGroupResultOutput)
    91  }
    92  
    93  // A collection of arguments for invoking getLogGroup.
    94  type LookupLogGroupOutputArgs struct {
    95  	// Name of the Cloudwatch log group
    96  	Name pulumi.StringInput `pulumi:"name"`
    97  	// Map of tags to assign to the resource.
    98  	Tags pulumi.StringMapInput `pulumi:"tags"`
    99  }
   100  
   101  func (LookupLogGroupOutputArgs) ElementType() reflect.Type {
   102  	return reflect.TypeOf((*LookupLogGroupArgs)(nil)).Elem()
   103  }
   104  
   105  // A collection of values returned by getLogGroup.
   106  type LookupLogGroupResultOutput struct{ *pulumi.OutputState }
   107  
   108  func (LookupLogGroupResultOutput) ElementType() reflect.Type {
   109  	return reflect.TypeOf((*LookupLogGroupResult)(nil)).Elem()
   110  }
   111  
   112  func (o LookupLogGroupResultOutput) ToLookupLogGroupResultOutput() LookupLogGroupResultOutput {
   113  	return o
   114  }
   115  
   116  func (o LookupLogGroupResultOutput) ToLookupLogGroupResultOutputWithContext(ctx context.Context) LookupLogGroupResultOutput {
   117  	return o
   118  }
   119  
   120  // ARN of the Cloudwatch log group. Any `:*` suffix added by the API, denoting all CloudWatch Log Streams under the CloudWatch Log Group, is removed for greater compatibility with other AWS services that do not accept the suffix.
   121  func (o LookupLogGroupResultOutput) Arn() pulumi.StringOutput {
   122  	return o.ApplyT(func(v LookupLogGroupResult) string { return v.Arn }).(pulumi.StringOutput)
   123  }
   124  
   125  // Creation time of the log group, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.
   126  func (o LookupLogGroupResultOutput) CreationTime() pulumi.IntOutput {
   127  	return o.ApplyT(func(v LookupLogGroupResult) int { return v.CreationTime }).(pulumi.IntOutput)
   128  }
   129  
   130  // The provider-assigned unique ID for this managed resource.
   131  func (o LookupLogGroupResultOutput) Id() pulumi.StringOutput {
   132  	return o.ApplyT(func(v LookupLogGroupResult) string { return v.Id }).(pulumi.StringOutput)
   133  }
   134  
   135  // ARN of the KMS Key to use when encrypting log data.
   136  func (o LookupLogGroupResultOutput) KmsKeyId() pulumi.StringOutput {
   137  	return o.ApplyT(func(v LookupLogGroupResult) string { return v.KmsKeyId }).(pulumi.StringOutput)
   138  }
   139  
   140  // The log class of the log group.
   141  func (o LookupLogGroupResultOutput) LogGroupClass() pulumi.StringOutput {
   142  	return o.ApplyT(func(v LookupLogGroupResult) string { return v.LogGroupClass }).(pulumi.StringOutput)
   143  }
   144  
   145  func (o LookupLogGroupResultOutput) Name() pulumi.StringOutput {
   146  	return o.ApplyT(func(v LookupLogGroupResult) string { return v.Name }).(pulumi.StringOutput)
   147  }
   148  
   149  // Number of days log events retained in the specified log group.
   150  func (o LookupLogGroupResultOutput) RetentionInDays() pulumi.IntOutput {
   151  	return o.ApplyT(func(v LookupLogGroupResult) int { return v.RetentionInDays }).(pulumi.IntOutput)
   152  }
   153  
   154  // Map of tags to assign to the resource.
   155  func (o LookupLogGroupResultOutput) Tags() pulumi.StringMapOutput {
   156  	return o.ApplyT(func(v LookupLogGroupResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   157  }
   158  
   159  func init() {
   160  	pulumi.RegisterOutputType(LookupLogGroupResultOutput{})
   161  }