core

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogFatal = iota
	LogError
	LogWarn
	LogInfo
)
View Source
const Version = "v1"

Variables

View Source
var (
	SchemeHttp  = "http"
	SchemeHttps = "https"

	MethodGet    = "GET"
	MethodPut    = "PUT"
	MethodPost   = "POST"
	MethodDelete = "DELETE"
	MethodPatch  = "PATCH"
	MethodHead   = "HEAD"
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Scheme   string
	Endpoint string
	Timeout  time.Duration
}

func NewConfig

func NewConfig() *Config

func (*Config) SetEndpoint

func (c *Config) SetEndpoint(endpoint string)

func (*Config) SetScheme

func (c *Config) SetScheme(scheme string)

func (*Config) SetTimeout

func (c *Config) SetTimeout(timeout time.Duration)

type Credential

type Credential struct {
	AccessKey string
	SecretKey string
}

func NewCredentials

func NewCredentials(accessKey, secretKey string) *Credential

type DefaultLogger

type DefaultLogger struct {
	Level int
}

func NewDefaultLogger

func NewDefaultLogger(level int) *DefaultLogger

func (DefaultLogger) Log

func (logger DefaultLogger) Log(level int, message ...interface{})

type DummyLogger

type DummyLogger struct {
}

func NewDummyLogger

func NewDummyLogger() *DummyLogger

func (DummyLogger) Log

func (logger DummyLogger) Log(level int, message ...interface{})

type Logger

type Logger interface {
	Log(level int, message ...interface{})
}

type NCloudClient

type NCloudClient struct {
	Credential  Credential
	Config      Config
	ServiceName string
	Revision    string
	Logger      Logger
}

func (NCloudClient) Send

func (c NCloudClient) Send(method, path, data string) ([]byte, error)

type NCloudRequest

type NCloudRequest struct {
	Path   string
	Method string
}

func (NCloudRequest) GetMethod

func (n NCloudRequest) GetMethod() string

func (NCloudRequest) GetPath

func (n NCloudRequest) GetPath() string

type RefreshStatus

type RefreshStatus int
const (
	RefreshStatusRuning RefreshStatus = iota
	RefreshStatusSuccess
	RefreshStatusFailed
)

type RequestInterface

type RequestInterface interface {
	GetPath() string
	GetMethod() string
}

type Signer

type Signer struct {
	Credentials Credential
}

func NewSigner

func NewSigner(credsProvider Credential) *Signer

func (*Signer) Sign

func (s *Signer) Sign(path string) (signer, timestamp string)

Jump to

Keyboard shortcuts

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