github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cloudwatch/eventConnection.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 cloudwatch 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 EventBridge connection resource. 16 // 17 // > **Note:** EventBridge was formerly known as CloudWatch Events. The functionality is identical. 18 // 19 // ## Example Usage 20 // 21 // <!--Start PulumiCodeChooser --> 22 // ```go 23 // package main 24 // 25 // import ( 26 // 27 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch" 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 := cloudwatch.NewEventConnection(ctx, "test", &cloudwatch.EventConnectionArgs{ 35 // Name: pulumi.String("ngrok-connection"), 36 // Description: pulumi.String("A connection description"), 37 // AuthorizationType: pulumi.String("API_KEY"), 38 // AuthParameters: &cloudwatch.EventConnectionAuthParametersArgs{ 39 // ApiKey: &cloudwatch.EventConnectionAuthParametersApiKeyArgs{ 40 // Key: pulumi.String("x-signature"), 41 // Value: pulumi.String("1234"), 42 // }, 43 // }, 44 // }) 45 // if err != nil { 46 // return err 47 // } 48 // return nil 49 // }) 50 // } 51 // 52 // ``` 53 // <!--End PulumiCodeChooser --> 54 // 55 // ### Basic Authorization 56 // 57 // <!--Start PulumiCodeChooser --> 58 // ```go 59 // package main 60 // 61 // import ( 62 // 63 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch" 64 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 65 // 66 // ) 67 // 68 // func main() { 69 // pulumi.Run(func(ctx *pulumi.Context) error { 70 // _, err := cloudwatch.NewEventConnection(ctx, "test", &cloudwatch.EventConnectionArgs{ 71 // Name: pulumi.String("ngrok-connection"), 72 // Description: pulumi.String("A connection description"), 73 // AuthorizationType: pulumi.String("BASIC"), 74 // AuthParameters: &cloudwatch.EventConnectionAuthParametersArgs{ 75 // Basic: &cloudwatch.EventConnectionAuthParametersBasicArgs{ 76 // Username: pulumi.String("user"), 77 // Password: pulumi.String("Pass1234!"), 78 // }, 79 // }, 80 // }) 81 // if err != nil { 82 // return err 83 // } 84 // return nil 85 // }) 86 // } 87 // 88 // ``` 89 // <!--End PulumiCodeChooser --> 90 // 91 // ### OAuth Authorization 92 // 93 // <!--Start PulumiCodeChooser --> 94 // ```go 95 // package main 96 // 97 // import ( 98 // 99 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch" 100 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 101 // 102 // ) 103 // 104 // func main() { 105 // pulumi.Run(func(ctx *pulumi.Context) error { 106 // _, err := cloudwatch.NewEventConnection(ctx, "test", &cloudwatch.EventConnectionArgs{ 107 // Name: pulumi.String("ngrok-connection"), 108 // Description: pulumi.String("A connection description"), 109 // AuthorizationType: pulumi.String("OAUTH_CLIENT_CREDENTIALS"), 110 // AuthParameters: &cloudwatch.EventConnectionAuthParametersArgs{ 111 // Oauth: &cloudwatch.EventConnectionAuthParametersOauthArgs{ 112 // AuthorizationEndpoint: pulumi.String("https://auth.url.com/endpoint"), 113 // HttpMethod: pulumi.String("GET"), 114 // ClientParameters: &cloudwatch.EventConnectionAuthParametersOauthClientParametersArgs{ 115 // ClientId: pulumi.String("1234567890"), 116 // ClientSecret: pulumi.String("Pass1234!"), 117 // }, 118 // OauthHttpParameters: &cloudwatch.EventConnectionAuthParametersOauthOauthHttpParametersArgs{ 119 // Bodies: cloudwatch.EventConnectionAuthParametersOauthOauthHttpParametersBodyArray{ 120 // &cloudwatch.EventConnectionAuthParametersOauthOauthHttpParametersBodyArgs{ 121 // Key: pulumi.String("body-parameter-key"), 122 // Value: pulumi.String("body-parameter-value"), 123 // IsValueSecret: pulumi.Bool(false), 124 // }, 125 // }, 126 // Headers: cloudwatch.EventConnectionAuthParametersOauthOauthHttpParametersHeaderArray{ 127 // &cloudwatch.EventConnectionAuthParametersOauthOauthHttpParametersHeaderArgs{ 128 // Key: pulumi.String("header-parameter-key"), 129 // Value: pulumi.String("header-parameter-value"), 130 // IsValueSecret: pulumi.Bool(false), 131 // }, 132 // }, 133 // QueryStrings: cloudwatch.EventConnectionAuthParametersOauthOauthHttpParametersQueryStringArray{ 134 // &cloudwatch.EventConnectionAuthParametersOauthOauthHttpParametersQueryStringArgs{ 135 // Key: pulumi.String("query-string-parameter-key"), 136 // Value: pulumi.String("query-string-parameter-value"), 137 // IsValueSecret: pulumi.Bool(false), 138 // }, 139 // }, 140 // }, 141 // }, 142 // }, 143 // }) 144 // if err != nil { 145 // return err 146 // } 147 // return nil 148 // }) 149 // } 150 // 151 // ``` 152 // <!--End PulumiCodeChooser --> 153 // 154 // ### Invocation Http Parameters 155 // 156 // <!--Start PulumiCodeChooser --> 157 // ```go 158 // package main 159 // 160 // import ( 161 // 162 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch" 163 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 164 // 165 // ) 166 // 167 // func main() { 168 // pulumi.Run(func(ctx *pulumi.Context) error { 169 // _, err := cloudwatch.NewEventConnection(ctx, "test", &cloudwatch.EventConnectionArgs{ 170 // Name: pulumi.String("ngrok-connection"), 171 // Description: pulumi.String("A connection description"), 172 // AuthorizationType: pulumi.String("BASIC"), 173 // AuthParameters: &cloudwatch.EventConnectionAuthParametersArgs{ 174 // Basic: &cloudwatch.EventConnectionAuthParametersBasicArgs{ 175 // Username: pulumi.String("user"), 176 // Password: pulumi.String("Pass1234!"), 177 // }, 178 // InvocationHttpParameters: &cloudwatch.EventConnectionAuthParametersInvocationHttpParametersArgs{ 179 // Bodies: cloudwatch.EventConnectionAuthParametersInvocationHttpParametersBodyArray{ 180 // &cloudwatch.EventConnectionAuthParametersInvocationHttpParametersBodyArgs{ 181 // Key: pulumi.String("body-parameter-key"), 182 // Value: pulumi.String("body-parameter-value"), 183 // IsValueSecret: pulumi.Bool(false), 184 // }, 185 // &cloudwatch.EventConnectionAuthParametersInvocationHttpParametersBodyArgs{ 186 // Key: pulumi.String("body-parameter-key2"), 187 // Value: pulumi.String("body-parameter-value2"), 188 // IsValueSecret: pulumi.Bool(true), 189 // }, 190 // }, 191 // Headers: cloudwatch.EventConnectionAuthParametersInvocationHttpParametersHeaderArray{ 192 // &cloudwatch.EventConnectionAuthParametersInvocationHttpParametersHeaderArgs{ 193 // Key: pulumi.String("header-parameter-key"), 194 // Value: pulumi.String("header-parameter-value"), 195 // IsValueSecret: pulumi.Bool(false), 196 // }, 197 // }, 198 // QueryStrings: cloudwatch.EventConnectionAuthParametersInvocationHttpParametersQueryStringArray{ 199 // &cloudwatch.EventConnectionAuthParametersInvocationHttpParametersQueryStringArgs{ 200 // Key: pulumi.String("query-string-parameter-key"), 201 // Value: pulumi.String("query-string-parameter-value"), 202 // IsValueSecret: pulumi.Bool(false), 203 // }, 204 // }, 205 // }, 206 // }, 207 // }) 208 // if err != nil { 209 // return err 210 // } 211 // return nil 212 // }) 213 // } 214 // 215 // ``` 216 // <!--End PulumiCodeChooser --> 217 // 218 // ## Import 219 // 220 // Using `pulumi import`, import EventBridge EventBridge connection using the `name`. For example: 221 // 222 // ```sh 223 // $ pulumi import aws:cloudwatch/eventConnection:EventConnection test ngrok-connection 224 // ``` 225 type EventConnection struct { 226 pulumi.CustomResourceState 227 228 // The Amazon Resource Name (ARN) of the connection. 229 Arn pulumi.StringOutput `pulumi:"arn"` 230 // Parameters used for authorization. A maximum of 1 are allowed. Documented below. 231 AuthParameters EventConnectionAuthParametersOutput `pulumi:"authParameters"` 232 // Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`. 233 AuthorizationType pulumi.StringOutput `pulumi:"authorizationType"` 234 // Enter a description for the connection. Maximum of 512 characters. 235 Description pulumi.StringPtrOutput `pulumi:"description"` 236 // The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_. 237 Name pulumi.StringOutput `pulumi:"name"` 238 // The Amazon Resource Name (ARN) of the secret created from the authorization parameters specified for the connection. 239 SecretArn pulumi.StringOutput `pulumi:"secretArn"` 240 } 241 242 // NewEventConnection registers a new resource with the given unique name, arguments, and options. 243 func NewEventConnection(ctx *pulumi.Context, 244 name string, args *EventConnectionArgs, opts ...pulumi.ResourceOption) (*EventConnection, error) { 245 if args == nil { 246 return nil, errors.New("missing one or more required arguments") 247 } 248 249 if args.AuthParameters == nil { 250 return nil, errors.New("invalid value for required argument 'AuthParameters'") 251 } 252 if args.AuthorizationType == nil { 253 return nil, errors.New("invalid value for required argument 'AuthorizationType'") 254 } 255 opts = internal.PkgResourceDefaultOpts(opts) 256 var resource EventConnection 257 err := ctx.RegisterResource("aws:cloudwatch/eventConnection:EventConnection", name, args, &resource, opts...) 258 if err != nil { 259 return nil, err 260 } 261 return &resource, nil 262 } 263 264 // GetEventConnection gets an existing EventConnection resource's state with the given name, ID, and optional 265 // state properties that are used to uniquely qualify the lookup (nil if not required). 266 func GetEventConnection(ctx *pulumi.Context, 267 name string, id pulumi.IDInput, state *EventConnectionState, opts ...pulumi.ResourceOption) (*EventConnection, error) { 268 var resource EventConnection 269 err := ctx.ReadResource("aws:cloudwatch/eventConnection:EventConnection", name, id, state, &resource, opts...) 270 if err != nil { 271 return nil, err 272 } 273 return &resource, nil 274 } 275 276 // Input properties used for looking up and filtering EventConnection resources. 277 type eventConnectionState struct { 278 // The Amazon Resource Name (ARN) of the connection. 279 Arn *string `pulumi:"arn"` 280 // Parameters used for authorization. A maximum of 1 are allowed. Documented below. 281 AuthParameters *EventConnectionAuthParameters `pulumi:"authParameters"` 282 // Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`. 283 AuthorizationType *string `pulumi:"authorizationType"` 284 // Enter a description for the connection. Maximum of 512 characters. 285 Description *string `pulumi:"description"` 286 // The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_. 287 Name *string `pulumi:"name"` 288 // The Amazon Resource Name (ARN) of the secret created from the authorization parameters specified for the connection. 289 SecretArn *string `pulumi:"secretArn"` 290 } 291 292 type EventConnectionState struct { 293 // The Amazon Resource Name (ARN) of the connection. 294 Arn pulumi.StringPtrInput 295 // Parameters used for authorization. A maximum of 1 are allowed. Documented below. 296 AuthParameters EventConnectionAuthParametersPtrInput 297 // Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`. 298 AuthorizationType pulumi.StringPtrInput 299 // Enter a description for the connection. Maximum of 512 characters. 300 Description pulumi.StringPtrInput 301 // The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_. 302 Name pulumi.StringPtrInput 303 // The Amazon Resource Name (ARN) of the secret created from the authorization parameters specified for the connection. 304 SecretArn pulumi.StringPtrInput 305 } 306 307 func (EventConnectionState) ElementType() reflect.Type { 308 return reflect.TypeOf((*eventConnectionState)(nil)).Elem() 309 } 310 311 type eventConnectionArgs struct { 312 // Parameters used for authorization. A maximum of 1 are allowed. Documented below. 313 AuthParameters EventConnectionAuthParameters `pulumi:"authParameters"` 314 // Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`. 315 AuthorizationType string `pulumi:"authorizationType"` 316 // Enter a description for the connection. Maximum of 512 characters. 317 Description *string `pulumi:"description"` 318 // The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_. 319 Name *string `pulumi:"name"` 320 } 321 322 // The set of arguments for constructing a EventConnection resource. 323 type EventConnectionArgs struct { 324 // Parameters used for authorization. A maximum of 1 are allowed. Documented below. 325 AuthParameters EventConnectionAuthParametersInput 326 // Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`. 327 AuthorizationType pulumi.StringInput 328 // Enter a description for the connection. Maximum of 512 characters. 329 Description pulumi.StringPtrInput 330 // The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_. 331 Name pulumi.StringPtrInput 332 } 333 334 func (EventConnectionArgs) ElementType() reflect.Type { 335 return reflect.TypeOf((*eventConnectionArgs)(nil)).Elem() 336 } 337 338 type EventConnectionInput interface { 339 pulumi.Input 340 341 ToEventConnectionOutput() EventConnectionOutput 342 ToEventConnectionOutputWithContext(ctx context.Context) EventConnectionOutput 343 } 344 345 func (*EventConnection) ElementType() reflect.Type { 346 return reflect.TypeOf((**EventConnection)(nil)).Elem() 347 } 348 349 func (i *EventConnection) ToEventConnectionOutput() EventConnectionOutput { 350 return i.ToEventConnectionOutputWithContext(context.Background()) 351 } 352 353 func (i *EventConnection) ToEventConnectionOutputWithContext(ctx context.Context) EventConnectionOutput { 354 return pulumi.ToOutputWithContext(ctx, i).(EventConnectionOutput) 355 } 356 357 // EventConnectionArrayInput is an input type that accepts EventConnectionArray and EventConnectionArrayOutput values. 358 // You can construct a concrete instance of `EventConnectionArrayInput` via: 359 // 360 // EventConnectionArray{ EventConnectionArgs{...} } 361 type EventConnectionArrayInput interface { 362 pulumi.Input 363 364 ToEventConnectionArrayOutput() EventConnectionArrayOutput 365 ToEventConnectionArrayOutputWithContext(context.Context) EventConnectionArrayOutput 366 } 367 368 type EventConnectionArray []EventConnectionInput 369 370 func (EventConnectionArray) ElementType() reflect.Type { 371 return reflect.TypeOf((*[]*EventConnection)(nil)).Elem() 372 } 373 374 func (i EventConnectionArray) ToEventConnectionArrayOutput() EventConnectionArrayOutput { 375 return i.ToEventConnectionArrayOutputWithContext(context.Background()) 376 } 377 378 func (i EventConnectionArray) ToEventConnectionArrayOutputWithContext(ctx context.Context) EventConnectionArrayOutput { 379 return pulumi.ToOutputWithContext(ctx, i).(EventConnectionArrayOutput) 380 } 381 382 // EventConnectionMapInput is an input type that accepts EventConnectionMap and EventConnectionMapOutput values. 383 // You can construct a concrete instance of `EventConnectionMapInput` via: 384 // 385 // EventConnectionMap{ "key": EventConnectionArgs{...} } 386 type EventConnectionMapInput interface { 387 pulumi.Input 388 389 ToEventConnectionMapOutput() EventConnectionMapOutput 390 ToEventConnectionMapOutputWithContext(context.Context) EventConnectionMapOutput 391 } 392 393 type EventConnectionMap map[string]EventConnectionInput 394 395 func (EventConnectionMap) ElementType() reflect.Type { 396 return reflect.TypeOf((*map[string]*EventConnection)(nil)).Elem() 397 } 398 399 func (i EventConnectionMap) ToEventConnectionMapOutput() EventConnectionMapOutput { 400 return i.ToEventConnectionMapOutputWithContext(context.Background()) 401 } 402 403 func (i EventConnectionMap) ToEventConnectionMapOutputWithContext(ctx context.Context) EventConnectionMapOutput { 404 return pulumi.ToOutputWithContext(ctx, i).(EventConnectionMapOutput) 405 } 406 407 type EventConnectionOutput struct{ *pulumi.OutputState } 408 409 func (EventConnectionOutput) ElementType() reflect.Type { 410 return reflect.TypeOf((**EventConnection)(nil)).Elem() 411 } 412 413 func (o EventConnectionOutput) ToEventConnectionOutput() EventConnectionOutput { 414 return o 415 } 416 417 func (o EventConnectionOutput) ToEventConnectionOutputWithContext(ctx context.Context) EventConnectionOutput { 418 return o 419 } 420 421 // The Amazon Resource Name (ARN) of the connection. 422 func (o EventConnectionOutput) Arn() pulumi.StringOutput { 423 return o.ApplyT(func(v *EventConnection) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 424 } 425 426 // Parameters used for authorization. A maximum of 1 are allowed. Documented below. 427 func (o EventConnectionOutput) AuthParameters() EventConnectionAuthParametersOutput { 428 return o.ApplyT(func(v *EventConnection) EventConnectionAuthParametersOutput { return v.AuthParameters }).(EventConnectionAuthParametersOutput) 429 } 430 431 // Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`. 432 func (o EventConnectionOutput) AuthorizationType() pulumi.StringOutput { 433 return o.ApplyT(func(v *EventConnection) pulumi.StringOutput { return v.AuthorizationType }).(pulumi.StringOutput) 434 } 435 436 // Enter a description for the connection. Maximum of 512 characters. 437 func (o EventConnectionOutput) Description() pulumi.StringPtrOutput { 438 return o.ApplyT(func(v *EventConnection) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput) 439 } 440 441 // The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_. 442 func (o EventConnectionOutput) Name() pulumi.StringOutput { 443 return o.ApplyT(func(v *EventConnection) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 444 } 445 446 // The Amazon Resource Name (ARN) of the secret created from the authorization parameters specified for the connection. 447 func (o EventConnectionOutput) SecretArn() pulumi.StringOutput { 448 return o.ApplyT(func(v *EventConnection) pulumi.StringOutput { return v.SecretArn }).(pulumi.StringOutput) 449 } 450 451 type EventConnectionArrayOutput struct{ *pulumi.OutputState } 452 453 func (EventConnectionArrayOutput) ElementType() reflect.Type { 454 return reflect.TypeOf((*[]*EventConnection)(nil)).Elem() 455 } 456 457 func (o EventConnectionArrayOutput) ToEventConnectionArrayOutput() EventConnectionArrayOutput { 458 return o 459 } 460 461 func (o EventConnectionArrayOutput) ToEventConnectionArrayOutputWithContext(ctx context.Context) EventConnectionArrayOutput { 462 return o 463 } 464 465 func (o EventConnectionArrayOutput) Index(i pulumi.IntInput) EventConnectionOutput { 466 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *EventConnection { 467 return vs[0].([]*EventConnection)[vs[1].(int)] 468 }).(EventConnectionOutput) 469 } 470 471 type EventConnectionMapOutput struct{ *pulumi.OutputState } 472 473 func (EventConnectionMapOutput) ElementType() reflect.Type { 474 return reflect.TypeOf((*map[string]*EventConnection)(nil)).Elem() 475 } 476 477 func (o EventConnectionMapOutput) ToEventConnectionMapOutput() EventConnectionMapOutput { 478 return o 479 } 480 481 func (o EventConnectionMapOutput) ToEventConnectionMapOutputWithContext(ctx context.Context) EventConnectionMapOutput { 482 return o 483 } 484 485 func (o EventConnectionMapOutput) MapIndex(k pulumi.StringInput) EventConnectionOutput { 486 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *EventConnection { 487 return vs[0].(map[string]*EventConnection)[vs[1].(string)] 488 }).(EventConnectionOutput) 489 } 490 491 func init() { 492 pulumi.RegisterInputType(reflect.TypeOf((*EventConnectionInput)(nil)).Elem(), &EventConnection{}) 493 pulumi.RegisterInputType(reflect.TypeOf((*EventConnectionArrayInput)(nil)).Elem(), EventConnectionArray{}) 494 pulumi.RegisterInputType(reflect.TypeOf((*EventConnectionMapInput)(nil)).Elem(), EventConnectionMap{}) 495 pulumi.RegisterOutputType(EventConnectionOutput{}) 496 pulumi.RegisterOutputType(EventConnectionArrayOutput{}) 497 pulumi.RegisterOutputType(EventConnectionMapOutput{}) 498 }