openapiutils

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2018 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHostFromURL added in v0.1.5

func GetHostFromURL(url string) string

GetHostFromURL returns the fqdn of a given string (localhost including port number is also handled). Example domains that would match: - http://domain.com/ - domain.com/parameter - domain.com?anything - example.domain.com - example.domain-hyphen.com - www.domain.com - localhost - localhost:8080 Example domains that would not match: - http://domain.com:8080 (this use case is not support at the moment, it is assumed that actual domains will use standard ports)

func StringExtensionExists added in v0.3.0

func StringExtensionExists(extensions spec.Extensions, key string) (string, bool)

StringExtensionExists tries to find a match using the built-in extensions GetString method and if there is no match it will try to find a match without converting the key lower case (as done behind the scenes by GetString method). Context: The Extensions look up methods tweaks the given key making it lower case and then trying to match against the keys in the map. However this may not always work as the Extensions might have been added without going through the Add method which lower cases the key, though in situations where the struct was un-marshaled directly instead this translation would not have happened and therefore the look up queiry will not find matches

Types

type HeaderConfigurations

type HeaderConfigurations map[string]spec.Parameter

HeaderConfigurations defines the header configurations that on runtime will be used by the resource factory to lookup which headers should be passed along with the request

func GetAllHeaderParameters

func GetAllHeaderParameters(spec *spec.Swagger) HeaderConfigurations

GetAllHeaderParameters gets all the parameters of type headers present in the swagger file and returns the header configurations. Currently only the following parameters are supported: - root level parameters (not supported) - path level parameters (not supported) - operation level parameters (supported)

func GetHeaderConfigurations

func GetHeaderConfigurations(parameters []spec.Parameter) HeaderConfigurations

GetHeaderConfigurations gets all the header configurations for a specific

func GetHeaderConfigurationsForParameterGroups

func GetHeaderConfigurationsForParameterGroups(parametersGroup parameterGroups) HeaderConfigurations

GetHeaderConfigurationsForParameterGroups loops through the provided parametersGroup (collection of parameters per operation) and returns a map containing all the header configurations; the key will either be the value specified in the extTfHeader or if not present the default value will be the name of the header. In any case, the key name will be translated to a terraform compliant field name if needed (more details in convertToTerraformCompliantFieldName method)

Jump to

Keyboard shortcuts

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