function

package
v0.8.42-5e42e19 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package function is an Golang lambda package. You run all your Lambda functions within this package

Index

Constants

View Source
const (
	//MIMEApplicationJSON is the http header for a JSON type
	MIMEApplicationJSON = "application/json"

	//MIMEApplicationJSONCharsetUTF8 is the http header for a JSON type with a charset of UTF8
	MIMEApplicationJSONCharsetUTF8 = "application/json; charset=utf-8"

	//MIMEApplicationJavaScript is the http header for a JSON type
	MIMEApplicationJavaScript = "application/javascript"

	//MIMEApplicationJavaScriptCharsetUTF8 is the http header for a JSON type with a charset of UTF8
	MIMEApplicationJavaScriptCharsetUTF8 = "application/javascript; charset=utf-8"

	//MIMEApplicationXML is the http header for a XML type
	MIMEApplicationXML = "application/xml"

	//MIMEApplicationXMLCharsetUTF8 is the http header for a XML type with a charset of UTF8
	MIMEApplicationXMLCharsetUTF8 = "application/xml; charset=utf-8"

	//MIMEApplicationForm is the http header for a form type
	MIMEApplicationForm = "application/x-www-form-urlencoded"

	//MIMEApplicationProtobuf is the http header for a protobuf type
	MIMEApplicationProtobuf = "application/protobuf"

	//MIMEApplicationMsgpack is the http header for a msgpack type
	MIMEApplicationMsgpack = "application/msgpack"

	//MIMETextHTML is the http header for a HTML type
	MIMETextHTML = "text/html"

	//MIMETextHTMLCharsetUTF8 is the http header for a HTML type with a charset of UTF8
	MIMETextHTMLCharsetUTF8 = "text/html; charset=utf-8"

	//MIMETextPlain is the http header for a plain text type
	MIMETextPlain = "text/plain"

	//MIMETextPlainCharsetUTF8 is the http header for a plain text type with a charset of UTF8
	MIMETextPlainCharsetUTF8 = "text/plain; charset=utf-8"

	//MIMEMultipartForm is the http header for a multi part form data type
	MIMEMultipartForm = "multipart/form-data"

	//MIMEOctetStream is the http header for a octet stream type
	MIMEOctetStream = "application/octet-stream"
)
View Source
const (
	//RequestContextName is a variable name
	RequestContextName = "REQUEST_CONTEXT"

	//RequestContextID is a variable name
	RequestContextID = "REQUEST_ID"

	//HeaderAuthenticateRealm is a http header auth realm
	HeaderAuthenticateRealm = `Basic realm="api.google.com"`

	//HeaderTrue is a http header variable name true
	HeaderTrue = "true"

	//ContentTypeIsXML is a variable when the payload is xml
	ContentTypeIsXML = "xml"

	//ContentTypeIsJSON is a variable when the payload is json
	ContentTypeIsJSON = "json"

	//ProtocalHTTP is a variable name when the request is over unsecure transport
	ProtocalHTTP = "http"

	//ProtocalHTTPS is a variable name when the request is over secure transport
	ProtocalHTTPS = "https"

	//HeaderAcceptEncoding is a http header variable name for encoding
	HeaderAcceptEncoding = "Accept-Encoding"

	//HeaderAllow is a http header variable name for allowing
	HeaderAllow = "Allow"

	//HeaderAuthorization is a http header variable name
	HeaderAuthorization = "Authorization"

	//HeaderContentDisposition is a http header variable name
	HeaderContentDisposition = "Content-Disposition"

	//HeaderContentEncoding is a http header variable name
	HeaderContentEncoding = "Content-Encoding"

	//HeaderContentLength is a http header variable name
	HeaderContentLength = "Content-Length"

	//HeaderContentType is a http header variable name
	HeaderContentType = "Content-Type"

	//HeaderCookie is a http header variable name
	HeaderCookie = "Cookie"

	//HeaderSetCookie is a http header variable name
	HeaderSetCookie = "Set-Cookie"

	//HeaderIfModifiedSince is a http header variable name
	HeaderIfModifiedSince = "If-Modified-Since"

	//HeaderLastModified is a http header variable name
	HeaderLastModified = "Last-Modified"

	//HeaderLocation is a http header variable name
	HeaderLocation = "Location"

	//HeaderUpgrade is a http header variable name
	HeaderUpgrade = "Upgrade"

	//HeaderUserAgent is a http header variable name
	HeaderUserAgent = "User-Agent"

	//HeaderVary is a http header variable name
	HeaderVary = "Vary"

	//HeaderWWWAuthenticate is a http header variable name
	HeaderWWWAuthenticate = "WWW-Authenticate"

	//HeaderXForwardedProto is a http header variable name
	HeaderXForwardedProto = "X-Forwarded-Proto"

	//HeaderXHTTPMethodOverride is a http header variable name
	HeaderXHTTPMethodOverride = "X-HTTP-Method-Override"

	//HeaderXForwardedFor is a http header variable name
	HeaderXForwardedFor = "X-Forwarded-For"

	//HeaderXRealIP is a http header variable name
	HeaderXRealIP = "X-Real-IP"

	//HeaderXRateLimitLimit is a http header variable name
	HeaderXRateLimitLimit = "X-Ratelimit-Limit"

	//HeaderXRateLimitRemainingRequests is a http header variable name
	HeaderXRateLimitRemainingRequests = "X-Ratelimit-Remaining"

	//HeaderXRateLimitResetTime is a http header variable name
	HeaderXRateLimitResetTime = "X-Ratelimit-Reset"

	//HeaderServer is a http header variable name
	HeaderServer = "Server"

	//HeaderOrigin is a http header variable name
	HeaderOrigin = "Origin"

	//HeaderAccessControlRequestMethod is a http header variable name
	HeaderAccessControlRequestMethod = "Access-Control-Request-Method"

	//HeaderAccessControlRequestHeaders is a http header variable name
	HeaderAccessControlRequestHeaders = "Access-Control-Request-Headers"

	//HeaderAccessControlAllowOrigin is a http header variable name
	HeaderAccessControlAllowOrigin = "Access-Control-Allow-Origin"

	//HeaderAccessControlAllowMethods is a http header variable name
	HeaderAccessControlAllowMethods = "Access-Control-Allow-Methods"

	//HeaderAccessControlAllowHeaders is a http header variable name
	HeaderAccessControlAllowHeaders = "Access-Control-Allow-Headers"

	//HeaderAccessControlAllowCredentials is a http header variable name
	HeaderAccessControlAllowCredentials = "Access-Control-Allow-Credentials"

	//HeaderAccessControlExposeHeaders is a http header variable name
	HeaderAccessControlExposeHeaders = "Access-Control-Expose-Headers"

	//HeaderAccessControlMaxAge is a http header variable name
	HeaderAccessControlMaxAge = "Access-Control-Max-Age"

	//HeaderPlatformPrivacyPreferences is a http header variable name
	HeaderPlatformPrivacyPreferences = "P3P"

	//PlatformPrivacyPreferencesPolicy is a http header variable name
	PlatformPrivacyPreferencesPolicy = "CP=\"NON DSP LAW CUR ADM DEV TAI PSA PSD HIS OUR DEL IND UNI PUR COM NAV INT DEM CNT STA POL HEA PRE LOC IVD SAM IVA OTC\""

	//HeaderStrictTransportSecurity is a http header variable name
	HeaderStrictTransportSecurity = "Strict-Transport-Security"

	//HeaderXContentTypeOptions is a http header variable name
	HeaderXContentTypeOptions = "X-Content-Type-Options"

	//HeaderXXSSProtection is a http header variable name
	HeaderXXSSProtection = "X-XSS-Protection"

	//HeaderXFrameOptions is a http header variable name
	HeaderXFrameOptions = "X-Frame-Options"

	//HeaderContentSecurityPolicy is a http header variable name
	HeaderContentSecurityPolicy = "Content-Security-Policy"

	//HeaderXCSRFToken is a http header variable name
	HeaderXCSRFToken = "X-CSRF-Token"
)

Variables

View Source
var (

	//ErrInternalServerError is an internal error
	ErrInternalServerError = ErrorResponse{Code: 500, Message: "Sorry, we've run into a problem. Please try again or contact support"}

	//ErrServiceUnavailable is an error when the service can not respond
	ErrServiceUnavailable = ErrorResponse{Code: 500, Message: "Service is temporarily unavailable"}

	//ErrGenericInvalidPayload is an error when the payload is incorrect
	ErrGenericInvalidPayload = ErrorResponse{Code: 400, Message: "Invalid request body"}

	//ErrMethodNotAllowed is an error when the request method isnt allowed
	ErrMethodNotAllowed = ErrorResponse{Code: 405, Message: "Sorry that type of HTTP request is not allowed"}

	//ErrQueryStringParametersRequired is an error when a query string was included in the request
	ErrQueryStringParametersRequired = ErrorResponse{Code: 403, Message: "You must supply a query string parameters"}

	//ErrForbiddenIPAddress is an error when the connecting IP is banned OR forbidden
	ErrForbiddenIPAddress = ErrorResponse{Code: 403, Message: "Your request has been rate limited"}

	//ErrSecureConnectionRequired is an error when the connection is unsecure
	ErrSecureConnectionRequired = ErrorResponse{Code: 403, Message: "You must connect via https"}
)

Functions

This section is empty.

Types

type ErrorResponse

type ErrorResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

ErrorResponse struct

type Function

type Function struct{}

Function struct

func New

func New() *Function

New creates a new function struct

func (*Function) Run

Run executes the function on the Lambda request

type OkResponse

type OkResponse struct {
}

OkResponse is an empty struct response

Jump to

Keyboard shortcuts

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