Help us shape the future of Go! Take the 2026 Go Developer Survey

authprofile

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ResourceNotExists   = errors.New("resource does not exist")
	OperationNotAllowed = errors.New("operation not allowed")
	InvalidCredentials  = errors.New("invalid credentials")
)

error types

Functions

This section is empty.

Types

type AuthIf

type AuthIf interface {
	Auth(s *grequests.Session) (map[string]string, error)
	SendRequest(s *grequests.Session, uri, method string, ro *grequests.RequestOptions) (*grequests.Response, error)
}

Common interface for the subclasses, key, session and null.

type Details

type Details struct {
	ErrorCode string `json:"error_code"`
	Detail    string `json:"detail"`
	Info      string `json:"info"`
}

type HttpResp

type HttpResp struct {
	StatusCode int       `json:"status_code"`
	Details    []Details `json:"details"`
}

type KeyProfile

type KeyProfile struct {
	Name   string
	URL    string
	Key    string
	Secret string
}

func (*KeyProfile) Auth

func (p *KeyProfile) Auth(s *grequests.Session) (map[string]string, error)

func (*KeyProfile) SendRequest

func (p *KeyProfile) SendRequest(s *grequests.Session, uri, method string, ro *grequests.RequestOptions) (*grequests.Response, error)

type Profile

type Profile struct {
	Name                string `json:"name,omitempty"`
	URL                 string `json:"url,omitempty"`
	Key                 string `json:"key,omitempty"`
	Secret              string `json:"secret,omitempty"`
	Username            string `json:"username,omitempty"`
	Password            string `json:"password,omitempty"`
	SkipServerCertValid bool   `json:"skip_server_cert_check,omitempty"`
}

func (*Profile) Auth

func (p *Profile) Auth(s *grequests.Session) (map[string]string, error)

func (*Profile) AuthAndPostData

func (p *Profile) AuthAndPostData(uri, method, contentType string, params map[string]string, data []byte) (string, error)

func (*Profile) AuthAndPostMultipartFile

func (p *Profile) AuthAndPostMultipartFile(uri, fileLocation, fileKeyName string) (string, error)

func (*Profile) AuthAndPostMultipartFiles

func (p *Profile) AuthAndPostMultipartFiles(uri string, files, fileKeys []string, valuesPath string) (string, error)

func (*Profile) AuthAndRequest

func (p *Profile) AuthAndRequest(uri, method string, payload interface{}) (string, error)

func (*Profile) AuthAndRequestFullResponse

func (p *Profile) AuthAndRequestFullResponse(uri, method string, payload interface{}) (*grequests.Response, error)

func (*Profile) AuthAndRequestWithHeadersFullResponse

func (p *Profile) AuthAndRequestWithHeadersFullResponse(uri, method string, payload interface{}, additionHeaders map[string]string) (*grequests.Response, error)

func (*Profile) PostRequestFromFile

func (p *Profile) PostRequestFromFile(uri, filename string) (string, error)

func (*Profile) Request

func (p *Profile) Request(uri, method string, payload interface{}, yamlResp bool) (string, error)

func (*Profile) RequestFromFile

func (p *Profile) RequestFromFile(uri, method, filename string) (string, error)

func (*Profile) SendRequest

func (p *Profile) SendRequest(s *grequests.Session, uri, method string, ro *grequests.RequestOptions) (*grequests.Response, error)

func (*Profile) SubProfile

func (p *Profile) SubProfile() AuthIf

type Profiles

type Profiles struct {
	Default  string             `json:"default,omitempty"`
	Profiles map[string]Profile `json:"profiles,omitempty"`
}

Jump to

Keyboard shortcuts

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