# IGateway

Interface for Gateway resources.

Extends: [IResource](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResource.html), [IGatewayRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_bedrockagentcore.IGatewayRef.html)
Implemented by: [Gateway](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.Gateway.html), [GatewayBase](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.GatewayBase.html)
Obtainable from: [Gateway.fromGatewayAttributes](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.Gateway.html#fromgatewayattributes)
Used as argument in: [ICredentialProviderConfig.grantNeededPermissionsToRole](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.ICredentialProviderConfig.html#grantneededpermissionstorole), IInterceptor.bind, IPolicyEngine.grantEvaluateForGateway, ITargetConfiguration.bind

- Source: [`lib/gateway/gateway-base.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/@aws-cdk/aws-bedrock-agentcore-alpha/lib/gateway/gateway-base.ts#L37)

## Properties

- `authorizerConfiguration`: [IGatewayAuthorizerConfig](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.IGatewayAuthorizerConfig.html) — The authorizer configuration for the gateway.

- `createdAt`: string — Timestamp when the gateway was created.

- `description`: string — The description of the gateway.

- `env`: [ResourceEnvironment](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) — The environment this resource belongs to.

  For resources that are created and managed in a Stack (those created by
  creating new class instances like `new Role()`, `new Bucket()`, etc.), this
  is always the same as the environment of the stack they belong to.

  For referenced resources (those obtained from referencing methods like
  `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
  different than the stack they were imported into.

- `exceptionLevel`: [GatewayExceptionLevel](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.GatewayExceptionLevel.html) — The exception level for the gateway.

- `gatewayArn`: string — The ARN of the gateway resource.

- `gatewayId`: string — The id of the gateway.

- `gatewayRef`: [GatewayReference](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_bedrockagentcore.GatewayReference.html) — A reference to a Gateway resource.

- `gatewayUrl`: string — The URL endpoint for the gateway.

- `kmsKey`: [IKey](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kms.IKey.html) — The KMS key used for encryption.

- `name`: string — The name of the gateway.

- `node`: [Node](https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `protocolConfiguration`: [IGatewayProtocolConfig](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.IGatewayProtocolConfig.html) — The protocol configuration for the gateway.

- `role`: [IRole](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) — The IAM role that provides permissions for the gateway to access AWS services.

- `stack`: [Stack](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stack.html) — The stack in which this resource is defined.

- `status`: string — The status of the gateway.

- `statusReason`: string[] — The status reasons for the gateway.

- `updatedAt`: string — Timestamp when the gateway was last updated.

## Methods

- `applyRemovalPolicy(policy: RemovalPolicy): void` — Apply the given removal policy to this resource.

  The Removal Policy controls what happens to this resource when it stops
  being managed by CloudFormation, either because you've removed it from the
  CDK application or because you've made a change that requires the resource
  to be replaced.

  The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
  account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).

- `grant(grantee: IGrantable, ...actions: string[]): Grant` — Grants IAM actions to the IAM Principal.

- `grantInvoke(grantee: IGrantable): Grant` — Grants permission to invoke this Gateway.

- `grantManage(grantee: IGrantable): Grant` — Grants `Create`, `Update`, and `Delete` actions on the Gateway.

- `grantRead(grantee: IGrantable): Grant` — Grants `Get` and `List` actions on the Gateway.

- `metric(metricName: string, dimensions: { [key: string]: string }, props?: MetricOptions): Metric` — Return the given named metric for this gateway.

  **Parameters**

  - `metricName` — The name of the metric.
  - `dimensions` — Additional dimensions for the metric.
  - `props` — Optional metric configuration.

- `metricDuration(props?: MetricOptions): Metric` — Return a metric measuring the duration of requests for this gateway.

  The duration metric represents the total time elapsed between receiving the request
  and sending the final response token, representing complete end-to-end processing time.

  **Parameters**

  - `props` — Optional metric configuration.

- `metricInvocations(props?: MetricOptions): Metric` — Return a metric containing the total number of invocations for this gateway.

  This metric tracks all successful invocations of the gateway.

  **Parameters**

  - `props` — Optional metric configuration.

- `metricLatency(props?: MetricOptions): Metric` — Return a metric measuring the latency of requests for this gateway.

  The latency metric represents the time elapsed between when the service receives
  the request and when it begins sending the first response token.

  **Parameters**

  - `props` — Optional metric configuration.

- `metricSystemErrors(props?: MetricOptions): Metric` — Return a metric containing the number of system errors (5xx status code) for this gateway.

  This metric tracks internal server errors and system failures.

  **Parameters**

  - `props` — Optional metric configuration.

- `metricTargetExecutionTime(props?: MetricOptions): Metric` — Return a metric measuring the target execution time for this gateway.

  This metric helps determine the contribution of the target (Lambda, OpenAPI, etc.)
  to the total latency.

  **Parameters**

  - `props` — Optional metric configuration.

- `metricTargetType(targetType: string, props?: MetricOptions): Metric` — Return a metric containing the number of requests served by each target type for this gateway.

  **Parameters**

  - `targetType` — The type of target (e.g., 'Lambda', 'OpenAPI', 'Smithy').
  - `props` — Optional metric configuration.

- `metricThrottles(props?: MetricOptions): Metric` — Return a metric containing the number of throttled requests (429 status code) for this gateway.

  This metric helps identify when the gateway is rate limiting requests.

  **Parameters**

  - `props` — Optional metric configuration.

- `metricUserErrors(props?: MetricOptions): Metric` — Return a metric containing the number of user errors (4xx status code, excluding 429) for this gateway.

  This metric tracks client errors like bad requests, unauthorized access, etc.

  **Parameters**

  - `props` — Optional metric configuration.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.

  **Parameters**

  - `mixins` — The mixins to apply.

  **Returns:** This construct for chaining
