handlers

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package handlers containers the HTTP Handlers for Local Metadata and Credentials

Index

Constants

View Source
const (
	// CredentialExpirationTimeFormat is the time stamp format used in the Local Credentials Service HTTP response
	CredentialExpirationTimeFormat = time.RFC3339
)

Variables

This section is empty.

Functions

func ServeHTTP

func ServeHTTP(handler func(w http.ResponseWriter, r *http.Request) error) func(w http.ResponseWriter, r *http.Request)

ServeHTTP wraps an HTTP Handler

Types

type CredentialResponse

type CredentialResponse struct {
	AccessKeyID     string `json:"AccessKeyId"`
	Expiration      string
	RoleArn         string
	SecretAccessKey string
	Token           string
}

CredentialResponse is used to marshal the JSON response for the Credentials Service

type CredentialService

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

CredentialService vends credentials to containers

func NewCredentialService

func NewCredentialService() (*CredentialService, error)

NewCredentialService returns a struct that handles credentials requests

func NewCredentialServiceWithClients

func NewCredentialServiceWithClients(iamClient iamiface.IAMAPI, stsClient stsiface.STSAPI, currentSession *session.Session) *CredentialService

NewCredentialServiceWithClients returns a struct that handles credentials requests with the given clients

func (*CredentialService) SetupRoutes

func (service *CredentialService) SetupRoutes(router *mux.Router)

SetupRoutes sets up the credentials paths in mux

type Error

type Error interface {
	error
	Status() int
}

Error wraps built-in error and adds a status code

type HTTPError

type HTTPError struct {
	Code int
	Err  error
}

HTTPError represents an error with a HTTP status code.

func (HTTPError) Error

func (herr HTTPError) Error() string

Error satisfies the error interface.

func (HTTPError) Status

func (herr HTTPError) Status() int

Status retutns the HTTP status code.

type MetadataService

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

MetadataService vends docker metadata to containers

func NewMetadataService

func NewMetadataService(taskMetadata, contMetadata map[string]interface{}) (*MetadataService, error)

NewMetadataService returns a struct that handles metadata requests

func NewMetadataServiceWithClient

func NewMetadataServiceWithClient(dockerClient docker.Client, taskMetadata, contMetadata map[string]interface{}) (*MetadataService, error)

NewMetadataServiceWithClient returns a struct that handles metadata requests using the given Docker Client

func (*MetadataService) SetupV2Routes

func (service *MetadataService) SetupV2Routes(router *mux.Router)

SetupV2Routes sets up the V2 Metadata routes

func (*MetadataService) SetupV3Routes

func (service *MetadataService) SetupV3Routes(router *mux.Router)

SetupV3Routes sets up the V3 Metadata routes

Directories

Path Synopsis
Package functionaltests includes tests that make http requests to the handlers using net/http/test
Package functionaltests includes tests that make http requests to the handlers using net/http/test

Jump to

Keyboard shortcuts

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