util

package
v0.0.0-...-9ac85d6 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateJWTToken

func CreateJWTToken(env string, username string, password string) (string, error)

CreateJWTToken gets raw jwt token from username, password and environment.

func CreateOSIOToken

func CreateOSIOToken(env string, uuid string, key string, keyID string, valid int64, session string) (string, error)

CreateOSIOToken creates OSIO token given inputs such as user identity, environment, etc.

func EnsureSuffix

func EnsureSuffix(s string, suffix string) string

EnsureSuffix ensures that hte given strings ends with the specified suffix. If the string s already ends with the suffix suffix, then it is returned unmodified, otherwise string s with the suffix appended is returned.

func HTTPClient

func HTTPClient() *http.Client

HTTPClient returns a client with a timeout

func IsBool

func IsBool(value interface{}, key string) error

IsBool checks if value stored at a given key is a bool.

func IsDuration

func IsDuration(value interface{}, key string) error

IsDuration checks if value stored at a given key is a bool.

func IsInt

func IsInt(value interface{}, key string) error

IsInt checks if values stored at a given key is an int.

func IsNotEmpty

func IsNotEmpty(value interface{}, key string) error

IsNotEmpty checks if value stored at given key is empty. if it is empty it returns an error.

func IsURL

func IsURL(value interface{}, key string) error

IsURL checks if value store at an given key is an URL.

func NameOfFunction

func NameOfFunction(pc uintptr) string

NameOfFunction gives name of the current function given program counter.

Types

type Attributes

type Attributes struct {
	Username string `json:"username"`
	Email    string `json:"email"`
	FullName string `json:"fullName"`
}

Attributes consists of user attributes such as username, email and fullname.

type Data

type Data struct {
	Attributes Attributes `json:"attributes"`
}

Data contains user attributes.

type Error

type Error struct {
	Errors []ErrorInfo
}

Error represents list of error informations.

type ErrorInfo

type ErrorInfo struct {
	Code   string `json:"code"`
	Detail string `json:"detail"`
}

ErrorInfo describes an HTTP error, consisting of HTTP status code and error detail.

type MultiError

type MultiError struct {
	Errors []error
}

MultiError is a collection of errors.

func (*MultiError) Collect

func (m *MultiError) Collect(err error)

Collect appends an error to this MultiError.

func (*MultiError) Empty

func (m *MultiError) Empty() bool

Empty returns true if current MuiltiError is empty, false otherwise.

func (MultiError) ToError

func (m MultiError) ToError() error

ToError returns a single error made up of all errors in this MultiError.

type User

type User struct {
	Data Data `json:"data"`
}

User represents an user of OSIO.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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