github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/lightsail/lb.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 lightsail 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 // Creates a Lightsail load balancer resource. 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/lightsail" 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 := lightsail.NewLb(ctx, "test", &lightsail.LbArgs{ 33 // Name: pulumi.String("test-load-balancer"), 34 // HealthCheckPath: pulumi.String("/"), 35 // InstancePort: pulumi.Int(80), 36 // Tags: pulumi.StringMap{ 37 // "foo": pulumi.String("bar"), 38 // }, 39 // }) 40 // if err != nil { 41 // return err 42 // } 43 // return nil 44 // }) 45 // } 46 // 47 // ``` 48 // <!--End PulumiCodeChooser --> 49 // 50 // ## Import 51 // 52 // Using `pulumi import`, import `aws_lightsail_lb` using the name attribute. For example: 53 // 54 // ```sh 55 // $ pulumi import aws:lightsail/lb:Lb test example-load-balancer 56 // ``` 57 type Lb struct { 58 pulumi.CustomResourceState 59 60 // The ARN of the Lightsail load balancer. 61 Arn pulumi.StringOutput `pulumi:"arn"` 62 // The timestamp when the load balancer was created. 63 CreatedAt pulumi.StringOutput `pulumi:"createdAt"` 64 // The DNS name of the load balancer. 65 DnsName pulumi.StringOutput `pulumi:"dnsName"` 66 // The health check path of the load balancer. Default value "/". 67 HealthCheckPath pulumi.StringPtrOutput `pulumi:"healthCheckPath"` 68 // The instance port the load balancer will connect. 69 InstancePort pulumi.IntOutput `pulumi:"instancePort"` 70 IpAddressType pulumi.StringPtrOutput `pulumi:"ipAddressType"` 71 // The name of the Lightsail load balancer. 72 Name pulumi.StringOutput `pulumi:"name"` 73 // The protocol of the load balancer. 74 Protocol pulumi.StringOutput `pulumi:"protocol"` 75 // The public ports of the load balancer. 76 PublicPorts pulumi.IntArrayOutput `pulumi:"publicPorts"` 77 // The support code for the database. Include this code in your email to support when you have questions about a database in Lightsail. This code enables our support team to look up your Lightsail information more easily. 78 SupportCode pulumi.StringOutput `pulumi:"supportCode"` 79 // A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 80 Tags pulumi.StringMapOutput `pulumi:"tags"` 81 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 82 // 83 // Deprecated: Please use `tags` instead. 84 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 85 } 86 87 // NewLb registers a new resource with the given unique name, arguments, and options. 88 func NewLb(ctx *pulumi.Context, 89 name string, args *LbArgs, opts ...pulumi.ResourceOption) (*Lb, error) { 90 if args == nil { 91 return nil, errors.New("missing one or more required arguments") 92 } 93 94 if args.InstancePort == nil { 95 return nil, errors.New("invalid value for required argument 'InstancePort'") 96 } 97 opts = internal.PkgResourceDefaultOpts(opts) 98 var resource Lb 99 err := ctx.RegisterResource("aws:lightsail/lb:Lb", name, args, &resource, opts...) 100 if err != nil { 101 return nil, err 102 } 103 return &resource, nil 104 } 105 106 // GetLb gets an existing Lb resource's state with the given name, ID, and optional 107 // state properties that are used to uniquely qualify the lookup (nil if not required). 108 func GetLb(ctx *pulumi.Context, 109 name string, id pulumi.IDInput, state *LbState, opts ...pulumi.ResourceOption) (*Lb, error) { 110 var resource Lb 111 err := ctx.ReadResource("aws:lightsail/lb:Lb", name, id, state, &resource, opts...) 112 if err != nil { 113 return nil, err 114 } 115 return &resource, nil 116 } 117 118 // Input properties used for looking up and filtering Lb resources. 119 type lbState struct { 120 // The ARN of the Lightsail load balancer. 121 Arn *string `pulumi:"arn"` 122 // The timestamp when the load balancer was created. 123 CreatedAt *string `pulumi:"createdAt"` 124 // The DNS name of the load balancer. 125 DnsName *string `pulumi:"dnsName"` 126 // The health check path of the load balancer. Default value "/". 127 HealthCheckPath *string `pulumi:"healthCheckPath"` 128 // The instance port the load balancer will connect. 129 InstancePort *int `pulumi:"instancePort"` 130 IpAddressType *string `pulumi:"ipAddressType"` 131 // The name of the Lightsail load balancer. 132 Name *string `pulumi:"name"` 133 // The protocol of the load balancer. 134 Protocol *string `pulumi:"protocol"` 135 // The public ports of the load balancer. 136 PublicPorts []int `pulumi:"publicPorts"` 137 // The support code for the database. Include this code in your email to support when you have questions about a database in Lightsail. This code enables our support team to look up your Lightsail information more easily. 138 SupportCode *string `pulumi:"supportCode"` 139 // A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 140 Tags map[string]string `pulumi:"tags"` 141 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 142 // 143 // Deprecated: Please use `tags` instead. 144 TagsAll map[string]string `pulumi:"tagsAll"` 145 } 146 147 type LbState struct { 148 // The ARN of the Lightsail load balancer. 149 Arn pulumi.StringPtrInput 150 // The timestamp when the load balancer was created. 151 CreatedAt pulumi.StringPtrInput 152 // The DNS name of the load balancer. 153 DnsName pulumi.StringPtrInput 154 // The health check path of the load balancer. Default value "/". 155 HealthCheckPath pulumi.StringPtrInput 156 // The instance port the load balancer will connect. 157 InstancePort pulumi.IntPtrInput 158 IpAddressType pulumi.StringPtrInput 159 // The name of the Lightsail load balancer. 160 Name pulumi.StringPtrInput 161 // The protocol of the load balancer. 162 Protocol pulumi.StringPtrInput 163 // The public ports of the load balancer. 164 PublicPorts pulumi.IntArrayInput 165 // The support code for the database. Include this code in your email to support when you have questions about a database in Lightsail. This code enables our support team to look up your Lightsail information more easily. 166 SupportCode pulumi.StringPtrInput 167 // A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 168 Tags pulumi.StringMapInput 169 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 170 // 171 // Deprecated: Please use `tags` instead. 172 TagsAll pulumi.StringMapInput 173 } 174 175 func (LbState) ElementType() reflect.Type { 176 return reflect.TypeOf((*lbState)(nil)).Elem() 177 } 178 179 type lbArgs struct { 180 // The health check path of the load balancer. Default value "/". 181 HealthCheckPath *string `pulumi:"healthCheckPath"` 182 // The instance port the load balancer will connect. 183 InstancePort int `pulumi:"instancePort"` 184 IpAddressType *string `pulumi:"ipAddressType"` 185 // The name of the Lightsail load balancer. 186 Name *string `pulumi:"name"` 187 // A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 188 Tags map[string]string `pulumi:"tags"` 189 } 190 191 // The set of arguments for constructing a Lb resource. 192 type LbArgs struct { 193 // The health check path of the load balancer. Default value "/". 194 HealthCheckPath pulumi.StringPtrInput 195 // The instance port the load balancer will connect. 196 InstancePort pulumi.IntInput 197 IpAddressType pulumi.StringPtrInput 198 // The name of the Lightsail load balancer. 199 Name pulumi.StringPtrInput 200 // A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 201 Tags pulumi.StringMapInput 202 } 203 204 func (LbArgs) ElementType() reflect.Type { 205 return reflect.TypeOf((*lbArgs)(nil)).Elem() 206 } 207 208 type LbInput interface { 209 pulumi.Input 210 211 ToLbOutput() LbOutput 212 ToLbOutputWithContext(ctx context.Context) LbOutput 213 } 214 215 func (*Lb) ElementType() reflect.Type { 216 return reflect.TypeOf((**Lb)(nil)).Elem() 217 } 218 219 func (i *Lb) ToLbOutput() LbOutput { 220 return i.ToLbOutputWithContext(context.Background()) 221 } 222 223 func (i *Lb) ToLbOutputWithContext(ctx context.Context) LbOutput { 224 return pulumi.ToOutputWithContext(ctx, i).(LbOutput) 225 } 226 227 // LbArrayInput is an input type that accepts LbArray and LbArrayOutput values. 228 // You can construct a concrete instance of `LbArrayInput` via: 229 // 230 // LbArray{ LbArgs{...} } 231 type LbArrayInput interface { 232 pulumi.Input 233 234 ToLbArrayOutput() LbArrayOutput 235 ToLbArrayOutputWithContext(context.Context) LbArrayOutput 236 } 237 238 type LbArray []LbInput 239 240 func (LbArray) ElementType() reflect.Type { 241 return reflect.TypeOf((*[]*Lb)(nil)).Elem() 242 } 243 244 func (i LbArray) ToLbArrayOutput() LbArrayOutput { 245 return i.ToLbArrayOutputWithContext(context.Background()) 246 } 247 248 func (i LbArray) ToLbArrayOutputWithContext(ctx context.Context) LbArrayOutput { 249 return pulumi.ToOutputWithContext(ctx, i).(LbArrayOutput) 250 } 251 252 // LbMapInput is an input type that accepts LbMap and LbMapOutput values. 253 // You can construct a concrete instance of `LbMapInput` via: 254 // 255 // LbMap{ "key": LbArgs{...} } 256 type LbMapInput interface { 257 pulumi.Input 258 259 ToLbMapOutput() LbMapOutput 260 ToLbMapOutputWithContext(context.Context) LbMapOutput 261 } 262 263 type LbMap map[string]LbInput 264 265 func (LbMap) ElementType() reflect.Type { 266 return reflect.TypeOf((*map[string]*Lb)(nil)).Elem() 267 } 268 269 func (i LbMap) ToLbMapOutput() LbMapOutput { 270 return i.ToLbMapOutputWithContext(context.Background()) 271 } 272 273 func (i LbMap) ToLbMapOutputWithContext(ctx context.Context) LbMapOutput { 274 return pulumi.ToOutputWithContext(ctx, i).(LbMapOutput) 275 } 276 277 type LbOutput struct{ *pulumi.OutputState } 278 279 func (LbOutput) ElementType() reflect.Type { 280 return reflect.TypeOf((**Lb)(nil)).Elem() 281 } 282 283 func (o LbOutput) ToLbOutput() LbOutput { 284 return o 285 } 286 287 func (o LbOutput) ToLbOutputWithContext(ctx context.Context) LbOutput { 288 return o 289 } 290 291 // The ARN of the Lightsail load balancer. 292 func (o LbOutput) Arn() pulumi.StringOutput { 293 return o.ApplyT(func(v *Lb) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 294 } 295 296 // The timestamp when the load balancer was created. 297 func (o LbOutput) CreatedAt() pulumi.StringOutput { 298 return o.ApplyT(func(v *Lb) pulumi.StringOutput { return v.CreatedAt }).(pulumi.StringOutput) 299 } 300 301 // The DNS name of the load balancer. 302 func (o LbOutput) DnsName() pulumi.StringOutput { 303 return o.ApplyT(func(v *Lb) pulumi.StringOutput { return v.DnsName }).(pulumi.StringOutput) 304 } 305 306 // The health check path of the load balancer. Default value "/". 307 func (o LbOutput) HealthCheckPath() pulumi.StringPtrOutput { 308 return o.ApplyT(func(v *Lb) pulumi.StringPtrOutput { return v.HealthCheckPath }).(pulumi.StringPtrOutput) 309 } 310 311 // The instance port the load balancer will connect. 312 func (o LbOutput) InstancePort() pulumi.IntOutput { 313 return o.ApplyT(func(v *Lb) pulumi.IntOutput { return v.InstancePort }).(pulumi.IntOutput) 314 } 315 316 func (o LbOutput) IpAddressType() pulumi.StringPtrOutput { 317 return o.ApplyT(func(v *Lb) pulumi.StringPtrOutput { return v.IpAddressType }).(pulumi.StringPtrOutput) 318 } 319 320 // The name of the Lightsail load balancer. 321 func (o LbOutput) Name() pulumi.StringOutput { 322 return o.ApplyT(func(v *Lb) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 323 } 324 325 // The protocol of the load balancer. 326 func (o LbOutput) Protocol() pulumi.StringOutput { 327 return o.ApplyT(func(v *Lb) pulumi.StringOutput { return v.Protocol }).(pulumi.StringOutput) 328 } 329 330 // The public ports of the load balancer. 331 func (o LbOutput) PublicPorts() pulumi.IntArrayOutput { 332 return o.ApplyT(func(v *Lb) pulumi.IntArrayOutput { return v.PublicPorts }).(pulumi.IntArrayOutput) 333 } 334 335 // The support code for the database. Include this code in your email to support when you have questions about a database in Lightsail. This code enables our support team to look up your Lightsail information more easily. 336 func (o LbOutput) SupportCode() pulumi.StringOutput { 337 return o.ApplyT(func(v *Lb) pulumi.StringOutput { return v.SupportCode }).(pulumi.StringOutput) 338 } 339 340 // A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 341 func (o LbOutput) Tags() pulumi.StringMapOutput { 342 return o.ApplyT(func(v *Lb) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 343 } 344 345 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 346 // 347 // Deprecated: Please use `tags` instead. 348 func (o LbOutput) TagsAll() pulumi.StringMapOutput { 349 return o.ApplyT(func(v *Lb) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 350 } 351 352 type LbArrayOutput struct{ *pulumi.OutputState } 353 354 func (LbArrayOutput) ElementType() reflect.Type { 355 return reflect.TypeOf((*[]*Lb)(nil)).Elem() 356 } 357 358 func (o LbArrayOutput) ToLbArrayOutput() LbArrayOutput { 359 return o 360 } 361 362 func (o LbArrayOutput) ToLbArrayOutputWithContext(ctx context.Context) LbArrayOutput { 363 return o 364 } 365 366 func (o LbArrayOutput) Index(i pulumi.IntInput) LbOutput { 367 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Lb { 368 return vs[0].([]*Lb)[vs[1].(int)] 369 }).(LbOutput) 370 } 371 372 type LbMapOutput struct{ *pulumi.OutputState } 373 374 func (LbMapOutput) ElementType() reflect.Type { 375 return reflect.TypeOf((*map[string]*Lb)(nil)).Elem() 376 } 377 378 func (o LbMapOutput) ToLbMapOutput() LbMapOutput { 379 return o 380 } 381 382 func (o LbMapOutput) ToLbMapOutputWithContext(ctx context.Context) LbMapOutput { 383 return o 384 } 385 386 func (o LbMapOutput) MapIndex(k pulumi.StringInput) LbOutput { 387 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Lb { 388 return vs[0].(map[string]*Lb)[vs[1].(string)] 389 }).(LbOutput) 390 } 391 392 func init() { 393 pulumi.RegisterInputType(reflect.TypeOf((*LbInput)(nil)).Elem(), &Lb{}) 394 pulumi.RegisterInputType(reflect.TypeOf((*LbArrayInput)(nil)).Elem(), LbArray{}) 395 pulumi.RegisterInputType(reflect.TypeOf((*LbMapInput)(nil)).Elem(), LbMap{}) 396 pulumi.RegisterOutputType(LbOutput{}) 397 pulumi.RegisterOutputType(LbArrayOutput{}) 398 pulumi.RegisterOutputType(LbMapOutput{}) 399 }