github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/connect/phoneNumber.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 connect 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 Amazon Connect Phone Number resource. For more information see 16 // [Amazon Connect: Getting Started](https://docs.aws.amazon.com/connect/latest/adminguide/amazon-connect-get-started.html) 17 // 18 // ## Example Usage 19 // 20 // ### Basic 21 // 22 // <!--Start PulumiCodeChooser --> 23 // ```go 24 // package main 25 // 26 // import ( 27 // 28 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/connect" 29 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 30 // 31 // ) 32 // 33 // func main() { 34 // pulumi.Run(func(ctx *pulumi.Context) error { 35 // _, err := connect.NewPhoneNumber(ctx, "example", &connect.PhoneNumberArgs{ 36 // TargetArn: pulumi.Any(exampleAwsConnectInstance.Arn), 37 // CountryCode: pulumi.String("US"), 38 // Type: pulumi.String("DID"), 39 // Tags: pulumi.StringMap{ 40 // "hello": pulumi.String("world"), 41 // }, 42 // }) 43 // if err != nil { 44 // return err 45 // } 46 // return nil 47 // }) 48 // } 49 // 50 // ``` 51 // <!--End PulumiCodeChooser --> 52 // 53 // ### Description 54 // 55 // <!--Start PulumiCodeChooser --> 56 // ```go 57 // package main 58 // 59 // import ( 60 // 61 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/connect" 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 := connect.NewPhoneNumber(ctx, "example", &connect.PhoneNumberArgs{ 69 // TargetArn: pulumi.Any(exampleAwsConnectInstance.Arn), 70 // CountryCode: pulumi.String("US"), 71 // Type: pulumi.String("DID"), 72 // Description: pulumi.String("example description"), 73 // }) 74 // if err != nil { 75 // return err 76 // } 77 // return nil 78 // }) 79 // } 80 // 81 // ``` 82 // <!--End PulumiCodeChooser --> 83 // 84 // ### Prefix to filter phone numbers 85 // 86 // <!--Start PulumiCodeChooser --> 87 // ```go 88 // package main 89 // 90 // import ( 91 // 92 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/connect" 93 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 94 // 95 // ) 96 // 97 // func main() { 98 // pulumi.Run(func(ctx *pulumi.Context) error { 99 // _, err := connect.NewPhoneNumber(ctx, "example", &connect.PhoneNumberArgs{ 100 // TargetArn: pulumi.Any(exampleAwsConnectInstance.Arn), 101 // CountryCode: pulumi.String("US"), 102 // Type: pulumi.String("DID"), 103 // Prefix: pulumi.String("+18005"), 104 // }) 105 // if err != nil { 106 // return err 107 // } 108 // return nil 109 // }) 110 // } 111 // 112 // ``` 113 // <!--End PulumiCodeChooser --> 114 // 115 // ## Import 116 // 117 // Using `pulumi import`, import Amazon Connect Phone Numbers using its `id`. For example: 118 // 119 // ```sh 120 // $ pulumi import aws:connect/phoneNumber:PhoneNumber example 12345678-abcd-1234-efgh-9876543210ab 121 // ``` 122 type PhoneNumber struct { 123 pulumi.CustomResourceState 124 125 // The ARN of the phone number. 126 Arn pulumi.StringOutput `pulumi:"arn"` 127 // The ISO country code. For a list of Valid values, refer to [PhoneNumberCountryCode](https://docs.aws.amazon.com/connect/latest/APIReference/API_SearchAvailablePhoneNumbers.html#connect-SearchAvailablePhoneNumbers-request-PhoneNumberCountryCode). 128 CountryCode pulumi.StringOutput `pulumi:"countryCode"` 129 // The description of the phone number. 130 Description pulumi.StringPtrOutput `pulumi:"description"` 131 // The phone number. Phone numbers are formatted `[+] [country code] [subscriber number including area code]`. 132 PhoneNumber pulumi.StringOutput `pulumi:"phoneNumber"` 133 // The prefix of the phone number that is used to filter available phone numbers. If provided, it must contain `+` as part of the country code. Do not specify this argument when importing the resource. 134 Prefix pulumi.StringPtrOutput `pulumi:"prefix"` 135 // The status of the phone number. Valid Values: `CLAIMED` | `IN_PROGRESS` | `FAILED`. 136 Statuses PhoneNumberStatusArrayOutput `pulumi:"statuses"` 137 // Tags to apply to the Phone Number. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 138 Tags pulumi.StringMapOutput `pulumi:"tags"` 139 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 140 // 141 // Deprecated: Please use `tags` instead. 142 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 143 // The Amazon Resource Name (ARN) for Amazon Connect instances that phone numbers are claimed to. 144 TargetArn pulumi.StringOutput `pulumi:"targetArn"` 145 // The type of phone number. Valid Values: `TOLL_FREE` | `DID`. 146 Type pulumi.StringOutput `pulumi:"type"` 147 } 148 149 // NewPhoneNumber registers a new resource with the given unique name, arguments, and options. 150 func NewPhoneNumber(ctx *pulumi.Context, 151 name string, args *PhoneNumberArgs, opts ...pulumi.ResourceOption) (*PhoneNumber, error) { 152 if args == nil { 153 return nil, errors.New("missing one or more required arguments") 154 } 155 156 if args.CountryCode == nil { 157 return nil, errors.New("invalid value for required argument 'CountryCode'") 158 } 159 if args.TargetArn == nil { 160 return nil, errors.New("invalid value for required argument 'TargetArn'") 161 } 162 if args.Type == nil { 163 return nil, errors.New("invalid value for required argument 'Type'") 164 } 165 opts = internal.PkgResourceDefaultOpts(opts) 166 var resource PhoneNumber 167 err := ctx.RegisterResource("aws:connect/phoneNumber:PhoneNumber", name, args, &resource, opts...) 168 if err != nil { 169 return nil, err 170 } 171 return &resource, nil 172 } 173 174 // GetPhoneNumber gets an existing PhoneNumber resource's state with the given name, ID, and optional 175 // state properties that are used to uniquely qualify the lookup (nil if not required). 176 func GetPhoneNumber(ctx *pulumi.Context, 177 name string, id pulumi.IDInput, state *PhoneNumberState, opts ...pulumi.ResourceOption) (*PhoneNumber, error) { 178 var resource PhoneNumber 179 err := ctx.ReadResource("aws:connect/phoneNumber:PhoneNumber", name, id, state, &resource, opts...) 180 if err != nil { 181 return nil, err 182 } 183 return &resource, nil 184 } 185 186 // Input properties used for looking up and filtering PhoneNumber resources. 187 type phoneNumberState struct { 188 // The ARN of the phone number. 189 Arn *string `pulumi:"arn"` 190 // The ISO country code. For a list of Valid values, refer to [PhoneNumberCountryCode](https://docs.aws.amazon.com/connect/latest/APIReference/API_SearchAvailablePhoneNumbers.html#connect-SearchAvailablePhoneNumbers-request-PhoneNumberCountryCode). 191 CountryCode *string `pulumi:"countryCode"` 192 // The description of the phone number. 193 Description *string `pulumi:"description"` 194 // The phone number. Phone numbers are formatted `[+] [country code] [subscriber number including area code]`. 195 PhoneNumber *string `pulumi:"phoneNumber"` 196 // The prefix of the phone number that is used to filter available phone numbers. If provided, it must contain `+` as part of the country code. Do not specify this argument when importing the resource. 197 Prefix *string `pulumi:"prefix"` 198 // The status of the phone number. Valid Values: `CLAIMED` | `IN_PROGRESS` | `FAILED`. 199 Statuses []PhoneNumberStatus `pulumi:"statuses"` 200 // Tags to apply to the Phone Number. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 201 Tags map[string]string `pulumi:"tags"` 202 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 203 // 204 // Deprecated: Please use `tags` instead. 205 TagsAll map[string]string `pulumi:"tagsAll"` 206 // The Amazon Resource Name (ARN) for Amazon Connect instances that phone numbers are claimed to. 207 TargetArn *string `pulumi:"targetArn"` 208 // The type of phone number. Valid Values: `TOLL_FREE` | `DID`. 209 Type *string `pulumi:"type"` 210 } 211 212 type PhoneNumberState struct { 213 // The ARN of the phone number. 214 Arn pulumi.StringPtrInput 215 // The ISO country code. For a list of Valid values, refer to [PhoneNumberCountryCode](https://docs.aws.amazon.com/connect/latest/APIReference/API_SearchAvailablePhoneNumbers.html#connect-SearchAvailablePhoneNumbers-request-PhoneNumberCountryCode). 216 CountryCode pulumi.StringPtrInput 217 // The description of the phone number. 218 Description pulumi.StringPtrInput 219 // The phone number. Phone numbers are formatted `[+] [country code] [subscriber number including area code]`. 220 PhoneNumber pulumi.StringPtrInput 221 // The prefix of the phone number that is used to filter available phone numbers. If provided, it must contain `+` as part of the country code. Do not specify this argument when importing the resource. 222 Prefix pulumi.StringPtrInput 223 // The status of the phone number. Valid Values: `CLAIMED` | `IN_PROGRESS` | `FAILED`. 224 Statuses PhoneNumberStatusArrayInput 225 // Tags to apply to the Phone Number. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 226 Tags pulumi.StringMapInput 227 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 228 // 229 // Deprecated: Please use `tags` instead. 230 TagsAll pulumi.StringMapInput 231 // The Amazon Resource Name (ARN) for Amazon Connect instances that phone numbers are claimed to. 232 TargetArn pulumi.StringPtrInput 233 // The type of phone number. Valid Values: `TOLL_FREE` | `DID`. 234 Type pulumi.StringPtrInput 235 } 236 237 func (PhoneNumberState) ElementType() reflect.Type { 238 return reflect.TypeOf((*phoneNumberState)(nil)).Elem() 239 } 240 241 type phoneNumberArgs struct { 242 // The ISO country code. For a list of Valid values, refer to [PhoneNumberCountryCode](https://docs.aws.amazon.com/connect/latest/APIReference/API_SearchAvailablePhoneNumbers.html#connect-SearchAvailablePhoneNumbers-request-PhoneNumberCountryCode). 243 CountryCode string `pulumi:"countryCode"` 244 // The description of the phone number. 245 Description *string `pulumi:"description"` 246 // The prefix of the phone number that is used to filter available phone numbers. If provided, it must contain `+` as part of the country code. Do not specify this argument when importing the resource. 247 Prefix *string `pulumi:"prefix"` 248 // Tags to apply to the Phone Number. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 249 Tags map[string]string `pulumi:"tags"` 250 // The Amazon Resource Name (ARN) for Amazon Connect instances that phone numbers are claimed to. 251 TargetArn string `pulumi:"targetArn"` 252 // The type of phone number. Valid Values: `TOLL_FREE` | `DID`. 253 Type string `pulumi:"type"` 254 } 255 256 // The set of arguments for constructing a PhoneNumber resource. 257 type PhoneNumberArgs struct { 258 // The ISO country code. For a list of Valid values, refer to [PhoneNumberCountryCode](https://docs.aws.amazon.com/connect/latest/APIReference/API_SearchAvailablePhoneNumbers.html#connect-SearchAvailablePhoneNumbers-request-PhoneNumberCountryCode). 259 CountryCode pulumi.StringInput 260 // The description of the phone number. 261 Description pulumi.StringPtrInput 262 // The prefix of the phone number that is used to filter available phone numbers. If provided, it must contain `+` as part of the country code. Do not specify this argument when importing the resource. 263 Prefix pulumi.StringPtrInput 264 // Tags to apply to the Phone Number. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 265 Tags pulumi.StringMapInput 266 // The Amazon Resource Name (ARN) for Amazon Connect instances that phone numbers are claimed to. 267 TargetArn pulumi.StringInput 268 // The type of phone number. Valid Values: `TOLL_FREE` | `DID`. 269 Type pulumi.StringInput 270 } 271 272 func (PhoneNumberArgs) ElementType() reflect.Type { 273 return reflect.TypeOf((*phoneNumberArgs)(nil)).Elem() 274 } 275 276 type PhoneNumberInput interface { 277 pulumi.Input 278 279 ToPhoneNumberOutput() PhoneNumberOutput 280 ToPhoneNumberOutputWithContext(ctx context.Context) PhoneNumberOutput 281 } 282 283 func (*PhoneNumber) ElementType() reflect.Type { 284 return reflect.TypeOf((**PhoneNumber)(nil)).Elem() 285 } 286 287 func (i *PhoneNumber) ToPhoneNumberOutput() PhoneNumberOutput { 288 return i.ToPhoneNumberOutputWithContext(context.Background()) 289 } 290 291 func (i *PhoneNumber) ToPhoneNumberOutputWithContext(ctx context.Context) PhoneNumberOutput { 292 return pulumi.ToOutputWithContext(ctx, i).(PhoneNumberOutput) 293 } 294 295 // PhoneNumberArrayInput is an input type that accepts PhoneNumberArray and PhoneNumberArrayOutput values. 296 // You can construct a concrete instance of `PhoneNumberArrayInput` via: 297 // 298 // PhoneNumberArray{ PhoneNumberArgs{...} } 299 type PhoneNumberArrayInput interface { 300 pulumi.Input 301 302 ToPhoneNumberArrayOutput() PhoneNumberArrayOutput 303 ToPhoneNumberArrayOutputWithContext(context.Context) PhoneNumberArrayOutput 304 } 305 306 type PhoneNumberArray []PhoneNumberInput 307 308 func (PhoneNumberArray) ElementType() reflect.Type { 309 return reflect.TypeOf((*[]*PhoneNumber)(nil)).Elem() 310 } 311 312 func (i PhoneNumberArray) ToPhoneNumberArrayOutput() PhoneNumberArrayOutput { 313 return i.ToPhoneNumberArrayOutputWithContext(context.Background()) 314 } 315 316 func (i PhoneNumberArray) ToPhoneNumberArrayOutputWithContext(ctx context.Context) PhoneNumberArrayOutput { 317 return pulumi.ToOutputWithContext(ctx, i).(PhoneNumberArrayOutput) 318 } 319 320 // PhoneNumberMapInput is an input type that accepts PhoneNumberMap and PhoneNumberMapOutput values. 321 // You can construct a concrete instance of `PhoneNumberMapInput` via: 322 // 323 // PhoneNumberMap{ "key": PhoneNumberArgs{...} } 324 type PhoneNumberMapInput interface { 325 pulumi.Input 326 327 ToPhoneNumberMapOutput() PhoneNumberMapOutput 328 ToPhoneNumberMapOutputWithContext(context.Context) PhoneNumberMapOutput 329 } 330 331 type PhoneNumberMap map[string]PhoneNumberInput 332 333 func (PhoneNumberMap) ElementType() reflect.Type { 334 return reflect.TypeOf((*map[string]*PhoneNumber)(nil)).Elem() 335 } 336 337 func (i PhoneNumberMap) ToPhoneNumberMapOutput() PhoneNumberMapOutput { 338 return i.ToPhoneNumberMapOutputWithContext(context.Background()) 339 } 340 341 func (i PhoneNumberMap) ToPhoneNumberMapOutputWithContext(ctx context.Context) PhoneNumberMapOutput { 342 return pulumi.ToOutputWithContext(ctx, i).(PhoneNumberMapOutput) 343 } 344 345 type PhoneNumberOutput struct{ *pulumi.OutputState } 346 347 func (PhoneNumberOutput) ElementType() reflect.Type { 348 return reflect.TypeOf((**PhoneNumber)(nil)).Elem() 349 } 350 351 func (o PhoneNumberOutput) ToPhoneNumberOutput() PhoneNumberOutput { 352 return o 353 } 354 355 func (o PhoneNumberOutput) ToPhoneNumberOutputWithContext(ctx context.Context) PhoneNumberOutput { 356 return o 357 } 358 359 // The ARN of the phone number. 360 func (o PhoneNumberOutput) Arn() pulumi.StringOutput { 361 return o.ApplyT(func(v *PhoneNumber) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 362 } 363 364 // The ISO country code. For a list of Valid values, refer to [PhoneNumberCountryCode](https://docs.aws.amazon.com/connect/latest/APIReference/API_SearchAvailablePhoneNumbers.html#connect-SearchAvailablePhoneNumbers-request-PhoneNumberCountryCode). 365 func (o PhoneNumberOutput) CountryCode() pulumi.StringOutput { 366 return o.ApplyT(func(v *PhoneNumber) pulumi.StringOutput { return v.CountryCode }).(pulumi.StringOutput) 367 } 368 369 // The description of the phone number. 370 func (o PhoneNumberOutput) Description() pulumi.StringPtrOutput { 371 return o.ApplyT(func(v *PhoneNumber) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput) 372 } 373 374 // The phone number. Phone numbers are formatted `[+] [country code] [subscriber number including area code]`. 375 func (o PhoneNumberOutput) PhoneNumber() pulumi.StringOutput { 376 return o.ApplyT(func(v *PhoneNumber) pulumi.StringOutput { return v.PhoneNumber }).(pulumi.StringOutput) 377 } 378 379 // The prefix of the phone number that is used to filter available phone numbers. If provided, it must contain `+` as part of the country code. Do not specify this argument when importing the resource. 380 func (o PhoneNumberOutput) Prefix() pulumi.StringPtrOutput { 381 return o.ApplyT(func(v *PhoneNumber) pulumi.StringPtrOutput { return v.Prefix }).(pulumi.StringPtrOutput) 382 } 383 384 // The status of the phone number. Valid Values: `CLAIMED` | `IN_PROGRESS` | `FAILED`. 385 func (o PhoneNumberOutput) Statuses() PhoneNumberStatusArrayOutput { 386 return o.ApplyT(func(v *PhoneNumber) PhoneNumberStatusArrayOutput { return v.Statuses }).(PhoneNumberStatusArrayOutput) 387 } 388 389 // Tags to apply to the Phone Number. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 390 func (o PhoneNumberOutput) Tags() pulumi.StringMapOutput { 391 return o.ApplyT(func(v *PhoneNumber) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 392 } 393 394 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 395 // 396 // Deprecated: Please use `tags` instead. 397 func (o PhoneNumberOutput) TagsAll() pulumi.StringMapOutput { 398 return o.ApplyT(func(v *PhoneNumber) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 399 } 400 401 // The Amazon Resource Name (ARN) for Amazon Connect instances that phone numbers are claimed to. 402 func (o PhoneNumberOutput) TargetArn() pulumi.StringOutput { 403 return o.ApplyT(func(v *PhoneNumber) pulumi.StringOutput { return v.TargetArn }).(pulumi.StringOutput) 404 } 405 406 // The type of phone number. Valid Values: `TOLL_FREE` | `DID`. 407 func (o PhoneNumberOutput) Type() pulumi.StringOutput { 408 return o.ApplyT(func(v *PhoneNumber) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput) 409 } 410 411 type PhoneNumberArrayOutput struct{ *pulumi.OutputState } 412 413 func (PhoneNumberArrayOutput) ElementType() reflect.Type { 414 return reflect.TypeOf((*[]*PhoneNumber)(nil)).Elem() 415 } 416 417 func (o PhoneNumberArrayOutput) ToPhoneNumberArrayOutput() PhoneNumberArrayOutput { 418 return o 419 } 420 421 func (o PhoneNumberArrayOutput) ToPhoneNumberArrayOutputWithContext(ctx context.Context) PhoneNumberArrayOutput { 422 return o 423 } 424 425 func (o PhoneNumberArrayOutput) Index(i pulumi.IntInput) PhoneNumberOutput { 426 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *PhoneNumber { 427 return vs[0].([]*PhoneNumber)[vs[1].(int)] 428 }).(PhoneNumberOutput) 429 } 430 431 type PhoneNumberMapOutput struct{ *pulumi.OutputState } 432 433 func (PhoneNumberMapOutput) ElementType() reflect.Type { 434 return reflect.TypeOf((*map[string]*PhoneNumber)(nil)).Elem() 435 } 436 437 func (o PhoneNumberMapOutput) ToPhoneNumberMapOutput() PhoneNumberMapOutput { 438 return o 439 } 440 441 func (o PhoneNumberMapOutput) ToPhoneNumberMapOutputWithContext(ctx context.Context) PhoneNumberMapOutput { 442 return o 443 } 444 445 func (o PhoneNumberMapOutput) MapIndex(k pulumi.StringInput) PhoneNumberOutput { 446 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *PhoneNumber { 447 return vs[0].(map[string]*PhoneNumber)[vs[1].(string)] 448 }).(PhoneNumberOutput) 449 } 450 451 func init() { 452 pulumi.RegisterInputType(reflect.TypeOf((*PhoneNumberInput)(nil)).Elem(), &PhoneNumber{}) 453 pulumi.RegisterInputType(reflect.TypeOf((*PhoneNumberArrayInput)(nil)).Elem(), PhoneNumberArray{}) 454 pulumi.RegisterInputType(reflect.TypeOf((*PhoneNumberMapInput)(nil)).Elem(), PhoneNumberMap{}) 455 pulumi.RegisterOutputType(PhoneNumberOutput{}) 456 pulumi.RegisterOutputType(PhoneNumberArrayOutput{}) 457 pulumi.RegisterOutputType(PhoneNumberMapOutput{}) 458 }