Package com.pulumi.aws.vpclattice
Class Listener
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.vpclattice.Listener
-
public class Listener extends com.pulumi.resources.CustomResourceResource for managing an AWS VPC Lattice Listener. ## Example Usage ### Fixed response action
### Forward actionpackage generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.vpclattice.Service; import com.pulumi.aws.vpclattice.ServiceArgs; import com.pulumi.aws.vpclattice.Listener; import com.pulumi.aws.vpclattice.ListenerArgs; import com.pulumi.aws.vpclattice.inputs.ListenerDefaultActionArgs; import com.pulumi.aws.vpclattice.inputs.ListenerDefaultActionFixedResponseArgs; import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var example = new Service("example", ServiceArgs.builder() .name("example") .build()); var exampleListener = new Listener("exampleListener", ListenerArgs.builder() .defaultAction(ListenerDefaultActionArgs.builder() .fixedResponse(ListenerDefaultActionFixedResponseArgs.builder() .statusCode(404) .build()) .build()) .name("example") .protocol("HTTPS") .serviceIdentifier(example.id()) .build()); } }
### Forward action with weighted target groupspackage generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.vpclattice.Service; import com.pulumi.aws.vpclattice.ServiceArgs; import com.pulumi.aws.vpclattice.TargetGroup; import com.pulumi.aws.vpclattice.TargetGroupArgs; import com.pulumi.aws.vpclattice.inputs.TargetGroupConfigArgs; import com.pulumi.aws.vpclattice.Listener; import com.pulumi.aws.vpclattice.ListenerArgs; import com.pulumi.aws.vpclattice.inputs.ListenerDefaultActionArgs; import com.pulumi.aws.vpclattice.inputs.ListenerDefaultActionForwardArgs; import com.pulumi.aws.vpclattice.inputs.ListenerDefaultActionForwardTargetGroupArgs; import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var example = new Service("example", ServiceArgs.builder() .name("example") .build()); var exampleTargetGroup = new TargetGroup("exampleTargetGroup", TargetGroupArgs.builder() .config(TargetGroupConfigArgs.builder() .port(80) .protocol("HTTP") .vpcIdentifier(exampleAwsVpc.id()) .build()) .name("example-target-group-1") .type("INSTANCE") .build()); var exampleListener = new Listener("exampleListener", ListenerArgs.builder() .defaultAction(ListenerDefaultActionArgs.builder() .forwards(ListenerDefaultActionForwardArgs.builder() .targetGroups(ListenerDefaultActionForwardTargetGroupArgs.builder() .targetGroupIdentifier(exampleTargetGroup.id()) .build()) .build()) .build()) .name("example") .protocol("HTTP") .serviceIdentifier(example.id()) .build()); } }
## Import Using `pulumi import`, import VPC Lattice Listener using the `listenerId` of the listener and the `id` of the VPC Lattice service combined with a `/` character. For example: ```sh $ pulumi import aws:vpclattice/listener:Listener example svc-1a2b3c4d/listener-987654321 ```package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.vpclattice.Service; import com.pulumi.aws.vpclattice.ServiceArgs; import com.pulumi.aws.vpclattice.TargetGroup; import com.pulumi.aws.vpclattice.TargetGroupArgs; import com.pulumi.aws.vpclattice.inputs.TargetGroupConfigArgs; import com.pulumi.aws.vpclattice.Listener; import com.pulumi.aws.vpclattice.ListenerArgs; import com.pulumi.aws.vpclattice.inputs.ListenerDefaultActionArgs; import com.pulumi.aws.vpclattice.inputs.ListenerDefaultActionForwardArgs; import com.pulumi.aws.vpclattice.inputs.ListenerDefaultActionForwardTargetGroupArgs; import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var example = new Service("example", ServiceArgs.builder() .name("example") .build()); var example1 = new TargetGroup("example1", TargetGroupArgs.builder() .config(TargetGroupConfigArgs.builder() .port(80) .protocol("HTTP") .vpcIdentifier(exampleAwsVpc.id()) .build()) .name("example-target-group-1") .type("INSTANCE") .build()); var example2 = new TargetGroup("example2", TargetGroupArgs.builder() .config(TargetGroupConfigArgs.builder() .port(8080) .protocol("HTTP") .vpcIdentifier(exampleAwsVpc.id()) .build()) .name("example-target-group-2") .type("INSTANCE") .build()); var exampleListener = new Listener("exampleListener", ListenerArgs.builder() .defaultAction(ListenerDefaultActionArgs.builder() .forwards(ListenerDefaultActionForwardArgs.builder() .targetGroups( ListenerDefaultActionForwardTargetGroupArgs.builder() .targetGroupIdentifier(example1.id()) .weight(80) .build(), ListenerDefaultActionForwardTargetGroupArgs.builder() .targetGroupIdentifier(example2.id()) .weight(20) .build()) .build()) .build()) .name("example") .protocol("HTTP") .serviceIdentifier(example.id()) .build()); } }
-
-
Constructor Summary
Constructors Constructor Description Listener(java.lang.String name)Listener(java.lang.String name, ListenerArgs args)Listener(java.lang.String name, ListenerArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.lang.String>arn()com.pulumi.core.Output<java.lang.String>createdAt()com.pulumi.core.Output<ListenerDefaultAction>defaultAction()static Listenerget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, ListenerState state, com.pulumi.resources.CustomResourceOptions options)Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.lang.String>lastUpdatedAt()com.pulumi.core.Output<java.lang.String>listenerId()com.pulumi.core.Output<java.lang.String>name()com.pulumi.core.Output<java.lang.Integer>port()com.pulumi.core.Output<java.lang.String>protocol()com.pulumi.core.Output<java.lang.String>region()com.pulumi.core.Output<java.lang.String>serviceArn()com.pulumi.core.Output<java.lang.String>serviceIdentifier()com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>>tags()com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>>tagsAll()
-
-
-
Constructor Detail
-
Listener
public Listener(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
Listener
public Listener(java.lang.String name, ListenerArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
Listener
public Listener(java.lang.String name, ListenerArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.options- A bag of options that control this resource's behavior.
-
-
Method Detail
-
arn
public com.pulumi.core.Output<java.lang.String> arn()
- Returns:
- ARN of the listener.
-
createdAt
public com.pulumi.core.Output<java.lang.String> createdAt()
- Returns:
- Date and time that the listener was created, specified in ISO-8601 format.
-
defaultAction
public com.pulumi.core.Output<ListenerDefaultAction> defaultAction()
- Returns:
- Default action block for the default listener rule. Default action blocks are defined below.
-
lastUpdatedAt
public com.pulumi.core.Output<java.lang.String> lastUpdatedAt()
- Returns:
- Date and time that the listener was last updated, specified in ISO-8601 format.
-
listenerId
public com.pulumi.core.Output<java.lang.String> listenerId()
- Returns:
- Standalone ID of the listener, e.g. `listener-0a1b2c3d4e5f6g`.
-
name
public com.pulumi.core.Output<java.lang.String> name()
- Returns:
- Name of the listener. A listener name must be unique within a service. Valid characters are a-z, 0-9, and hyphens (-). You can't use a hyphen as the first or last character, or immediately after another hyphen.
-
port
public com.pulumi.core.Output<java.lang.Integer> port()
- Returns:
- Listener port. You can specify a value from 1 to 65535. If `port` is not specified and `protocol` is HTTP, the value will default to 80. If `port` is not specified and `protocol` is HTTPS, the value will default to 443.
-
protocol
public com.pulumi.core.Output<java.lang.String> protocol()
- Returns:
- Protocol for the listener. Supported values are `HTTP`, `HTTPS` or `TLS_PASSTHROUGH`
-
region
public com.pulumi.core.Output<java.lang.String> region()
- Returns:
- Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
-
serviceArn
public com.pulumi.core.Output<java.lang.String> serviceArn()
- Returns:
- ARN of the VPC Lattice service. You must include either the `serviceArn` or `serviceIdentifier` arguments.
-
serviceIdentifier
public com.pulumi.core.Output<java.lang.String> serviceIdentifier()
- Returns:
- ID of the VPC Lattice service. You must include either the `serviceArn` or `serviceIdentifier` arguments. > **NOTE:** You must specify one of the following arguments: `serviceArn` or `serviceIdentifier`.
-
tags
public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>> tags()
- Returns:
- Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
-
tagsAll
public com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>> tagsAll()
-
get
public static Listener get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable ListenerState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name- The _unique_ name of the resulting resource.id- The _unique_ provider ID of the resource to lookup.state-options- Optional settings to control the behavior of the CustomResource.
-
-