apigateway

package
v0.0.1-alpha.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package apigateway provides emulation of Amazon API Gateway (REST v1 + HTTP v2).

Implements:

REST v1: CreateRestApi, GetRestApi, GetRestApis, DeleteRestApi, UpdateRestApi,
  CreateResource, GetResource, GetResources, DeleteResource,
  PutMethod, GetMethod, DeleteMethod,
  PutIntegration, GetIntegration, DeleteIntegration,
  PutMethodResponse, PutIntegrationResponse,
  CreateDeployment, GetDeployments, CreateStage, GetStage, GetStages, UpdateStage, DeleteStage,
  CreateAuthorizer, GetAuthorizer, GetAuthorizers, DeleteAuthorizer,
  CreateApiKey, GetApiKey, GetApiKeys, DeleteApiKey,
  CreateUsagePlan, GetUsagePlan, GetUsagePlans, DeleteUsagePlan,
  CreateUsagePlanKey, GetUsagePlanKeys, DeleteUsagePlanKey
HTTP v2: CreateApi, GetApi, GetApis, UpdateApi, DeleteApi,
  CreateRoute, GetRoute, GetRoutes, DeleteRoute,
  CreateIntegration, GetIntegration, GetIntegrations, DeleteIntegration,
  CreateDeploymentV2, GetDeploymentsV2, CreateStageV2, GetStageV2, GetStagesV2, DeleteStageV2,
  CreateAuthorizer, GetAuthorizer, GetAuthorizers, DeleteAuthorizer
Execution: Lambda proxy (AWS_PROXY), MOCK integrations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKey

type APIKey struct {
	ID          string            `json:"id"`
	Name        string            `json:"name"`
	Value       string            `json:"value"`
	Description string            `json:"description,omitempty"`
	Enabled     bool              `json:"enabled"`
	CreatedDate int64             `json:"createdDate"`
	Tags        map[string]string `json:"tags,omitempty"`
	StageKeys   []string          `json:"stageKeys,omitempty"` // "{restApiId}/{stageName}"

}

APIKey represents an API key used for authentication.

type APIV2

type APIV2 struct {
	ApiID                    string            `json:"apiId"`
	Name                     string            `json:"name"`
	ProtocolType             string            `json:"protocolType"` // HTTP, WEBSOCKET
	Description              string            `json:"description,omitempty"`
	RouteSelectionExpression string            `json:"routeSelectionExpression,omitempty"`
	CorsConfiguration        *CorsConfig       `json:"corsConfiguration,omitempty"`
	CreatedDate              string            `json:"createdDate"`
	Tags                     map[string]string `json:"tags,omitempty"`
	Version                  string            `json:"version,omitempty"`
	DisableExecuteAPI        bool              `json:"disableExecuteApiEndpoint,omitempty"`
}

APIV2 represents an HTTP (or WebSocket) API.

type ApiMapping

type ApiMapping struct {
	ApiMappingID  string `json:"apiMappingId"`
	ApiID         string `json:"apiId"`
	Stage         string `json:"stage"`
	ApiMappingKey string `json:"apiMappingKey,omitempty"`
}

ApiMapping maps a domain name to an HTTP API stage.

type Authorizer

type Authorizer struct {
	ID                           string   `json:"id"`
	Name                         string   `json:"name"`
	Type                         string   `json:"type"` // TOKEN, REQUEST, COGNITO_USER_POOLS
	AuthorizerURI                string   `json:"authorizerUri,omitempty"`
	AuthorizerCredentials        string   `json:"authorizerCredentials,omitempty"`
	IdentitySource               string   `json:"identitySource,omitempty"`
	IdentityValidationExpression string   `json:"identityValidationExpression,omitempty"`
	AuthorizerResultTTLInSeconds int      `json:"authorizerResultTtlInSeconds,omitempty"`
	ProviderARNs                 []string `json:"providerARNs,omitempty"`
}

Authorizer represents a REST API authorizer. TODO(priority:P2): implement authorizer CRUD and invocation during request execution.

type AuthorizerV2

type AuthorizerV2 struct {
	AuthorizerID                 string     `json:"authorizerId"`
	Name                         string     `json:"name"`
	AuthorizerType               string     `json:"authorizerType"` // REQUEST, JWT
	IdentitySource               string     `json:"identitySource,omitempty"`
	AuthorizerURI                string     `json:"authorizerUri,omitempty"`
	AuthorizerCredentialsArn     string     `json:"authorizerCredentialsArn,omitempty"`
	AuthorizerResultTTLInSeconds int        `json:"authorizerResultTtlInSeconds,omitempty"`
	JwtConfiguration             *JwtConfig `json:"jwtConfiguration,omitempty"`
}

AuthorizerV2 represents an HTTP API authorizer. TODO(priority:P2): implement v2 authorizer CRUD — especially JWT authorizer for HTTP APIs.

type BasePathMapping

type BasePathMapping struct {
	BasePath  string `json:"basePath"`
	RestApiID string `json:"restApiId"`
	Stage     string `json:"stage,omitempty"`
}

BasePathMapping maps a base path under a custom domain to a REST API stage.

type CorsConfig

type CorsConfig struct {
	AllowCredentials bool     `json:"allowCredentials,omitempty"`
	AllowHeaders     []string `json:"allowHeaders,omitempty"`
	AllowMethods     []string `json:"allowMethods,omitempty"`
	AllowOrigins     []string `json:"allowOrigins,omitempty"`
	ExposeHeaders    []string `json:"exposeHeaders,omitempty"`
	MaxAge           int      `json:"maxAge,omitempty"`
}

CorsConfig is the CORS configuration for an HTTP API.

type Deployment

type Deployment struct {
	ID          string `json:"id"`
	Description string `json:"description,omitempty"`
	CreatedDate int64  `json:"createdDate"`
}

Deployment represents a snapshot of the API at a point in time.

type DeploymentV2

type DeploymentV2 struct {
	DeploymentID     string `json:"deploymentId"`
	Description      string `json:"description,omitempty"`
	AutoDeployed     bool   `json:"autoDeployed,omitempty"`
	CreatedDate      string `json:"createdDate"`
	DeploymentStatus string `json:"deploymentStatus,omitempty"` // PENDING, FAILED, DEPLOYED
}

DeploymentV2 represents a deployment snapshot in an HTTP API.

type DomainName

type DomainName struct {
	DomainName             string            `json:"domainName"`
	CertificateArn         string            `json:"certificateArn,omitempty"`
	CertificateName        string            `json:"certificateName,omitempty"`
	DistributionDomainName string            `json:"distributionDomainName,omitempty"`
	RegionalDomainName     string            `json:"regionalDomainName,omitempty"`
	RegionalCertificateArn string            `json:"regionalCertificateArn,omitempty"`
	SecurityPolicy         string            `json:"securityPolicy,omitempty"`
	Tags                   map[string]string `json:"tags,omitempty"`
}

DomainName represents a custom domain name for a REST API.

type DomainNameConfig

type DomainNameConfig struct {
	ApiGatewayDomainName string `json:"apiGatewayDomainName,omitempty"`
	CertificateArn       string `json:"certificateArn,omitempty"`
	EndpointType         string `json:"endpointType,omitempty"` // REGIONAL, EDGE
	SecurityPolicy       string `json:"securityPolicy,omitempty"`
}

DomainNameConfig describes a domain name configuration entry.

type DomainNameV2

type DomainNameV2 struct {
	DomainName               string             `json:"domainName"`
	DomainNameConfigurations []DomainNameConfig `json:"domainNameConfigurations,omitempty"`
	Tags                     map[string]string  `json:"tags,omitempty"`
}

DomainNameV2 represents a custom domain name for an HTTP API.

type EndpointConfig

type EndpointConfig struct {
	Types []string `json:"types"` // REGIONAL, EDGE, PRIVATE
}

EndpointConfig describes the API endpoint type.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler holds API Gateway handler dependencies.

func (*Handler) CreateApiKey

func (h *Handler) CreateApiKey(w http.ResponseWriter, r *http.Request)

CreateApiKey handles POST /apikeys.

func (*Handler) CreateAuthorizer

func (h *Handler) CreateAuthorizer(w http.ResponseWriter, r *http.Request)

CreateAuthorizer handles POST /restapis/{restApiId}/authorizers.

func (*Handler) CreateBasePathMapping

func (h *Handler) CreateBasePathMapping(w http.ResponseWriter, r *http.Request)

CreateBasePathMapping handles POST /domainnames/{domainName}/basepathmappings.

func (*Handler) CreateDeployment

func (h *Handler) CreateDeployment(w http.ResponseWriter, r *http.Request)

func (*Handler) CreateDomainName

func (h *Handler) CreateDomainName(w http.ResponseWriter, r *http.Request)

CreateDomainName handles POST /domainnames.

func (*Handler) CreateModel

func (h *Handler) CreateModel(w http.ResponseWriter, r *http.Request)

CreateModel handles POST /restapis/{restApiId}/models.

func (*Handler) CreateRequestValidator

func (h *Handler) CreateRequestValidator(w http.ResponseWriter, r *http.Request)

CreateRequestValidator handles POST /restapis/{restApiId}/requestvalidators.

func (*Handler) CreateResource

func (h *Handler) CreateResource(w http.ResponseWriter, r *http.Request)

func (*Handler) CreateRestApi

func (h *Handler) CreateRestApi(w http.ResponseWriter, r *http.Request)

func (*Handler) CreateStage

func (h *Handler) CreateStage(w http.ResponseWriter, r *http.Request)

func (*Handler) CreateUsagePlan

func (h *Handler) CreateUsagePlan(w http.ResponseWriter, r *http.Request)

CreateUsagePlan handles POST /usageplans.

Per the AWS API Gateway REST API reference, `name` is optional on CreateUsagePlan — if omitted, AWS auto-generates one. This matches the behaviour of CDK's `RestApi.addUsagePlan({ apiStages: [...] })`, which does not set a name.

func (*Handler) CreateUsagePlanKey

func (h *Handler) CreateUsagePlanKey(w http.ResponseWriter, r *http.Request)

CreateUsagePlanKey handles POST /usageplans/{usagePlanId}/keys.

func (*Handler) CreateV2Api

func (h *Handler) CreateV2Api(w http.ResponseWriter, r *http.Request)

func (*Handler) CreateV2ApiMapping

func (h *Handler) CreateV2ApiMapping(w http.ResponseWriter, r *http.Request)

CreateV2ApiMapping handles POST /v2/domainnames/{domainName}/apimappings.

func (*Handler) CreateV2Authorizer

func (h *Handler) CreateV2Authorizer(w http.ResponseWriter, r *http.Request)

CreateV2Authorizer handles POST /v2/apis/{apiId}/authorizers.

func (*Handler) CreateV2Deployment

func (h *Handler) CreateV2Deployment(w http.ResponseWriter, r *http.Request)

func (*Handler) CreateV2DomainName

func (h *Handler) CreateV2DomainName(w http.ResponseWriter, r *http.Request)

CreateV2DomainName handles POST /v2/domainnames.

func (*Handler) CreateV2Integration

func (h *Handler) CreateV2Integration(w http.ResponseWriter, r *http.Request)

func (*Handler) CreateV2Route

func (h *Handler) CreateV2Route(w http.ResponseWriter, r *http.Request)

func (*Handler) CreateV2Stage

func (h *Handler) CreateV2Stage(w http.ResponseWriter, r *http.Request)
func (h *Handler) CreateV2VpcLink(w http.ResponseWriter, r *http.Request)

CreateV2VpcLink handles POST /v2/vpclinks.

func (h *Handler) CreateVpcLink(w http.ResponseWriter, r *http.Request)

CreateVpcLink handles POST /vpclinks.

func (*Handler) DeleteApiKey

func (h *Handler) DeleteApiKey(w http.ResponseWriter, r *http.Request)

DeleteApiKey handles DELETE /apikeys/{apiKey}.

func (*Handler) DeleteAuthorizer

func (h *Handler) DeleteAuthorizer(w http.ResponseWriter, r *http.Request)

DeleteAuthorizer handles DELETE /restapis/{restApiId}/authorizers/{authorizerId}.

func (*Handler) DeleteDomainName

func (h *Handler) DeleteDomainName(w http.ResponseWriter, r *http.Request)

DeleteDomainName handles DELETE /domainnames/{domainName}.

func (*Handler) DeleteIntegration

func (h *Handler) DeleteIntegration(w http.ResponseWriter, r *http.Request)

func (*Handler) DeleteIntegrationResponse

func (h *Handler) DeleteIntegrationResponse(w http.ResponseWriter, r *http.Request)

DeleteIntegrationResponse handles DELETE /restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/integration/responses/{statusCode}.

func (*Handler) DeleteMethod

func (h *Handler) DeleteMethod(w http.ResponseWriter, r *http.Request)

func (*Handler) DeleteMethodResponse

func (h *Handler) DeleteMethodResponse(w http.ResponseWriter, r *http.Request)

DeleteMethodResponse handles DELETE /restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/responses/{statusCode}.

func (*Handler) DeleteModel

func (h *Handler) DeleteModel(w http.ResponseWriter, r *http.Request)

DeleteModel handles DELETE /restapis/{restApiId}/models/{modelName}.

func (*Handler) DeleteRequestValidator

func (h *Handler) DeleteRequestValidator(w http.ResponseWriter, r *http.Request)

DeleteRequestValidator handles DELETE /restapis/{restApiId}/requestvalidators/{requestvalidatorId}.

func (*Handler) DeleteResource

func (h *Handler) DeleteResource(w http.ResponseWriter, r *http.Request)

func (*Handler) DeleteRestApi

func (h *Handler) DeleteRestApi(w http.ResponseWriter, r *http.Request)

func (*Handler) DeleteStage

func (h *Handler) DeleteStage(w http.ResponseWriter, r *http.Request)

func (*Handler) DeleteUsagePlan

func (h *Handler) DeleteUsagePlan(w http.ResponseWriter, r *http.Request)

DeleteUsagePlan handles DELETE /usageplans/{usagePlanId}.

func (*Handler) DeleteUsagePlanKey

func (h *Handler) DeleteUsagePlanKey(w http.ResponseWriter, r *http.Request)

DeleteUsagePlanKey handles DELETE /usageplans/{usagePlanId}/keys/{keyId}.

func (*Handler) DeleteV2Api

func (h *Handler) DeleteV2Api(w http.ResponseWriter, r *http.Request)

func (*Handler) DeleteV2Authorizer

func (h *Handler) DeleteV2Authorizer(w http.ResponseWriter, r *http.Request)

DeleteV2Authorizer handles DELETE /v2/apis/{apiId}/authorizers/{authorizerId}.

func (*Handler) DeleteV2DomainName

func (h *Handler) DeleteV2DomainName(w http.ResponseWriter, r *http.Request)

DeleteV2DomainName handles DELETE /v2/domainnames/{domainName}.

func (*Handler) DeleteV2Integration

func (h *Handler) DeleteV2Integration(w http.ResponseWriter, r *http.Request)

func (*Handler) DeleteV2Route

func (h *Handler) DeleteV2Route(w http.ResponseWriter, r *http.Request)

func (*Handler) DeleteV2Stage

func (h *Handler) DeleteV2Stage(w http.ResponseWriter, r *http.Request)
func (h *Handler) DeleteV2VpcLink(w http.ResponseWriter, r *http.Request)

DeleteV2VpcLink handles DELETE /v2/vpclinks/{vpcLinkId}.

func (h *Handler) DeleteVpcLink(w http.ResponseWriter, r *http.Request)

DeleteVpcLink handles DELETE /vpclinks/{vpcLinkId}.

func (*Handler) ExecuteRestAPI

func (h *Handler) ExecuteRestAPI(w http.ResponseWriter, r *http.Request)

ExecuteRestAPI handles incoming requests to a deployed REST API stage. Route: /restapis/{restApiId}/{stageName}/_user_request_/*.

func (*Handler) ExecuteV2API

func (h *Handler) ExecuteV2API(w http.ResponseWriter, r *http.Request)

ExecuteV2API handles incoming requests to a deployed HTTP API stage.

func (*Handler) GetAccount

func (h *Handler) GetAccount(w http.ResponseWriter, r *http.Request)

GetAccount — GET /account TODO(priority:P3): implement GetAccount — return throttle limits and feature flags.

func (*Handler) GetApiKey

func (h *Handler) GetApiKey(w http.ResponseWriter, r *http.Request)

GetApiKey handles GET /apikeys/{apiKey}.

func (*Handler) GetApiKeys

func (h *Handler) GetApiKeys(w http.ResponseWriter, r *http.Request)

GetApiKeys handles GET /apikeys.

func (*Handler) GetAuthorizer

func (h *Handler) GetAuthorizer(w http.ResponseWriter, r *http.Request)

GetAuthorizer handles GET /restapis/{restApiId}/authorizers/{authorizerId}.

func (*Handler) GetAuthorizers

func (h *Handler) GetAuthorizers(w http.ResponseWriter, r *http.Request)

GetAuthorizers handles GET /restapis/{restApiId}/authorizers.

func (*Handler) GetBasePathMappings

func (h *Handler) GetBasePathMappings(w http.ResponseWriter, r *http.Request)

GetBasePathMappings handles GET /domainnames/{domainName}/basepathmappings.

func (*Handler) GetDeployments

func (h *Handler) GetDeployments(w http.ResponseWriter, r *http.Request)

GetDeployments returns all deployments for a REST API.

func (*Handler) GetDomainNames

func (h *Handler) GetDomainNames(w http.ResponseWriter, r *http.Request)

GetDomainNames handles GET /domainnames.

func (*Handler) GetIntegration

func (h *Handler) GetIntegration(w http.ResponseWriter, r *http.Request)

func (*Handler) GetIntegrationResponse

func (h *Handler) GetIntegrationResponse(w http.ResponseWriter, r *http.Request)

GetIntegrationResponse handles GET /restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/integration/responses/{statusCode}.

func (*Handler) GetMethod

func (h *Handler) GetMethod(w http.ResponseWriter, r *http.Request)

func (*Handler) GetMethodResponse

func (h *Handler) GetMethodResponse(w http.ResponseWriter, r *http.Request)

GetMethodResponse handles GET /restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/responses/{statusCode}.

func (*Handler) GetModel

func (h *Handler) GetModel(w http.ResponseWriter, r *http.Request)

GetModel handles GET /restapis/{restApiId}/models/{modelName}.

func (*Handler) GetModels

func (h *Handler) GetModels(w http.ResponseWriter, r *http.Request)

GetModels handles GET /restapis/{restApiId}/models.

func (*Handler) GetRequestValidators

func (h *Handler) GetRequestValidators(w http.ResponseWriter, r *http.Request)

GetRequestValidators handles GET /restapis/{restApiId}/requestvalidators.

func (*Handler) GetResource

func (h *Handler) GetResource(w http.ResponseWriter, r *http.Request)

func (*Handler) GetResources

func (h *Handler) GetResources(w http.ResponseWriter, r *http.Request)

func (*Handler) GetRestApi

func (h *Handler) GetRestApi(w http.ResponseWriter, r *http.Request)

func (*Handler) GetRestApis

func (h *Handler) GetRestApis(w http.ResponseWriter, r *http.Request)

func (*Handler) GetStage

func (h *Handler) GetStage(w http.ResponseWriter, r *http.Request)

func (*Handler) GetStages

func (h *Handler) GetStages(w http.ResponseWriter, r *http.Request)

func (*Handler) GetTags

func (h *Handler) GetTags(w http.ResponseWriter, r *http.Request)

GetTags handles GET /tags/{resourceArn}.

func (*Handler) GetUsagePlan

func (h *Handler) GetUsagePlan(w http.ResponseWriter, r *http.Request)

GetUsagePlan handles GET /usageplans/{usagePlanId}.

func (*Handler) GetUsagePlanKeys

func (h *Handler) GetUsagePlanKeys(w http.ResponseWriter, r *http.Request)

GetUsagePlanKeys handles GET /usageplans/{usagePlanId}/keys.

func (*Handler) GetUsagePlans

func (h *Handler) GetUsagePlans(w http.ResponseWriter, r *http.Request)

GetUsagePlans handles GET /usageplans.

func (*Handler) GetV2Api

func (h *Handler) GetV2Api(w http.ResponseWriter, r *http.Request)

func (*Handler) GetV2ApiMappings

func (h *Handler) GetV2ApiMappings(w http.ResponseWriter, r *http.Request)

GetV2ApiMappings handles GET /v2/domainnames/{domainName}/apimappings.

func (*Handler) GetV2Apis

func (h *Handler) GetV2Apis(w http.ResponseWriter, r *http.Request)

func (*Handler) GetV2Authorizer

func (h *Handler) GetV2Authorizer(w http.ResponseWriter, r *http.Request)

GetV2Authorizer handles GET /v2/apis/{apiId}/authorizers/{authorizerId}.

func (*Handler) GetV2Authorizers

func (h *Handler) GetV2Authorizers(w http.ResponseWriter, r *http.Request)

GetV2Authorizers handles GET /v2/apis/{apiId}/authorizers.

func (*Handler) GetV2Deployments

func (h *Handler) GetV2Deployments(w http.ResponseWriter, r *http.Request)

func (*Handler) GetV2DomainNames

func (h *Handler) GetV2DomainNames(w http.ResponseWriter, r *http.Request)

GetV2DomainNames handles GET /v2/domainnames.

func (*Handler) GetV2Integration

func (h *Handler) GetV2Integration(w http.ResponseWriter, r *http.Request)

func (*Handler) GetV2Integrations

func (h *Handler) GetV2Integrations(w http.ResponseWriter, r *http.Request)

func (*Handler) GetV2Route

func (h *Handler) GetV2Route(w http.ResponseWriter, r *http.Request)

func (*Handler) GetV2Routes

func (h *Handler) GetV2Routes(w http.ResponseWriter, r *http.Request)

func (*Handler) GetV2Stage

func (h *Handler) GetV2Stage(w http.ResponseWriter, r *http.Request)

func (*Handler) GetV2Stages

func (h *Handler) GetV2Stages(w http.ResponseWriter, r *http.Request)

func (*Handler) GetV2Tags

func (h *Handler) GetV2Tags(w http.ResponseWriter, r *http.Request)

GetV2Tags handles GET /v2/tags/{resourceArn}.

func (h *Handler) GetV2VpcLinks(w http.ResponseWriter, r *http.Request)

GetV2VpcLinks handles GET /v2/vpclinks.

func (h *Handler) GetVpcLinks(w http.ResponseWriter, r *http.Request)

GetVpcLinks handles GET /vpclinks.

func (*Handler) PutIntegration

func (h *Handler) PutIntegration(w http.ResponseWriter, r *http.Request)

func (*Handler) PutIntegrationResponse

func (h *Handler) PutIntegrationResponse(w http.ResponseWriter, r *http.Request)

func (*Handler) PutMethod

func (h *Handler) PutMethod(w http.ResponseWriter, r *http.Request)

func (*Handler) PutMethodResponse

func (h *Handler) PutMethodResponse(w http.ResponseWriter, r *http.Request)

func (*Handler) TagResource

func (h *Handler) TagResource(w http.ResponseWriter, r *http.Request)

TagResource handles PUT /tags/{resourceArn}.

func (*Handler) TagV2Resource

func (h *Handler) TagV2Resource(w http.ResponseWriter, r *http.Request)

TagV2Resource handles POST /v2/tags/{resourceArn}.

func (*Handler) UntagResource

func (h *Handler) UntagResource(w http.ResponseWriter, r *http.Request)

UntagResource handles DELETE /tags/{resourceArn}?tagKeys=k1,k2.

func (*Handler) UntagV2Resource

func (h *Handler) UntagV2Resource(w http.ResponseWriter, r *http.Request)

UntagV2Resource handles DELETE /v2/tags/{resourceArn}?tagKeys=k1,k2.

func (*Handler) UpdateAccount

func (h *Handler) UpdateAccount(w http.ResponseWriter, r *http.Request)

UpdateAccount — PATCH /account TODO(priority:P3): implement UpdateAccount — update throttle limits.

func (*Handler) UpdateIntegration

func (h *Handler) UpdateIntegration(w http.ResponseWriter, r *http.Request)

UpdateIntegration handles PATCH /restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/integration. AWS docs: https://docs.aws.amazon.com/apigateway/latest/api/API_UpdateIntegration.html

func (*Handler) UpdateMethod

func (h *Handler) UpdateMethod(w http.ResponseWriter, r *http.Request)

UpdateMethod handles PATCH /restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}. AWS docs: https://docs.aws.amazon.com/apigateway/latest/api/API_UpdateMethod.html

func (*Handler) UpdateResource

func (h *Handler) UpdateResource(w http.ResponseWriter, r *http.Request)

UpdateResource handles PATCH /restapis/{restApiId}/resources/{resourceId}. AWS docs: https://docs.aws.amazon.com/apigateway/latest/api/API_UpdateResource.html

func (*Handler) UpdateRestApi

func (h *Handler) UpdateRestApi(w http.ResponseWriter, r *http.Request)

func (*Handler) UpdateStage

func (h *Handler) UpdateStage(w http.ResponseWriter, r *http.Request)

func (*Handler) UpdateV2Api

func (h *Handler) UpdateV2Api(w http.ResponseWriter, r *http.Request)

func (*Handler) UpdateV2Integration

func (h *Handler) UpdateV2Integration(w http.ResponseWriter, r *http.Request)

UpdateV2Integration handles PATCH /v2/apis/{apiId}/integrations/{integrationId}. AWS docs: https://docs.aws.amazon.com/apigatewayv2/latest/api-reference/apis-apiid-integrations-integrationid.html

func (*Handler) UpdateV2Route

func (h *Handler) UpdateV2Route(w http.ResponseWriter, r *http.Request)

UpdateV2Route handles PATCH /v2/apis/{apiId}/routes/{routeId}. AWS docs: https://docs.aws.amazon.com/apigatewayv2/latest/api-reference/apis-apiid-routes-routeid.html

func (*Handler) UpdateV2Stage

func (h *Handler) UpdateV2Stage(w http.ResponseWriter, r *http.Request)

UpdateV2Stage handles PATCH /v2/apis/{apiId}/stages/{stageName}. AWS docs: https://docs.aws.amazon.com/apigatewayv2/latest/api-reference/apis-apiid-stages-stagename.html

type Integration

type Integration struct {
	Type                 string                          `json:"type"` // AWS_PROXY, HTTP_PROXY, MOCK, AWS, HTTP
	HTTPMethod           string                          `json:"httpMethod,omitempty"`
	URI                  string                          `json:"uri,omitempty"`
	ConnectionType       string                          `json:"connectionType,omitempty"`
	ContentHandling      string                          `json:"contentHandling,omitempty"`
	Credentials          string                          `json:"credentials,omitempty"`
	PassthroughBehavior  string                          `json:"passthroughBehavior,omitempty"`
	RequestParameters    map[string]string               `json:"requestParameters,omitempty"`
	RequestTemplates     map[string]string               `json:"requestTemplates,omitempty"`
	TimeoutInMillis      int                             `json:"timeoutInMillis,omitempty"`
	IntegrationResponses map[string]*IntegrationResponse `json:"integrationResponses,omitempty"`
}

Integration defines a method integration (backend binding).

type IntegrationResponse

type IntegrationResponse struct {
	StatusCode         string            `json:"statusCode"`
	SelectionPattern   string            `json:"selectionPattern,omitempty"`
	ResponseParameters map[string]string `json:"responseParameters,omitempty"`
	ResponseTemplates  map[string]string `json:"responseTemplates,omitempty"`
	ContentHandling    string            `json:"contentHandling,omitempty"`
}

IntegrationResponse defines a response mapping from the integration.

type IntegrationV2

type IntegrationV2 struct {
	IntegrationID        string `json:"integrationId"`
	IntegrationType      string `json:"integrationType"` // AWS_PROXY, HTTP_PROXY
	IntegrationURI       string `json:"integrationUri,omitempty"`
	IntegrationMethod    string `json:"integrationMethod,omitempty"`
	PayloadFormatVersion string `json:"payloadFormatVersion,omitempty"` // "1.0", "2.0"
	ConnectionType       string `json:"connectionType,omitempty"`
	TimeoutInMillis      int    `json:"timeoutInMillis,omitempty"`
	Description          string `json:"description,omitempty"`
}

IntegrationV2 defines an integration in an HTTP API.

type JwtConfig

type JwtConfig struct {
	Audience []string `json:"audience,omitempty"`
	Issuer   string   `json:"issuer,omitempty"`
}

JwtConfig defines JWT authorizer configuration for HTTP APIs.

type Method

type Method struct {
	HTTPMethod        string                     `json:"httpMethod"`
	AuthorizationType string                     `json:"authorizationType"`
	AuthorizerID      string                     `json:"authorizerId,omitempty"`
	APIKeyRequired    bool                       `json:"apiKeyRequired"`
	RequestParameters map[string]bool            `json:"requestParameters,omitempty"`
	MethodIntegration *Integration               `json:"methodIntegration,omitempty"`
	MethodResponses   map[string]*MethodResponse `json:"methodResponses,omitempty"`
}

Method defines an HTTP method on a resource.

type MethodResponse

type MethodResponse struct {
	StatusCode         string          `json:"statusCode"`
	ResponseParameters map[string]bool `json:"responseParameters,omitempty"`
}

MethodResponse defines a method response shape.

type Model

type Model struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	ContentType string `json:"contentType,omitempty"`
	Description string `json:"description,omitempty"`
	Schema      string `json:"schema,omitempty"`
}

Model defines a data model schema for an API.

type QuotaSettings

type QuotaSettings struct {
	Limit  int    `json:"limit,omitempty"`
	Offset int    `json:"offset,omitempty"`
	Period string `json:"period,omitempty"` // DAY, WEEK, MONTH
}

QuotaSettings defines usage quota parameters. TODO(priority:P3): enforce quota limits at request time.

type RequestValidator

type RequestValidator struct {
	ID                        string `json:"id"`
	Name                      string `json:"name"`
	ValidateRequestBody       bool   `json:"validateRequestBody"`
	ValidateRequestParameters bool   `json:"validateRequestParameters"`
}

RequestValidator validates request body and/or parameters.

type Resource

type Resource struct {
	ID              string             `json:"id"`
	ParentID        string             `json:"parentId,omitempty"`
	PathPart        string             `json:"pathPart"`
	Path            string             `json:"path"`
	ResourceMethods map[string]*Method `json:"resourceMethods,omitempty"`
}

Resource is a URL path node in the REST API resource tree.

type RestAPI

type RestAPI struct {
	ID                string            `json:"id"`
	Name              string            `json:"name"`
	Description       string            `json:"description,omitempty"`
	CreatedDate       int64             `json:"createdDate"`
	Version           string            `json:"version,omitempty"`
	EndpointConfig    *EndpointConfig   `json:"endpointConfiguration,omitempty"`
	Policy            string            `json:"policy,omitempty"`
	Tags              map[string]string `json:"tags,omitempty"`
	BinaryMediaTypes  []string          `json:"binaryMediaTypes,omitempty"`
	DisableExecuteAPI bool              `json:"disableExecuteApiEndpoint,omitempty"`
	RootResourceID    string            `json:"rootResourceId"`
}

RestAPI is the top-level REST API resource.

type RouteV2

type RouteV2 struct {
	RouteID           string `json:"routeId"`
	RouteKey          string `json:"routeKey"` // "GET /users", "$default"
	Target            string `json:"target,omitempty"`
	AuthorizationType string `json:"authorizationType,omitempty"`
	AuthorizerID      string `json:"authorizerId,omitempty"`
	APIKeyRequired    bool   `json:"apiKeyRequired,omitempty"`
}

RouteV2 defines a route in an HTTP API.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service implements router.Service for API Gateway using REST paths.

func New

func New(cfg *config.Config, store state.Store, logger *zap.Logger, clk clock.Clock) *Service

New returns a configured API Gateway Service.

func (*Service) InitBus

func (s *Service) InitBus(bus *events.Bus)

InitBus wires the event bus for API lifecycle events.

func (*Service) InitCognitoValidator

func (s *Service) InitCognitoValidator(v events.CognitoTokenValidator)

InitCognitoValidator wires the Cognito JWT validator for authorizer enforcement. When set, COGNITO_USER_POOLS (REST v1) and JWT (HTTP v2) authorizers will validate Bearer tokens on every request before forwarding to the integration.

func (*Service) InitDomainRegistry

func (s *Service) InitDomainRegistry(reg *domainregistry.Registry)

InitDomainRegistry wires the custom-domain registry. Existing domain names are hydrated lazily on first domain-related request. Safe to call with a nil registry; the handlers are all nil-guarded.

func (*Service) InitLambdaInvoker

func (s *Service) InitLambdaInvoker(invoker events.FunctionSyncInvoker)

InitLambdaInvoker wires the synchronous Lambda invoker for request execution.

func (*Service) Name

func (s *Service) Name() string

Name satisfies router.Service.

func (*Service) RegisterRoutes

func (s *Service) RegisterRoutes(r chi.Router)

RegisterRoutes satisfies router.Service. API Gateway v1 uses /restapis and v2 uses /v2/apis.

func (*Service) V2APIRouter

func (s *Service) V2APIRouter() chi.Router

V2APIRouter returns a chi.Router for the API Gateway v2 /v2/apis management routes. This is mounted by the main router via service-name dispatch so that it coexists with AppSync Events API on the same path prefix.

type Stage

type Stage struct {
	StageName       string            `json:"stageName"`
	DeploymentID    string            `json:"deploymentId"`
	Description     string            `json:"description,omitempty"`
	CreatedDate     int64             `json:"createdDate"`
	LastUpdatedDate int64             `json:"lastUpdatedDate"`
	Tags            map[string]string `json:"tags,omitempty"`
	Variables       map[string]string `json:"variables,omitempty"`
}

Stage represents a named deployment stage (e.g. "prod", "dev").

type StageV2

type StageV2 struct {
	StageName       string            `json:"stageName"`
	DeploymentID    string            `json:"deploymentId,omitempty"`
	Description     string            `json:"description,omitempty"`
	AutoDeploy      bool              `json:"autoDeploy,omitempty"`
	CreatedDate     string            `json:"createdDate"`
	LastUpdatedDate string            `json:"lastUpdatedDate"`
	StageVariables  map[string]string `json:"stageVariables,omitempty"`
	Tags            map[string]string `json:"tags,omitempty"`
}

StageV2 represents a stage in an HTTP API.

type ThrottleSettings

type ThrottleSettings struct {
	BurstLimit int     `json:"burstLimit,omitempty"`
	RateLimit  float64 `json:"rateLimit,omitempty"`
}

ThrottleSettings defines rate limiting parameters. TODO(priority:P3): enforce throttle limits at request time.

type UsagePlan

type UsagePlan struct {
	ID          string            `json:"id"`
	Name        string            `json:"name"`
	Description string            `json:"description,omitempty"`
	APIStages   []UsagePlanStage  `json:"apiStages,omitempty"`
	Throttle    *ThrottleSettings `json:"throttle,omitempty"`
	Quota       *QuotaSettings    `json:"quota,omitempty"`
	Tags        map[string]string `json:"tags,omitempty"`
	// KeyIDs lists the API key IDs attached to this plan via UsagePlanKey.
	// AWS exposes these via the /usageplans/{id}/keys endpoint; SDK clients
	// ignore unknown fields so leaking this in plan responses is harmless.
	KeyIDs []string `json:"keyIds,omitempty"`
}

UsagePlan links API keys to stages and sets throttle/quota limits.

type UsagePlanStage

type UsagePlanStage struct {
	ApiID string `json:"apiId"`
	Stage string `json:"stage"`
}

UsagePlanStage links a usage plan to a specific API + stage.

type VpcLink struct {
	ID          string            `json:"id"`
	Name        string            `json:"name"`
	Description string            `json:"description,omitempty"`
	TargetArns  []string          `json:"targetArns,omitempty"`
	Status      string            `json:"status"` // AVAILABLE, PENDING, DELETING, FAILED
	Tags        map[string]string `json:"tags,omitempty"`
}

VpcLink represents a VPC Link resource for REST API v1.

type VpcLinkV2

type VpcLinkV2 struct {
	VpcLinkID        string            `json:"vpcLinkId"`
	Name             string            `json:"name"`
	SecurityGroupIDs []string          `json:"securityGroupIds,omitempty"`
	SubnetIDs        []string          `json:"subnetIds,omitempty"`
	Status           string            `json:"vpcLinkStatus"` // AVAILABLE, PENDING, DELETING, FAILED
	Tags             map[string]string `json:"tags,omitempty"`
}

VpcLinkV2 represents a VPC Link resource for HTTP API v2.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL