endpoints

package
v1.2.91060466 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EndpointInfo

type EndpointInfo struct {
	TemplateURL string
	APIVersion  string
	URLSegments []EndpointSegment
}

EndpointInfo represents an ARM endpoint

func GetEndpointInfoFromURL

func GetEndpointInfoFromURL(templateURL string, apiVersion string) (EndpointInfo, error)

GetEndpointInfoFromURL builds an EndpointInfo instance

func MustGetEndpointInfoFromURL added in v1.1.363

func MustGetEndpointInfoFromURL(url string, apiVersion string) *EndpointInfo

MustGetEndpointInfoFromURL creates an endpoint or panics

func (*EndpointInfo) BuildURL

func (ei *EndpointInfo) BuildURL(values map[string]string) (string, error)

BuildURL generates a URL based on the templateURL filling in placeholders with the values map

func (*EndpointInfo) BuildURLFromArray added in v1.1.363

func (ei *EndpointInfo) BuildURLFromArray(values []string) (string, error)

BuildURLFromArray generates a URL based on the templateURL filling in placeholders with the values array by index

func (*EndpointInfo) GenerateValueArrayFromMap added in v1.1.363

func (ei *EndpointInfo) GenerateValueArrayFromMap(templateValues map[string]string) []string

GenerateValueArrayFromMap builds an ordered array of template match values from a templateValues map for use with BuildURLFromArray

func (*EndpointInfo) Match

func (ei *EndpointInfo) Match(url string) MatchResult

Match tests whether a URL matches the EndpointInfo (ignoring query string values)

type EndpointSegment

type EndpointSegment struct {
	// holds a literal to match for fixed segments (e.g. /subscriptions/)
	Match string
	// holds the name of a templated segment (e.g. 'name' for /{name}/)
	Name   string
	Prefix string
	Suffix string
}

EndpointSegment reprsesents a segment of a template URL

type MatchResult

type MatchResult struct {
	// indicates whether this was a match
	IsMatch bool
	// holds the values pulled from named segments of the URL
	Values map[string]string
}

MatchResult holds information about an EndPointInfo match

Jump to

Keyboard shortcuts

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