github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/evidently/segment.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 evidently 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 Evidently Segment resource. 16 // 17 // ## Example Usage 18 // 19 // ### Basic 20 // 21 // <!--Start PulumiCodeChooser --> 22 // ```go 23 // package main 24 // 25 // import ( 26 // 27 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/evidently" 28 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 29 // 30 // ) 31 // 32 // func main() { 33 // pulumi.Run(func(ctx *pulumi.Context) error { 34 // _, err := evidently.NewSegment(ctx, "example", &evidently.SegmentArgs{ 35 // Name: pulumi.String("example"), 36 // Pattern: pulumi.String("{\"Price\":[{\"numeric\":[\">\",10,\"<=\",20]}]}"), 37 // Tags: pulumi.StringMap{ 38 // "Key1": pulumi.String("example Segment"), 39 // }, 40 // }) 41 // if err != nil { 42 // return err 43 // } 44 // return nil 45 // }) 46 // } 47 // 48 // ``` 49 // <!--End PulumiCodeChooser --> 50 // 51 // ### With JSON object in pattern 52 // 53 // <!--Start PulumiCodeChooser --> 54 // ```go 55 // package main 56 // 57 // import ( 58 // 59 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/evidently" 60 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 61 // 62 // ) 63 // 64 // func main() { 65 // pulumi.Run(func(ctx *pulumi.Context) error { 66 // _, err := evidently.NewSegment(ctx, "example", &evidently.SegmentArgs{ 67 // Name: pulumi.String("example"), 68 // Pattern: pulumi.String(` { 69 // "Price": [ 70 // { 71 // "numeric": [">",10,"<=",20] 72 // } 73 // ] 74 // } 75 // 76 // `), 77 // 78 // Tags: pulumi.StringMap{ 79 // "Key1": pulumi.String("example Segment"), 80 // }, 81 // }) 82 // if err != nil { 83 // return err 84 // } 85 // return nil 86 // }) 87 // } 88 // 89 // ``` 90 // <!--End PulumiCodeChooser --> 91 // 92 // ### With Description 93 // 94 // <!--Start PulumiCodeChooser --> 95 // ```go 96 // package main 97 // 98 // import ( 99 // 100 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/evidently" 101 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 102 // 103 // ) 104 // 105 // func main() { 106 // pulumi.Run(func(ctx *pulumi.Context) error { 107 // _, err := evidently.NewSegment(ctx, "example", &evidently.SegmentArgs{ 108 // Name: pulumi.String("example"), 109 // Pattern: pulumi.String("{\"Price\":[{\"numeric\":[\">\",10,\"<=\",20]}]}"), 110 // Description: pulumi.String("example"), 111 // }) 112 // if err != nil { 113 // return err 114 // } 115 // return nil 116 // }) 117 // } 118 // 119 // ``` 120 // <!--End PulumiCodeChooser --> 121 // 122 // ## Import 123 // 124 // Using `pulumi import`, import CloudWatch Evidently Segment using the `arn`. For example: 125 // 126 // ```sh 127 // $ pulumi import aws:evidently/segment:Segment example arn:aws:evidently:us-west-2:123456789012:segment/example 128 // ``` 129 type Segment struct { 130 pulumi.CustomResourceState 131 132 // The ARN of the segment. 133 Arn pulumi.StringOutput `pulumi:"arn"` 134 // The date and time that the segment is created. 135 CreatedTime pulumi.StringOutput `pulumi:"createdTime"` 136 // Specifies the description of the segment. 137 Description pulumi.StringPtrOutput `pulumi:"description"` 138 // The number of experiments that this segment is used in. This count includes all current experiments, not just those that are currently running. 139 ExperimentCount pulumi.IntOutput `pulumi:"experimentCount"` 140 // The date and time that this segment was most recently updated. 141 LastUpdatedTime pulumi.StringOutput `pulumi:"lastUpdatedTime"` 142 // The number of launches that this segment is used in. This count includes all current launches, not just those that are currently running. 143 LaunchCount pulumi.IntOutput `pulumi:"launchCount"` 144 // A name for the segment. 145 Name pulumi.StringOutput `pulumi:"name"` 146 // The pattern to use for the segment. For more information about pattern syntax, see [Segment rule pattern syntax](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Evidently-segments.html#CloudWatch-Evidently-segments-syntax.html). 147 Pattern pulumi.StringOutput `pulumi:"pattern"` 148 // Tags to apply to the segment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 149 Tags pulumi.StringMapOutput `pulumi:"tags"` 150 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 151 // 152 // Deprecated: Please use `tags` instead. 153 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 154 } 155 156 // NewSegment registers a new resource with the given unique name, arguments, and options. 157 func NewSegment(ctx *pulumi.Context, 158 name string, args *SegmentArgs, opts ...pulumi.ResourceOption) (*Segment, error) { 159 if args == nil { 160 return nil, errors.New("missing one or more required arguments") 161 } 162 163 if args.Pattern == nil { 164 return nil, errors.New("invalid value for required argument 'Pattern'") 165 } 166 opts = internal.PkgResourceDefaultOpts(opts) 167 var resource Segment 168 err := ctx.RegisterResource("aws:evidently/segment:Segment", name, args, &resource, opts...) 169 if err != nil { 170 return nil, err 171 } 172 return &resource, nil 173 } 174 175 // GetSegment gets an existing Segment resource's state with the given name, ID, and optional 176 // state properties that are used to uniquely qualify the lookup (nil if not required). 177 func GetSegment(ctx *pulumi.Context, 178 name string, id pulumi.IDInput, state *SegmentState, opts ...pulumi.ResourceOption) (*Segment, error) { 179 var resource Segment 180 err := ctx.ReadResource("aws:evidently/segment:Segment", name, id, state, &resource, opts...) 181 if err != nil { 182 return nil, err 183 } 184 return &resource, nil 185 } 186 187 // Input properties used for looking up and filtering Segment resources. 188 type segmentState struct { 189 // The ARN of the segment. 190 Arn *string `pulumi:"arn"` 191 // The date and time that the segment is created. 192 CreatedTime *string `pulumi:"createdTime"` 193 // Specifies the description of the segment. 194 Description *string `pulumi:"description"` 195 // The number of experiments that this segment is used in. This count includes all current experiments, not just those that are currently running. 196 ExperimentCount *int `pulumi:"experimentCount"` 197 // The date and time that this segment was most recently updated. 198 LastUpdatedTime *string `pulumi:"lastUpdatedTime"` 199 // The number of launches that this segment is used in. This count includes all current launches, not just those that are currently running. 200 LaunchCount *int `pulumi:"launchCount"` 201 // A name for the segment. 202 Name *string `pulumi:"name"` 203 // The pattern to use for the segment. For more information about pattern syntax, see [Segment rule pattern syntax](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Evidently-segments.html#CloudWatch-Evidently-segments-syntax.html). 204 Pattern *string `pulumi:"pattern"` 205 // Tags to apply to the segment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 206 Tags map[string]string `pulumi:"tags"` 207 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 208 // 209 // Deprecated: Please use `tags` instead. 210 TagsAll map[string]string `pulumi:"tagsAll"` 211 } 212 213 type SegmentState struct { 214 // The ARN of the segment. 215 Arn pulumi.StringPtrInput 216 // The date and time that the segment is created. 217 CreatedTime pulumi.StringPtrInput 218 // Specifies the description of the segment. 219 Description pulumi.StringPtrInput 220 // The number of experiments that this segment is used in. This count includes all current experiments, not just those that are currently running. 221 ExperimentCount pulumi.IntPtrInput 222 // The date and time that this segment was most recently updated. 223 LastUpdatedTime pulumi.StringPtrInput 224 // The number of launches that this segment is used in. This count includes all current launches, not just those that are currently running. 225 LaunchCount pulumi.IntPtrInput 226 // A name for the segment. 227 Name pulumi.StringPtrInput 228 // The pattern to use for the segment. For more information about pattern syntax, see [Segment rule pattern syntax](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Evidently-segments.html#CloudWatch-Evidently-segments-syntax.html). 229 Pattern pulumi.StringPtrInput 230 // Tags to apply to the segment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 231 Tags pulumi.StringMapInput 232 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 233 // 234 // Deprecated: Please use `tags` instead. 235 TagsAll pulumi.StringMapInput 236 } 237 238 func (SegmentState) ElementType() reflect.Type { 239 return reflect.TypeOf((*segmentState)(nil)).Elem() 240 } 241 242 type segmentArgs struct { 243 // Specifies the description of the segment. 244 Description *string `pulumi:"description"` 245 // A name for the segment. 246 Name *string `pulumi:"name"` 247 // The pattern to use for the segment. For more information about pattern syntax, see [Segment rule pattern syntax](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Evidently-segments.html#CloudWatch-Evidently-segments-syntax.html). 248 Pattern string `pulumi:"pattern"` 249 // Tags to apply to the segment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 250 Tags map[string]string `pulumi:"tags"` 251 } 252 253 // The set of arguments for constructing a Segment resource. 254 type SegmentArgs struct { 255 // Specifies the description of the segment. 256 Description pulumi.StringPtrInput 257 // A name for the segment. 258 Name pulumi.StringPtrInput 259 // The pattern to use for the segment. For more information about pattern syntax, see [Segment rule pattern syntax](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Evidently-segments.html#CloudWatch-Evidently-segments-syntax.html). 260 Pattern pulumi.StringInput 261 // Tags to apply to the segment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 262 Tags pulumi.StringMapInput 263 } 264 265 func (SegmentArgs) ElementType() reflect.Type { 266 return reflect.TypeOf((*segmentArgs)(nil)).Elem() 267 } 268 269 type SegmentInput interface { 270 pulumi.Input 271 272 ToSegmentOutput() SegmentOutput 273 ToSegmentOutputWithContext(ctx context.Context) SegmentOutput 274 } 275 276 func (*Segment) ElementType() reflect.Type { 277 return reflect.TypeOf((**Segment)(nil)).Elem() 278 } 279 280 func (i *Segment) ToSegmentOutput() SegmentOutput { 281 return i.ToSegmentOutputWithContext(context.Background()) 282 } 283 284 func (i *Segment) ToSegmentOutputWithContext(ctx context.Context) SegmentOutput { 285 return pulumi.ToOutputWithContext(ctx, i).(SegmentOutput) 286 } 287 288 // SegmentArrayInput is an input type that accepts SegmentArray and SegmentArrayOutput values. 289 // You can construct a concrete instance of `SegmentArrayInput` via: 290 // 291 // SegmentArray{ SegmentArgs{...} } 292 type SegmentArrayInput interface { 293 pulumi.Input 294 295 ToSegmentArrayOutput() SegmentArrayOutput 296 ToSegmentArrayOutputWithContext(context.Context) SegmentArrayOutput 297 } 298 299 type SegmentArray []SegmentInput 300 301 func (SegmentArray) ElementType() reflect.Type { 302 return reflect.TypeOf((*[]*Segment)(nil)).Elem() 303 } 304 305 func (i SegmentArray) ToSegmentArrayOutput() SegmentArrayOutput { 306 return i.ToSegmentArrayOutputWithContext(context.Background()) 307 } 308 309 func (i SegmentArray) ToSegmentArrayOutputWithContext(ctx context.Context) SegmentArrayOutput { 310 return pulumi.ToOutputWithContext(ctx, i).(SegmentArrayOutput) 311 } 312 313 // SegmentMapInput is an input type that accepts SegmentMap and SegmentMapOutput values. 314 // You can construct a concrete instance of `SegmentMapInput` via: 315 // 316 // SegmentMap{ "key": SegmentArgs{...} } 317 type SegmentMapInput interface { 318 pulumi.Input 319 320 ToSegmentMapOutput() SegmentMapOutput 321 ToSegmentMapOutputWithContext(context.Context) SegmentMapOutput 322 } 323 324 type SegmentMap map[string]SegmentInput 325 326 func (SegmentMap) ElementType() reflect.Type { 327 return reflect.TypeOf((*map[string]*Segment)(nil)).Elem() 328 } 329 330 func (i SegmentMap) ToSegmentMapOutput() SegmentMapOutput { 331 return i.ToSegmentMapOutputWithContext(context.Background()) 332 } 333 334 func (i SegmentMap) ToSegmentMapOutputWithContext(ctx context.Context) SegmentMapOutput { 335 return pulumi.ToOutputWithContext(ctx, i).(SegmentMapOutput) 336 } 337 338 type SegmentOutput struct{ *pulumi.OutputState } 339 340 func (SegmentOutput) ElementType() reflect.Type { 341 return reflect.TypeOf((**Segment)(nil)).Elem() 342 } 343 344 func (o SegmentOutput) ToSegmentOutput() SegmentOutput { 345 return o 346 } 347 348 func (o SegmentOutput) ToSegmentOutputWithContext(ctx context.Context) SegmentOutput { 349 return o 350 } 351 352 // The ARN of the segment. 353 func (o SegmentOutput) Arn() pulumi.StringOutput { 354 return o.ApplyT(func(v *Segment) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 355 } 356 357 // The date and time that the segment is created. 358 func (o SegmentOutput) CreatedTime() pulumi.StringOutput { 359 return o.ApplyT(func(v *Segment) pulumi.StringOutput { return v.CreatedTime }).(pulumi.StringOutput) 360 } 361 362 // Specifies the description of the segment. 363 func (o SegmentOutput) Description() pulumi.StringPtrOutput { 364 return o.ApplyT(func(v *Segment) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput) 365 } 366 367 // The number of experiments that this segment is used in. This count includes all current experiments, not just those that are currently running. 368 func (o SegmentOutput) ExperimentCount() pulumi.IntOutput { 369 return o.ApplyT(func(v *Segment) pulumi.IntOutput { return v.ExperimentCount }).(pulumi.IntOutput) 370 } 371 372 // The date and time that this segment was most recently updated. 373 func (o SegmentOutput) LastUpdatedTime() pulumi.StringOutput { 374 return o.ApplyT(func(v *Segment) pulumi.StringOutput { return v.LastUpdatedTime }).(pulumi.StringOutput) 375 } 376 377 // The number of launches that this segment is used in. This count includes all current launches, not just those that are currently running. 378 func (o SegmentOutput) LaunchCount() pulumi.IntOutput { 379 return o.ApplyT(func(v *Segment) pulumi.IntOutput { return v.LaunchCount }).(pulumi.IntOutput) 380 } 381 382 // A name for the segment. 383 func (o SegmentOutput) Name() pulumi.StringOutput { 384 return o.ApplyT(func(v *Segment) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 385 } 386 387 // The pattern to use for the segment. For more information about pattern syntax, see [Segment rule pattern syntax](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Evidently-segments.html#CloudWatch-Evidently-segments-syntax.html). 388 func (o SegmentOutput) Pattern() pulumi.StringOutput { 389 return o.ApplyT(func(v *Segment) pulumi.StringOutput { return v.Pattern }).(pulumi.StringOutput) 390 } 391 392 // Tags to apply to the segment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 393 func (o SegmentOutput) Tags() pulumi.StringMapOutput { 394 return o.ApplyT(func(v *Segment) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 395 } 396 397 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 398 // 399 // Deprecated: Please use `tags` instead. 400 func (o SegmentOutput) TagsAll() pulumi.StringMapOutput { 401 return o.ApplyT(func(v *Segment) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 402 } 403 404 type SegmentArrayOutput struct{ *pulumi.OutputState } 405 406 func (SegmentArrayOutput) ElementType() reflect.Type { 407 return reflect.TypeOf((*[]*Segment)(nil)).Elem() 408 } 409 410 func (o SegmentArrayOutput) ToSegmentArrayOutput() SegmentArrayOutput { 411 return o 412 } 413 414 func (o SegmentArrayOutput) ToSegmentArrayOutputWithContext(ctx context.Context) SegmentArrayOutput { 415 return o 416 } 417 418 func (o SegmentArrayOutput) Index(i pulumi.IntInput) SegmentOutput { 419 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Segment { 420 return vs[0].([]*Segment)[vs[1].(int)] 421 }).(SegmentOutput) 422 } 423 424 type SegmentMapOutput struct{ *pulumi.OutputState } 425 426 func (SegmentMapOutput) ElementType() reflect.Type { 427 return reflect.TypeOf((*map[string]*Segment)(nil)).Elem() 428 } 429 430 func (o SegmentMapOutput) ToSegmentMapOutput() SegmentMapOutput { 431 return o 432 } 433 434 func (o SegmentMapOutput) ToSegmentMapOutputWithContext(ctx context.Context) SegmentMapOutput { 435 return o 436 } 437 438 func (o SegmentMapOutput) MapIndex(k pulumi.StringInput) SegmentOutput { 439 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Segment { 440 return vs[0].(map[string]*Segment)[vs[1].(string)] 441 }).(SegmentOutput) 442 } 443 444 func init() { 445 pulumi.RegisterInputType(reflect.TypeOf((*SegmentInput)(nil)).Elem(), &Segment{}) 446 pulumi.RegisterInputType(reflect.TypeOf((*SegmentArrayInput)(nil)).Elem(), SegmentArray{}) 447 pulumi.RegisterInputType(reflect.TypeOf((*SegmentMapInput)(nil)).Elem(), SegmentMap{}) 448 pulumi.RegisterOutputType(SegmentOutput{}) 449 pulumi.RegisterOutputType(SegmentArrayOutput{}) 450 pulumi.RegisterOutputType(SegmentMapOutput{}) 451 }