apigateway

package
v0.0.0-...-473356e Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package apigateway provides swagger for API Gateway.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLambdaURI

func GetLambdaURI(lambdaArn string) string

GetLambdaURI returns the Lambda URI

Types

type ANYMethod

type ANYMethod struct {
	Produces                     []string                 `json:"produces"`
	Parameters                   []map[string]interface{} `json:"parameters"`
	Responses                    map[string]string        `json:"responses"`
	XAmazonAPIGatewayIntegration APIIntegration           `json:"x-amazon-apigateway-integration"`
}

ANYMethod provides is a part of th API Gateway swagger, it instructs the API to handle any HTTP method on an APIPath

type APIInfo

type APIInfo struct {
	Version string `json:"version"`
	Title   string `json:"title"`
}

APIInfo provides is a part of th API Gateway swagger

type APIIntegration

type APIIntegration struct {
	URI                 string                       `json:"uri"`
	Responses           map[string]map[string]string `json:"responses"`
	PassthroughBehavior string                       `json:"passthroughBehavior"`
	HTTPMethod          string                       `json:"httpMethod"`
	CacheNamespace      string                       `json:"cacheNamespace"`
	CacheKeyParameters  []string                     `json:"cacheKeyParameters"`
	Type                string                       `json:"type"`
	TimeoutMs           int                          `json:"timeoutInMillis"`
}

APIIntegration provides is a part of th API Gateway swagger

type APIPath

type APIPath struct {
	XAmazonAPIGatwayAnyMethod ANYMethod `json:"x-amazon-apigateway-any-method"`
}

APIPath provides is a part of th API Gateway swagger

type Swagger

type Swagger struct {
	Swagger                           string             `json:"swagger"`
	Info                              APIInfo            `json:"info"`
	Host                              string             `json:"host"`
	BasePath                          string             `json:"basePath"`
	Schemes                           []string           `json:"schemes"`
	Paths                             map[string]APIPath `json:"paths"`
	XAmazonAPIGatewayBinaryMediaTypes []string           `json:"x-amazon-apigateway-binary-media-types"`
}

Swagger defines an AWS API Gateway Lambda Proxy swagger definition More info here: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions.html

func NewSwagger

func NewSwagger(cfg *SwaggerConfig) (Swagger, error)

NewSwagger creates a new Swagger struct with some default values

type SwaggerConfig

type SwaggerConfig struct {
	Title             string
	LambdaURI         string
	CacheNamespace    string
	Version           string
	ResourceTimeoutMs int
}

SwaggerConfig holds configuration values for NewSwagger() TODO: Probably want to a more comprehensive field for mapping XAmazonAPIGatewayIntegration values with defaults, etc. For now, "ResourceTimeoutMs" is really XAmazonAPIGatewayIntegration.TimeoutMs which is "timeoutInMillis" in Swagger JSON to AWS.

Jump to

Keyboard shortcuts

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