control

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2017 License: Apache-2.0 Imports: 12 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCsrfHeader

func AddCsrfHeader(req *http.Request, client *http.Client) *http.Request

AddCsrfHeader checks to see if cookie jar has Csrf and adds it as a header

func CURLThis

func CURLThis(client *http.Client, req *http.Request) string

CURLThis takes an http.Client and http.Request and outputs the equivalent cURL command, to be used elsewhere.

func DebugRequestHeader

func DebugRequestHeader(req *http.Request)

DebugRequestHeader outputs headers of an http.Request struct to the log

func DebugResponseHeader

func DebugResponseHeader(resp *http.Response)

DebugResponseHeader outputs to the log the headers of an http.Response struct

Types

type Auth

type Auth struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

Auth is another simple struct

type Configuration

type Configuration struct {
	URL             string `json:"url" mapstructure:"url"`
	Email           string `json:"email" mapstructure:"email"`
	Password        string `json:"password" mapstructure:"password"`
	Theme           string `json:"theme" mapstructure:"theme"`
	ConsoleUsername string `json:"consoleUsername" mapstructure:"console-username"`
	LoginDomainID   string `json:"loginDomainID"`
}

Configuration provides a simple struct to hold login info

func InitializeConfiguration

func InitializeConfiguration(configLocation string, debug bool) (Configuration, error)

InitializeConfiguration reads config (or local.conf)

func ViperToConfiguration

func ViperToConfiguration(configmap map[string]interface{}, debug bool) (Configuration, error)

ViperToConfiguration Takes in viper, returns Configuration object

type UserInfo

type UserInfo struct {
	UserName             string `json:"userName"`
	Status               string `json:"status"`
	AvatarURL            string `json:"avatarURL"`
	UserFDN              string `json:"userFDN"`
	LoginState           string `json:"loginState"`
	AuthTokenValidUntil  string `json:"authTokenValidUntil"`
	LoginDomainID        string `json:"loginDomainId"`
	PendingNotifications int    `json:"pendingNotifications"`
}

UserInfo is the logged-in user's information

func LoginToCM

func LoginToCM(config Configuration, debug bool) (*http.Client, UserInfo, error)

LoginToCM logs in to the API Platform

Jump to

Keyboard shortcuts

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