server

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CREDS_ROUTE   = "/creds"   // put/get/delete
	PROFILE_ROUTE = "/profile" // get
	LIST_ROUTE    = "/"        // get: default route
	CHARSET_JSON  = "application/json; charset=utf-8"
)

Variables

This section is empty.

Functions

func SetLogger

func SetLogger(l *logrus.Logger)

Types

type Client

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

func NewClient

func NewClient(port int) *Client

func (*Client) Delete

func (c *Client) Delete(profile string) error

func (*Client) GetProfile

func (c *Client) GetProfile() (string, error)

func (*Client) LoadUrl

func (c *Client) LoadUrl(profile string) string

func (*Client) ProfileUrl

func (c *Client) ProfileUrl() string

func (*Client) SubmitCreds

func (c *Client) SubmitCreds(creds *storage.RoleCredentials, profile string, slotted bool) error

type ClientRequest

type ClientRequest struct {
	Creds       *storage.RoleCredentials `json:"Creds"`
	ProfileName string                   `json:"ProfileName"`
}

type EcsServer

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

func NewEcsServer

func NewEcsServer(ctx context.Context, authToken string, port int) (*EcsServer, error)

NewEcsServer creates a new ECS Server

func (*EcsServer) AuthToken

func (e *EcsServer) AuthToken() string

func (*EcsServer) BaseURL

func (e *EcsServer) BaseURL() string

func (*EcsServer) CredsRoute

func (e *EcsServer) CredsRoute(w http.ResponseWriter, r *http.Request)

CredsRoutef accepts GET, PUT, DELETE to manage our creds. The path compoent after the first word indicates a named slot. Lack of a named slot utilizes the defaultCreds

func (*EcsServer) Expired

func (e *EcsServer) Expired(w http.ResponseWriter)

Expired returns a credentials expired response

func (*EcsServer) Invalid

func (e *EcsServer) Invalid(w http.ResponseWriter)

Invalid returns an invalid request response

func (*EcsServer) ListRoute

func (e *EcsServer) ListRoute(w http.ResponseWriter, r *http.Request)

ListRoute returns the list of roles

func (*EcsServer) OK

func (e *EcsServer) OK(w http.ResponseWriter)

OK returns an OK response

func (*EcsServer) ProfileRoute

func (e *EcsServer) ProfileRoute(w http.ResponseWriter, r *http.Request)

RoleRoute returns the current ProfileName in the defaultCreds

func (*EcsServer) Serve

func (e *EcsServer) Serve() error

Serve starts the sever and blocks

func (*EcsServer) Unavailable

func (e *EcsServer) Unavailable(w http.ResponseWriter)

Unavailable returns a credentials unavailable response

Jump to

Keyboard shortcuts

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