github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ssmcontacts/plan.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 ssmcontacts 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 // Resource for managing an AWS SSM Contact Plan. 16 // 17 // ## Example Usage 18 // 19 // ### Basic Usage 20 // 21 // <!--Start PulumiCodeChooser --> 22 // ```go 23 // package main 24 // 25 // import ( 26 // 27 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssmcontacts" 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 := ssmcontacts.NewPlan(ctx, "example", &ssmcontacts.PlanArgs{ 35 // ContactId: pulumi.String("arn:aws:ssm-contacts:us-west-2:123456789012:contact/contactalias"), 36 // Stages: ssmcontacts.PlanStageArray{ 37 // &ssmcontacts.PlanStageArgs{ 38 // DurationInMinutes: pulumi.Int(1), 39 // }, 40 // }, 41 // }) 42 // if err != nil { 43 // return err 44 // } 45 // return nil 46 // }) 47 // } 48 // 49 // ``` 50 // <!--End PulumiCodeChooser --> 51 // 52 // ### Usage with SSM Contact 53 // 54 // <!--Start PulumiCodeChooser --> 55 // ```go 56 // package main 57 // 58 // import ( 59 // 60 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssmcontacts" 61 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 62 // 63 // ) 64 // 65 // func main() { 66 // pulumi.Run(func(ctx *pulumi.Context) error { 67 // contact, err := ssmcontacts.NewContact(ctx, "contact", &ssmcontacts.ContactArgs{ 68 // Alias: pulumi.String("alias"), 69 // Type: pulumi.String("PERSONAL"), 70 // }) 71 // if err != nil { 72 // return err 73 // } 74 // _, err = ssmcontacts.NewPlan(ctx, "plan", &ssmcontacts.PlanArgs{ 75 // ContactId: contact.Arn, 76 // Stages: ssmcontacts.PlanStageArray{ 77 // &ssmcontacts.PlanStageArgs{ 78 // DurationInMinutes: pulumi.Int(1), 79 // }, 80 // }, 81 // }) 82 // if err != nil { 83 // return err 84 // } 85 // return nil 86 // }) 87 // } 88 // 89 // ``` 90 // <!--End PulumiCodeChooser --> 91 // 92 // ### Usage With All Fields 93 // 94 // <!--Start PulumiCodeChooser --> 95 // ```go 96 // package main 97 // 98 // import ( 99 // 100 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssmcontacts" 101 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 102 // 103 // ) 104 // 105 // func main() { 106 // pulumi.Run(func(ctx *pulumi.Context) error { 107 // escalationPlan, err := ssmcontacts.NewContact(ctx, "escalation_plan", &ssmcontacts.ContactArgs{ 108 // Alias: pulumi.String("escalation-plan-alias"), 109 // Type: pulumi.String("ESCALATION"), 110 // }) 111 // if err != nil { 112 // return err 113 // } 114 // contactOne, err := ssmcontacts.NewContact(ctx, "contact_one", &ssmcontacts.ContactArgs{ 115 // Alias: pulumi.String("alias"), 116 // Type: pulumi.String("PERSONAL"), 117 // }) 118 // if err != nil { 119 // return err 120 // } 121 // contactTwo, err := ssmcontacts.NewContact(ctx, "contact_two", &ssmcontacts.ContactArgs{ 122 // Alias: pulumi.String("alias"), 123 // Type: pulumi.String("PERSONAL"), 124 // }) 125 // if err != nil { 126 // return err 127 // } 128 // _, err = ssmcontacts.NewPlan(ctx, "test", &ssmcontacts.PlanArgs{ 129 // ContactId: escalationPlan.Arn, 130 // Stages: ssmcontacts.PlanStageArray{ 131 // &ssmcontacts.PlanStageArgs{ 132 // DurationInMinutes: pulumi.Int(0), 133 // Targets: ssmcontacts.PlanStageTargetArray{ 134 // &ssmcontacts.PlanStageTargetArgs{ 135 // ContactTargetInfo: &ssmcontacts.PlanStageTargetContactTargetInfoArgs{ 136 // IsEssential: pulumi.Bool(false), 137 // ContactId: contactOne.Arn, 138 // }, 139 // }, 140 // &ssmcontacts.PlanStageTargetArgs{ 141 // ContactTargetInfo: &ssmcontacts.PlanStageTargetContactTargetInfoArgs{ 142 // IsEssential: pulumi.Bool(true), 143 // ContactId: contactTwo.Arn, 144 // }, 145 // }, 146 // &ssmcontacts.PlanStageTargetArgs{ 147 // ChannelTargetInfo: &ssmcontacts.PlanStageTargetChannelTargetInfoArgs{ 148 // RetryIntervalInMinutes: pulumi.Int(2), 149 // ContactChannelId: pulumi.Any(channel.Arn), 150 // }, 151 // }, 152 // }, 153 // }, 154 // }, 155 // }) 156 // if err != nil { 157 // return err 158 // } 159 // return nil 160 // }) 161 // } 162 // 163 // ``` 164 // <!--End PulumiCodeChooser --> 165 // 166 // ## Import 167 // 168 // Using `pulumi import`, import SSM Contact Plan using the Contact ARN. For example: 169 // 170 // ```sh 171 // $ pulumi import aws:ssmcontacts/plan:Plan example {ARNValue} 172 // ``` 173 type Plan struct { 174 pulumi.CustomResourceState 175 176 // The Amazon Resource Name (ARN) of the contact or escalation plan. 177 ContactId pulumi.StringOutput `pulumi:"contactId"` 178 // One or more configuration blocks for specifying a list of stages that the escalation plan or engagement plan uses to engage contacts and contact methods. See Stage below for more details. 179 Stages PlanStageArrayOutput `pulumi:"stages"` 180 } 181 182 // NewPlan registers a new resource with the given unique name, arguments, and options. 183 func NewPlan(ctx *pulumi.Context, 184 name string, args *PlanArgs, opts ...pulumi.ResourceOption) (*Plan, error) { 185 if args == nil { 186 return nil, errors.New("missing one or more required arguments") 187 } 188 189 if args.ContactId == nil { 190 return nil, errors.New("invalid value for required argument 'ContactId'") 191 } 192 if args.Stages == nil { 193 return nil, errors.New("invalid value for required argument 'Stages'") 194 } 195 opts = internal.PkgResourceDefaultOpts(opts) 196 var resource Plan 197 err := ctx.RegisterResource("aws:ssmcontacts/plan:Plan", name, args, &resource, opts...) 198 if err != nil { 199 return nil, err 200 } 201 return &resource, nil 202 } 203 204 // GetPlan gets an existing Plan resource's state with the given name, ID, and optional 205 // state properties that are used to uniquely qualify the lookup (nil if not required). 206 func GetPlan(ctx *pulumi.Context, 207 name string, id pulumi.IDInput, state *PlanState, opts ...pulumi.ResourceOption) (*Plan, error) { 208 var resource Plan 209 err := ctx.ReadResource("aws:ssmcontacts/plan:Plan", name, id, state, &resource, opts...) 210 if err != nil { 211 return nil, err 212 } 213 return &resource, nil 214 } 215 216 // Input properties used for looking up and filtering Plan resources. 217 type planState struct { 218 // The Amazon Resource Name (ARN) of the contact or escalation plan. 219 ContactId *string `pulumi:"contactId"` 220 // One or more configuration blocks for specifying a list of stages that the escalation plan or engagement plan uses to engage contacts and contact methods. See Stage below for more details. 221 Stages []PlanStage `pulumi:"stages"` 222 } 223 224 type PlanState struct { 225 // The Amazon Resource Name (ARN) of the contact or escalation plan. 226 ContactId pulumi.StringPtrInput 227 // One or more configuration blocks for specifying a list of stages that the escalation plan or engagement plan uses to engage contacts and contact methods. See Stage below for more details. 228 Stages PlanStageArrayInput 229 } 230 231 func (PlanState) ElementType() reflect.Type { 232 return reflect.TypeOf((*planState)(nil)).Elem() 233 } 234 235 type planArgs struct { 236 // The Amazon Resource Name (ARN) of the contact or escalation plan. 237 ContactId string `pulumi:"contactId"` 238 // One or more configuration blocks for specifying a list of stages that the escalation plan or engagement plan uses to engage contacts and contact methods. See Stage below for more details. 239 Stages []PlanStage `pulumi:"stages"` 240 } 241 242 // The set of arguments for constructing a Plan resource. 243 type PlanArgs struct { 244 // The Amazon Resource Name (ARN) of the contact or escalation plan. 245 ContactId pulumi.StringInput 246 // One or more configuration blocks for specifying a list of stages that the escalation plan or engagement plan uses to engage contacts and contact methods. See Stage below for more details. 247 Stages PlanStageArrayInput 248 } 249 250 func (PlanArgs) ElementType() reflect.Type { 251 return reflect.TypeOf((*planArgs)(nil)).Elem() 252 } 253 254 type PlanInput interface { 255 pulumi.Input 256 257 ToPlanOutput() PlanOutput 258 ToPlanOutputWithContext(ctx context.Context) PlanOutput 259 } 260 261 func (*Plan) ElementType() reflect.Type { 262 return reflect.TypeOf((**Plan)(nil)).Elem() 263 } 264 265 func (i *Plan) ToPlanOutput() PlanOutput { 266 return i.ToPlanOutputWithContext(context.Background()) 267 } 268 269 func (i *Plan) ToPlanOutputWithContext(ctx context.Context) PlanOutput { 270 return pulumi.ToOutputWithContext(ctx, i).(PlanOutput) 271 } 272 273 // PlanArrayInput is an input type that accepts PlanArray and PlanArrayOutput values. 274 // You can construct a concrete instance of `PlanArrayInput` via: 275 // 276 // PlanArray{ PlanArgs{...} } 277 type PlanArrayInput interface { 278 pulumi.Input 279 280 ToPlanArrayOutput() PlanArrayOutput 281 ToPlanArrayOutputWithContext(context.Context) PlanArrayOutput 282 } 283 284 type PlanArray []PlanInput 285 286 func (PlanArray) ElementType() reflect.Type { 287 return reflect.TypeOf((*[]*Plan)(nil)).Elem() 288 } 289 290 func (i PlanArray) ToPlanArrayOutput() PlanArrayOutput { 291 return i.ToPlanArrayOutputWithContext(context.Background()) 292 } 293 294 func (i PlanArray) ToPlanArrayOutputWithContext(ctx context.Context) PlanArrayOutput { 295 return pulumi.ToOutputWithContext(ctx, i).(PlanArrayOutput) 296 } 297 298 // PlanMapInput is an input type that accepts PlanMap and PlanMapOutput values. 299 // You can construct a concrete instance of `PlanMapInput` via: 300 // 301 // PlanMap{ "key": PlanArgs{...} } 302 type PlanMapInput interface { 303 pulumi.Input 304 305 ToPlanMapOutput() PlanMapOutput 306 ToPlanMapOutputWithContext(context.Context) PlanMapOutput 307 } 308 309 type PlanMap map[string]PlanInput 310 311 func (PlanMap) ElementType() reflect.Type { 312 return reflect.TypeOf((*map[string]*Plan)(nil)).Elem() 313 } 314 315 func (i PlanMap) ToPlanMapOutput() PlanMapOutput { 316 return i.ToPlanMapOutputWithContext(context.Background()) 317 } 318 319 func (i PlanMap) ToPlanMapOutputWithContext(ctx context.Context) PlanMapOutput { 320 return pulumi.ToOutputWithContext(ctx, i).(PlanMapOutput) 321 } 322 323 type PlanOutput struct{ *pulumi.OutputState } 324 325 func (PlanOutput) ElementType() reflect.Type { 326 return reflect.TypeOf((**Plan)(nil)).Elem() 327 } 328 329 func (o PlanOutput) ToPlanOutput() PlanOutput { 330 return o 331 } 332 333 func (o PlanOutput) ToPlanOutputWithContext(ctx context.Context) PlanOutput { 334 return o 335 } 336 337 // The Amazon Resource Name (ARN) of the contact or escalation plan. 338 func (o PlanOutput) ContactId() pulumi.StringOutput { 339 return o.ApplyT(func(v *Plan) pulumi.StringOutput { return v.ContactId }).(pulumi.StringOutput) 340 } 341 342 // One or more configuration blocks for specifying a list of stages that the escalation plan or engagement plan uses to engage contacts and contact methods. See Stage below for more details. 343 func (o PlanOutput) Stages() PlanStageArrayOutput { 344 return o.ApplyT(func(v *Plan) PlanStageArrayOutput { return v.Stages }).(PlanStageArrayOutput) 345 } 346 347 type PlanArrayOutput struct{ *pulumi.OutputState } 348 349 func (PlanArrayOutput) ElementType() reflect.Type { 350 return reflect.TypeOf((*[]*Plan)(nil)).Elem() 351 } 352 353 func (o PlanArrayOutput) ToPlanArrayOutput() PlanArrayOutput { 354 return o 355 } 356 357 func (o PlanArrayOutput) ToPlanArrayOutputWithContext(ctx context.Context) PlanArrayOutput { 358 return o 359 } 360 361 func (o PlanArrayOutput) Index(i pulumi.IntInput) PlanOutput { 362 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Plan { 363 return vs[0].([]*Plan)[vs[1].(int)] 364 }).(PlanOutput) 365 } 366 367 type PlanMapOutput struct{ *pulumi.OutputState } 368 369 func (PlanMapOutput) ElementType() reflect.Type { 370 return reflect.TypeOf((*map[string]*Plan)(nil)).Elem() 371 } 372 373 func (o PlanMapOutput) ToPlanMapOutput() PlanMapOutput { 374 return o 375 } 376 377 func (o PlanMapOutput) ToPlanMapOutputWithContext(ctx context.Context) PlanMapOutput { 378 return o 379 } 380 381 func (o PlanMapOutput) MapIndex(k pulumi.StringInput) PlanOutput { 382 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Plan { 383 return vs[0].(map[string]*Plan)[vs[1].(string)] 384 }).(PlanOutput) 385 } 386 387 func init() { 388 pulumi.RegisterInputType(reflect.TypeOf((*PlanInput)(nil)).Elem(), &Plan{}) 389 pulumi.RegisterInputType(reflect.TypeOf((*PlanArrayInput)(nil)).Elem(), PlanArray{}) 390 pulumi.RegisterInputType(reflect.TypeOf((*PlanMapInput)(nil)).Elem(), PlanMap{}) 391 pulumi.RegisterOutputType(PlanOutput{}) 392 pulumi.RegisterOutputType(PlanArrayOutput{}) 393 pulumi.RegisterOutputType(PlanMapOutput{}) 394 }