staticroute

package
v0.0.0-...-08b716b Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package staticroute provides tools for building EC2 Instance Metadata static routes from the set of data endpoints. A data endpoint is an one that serves instance specific data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder map[string]unorderedSet

Builder constructs a set of Route objects. Endpoints added via FromEndpoint will be result in a static route for each level of endpoint nesting. The root route is always an empty string. Endpoints that are descendable will be appended with a slash. For example, adding the endpoint "/foo/bar/baz" will result in the following routes:

"/foo/bar" -> baz
"/foo" -> bar/
"" -> foo/

func NewBuilder

func NewBuilder() Builder

NewBuilder returns a new Builder instance.

func (Builder) Build

func (b Builder) Build() []Route

Build returns a slice of Route objects containing an Endpoint and its associated child elements for the response body. The root route is identified by an empty string for the Endpoint field of Route.

func (Builder) FromEndpoint

func (b Builder) FromEndpoint(endpoint string)

FromEndpoint adds endpoint to b. endpoint should be of URL path form such as "/foo/bar". FromEndpoint can be called multiple times.

type Route

type Route struct {
	Endpoint string
	Children []string
}

Route is an endpoint and its associated child elements.

Jump to

Keyboard shortcuts

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