github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cloudwatch/logDestination.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 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Provides a CloudWatch Logs destination resource. 16 // 17 // ## Example Usage 18 // 19 // <!--Start PulumiCodeChooser --> 20 // ```go 21 // package main 22 // 23 // import ( 24 // 25 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch" 26 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 27 // 28 // ) 29 // 30 // func main() { 31 // pulumi.Run(func(ctx *pulumi.Context) error { 32 // _, err := cloudwatch.NewLogDestination(ctx, "test_destination", &cloudwatch.LogDestinationArgs{ 33 // Name: pulumi.String("test_destination"), 34 // RoleArn: pulumi.Any(iamForCloudwatch.Arn), 35 // TargetArn: pulumi.Any(kinesisForCloudwatch.Arn), 36 // }) 37 // if err != nil { 38 // return err 39 // } 40 // return nil 41 // }) 42 // } 43 // 44 // ``` 45 // <!--End PulumiCodeChooser --> 46 // 47 // ## Import 48 // 49 // Using `pulumi import`, import CloudWatch Logs destinations using the `name`. For example: 50 // 51 // ```sh 52 // $ pulumi import aws:cloudwatch/logDestination:LogDestination test_destination test_destination 53 // ``` 54 type LogDestination struct { 55 pulumi.CustomResourceState 56 57 // The Amazon Resource Name (ARN) specifying the log destination. 58 Arn pulumi.StringOutput `pulumi:"arn"` 59 // A name for the log destination. 60 Name pulumi.StringOutput `pulumi:"name"` 61 // The ARN of an IAM role that grants Amazon CloudWatch Logs permissions to put data into the target. 62 RoleArn pulumi.StringOutput `pulumi:"roleArn"` 63 // 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. 64 Tags pulumi.StringMapOutput `pulumi:"tags"` 65 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 66 // 67 // Deprecated: Please use `tags` instead. 68 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 69 // The ARN of the target Amazon Kinesis stream resource for the destination. 70 TargetArn pulumi.StringOutput `pulumi:"targetArn"` 71 } 72 73 // NewLogDestination registers a new resource with the given unique name, arguments, and options. 74 func NewLogDestination(ctx *pulumi.Context, 75 name string, args *LogDestinationArgs, opts ...pulumi.ResourceOption) (*LogDestination, error) { 76 if args == nil { 77 return nil, errors.New("missing one or more required arguments") 78 } 79 80 if args.RoleArn == nil { 81 return nil, errors.New("invalid value for required argument 'RoleArn'") 82 } 83 if args.TargetArn == nil { 84 return nil, errors.New("invalid value for required argument 'TargetArn'") 85 } 86 opts = internal.PkgResourceDefaultOpts(opts) 87 var resource LogDestination 88 err := ctx.RegisterResource("aws:cloudwatch/logDestination:LogDestination", name, args, &resource, opts...) 89 if err != nil { 90 return nil, err 91 } 92 return &resource, nil 93 } 94 95 // GetLogDestination gets an existing LogDestination resource's state with the given name, ID, and optional 96 // state properties that are used to uniquely qualify the lookup (nil if not required). 97 func GetLogDestination(ctx *pulumi.Context, 98 name string, id pulumi.IDInput, state *LogDestinationState, opts ...pulumi.ResourceOption) (*LogDestination, error) { 99 var resource LogDestination 100 err := ctx.ReadResource("aws:cloudwatch/logDestination:LogDestination", name, id, state, &resource, opts...) 101 if err != nil { 102 return nil, err 103 } 104 return &resource, nil 105 } 106 107 // Input properties used for looking up and filtering LogDestination resources. 108 type logDestinationState struct { 109 // The Amazon Resource Name (ARN) specifying the log destination. 110 Arn *string `pulumi:"arn"` 111 // A name for the log destination. 112 Name *string `pulumi:"name"` 113 // The ARN of an IAM role that grants Amazon CloudWatch Logs permissions to put data into the target. 114 RoleArn *string `pulumi:"roleArn"` 115 // 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. 116 Tags map[string]string `pulumi:"tags"` 117 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 118 // 119 // Deprecated: Please use `tags` instead. 120 TagsAll map[string]string `pulumi:"tagsAll"` 121 // The ARN of the target Amazon Kinesis stream resource for the destination. 122 TargetArn *string `pulumi:"targetArn"` 123 } 124 125 type LogDestinationState struct { 126 // The Amazon Resource Name (ARN) specifying the log destination. 127 Arn pulumi.StringPtrInput 128 // A name for the log destination. 129 Name pulumi.StringPtrInput 130 // The ARN of an IAM role that grants Amazon CloudWatch Logs permissions to put data into the target. 131 RoleArn pulumi.StringPtrInput 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 pulumi.StringMapInput 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 pulumi.StringMapInput 138 // The ARN of the target Amazon Kinesis stream resource for the destination. 139 TargetArn pulumi.StringPtrInput 140 } 141 142 func (LogDestinationState) ElementType() reflect.Type { 143 return reflect.TypeOf((*logDestinationState)(nil)).Elem() 144 } 145 146 type logDestinationArgs struct { 147 // A name for the log destination. 148 Name *string `pulumi:"name"` 149 // The ARN of an IAM role that grants Amazon CloudWatch Logs permissions to put data into the target. 150 RoleArn string `pulumi:"roleArn"` 151 // 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. 152 Tags map[string]string `pulumi:"tags"` 153 // The ARN of the target Amazon Kinesis stream resource for the destination. 154 TargetArn string `pulumi:"targetArn"` 155 } 156 157 // The set of arguments for constructing a LogDestination resource. 158 type LogDestinationArgs struct { 159 // A name for the log destination. 160 Name pulumi.StringPtrInput 161 // The ARN of an IAM role that grants Amazon CloudWatch Logs permissions to put data into the target. 162 RoleArn pulumi.StringInput 163 // 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. 164 Tags pulumi.StringMapInput 165 // The ARN of the target Amazon Kinesis stream resource for the destination. 166 TargetArn pulumi.StringInput 167 } 168 169 func (LogDestinationArgs) ElementType() reflect.Type { 170 return reflect.TypeOf((*logDestinationArgs)(nil)).Elem() 171 } 172 173 type LogDestinationInput interface { 174 pulumi.Input 175 176 ToLogDestinationOutput() LogDestinationOutput 177 ToLogDestinationOutputWithContext(ctx context.Context) LogDestinationOutput 178 } 179 180 func (*LogDestination) ElementType() reflect.Type { 181 return reflect.TypeOf((**LogDestination)(nil)).Elem() 182 } 183 184 func (i *LogDestination) ToLogDestinationOutput() LogDestinationOutput { 185 return i.ToLogDestinationOutputWithContext(context.Background()) 186 } 187 188 func (i *LogDestination) ToLogDestinationOutputWithContext(ctx context.Context) LogDestinationOutput { 189 return pulumi.ToOutputWithContext(ctx, i).(LogDestinationOutput) 190 } 191 192 // LogDestinationArrayInput is an input type that accepts LogDestinationArray and LogDestinationArrayOutput values. 193 // You can construct a concrete instance of `LogDestinationArrayInput` via: 194 // 195 // LogDestinationArray{ LogDestinationArgs{...} } 196 type LogDestinationArrayInput interface { 197 pulumi.Input 198 199 ToLogDestinationArrayOutput() LogDestinationArrayOutput 200 ToLogDestinationArrayOutputWithContext(context.Context) LogDestinationArrayOutput 201 } 202 203 type LogDestinationArray []LogDestinationInput 204 205 func (LogDestinationArray) ElementType() reflect.Type { 206 return reflect.TypeOf((*[]*LogDestination)(nil)).Elem() 207 } 208 209 func (i LogDestinationArray) ToLogDestinationArrayOutput() LogDestinationArrayOutput { 210 return i.ToLogDestinationArrayOutputWithContext(context.Background()) 211 } 212 213 func (i LogDestinationArray) ToLogDestinationArrayOutputWithContext(ctx context.Context) LogDestinationArrayOutput { 214 return pulumi.ToOutputWithContext(ctx, i).(LogDestinationArrayOutput) 215 } 216 217 // LogDestinationMapInput is an input type that accepts LogDestinationMap and LogDestinationMapOutput values. 218 // You can construct a concrete instance of `LogDestinationMapInput` via: 219 // 220 // LogDestinationMap{ "key": LogDestinationArgs{...} } 221 type LogDestinationMapInput interface { 222 pulumi.Input 223 224 ToLogDestinationMapOutput() LogDestinationMapOutput 225 ToLogDestinationMapOutputWithContext(context.Context) LogDestinationMapOutput 226 } 227 228 type LogDestinationMap map[string]LogDestinationInput 229 230 func (LogDestinationMap) ElementType() reflect.Type { 231 return reflect.TypeOf((*map[string]*LogDestination)(nil)).Elem() 232 } 233 234 func (i LogDestinationMap) ToLogDestinationMapOutput() LogDestinationMapOutput { 235 return i.ToLogDestinationMapOutputWithContext(context.Background()) 236 } 237 238 func (i LogDestinationMap) ToLogDestinationMapOutputWithContext(ctx context.Context) LogDestinationMapOutput { 239 return pulumi.ToOutputWithContext(ctx, i).(LogDestinationMapOutput) 240 } 241 242 type LogDestinationOutput struct{ *pulumi.OutputState } 243 244 func (LogDestinationOutput) ElementType() reflect.Type { 245 return reflect.TypeOf((**LogDestination)(nil)).Elem() 246 } 247 248 func (o LogDestinationOutput) ToLogDestinationOutput() LogDestinationOutput { 249 return o 250 } 251 252 func (o LogDestinationOutput) ToLogDestinationOutputWithContext(ctx context.Context) LogDestinationOutput { 253 return o 254 } 255 256 // The Amazon Resource Name (ARN) specifying the log destination. 257 func (o LogDestinationOutput) Arn() pulumi.StringOutput { 258 return o.ApplyT(func(v *LogDestination) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 259 } 260 261 // A name for the log destination. 262 func (o LogDestinationOutput) Name() pulumi.StringOutput { 263 return o.ApplyT(func(v *LogDestination) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 264 } 265 266 // The ARN of an IAM role that grants Amazon CloudWatch Logs permissions to put data into the target. 267 func (o LogDestinationOutput) RoleArn() pulumi.StringOutput { 268 return o.ApplyT(func(v *LogDestination) pulumi.StringOutput { return v.RoleArn }).(pulumi.StringOutput) 269 } 270 271 // 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. 272 func (o LogDestinationOutput) Tags() pulumi.StringMapOutput { 273 return o.ApplyT(func(v *LogDestination) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 274 } 275 276 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 277 // 278 // Deprecated: Please use `tags` instead. 279 func (o LogDestinationOutput) TagsAll() pulumi.StringMapOutput { 280 return o.ApplyT(func(v *LogDestination) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 281 } 282 283 // The ARN of the target Amazon Kinesis stream resource for the destination. 284 func (o LogDestinationOutput) TargetArn() pulumi.StringOutput { 285 return o.ApplyT(func(v *LogDestination) pulumi.StringOutput { return v.TargetArn }).(pulumi.StringOutput) 286 } 287 288 type LogDestinationArrayOutput struct{ *pulumi.OutputState } 289 290 func (LogDestinationArrayOutput) ElementType() reflect.Type { 291 return reflect.TypeOf((*[]*LogDestination)(nil)).Elem() 292 } 293 294 func (o LogDestinationArrayOutput) ToLogDestinationArrayOutput() LogDestinationArrayOutput { 295 return o 296 } 297 298 func (o LogDestinationArrayOutput) ToLogDestinationArrayOutputWithContext(ctx context.Context) LogDestinationArrayOutput { 299 return o 300 } 301 302 func (o LogDestinationArrayOutput) Index(i pulumi.IntInput) LogDestinationOutput { 303 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *LogDestination { 304 return vs[0].([]*LogDestination)[vs[1].(int)] 305 }).(LogDestinationOutput) 306 } 307 308 type LogDestinationMapOutput struct{ *pulumi.OutputState } 309 310 func (LogDestinationMapOutput) ElementType() reflect.Type { 311 return reflect.TypeOf((*map[string]*LogDestination)(nil)).Elem() 312 } 313 314 func (o LogDestinationMapOutput) ToLogDestinationMapOutput() LogDestinationMapOutput { 315 return o 316 } 317 318 func (o LogDestinationMapOutput) ToLogDestinationMapOutputWithContext(ctx context.Context) LogDestinationMapOutput { 319 return o 320 } 321 322 func (o LogDestinationMapOutput) MapIndex(k pulumi.StringInput) LogDestinationOutput { 323 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *LogDestination { 324 return vs[0].(map[string]*LogDestination)[vs[1].(string)] 325 }).(LogDestinationOutput) 326 } 327 328 func init() { 329 pulumi.RegisterInputType(reflect.TypeOf((*LogDestinationInput)(nil)).Elem(), &LogDestination{}) 330 pulumi.RegisterInputType(reflect.TypeOf((*LogDestinationArrayInput)(nil)).Elem(), LogDestinationArray{}) 331 pulumi.RegisterInputType(reflect.TypeOf((*LogDestinationMapInput)(nil)).Elem(), LogDestinationMap{}) 332 pulumi.RegisterOutputType(LogDestinationOutput{}) 333 pulumi.RegisterOutputType(LogDestinationArrayOutput{}) 334 pulumi.RegisterOutputType(LogDestinationMapOutput{}) 335 }