github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/connect/botAssociation.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 // Allows the specified Amazon Connect instance to access the specified Amazon Lex (V1) bot. For more information see 16 // [Amazon Connect: Getting Started](https://docs.aws.amazon.com/connect/latest/adminguide/amazon-connect-get-started.html) and [Add an Amazon Lex bot](https://docs.aws.amazon.com/connect/latest/adminguide/amazon-lex.html). 17 // 18 // > **NOTE:** This resource only currently supports Amazon Lex (V1) Associations. 19 // 20 // ## Example Usage 21 // 22 // ### Basic 23 // 24 // <!--Start PulumiCodeChooser --> 25 // ```go 26 // package main 27 // 28 // import ( 29 // 30 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/connect" 31 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 32 // 33 // ) 34 // 35 // func main() { 36 // pulumi.Run(func(ctx *pulumi.Context) error { 37 // _, err := connect.NewBotAssociation(ctx, "example", &connect.BotAssociationArgs{ 38 // InstanceId: pulumi.Any(exampleAwsConnectInstance.Id), 39 // LexBot: &connect.BotAssociationLexBotArgs{ 40 // LexRegion: pulumi.String("us-west-2"), 41 // Name: pulumi.String("Test"), 42 // }, 43 // }) 44 // if err != nil { 45 // return err 46 // } 47 // return nil 48 // }) 49 // } 50 // 51 // ``` 52 // <!--End PulumiCodeChooser --> 53 // 54 // ### Including a sample Lex bot 55 // 56 // <!--Start PulumiCodeChooser --> 57 // ```go 58 // package main 59 // 60 // import ( 61 // 62 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws" 63 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/connect" 64 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lex" 65 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 66 // 67 // ) 68 // 69 // func main() { 70 // pulumi.Run(func(ctx *pulumi.Context) error { 71 // current, err := aws.GetRegion(ctx, nil, nil) 72 // if err != nil { 73 // return err 74 // } 75 // example, err := lex.NewIntent(ctx, "example", &lex.IntentArgs{ 76 // CreateVersion: pulumi.Bool(true), 77 // Name: pulumi.String("connect_lex_intent"), 78 // FulfillmentActivity: &lex.IntentFulfillmentActivityArgs{ 79 // Type: pulumi.String("ReturnIntent"), 80 // }, 81 // SampleUtterances: pulumi.StringArray{ 82 // pulumi.String("I would like to pick up flowers."), 83 // }, 84 // }) 85 // if err != nil { 86 // return err 87 // } 88 // exampleBot, err := lex.NewBot(ctx, "example", &lex.BotArgs{ 89 // AbortStatement: &lex.BotAbortStatementArgs{ 90 // Messages: lex.BotAbortStatementMessageArray{ 91 // &lex.BotAbortStatementMessageArgs{ 92 // Content: pulumi.String("Sorry, I am not able to assist at this time."), 93 // ContentType: pulumi.String("PlainText"), 94 // }, 95 // }, 96 // }, 97 // ClarificationPrompt: &lex.BotClarificationPromptArgs{ 98 // MaxAttempts: pulumi.Int(2), 99 // Messages: lex.BotClarificationPromptMessageArray{ 100 // &lex.BotClarificationPromptMessageArgs{ 101 // Content: pulumi.String("I didn't understand you, what would you like to do?"), 102 // ContentType: pulumi.String("PlainText"), 103 // }, 104 // }, 105 // }, 106 // Intents: lex.BotIntentArray{ 107 // &lex.BotIntentArgs{ 108 // IntentName: example.Name, 109 // IntentVersion: pulumi.String("1"), 110 // }, 111 // }, 112 // ChildDirected: pulumi.Bool(false), 113 // Name: pulumi.String("connect_lex_bot"), 114 // ProcessBehavior: pulumi.String("BUILD"), 115 // }) 116 // if err != nil { 117 // return err 118 // } 119 // _, err = connect.NewBotAssociation(ctx, "example", &connect.BotAssociationArgs{ 120 // InstanceId: pulumi.Any(exampleAwsConnectInstance.Id), 121 // LexBot: &connect.BotAssociationLexBotArgs{ 122 // LexRegion: pulumi.String(current.Name), 123 // Name: exampleBot.Name, 124 // }, 125 // }) 126 // if err != nil { 127 // return err 128 // } 129 // return nil 130 // }) 131 // } 132 // 133 // ``` 134 // <!--End PulumiCodeChooser --> 135 // 136 // ## Import 137 // 138 // Using `pulumi import`, import `aws_connect_bot_association` using the Amazon Connect instance ID, Lex (V1) bot name, and Lex (V1) bot region separated by colons (`:`). For example: 139 // 140 // ```sh 141 // $ pulumi import aws:connect/botAssociation:BotAssociation example aaaaaaaa-bbbb-cccc-dddd-111111111111:Example:us-west-2 142 // ``` 143 type BotAssociation struct { 144 pulumi.CustomResourceState 145 146 // The identifier of the Amazon Connect instance. You can find the instanceId in the ARN of the instance. 147 InstanceId pulumi.StringOutput `pulumi:"instanceId"` 148 // Configuration information of an Amazon Lex (V1) bot. Detailed below. 149 LexBot BotAssociationLexBotOutput `pulumi:"lexBot"` 150 } 151 152 // NewBotAssociation registers a new resource with the given unique name, arguments, and options. 153 func NewBotAssociation(ctx *pulumi.Context, 154 name string, args *BotAssociationArgs, opts ...pulumi.ResourceOption) (*BotAssociation, error) { 155 if args == nil { 156 return nil, errors.New("missing one or more required arguments") 157 } 158 159 if args.InstanceId == nil { 160 return nil, errors.New("invalid value for required argument 'InstanceId'") 161 } 162 if args.LexBot == nil { 163 return nil, errors.New("invalid value for required argument 'LexBot'") 164 } 165 opts = internal.PkgResourceDefaultOpts(opts) 166 var resource BotAssociation 167 err := ctx.RegisterResource("aws:connect/botAssociation:BotAssociation", name, args, &resource, opts...) 168 if err != nil { 169 return nil, err 170 } 171 return &resource, nil 172 } 173 174 // GetBotAssociation gets an existing BotAssociation 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 GetBotAssociation(ctx *pulumi.Context, 177 name string, id pulumi.IDInput, state *BotAssociationState, opts ...pulumi.ResourceOption) (*BotAssociation, error) { 178 var resource BotAssociation 179 err := ctx.ReadResource("aws:connect/botAssociation:BotAssociation", 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 BotAssociation resources. 187 type botAssociationState struct { 188 // The identifier of the Amazon Connect instance. You can find the instanceId in the ARN of the instance. 189 InstanceId *string `pulumi:"instanceId"` 190 // Configuration information of an Amazon Lex (V1) bot. Detailed below. 191 LexBot *BotAssociationLexBot `pulumi:"lexBot"` 192 } 193 194 type BotAssociationState struct { 195 // The identifier of the Amazon Connect instance. You can find the instanceId in the ARN of the instance. 196 InstanceId pulumi.StringPtrInput 197 // Configuration information of an Amazon Lex (V1) bot. Detailed below. 198 LexBot BotAssociationLexBotPtrInput 199 } 200 201 func (BotAssociationState) ElementType() reflect.Type { 202 return reflect.TypeOf((*botAssociationState)(nil)).Elem() 203 } 204 205 type botAssociationArgs struct { 206 // The identifier of the Amazon Connect instance. You can find the instanceId in the ARN of the instance. 207 InstanceId string `pulumi:"instanceId"` 208 // Configuration information of an Amazon Lex (V1) bot. Detailed below. 209 LexBot BotAssociationLexBot `pulumi:"lexBot"` 210 } 211 212 // The set of arguments for constructing a BotAssociation resource. 213 type BotAssociationArgs struct { 214 // The identifier of the Amazon Connect instance. You can find the instanceId in the ARN of the instance. 215 InstanceId pulumi.StringInput 216 // Configuration information of an Amazon Lex (V1) bot. Detailed below. 217 LexBot BotAssociationLexBotInput 218 } 219 220 func (BotAssociationArgs) ElementType() reflect.Type { 221 return reflect.TypeOf((*botAssociationArgs)(nil)).Elem() 222 } 223 224 type BotAssociationInput interface { 225 pulumi.Input 226 227 ToBotAssociationOutput() BotAssociationOutput 228 ToBotAssociationOutputWithContext(ctx context.Context) BotAssociationOutput 229 } 230 231 func (*BotAssociation) ElementType() reflect.Type { 232 return reflect.TypeOf((**BotAssociation)(nil)).Elem() 233 } 234 235 func (i *BotAssociation) ToBotAssociationOutput() BotAssociationOutput { 236 return i.ToBotAssociationOutputWithContext(context.Background()) 237 } 238 239 func (i *BotAssociation) ToBotAssociationOutputWithContext(ctx context.Context) BotAssociationOutput { 240 return pulumi.ToOutputWithContext(ctx, i).(BotAssociationOutput) 241 } 242 243 // BotAssociationArrayInput is an input type that accepts BotAssociationArray and BotAssociationArrayOutput values. 244 // You can construct a concrete instance of `BotAssociationArrayInput` via: 245 // 246 // BotAssociationArray{ BotAssociationArgs{...} } 247 type BotAssociationArrayInput interface { 248 pulumi.Input 249 250 ToBotAssociationArrayOutput() BotAssociationArrayOutput 251 ToBotAssociationArrayOutputWithContext(context.Context) BotAssociationArrayOutput 252 } 253 254 type BotAssociationArray []BotAssociationInput 255 256 func (BotAssociationArray) ElementType() reflect.Type { 257 return reflect.TypeOf((*[]*BotAssociation)(nil)).Elem() 258 } 259 260 func (i BotAssociationArray) ToBotAssociationArrayOutput() BotAssociationArrayOutput { 261 return i.ToBotAssociationArrayOutputWithContext(context.Background()) 262 } 263 264 func (i BotAssociationArray) ToBotAssociationArrayOutputWithContext(ctx context.Context) BotAssociationArrayOutput { 265 return pulumi.ToOutputWithContext(ctx, i).(BotAssociationArrayOutput) 266 } 267 268 // BotAssociationMapInput is an input type that accepts BotAssociationMap and BotAssociationMapOutput values. 269 // You can construct a concrete instance of `BotAssociationMapInput` via: 270 // 271 // BotAssociationMap{ "key": BotAssociationArgs{...} } 272 type BotAssociationMapInput interface { 273 pulumi.Input 274 275 ToBotAssociationMapOutput() BotAssociationMapOutput 276 ToBotAssociationMapOutputWithContext(context.Context) BotAssociationMapOutput 277 } 278 279 type BotAssociationMap map[string]BotAssociationInput 280 281 func (BotAssociationMap) ElementType() reflect.Type { 282 return reflect.TypeOf((*map[string]*BotAssociation)(nil)).Elem() 283 } 284 285 func (i BotAssociationMap) ToBotAssociationMapOutput() BotAssociationMapOutput { 286 return i.ToBotAssociationMapOutputWithContext(context.Background()) 287 } 288 289 func (i BotAssociationMap) ToBotAssociationMapOutputWithContext(ctx context.Context) BotAssociationMapOutput { 290 return pulumi.ToOutputWithContext(ctx, i).(BotAssociationMapOutput) 291 } 292 293 type BotAssociationOutput struct{ *pulumi.OutputState } 294 295 func (BotAssociationOutput) ElementType() reflect.Type { 296 return reflect.TypeOf((**BotAssociation)(nil)).Elem() 297 } 298 299 func (o BotAssociationOutput) ToBotAssociationOutput() BotAssociationOutput { 300 return o 301 } 302 303 func (o BotAssociationOutput) ToBotAssociationOutputWithContext(ctx context.Context) BotAssociationOutput { 304 return o 305 } 306 307 // The identifier of the Amazon Connect instance. You can find the instanceId in the ARN of the instance. 308 func (o BotAssociationOutput) InstanceId() pulumi.StringOutput { 309 return o.ApplyT(func(v *BotAssociation) pulumi.StringOutput { return v.InstanceId }).(pulumi.StringOutput) 310 } 311 312 // Configuration information of an Amazon Lex (V1) bot. Detailed below. 313 func (o BotAssociationOutput) LexBot() BotAssociationLexBotOutput { 314 return o.ApplyT(func(v *BotAssociation) BotAssociationLexBotOutput { return v.LexBot }).(BotAssociationLexBotOutput) 315 } 316 317 type BotAssociationArrayOutput struct{ *pulumi.OutputState } 318 319 func (BotAssociationArrayOutput) ElementType() reflect.Type { 320 return reflect.TypeOf((*[]*BotAssociation)(nil)).Elem() 321 } 322 323 func (o BotAssociationArrayOutput) ToBotAssociationArrayOutput() BotAssociationArrayOutput { 324 return o 325 } 326 327 func (o BotAssociationArrayOutput) ToBotAssociationArrayOutputWithContext(ctx context.Context) BotAssociationArrayOutput { 328 return o 329 } 330 331 func (o BotAssociationArrayOutput) Index(i pulumi.IntInput) BotAssociationOutput { 332 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *BotAssociation { 333 return vs[0].([]*BotAssociation)[vs[1].(int)] 334 }).(BotAssociationOutput) 335 } 336 337 type BotAssociationMapOutput struct{ *pulumi.OutputState } 338 339 func (BotAssociationMapOutput) ElementType() reflect.Type { 340 return reflect.TypeOf((*map[string]*BotAssociation)(nil)).Elem() 341 } 342 343 func (o BotAssociationMapOutput) ToBotAssociationMapOutput() BotAssociationMapOutput { 344 return o 345 } 346 347 func (o BotAssociationMapOutput) ToBotAssociationMapOutputWithContext(ctx context.Context) BotAssociationMapOutput { 348 return o 349 } 350 351 func (o BotAssociationMapOutput) MapIndex(k pulumi.StringInput) BotAssociationOutput { 352 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *BotAssociation { 353 return vs[0].(map[string]*BotAssociation)[vs[1].(string)] 354 }).(BotAssociationOutput) 355 } 356 357 func init() { 358 pulumi.RegisterInputType(reflect.TypeOf((*BotAssociationInput)(nil)).Elem(), &BotAssociation{}) 359 pulumi.RegisterInputType(reflect.TypeOf((*BotAssociationArrayInput)(nil)).Elem(), BotAssociationArray{}) 360 pulumi.RegisterInputType(reflect.TypeOf((*BotAssociationMapInput)(nil)).Elem(), BotAssociationMap{}) 361 pulumi.RegisterOutputType(BotAssociationOutput{}) 362 pulumi.RegisterOutputType(BotAssociationArrayOutput{}) 363 pulumi.RegisterOutputType(BotAssociationMapOutput{}) 364 }