github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/vpclattice/targetGroupAttachment.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 vpclattice 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 the ability to register a target with an AWS VPC Lattice Target Group. 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/vpclattice" 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 := vpclattice.NewTargetGroupAttachment(ctx, "example", &vpclattice.TargetGroupAttachmentArgs{ 35 // TargetGroupIdentifier: pulumi.Any(exampleAwsVpclatticeTargetGroup.Id), 36 // Target: &vpclattice.TargetGroupAttachmentTargetArgs{ 37 // Id: pulumi.Any(exampleAwsLb.Arn), 38 // Port: pulumi.Int(80), 39 // }, 40 // }) 41 // if err != nil { 42 // return err 43 // } 44 // return nil 45 // }) 46 // } 47 // 48 // ``` 49 // <!--End PulumiCodeChooser --> 50 type TargetGroupAttachment struct { 51 pulumi.CustomResourceState 52 53 // The target. 54 Target TargetGroupAttachmentTargetOutput `pulumi:"target"` 55 // The ID or Amazon Resource Name (ARN) of the target group. 56 TargetGroupIdentifier pulumi.StringOutput `pulumi:"targetGroupIdentifier"` 57 } 58 59 // NewTargetGroupAttachment registers a new resource with the given unique name, arguments, and options. 60 func NewTargetGroupAttachment(ctx *pulumi.Context, 61 name string, args *TargetGroupAttachmentArgs, opts ...pulumi.ResourceOption) (*TargetGroupAttachment, error) { 62 if args == nil { 63 return nil, errors.New("missing one or more required arguments") 64 } 65 66 if args.Target == nil { 67 return nil, errors.New("invalid value for required argument 'Target'") 68 } 69 if args.TargetGroupIdentifier == nil { 70 return nil, errors.New("invalid value for required argument 'TargetGroupIdentifier'") 71 } 72 opts = internal.PkgResourceDefaultOpts(opts) 73 var resource TargetGroupAttachment 74 err := ctx.RegisterResource("aws:vpclattice/targetGroupAttachment:TargetGroupAttachment", name, args, &resource, opts...) 75 if err != nil { 76 return nil, err 77 } 78 return &resource, nil 79 } 80 81 // GetTargetGroupAttachment gets an existing TargetGroupAttachment resource's state with the given name, ID, and optional 82 // state properties that are used to uniquely qualify the lookup (nil if not required). 83 func GetTargetGroupAttachment(ctx *pulumi.Context, 84 name string, id pulumi.IDInput, state *TargetGroupAttachmentState, opts ...pulumi.ResourceOption) (*TargetGroupAttachment, error) { 85 var resource TargetGroupAttachment 86 err := ctx.ReadResource("aws:vpclattice/targetGroupAttachment:TargetGroupAttachment", name, id, state, &resource, opts...) 87 if err != nil { 88 return nil, err 89 } 90 return &resource, nil 91 } 92 93 // Input properties used for looking up and filtering TargetGroupAttachment resources. 94 type targetGroupAttachmentState struct { 95 // The target. 96 Target *TargetGroupAttachmentTarget `pulumi:"target"` 97 // The ID or Amazon Resource Name (ARN) of the target group. 98 TargetGroupIdentifier *string `pulumi:"targetGroupIdentifier"` 99 } 100 101 type TargetGroupAttachmentState struct { 102 // The target. 103 Target TargetGroupAttachmentTargetPtrInput 104 // The ID or Amazon Resource Name (ARN) of the target group. 105 TargetGroupIdentifier pulumi.StringPtrInput 106 } 107 108 func (TargetGroupAttachmentState) ElementType() reflect.Type { 109 return reflect.TypeOf((*targetGroupAttachmentState)(nil)).Elem() 110 } 111 112 type targetGroupAttachmentArgs struct { 113 // The target. 114 Target TargetGroupAttachmentTarget `pulumi:"target"` 115 // The ID or Amazon Resource Name (ARN) of the target group. 116 TargetGroupIdentifier string `pulumi:"targetGroupIdentifier"` 117 } 118 119 // The set of arguments for constructing a TargetGroupAttachment resource. 120 type TargetGroupAttachmentArgs struct { 121 // The target. 122 Target TargetGroupAttachmentTargetInput 123 // The ID or Amazon Resource Name (ARN) of the target group. 124 TargetGroupIdentifier pulumi.StringInput 125 } 126 127 func (TargetGroupAttachmentArgs) ElementType() reflect.Type { 128 return reflect.TypeOf((*targetGroupAttachmentArgs)(nil)).Elem() 129 } 130 131 type TargetGroupAttachmentInput interface { 132 pulumi.Input 133 134 ToTargetGroupAttachmentOutput() TargetGroupAttachmentOutput 135 ToTargetGroupAttachmentOutputWithContext(ctx context.Context) TargetGroupAttachmentOutput 136 } 137 138 func (*TargetGroupAttachment) ElementType() reflect.Type { 139 return reflect.TypeOf((**TargetGroupAttachment)(nil)).Elem() 140 } 141 142 func (i *TargetGroupAttachment) ToTargetGroupAttachmentOutput() TargetGroupAttachmentOutput { 143 return i.ToTargetGroupAttachmentOutputWithContext(context.Background()) 144 } 145 146 func (i *TargetGroupAttachment) ToTargetGroupAttachmentOutputWithContext(ctx context.Context) TargetGroupAttachmentOutput { 147 return pulumi.ToOutputWithContext(ctx, i).(TargetGroupAttachmentOutput) 148 } 149 150 // TargetGroupAttachmentArrayInput is an input type that accepts TargetGroupAttachmentArray and TargetGroupAttachmentArrayOutput values. 151 // You can construct a concrete instance of `TargetGroupAttachmentArrayInput` via: 152 // 153 // TargetGroupAttachmentArray{ TargetGroupAttachmentArgs{...} } 154 type TargetGroupAttachmentArrayInput interface { 155 pulumi.Input 156 157 ToTargetGroupAttachmentArrayOutput() TargetGroupAttachmentArrayOutput 158 ToTargetGroupAttachmentArrayOutputWithContext(context.Context) TargetGroupAttachmentArrayOutput 159 } 160 161 type TargetGroupAttachmentArray []TargetGroupAttachmentInput 162 163 func (TargetGroupAttachmentArray) ElementType() reflect.Type { 164 return reflect.TypeOf((*[]*TargetGroupAttachment)(nil)).Elem() 165 } 166 167 func (i TargetGroupAttachmentArray) ToTargetGroupAttachmentArrayOutput() TargetGroupAttachmentArrayOutput { 168 return i.ToTargetGroupAttachmentArrayOutputWithContext(context.Background()) 169 } 170 171 func (i TargetGroupAttachmentArray) ToTargetGroupAttachmentArrayOutputWithContext(ctx context.Context) TargetGroupAttachmentArrayOutput { 172 return pulumi.ToOutputWithContext(ctx, i).(TargetGroupAttachmentArrayOutput) 173 } 174 175 // TargetGroupAttachmentMapInput is an input type that accepts TargetGroupAttachmentMap and TargetGroupAttachmentMapOutput values. 176 // You can construct a concrete instance of `TargetGroupAttachmentMapInput` via: 177 // 178 // TargetGroupAttachmentMap{ "key": TargetGroupAttachmentArgs{...} } 179 type TargetGroupAttachmentMapInput interface { 180 pulumi.Input 181 182 ToTargetGroupAttachmentMapOutput() TargetGroupAttachmentMapOutput 183 ToTargetGroupAttachmentMapOutputWithContext(context.Context) TargetGroupAttachmentMapOutput 184 } 185 186 type TargetGroupAttachmentMap map[string]TargetGroupAttachmentInput 187 188 func (TargetGroupAttachmentMap) ElementType() reflect.Type { 189 return reflect.TypeOf((*map[string]*TargetGroupAttachment)(nil)).Elem() 190 } 191 192 func (i TargetGroupAttachmentMap) ToTargetGroupAttachmentMapOutput() TargetGroupAttachmentMapOutput { 193 return i.ToTargetGroupAttachmentMapOutputWithContext(context.Background()) 194 } 195 196 func (i TargetGroupAttachmentMap) ToTargetGroupAttachmentMapOutputWithContext(ctx context.Context) TargetGroupAttachmentMapOutput { 197 return pulumi.ToOutputWithContext(ctx, i).(TargetGroupAttachmentMapOutput) 198 } 199 200 type TargetGroupAttachmentOutput struct{ *pulumi.OutputState } 201 202 func (TargetGroupAttachmentOutput) ElementType() reflect.Type { 203 return reflect.TypeOf((**TargetGroupAttachment)(nil)).Elem() 204 } 205 206 func (o TargetGroupAttachmentOutput) ToTargetGroupAttachmentOutput() TargetGroupAttachmentOutput { 207 return o 208 } 209 210 func (o TargetGroupAttachmentOutput) ToTargetGroupAttachmentOutputWithContext(ctx context.Context) TargetGroupAttachmentOutput { 211 return o 212 } 213 214 // The target. 215 func (o TargetGroupAttachmentOutput) Target() TargetGroupAttachmentTargetOutput { 216 return o.ApplyT(func(v *TargetGroupAttachment) TargetGroupAttachmentTargetOutput { return v.Target }).(TargetGroupAttachmentTargetOutput) 217 } 218 219 // The ID or Amazon Resource Name (ARN) of the target group. 220 func (o TargetGroupAttachmentOutput) TargetGroupIdentifier() pulumi.StringOutput { 221 return o.ApplyT(func(v *TargetGroupAttachment) pulumi.StringOutput { return v.TargetGroupIdentifier }).(pulumi.StringOutput) 222 } 223 224 type TargetGroupAttachmentArrayOutput struct{ *pulumi.OutputState } 225 226 func (TargetGroupAttachmentArrayOutput) ElementType() reflect.Type { 227 return reflect.TypeOf((*[]*TargetGroupAttachment)(nil)).Elem() 228 } 229 230 func (o TargetGroupAttachmentArrayOutput) ToTargetGroupAttachmentArrayOutput() TargetGroupAttachmentArrayOutput { 231 return o 232 } 233 234 func (o TargetGroupAttachmentArrayOutput) ToTargetGroupAttachmentArrayOutputWithContext(ctx context.Context) TargetGroupAttachmentArrayOutput { 235 return o 236 } 237 238 func (o TargetGroupAttachmentArrayOutput) Index(i pulumi.IntInput) TargetGroupAttachmentOutput { 239 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *TargetGroupAttachment { 240 return vs[0].([]*TargetGroupAttachment)[vs[1].(int)] 241 }).(TargetGroupAttachmentOutput) 242 } 243 244 type TargetGroupAttachmentMapOutput struct{ *pulumi.OutputState } 245 246 func (TargetGroupAttachmentMapOutput) ElementType() reflect.Type { 247 return reflect.TypeOf((*map[string]*TargetGroupAttachment)(nil)).Elem() 248 } 249 250 func (o TargetGroupAttachmentMapOutput) ToTargetGroupAttachmentMapOutput() TargetGroupAttachmentMapOutput { 251 return o 252 } 253 254 func (o TargetGroupAttachmentMapOutput) ToTargetGroupAttachmentMapOutputWithContext(ctx context.Context) TargetGroupAttachmentMapOutput { 255 return o 256 } 257 258 func (o TargetGroupAttachmentMapOutput) MapIndex(k pulumi.StringInput) TargetGroupAttachmentOutput { 259 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *TargetGroupAttachment { 260 return vs[0].(map[string]*TargetGroupAttachment)[vs[1].(string)] 261 }).(TargetGroupAttachmentOutput) 262 } 263 264 func init() { 265 pulumi.RegisterInputType(reflect.TypeOf((*TargetGroupAttachmentInput)(nil)).Elem(), &TargetGroupAttachment{}) 266 pulumi.RegisterInputType(reflect.TypeOf((*TargetGroupAttachmentArrayInput)(nil)).Elem(), TargetGroupAttachmentArray{}) 267 pulumi.RegisterInputType(reflect.TypeOf((*TargetGroupAttachmentMapInput)(nil)).Elem(), TargetGroupAttachmentMap{}) 268 pulumi.RegisterOutputType(TargetGroupAttachmentOutput{}) 269 pulumi.RegisterOutputType(TargetGroupAttachmentArrayOutput{}) 270 pulumi.RegisterOutputType(TargetGroupAttachmentMapOutput{}) 271 }