import type { IResource, RemovalPolicy } from 'aws-cdk-lib'; import { Resource } from 'aws-cdk-lib'; import type { Construct } from 'constructs'; import type { IMatchHeader } from './match-header'; import type { IMatchPath } from './match-path'; import type { IRuleAction } from './rule-action'; import type { Service } from './service'; import { type HttpMethod } from './util'; /** * It is not required that the listener and target group protocols match. * VPC Lattice manages the entire process of upgrading and downgrading between protocols and versions. */ export declare enum ListenerProtocol { /** * HTTP Protocol * @see https://docs.aws.amazon.com/vpc-lattice/latest/ug/http-listeners.html */ HTTP = "HTTP", /** * HTTPS Protocol * VPC Lattice will provision and manage a TLS certificate that is associated * with the VPC Lattice generated FQDN. * @see https://docs.aws.amazon.com/vpc-lattice/latest/ug/https-listeners.html */ HTTPS = "HTTPS", /** * TLS Passthrough. This ensures that your application * decrypts the encrypted traffic instead of VPC Lattice. */ TLS_PASSTHROUGH = "TLS_PASSTHROUGH" } /** * Create a VPC Lattice Listener. It is simply a process that checks for * connection requests, and routes them to targets in a target group according * to the defined rules. * Implemented by `Listener`. * @see https://docs.aws.amazon.com/vpc-lattice/latest/ug/listeners.html */ export interface IListener extends IResource { /** * The Amazon Resource Name (ARN) of the service. */ readonly listenerArn: string; /** * The Id of the Service Network * @attribute */ readonly listenerId: string; /** * Add A Rule to the Listener */ addRule(rule: AddRuleProps): void; } /** * Properties to Create a Lattice Listener */ export interface ListenerProps { /** * The Id of the service that this listener is associated with. */ readonly service: Service; /** * The Name of the listener. */ readonly name?: string; /** * Protocol that the listener will listen on */ readonly protocol?: ListenerProtocol; /** * Optional port number for the listener. If not supplied, will default to 80 or 443, depending on the Protocol. * @default - 80 or 443 depending on the Protocol */ readonly port?: number; /** * * A default action that will be taken if no rules match. * @default HTTPFixedResponse.NOT_FOUND */ readonly defaultAction?: IRuleAction; /** * Rules to add to the listener. */ readonly rules?: AddRuleProps[]; /** * Determine what happens to the service when the resource/stack is deleted. * * @default RemovalPolicy.RETAIN */ readonly removalPolicy?: RemovalPolicy; } /** * A listener is a process that checks for connection requests, using the protocol * and port that you configure. The rules that you define for a listener determine * how the service routes requests to its registered targets. * * **This class should not be called directly**. * Use the `.addListener()` method on an instance of a Service construct. * @resource AWS::VpcLattice::Listener * */ export declare class Listener extends Resource implements IListener { readonly listenerArn: string; readonly listenerId: string; /** * The listener protocol */ readonly protocol: ListenerProtocol; /** * The listener port. */ readonly port: number; /** * The name of the listener */ readonly name?: string; /** * The default action for this listener */ readonly defaultAction: IRuleAction; /** * The service this listener is attached to */ readonly service: Service; /** * The listener rules to add */ rules: AddRuleProps[]; private readonly _resource; constructor(scope: Construct, id: string, props: ListenerProps); /** * Verifies a valid protocol / target Type combination */ protected validatePort(): string[]; protected validateListenerName(name: string): string[]; protected validateRulePriorities(): string[]; /** * Adds a rule to the listener * @param rule */ addRule(rule: AddRuleProps): void; } export interface AddRuleProps { /** * the action for the rule, is either a fixed Response, or a being sent to Weighted TargetGroup */ readonly action: IRuleAction; /** * The method to match for the rule */ readonly matchMethod?: HttpMethod; /** * The headers to match for the rule */ readonly matchHeader?: IMatchHeader[]; /** * The path to match for the rule */ readonly matchPath?: IMatchPath; /** * A name for the the Rule */ readonly name: string; /** * The priority of this rule, a lower priority will be processed first */ readonly priority: number; }