server

package
v1.13.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	CREDS_ROUTE   = "/creds"   // put/get/delete
	PROFILE_ROUTE = "/profile" // get
	DEFAULT_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) ListProfiles added in v1.13.0

func (c *Client) ListProfiles() ([]ListProfilesResponse, error)

ListProfiles returns a list of profiles that are loaded into slots

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) DefaultRoute added in v1.13.0

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

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) 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

type ListProfilesResponse added in v1.13.0

type ListProfilesResponse struct {
	ProfileName  string `json:"ProfileName" header:"ProfileName"`
	AccountIdPad string `json:"AccountId" header:"AccountIdPad"`
	RoleName     string `json:"RoleName" header:"RoleName"`
	Expiration   int64  `json:"Expiration" header:"Expiration"`
	Expires      string `json:"Expires" header:"Expires"`
}

func (ListProfilesResponse) GetHeader added in v1.13.0

func (lpr ListProfilesResponse) GetHeader(fieldName string) (string, error)

GetHeader is required for GenerateTable()

type Message added in v1.13.0

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

Use format as defined here: https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/credentials/endpointcreds

Jump to

Keyboard shortcuts

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