ssm-sign-proxy: github.com/shogo82148/ssm-sign-proxy Index | Files

package proxy

import "github.com/shogo82148/ssm-sign-proxy"

Index

Package Files

error.go lambda.go proxy.go request.go version.go

Constants

const Version = "0.0.3"

Version is the version of ssm-sign-proxy.

type InstanceContext Uses

type InstanceContext struct {
    InstanceID string `json:"instance_id"`
    Hostname   string `json:"hostname"`
}

InstanceContext contains the information to identify the ARN invoking the lambda

type Lambda Uses

type Lambda struct {
    Config aws.Config
    Prefix string
    Client *http.Client
    // contains filtered or unexported fields
}

Lambda is a lambda function.

func (*Lambda) Handle Uses

func (l *Lambda) Handle(ctx context.Context, req *Request) (*Response, error)

Handle hanles events of the AWS Lambda.

type Parameter Uses

type Parameter struct {
    // general http headers
    Headers http.Header

    // basic authorization
    User     string
    Password string

    // rewrite url
    Path string

    // general queries
    Queries url.Values
}

Parameter is parameter for signing.

func (*Parameter) Sign Uses

func (p *Parameter) Sign(req *http.Request) error

Sign adds authentication information to the request.

type Proxy Uses

type Proxy struct {
    Config       aws.Config
    FunctionName string
    ErrorHandler func(http.ResponseWriter, *http.Request, error)
    // contains filtered or unexported fields
}

Proxy is a proxy which signs requests using AWS System Manager Parameter Store.

func (*Proxy) RoundTrip Uses

func (p *Proxy) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements the http.RoundTripper interface.

func (*Proxy) ServeHTTP Uses

func (p *Proxy) ServeHTTP(w http.ResponseWriter, req *http.Request)

type Request Uses

type Request struct {
    HTTPMethod                      string              `json:"httpMethod"`
    Path                            string              `json:"path"`
    QueryStringParameters           map[string]string   `json:"queryStringParameters,omitempty"`
    MultiValueQueryStringParameters map[string][]string `json:"multiValueQueryStringParameters,omitempty"`
    Headers                         map[string]string   `json:"headers,omitempty"`
    MultiValueHeaders               map[string][]string `json:"multiValueHeaders,omitempty"`
    RequestContext                  RequestContext      `json:"requestContext"`
    IsBase64Encoded                 bool                `json:"isBase64Encoded"`
    Body                            string              `json:"body"`
}

Request contains data originating from the proxy.

func NewRequest Uses

func NewRequest(req *http.Request) (*Request, error)

NewRequest converts the request to AWS Lambda event.

func (*Request) Request Uses

func (req *Request) Request() (*http.Request, error)

Request returns http.Request.

type RequestContext Uses

type RequestContext struct {
    Instance InstanceContext `json:"instance"`
}

RequestContext contains the information to identify the instance invoking the lambda

type Response Uses

type Response struct {
    StatusCode        int                 `json:"statusCode"`
    StatusDescription string              `json:"statusDescription"`
    Headers           map[string]string   `json:"headers"`
    MultiValueHeaders map[string][]string `json:"multiValueHeaders"`
    Body              string              `json:"body"`
    IsBase64Encoded   bool                `json:"isBase64Encoded"`
}

Response configures the response to be returned by the ALB Lambda target group for the request

func NewResponse Uses

func NewResponse(resp *http.Response) (*Response, error)

NewResponse returns new Response.

func (*Response) Response Uses

func (resp *Response) Response() (*http.Response, error)

Response returns http.Response.

func (*Response) WriteTo Uses

func (resp *Response) WriteTo(w http.ResponseWriter) error

WriteTo writes the response to w.

Package proxy imports 24 packages (graph). Updated 2019-04-03. Refresh now. Tools for package owners.