167 lines
5.6 KiB
TypeScript
167 lines
5.6 KiB
TypeScript
import type { Construct } from 'constructs';
|
|
import * as cloudwatch from '../../../aws-cloudwatch';
|
|
import type { ITargetGroupRef } from '../elasticloadbalancingv2.generated';
|
|
import type { INetworkListenerRef } from './network-listener';
|
|
import type { BaseTargetGroupProps, ITargetGroup, LoadBalancerTargetProps, TargetGroupAttributes } from '../shared/base-target-group';
|
|
import { TargetGroupBase } from '../shared/base-target-group';
|
|
import { Protocol } from '../shared/enums';
|
|
/**
|
|
* Properties for a new Network Target Group
|
|
*/
|
|
export interface NetworkTargetGroupProps extends BaseTargetGroupProps {
|
|
/**
|
|
* The port on which the target receives traffic.
|
|
*/
|
|
readonly port: number;
|
|
/**
|
|
* Protocol for target group, expects TCP, TLS, UDP, or TCP_UDP.
|
|
*
|
|
* @default - TCP
|
|
*/
|
|
readonly protocol?: Protocol;
|
|
/**
|
|
* Indicates whether Proxy Protocol version 2 is enabled.
|
|
*
|
|
* @default false
|
|
*/
|
|
readonly proxyProtocolV2?: boolean;
|
|
/**
|
|
* Indicates whether client IP preservation is enabled.
|
|
*
|
|
* @default false if the target group type is IP address and the
|
|
* target group protocol is TCP or TLS. Otherwise, true.
|
|
*/
|
|
readonly preserveClientIp?: boolean;
|
|
/**
|
|
* The targets to add to this target group.
|
|
*
|
|
* Can be `Instance`, `IPAddress`, or any self-registering load balancing
|
|
* target. If you use either `Instance` or `IPAddress` as targets, all
|
|
* target must be of the same type.
|
|
*
|
|
* @default - No targets.
|
|
*/
|
|
readonly targets?: INetworkLoadBalancerTarget[];
|
|
/**
|
|
*
|
|
* Indicates whether the load balancer terminates connections at
|
|
* the end of the deregistration timeout.
|
|
*
|
|
* @default false
|
|
*/
|
|
readonly connectionTermination?: boolean;
|
|
}
|
|
/**
|
|
* Contains all metrics for a Target Group of a Network Load Balancer.
|
|
*/
|
|
export interface INetworkTargetGroupMetrics {
|
|
/**
|
|
* Return the given named metric for this Network Target Group
|
|
*
|
|
* @default Average over 5 minutes
|
|
*/
|
|
custom(metricName: string, props?: cloudwatch.MetricOptions): cloudwatch.Metric;
|
|
/**
|
|
* The number of targets that are considered healthy.
|
|
*
|
|
* @default Average over 5 minutes
|
|
*/
|
|
healthyHostCount(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
|
|
/**
|
|
* The number of targets that are considered unhealthy.
|
|
*
|
|
* @default Average over 5 minutes
|
|
*/
|
|
unHealthyHostCount(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
|
|
}
|
|
/**
|
|
* Define a Network Target Group
|
|
*/
|
|
export declare class NetworkTargetGroup extends TargetGroupBase implements INetworkTargetGroup {
|
|
/**
|
|
* Uniquely identifies this class.
|
|
*/
|
|
static readonly PROPERTY_INJECTION_ID: string;
|
|
/**
|
|
* Import an existing target group
|
|
*/
|
|
static fromTargetGroupAttributes(scope: Construct, id: string, attrs: TargetGroupAttributes): INetworkTargetGroup;
|
|
readonly isNetworkTargetGroup = true;
|
|
private readonly listeners;
|
|
private _metrics?;
|
|
constructor(scope: Construct, id: string, props: NetworkTargetGroupProps);
|
|
get metrics(): INetworkTargetGroupMetrics;
|
|
/**
|
|
* Add a load balancing target to this target group
|
|
*/
|
|
addTarget(...targets: INetworkLoadBalancerTarget[]): void;
|
|
/**
|
|
* Register a listener that is load balancing to this target group.
|
|
*
|
|
* Don't call this directly. It will be called by listeners.
|
|
*/
|
|
registerListener(listener: INetworkListenerRef): void;
|
|
/**
|
|
* The number of targets that are considered healthy.
|
|
*
|
|
* @default Average over 5 minutes
|
|
* @deprecated Use ``NetworkTargetGroup.metrics.healthyHostCount`` instead
|
|
*/
|
|
metricHealthyHostCount(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
|
|
/**
|
|
* The number of targets that are considered unhealthy.
|
|
*
|
|
* @default Average over 5 minutes
|
|
* @deprecated Use ``NetworkTargetGroup.metrics.healthyHostCount`` instead
|
|
*/
|
|
metricUnHealthyHostCount(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
|
|
/**
|
|
* Full name of first load balancer
|
|
*/
|
|
get firstLoadBalancerFullName(): string;
|
|
protected validateTargetGroup(): string[];
|
|
}
|
|
/**
|
|
* Indicates that this resource can be referenced as an NLB TargetGroup
|
|
*/
|
|
export interface INetworkTargetGroupRef extends ITargetGroupRef {
|
|
/**
|
|
* Indicates that this is a Network Target Group
|
|
*
|
|
* Will always return true, but is necessary to prevent accidental structural
|
|
* equality in TypeScript.
|
|
*/
|
|
readonly isNetworkTargetGroup: boolean;
|
|
}
|
|
/**
|
|
* A network target group
|
|
*/
|
|
export interface INetworkTargetGroup extends ITargetGroup, INetworkTargetGroupRef {
|
|
/**
|
|
* All metrics available for this target group.
|
|
*/
|
|
readonly metrics: INetworkTargetGroupMetrics;
|
|
/**
|
|
* Register a listener that is load balancing to this target group.
|
|
*
|
|
* Don't call this directly. It will be called by listeners.
|
|
*/
|
|
registerListener(listener: INetworkListenerRef): void;
|
|
/**
|
|
* Add a load balancing target to this target group
|
|
*/
|
|
addTarget(...targets: INetworkLoadBalancerTarget[]): void;
|
|
}
|
|
/**
|
|
* Interface for constructs that can be targets of an network load balancer
|
|
*/
|
|
export interface INetworkLoadBalancerTarget {
|
|
/**
|
|
* Attach load-balanced target to a TargetGroup
|
|
*
|
|
* May return JSON to directly add to the [Targets] list, or return undefined
|
|
* if the target will register itself with the load balancer.
|
|
*/
|
|
attachToNetworkTargetGroup(targetGroup: INetworkTargetGroup): LoadBalancerTargetProps;
|
|
}
|