getter

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Method is the HTTP method this endpoint is registered for.
	Method = "GET"
	// Name identifies the endpoint. It is aligned to the package path.
	Name = "imds/instance/getter/"
	// Path is the HTTP request path this endpoint is registered for.
	Path = "/imds/instance/{subscription_id}/{resource_group_name}/{vmss_name}/{instance_id}/"
)

Variables

This section is empty.

Functions

func IsInvalidConfig

func IsInvalidConfig(err error) bool

IsInvalidConfig asserts invalidConfigError.

func IsInvalidRequest

func IsInvalidRequest(err error) bool

IsInvalidRequest asserts invalidRequestError.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound asserts notFoundError.

Types

type Config

type Config struct {
	Logger          micrologger.Logger
	Middleware      *middleware.Middleware
	InstanceService *instance.Service
}

type Endpoint

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

func New

func New(config Config) (*Endpoint, error)

New creates a new configured endpoint object.

func (*Endpoint) Decoder

func (e *Endpoint) Decoder() kithttp.DecodeRequestFunc

Decoder decodes the incoming request.

func (*Endpoint) Encoder

func (e *Endpoint) Encoder() kithttp.EncodeResponseFunc

Encoder encodes the outgoing response.

func (*Endpoint) Endpoint

func (e *Endpoint) Endpoint() kitendpoint.Endpoint

Endpoint is where the actual request gets sent off to a service package that does some business logic.

func (*Endpoint) Method

func (e *Endpoint) Method() string

Method returns what HTTP verb this endpoint accepts. These are defined as consts above.

func (*Endpoint) Middlewares

func (e *Endpoint) Middlewares() []kitendpoint.Middleware

Middlewares returns a slice of the middlewares used in this endpoint.

func (*Endpoint) Name

func (e *Endpoint) Name() string

Name returns a name for this endpoint. These are defined as consts above.

func (*Endpoint) Path

func (e *Endpoint) Path() string

Path returns thet path that this endpoint is listening on. These are defined as consts above.

type PathParams

type PathParams struct {
	SubscriptionID    string
	ResourceGroupName string
	VMSSName          string
	InstanceID        string
}

PathParams hold the parameters we get from the URL.

type Request

type Request struct {
	PathParams PathParams
}

Request represents the path and body parameters coming in to this endpoint.

GET /imds/instance/{subscription_id}/{resource_group}/{vmss_name}/{instance_id}/

type Response

type Response map[interface{}]interface{}

Response is what we send back to the user as json.

Jump to

Keyboard shortcuts

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