github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cloudwatch/logGroup.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 // Provides a CloudWatch Log Group resource. 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.NewLogGroup(ctx, "yada", &cloudwatch.LogGroupArgs{ 32 // Name: pulumi.String("Yada"), 33 // Tags: pulumi.StringMap{ 34 // "Environment": pulumi.String("production"), 35 // "Application": pulumi.String("serviceA"), 36 // }, 37 // }) 38 // if err != nil { 39 // return err 40 // } 41 // return nil 42 // }) 43 // } 44 // 45 // ``` 46 // <!--End PulumiCodeChooser --> 47 // 48 // ## Import 49 // 50 // Using `pulumi import`, import Cloudwatch Log Groups using the `name`. For example: 51 // 52 // ```sh 53 // $ pulumi import aws:cloudwatch/logGroup:LogGroup test_group yada 54 // ``` 55 type LogGroup struct { 56 pulumi.CustomResourceState 57 58 // The Amazon Resource Name (ARN) specifying the 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. 59 Arn pulumi.StringOutput `pulumi:"arn"` 60 // The ARN of the KMS Key to use when encrypting log data. Please note, after the AWS KMS CMK is disassociated from the log group, 61 // AWS CloudWatch Logs stops encrypting newly ingested data for the log group. All previously ingested data remains encrypted, and AWS CloudWatch Logs requires 62 // permissions for the CMK whenever the encrypted data is requested. 63 KmsKeyId pulumi.StringPtrOutput `pulumi:"kmsKeyId"` 64 // Specified the log class of the log group. Possible values are: `STANDARD` or `INFREQUENT_ACCESS`. 65 LogGroupClass pulumi.StringOutput `pulumi:"logGroupClass"` 66 // The name of the log group. If omitted, this provider will assign a random, unique name. 67 Name pulumi.StringOutput `pulumi:"name"` 68 // Creates a unique name beginning with the specified prefix. Conflicts with `name`. 69 NamePrefix pulumi.StringOutput `pulumi:"namePrefix"` 70 // Specifies the number of days 71 // you want to retain log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1096, 1827, 2192, 2557, 2922, 3288, 3653, and 0. 72 // If you select 0, the events in the log group are always retained and never expire. 73 RetentionInDays pulumi.IntPtrOutput `pulumi:"retentionInDays"` 74 // Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the state. 75 SkipDestroy pulumi.BoolPtrOutput `pulumi:"skipDestroy"` 76 // A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 77 Tags pulumi.StringMapOutput `pulumi:"tags"` 78 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 79 // 80 // Deprecated: Please use `tags` instead. 81 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 82 } 83 84 // NewLogGroup registers a new resource with the given unique name, arguments, and options. 85 func NewLogGroup(ctx *pulumi.Context, 86 name string, args *LogGroupArgs, opts ...pulumi.ResourceOption) (*LogGroup, error) { 87 if args == nil { 88 args = &LogGroupArgs{} 89 } 90 91 opts = internal.PkgResourceDefaultOpts(opts) 92 var resource LogGroup 93 err := ctx.RegisterResource("aws:cloudwatch/logGroup:LogGroup", name, args, &resource, opts...) 94 if err != nil { 95 return nil, err 96 } 97 return &resource, nil 98 } 99 100 // GetLogGroup gets an existing LogGroup resource's state with the given name, ID, and optional 101 // state properties that are used to uniquely qualify the lookup (nil if not required). 102 func GetLogGroup(ctx *pulumi.Context, 103 name string, id pulumi.IDInput, state *LogGroupState, opts ...pulumi.ResourceOption) (*LogGroup, error) { 104 var resource LogGroup 105 err := ctx.ReadResource("aws:cloudwatch/logGroup:LogGroup", name, id, state, &resource, opts...) 106 if err != nil { 107 return nil, err 108 } 109 return &resource, nil 110 } 111 112 // Input properties used for looking up and filtering LogGroup resources. 113 type logGroupState struct { 114 // The Amazon Resource Name (ARN) specifying the 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. 115 Arn *string `pulumi:"arn"` 116 // The ARN of the KMS Key to use when encrypting log data. Please note, after the AWS KMS CMK is disassociated from the log group, 117 // AWS CloudWatch Logs stops encrypting newly ingested data for the log group. All previously ingested data remains encrypted, and AWS CloudWatch Logs requires 118 // permissions for the CMK whenever the encrypted data is requested. 119 KmsKeyId *string `pulumi:"kmsKeyId"` 120 // Specified the log class of the log group. Possible values are: `STANDARD` or `INFREQUENT_ACCESS`. 121 LogGroupClass *string `pulumi:"logGroupClass"` 122 // The name of the log group. If omitted, this provider will assign a random, unique name. 123 Name *string `pulumi:"name"` 124 // Creates a unique name beginning with the specified prefix. Conflicts with `name`. 125 NamePrefix *string `pulumi:"namePrefix"` 126 // Specifies the number of days 127 // you want to retain log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1096, 1827, 2192, 2557, 2922, 3288, 3653, and 0. 128 // If you select 0, the events in the log group are always retained and never expire. 129 RetentionInDays *int `pulumi:"retentionInDays"` 130 // Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the state. 131 SkipDestroy *bool `pulumi:"skipDestroy"` 132 // A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 133 Tags map[string]string `pulumi:"tags"` 134 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 135 // 136 // Deprecated: Please use `tags` instead. 137 TagsAll map[string]string `pulumi:"tagsAll"` 138 } 139 140 type LogGroupState struct { 141 // The Amazon Resource Name (ARN) specifying the 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. 142 Arn pulumi.StringPtrInput 143 // The ARN of the KMS Key to use when encrypting log data. Please note, after the AWS KMS CMK is disassociated from the log group, 144 // AWS CloudWatch Logs stops encrypting newly ingested data for the log group. All previously ingested data remains encrypted, and AWS CloudWatch Logs requires 145 // permissions for the CMK whenever the encrypted data is requested. 146 KmsKeyId pulumi.StringPtrInput 147 // Specified the log class of the log group. Possible values are: `STANDARD` or `INFREQUENT_ACCESS`. 148 LogGroupClass pulumi.StringPtrInput 149 // The name of the log group. If omitted, this provider will assign a random, unique name. 150 Name pulumi.StringPtrInput 151 // Creates a unique name beginning with the specified prefix. Conflicts with `name`. 152 NamePrefix pulumi.StringPtrInput 153 // Specifies the number of days 154 // you want to retain log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1096, 1827, 2192, 2557, 2922, 3288, 3653, and 0. 155 // If you select 0, the events in the log group are always retained and never expire. 156 RetentionInDays pulumi.IntPtrInput 157 // Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the state. 158 SkipDestroy pulumi.BoolPtrInput 159 // A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 160 Tags pulumi.StringMapInput 161 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 162 // 163 // Deprecated: Please use `tags` instead. 164 TagsAll pulumi.StringMapInput 165 } 166 167 func (LogGroupState) ElementType() reflect.Type { 168 return reflect.TypeOf((*logGroupState)(nil)).Elem() 169 } 170 171 type logGroupArgs struct { 172 // The ARN of the KMS Key to use when encrypting log data. Please note, after the AWS KMS CMK is disassociated from the log group, 173 // AWS CloudWatch Logs stops encrypting newly ingested data for the log group. All previously ingested data remains encrypted, and AWS CloudWatch Logs requires 174 // permissions for the CMK whenever the encrypted data is requested. 175 KmsKeyId *string `pulumi:"kmsKeyId"` 176 // Specified the log class of the log group. Possible values are: `STANDARD` or `INFREQUENT_ACCESS`. 177 LogGroupClass *string `pulumi:"logGroupClass"` 178 // The name of the log group. If omitted, this provider will assign a random, unique name. 179 Name *string `pulumi:"name"` 180 // Creates a unique name beginning with the specified prefix. Conflicts with `name`. 181 NamePrefix *string `pulumi:"namePrefix"` 182 // Specifies the number of days 183 // you want to retain log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1096, 1827, 2192, 2557, 2922, 3288, 3653, and 0. 184 // If you select 0, the events in the log group are always retained and never expire. 185 RetentionInDays *int `pulumi:"retentionInDays"` 186 // Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the state. 187 SkipDestroy *bool `pulumi:"skipDestroy"` 188 // A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 189 Tags map[string]string `pulumi:"tags"` 190 } 191 192 // The set of arguments for constructing a LogGroup resource. 193 type LogGroupArgs struct { 194 // The ARN of the KMS Key to use when encrypting log data. Please note, after the AWS KMS CMK is disassociated from the log group, 195 // AWS CloudWatch Logs stops encrypting newly ingested data for the log group. All previously ingested data remains encrypted, and AWS CloudWatch Logs requires 196 // permissions for the CMK whenever the encrypted data is requested. 197 KmsKeyId pulumi.StringPtrInput 198 // Specified the log class of the log group. Possible values are: `STANDARD` or `INFREQUENT_ACCESS`. 199 LogGroupClass pulumi.StringPtrInput 200 // The name of the log group. If omitted, this provider will assign a random, unique name. 201 Name pulumi.StringPtrInput 202 // Creates a unique name beginning with the specified prefix. Conflicts with `name`. 203 NamePrefix pulumi.StringPtrInput 204 // Specifies the number of days 205 // you want to retain log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1096, 1827, 2192, 2557, 2922, 3288, 3653, and 0. 206 // If you select 0, the events in the log group are always retained and never expire. 207 RetentionInDays pulumi.IntPtrInput 208 // Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the state. 209 SkipDestroy pulumi.BoolPtrInput 210 // A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 211 Tags pulumi.StringMapInput 212 } 213 214 func (LogGroupArgs) ElementType() reflect.Type { 215 return reflect.TypeOf((*logGroupArgs)(nil)).Elem() 216 } 217 218 type LogGroupInput interface { 219 pulumi.Input 220 221 ToLogGroupOutput() LogGroupOutput 222 ToLogGroupOutputWithContext(ctx context.Context) LogGroupOutput 223 } 224 225 func (*LogGroup) ElementType() reflect.Type { 226 return reflect.TypeOf((**LogGroup)(nil)).Elem() 227 } 228 229 func (i *LogGroup) ToLogGroupOutput() LogGroupOutput { 230 return i.ToLogGroupOutputWithContext(context.Background()) 231 } 232 233 func (i *LogGroup) ToLogGroupOutputWithContext(ctx context.Context) LogGroupOutput { 234 return pulumi.ToOutputWithContext(ctx, i).(LogGroupOutput) 235 } 236 237 // LogGroupArrayInput is an input type that accepts LogGroupArray and LogGroupArrayOutput values. 238 // You can construct a concrete instance of `LogGroupArrayInput` via: 239 // 240 // LogGroupArray{ LogGroupArgs{...} } 241 type LogGroupArrayInput interface { 242 pulumi.Input 243 244 ToLogGroupArrayOutput() LogGroupArrayOutput 245 ToLogGroupArrayOutputWithContext(context.Context) LogGroupArrayOutput 246 } 247 248 type LogGroupArray []LogGroupInput 249 250 func (LogGroupArray) ElementType() reflect.Type { 251 return reflect.TypeOf((*[]*LogGroup)(nil)).Elem() 252 } 253 254 func (i LogGroupArray) ToLogGroupArrayOutput() LogGroupArrayOutput { 255 return i.ToLogGroupArrayOutputWithContext(context.Background()) 256 } 257 258 func (i LogGroupArray) ToLogGroupArrayOutputWithContext(ctx context.Context) LogGroupArrayOutput { 259 return pulumi.ToOutputWithContext(ctx, i).(LogGroupArrayOutput) 260 } 261 262 // LogGroupMapInput is an input type that accepts LogGroupMap and LogGroupMapOutput values. 263 // You can construct a concrete instance of `LogGroupMapInput` via: 264 // 265 // LogGroupMap{ "key": LogGroupArgs{...} } 266 type LogGroupMapInput interface { 267 pulumi.Input 268 269 ToLogGroupMapOutput() LogGroupMapOutput 270 ToLogGroupMapOutputWithContext(context.Context) LogGroupMapOutput 271 } 272 273 type LogGroupMap map[string]LogGroupInput 274 275 func (LogGroupMap) ElementType() reflect.Type { 276 return reflect.TypeOf((*map[string]*LogGroup)(nil)).Elem() 277 } 278 279 func (i LogGroupMap) ToLogGroupMapOutput() LogGroupMapOutput { 280 return i.ToLogGroupMapOutputWithContext(context.Background()) 281 } 282 283 func (i LogGroupMap) ToLogGroupMapOutputWithContext(ctx context.Context) LogGroupMapOutput { 284 return pulumi.ToOutputWithContext(ctx, i).(LogGroupMapOutput) 285 } 286 287 type LogGroupOutput struct{ *pulumi.OutputState } 288 289 func (LogGroupOutput) ElementType() reflect.Type { 290 return reflect.TypeOf((**LogGroup)(nil)).Elem() 291 } 292 293 func (o LogGroupOutput) ToLogGroupOutput() LogGroupOutput { 294 return o 295 } 296 297 func (o LogGroupOutput) ToLogGroupOutputWithContext(ctx context.Context) LogGroupOutput { 298 return o 299 } 300 301 // The Amazon Resource Name (ARN) specifying the 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. 302 func (o LogGroupOutput) Arn() pulumi.StringOutput { 303 return o.ApplyT(func(v *LogGroup) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 304 } 305 306 // The ARN of the KMS Key to use when encrypting log data. Please note, after the AWS KMS CMK is disassociated from the log group, 307 // AWS CloudWatch Logs stops encrypting newly ingested data for the log group. All previously ingested data remains encrypted, and AWS CloudWatch Logs requires 308 // permissions for the CMK whenever the encrypted data is requested. 309 func (o LogGroupOutput) KmsKeyId() pulumi.StringPtrOutput { 310 return o.ApplyT(func(v *LogGroup) pulumi.StringPtrOutput { return v.KmsKeyId }).(pulumi.StringPtrOutput) 311 } 312 313 // Specified the log class of the log group. Possible values are: `STANDARD` or `INFREQUENT_ACCESS`. 314 func (o LogGroupOutput) LogGroupClass() pulumi.StringOutput { 315 return o.ApplyT(func(v *LogGroup) pulumi.StringOutput { return v.LogGroupClass }).(pulumi.StringOutput) 316 } 317 318 // The name of the log group. If omitted, this provider will assign a random, unique name. 319 func (o LogGroupOutput) Name() pulumi.StringOutput { 320 return o.ApplyT(func(v *LogGroup) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 321 } 322 323 // Creates a unique name beginning with the specified prefix. Conflicts with `name`. 324 func (o LogGroupOutput) NamePrefix() pulumi.StringOutput { 325 return o.ApplyT(func(v *LogGroup) pulumi.StringOutput { return v.NamePrefix }).(pulumi.StringOutput) 326 } 327 328 // Specifies the number of days 329 // you want to retain log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1096, 1827, 2192, 2557, 2922, 3288, 3653, and 0. 330 // If you select 0, the events in the log group are always retained and never expire. 331 func (o LogGroupOutput) RetentionInDays() pulumi.IntPtrOutput { 332 return o.ApplyT(func(v *LogGroup) pulumi.IntPtrOutput { return v.RetentionInDays }).(pulumi.IntPtrOutput) 333 } 334 335 // Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the state. 336 func (o LogGroupOutput) SkipDestroy() pulumi.BoolPtrOutput { 337 return o.ApplyT(func(v *LogGroup) pulumi.BoolPtrOutput { return v.SkipDestroy }).(pulumi.BoolPtrOutput) 338 } 339 340 // A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 341 func (o LogGroupOutput) Tags() pulumi.StringMapOutput { 342 return o.ApplyT(func(v *LogGroup) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 343 } 344 345 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 346 // 347 // Deprecated: Please use `tags` instead. 348 func (o LogGroupOutput) TagsAll() pulumi.StringMapOutput { 349 return o.ApplyT(func(v *LogGroup) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 350 } 351 352 type LogGroupArrayOutput struct{ *pulumi.OutputState } 353 354 func (LogGroupArrayOutput) ElementType() reflect.Type { 355 return reflect.TypeOf((*[]*LogGroup)(nil)).Elem() 356 } 357 358 func (o LogGroupArrayOutput) ToLogGroupArrayOutput() LogGroupArrayOutput { 359 return o 360 } 361 362 func (o LogGroupArrayOutput) ToLogGroupArrayOutputWithContext(ctx context.Context) LogGroupArrayOutput { 363 return o 364 } 365 366 func (o LogGroupArrayOutput) Index(i pulumi.IntInput) LogGroupOutput { 367 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *LogGroup { 368 return vs[0].([]*LogGroup)[vs[1].(int)] 369 }).(LogGroupOutput) 370 } 371 372 type LogGroupMapOutput struct{ *pulumi.OutputState } 373 374 func (LogGroupMapOutput) ElementType() reflect.Type { 375 return reflect.TypeOf((*map[string]*LogGroup)(nil)).Elem() 376 } 377 378 func (o LogGroupMapOutput) ToLogGroupMapOutput() LogGroupMapOutput { 379 return o 380 } 381 382 func (o LogGroupMapOutput) ToLogGroupMapOutputWithContext(ctx context.Context) LogGroupMapOutput { 383 return o 384 } 385 386 func (o LogGroupMapOutput) MapIndex(k pulumi.StringInput) LogGroupOutput { 387 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *LogGroup { 388 return vs[0].(map[string]*LogGroup)[vs[1].(string)] 389 }).(LogGroupOutput) 390 } 391 392 func init() { 393 pulumi.RegisterInputType(reflect.TypeOf((*LogGroupInput)(nil)).Elem(), &LogGroup{}) 394 pulumi.RegisterInputType(reflect.TypeOf((*LogGroupArrayInput)(nil)).Elem(), LogGroupArray{}) 395 pulumi.RegisterInputType(reflect.TypeOf((*LogGroupMapInput)(nil)).Elem(), LogGroupMap{}) 396 pulumi.RegisterOutputType(LogGroupOutput{}) 397 pulumi.RegisterOutputType(LogGroupArrayOutput{}) 398 pulumi.RegisterOutputType(LogGroupMapOutput{}) 399 }