github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/costexplorer/anomalyMonitor.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 costexplorer 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 CE Anomaly Monitor. 16 // 17 // ## Example Usage 18 // 19 // There are two main types of a Cost Anomaly Monitor: `DIMENSIONAL` and `CUSTOM`. 20 // 21 // ### Dimensional Example 22 // 23 // <!--Start PulumiCodeChooser --> 24 // ```go 25 // package main 26 // 27 // import ( 28 // 29 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/costexplorer" 30 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 31 // 32 // ) 33 // 34 // func main() { 35 // pulumi.Run(func(ctx *pulumi.Context) error { 36 // _, err := costexplorer.NewAnomalyMonitor(ctx, "service_monitor", &costexplorer.AnomalyMonitorArgs{ 37 // Name: pulumi.String("AWSServiceMonitor"), 38 // MonitorType: pulumi.String("DIMENSIONAL"), 39 // MonitorDimension: pulumi.String("SERVICE"), 40 // }) 41 // if err != nil { 42 // return err 43 // } 44 // return nil 45 // }) 46 // } 47 // 48 // ``` 49 // <!--End PulumiCodeChooser --> 50 // 51 // ### Custom Example 52 // 53 // <!--Start PulumiCodeChooser --> 54 // ```go 55 // package main 56 // 57 // import ( 58 // 59 // "encoding/json" 60 // 61 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/costexplorer" 62 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 63 // 64 // ) 65 // 66 // func main() { 67 // pulumi.Run(func(ctx *pulumi.Context) error { 68 // tmpJSON0, err := json.Marshal(map[string]interface{}{ 69 // "And": nil, 70 // "CostCategories": nil, 71 // "Dimensions": nil, 72 // "Not": nil, 73 // "Or": nil, 74 // "Tags": map[string]interface{}{ 75 // "Key": "CostCenter", 76 // "MatchOptions": nil, 77 // "Values": []string{ 78 // "10000", 79 // }, 80 // }, 81 // }) 82 // if err != nil { 83 // return err 84 // } 85 // json0 := string(tmpJSON0) 86 // _, err = costexplorer.NewAnomalyMonitor(ctx, "test", &costexplorer.AnomalyMonitorArgs{ 87 // Name: pulumi.String("AWSCustomAnomalyMonitor"), 88 // MonitorType: pulumi.String("CUSTOM"), 89 // MonitorSpecification: pulumi.String(json0), 90 // }) 91 // if err != nil { 92 // return err 93 // } 94 // return nil 95 // }) 96 // } 97 // 98 // ``` 99 // <!--End PulumiCodeChooser --> 100 // 101 // ## Import 102 // 103 // Using `pulumi import`, import `aws_ce_anomaly_monitor` using the `id`. For example: 104 // 105 // ```sh 106 // $ pulumi import aws:costexplorer/anomalyMonitor:AnomalyMonitor example costAnomalyMonitorARN 107 // ``` 108 type AnomalyMonitor struct { 109 pulumi.CustomResourceState 110 111 // ARN of the anomaly monitor. 112 Arn pulumi.StringOutput `pulumi:"arn"` 113 // The dimensions to evaluate. Valid values: `SERVICE`. 114 MonitorDimension pulumi.StringPtrOutput `pulumi:"monitorDimension"` 115 // A valid JSON representation for the [Expression](https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_Expression.html) object. 116 MonitorSpecification pulumi.StringPtrOutput `pulumi:"monitorSpecification"` 117 // The possible type values. Valid values: `DIMENSIONAL` | `CUSTOM`. 118 MonitorType pulumi.StringOutput `pulumi:"monitorType"` 119 // The name of the monitor. 120 Name pulumi.StringOutput `pulumi:"name"` 121 // 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. 122 Tags pulumi.StringMapOutput `pulumi:"tags"` 123 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 124 // 125 // Deprecated: Please use `tags` instead. 126 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 127 } 128 129 // NewAnomalyMonitor registers a new resource with the given unique name, arguments, and options. 130 func NewAnomalyMonitor(ctx *pulumi.Context, 131 name string, args *AnomalyMonitorArgs, opts ...pulumi.ResourceOption) (*AnomalyMonitor, error) { 132 if args == nil { 133 return nil, errors.New("missing one or more required arguments") 134 } 135 136 if args.MonitorType == nil { 137 return nil, errors.New("invalid value for required argument 'MonitorType'") 138 } 139 opts = internal.PkgResourceDefaultOpts(opts) 140 var resource AnomalyMonitor 141 err := ctx.RegisterResource("aws:costexplorer/anomalyMonitor:AnomalyMonitor", name, args, &resource, opts...) 142 if err != nil { 143 return nil, err 144 } 145 return &resource, nil 146 } 147 148 // GetAnomalyMonitor gets an existing AnomalyMonitor resource's state with the given name, ID, and optional 149 // state properties that are used to uniquely qualify the lookup (nil if not required). 150 func GetAnomalyMonitor(ctx *pulumi.Context, 151 name string, id pulumi.IDInput, state *AnomalyMonitorState, opts ...pulumi.ResourceOption) (*AnomalyMonitor, error) { 152 var resource AnomalyMonitor 153 err := ctx.ReadResource("aws:costexplorer/anomalyMonitor:AnomalyMonitor", name, id, state, &resource, opts...) 154 if err != nil { 155 return nil, err 156 } 157 return &resource, nil 158 } 159 160 // Input properties used for looking up and filtering AnomalyMonitor resources. 161 type anomalyMonitorState struct { 162 // ARN of the anomaly monitor. 163 Arn *string `pulumi:"arn"` 164 // The dimensions to evaluate. Valid values: `SERVICE`. 165 MonitorDimension *string `pulumi:"monitorDimension"` 166 // A valid JSON representation for the [Expression](https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_Expression.html) object. 167 MonitorSpecification *string `pulumi:"monitorSpecification"` 168 // The possible type values. Valid values: `DIMENSIONAL` | `CUSTOM`. 169 MonitorType *string `pulumi:"monitorType"` 170 // The name of the monitor. 171 Name *string `pulumi:"name"` 172 // 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. 173 Tags map[string]string `pulumi:"tags"` 174 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 175 // 176 // Deprecated: Please use `tags` instead. 177 TagsAll map[string]string `pulumi:"tagsAll"` 178 } 179 180 type AnomalyMonitorState struct { 181 // ARN of the anomaly monitor. 182 Arn pulumi.StringPtrInput 183 // The dimensions to evaluate. Valid values: `SERVICE`. 184 MonitorDimension pulumi.StringPtrInput 185 // A valid JSON representation for the [Expression](https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_Expression.html) object. 186 MonitorSpecification pulumi.StringPtrInput 187 // The possible type values. Valid values: `DIMENSIONAL` | `CUSTOM`. 188 MonitorType pulumi.StringPtrInput 189 // The name of the monitor. 190 Name pulumi.StringPtrInput 191 // 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. 192 Tags pulumi.StringMapInput 193 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 194 // 195 // Deprecated: Please use `tags` instead. 196 TagsAll pulumi.StringMapInput 197 } 198 199 func (AnomalyMonitorState) ElementType() reflect.Type { 200 return reflect.TypeOf((*anomalyMonitorState)(nil)).Elem() 201 } 202 203 type anomalyMonitorArgs struct { 204 // The dimensions to evaluate. Valid values: `SERVICE`. 205 MonitorDimension *string `pulumi:"monitorDimension"` 206 // A valid JSON representation for the [Expression](https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_Expression.html) object. 207 MonitorSpecification *string `pulumi:"monitorSpecification"` 208 // The possible type values. Valid values: `DIMENSIONAL` | `CUSTOM`. 209 MonitorType string `pulumi:"monitorType"` 210 // The name of the monitor. 211 Name *string `pulumi:"name"` 212 // 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. 213 Tags map[string]string `pulumi:"tags"` 214 } 215 216 // The set of arguments for constructing a AnomalyMonitor resource. 217 type AnomalyMonitorArgs struct { 218 // The dimensions to evaluate. Valid values: `SERVICE`. 219 MonitorDimension pulumi.StringPtrInput 220 // A valid JSON representation for the [Expression](https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_Expression.html) object. 221 MonitorSpecification pulumi.StringPtrInput 222 // The possible type values. Valid values: `DIMENSIONAL` | `CUSTOM`. 223 MonitorType pulumi.StringInput 224 // The name of the monitor. 225 Name pulumi.StringPtrInput 226 // 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. 227 Tags pulumi.StringMapInput 228 } 229 230 func (AnomalyMonitorArgs) ElementType() reflect.Type { 231 return reflect.TypeOf((*anomalyMonitorArgs)(nil)).Elem() 232 } 233 234 type AnomalyMonitorInput interface { 235 pulumi.Input 236 237 ToAnomalyMonitorOutput() AnomalyMonitorOutput 238 ToAnomalyMonitorOutputWithContext(ctx context.Context) AnomalyMonitorOutput 239 } 240 241 func (*AnomalyMonitor) ElementType() reflect.Type { 242 return reflect.TypeOf((**AnomalyMonitor)(nil)).Elem() 243 } 244 245 func (i *AnomalyMonitor) ToAnomalyMonitorOutput() AnomalyMonitorOutput { 246 return i.ToAnomalyMonitorOutputWithContext(context.Background()) 247 } 248 249 func (i *AnomalyMonitor) ToAnomalyMonitorOutputWithContext(ctx context.Context) AnomalyMonitorOutput { 250 return pulumi.ToOutputWithContext(ctx, i).(AnomalyMonitorOutput) 251 } 252 253 // AnomalyMonitorArrayInput is an input type that accepts AnomalyMonitorArray and AnomalyMonitorArrayOutput values. 254 // You can construct a concrete instance of `AnomalyMonitorArrayInput` via: 255 // 256 // AnomalyMonitorArray{ AnomalyMonitorArgs{...} } 257 type AnomalyMonitorArrayInput interface { 258 pulumi.Input 259 260 ToAnomalyMonitorArrayOutput() AnomalyMonitorArrayOutput 261 ToAnomalyMonitorArrayOutputWithContext(context.Context) AnomalyMonitorArrayOutput 262 } 263 264 type AnomalyMonitorArray []AnomalyMonitorInput 265 266 func (AnomalyMonitorArray) ElementType() reflect.Type { 267 return reflect.TypeOf((*[]*AnomalyMonitor)(nil)).Elem() 268 } 269 270 func (i AnomalyMonitorArray) ToAnomalyMonitorArrayOutput() AnomalyMonitorArrayOutput { 271 return i.ToAnomalyMonitorArrayOutputWithContext(context.Background()) 272 } 273 274 func (i AnomalyMonitorArray) ToAnomalyMonitorArrayOutputWithContext(ctx context.Context) AnomalyMonitorArrayOutput { 275 return pulumi.ToOutputWithContext(ctx, i).(AnomalyMonitorArrayOutput) 276 } 277 278 // AnomalyMonitorMapInput is an input type that accepts AnomalyMonitorMap and AnomalyMonitorMapOutput values. 279 // You can construct a concrete instance of `AnomalyMonitorMapInput` via: 280 // 281 // AnomalyMonitorMap{ "key": AnomalyMonitorArgs{...} } 282 type AnomalyMonitorMapInput interface { 283 pulumi.Input 284 285 ToAnomalyMonitorMapOutput() AnomalyMonitorMapOutput 286 ToAnomalyMonitorMapOutputWithContext(context.Context) AnomalyMonitorMapOutput 287 } 288 289 type AnomalyMonitorMap map[string]AnomalyMonitorInput 290 291 func (AnomalyMonitorMap) ElementType() reflect.Type { 292 return reflect.TypeOf((*map[string]*AnomalyMonitor)(nil)).Elem() 293 } 294 295 func (i AnomalyMonitorMap) ToAnomalyMonitorMapOutput() AnomalyMonitorMapOutput { 296 return i.ToAnomalyMonitorMapOutputWithContext(context.Background()) 297 } 298 299 func (i AnomalyMonitorMap) ToAnomalyMonitorMapOutputWithContext(ctx context.Context) AnomalyMonitorMapOutput { 300 return pulumi.ToOutputWithContext(ctx, i).(AnomalyMonitorMapOutput) 301 } 302 303 type AnomalyMonitorOutput struct{ *pulumi.OutputState } 304 305 func (AnomalyMonitorOutput) ElementType() reflect.Type { 306 return reflect.TypeOf((**AnomalyMonitor)(nil)).Elem() 307 } 308 309 func (o AnomalyMonitorOutput) ToAnomalyMonitorOutput() AnomalyMonitorOutput { 310 return o 311 } 312 313 func (o AnomalyMonitorOutput) ToAnomalyMonitorOutputWithContext(ctx context.Context) AnomalyMonitorOutput { 314 return o 315 } 316 317 // ARN of the anomaly monitor. 318 func (o AnomalyMonitorOutput) Arn() pulumi.StringOutput { 319 return o.ApplyT(func(v *AnomalyMonitor) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 320 } 321 322 // The dimensions to evaluate. Valid values: `SERVICE`. 323 func (o AnomalyMonitorOutput) MonitorDimension() pulumi.StringPtrOutput { 324 return o.ApplyT(func(v *AnomalyMonitor) pulumi.StringPtrOutput { return v.MonitorDimension }).(pulumi.StringPtrOutput) 325 } 326 327 // A valid JSON representation for the [Expression](https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_Expression.html) object. 328 func (o AnomalyMonitorOutput) MonitorSpecification() pulumi.StringPtrOutput { 329 return o.ApplyT(func(v *AnomalyMonitor) pulumi.StringPtrOutput { return v.MonitorSpecification }).(pulumi.StringPtrOutput) 330 } 331 332 // The possible type values. Valid values: `DIMENSIONAL` | `CUSTOM`. 333 func (o AnomalyMonitorOutput) MonitorType() pulumi.StringOutput { 334 return o.ApplyT(func(v *AnomalyMonitor) pulumi.StringOutput { return v.MonitorType }).(pulumi.StringOutput) 335 } 336 337 // The name of the monitor. 338 func (o AnomalyMonitorOutput) Name() pulumi.StringOutput { 339 return o.ApplyT(func(v *AnomalyMonitor) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 340 } 341 342 // 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. 343 func (o AnomalyMonitorOutput) Tags() pulumi.StringMapOutput { 344 return o.ApplyT(func(v *AnomalyMonitor) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 345 } 346 347 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 348 // 349 // Deprecated: Please use `tags` instead. 350 func (o AnomalyMonitorOutput) TagsAll() pulumi.StringMapOutput { 351 return o.ApplyT(func(v *AnomalyMonitor) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 352 } 353 354 type AnomalyMonitorArrayOutput struct{ *pulumi.OutputState } 355 356 func (AnomalyMonitorArrayOutput) ElementType() reflect.Type { 357 return reflect.TypeOf((*[]*AnomalyMonitor)(nil)).Elem() 358 } 359 360 func (o AnomalyMonitorArrayOutput) ToAnomalyMonitorArrayOutput() AnomalyMonitorArrayOutput { 361 return o 362 } 363 364 func (o AnomalyMonitorArrayOutput) ToAnomalyMonitorArrayOutputWithContext(ctx context.Context) AnomalyMonitorArrayOutput { 365 return o 366 } 367 368 func (o AnomalyMonitorArrayOutput) Index(i pulumi.IntInput) AnomalyMonitorOutput { 369 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *AnomalyMonitor { 370 return vs[0].([]*AnomalyMonitor)[vs[1].(int)] 371 }).(AnomalyMonitorOutput) 372 } 373 374 type AnomalyMonitorMapOutput struct{ *pulumi.OutputState } 375 376 func (AnomalyMonitorMapOutput) ElementType() reflect.Type { 377 return reflect.TypeOf((*map[string]*AnomalyMonitor)(nil)).Elem() 378 } 379 380 func (o AnomalyMonitorMapOutput) ToAnomalyMonitorMapOutput() AnomalyMonitorMapOutput { 381 return o 382 } 383 384 func (o AnomalyMonitorMapOutput) ToAnomalyMonitorMapOutputWithContext(ctx context.Context) AnomalyMonitorMapOutput { 385 return o 386 } 387 388 func (o AnomalyMonitorMapOutput) MapIndex(k pulumi.StringInput) AnomalyMonitorOutput { 389 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *AnomalyMonitor { 390 return vs[0].(map[string]*AnomalyMonitor)[vs[1].(string)] 391 }).(AnomalyMonitorOutput) 392 } 393 394 func init() { 395 pulumi.RegisterInputType(reflect.TypeOf((*AnomalyMonitorInput)(nil)).Elem(), &AnomalyMonitor{}) 396 pulumi.RegisterInputType(reflect.TypeOf((*AnomalyMonitorArrayInput)(nil)).Elem(), AnomalyMonitorArray{}) 397 pulumi.RegisterInputType(reflect.TypeOf((*AnomalyMonitorMapInput)(nil)).Elem(), AnomalyMonitorMap{}) 398 pulumi.RegisterOutputType(AnomalyMonitorOutput{}) 399 pulumi.RegisterOutputType(AnomalyMonitorArrayOutput{}) 400 pulumi.RegisterOutputType(AnomalyMonitorMapOutput{}) 401 }