github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/route53recoverycontrol/safetyRule.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 route53recoverycontrol 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 an AWS Route 53 Recovery Control Config Safety Rule 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/route53recoverycontrol" 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 := route53recoverycontrol.NewSafetyRule(ctx, "example", &route53recoverycontrol.SafetyRuleArgs{ 33 // AssertedControls: pulumi.StringArray{ 34 // exampleAwsRoute53recoverycontrolconfigRoutingControl.Arn, 35 // }, 36 // ControlPanelArn: pulumi.String("arn:aws:route53-recovery-control::313517334327:controlpanel/abd5fbfc052d4844a082dbf400f61da8"), 37 // Name: pulumi.String("daisyguttridge"), 38 // WaitPeriodMs: pulumi.Int(5000), 39 // RuleConfig: &route53recoverycontrol.SafetyRuleRuleConfigArgs{ 40 // Inverted: pulumi.Bool(false), 41 // Threshold: pulumi.Int(1), 42 // Type: pulumi.String("ATLEAST"), 43 // }, 44 // }) 45 // if err != nil { 46 // return err 47 // } 48 // return nil 49 // }) 50 // } 51 // 52 // ``` 53 // <!--End PulumiCodeChooser --> 54 // 55 // <!--Start PulumiCodeChooser --> 56 // ```go 57 // package main 58 // 59 // import ( 60 // 61 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53recoverycontrol" 62 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 63 // 64 // ) 65 // 66 // func main() { 67 // pulumi.Run(func(ctx *pulumi.Context) error { 68 // _, err := route53recoverycontrol.NewSafetyRule(ctx, "example", &route53recoverycontrol.SafetyRuleArgs{ 69 // Name: pulumi.String("i_o"), 70 // ControlPanelArn: pulumi.String("arn:aws:route53-recovery-control::313517334327:controlpanel/abd5fbfc052d4844a082dbf400f61da8"), 71 // WaitPeriodMs: pulumi.Int(5000), 72 // GatingControls: pulumi.StringArray{ 73 // exampleAwsRoute53recoverycontrolconfigRoutingControl.Arn, 74 // }, 75 // TargetControls: pulumi.StringArray{ 76 // exampleAwsRoute53recoverycontrolconfigRoutingControl.Arn, 77 // }, 78 // RuleConfig: &route53recoverycontrol.SafetyRuleRuleConfigArgs{ 79 // Inverted: pulumi.Bool(false), 80 // Threshold: pulumi.Int(1), 81 // Type: pulumi.String("ATLEAST"), 82 // }, 83 // }) 84 // if err != nil { 85 // return err 86 // } 87 // return nil 88 // }) 89 // } 90 // 91 // ``` 92 // <!--End PulumiCodeChooser --> 93 // 94 // ## Import 95 // 96 // Using `pulumi import`, import Route53 Recovery Control Config Safety Rule using the safety rule ARN. For example: 97 // 98 // ```sh 99 // $ pulumi import aws:route53recoverycontrol/safetyRule:SafetyRule myrule arn:aws:route53-recovery-control::313517334327:controlpanel/1bfba17df8684f5dab0467b71424f7e8/safetyrule/3bacc77003364c0f 100 // ``` 101 type SafetyRule struct { 102 pulumi.CustomResourceState 103 104 // ARN of the safety rule. 105 Arn pulumi.StringOutput `pulumi:"arn"` 106 // Routing controls that are part of transactions that are evaluated to determine if a request to change a routing control state is allowed. 107 AssertedControls pulumi.StringArrayOutput `pulumi:"assertedControls"` 108 // ARN of the control panel in which this safety rule will reside. 109 ControlPanelArn pulumi.StringOutput `pulumi:"controlPanelArn"` 110 // Gating controls for the new gating rule. That is, routing controls that are evaluated by the rule configuration that you specify. 111 GatingControls pulumi.StringArrayOutput `pulumi:"gatingControls"` 112 // Name describing the safety rule. 113 Name pulumi.StringOutput `pulumi:"name"` 114 // Configuration block for safety rule criteria. See below. 115 RuleConfig SafetyRuleRuleConfigOutput `pulumi:"ruleConfig"` 116 // Status of the safety rule. `PENDING` when it is being created/updated, `PENDING_DELETION` when it is being deleted, and `DEPLOYED` otherwise. 117 Status pulumi.StringOutput `pulumi:"status"` 118 // Routing controls that can only be set or unset if the specified `ruleConfig` evaluates to true for the specified `gatingControls`. 119 TargetControls pulumi.StringArrayOutput `pulumi:"targetControls"` 120 // Evaluation period, in milliseconds (ms), during which any request against the target routing controls will fail. 121 // 122 // The following arguments are optional: 123 WaitPeriodMs pulumi.IntOutput `pulumi:"waitPeriodMs"` 124 } 125 126 // NewSafetyRule registers a new resource with the given unique name, arguments, and options. 127 func NewSafetyRule(ctx *pulumi.Context, 128 name string, args *SafetyRuleArgs, opts ...pulumi.ResourceOption) (*SafetyRule, error) { 129 if args == nil { 130 return nil, errors.New("missing one or more required arguments") 131 } 132 133 if args.ControlPanelArn == nil { 134 return nil, errors.New("invalid value for required argument 'ControlPanelArn'") 135 } 136 if args.RuleConfig == nil { 137 return nil, errors.New("invalid value for required argument 'RuleConfig'") 138 } 139 if args.WaitPeriodMs == nil { 140 return nil, errors.New("invalid value for required argument 'WaitPeriodMs'") 141 } 142 opts = internal.PkgResourceDefaultOpts(opts) 143 var resource SafetyRule 144 err := ctx.RegisterResource("aws:route53recoverycontrol/safetyRule:SafetyRule", name, args, &resource, opts...) 145 if err != nil { 146 return nil, err 147 } 148 return &resource, nil 149 } 150 151 // GetSafetyRule gets an existing SafetyRule resource's state with the given name, ID, and optional 152 // state properties that are used to uniquely qualify the lookup (nil if not required). 153 func GetSafetyRule(ctx *pulumi.Context, 154 name string, id pulumi.IDInput, state *SafetyRuleState, opts ...pulumi.ResourceOption) (*SafetyRule, error) { 155 var resource SafetyRule 156 err := ctx.ReadResource("aws:route53recoverycontrol/safetyRule:SafetyRule", name, id, state, &resource, opts...) 157 if err != nil { 158 return nil, err 159 } 160 return &resource, nil 161 } 162 163 // Input properties used for looking up and filtering SafetyRule resources. 164 type safetyRuleState struct { 165 // ARN of the safety rule. 166 Arn *string `pulumi:"arn"` 167 // Routing controls that are part of transactions that are evaluated to determine if a request to change a routing control state is allowed. 168 AssertedControls []string `pulumi:"assertedControls"` 169 // ARN of the control panel in which this safety rule will reside. 170 ControlPanelArn *string `pulumi:"controlPanelArn"` 171 // Gating controls for the new gating rule. That is, routing controls that are evaluated by the rule configuration that you specify. 172 GatingControls []string `pulumi:"gatingControls"` 173 // Name describing the safety rule. 174 Name *string `pulumi:"name"` 175 // Configuration block for safety rule criteria. See below. 176 RuleConfig *SafetyRuleRuleConfig `pulumi:"ruleConfig"` 177 // Status of the safety rule. `PENDING` when it is being created/updated, `PENDING_DELETION` when it is being deleted, and `DEPLOYED` otherwise. 178 Status *string `pulumi:"status"` 179 // Routing controls that can only be set or unset if the specified `ruleConfig` evaluates to true for the specified `gatingControls`. 180 TargetControls []string `pulumi:"targetControls"` 181 // Evaluation period, in milliseconds (ms), during which any request against the target routing controls will fail. 182 // 183 // The following arguments are optional: 184 WaitPeriodMs *int `pulumi:"waitPeriodMs"` 185 } 186 187 type SafetyRuleState struct { 188 // ARN of the safety rule. 189 Arn pulumi.StringPtrInput 190 // Routing controls that are part of transactions that are evaluated to determine if a request to change a routing control state is allowed. 191 AssertedControls pulumi.StringArrayInput 192 // ARN of the control panel in which this safety rule will reside. 193 ControlPanelArn pulumi.StringPtrInput 194 // Gating controls for the new gating rule. That is, routing controls that are evaluated by the rule configuration that you specify. 195 GatingControls pulumi.StringArrayInput 196 // Name describing the safety rule. 197 Name pulumi.StringPtrInput 198 // Configuration block for safety rule criteria. See below. 199 RuleConfig SafetyRuleRuleConfigPtrInput 200 // Status of the safety rule. `PENDING` when it is being created/updated, `PENDING_DELETION` when it is being deleted, and `DEPLOYED` otherwise. 201 Status pulumi.StringPtrInput 202 // Routing controls that can only be set or unset if the specified `ruleConfig` evaluates to true for the specified `gatingControls`. 203 TargetControls pulumi.StringArrayInput 204 // Evaluation period, in milliseconds (ms), during which any request against the target routing controls will fail. 205 // 206 // The following arguments are optional: 207 WaitPeriodMs pulumi.IntPtrInput 208 } 209 210 func (SafetyRuleState) ElementType() reflect.Type { 211 return reflect.TypeOf((*safetyRuleState)(nil)).Elem() 212 } 213 214 type safetyRuleArgs struct { 215 // Routing controls that are part of transactions that are evaluated to determine if a request to change a routing control state is allowed. 216 AssertedControls []string `pulumi:"assertedControls"` 217 // ARN of the control panel in which this safety rule will reside. 218 ControlPanelArn string `pulumi:"controlPanelArn"` 219 // Gating controls for the new gating rule. That is, routing controls that are evaluated by the rule configuration that you specify. 220 GatingControls []string `pulumi:"gatingControls"` 221 // Name describing the safety rule. 222 Name *string `pulumi:"name"` 223 // Configuration block for safety rule criteria. See below. 224 RuleConfig SafetyRuleRuleConfig `pulumi:"ruleConfig"` 225 // Routing controls that can only be set or unset if the specified `ruleConfig` evaluates to true for the specified `gatingControls`. 226 TargetControls []string `pulumi:"targetControls"` 227 // Evaluation period, in milliseconds (ms), during which any request against the target routing controls will fail. 228 // 229 // The following arguments are optional: 230 WaitPeriodMs int `pulumi:"waitPeriodMs"` 231 } 232 233 // The set of arguments for constructing a SafetyRule resource. 234 type SafetyRuleArgs struct { 235 // Routing controls that are part of transactions that are evaluated to determine if a request to change a routing control state is allowed. 236 AssertedControls pulumi.StringArrayInput 237 // ARN of the control panel in which this safety rule will reside. 238 ControlPanelArn pulumi.StringInput 239 // Gating controls for the new gating rule. That is, routing controls that are evaluated by the rule configuration that you specify. 240 GatingControls pulumi.StringArrayInput 241 // Name describing the safety rule. 242 Name pulumi.StringPtrInput 243 // Configuration block for safety rule criteria. See below. 244 RuleConfig SafetyRuleRuleConfigInput 245 // Routing controls that can only be set or unset if the specified `ruleConfig` evaluates to true for the specified `gatingControls`. 246 TargetControls pulumi.StringArrayInput 247 // Evaluation period, in milliseconds (ms), during which any request against the target routing controls will fail. 248 // 249 // The following arguments are optional: 250 WaitPeriodMs pulumi.IntInput 251 } 252 253 func (SafetyRuleArgs) ElementType() reflect.Type { 254 return reflect.TypeOf((*safetyRuleArgs)(nil)).Elem() 255 } 256 257 type SafetyRuleInput interface { 258 pulumi.Input 259 260 ToSafetyRuleOutput() SafetyRuleOutput 261 ToSafetyRuleOutputWithContext(ctx context.Context) SafetyRuleOutput 262 } 263 264 func (*SafetyRule) ElementType() reflect.Type { 265 return reflect.TypeOf((**SafetyRule)(nil)).Elem() 266 } 267 268 func (i *SafetyRule) ToSafetyRuleOutput() SafetyRuleOutput { 269 return i.ToSafetyRuleOutputWithContext(context.Background()) 270 } 271 272 func (i *SafetyRule) ToSafetyRuleOutputWithContext(ctx context.Context) SafetyRuleOutput { 273 return pulumi.ToOutputWithContext(ctx, i).(SafetyRuleOutput) 274 } 275 276 // SafetyRuleArrayInput is an input type that accepts SafetyRuleArray and SafetyRuleArrayOutput values. 277 // You can construct a concrete instance of `SafetyRuleArrayInput` via: 278 // 279 // SafetyRuleArray{ SafetyRuleArgs{...} } 280 type SafetyRuleArrayInput interface { 281 pulumi.Input 282 283 ToSafetyRuleArrayOutput() SafetyRuleArrayOutput 284 ToSafetyRuleArrayOutputWithContext(context.Context) SafetyRuleArrayOutput 285 } 286 287 type SafetyRuleArray []SafetyRuleInput 288 289 func (SafetyRuleArray) ElementType() reflect.Type { 290 return reflect.TypeOf((*[]*SafetyRule)(nil)).Elem() 291 } 292 293 func (i SafetyRuleArray) ToSafetyRuleArrayOutput() SafetyRuleArrayOutput { 294 return i.ToSafetyRuleArrayOutputWithContext(context.Background()) 295 } 296 297 func (i SafetyRuleArray) ToSafetyRuleArrayOutputWithContext(ctx context.Context) SafetyRuleArrayOutput { 298 return pulumi.ToOutputWithContext(ctx, i).(SafetyRuleArrayOutput) 299 } 300 301 // SafetyRuleMapInput is an input type that accepts SafetyRuleMap and SafetyRuleMapOutput values. 302 // You can construct a concrete instance of `SafetyRuleMapInput` via: 303 // 304 // SafetyRuleMap{ "key": SafetyRuleArgs{...} } 305 type SafetyRuleMapInput interface { 306 pulumi.Input 307 308 ToSafetyRuleMapOutput() SafetyRuleMapOutput 309 ToSafetyRuleMapOutputWithContext(context.Context) SafetyRuleMapOutput 310 } 311 312 type SafetyRuleMap map[string]SafetyRuleInput 313 314 func (SafetyRuleMap) ElementType() reflect.Type { 315 return reflect.TypeOf((*map[string]*SafetyRule)(nil)).Elem() 316 } 317 318 func (i SafetyRuleMap) ToSafetyRuleMapOutput() SafetyRuleMapOutput { 319 return i.ToSafetyRuleMapOutputWithContext(context.Background()) 320 } 321 322 func (i SafetyRuleMap) ToSafetyRuleMapOutputWithContext(ctx context.Context) SafetyRuleMapOutput { 323 return pulumi.ToOutputWithContext(ctx, i).(SafetyRuleMapOutput) 324 } 325 326 type SafetyRuleOutput struct{ *pulumi.OutputState } 327 328 func (SafetyRuleOutput) ElementType() reflect.Type { 329 return reflect.TypeOf((**SafetyRule)(nil)).Elem() 330 } 331 332 func (o SafetyRuleOutput) ToSafetyRuleOutput() SafetyRuleOutput { 333 return o 334 } 335 336 func (o SafetyRuleOutput) ToSafetyRuleOutputWithContext(ctx context.Context) SafetyRuleOutput { 337 return o 338 } 339 340 // ARN of the safety rule. 341 func (o SafetyRuleOutput) Arn() pulumi.StringOutput { 342 return o.ApplyT(func(v *SafetyRule) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 343 } 344 345 // Routing controls that are part of transactions that are evaluated to determine if a request to change a routing control state is allowed. 346 func (o SafetyRuleOutput) AssertedControls() pulumi.StringArrayOutput { 347 return o.ApplyT(func(v *SafetyRule) pulumi.StringArrayOutput { return v.AssertedControls }).(pulumi.StringArrayOutput) 348 } 349 350 // ARN of the control panel in which this safety rule will reside. 351 func (o SafetyRuleOutput) ControlPanelArn() pulumi.StringOutput { 352 return o.ApplyT(func(v *SafetyRule) pulumi.StringOutput { return v.ControlPanelArn }).(pulumi.StringOutput) 353 } 354 355 // Gating controls for the new gating rule. That is, routing controls that are evaluated by the rule configuration that you specify. 356 func (o SafetyRuleOutput) GatingControls() pulumi.StringArrayOutput { 357 return o.ApplyT(func(v *SafetyRule) pulumi.StringArrayOutput { return v.GatingControls }).(pulumi.StringArrayOutput) 358 } 359 360 // Name describing the safety rule. 361 func (o SafetyRuleOutput) Name() pulumi.StringOutput { 362 return o.ApplyT(func(v *SafetyRule) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 363 } 364 365 // Configuration block for safety rule criteria. See below. 366 func (o SafetyRuleOutput) RuleConfig() SafetyRuleRuleConfigOutput { 367 return o.ApplyT(func(v *SafetyRule) SafetyRuleRuleConfigOutput { return v.RuleConfig }).(SafetyRuleRuleConfigOutput) 368 } 369 370 // Status of the safety rule. `PENDING` when it is being created/updated, `PENDING_DELETION` when it is being deleted, and `DEPLOYED` otherwise. 371 func (o SafetyRuleOutput) Status() pulumi.StringOutput { 372 return o.ApplyT(func(v *SafetyRule) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput) 373 } 374 375 // Routing controls that can only be set or unset if the specified `ruleConfig` evaluates to true for the specified `gatingControls`. 376 func (o SafetyRuleOutput) TargetControls() pulumi.StringArrayOutput { 377 return o.ApplyT(func(v *SafetyRule) pulumi.StringArrayOutput { return v.TargetControls }).(pulumi.StringArrayOutput) 378 } 379 380 // Evaluation period, in milliseconds (ms), during which any request against the target routing controls will fail. 381 // 382 // The following arguments are optional: 383 func (o SafetyRuleOutput) WaitPeriodMs() pulumi.IntOutput { 384 return o.ApplyT(func(v *SafetyRule) pulumi.IntOutput { return v.WaitPeriodMs }).(pulumi.IntOutput) 385 } 386 387 type SafetyRuleArrayOutput struct{ *pulumi.OutputState } 388 389 func (SafetyRuleArrayOutput) ElementType() reflect.Type { 390 return reflect.TypeOf((*[]*SafetyRule)(nil)).Elem() 391 } 392 393 func (o SafetyRuleArrayOutput) ToSafetyRuleArrayOutput() SafetyRuleArrayOutput { 394 return o 395 } 396 397 func (o SafetyRuleArrayOutput) ToSafetyRuleArrayOutputWithContext(ctx context.Context) SafetyRuleArrayOutput { 398 return o 399 } 400 401 func (o SafetyRuleArrayOutput) Index(i pulumi.IntInput) SafetyRuleOutput { 402 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *SafetyRule { 403 return vs[0].([]*SafetyRule)[vs[1].(int)] 404 }).(SafetyRuleOutput) 405 } 406 407 type SafetyRuleMapOutput struct{ *pulumi.OutputState } 408 409 func (SafetyRuleMapOutput) ElementType() reflect.Type { 410 return reflect.TypeOf((*map[string]*SafetyRule)(nil)).Elem() 411 } 412 413 func (o SafetyRuleMapOutput) ToSafetyRuleMapOutput() SafetyRuleMapOutput { 414 return o 415 } 416 417 func (o SafetyRuleMapOutput) ToSafetyRuleMapOutputWithContext(ctx context.Context) SafetyRuleMapOutput { 418 return o 419 } 420 421 func (o SafetyRuleMapOutput) MapIndex(k pulumi.StringInput) SafetyRuleOutput { 422 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *SafetyRule { 423 return vs[0].(map[string]*SafetyRule)[vs[1].(string)] 424 }).(SafetyRuleOutput) 425 } 426 427 func init() { 428 pulumi.RegisterInputType(reflect.TypeOf((*SafetyRuleInput)(nil)).Elem(), &SafetyRule{}) 429 pulumi.RegisterInputType(reflect.TypeOf((*SafetyRuleArrayInput)(nil)).Elem(), SafetyRuleArray{}) 430 pulumi.RegisterInputType(reflect.TypeOf((*SafetyRuleMapInput)(nil)).Elem(), SafetyRuleMap{}) 431 pulumi.RegisterOutputType(SafetyRuleOutput{}) 432 pulumi.RegisterOutputType(SafetyRuleArrayOutput{}) 433 pulumi.RegisterOutputType(SafetyRuleMapOutput{}) 434 }