client

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	XAuthUser     = "X-Auth-User"
	XAuthKey      = "X-Auth-Key"
	XAuthUserType = "X-Auth-UserType"
	XAuthToken    = "X-Auth-Token"
)

Variables

This section is empty.

Functions

func Delete

func Delete[S any](ctx context.Context, client FusionComputeClient, uri string, success *S) error

func DeleteWithError

func DeleteWithError[S any, E fcErr.Error](ctx context.Context, client FusionComputeClient, uri string, success *S, failed E) error

func Do

func Do[S any](req *resty.Request, method, uri string, success *S) error

func DoWithError

func DoWithError[S any, E fcErr.Error](req *resty.Request, method, uri string, success *S, failed E) error

func Get

func Get[S any](ctx context.Context, client FusionComputeClient, uri string, success *S) error

func GetWithError

func GetWithError[S any, E fcErr.Error](ctx context.Context, client FusionComputeClient, uri string, success *S, failed E) error

func Post

func Post[S any](ctx context.Context, client FusionComputeClient, uri string, body interface{}, success *S) error

func PostWithError

func PostWithError[S any, E fcErr.Error](ctx context.Context, client FusionComputeClient, uri string, body interface{}, success *S, failed E) error

Types

type Auth

type Auth interface {
	Login(ctx context.Context) error
	Logout(ctx context.Context) error
}

func NewAuth

func NewAuth(client FusionComputeClient) Auth

type Config

type Config struct {
	RestyConstructor RestyConstructor
}

func (*Config) Merge

func (c *Config) Merge(conf *Config)

type FusionComputeClient

type FusionComputeClient interface {
	Connect(context.Context) error
	DisConnect(context.Context) error
	SetSession(token string)
	GetSession() Session
	GetHost() string
	GetUser() string
	GetPassword() string
	GetHTTPClient() *resty.Client
	GetApiClient() (*resty.Client, error)
}

func NewFusionComputeClient

func NewFusionComputeClient(host string, user string, password string, cfg ...*Config) FusionComputeClient

type LoginResponse

type LoginResponse struct {
	Validity     int      `json:"validity"`
	RightType    int      `json:"rightType"`
	PrivilegeIds []string `json:"privilegeIds"`
	UserId       string   `json:"userId"`
	UserName     string   `json:"userName"`
	RoleList     []string `json:"roleList"`
}

type RestyConstructor

type RestyConstructor func() *resty.Client

type Session

type Session string

Jump to

Keyboard shortcuts

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