common

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2020 License: Apache-1.1, Apache-2.0, BSD-3-Clause, + 1 more Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Exchange = func(request *http.Request) (urlResponse string, statusCode int, err error) {
	transport := &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}
	client := &http.Client{Transport: transport}

	resp, err := client.Do(request)
	if err != nil {
		return "", 0, err
	}

	urlResponse, err = getURLOutput(resp)
	statusCode = resp.StatusCode
	return
}

Exchange implements the impl.RequestHelper function type

Functions

func CheckRequiredParam

func CheckRequiredParam(restEndPoint domain.RestEndPoint, command domain.UserCommand) error

CheckRequiredParam checks if required parameters have been provided

func Contains added in v1.0.2

func Contains(s []string, e string) bool

func GetEndPoints

func GetEndPoints(commandData *domain.CommandData, processRequest impl.RequestHelper) error

GetEndPoints retrieves available endpoint from the Swagger endpoint on the Geode/PCC locator

func GetOption

func GetOption(parameters map[string]string, options []string) string

GetOption retrieves entries from the map of parameters by name

func GetTargetAndClusterCommand

func GetTargetAndClusterCommand(args []string) (target string, userCommand domain.UserCommand)

GetTargetAndClusterCommand extracts the target and command from the args and environment variables

func HasOption

func HasOption(parameters map[string]string, options []string) bool

HasOption checks if a option has been passed in on the command line

func NewCommandProcessor

func NewCommandProcessor(requester impl.RequestHelper, formatter Formatter, requestBuilder RequestBuilder) (impl.CommandProcessor, error)

NewCommandProcessor provides the constructor for the CommandProcessor

Types

type Formatter

type Formatter interface {
	DescribeEndpoint(domain.RestEndPoint, bool) string
	FormatResponse(string, string, bool) (string, error)
}

Formatter interface provides response and other output formatting

type RequestBuilder

type RequestBuilder func(endpoint domain.RestEndPoint, commandData *domain.CommandData) (request *http.Request, err error)

RequestBuilder is function type generating a request

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.
formatfakes
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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