api

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoContent = errors.New("no content")
View Source
var HTTPError httpError
View Source
var UserAgent = "soluble-cli/" + version.Version

Functions

This section is empty.

Types

type Client

type Client struct {
	*resty.Client
	Config
	NoOrganizationHook func() error
}

func NewClient

func NewClient(config *Config) *Client

func (*Client) Delete

func (c *Client) Delete(path string, options ...Option) (*jnode.Node, error)

func (*Client) Download added in v0.5.37

func (c *Client) Download(path string) ([]byte, error)

func (*Client) Get

func (c *Client) Get(path string, options ...Option) (*jnode.Node, error)

func (*Client) GetClient

func (c *Client) GetClient() *resty.Client

func (*Client) GetHostURL

func (c *Client) GetHostURL() string

func (*Client) GetOrganization

func (c *Client) GetOrganization() string

func (*Client) GetWithParams

func (c *Client) GetWithParams(path string, params map[string]string, options ...Option) (*jnode.Node, error)

func (*Client) Patch

func (c *Client) Patch(path string, body *jnode.Node, options ...Option) (*jnode.Node, error)

func (*Client) Post

func (c *Client) Post(path string, body *jnode.Node, options ...Option) (*jnode.Node, error)

func (*Client) XCPPost

func (c *Client) XCPPost(module string, files []string, values map[string]string, options ...Option) (*jnode.Node, error)

type Config

type Config struct {
	Organization               string
	OrganizationFromConfigFile bool
	LegacyAPIToken             string
	LaceworkAccount            string
	LaceworkAPIToken           string
	LaceworkAPIKey             string
	LaceworkAPISecret          string
	APIServer                  string
	APIPrefix                  string
	Debug                      bool
	TLSNoVerify                bool
	Timeout                    time.Duration
	RetryCount                 int
	RetryWaitSeconds           float64
	Headers                    []string
}

func (*Config) GetAppURL added in v0.5.39

func (c *Config) GetAppURL() string

func (*Config) GetDomain added in v0.5.39

func (c *Config) GetDomain() string

func (*Config) SetValues added in v0.5.39

func (c *Config) SetValues() *Config

func (*Config) Validate added in v0.5.39

func (c *Config) Validate() error

Verify that the configuration chosen is usuable In particular, verify that LW_ACCOUNT is the same, because otherwise Organization is likely to be wrong.

type Credentials added in v0.5.39

type Credentials map[string]*ProfileCredentials

func (Credentials) Find added in v0.5.39

func (c Credentials) Find(profileName string) *ProfileCredentials

func (Credentials) Save added in v0.5.39

func (c Credentials) Save() error

type Option

type Option interface {
	Apply(*resty.Request)
}

func CloseableOptionFunc added in v0.5.9

func CloseableOptionFunc(f func(req *resty.Request), close func() error) Option

func OptionFunc added in v0.5.9

func OptionFunc(f func(*resty.Request)) Option

type ProfileCredentials added in v0.5.39

type ProfileCredentials struct {
	Token     string    `json:"token"`
	ExpiresAt time.Time `json:"expiresAt"`
}

func (*ProfileCredentials) IsNearExpiration added in v0.5.39

func (p *ProfileCredentials) IsNearExpiration() bool

func (*ProfileCredentials) RefreshToken added in v0.5.39

func (p *ProfileCredentials) RefreshToken(domain string, keyID string, secretKey string) error

Jump to

Keyboard shortcuts

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