apigateway

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 41 Imported by: 0

README

API Gateway

Parity grade: A · SDK aws-sdk-go-v2/service/apigateway@v1.38.6 · last audited 2026-07-11 (83adaebe)

Coverage

Metric Value
Operations audited 123 (123 ok)
Feature families 3 (3 ok)
Known gaps 5
Deferred items 3
Resource leaks clean
Known gaps
  • PATCH 'remove' on bare top-level SCALAR fields (e.g. /description, /policy) is still a no-op: every UpdateInput's backend merge uses a zero-value-means-not-provided check (if input.X != "" / != nil), so an explicit remove can't be distinguished from absence without adding presence-tracking (pointer types or an explicit field mask) to every UpdateInput across ~15 resources. Map/list-valued fields (variables, binaryMediaTypes, apiStages, responseParameters/Templates, methodSettings) DO support remove correctly (this sweep) because their merge goes through a full non-nil replacement value. (bd: gopherstack-0s6, follow-up)
  • UsagePlan per-api-stage throttle overrides via PATCH path /apiStages/{restApiId}:{stage}/throttle/{resourcePath}~1{httpMethod}/{rateLimit,burstLimit} are not implemented (only whole-apiStage add/remove via the single-segment /apiStages path is). (bd: gopherstack-0s6, follow-up)
  • Stage CanarySettings.StageVariableOverrides nested PATCH (/canarySettings/stageVariableOverrides/{name}) is not implemented; canarySettings/{deploymentId,percentTraffic,useStageCache} are.
  • MethodSetting.CacheDataEncrypted and UnauthorizedCacheControlHeaderStrategy have no field on gopherstack's MethodSetting struct at all (predates this sweep), so their PATCH property paths (caching/dataEncrypted, caching/unauthorizedCacheControlHeaderStrategy) are unrecognized and fall through as no-ops.
  • The exact property-path strings for per-route stage method settings (stageMethodSettingProperty in patch.go, e.g. "logging/dataTrace") are a best-effort mapping from AWS's PATCH-operations reference docs, not verified against an SDK-level enum (PatchOperation.Path is a free string in aws-sdk-go-v2 with no typed catalog to check against). Flag for correction if a live wire capture disagrees.
Deferred
  • RestApi.ApiStatus/ApiStatusMessage/DisableExecuteApiEndpoint/EndpointAccessMode (present in aws-sdk-go-v2 types.RestApi, absent from gopherstack's RestAPI struct) — cosmetic/status-only fields, low client impact, out of scope this pass.
  • Stage.DocumentationVersion (present in AWS's Stage type) not modeled.
  • ApiKey.StageKeys (types.ApiKey.StageKeys / types.CreateApiKeyInput.StageKeys) not modeled, so CreateApiKey's stageKeys and UpdateApiKey's PATCH /stages add/remove are unimplemented. Checked this sweep against aws-sdk-go-v2 CreateApiKeyInput's doc comment: 'DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key. ... This parameter is deprecated and should not be used.' Low real-world impact; deferred. The PATCH /labels add/remove path from patch-operations.html has no corresponding field anywhere in aws-sdk-go-v2/service/apigateway/types.ApiKey either (likely a stale doc artifact from a pre-Tags API generation) — nothing to implement against.

More

Documentation

Index

Constants

View Source
const (
	IntegrationTypeMock      = "MOCK"
	IntegrationTypeHTTP      = "HTTP"
	IntegrationTypeHTTPProxy = "HTTP_PROXY"
	IntegrationTypeAWS       = "AWS"
	IntegrationTypeAWSProxy  = "AWS_PROXY"
)

Integration type constants.

View Source
const (
	AuthTypeNone            = "NONE"
	AuthTypeAWSIAM          = "AWS_IAM"
	AuthTypeCustom          = "CUSTOM"
	AuthTypeCognitoUserPool = "COGNITO_USER_POOLS"
)

Authorization type constants.

Variables

View Source
var (
	ErrRestAPINotFound                     = errors.New("NotFoundException")
	ErrResourceNotFound                    = errors.New("NotFoundException")
	ErrMethodNotFound                      = errors.New("NotFoundException")
	ErrMethodResponseNotFound              = errors.New("NotFoundException")
	ErrIntegrationResponseNotFound         = errors.New("NotFoundException")
	ErrDeploymentNotFound                  = errors.New("NotFoundException")
	ErrAuthorizerNotFound                  = errors.New("NotFoundException")
	ErrValidatorNotFound                   = errors.New("NotFoundException")
	ErrAPIKeyNotFound                      = errors.New("NotFoundException")
	ErrBasePathMappingNotFound             = errors.New("NotFoundException")
	ErrDocumentationPartNotFound           = errors.New("NotFoundException")
	ErrDocumentationVersionNotFound        = errors.New("NotFoundException")
	ErrDomainNameNotFound                  = errors.New("NotFoundException")
	ErrDomainNameAccessAssociationNotFound = errors.New("NotFoundException")
	ErrModelNotFound                       = errors.New("NotFoundException")
	ErrUsagePlanNotFound                   = errors.New("NotFoundException")
	ErrUsagePlanKeyNotFound                = errors.New("NotFoundException")
	ErrStageNotFound                       = errors.New("NotFoundException")
	ErrNotFound                            = errors.New("NotFoundException")
	ErrAlreadyExists                       = awserr.New("ConflictException", awserr.ErrAlreadyExists)
	ErrInvalidParameter                    = errors.New("BadRequestException")

	// ErrQuotaExceeded is returned by the data plane when an API key has exhausted
	// its usage-plan quota for the current period (AWS maps this to HTTP 429).
	ErrQuotaExceeded = errors.New("LimitExceededException")
	// ErrThrottled is returned by the data plane when an API key exceeds the
	// usage-plan rate/burst throttle (AWS maps this to HTTP 429).
	ErrThrottled = errors.New("TooManyRequestsException")
)

Functions

func ExtractLambdaFunctionName

func ExtractLambdaFunctionName(uri string) string

ExtractLambdaFunctionName extracts a Lambda function name (or short ARN) from either:

  • A plain function name: "my-function"
  • A Lambda ARN: "arn:aws:lambda:region:account:function:my-function"
  • An API Gateway invoke URI containing "arn:aws:apigateway:region:lambda:path/.../functions/{lambdaArn}/invocations"

Returns the input unchanged if it does not match any known pattern.

func RenderTemplate

func RenderTemplate(tmpl string, ctx VTLContext) string

RenderTemplate renders a Velocity Template Language (VTL) template string using the provided context.

Types

type APIKey

type APIKey struct {
	CreatedDate     unixEpochTime `json:"createdDate"`
	LastUpdatedDate unixEpochTime `json:"lastUpdatedDate"`
	Tags            *tags.Tags    `json:"tags,omitempty"`
	ID              string        `json:"id"`
	Name            string        `json:"name"`
	Description     string        `json:"description,omitempty"`
	Value           string        `json:"value,omitempty"`
	// CustomerID is an AWS Marketplace customer identifier, when integrating
	// with the AWS SaaS Marketplace (types.ApiKey.CustomerId in the SDK).
	CustomerID string `json:"customerId,omitempty"`
	Enabled    bool   `json:"enabled"`
}

APIKey represents an API Gateway API key.

type APIStageAssociation

type APIStageAssociation struct {
	Throttle  map[string]*ThrottleSettings `json:"throttle,omitempty"`
	RestAPIID string                       `json:"restApiId,omitempty"`
	Stage     string                       `json:"stage,omitempty"`
}

APIStageAssociation associates a usage plan with a specific REST API stage.

type AccessLogSettings

type AccessLogSettings struct {
	DestinationARN string `json:"destinationArn,omitempty"`
	Format         string `json:"format,omitempty"`
}

AccessLogSettings configures CloudWatch access logging for a stage.

type Account

type Account struct {
	ThrottleSettings  *ThrottleSettings `json:"throttleSettings,omitempty"`
	APIKeyVersion     string            `json:"apiKeyVersion,omitempty"`
	CloudwatchRoleARN string            `json:"cloudwatchRoleArn,omitempty"`
	Features          []string          `json:"features,omitempty"`
}

Account represents the API Gateway account settings.

type Authorizer

type Authorizer struct {
	ID                           string `json:"id"`
	Name                         string `json:"name"`
	Type                         string `json:"type"`
	AuthorizerURI                string `json:"authorizerUri,omitempty"`
	AuthorizerCredentials        string `json:"authorizerCredentials,omitempty"`
	IdentitySource               string `json:"identitySource,omitempty"`
	IdentityValidationExpression string `json:"identityValidationExpression,omitempty"`
	// RestAPIID identifies the owning REST API. It is internal storage-layer
	// identity (composite key for the backend's flat store.Table[Authorizer]),
	// never part of the wire response, matching the same json:"-" convention
	// already used by Resource/Stage/Deployment/Model for the identical purpose.
	RestAPIID                    string   `json:"-"`
	ProviderARNs                 []string `json:"providerARNs,omitempty"`
	AuthorizerResultTTLInSeconds int      `json:"authorizerResultTtlInSeconds,omitempty"`
}

Authorizer represents an API Gateway authorizer.

type AuthorizerEvent

type AuthorizerEvent struct {
	Headers               map[string]string  `json:"headers,omitempty"`
	QueryStringParameters map[string]string  `json:"queryStringParameters,omitempty"`
	StageVariables        map[string]string  `json:"stageVariables,omitempty"`
	RequestContext        LambdaProxyContext `json:"requestContext"`
	Type                  string             `json:"type"`
	AuthorizationToken    string             `json:"authorizationToken,omitempty"`
	MethodArn             string             `json:"methodArn"`
	Resource              string             `json:"resource,omitempty"`
	Path                  string             `json:"path,omitempty"`
	HTTPMethod            string             `json:"httpMethod,omitempty"`
}

AuthorizerEvent is the event payload sent to a Lambda authorizer function.

type AuthorizerResponse

type AuthorizerResponse struct {
	Context        map[string]any  `json:"context,omitempty"`
	PolicyDocument *PolicyDocument `json:"policyDocument,omitempty"`
	PrincipalID    string          `json:"principalId"`
}

AuthorizerResponse is the response returned by a Lambda authorizer function.

type BasePathMapping

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

BasePathMapping maps a base path on a custom domain to an API stage.

type CanarySettings

type CanarySettings struct {
	StageVariableOverrides map[string]string `json:"stageVariableOverrides,omitempty"`
	DeploymentID           string            `json:"deploymentId,omitempty"`
	PercentTraffic         float64           `json:"percentTraffic,omitempty"`
	UseStageCache          bool              `json:"useStageCache,omitempty"`
}

CanarySettings holds canary deployment configuration for a stage.

type ClientCertificate

type ClientCertificate struct {
	CreatedDate           unixEpochTime `json:"createdDate"`
	ExpirationDate        unixEpochTime `json:"expirationDate"`
	PemEncodedCertificate string        `json:"pemEncodedCertificate"`
	Description           string        `json:"description"`
	ClientCertificateID   string        `json:"clientCertificateId"`
}

ClientCertificate represents an API Gateway client certificate.

type CorsConfiguration

type CorsConfiguration struct {
	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"`
}

CorsConfiguration holds CORS settings for a resource.

type CreateAPIKeyInput

type CreateAPIKeyInput struct {
	Tags        *tags.Tags `json:"tags,omitempty"`
	Name        string     `json:"name"`
	Description string     `json:"description,omitempty"`
	Value       string     `json:"value,omitempty"`
	CustomerID  string     `json:"customerId,omitempty"`
	Enabled     bool       `json:"enabled"`
}

CreateAPIKeyInput is the input for CreateAPIKey.

type CreateAuthorizerInput

type CreateAuthorizerInput struct {
	Name                         string   `json:"name"`
	Type                         string   `json:"type"`
	AuthorizerURI                string   `json:"authorizerUri,omitempty"`
	AuthorizerCredentials        string   `json:"authorizerCredentials,omitempty"`
	IdentitySource               string   `json:"identitySource,omitempty"`
	IdentityValidationExpression string   `json:"identityValidationExpression,omitempty"`
	ProviderARNs                 []string `json:"providerARNs,omitempty"`
	AuthorizerResultTTLInSeconds int      `json:"authorizerResultTtlInSeconds,omitempty"`
}

CreateAuthorizerInput is the input for CreateAuthorizer.

type CreateBasePathMappingInput

type CreateBasePathMappingInput struct {
	DomainName string `json:"domainName"`
	BasePath   string `json:"basePath"`
	RestAPIID  string `json:"restApiId"`
	Stage      string `json:"stage,omitempty"`
}

CreateBasePathMappingInput is the input for CreateBasePathMapping.

type CreateDocumentationPartInput

type CreateDocumentationPartInput struct {
	Location   DocumentationLocation `json:"location"`
	RestAPIID  string                `json:"restApiId"`
	Properties string                `json:"properties"`
}

CreateDocumentationPartInput is the input for CreateDocumentationPart.

type CreateDocumentationVersionInput

type CreateDocumentationVersionInput struct {
	RestAPIID   string `json:"restApiId"`
	Version     string `json:"documentationVersion"`
	Description string `json:"description,omitempty"`
}

CreateDocumentationVersionInput is the input for CreateDocumentationVersion.

type CreateDomainNameAccessAssociationInput

type CreateDomainNameAccessAssociationInput struct {
	DomainNameARN               string `json:"domainNameArn"`
	AccessAssociationSource     string `json:"accessAssociationSource"`
	AccessAssociationSourceType string `json:"accessAssociationSourceType"`
}

CreateDomainNameAccessAssociationInput is the input for CreateDomainNameAccessAssociation.

type CreateDomainNameInput

type CreateDomainNameInput struct {
	Tags                   *tags.Tags             `json:"tags,omitempty"`
	EndpointConfiguration  *EndpointConfiguration `json:"endpointConfiguration,omitempty"`
	DomainName             string                 `json:"domainName"`
	CertificateARN         string                 `json:"certificateArn,omitempty"`
	RegionalCertificateARN string                 `json:"regionalCertificateArn,omitempty"`
	SecurityPolicy         string                 `json:"securityPolicy,omitempty"`
}

CreateDomainNameInput is the input for CreateDomainName.

type CreateModelInput

type CreateModelInput struct {
	RestAPIID   string `json:"restApiId"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	ContentType string `json:"contentType,omitempty"`
	Schema      string `json:"schema,omitempty"`
}

CreateModelInput is the input for CreateModel.

type CreateRequestValidatorInput

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

CreateRequestValidatorInput is the input for CreateRequestValidator.

type CreateRestAPIInput

type CreateRestAPIInput struct {
	EndpointConfiguration  *EndpointConfiguration `json:"endpointConfiguration,omitempty"`
	Tags                   *tags.Tags             `json:"tags,omitempty"`
	Name                   string                 `json:"name"`
	Description            string                 `json:"description,omitempty"`
	Policy                 string                 `json:"policy,omitempty"`
	APIKeySource           string                 `json:"apiKeySource,omitempty"`
	BinaryMediaTypes       []string               `json:"binaryMediaTypes,omitempty"`
	MinimumCompressionSize int                    `json:"minimumCompressionSize,omitempty"`
}

CreateRestAPIInput is the input for CreateRestApi.

type CreateStageInput

type CreateStageInput struct {
	CanarySettings      *CanarySettings          `json:"canarySettings,omitempty"`
	AccessLogSettings   *AccessLogSettings       `json:"accessLogSettings,omitempty"`
	MethodSettings      map[string]MethodSetting `json:"methodSettings,omitempty"`
	Variables           map[string]string        `json:"variables,omitempty"`
	RestAPIID           string                   `json:"restApiId"`
	StageName           string                   `json:"stageName"`
	DeploymentID        string                   `json:"deploymentId"`
	Description         string                   `json:"description,omitempty"`
	ClientCertificateID string                   `json:"clientCertificateId,omitempty"`
	CacheClusterSize    string                   `json:"cacheClusterSize,omitempty"`
	TracingEnabled      bool                     `json:"tracingEnabled,omitempty"`
	CacheClusterEnabled bool                     `json:"cacheClusterEnabled,omitempty"`
}

CreateStageInput is the input for the standalone CreateStage operation.

type CreateUsagePlanInput

type CreateUsagePlanInput struct {
	Tags        *tags.Tags            `json:"tags,omitempty"`
	Throttle    *ThrottleSettings     `json:"throttle,omitempty"`
	Quota       *QuotaSettings        `json:"quota,omitempty"`
	Name        string                `json:"name"`
	Description string                `json:"description,omitempty"`
	APIStages   []APIStageAssociation `json:"apiStages,omitempty"`
}

CreateUsagePlanInput is the input for CreateUsagePlan.

type CreateUsagePlanKeyInput

type CreateUsagePlanKeyInput struct {
	UsagePlanID string `json:"usagePlanId"`
	KeyID       string `json:"keyId"`
	KeyType     string `json:"keyType"`
}

CreateUsagePlanKeyInput is the input for CreateUsagePlanKey.

type CreateVpcLinkInput

type CreateVpcLinkInput struct {
	Tags        map[string]string `json:"tags,omitempty"`
	Name        string            `json:"name"`
	Description string            `json:"description,omitempty"`
	TargetARNs  []string          `json:"targetArns,omitempty"`
}

CreateVpcLinkInput is the input for CreateVpcLink.

type Deployment

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

Deployment represents a REST API deployment.

type DocumentationLocation

type DocumentationLocation struct {
	Type       string `json:"type"`
	Path       string `json:"path,omitempty"`
	Method     string `json:"method,omitempty"`
	StatusCode string `json:"statusCode,omitempty"`
	Name       string `json:"name,omitempty"`
}

DocumentationLocation specifies where a documentation part applies.

type DocumentationPart

type DocumentationPart struct {
	Location   DocumentationLocation `json:"location"`
	ID         string                `json:"id"`
	RestAPIID  string                `json:"-"`
	Properties string                `json:"properties"`
}

DocumentationPart represents a piece of API documentation.

type DocumentationVersion

type DocumentationVersion struct {
	CreatedDate unixEpochTime `json:"createdDate"`
	RestAPIID   string        `json:"-"`
	Version     string        `json:"version"`
	Description string        `json:"description,omitempty"`
}

DocumentationVersion represents a versioned snapshot of API documentation.

type DomainName

type DomainName struct {
	CreatedDate              *unixEpochTime         `json:"createdDate,omitempty"`
	Tags                     *tags.Tags             `json:"tags,omitempty"`
	EndpointConfiguration    *EndpointConfiguration `json:"endpointConfiguration,omitempty"`
	DomainNameValue          string                 `json:"domainName"`
	CertificateARN           string                 `json:"certificateArn,omitempty"`
	RegionalCertificateARN   string                 `json:"regionalCertificateArn,omitempty"`
	DistributionDomainName   string                 `json:"distributionDomainName,omitempty"`
	DistributionHostedZoneID string                 `json:"distributionHostedZoneId,omitempty"`
	RegionalDomainName       string                 `json:"regionalDomainName,omitempty"`
	RegionalHostedZoneID     string                 `json:"regionalHostedZoneId,omitempty"`
	SecurityPolicy           string                 `json:"securityPolicy,omitempty"`
	DomainNameStatus         string                 `json:"domainNameStatus,omitempty"`
}

DomainName represents a custom domain name for an API.

type DomainNameAccessAssociation

type DomainNameAccessAssociation struct {
	DomainNameAccessAssociationARN string `json:"domainNameAccessAssociationArn,omitempty"`
	DomainNameARN                  string `json:"domainNameArn"`
	AccessAssociationSource        string `json:"accessAssociationSource"`
	AccessAssociationSourceType    string `json:"accessAssociationSourceType"`
}

DomainNameAccessAssociation links a domain name to an access source such as a VPC endpoint.

type EndpointConfiguration

type EndpointConfiguration struct {
	VpcEndpointIDs []string `json:"vpcEndpointIds,omitempty"`
	Types          []string `json:"types,omitempty"`
}

EndpointConfiguration describes the endpoint types for a REST API.

type ErrorResponse

type ErrorResponse struct {
	Type    string `json:"__type"`
	Message string `json:"message"`
}

ErrorResponse is the JSON error format for API Gateway clients.

type GatewayResponse

type GatewayResponse struct {
	StatusCode         string            `json:"statusCode,omitempty"`
	ResponseParameters map[string]string `json:"responseParameters,omitempty"`
	ResponseTemplates  map[string]string `json:"responseTemplates,omitempty"`
	ResponseType       string            `json:"responseType"`
	RestAPIID          string            `json:"restApiId"`
	DefaultResponse    bool              `json:"defaultResponse,omitempty"`
}

GatewayResponse represents a gateway response configuration.

type GenerateClientCertificateInput

type GenerateClientCertificateInput struct {
	Tags        map[string]string `json:"tags,omitempty"`
	Description string            `json:"description,omitempty"`
}

GenerateClientCertificateInput is the input for GenerateClientCertificate.

type GetUsageInput

type GetUsageInput struct {
	UsagePlanID string `json:"usagePlanId"`
	StartDate   string `json:"startDate"`
	EndDate     string `json:"endDate"`
	Position    string `json:"position,omitempty"`
	Limit       int    `json:"limit,omitempty"`
}

GetUsageInput is the input for GetUsage.

type Handler

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

Handler is the Echo HTTP service handler for API Gateway operations.

func NewHandler

func NewHandler(backend StorageBackend) *Handler

NewHandler creates a new API Gateway handler with a default HTTP client timeout.

func (*Handler) ChaosOperations

func (h *Handler) ChaosOperations() []string

ChaosOperations returns all operations that can be fault-injected.

func (*Handler) ChaosRegions

func (h *Handler) ChaosRegions() []string

ChaosRegions returns all regions this API Gateway instance handles.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the lowercase AWS service name for fault rule matching.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation extracts the operation name from the X-Amz-Target header or REST path.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(c *echo.Context) string

ExtractResource extracts the resource identifier from the request body.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations returns all mocked API Gateway operations.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler function for API Gateway requests.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority for the API Gateway handler.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears all in-memory state from the backend. It is used by the POST /_gopherstack/reset endpoint for CI pipelines and rapid local development.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable by delegating to the backend.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher returns a matcher for API Gateway requests. Matches X-Amz-Target (JSON protocol) and REST paths (/restapis/..., /apikeys, /domainnames/..., /usageplans/...). The /tags/{arn} path is only matched when the ARN belongs to an API Gateway resource (contains ":apigateway:") so that other services (e.g. FIS) can own their own tag routes.

func (*Handler) SetHTTPClient

func (h *Handler) SetHTTPClient(c *http.Client)

SetHTTPClient configures the HTTP client used for HTTP/HTTP_PROXY integrations. If not set, a dedicated client with a 30-second timeout is used.

func (*Handler) SetJWKSProvider

func (h *Handler) SetJWKSProvider(p JWKSProvider)

SetJWKSProvider configures the JWKS provider used to verify Cognito JWT signatures.

func (*Handler) SetLambdaInvoker

func (h *Handler) SetLambdaInvoker(lambda LambdaInvoker)

SetLambdaInvoker configures the Lambda invoker for AWS_PROXY integrations.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable by delegating to the backend.

type ImportRestAPIInput

type ImportRestAPIInput struct {
	Body           []byte `json:"body,omitempty"`
	FailOnWarnings bool   `json:"failOnWarnings,omitempty"`
}

ImportRestAPIInput is the input for ImportRestApi.

type InMemoryBackend

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

InMemoryBackend implements StorageBackend using in-memory maps, with every resource collection registered as a *store.Table on registry (see store_setup.go). Resource families that AWS scopes to a REST API (resources, deployments, stages, authorizers, requestValidators, documentationParts, documentationVersions, models) are flat tables keyed by a composite "<restAPIID>#<childID>" string (see resourceKey et al in store_setup.go), with a secondary "byAPI" store.Index answering "all children of REST API X" -- replacing the old map[string]*apiData nesting.

func NewInMemoryBackend

func NewInMemoryBackend() *InMemoryBackend

NewInMemoryBackend creates a new InMemoryBackend.

func (*InMemoryBackend) CreateAPIKey

func (b *InMemoryBackend) CreateAPIKey(input CreateAPIKeyInput) (*APIKey, error)

CreateAPIKey creates a new API key with an optional auto-generated value.

func (*InMemoryBackend) CreateAuthorizer

func (b *InMemoryBackend) CreateAuthorizer(restAPIID string, input CreateAuthorizerInput) (*Authorizer, error)

CreateAuthorizer creates a new authorizer for a REST API.

func (*InMemoryBackend) CreateBasePathMapping

func (b *InMemoryBackend) CreateBasePathMapping(input CreateBasePathMappingInput) (*BasePathMapping, error)

CreateBasePathMapping creates a new base path mapping for a domain name.

func (*InMemoryBackend) CreateDeployment

func (b *InMemoryBackend) CreateDeployment(restAPIID, stageName, description string) (*Deployment, error)

CreateDeployment creates a deployment and associated stage.

func (*InMemoryBackend) CreateDocumentationPart

func (b *InMemoryBackend) CreateDocumentationPart(input CreateDocumentationPartInput) (*DocumentationPart, error)

CreateDocumentationPart creates a documentation part for a REST API.

func (*InMemoryBackend) CreateDocumentationVersion

func (b *InMemoryBackend) CreateDocumentationVersion(
	input CreateDocumentationVersionInput,
) (*DocumentationVersion, error)

CreateDocumentationVersion creates a documentation version snapshot for a REST API.

func (*InMemoryBackend) CreateDomainName

func (b *InMemoryBackend) CreateDomainName(input CreateDomainNameInput) (*DomainName, error)

CreateDomainName creates a new custom domain name.

func (*InMemoryBackend) CreateDomainNameAccessAssociation

func (b *InMemoryBackend) CreateDomainNameAccessAssociation(
	input CreateDomainNameAccessAssociationInput,
) (*DomainNameAccessAssociation, error)

CreateDomainNameAccessAssociation creates an access association for a domain name.

func (*InMemoryBackend) CreateModel

func (b *InMemoryBackend) CreateModel(input CreateModelInput) (*Model, error)

CreateModel creates a data model for a REST API.

func (*InMemoryBackend) CreateRequestValidator

func (b *InMemoryBackend) CreateRequestValidator(
	restAPIID string,
	input CreateRequestValidatorInput,
) (*RequestValidator, error)

CreateRequestValidator creates a new request validator for a REST API.

func (*InMemoryBackend) CreateResource

func (b *InMemoryBackend) CreateResource(restAPIID, parentID, pathPart string) (*Resource, error)

CreateResource creates a new resource under a parent.

func (*InMemoryBackend) CreateRestAPI

func (b *InMemoryBackend) CreateRestAPI(input CreateRestAPIInput) (*RestAPI, error)

CreateRestAPI creates a new REST API and its root resource.

func (*InMemoryBackend) CreateStage

func (b *InMemoryBackend) CreateStage(input CreateStageInput) (*Stage, error)

CreateStage creates a new deployment stage for a REST API without creating a deployment.

func (*InMemoryBackend) CreateUsagePlan

func (b *InMemoryBackend) CreateUsagePlan(input CreateUsagePlanInput) (*UsagePlan, error)

CreateUsagePlan creates a new usage plan.

func (*InMemoryBackend) CreateUsagePlanKey

func (b *InMemoryBackend) CreateUsagePlanKey(input CreateUsagePlanKeyInput) (*UsagePlanKey, error)

CreateUsagePlanKey associates an API key with a usage plan.

func (b *InMemoryBackend) CreateVpcLink(input CreateVpcLinkInput) (*VpcLink, error)

CreateVpcLink creates a new VPC link.

func (*InMemoryBackend) DeleteAPIKey

func (b *InMemoryBackend) DeleteAPIKey(id string) error

DeleteAPIKey removes an API key by ID.

func (*InMemoryBackend) DeleteAuthorizer

func (b *InMemoryBackend) DeleteAuthorizer(restAPIID, authorizerID string) error

DeleteAuthorizer removes an authorizer from a REST API.

func (*InMemoryBackend) DeleteBasePathMapping

func (b *InMemoryBackend) DeleteBasePathMapping(domainName, basePath string) error

DeleteBasePathMapping removes a base path mapping by domain + path.

func (*InMemoryBackend) DeleteClientCertificate

func (b *InMemoryBackend) DeleteClientCertificate(id string) error

DeleteClientCertificate removes a client certificate.

func (*InMemoryBackend) DeleteDeployment

func (b *InMemoryBackend) DeleteDeployment(restAPIID, deploymentID string) error

DeleteDeployment removes a deployment from a REST API.

func (*InMemoryBackend) DeleteDocumentationPart

func (b *InMemoryBackend) DeleteDocumentationPart(restAPIID, docPartID string) error

DeleteDocumentationPart removes a documentation part by ID.

func (*InMemoryBackend) DeleteDocumentationVersion

func (b *InMemoryBackend) DeleteDocumentationVersion(restAPIID, version string) error

DeleteDocumentationVersion removes a documentation version by version string.

func (*InMemoryBackend) DeleteDomainName

func (b *InMemoryBackend) DeleteDomainName(name string) error

DeleteDomainName removes a domain name by value.

func (*InMemoryBackend) DeleteDomainNameAccessAssociation

func (b *InMemoryBackend) DeleteDomainNameAccessAssociation(arn string) error

DeleteDomainNameAccessAssociation removes a domain name access association by ARN.

func (*InMemoryBackend) DeleteGatewayResponse

func (b *InMemoryBackend) DeleteGatewayResponse(restAPIID, responseType string) error

DeleteGatewayResponse removes a custom gateway response, reverting to default.

func (*InMemoryBackend) DeleteIntegration

func (b *InMemoryBackend) DeleteIntegration(restAPIID, resourceID, httpMethod string) error

DeleteIntegration removes the integration from a method.

func (*InMemoryBackend) DeleteIntegrationResponse

func (b *InMemoryBackend) DeleteIntegrationResponse(restAPIID, resourceID, httpMethod, statusCode string) error

DeleteIntegrationResponse removes an integration response from a method integration.

func (*InMemoryBackend) DeleteMethod

func (b *InMemoryBackend) DeleteMethod(restAPIID, resourceID, httpMethod string) error

DeleteMethod removes a method from a resource.

func (*InMemoryBackend) DeleteMethodResponse

func (b *InMemoryBackend) DeleteMethodResponse(restAPIID, resourceID, httpMethod, statusCode string) error

DeleteMethodResponse removes a method response from a method.

func (*InMemoryBackend) DeleteModel

func (b *InMemoryBackend) DeleteModel(restAPIID, modelName string) error

DeleteModel removes a model from a REST API by name.

func (*InMemoryBackend) DeleteRequestValidator

func (b *InMemoryBackend) DeleteRequestValidator(restAPIID, validatorID string) error

DeleteRequestValidator removes a request validator from a REST API.

func (*InMemoryBackend) DeleteResource

func (b *InMemoryBackend) DeleteResource(restAPIID, resourceID string) error

DeleteResource removes a resource.

func (*InMemoryBackend) DeleteRestAPI

func (b *InMemoryBackend) DeleteRestAPI(restAPIID string) error

DeleteRestAPI removes a REST API and all its resources.

func (*InMemoryBackend) DeleteStage

func (b *InMemoryBackend) DeleteStage(restAPIID, stageName string) error

DeleteStage removes a stage.

func (*InMemoryBackend) DeleteUsagePlan

func (b *InMemoryBackend) DeleteUsagePlan(id string) error

DeleteUsagePlan removes a usage plan by ID along with its key associations.

func (*InMemoryBackend) DeleteUsagePlanKey

func (b *InMemoryBackend) DeleteUsagePlanKey(usagePlanID, keyID string) error

DeleteUsagePlanKey removes a key from a usage plan.

func (b *InMemoryBackend) DeleteVpcLink(id string) error

DeleteVpcLink removes a VPC link.

func (*InMemoryBackend) EnforceUsagePlan

func (b *InMemoryBackend) EnforceUsagePlan(apiID, stageName, keyID string) error

EnforceUsagePlan applies usage-plan quota and throttle limits for an API key on the given API stage. It returns nil when the request is allowed or when the key is not associated with a usage plan for the stage (unmetered, matching a bare API key), ErrQuotaExceeded when the period quota is exhausted, or ErrThrottled when the rate/burst limit is exceeded.

func (*InMemoryBackend) GenerateClientCertificate

func (b *InMemoryBackend) GenerateClientCertificate(input GenerateClientCertificateInput) (*ClientCertificate, error)

GenerateClientCertificate creates a new client certificate for mutual TLS.

func (*InMemoryBackend) GetAPIKey

func (b *InMemoryBackend) GetAPIKey(id string) (*APIKey, error)

GetAPIKey retrieves an API key by ID.

func (*InMemoryBackend) GetAPIKeyByValue

func (b *InMemoryBackend) GetAPIKeyByValue(value string) (*APIKey, error)

GetAPIKeyByValue retrieves an API key by its value (the secret string sent in x-api-key). It resolves the key in O(1) via the value→ID index instead of a linear scan, because it runs on the hot data-plane path for every apiKey-required request.

func (*InMemoryBackend) GetAPIKeys

func (b *InMemoryBackend) GetAPIKeys() ([]APIKey, error)

GetAPIKeys returns all API keys sorted by ID.

func (*InMemoryBackend) GetAPIKeysPage

func (b *InMemoryBackend) GetAPIKeysPage(limit int, position string) ([]APIKey, string, error)

GetAPIKeysPage returns API keys with cursor-based pagination.

func (*InMemoryBackend) GetAccount

func (b *InMemoryBackend) GetAccount() (*Account, error)

GetAccount returns the mock API Gateway account settings.

func (*InMemoryBackend) GetAuthorizer

func (b *InMemoryBackend) GetAuthorizer(restAPIID, authorizerID string) (*Authorizer, error)

GetAuthorizer retrieves an authorizer by ID.

func (*InMemoryBackend) GetAuthorizers

func (b *InMemoryBackend) GetAuthorizers(restAPIID string) ([]Authorizer, error)

GetAuthorizers returns all authorizers for a REST API.

func (*InMemoryBackend) GetBasePathMapping

func (b *InMemoryBackend) GetBasePathMapping(domainName, basePath string) (*BasePathMapping, error)

GetBasePathMapping retrieves a base path mapping by domain + path.

func (*InMemoryBackend) GetBasePathMappings

func (b *InMemoryBackend) GetBasePathMappings(domainName string) ([]BasePathMapping, error)

GetBasePathMappings returns all base path mappings for a domain name.

func (*InMemoryBackend) GetClientCertificate

func (b *InMemoryBackend) GetClientCertificate(id string) (*ClientCertificate, error)

GetClientCertificate returns a client certificate by ID.

func (*InMemoryBackend) GetClientCertificates

func (b *InMemoryBackend) GetClientCertificates() ([]ClientCertificate, error)

GetClientCertificates returns all client certificates.

func (*InMemoryBackend) GetDeployment

func (b *InMemoryBackend) GetDeployment(restAPIID, deploymentID string) (*Deployment, error)

GetDeployment returns a single deployment by ID.

func (*InMemoryBackend) GetDeployments

func (b *InMemoryBackend) GetDeployments(restAPIID string) ([]Deployment, error)

GetDeployments returns all deployments for a REST API.

func (*InMemoryBackend) GetDocumentationPart

func (b *InMemoryBackend) GetDocumentationPart(restAPIID, docPartID string) (*DocumentationPart, error)

GetDocumentationPart retrieves a documentation part by ID.

func (*InMemoryBackend) GetDocumentationParts

func (b *InMemoryBackend) GetDocumentationParts(restAPIID string) ([]DocumentationPart, error)

GetDocumentationParts returns all documentation parts for a REST API sorted by ID.

func (*InMemoryBackend) GetDocumentationVersion

func (b *InMemoryBackend) GetDocumentationVersion(restAPIID, version string) (*DocumentationVersion, error)

GetDocumentationVersion retrieves a documentation version by version string.

func (*InMemoryBackend) GetDocumentationVersions

func (b *InMemoryBackend) GetDocumentationVersions(restAPIID string) ([]DocumentationVersion, error)

GetDocumentationVersions returns all documentation versions for a REST API sorted by version.

func (*InMemoryBackend) GetDomainName

func (b *InMemoryBackend) GetDomainName(name string) (*DomainName, error)

GetDomainName retrieves a domain name by value.

func (*InMemoryBackend) GetDomainNameAccessAssociations

func (b *InMemoryBackend) GetDomainNameAccessAssociations(resourceOwner string) ([]DomainNameAccessAssociation, error)

GetDomainNameAccessAssociations lists domain name access associations owned by this account. resourceOwner selects SELF (default) or OTHER_ACCOUNTS; since this backend only ever creates associations under the caller's own account, OTHER_ACCOUNTS always returns an empty list.

func (*InMemoryBackend) GetDomainNames

func (b *InMemoryBackend) GetDomainNames() ([]DomainName, error)

GetDomainNames returns all domain names sorted by name.

func (*InMemoryBackend) GetDomainNamesPage

func (b *InMemoryBackend) GetDomainNamesPage(limit int, position string) ([]DomainName, string, error)

GetDomainNamesPage returns domain names with cursor-based pagination.

func (*InMemoryBackend) GetExport

func (b *InMemoryBackend) GetExport(restAPIID, stageName, exportType string) (map[string]any, error)

GetExport generates an OpenAPI 2.0 (Swagger) or OAS 3.0 export of the REST API. exportType "oas30" produces OpenAPI 3.0.1; any other value produces Swagger 2.0.

func (*InMemoryBackend) GetGatewayResponse

func (b *InMemoryBackend) GetGatewayResponse(restAPIID, responseType string) (*GatewayResponse, error)

GetGatewayResponse retrieves a gateway response by type.

func (*InMemoryBackend) GetGatewayResponses

func (b *InMemoryBackend) GetGatewayResponses(restAPIID string) ([]GatewayResponse, error)

GetGatewayResponses retrieves all gateway responses for a REST API.

func (*InMemoryBackend) GetIntegration

func (b *InMemoryBackend) GetIntegration(restAPIID, resourceID, httpMethod string) (*Integration, error)

GetIntegration retrieves the integration for a method.

func (*InMemoryBackend) GetIntegrationResponse

func (b *InMemoryBackend) GetIntegrationResponse(
	restAPIID, resourceID, httpMethod, statusCode string,
) (*IntegrationResponse, error)

GetIntegrationResponse retrieves an integration response for a given status code.

func (*InMemoryBackend) GetMethod

func (b *InMemoryBackend) GetMethod(restAPIID, resourceID, httpMethod string) (*Method, error)

GetMethod retrieves a method on a resource.

func (*InMemoryBackend) GetMethodResponse

func (b *InMemoryBackend) GetMethodResponse(
	restAPIID, resourceID, httpMethod, statusCode string,
) (*MethodResponse, error)

GetMethodResponse retrieves a method response for a given status code.

func (*InMemoryBackend) GetModel

func (b *InMemoryBackend) GetModel(restAPIID, modelName string) (*Model, error)

GetModel retrieves a model by name within a REST API.

func (*InMemoryBackend) GetModelTemplate

func (b *InMemoryBackend) GetModelTemplate(restAPIID, modelName string) (string, error)

GetModelTemplate returns the default template for a model.

func (*InMemoryBackend) GetModels

func (b *InMemoryBackend) GetModels(restAPIID string) ([]Model, error)

GetModels returns all models for a REST API sorted by name.

func (*InMemoryBackend) GetRequestValidator

func (b *InMemoryBackend) GetRequestValidator(restAPIID, validatorID string) (*RequestValidator, error)

GetRequestValidator retrieves a request validator by ID.

func (*InMemoryBackend) GetRequestValidators

func (b *InMemoryBackend) GetRequestValidators(restAPIID string) ([]RequestValidator, error)

GetRequestValidators returns all request validators for a REST API.

func (*InMemoryBackend) GetResource

func (b *InMemoryBackend) GetResource(restAPIID, resourceID string) (*Resource, error)

GetResource returns a single resource.

func (*InMemoryBackend) GetResourceTags

func (b *InMemoryBackend) GetResourceTags(resourceARN string) (map[string]string, error)

GetResourceTags returns the tags for a resource identified by its ARN. For simplicity, we parse the ARN to extract the resource type and ID.

func (*InMemoryBackend) GetResources

func (b *InMemoryBackend) GetResources(restAPIID, position string, limit int) ([]Resource, string, error)

GetResources returns all resources for a REST API with pagination.

func (*InMemoryBackend) GetRestAPI

func (b *InMemoryBackend) GetRestAPI(restAPIID string) (*RestAPI, error)

GetRestAPI returns a single REST API.

func (*InMemoryBackend) GetRestAPIs

func (b *InMemoryBackend) GetRestAPIs(limit int, position string) ([]RestAPI, string, error)

GetRestAPIs returns all REST APIs with pagination.

func (*InMemoryBackend) GetSdk

func (b *InMemoryBackend) GetSdk(restAPIID, stageName, sdkType string) (*SdkExport, error)

GetSdk generates an SDK package for the given REST API/stage/language. A full per-language code generator is out of scope for an emulator, so the package is a real ZIP archive containing the API's actual OpenAPI export (reusing the same generator as GetExport) plus a README describing the requested SDK type — real API configuration, packaged in the correct wire/container format, rather than a fabricated empty blob.

func (*InMemoryBackend) GetSdkType

func (b *InMemoryBackend) GetSdkType(id string) (*SdkType, error)

GetSdkType looks up a single SDK type by ID from the fixed catalog.

func (*InMemoryBackend) GetSdkTypes

func (b *InMemoryBackend) GetSdkTypes() []SdkType

GetSdkTypes returns the fixed catalog of SDK types.

func (*InMemoryBackend) GetStage

func (b *InMemoryBackend) GetStage(restAPIID, stageName string) (*Stage, error)

GetStage returns a single stage.

func (*InMemoryBackend) GetStages

func (b *InMemoryBackend) GetStages(restAPIID string) ([]Stage, error)

GetStages returns all stages for a REST API.

func (*InMemoryBackend) GetUsage

func (b *InMemoryBackend) GetUsage(input GetUsageInput) (*UsageData, error)

GetUsage returns real per-key usage data for a usage plan. Each item is keyed by API key ID and contains a [used, remaining] pair reflecting the requests the data plane has actually metered against the plan's quota. If a key's remaining quota was explicitly overridden via UpdateUsage, that override takes precedence over the computed remaining value (mirroring AWS's "temporary extension to the remaining quota" semantics for UpdateUsage).

func (*InMemoryBackend) GetUsagePlan

func (b *InMemoryBackend) GetUsagePlan(id string) (*UsagePlan, error)

GetUsagePlan retrieves a usage plan by ID.

func (*InMemoryBackend) GetUsagePlanKey

func (b *InMemoryBackend) GetUsagePlanKey(usagePlanID, keyID string) (*UsagePlanKey, error)

GetUsagePlanKey retrieves a single key from a usage plan.

func (*InMemoryBackend) GetUsagePlanKeys

func (b *InMemoryBackend) GetUsagePlanKeys(usagePlanID string) ([]UsagePlanKey, error)

GetUsagePlanKeys returns all keys for a usage plan sorted by ID.

func (*InMemoryBackend) GetUsagePlans

func (b *InMemoryBackend) GetUsagePlans() ([]UsagePlan, error)

GetUsagePlans returns all usage plans sorted by ID.

func (*InMemoryBackend) GetUsagePlansPage

func (b *InMemoryBackend) GetUsagePlansPage(limit int, position string) ([]UsagePlan, string, error)

GetUsagePlansPage returns usage plans with cursor-based pagination.

func (b *InMemoryBackend) GetVpcLink(id string) (*VpcLink, error)

GetVpcLink retrieves a VPC link by ID.

func (b *InMemoryBackend) GetVpcLinks() ([]VpcLink, error)

GetVpcLinks retrieves all VPC links.

func (*InMemoryBackend) ImportAPIKeys

func (b *InMemoryBackend) ImportAPIKeys(body []byte, format string, failOnWarnings bool) ([]string, []string, error)

ImportAPIKeys parses a CSV payload of API keys in AWS's "API Key File Format": a header row naming columns (name, key, description, enabled), followed by one data row per key. Rows that fail to import are reported as warnings rather than aborting the whole batch; when failOnWarnings is true, any warning rolls the entire import back and returns an error instead.

func (*InMemoryBackend) ImportDocumentationParts

func (b *InMemoryBackend) ImportDocumentationParts(
	restAPIID string, body []byte, mode string, failOnWarnings bool,
) ([]string, []string, error)

ImportDocumentationParts parses a documentationParts JSON payload and creates a real DocumentationPart for each entry. mode "overwrite" clears all existing documentation parts for the API before importing; any other value merges the new parts into the existing set. Failures are reported as warnings; when failOnWarnings is true, any warning rolls the whole import back and returns an error instead.

func (*InMemoryBackend) ImportRestAPI

func (b *InMemoryBackend) ImportRestAPI(input ImportRestAPIInput) (*RestAPI, error)

ImportRestAPI creates a brand-new REST API from an OpenAPI/Swagger document, materialising resources, methods, integrations, responses and models.

func (*InMemoryBackend) PutGatewayResponse

func (b *InMemoryBackend) PutGatewayResponse(input PutGatewayResponseInput) (*GatewayResponse, error)

PutGatewayResponse creates or updates a gateway response.

func (*InMemoryBackend) PutIntegration

func (b *InMemoryBackend) PutIntegration(
	restAPIID, resourceID, httpMethod string,
	input PutIntegrationInput,
) (*Integration, error)

PutIntegration creates or replaces an integration on a method.

func (*InMemoryBackend) PutIntegrationResponse

func (b *InMemoryBackend) PutIntegrationResponse(
	restAPIID, resourceID, httpMethod, statusCode string,
	input PutIntegrationResponseInput,
) (*IntegrationResponse, error)

PutIntegrationResponse creates or replaces an integration response.

func (*InMemoryBackend) PutMethod

func (b *InMemoryBackend) PutMethod(input PutMethodInput) (*Method, error)

PutMethod creates or replaces a method on a resource.

func (*InMemoryBackend) PutMethodResponse

func (b *InMemoryBackend) PutMethodResponse(
	restAPIID, resourceID, httpMethod, statusCode string,
	input PutMethodResponseInput,
) (*MethodResponse, error)

PutMethodResponse creates or replaces a method response on a method.

func (*InMemoryBackend) PutRestAPI

func (b *InMemoryBackend) PutRestAPI(input PutRestAPIInput) (*RestAPI, error)

PutRestAPI imports an OpenAPI/Swagger document into an existing API. mode "overwrite" replaces the resource tree; "merge" (default) layers the imported paths on top of the existing tree.

func (*InMemoryBackend) RejectDomainNameAccessAssociation

func (b *InMemoryBackend) RejectDomainNameAccessAssociation(arn, domainNameARN string) error

RejectDomainNameAccessAssociation rejects (removes) a domain name access association, validating that it belongs to the given domain name ARN.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all in-memory state from the backend. It is used by the POST /_gopherstack/reset endpoint for CI pipelines and rapid local development.

func (*InMemoryBackend) ResourcesForRouting

func (b *InMemoryBackend) ResourcesForRouting(restAPIID string) ([]Resource, uint64, error)

ResourcesForRouting returns every resource for the API plus a version counter that changes on any resource-set mutation. Unlike GetResources it is not paginated: the data-plane proxy needs the complete set to build a routing trie, and it uses the version to cache that trie across requests instead of rebuilding it every time.

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore loads backend state from a JSON snapshot. It implements persistence.Persistable.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serialises the backend state to JSON. It implements persistence.Persistable.

func (*InMemoryBackend) TagResource

func (b *InMemoryBackend) TagResource(resourceARN string, newTags map[string]string) error

TagResource adds or updates tags on a resource identified by its ARN.

func (*InMemoryBackend) TestInvokeAuthorizer

TestInvokeAuthorizer performs a mock test invocation of an authorizer.

func (*InMemoryBackend) TestInvokeMethod

func (b *InMemoryBackend) TestInvokeMethod(input TestInvokeMethodInput) (*TestInvokeMethodOutput, error)

TestInvokeMethod performs a test invocation of a method, returning a mock 200 response.

func (*InMemoryBackend) UntagResource

func (b *InMemoryBackend) UntagResource(resourceARN string, tagKeys []string) error

UntagResource removes tags from a resource identified by its ARN.

func (*InMemoryBackend) UpdateAPIKey

func (b *InMemoryBackend) UpdateAPIKey(id string, input UpdateAPIKeyInput) (*APIKey, error)

UpdateAPIKey updates mutable fields on an existing API key.

func (*InMemoryBackend) UpdateAccount

func (b *InMemoryBackend) UpdateAccount(input UpdateAccountInput) (*Account, error)

UpdateAccount updates the account's throttle settings.

func (*InMemoryBackend) UpdateAuthorizer

func (b *InMemoryBackend) UpdateAuthorizer(
	restAPIID, authorizerID string,
	input UpdateAuthorizerInput,
) (*Authorizer, error)

UpdateAuthorizer updates fields on an existing authorizer.

func (*InMemoryBackend) UpdateBasePathMapping

func (b *InMemoryBackend) UpdateBasePathMapping(input UpdateBasePathMappingInput) (*BasePathMapping, error)

UpdateBasePathMapping updates an existing base path mapping.

func (*InMemoryBackend) UpdateClientCertificate

func (b *InMemoryBackend) UpdateClientCertificate(input UpdateClientCertificateInput) (*ClientCertificate, error)

UpdateClientCertificate updates the description of a client certificate.

func (*InMemoryBackend) UpdateDeployment

func (b *InMemoryBackend) UpdateDeployment(
	restAPIID, deploymentID string,
	input UpdateDeploymentInput,
) (*Deployment, error)

UpdateDeployment updates the description of a deployment.

func (*InMemoryBackend) UpdateDocumentationPart

func (b *InMemoryBackend) UpdateDocumentationPart(input UpdateDocumentationPartInput) (*DocumentationPart, error)

UpdateDocumentationPart updates the properties of a documentation part.

func (*InMemoryBackend) UpdateDocumentationVersion

func (b *InMemoryBackend) UpdateDocumentationVersion(
	input UpdateDocumentationVersionInput,
) (*DocumentationVersion, error)

UpdateDocumentationVersion updates a documentation version's description.

func (*InMemoryBackend) UpdateDomainName

func (b *InMemoryBackend) UpdateDomainName(input UpdateDomainNameInput) (*DomainName, error)

UpdateDomainName updates a domain name's certificate ARN.

func (*InMemoryBackend) UpdateGatewayResponse

func (b *InMemoryBackend) UpdateGatewayResponse(input PutGatewayResponseInput) (*GatewayResponse, error)

UpdateGatewayResponse applies a partial (PATCH) update to a gateway response, merging only the fields present in input with the existing response (or with AWS's implicit default response for responseType, if none has been customized yet). Unlike PutGatewayResponse — which is a full wholesale replace used by the real PUT operation — UpdateGatewayResponse must not clobber ResponseParameters/ResponseTemplates/StatusCode that weren't part of this PATCH document, matching AWS's PATCH-operation semantics for this resource.

func (*InMemoryBackend) UpdateIntegration

func (b *InMemoryBackend) UpdateIntegration(input UpdateIntegrationInput) (*Integration, error)

UpdateIntegration updates an integration's URI or type.

func (*InMemoryBackend) UpdateIntegrationResponse

func (b *InMemoryBackend) UpdateIntegrationResponse(
	input UpdateIntegrationResponseInput,
) (*IntegrationResponse, error)

UpdateIntegrationResponse updates an integration response's templates or selection pattern.

func (*InMemoryBackend) UpdateMethod

func (b *InMemoryBackend) UpdateMethod(input UpdateMethodInput) (*Method, error)

UpdateMethod updates method settings (authorization, API key requirement, etc.)

func (*InMemoryBackend) UpdateMethodResponse

func (b *InMemoryBackend) UpdateMethodResponse(input UpdateMethodResponseInput) (*MethodResponse, error)

UpdateMethodResponse updates a method response's models or parameters.

func (*InMemoryBackend) UpdateModel

func (b *InMemoryBackend) UpdateModel(restAPIID, modelName string, input UpdateModelInput) (*Model, error)

UpdateModel updates description and schema on a model.

func (*InMemoryBackend) UpdateRequestValidator

func (b *InMemoryBackend) UpdateRequestValidator(
	restAPIID, validatorID string,
	input UpdateRequestValidatorInput,
) (*RequestValidator, error)

UpdateRequestValidator updates fields on an existing request validator.

func (*InMemoryBackend) UpdateResource

func (b *InMemoryBackend) UpdateResource(restAPIID, resourceID string, input UpdateResourceInput) (*Resource, error)

UpdateResource updates the pathPart of a resource (recomputes path if changed).

func (*InMemoryBackend) UpdateRestAPI

func (b *InMemoryBackend) UpdateRestAPI(restAPIID string, input UpdateRestAPIInput) (*RestAPI, error)

UpdateRestAPI updates the name and/or description of a REST API.

func (*InMemoryBackend) UpdateStage

func (b *InMemoryBackend) UpdateStage(restAPIID, stageName string, input UpdateStageInput) (*Stage, error)

UpdateStage updates mutable fields on a deployment stage.

func (*InMemoryBackend) UpdateUsage

func (b *InMemoryBackend) UpdateUsage(usagePlanID, keyID string, patchedFields map[string]string) (*UsageData, error)

UpdateUsage validates that the usage plan and API key association exist and records a remaining-quota override for that key, so a subsequent GetUsage call reflects the change. Real AWS's only supported UpdateUsage patch path is the single-segment scalar "/remaining" (see patch-operations.html's UpdateUsage table — there is no per-date path segment, unlike the superficially similar per-route paths on UpdateStage/UpdateUsagePlan), so handler.go's applyStructuredPatch flattens the request into a single "remaining" -> value entry via the generic top-level fallback and this method only ever needs the value, not the key; patchedFields is still a map (rather than a single value) purely to reuse that generic flattening path. non-integer values are ignored. Real API Gateway quota-consumption tracking (based on live request traffic) isn't modeled by this emulator — as with GetUsage's Items, which are always empty absent real traffic — but the override recorded here is genuinely read back by GetUsage.

func (*InMemoryBackend) UpdateUsagePlan

func (b *InMemoryBackend) UpdateUsagePlan(input UpdateUsagePlanInput) (*UsagePlan, error)

UpdateUsagePlan updates a usage plan's name, description, throttle, or quota.

func (b *InMemoryBackend) UpdateVpcLink(input UpdateVpcLinkInput) (*VpcLink, error)

UpdateVpcLink updates the name or description of a VPC link.

type Integration

type Integration struct {
	RequestTemplates     map[string]string               `json:"requestTemplates,omitempty"`
	RequestParameters    map[string]string               `json:"requestParameters,omitempty"`
	IntegrationResponses map[string]*IntegrationResponse `json:"integrationResponses,omitempty"`
	ConnectionID         string                          `json:"connectionId,omitempty"`
	Type                 string                          `json:"type"`
	HTTPMethod           string                          `json:"httpMethod,omitempty"`
	URI                  string                          `json:"uri,omitempty"`
	PassthroughBehavior  string                          `json:"passthroughBehavior,omitempty"`
	ConnectionType       string                          `json:"connectionType,omitempty"`
	ContentHandling      string                          `json:"contentHandling,omitempty"`
	Credentials          string                          `json:"credentials,omitempty"`
	CacheNamespace       string                          `json:"cacheNamespace,omitempty"`
	CacheKeyParameters   []string                        `json:"cacheKeyParameters,omitempty"`
	TimeoutInMillis      int                             `json:"timeoutInMillis,omitempty"`
}

Integration represents a method integration.

type IntegrationResponse

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

IntegrationResponse represents a response from an integration.

type JWKSProvider

type JWKSProvider interface {
	GetJWTPublicKey(issuerURL, kid string) (*rsa.PublicKey, error)
}

JWKSProvider resolves RSA public keys for JWT signature verification. Implementations return an error when the issuer or key is unknown.

type LambdaInvoker

type LambdaInvoker interface {
	InvokeFunction(ctx context.Context, name, invocationType string, payload []byte) ([]byte, int, error)
}

LambdaInvoker can invoke a Lambda function by name/ARN.

type LambdaProxyContext

type LambdaProxyContext struct {
	Authorizer   map[string]any `json:"authorizer,omitempty"`
	ResourcePath string         `json:"resourcePath"`
	HTTPMethod   string         `json:"httpMethod"`
	Stage        string         `json:"stage"`
	APIId        string         `json:"apiId"`
	RequestID    string         `json:"requestId,omitempty"`
}

LambdaProxyContext provides context for the Lambda proxy event.

type LambdaProxyEvent

type LambdaProxyEvent struct {
	QueryStringParameters map[string]string   `json:"queryStringParameters,omitempty"`
	Headers               map[string]string   `json:"headers,omitempty"`
	MultiValueHeaders     map[string][]string `json:"multiValueHeaders,omitempty"`
	PathParameters        map[string]string   `json:"pathParameters,omitempty"`
	MultiValueQueryString map[string][]string `json:"multiValueQueryStringParameters,omitempty"`
	StageVariables        map[string]string   `json:"stageVariables,omitempty"`
	RequestContext        LambdaProxyContext  `json:"requestContext"`
	Resource              string              `json:"resource"`
	Path                  string              `json:"path"`
	HTTPMethod            string              `json:"httpMethod"`
	Body                  string              `json:"body,omitempty"`
	IsBase64Encoded       bool                `json:"isBase64Encoded"`
}

LambdaProxyEvent is the API Gateway Lambda proxy event format. https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html

func BuildProxyEvent

func BuildProxyEvent(
	r *http.Request,
	apiID, stageName, resource, path string,
	pathParameters map[string]string,
) (*LambdaProxyEvent, error)

BuildProxyEvent converts an incoming HTTP request to a Lambda proxy event. pathParameters are the path variable values extracted by the routing engine (may be nil).

type LambdaProxyResponse

type LambdaProxyResponse struct {
	Headers         map[string]string `json:"headers,omitempty"`
	Body            string            `json:"body,omitempty"`
	StatusCode      int               `json:"statusCode"`
	IsBase64Encoded bool              `json:"isBase64Encoded,omitempty"`
}

LambdaProxyResponse is the response format from a Lambda proxy function.

type Method

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

Method represents an API Gateway method on a resource.

type MethodResponse

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

MethodResponse represents a method response configuration.

type MethodSetting

type MethodSetting struct {
	LoggingLevel                        string  `json:"loggingLevel,omitempty"`
	ThrottlingRateLimit                 float64 `json:"throttlingRateLimit,omitempty"`
	ThrottlingBurstLimit                int     `json:"throttlingBurstLimit,omitempty"`
	CacheTTLInSeconds                   int     `json:"cacheTtlInSeconds,omitempty"`
	DataTraceEnabled                    bool    `json:"dataTraceEnabled,omitempty"`
	MetricsEnabled                      bool    `json:"metricsEnabled,omitempty"`
	CachingEnabled                      bool    `json:"cachingEnabled,omitempty"`
	RequireAuthorizationForCacheControl bool    `json:"requireAuthorizationForCacheControl,omitempty"`
}

MethodSetting holds per-method CloudWatch logging and throttling settings.

type Model

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

Model represents a data model for a REST API.

type PolicyDocument

type PolicyDocument struct {
	Version   string            `json:"Version,omitempty"`
	Statement []PolicyStatement `json:"Statement"`
}

PolicyDocument is an IAM policy document as returned by Lambda authorizers.

type PolicyStatement

type PolicyStatement struct {
	Action   any    `json:"Action"`
	Resource any    `json:"Resource"`
	Effect   string `json:"Effect"`
}

PolicyStatement is a single statement within an IAM policy document.

type Provider

type Provider struct{}

Provider implements service.Provider for the API Gateway service.

func (*Provider) Init

Init initializes the API Gateway service backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the logical name of the provider.

type PutGatewayResponseInput

type PutGatewayResponseInput struct {
	StatusCode         string            `json:"statusCode,omitempty"`
	ResponseParameters map[string]string `json:"responseParameters,omitempty"`
	ResponseTemplates  map[string]string `json:"responseTemplates,omitempty"`
	RestAPIID          string            `json:"restApiId"`
	ResponseType       string            `json:"responseType"`
}

PutGatewayResponseInput is the input for PutGatewayResponse.

type PutIntegrationInput

type PutIntegrationInput struct {
	RequestTemplates    map[string]string `json:"requestTemplates,omitempty"`
	RequestParameters   map[string]string `json:"requestParameters,omitempty"`
	PassthroughBehavior string            `json:"passthroughBehavior,omitempty"`
	Type                string            `json:"type"`
	HTTPMethod          string            `json:"httpMethod,omitempty"`
	URI                 string            `json:"uri,omitempty"`
	ConnectionType      string            `json:"connectionType,omitempty"`
	ConnectionID        string            `json:"connectionId,omitempty"`
	ContentHandling     string            `json:"contentHandling,omitempty"`
	Credentials         string            `json:"credentials,omitempty"`
	CacheNamespace      string            `json:"cacheNamespace,omitempty"`
	CacheKeyParameters  []string          `json:"cacheKeyParameters,omitempty"`
	TimeoutInMillis     int               `json:"timeoutInMillis,omitempty"`
}

PutIntegrationInput is the input for PutIntegration.

type PutIntegrationResponseInput

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

PutIntegrationResponseInput is the input for PutIntegrationResponse.

type PutMethodInput

type PutMethodInput struct {
	RequestParameters  map[string]bool   `json:"requestParameters,omitempty"`
	RequestModels      map[string]string `json:"requestModels,omitempty"`
	RestAPIID          string            `json:"restApiId"`
	ResourceID         string            `json:"resourceId"`
	HTTPMethod         string            `json:"httpMethod"`
	AuthorizationType  string            `json:"authorizationType"`
	AuthorizerID       string            `json:"authorizerId,omitempty"`
	RequestValidatorID string            `json:"requestValidatorId,omitempty"`
	OperationName      string            `json:"operationName,omitempty"`
	APIKeyRequired     bool              `json:"apiKeyRequired"`
}

PutMethodInput is the input for PutMethod.

type PutMethodResponseInput

type PutMethodResponseInput struct {
	ResponseModels     map[string]string `json:"responseModels,omitempty"`
	ResponseParameters map[string]bool   `json:"responseParameters,omitempty"`
}

PutMethodResponseInput is the input for PutMethodResponse.

type PutRestAPIInput

type PutRestAPIInput struct {
	RestAPIID      string `json:"restApiId"`
	Mode           string `json:"mode,omitempty"`
	Body           []byte `json:"body,omitempty"`
	FailOnWarnings bool   `json:"failOnWarnings,omitempty"`
}

PutRestAPIInput is the input for the PutRestApi operation.

type QuotaSettings

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

QuotaSettings controls request quota limiting for a usage plan.

type RequestValidator

type RequestValidator struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	// RestAPIID identifies the owning REST API. Internal storage-layer identity
	// only (composite key for the backend's flat store.Table[RequestValidator]);
	// never part of the wire response — see the identical Authorizer.RestAPIID doc.
	RestAPIID                 string `json:"-"`
	ValidateRequestBody       bool   `json:"validateRequestBody"`
	ValidateRequestParameters bool   `json:"validateRequestParameters"`
}

RequestValidator represents an API Gateway request validator.

type Resource

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

Resource represents an API Gateway resource.

type RestAPI

type RestAPI struct {
	CreatedDate            unixEpochTime          `json:"createdDate"`
	EndpointConfiguration  *EndpointConfiguration `json:"endpointConfiguration,omitempty"`
	Tags                   *tags.Tags             `json:"tags,omitempty"`
	ID                     string                 `json:"id"`
	Name                   string                 `json:"name"`
	Description            string                 `json:"description,omitempty"`
	Policy                 string                 `json:"policy,omitempty"`
	APIKeySource           string                 `json:"apiKeySource,omitempty"`
	RootResourceID         string                 `json:"rootResourceId,omitempty"`
	BinaryMediaTypes       []string               `json:"binaryMediaTypes,omitempty"`
	MinimumCompressionSize int                    `json:"minimumCompressionSize,omitempty"`
}

RestAPI represents an API Gateway REST API.

type SdkExport

type SdkExport struct {
	ContentType        string
	ContentDisposition string
	Body               []byte
}

SdkExport is the binary SDK package returned by GetSdk.

type SdkType

type SdkType struct {
	ID           string
	FriendlyName string
}

SdkType describes a code-generation target supported by GetSdk. AWS documents this fixed set directly on the GetSdk API ("Currently java, javascript, android, objectivec (for iOS), swift (for iOS), and ruby are supported.") — it is not a user-created resource, so the catalog is static.

type Stage

type Stage struct {
	CanarySettings      *CanarySettings          `json:"canarySettings,omitempty"`
	AccessLogSettings   *AccessLogSettings       `json:"accessLogSettings,omitempty"`
	MethodSettings      map[string]MethodSetting `json:"methodSettings,omitempty"`
	Variables           map[string]string        `json:"variables,omitempty"`
	CreatedDate         unixEpochTime            `json:"createdDate"`
	LastUpdatedDate     unixEpochTime            `json:"lastUpdatedDate"`
	StageName           string                   `json:"stageName"`
	RestAPIID           string                   `json:"-"`
	DeploymentID        string                   `json:"deploymentId"`
	Description         string                   `json:"description,omitempty"`
	ClientCertificateID string                   `json:"clientCertificateId,omitempty"`
	// CacheClusterSize is the cache cluster's capacity in GB (e.g. "0.5"), only
	// meaningful when CacheClusterEnabled is true.
	CacheClusterSize string `json:"cacheClusterSize,omitempty"`
	// CacheClusterStatus mirrors AWS's CacheClusterStatus enum
	// (AVAILABLE/NOT_AVAILABLE/...), derived from CacheClusterEnabled.
	CacheClusterStatus string `json:"cacheClusterStatus,omitempty"`
	// InvokeURL is the invoke URL for this stage (non-AWS field used by gopherstack UI).
	InvokeURL           string `json:"invokeUrl,omitempty"`
	TracingEnabled      bool   `json:"tracingEnabled,omitempty"`
	CacheClusterEnabled bool   `json:"cacheClusterEnabled,omitempty"`
}

Stage represents a deployment stage.

type StorageBackend

type StorageBackend interface {
	// REST APIs
	CreateRestAPI(input CreateRestAPIInput) (*RestAPI, error)
	DeleteRestAPI(restAPIID string) error
	GetRestAPI(restAPIID string) (*RestAPI, error)
	GetRestAPIs(limit int, position string) ([]RestAPI, string, error)
	UpdateRestAPI(restAPIID string, input UpdateRestAPIInput) (*RestAPI, error)

	// Resources
	GetResources(restAPIID, position string, limit int) ([]Resource, string, error)
	// ResourcesForRouting returns every resource for an API together with a version
	// counter that changes whenever the API's resource set is mutated. The data-plane
	// proxy uses it to build and cache a routing trie without re-copying the full
	// resource set (and paging past AWS's default page size) on every request.
	ResourcesForRouting(restAPIID string) ([]Resource, uint64, error)
	GetResource(restAPIID, resourceID string) (*Resource, error)
	CreateResource(restAPIID, parentID, pathPart string) (*Resource, error)
	DeleteResource(restAPIID, resourceID string) error
	UpdateResource(restAPIID, resourceID string, input UpdateResourceInput) (*Resource, error)

	// Methods
	PutMethod(input PutMethodInput) (*Method, error)
	GetMethod(restAPIID, resourceID, httpMethod string) (*Method, error)
	DeleteMethod(restAPIID, resourceID, httpMethod string) error

	// Method Responses
	PutMethodResponse(
		restAPIID, resourceID, httpMethod, statusCode string,
		input PutMethodResponseInput,
	) (*MethodResponse, error)
	GetMethodResponse(restAPIID, resourceID, httpMethod, statusCode string) (*MethodResponse, error)
	DeleteMethodResponse(restAPIID, resourceID, httpMethod, statusCode string) error

	// Integrations
	PutIntegration(restAPIID, resourceID, httpMethod string, input PutIntegrationInput) (*Integration, error)
	GetIntegration(restAPIID, resourceID, httpMethod string) (*Integration, error)
	DeleteIntegration(restAPIID, resourceID, httpMethod string) error

	// Integration Responses
	PutIntegrationResponse(
		restAPIID, resourceID, httpMethod, statusCode string,
		input PutIntegrationResponseInput,
	) (*IntegrationResponse, error)
	GetIntegrationResponse(restAPIID, resourceID, httpMethod, statusCode string) (*IntegrationResponse, error)
	DeleteIntegrationResponse(restAPIID, resourceID, httpMethod, statusCode string) error

	// Deployments
	CreateDeployment(restAPIID, stageName, description string) (*Deployment, error)
	GetDeployment(restAPIID, deploymentID string) (*Deployment, error)
	GetDeployments(restAPIID string) ([]Deployment, error)
	DeleteDeployment(restAPIID, deploymentID string) error
	UpdateDeployment(restAPIID, deploymentID string, input UpdateDeploymentInput) (*Deployment, error)

	// Stages
	GetStages(restAPIID string) ([]Stage, error)
	GetStage(restAPIID, stageName string) (*Stage, error)
	DeleteStage(restAPIID, stageName string) error

	// Authorizers
	CreateAuthorizer(restAPIID string, input CreateAuthorizerInput) (*Authorizer, error)
	GetAuthorizer(restAPIID, authorizerID string) (*Authorizer, error)
	GetAuthorizers(restAPIID string) ([]Authorizer, error)
	UpdateAuthorizer(restAPIID, authorizerID string, input UpdateAuthorizerInput) (*Authorizer, error)
	DeleteAuthorizer(restAPIID, authorizerID string) error

	// Request Validators
	CreateRequestValidator(restAPIID string, input CreateRequestValidatorInput) (*RequestValidator, error)
	GetRequestValidator(restAPIID, validatorID string) (*RequestValidator, error)
	GetRequestValidators(restAPIID string) ([]RequestValidator, error)
	UpdateRequestValidator(restAPIID, validatorID string, input UpdateRequestValidatorInput) (*RequestValidator, error)
	DeleteRequestValidator(restAPIID, validatorID string) error

	// API Keys
	CreateAPIKey(input CreateAPIKeyInput) (*APIKey, error)
	GetAPIKey(id string) (*APIKey, error)
	GetAPIKeyByValue(value string) (*APIKey, error)
	GetAPIKeys() ([]APIKey, error)
	GetAPIKeysPage(limit int, position string) ([]APIKey, string, error)
	DeleteAPIKey(id string) error
	UpdateAPIKey(id string, input UpdateAPIKeyInput) (*APIKey, error)

	// Base Path Mappings
	CreateBasePathMapping(input CreateBasePathMappingInput) (*BasePathMapping, error)
	GetBasePathMapping(domainName, basePath string) (*BasePathMapping, error)
	GetBasePathMappings(domainName string) ([]BasePathMapping, error)
	DeleteBasePathMapping(domainName, basePath string) error

	// Documentation Parts (per-API)
	CreateDocumentationPart(input CreateDocumentationPartInput) (*DocumentationPart, error)
	GetDocumentationPart(restAPIID, docPartID string) (*DocumentationPart, error)
	GetDocumentationParts(restAPIID string) ([]DocumentationPart, error)
	DeleteDocumentationPart(restAPIID, docPartID string) error

	// Documentation Versions (per-API)
	CreateDocumentationVersion(input CreateDocumentationVersionInput) (*DocumentationVersion, error)
	GetDocumentationVersion(restAPIID, version string) (*DocumentationVersion, error)
	GetDocumentationVersions(restAPIID string) ([]DocumentationVersion, error)
	DeleteDocumentationVersion(restAPIID, version string) error

	// Domain Names
	CreateDomainName(input CreateDomainNameInput) (*DomainName, error)
	GetDomainName(name string) (*DomainName, error)
	GetDomainNames() ([]DomainName, error)
	GetDomainNamesPage(limit int, position string) ([]DomainName, string, error)
	DeleteDomainName(name string) error

	// Domain Name Access Associations
	CreateDomainNameAccessAssociation(
		input CreateDomainNameAccessAssociationInput,
	) (*DomainNameAccessAssociation, error)
	GetDomainNameAccessAssociations(resourceOwner string) ([]DomainNameAccessAssociation, error)
	DeleteDomainNameAccessAssociation(arn string) error
	RejectDomainNameAccessAssociation(arn, domainNameARN string) error

	// Models (per-API)
	CreateModel(input CreateModelInput) (*Model, error)
	GetModel(restAPIID, modelName string) (*Model, error)
	GetModels(restAPIID string) ([]Model, error)
	DeleteModel(restAPIID, modelName string) error
	UpdateModel(restAPIID, modelName string, input UpdateModelInput) (*Model, error)

	// Standalone Stage creation
	CreateStage(input CreateStageInput) (*Stage, error)
	UpdateStage(restAPIID, stageName string, input UpdateStageInput) (*Stage, error)

	// Usage Plans
	CreateUsagePlan(input CreateUsagePlanInput) (*UsagePlan, error)
	GetUsagePlan(id string) (*UsagePlan, error)
	GetUsagePlans() ([]UsagePlan, error)
	GetUsagePlansPage(limit int, position string) ([]UsagePlan, string, error)
	DeleteUsagePlan(id string) error

	// Usage Plan Keys
	CreateUsagePlanKey(input CreateUsagePlanKeyInput) (*UsagePlanKey, error)
	GetUsagePlanKey(usagePlanID, keyID string) (*UsagePlanKey, error)
	GetUsagePlanKeys(usagePlanID string) ([]UsagePlanKey, error)
	DeleteUsagePlanKey(usagePlanID, keyID string) error

	// Account
	GetAccount() (*Account, error)

	// Tags
	GetResourceTags(resourceARN string) (map[string]string, error)
	TagResource(resourceARN string, tags map[string]string) error
	UntagResource(resourceARN string, tagKeys []string) error

	// Test Invocation
	TestInvokeMethod(input TestInvokeMethodInput) (*TestInvokeMethodOutput, error)

	// Update operations.
	UpdateUsagePlan(input UpdateUsagePlanInput) (*UsagePlan, error)
	UpdateDomainName(input UpdateDomainNameInput) (*DomainName, error)
	UpdateBasePathMapping(input UpdateBasePathMappingInput) (*BasePathMapping, error)
	UpdateDocumentationPart(input UpdateDocumentationPartInput) (*DocumentationPart, error)
	UpdateDocumentationVersion(input UpdateDocumentationVersionInput) (*DocumentationVersion, error)
	UpdateMethod(input UpdateMethodInput) (*Method, error)
	UpdateIntegration(input UpdateIntegrationInput) (*Integration, error)
	UpdateIntegrationResponse(input UpdateIntegrationResponseInput) (*IntegrationResponse, error)
	UpdateMethodResponse(input UpdateMethodResponseInput) (*MethodResponse, error)
	UpdateAccount(input UpdateAccountInput) (*Account, error)
	TestInvokeAuthorizer(input TestInvokeAuthorizerInput) (*TestInvokeAuthorizerOutput, error)
	GetModelTemplate(restAPIID, modelName string) (string, error)

	// Gateway response operations.
	GetGatewayResponse(restAPIID, responseType string) (*GatewayResponse, error)
	GetGatewayResponses(restAPIID string) ([]GatewayResponse, error)
	PutGatewayResponse(input PutGatewayResponseInput) (*GatewayResponse, error)
	UpdateGatewayResponse(input PutGatewayResponseInput) (*GatewayResponse, error)
	DeleteGatewayResponse(restAPIID, responseType string) error

	// Client certificate operations.
	GenerateClientCertificate(input GenerateClientCertificateInput) (*ClientCertificate, error)
	GetClientCertificate(id string) (*ClientCertificate, error)
	GetClientCertificates() ([]ClientCertificate, error)
	DeleteClientCertificate(id string) error

	// Usage operations.
	GetUsage(input GetUsageInput) (*UsageData, error)
	// EnforceUsagePlan applies usage-plan quota and throttle/burst limits for an API
	// key on the given API stage. It returns nil when the request is allowed (or when
	// the key is not associated with a usage plan for the stage), ErrQuotaExceeded when
	// the period quota is exhausted, or ErrThrottled when the rate/burst limit is hit.
	EnforceUsagePlan(apiID, stageName, keyID string) error

	// VPC Link operations.
	CreateVpcLink(input CreateVpcLinkInput) (*VpcLink, error)
	GetVpcLink(id string) (*VpcLink, error)
	GetVpcLinks() ([]VpcLink, error)
	DeleteVpcLink(id string) error
	UpdateVpcLink(input UpdateVpcLinkInput) (*VpcLink, error)

	// Client certificate update.
	UpdateClientCertificate(input UpdateClientCertificateInput) (*ClientCertificate, error)

	// OpenAPI export.
	GetExport(restAPIID, stageName, exportType string) (map[string]any, error)

	// SDK generation.
	GetSdkTypes() []SdkType
	GetSdkType(id string) (*SdkType, error)
	GetSdk(restAPIID, stageName, sdkType string) (*SdkExport, error)

	// API key / documentation part bulk import.
	ImportAPIKeys(body []byte, format string, failOnWarnings bool) ([]string, []string, error)
	ImportDocumentationParts(
		restAPIID string,
		body []byte,
		mode string,
		failOnWarnings bool,
	) ([]string, []string, error)

	// Usage update.
	UpdateUsage(usagePlanID, keyID string, dateValues map[string]string) (*UsageData, error)

	// OpenAPI import.
	ImportRestAPI(input ImportRestAPIInput) (*RestAPI, error)
	PutRestAPI(input PutRestAPIInput) (*RestAPI, error)
}

StorageBackend is the interface for the API Gateway in-memory store.

type TestInvokeAuthorizerInput

type TestInvokeAuthorizerInput struct {
	Headers        map[string]string `json:"headers,omitempty"`
	StageVariables map[string]string `json:"stageVariables,omitempty"`
	Body           string            `json:"body,omitempty"`
	RestAPIID      string            `json:"restApiId"`
	AuthorizerID   string            `json:"authorizerId"`
	Identity       string            `json:"identity,omitempty"`
}

TestInvokeAuthorizerInput is the input for TestInvokeAuthorizer.

type TestInvokeAuthorizerOutput

type TestInvokeAuthorizerOutput struct {
	Claims              map[string]string `json:"claims,omitempty"`
	Context             map[string]string `json:"context,omitempty"`
	Log                 string            `json:"log,omitempty"`
	PrincipalID         string            `json:"principalId"`
	PolicyDocument      string            `json:"policy,omitempty"`
	ClientStatus        int               `json:"clientStatus"`
	Latency             int64             `json:"latency"`
	AuthorizationStatus int               `json:"authorization"`
}

TestInvokeAuthorizerOutput is the output from TestInvokeAuthorizer.

type TestInvokeMethodInput

type TestInvokeMethodInput struct {
	Headers             map[string]string `json:"headers,omitempty"`
	StageVariables      map[string]string `json:"stageVariables,omitempty"`
	PathWithQueryString string            `json:"pathWithQueryString,omitempty"`
	Body                string            `json:"body,omitempty"`
	RestAPIID           string            `json:"restApiId"`
	ResourceID          string            `json:"resourceId"`
	HTTPMethod          string            `json:"httpMethod"`
}

TestInvokeMethodInput is the input for TestInvokeMethod.

type TestInvokeMethodOutput

type TestInvokeMethodOutput struct {
	Headers map[string]string `json:"headers,omitempty"`
	Log     string            `json:"log,omitempty"`
	Body    string            `json:"body,omitempty"`
	Status  int               `json:"status"`
	Latency int64             `json:"latency"`
}

TestInvokeMethodOutput is the output from TestInvokeMethod.

type ThrottleSettings

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

ThrottleSettings controls request rate limiting for a usage plan.

type UpdateAPIKeyInput

type UpdateAPIKeyInput struct {
	Enabled     *bool  `json:"enabled,omitempty"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	CustomerID  string `json:"customerId,omitempty"`
}

UpdateAPIKeyInput is the input for UpdateAPIKey.

type UpdateAccountInput

type UpdateAccountInput struct {
	ThrottleSettings  *ThrottleSettings `json:"throttleSettings,omitempty"`
	CloudwatchRoleARN string            `json:"cloudwatchRoleArn,omitempty"`
}

UpdateAccountInput is the input for UpdateAccount. The real AWS wire shape carries only "patchOperations" (see aws-sdk-go-v2 apigateway UpdateAccountInput); handler.go flattens the patch document into these named fields (CloudwatchRoleARN via top-level "/cloudwatchRoleArn", ThrottleSettings via nested "/throttle/{rateLimit,burstLimit}" — see patch.go).

type UpdateAuthorizerInput

type UpdateAuthorizerInput struct {
	Name                         string   `json:"name,omitempty"`
	Type                         string   `json:"type,omitempty"`
	AuthorizerURI                string   `json:"authorizerUri,omitempty"`
	AuthorizerCredentials        string   `json:"authorizerCredentials,omitempty"`
	IdentitySource               string   `json:"identitySource,omitempty"`
	IdentityValidationExpression string   `json:"identityValidationExpression,omitempty"`
	ProviderARNs                 []string `json:"providerARNs,omitempty"`
	AuthorizerResultTTLInSeconds int      `json:"authorizerResultTtlInSeconds,omitempty"`
}

UpdateAuthorizerInput is the input for UpdateAuthorizer (patch operations).

type UpdateBasePathMappingInput

type UpdateBasePathMappingInput struct {
	DomainName string `json:"domainName"`
	BasePath   string `json:"basePath"`
	RestAPIID  string `json:"restApiId,omitempty"`
	Stage      string `json:"stage,omitempty"`
}

UpdateBasePathMappingInput is the input for UpdateBasePathMapping.

type UpdateClientCertificateInput

type UpdateClientCertificateInput struct {
	ClientCertificateID string `json:"clientCertificateId"`
	Description         string `json:"description,omitempty"`
}

UpdateClientCertificateInput is the input for UpdateClientCertificate.

type UpdateDeploymentInput

type UpdateDeploymentInput struct {
	Description string `json:"description,omitempty"`
}

UpdateDeploymentInput is the input for UpdateDeployment.

type UpdateDocumentationPartInput

type UpdateDocumentationPartInput struct {
	RestAPIID  string `json:"restApiId"`
	DocPartID  string `json:"docPartId"`
	Properties string `json:"properties,omitempty"`
}

UpdateDocumentationPartInput is the input for UpdateDocumentationPart.

type UpdateDocumentationVersionInput

type UpdateDocumentationVersionInput struct {
	RestAPIID            string `json:"restApiId"`
	DocumentationVersion string `json:"documentationVersion"`
	Description          string `json:"description,omitempty"`
}

UpdateDocumentationVersionInput is the input for UpdateDocumentationVersion.

type UpdateDomainNameInput

type UpdateDomainNameInput struct {
	EndpointConfiguration  *EndpointConfiguration `json:"endpointConfiguration,omitempty"`
	CertificateARN         string                 `json:"certificateArn,omitempty"`
	RegionalCertificateARN string                 `json:"regionalCertificateArn,omitempty"`
	SecurityPolicy         string                 `json:"securityPolicy,omitempty"`
	DomainName             string                 `json:"domainName"`
}

UpdateDomainNameInput is the input for UpdateDomainName.

type UpdateIntegrationInput

type UpdateIntegrationInput struct {
	RequestTemplates      map[string]string `json:"requestTemplates,omitempty"`
	RequestParameters     map[string]string `json:"requestParameters,omitempty"`
	IntegrationHTTPMethod string            `json:"integrationHttpMethod,omitempty"`
	PassthroughBehavior   string            `json:"passthroughBehavior,omitempty"`
	ResourceID            string            `json:"resourceId"`
	HTTPMethod            string            `json:"httpMethod"`
	URI                   string            `json:"uri,omitempty"`
	IntegrationType       string            `json:"type,omitempty"`
	CacheNamespace        string            `json:"cacheNamespace,omitempty"`
	RestAPIID             string            `json:"restApiId"`
	ConnectionType        string            `json:"connectionType,omitempty"`
	ConnectionID          string            `json:"connectionId,omitempty"`
	ContentHandling       string            `json:"contentHandling,omitempty"`
	Credentials           string            `json:"credentials,omitempty"`
	CacheKeyParameters    []string          `json:"cacheKeyParameters,omitempty"`
	TimeoutInMillis       int               `json:"timeoutInMillis,omitempty"`
}

UpdateIntegrationInput is the input for UpdateIntegration.

type UpdateIntegrationResponseInput

type UpdateIntegrationResponseInput struct {
	ResponseTemplates  map[string]string `json:"responseTemplates,omitempty"`
	ResponseParameters map[string]string `json:"responseParameters,omitempty"`
	RestAPIID          string            `json:"restApiId"`
	ResourceID         string            `json:"resourceId"`
	HTTPMethod         string            `json:"httpMethod"`
	StatusCode         string            `json:"statusCode"`
	SelectionPattern   string            `json:"selectionPattern,omitempty"`
	ContentHandling    string            `json:"contentHandling,omitempty"`
}

UpdateIntegrationResponseInput is the input for UpdateIntegrationResponse.

type UpdateMethodInput

type UpdateMethodInput struct {
	RequestModels     map[string]string `json:"requestModels,omitempty"`
	APIKeyRequired    *bool             `json:"apiKeyRequired,omitempty"`
	RestAPIID         string            `json:"restApiId"`
	ResourceID        string            `json:"resourceId"`
	HTTPMethod        string            `json:"httpMethod"`
	AuthorizationType string            `json:"authorizationType,omitempty"`
	AuthorizerID      string            `json:"authorizerId,omitempty"`
	OperationName     string            `json:"operationName,omitempty"`
}

UpdateMethodInput is the input for UpdateMethod.

type UpdateMethodResponseInput

type UpdateMethodResponseInput struct {
	ResponseModels     map[string]string `json:"responseModels,omitempty"`
	ResponseParameters map[string]bool   `json:"responseParameters,omitempty"`
	RestAPIID          string            `json:"restApiId"`
	ResourceID         string            `json:"resourceId"`
	HTTPMethod         string            `json:"httpMethod"`
	StatusCode         string            `json:"statusCode"`
}

UpdateMethodResponseInput is the input for UpdateMethodResponse.

type UpdateModelInput

type UpdateModelInput struct {
	Description string `json:"description,omitempty"`
	Schema      string `json:"schema,omitempty"`
}

UpdateModelInput is the input for UpdateModel.

type UpdateRequestValidatorInput

type UpdateRequestValidatorInput struct {
	ValidateRequestBody       *bool  `json:"validateRequestBody,omitempty"`
	ValidateRequestParameters *bool  `json:"validateRequestParameters,omitempty"`
	Name                      string `json:"name,omitempty"`
}

UpdateRequestValidatorInput is the input for UpdateRequestValidator.

type UpdateResourceInput

type UpdateResourceInput struct {
	CorsConfiguration *CorsConfiguration `json:"corsConfiguration,omitempty"`
	PathPart          string             `json:"pathPart,omitempty"`
}

UpdateResourceInput is the input for UpdateResource (rename pathPart or set CORS).

type UpdateRestAPIInput

type UpdateRestAPIInput struct {
	EndpointConfiguration  *EndpointConfiguration `json:"endpointConfiguration,omitempty"`
	MinimumCompressionSize *int                   `json:"minimumCompressionSize,omitempty"`
	Name                   string                 `json:"name,omitempty"`
	Description            string                 `json:"description,omitempty"`
	Policy                 string                 `json:"policy,omitempty"`
	APIKeySource           string                 `json:"apiKeySource,omitempty"`
	BinaryMediaTypes       []string               `json:"binaryMediaTypes,omitempty"`
}

UpdateRestAPIInput is the input for UpdateRestApi.

type UpdateStageInput

type UpdateStageInput struct {
	CanarySettings      *CanarySettings          `json:"canarySettings,omitempty"`
	AccessLogSettings   *AccessLogSettings       `json:"accessLogSettings,omitempty"`
	TracingEnabled      *bool                    `json:"tracingEnabled,omitempty"`
	CacheClusterEnabled *bool                    `json:"cacheClusterEnabled,omitempty"`
	MethodSettings      map[string]MethodSetting `json:"methodSettings,omitempty"`
	Variables           map[string]string        `json:"variables,omitempty"`
	DeploymentID        string                   `json:"deploymentId,omitempty"`
	Description         string                   `json:"description,omitempty"`
	ClientCertificateID string                   `json:"clientCertificateId,omitempty"`
	CacheClusterSize    string                   `json:"cacheClusterSize,omitempty"`
}

UpdateStageInput is the input for UpdateStage.

type UpdateUsagePlanInput

type UpdateUsagePlanInput struct {
	Throttle    *ThrottleSettings     `json:"throttle,omitempty"`
	Quota       *QuotaSettings        `json:"quota,omitempty"`
	Name        string                `json:"name,omitempty"`
	Description string                `json:"description,omitempty"`
	UsagePlanID string                `json:"usagePlanId"`
	APIStages   []APIStageAssociation `json:"apiStages,omitempty"`
}

UpdateUsagePlanInput is the input for UpdateUsagePlan.

type UpdateVpcLinkInput

type UpdateVpcLinkInput struct {
	VpcLinkID   string `json:"vpcLinkId"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
}

UpdateVpcLinkInput is the input for UpdateVpcLink.

type UsageData

type UsageData struct {
	Items       map[string][]any `json:"items"`
	StartDate   string           `json:"startDate"`
	EndDate     string           `json:"endDate"`
	UsagePlanID string           `json:"usagePlanId"`
	Position    string           `json:"position,omitempty"`
}

UsageData represents the usage data response.

type UsagePlan

type UsagePlan struct {
	Tags        *tags.Tags            `json:"tags,omitempty"`
	Throttle    *ThrottleSettings     `json:"throttle,omitempty"`
	Quota       *QuotaSettings        `json:"quota,omitempty"`
	ID          string                `json:"id"`
	Name        string                `json:"name"`
	Description string                `json:"description,omitempty"`
	APIStages   []APIStageAssociation `json:"apiStages,omitempty"`
}

UsagePlan represents an API Gateway usage plan.

type UsagePlanKey

type UsagePlanKey struct {
	ID    string `json:"id"`
	Type  string `json:"type"`
	Value string `json:"value,omitempty"`
	Name  string `json:"name,omitempty"`
	// UsagePlanID identifies the owning usage plan. Internal storage-layer
	// identity only (composite key for the backend's flat
	// store.Table[UsagePlanKey]); never part of the wire response — see the
	// identical Authorizer.RestAPIID doc.
	UsagePlanID string `json:"-"`
}

UsagePlanKey represents an API key associated with a usage plan.

type VTLContext

type VTLContext struct {
	// StageVariables is exposed as $stageVariables.X.
	StageVariables map[string]string
	// Body is the raw request body passed as $input.body.
	Body string
	// RequestID is exposed as $context.requestId.
	RequestID string
	// HTTPMethod is exposed as $context.httpMethod.
	HTTPMethod string
	// ResourcePath is exposed as $context.resourcePath (the route template, e.g. /users/{id}).
	ResourcePath string
	// Path is exposed as $context.path (the actual request path).
	Path string
	// Stage is exposed as $context.stage.
	Stage string
	// APIID is exposed as $context.apiId.
	APIID string
	// SourceIP is exposed as $context.identity.sourceIp.
	SourceIP string
	// UserAgent is exposed as $context.identity.userAgent.
	UserAgent string
}

VTLContext holds the context variables available during VTL template rendering.

type VpcLink struct {
	Tags        map[string]string `json:"tags,omitempty"`
	ID          string            `json:"id"`
	Name        string            `json:"name"`
	Description string            `json:"description,omitempty"`
	Status      string            `json:"status"`
	TargetARNs  []string          `json:"targetArns,omitempty"`
}

VpcLink represents a VPC Link for private integrations.

Jump to

Keyboard shortcuts

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