stargoat

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetCommonParams

func SetCommonParams(h HasCommonParamSetters, client *http.Client, ctx context.Context, xCassandraToken string)

Types

type Client

type Client struct {
	Ctx               context.Context
	Token             StargateToken
	StayAuthenticated bool
	// contains filtered or unexported fields
}

func NewClient

func NewClient(sgURL string, token StargateToken, stayAuthenticated bool, httpClient *http.Client) (*Client, error)

func (*Client) DeleteDoc

func (c *Client) DeleteDoc(namespace, collection, id string) (bool, error)

func (*Client) GetDoc

func (c *Client) GetDoc(namespace, collection, id string) (interface{}, error)

func (*Client) PatchDoc

func (c *Client) PatchDoc(namespace, collection, id string, document interface{}) (string, error)

func (*Client) PostDoc

func (c *Client) PostDoc(namespace, collection string, document interface{}) (string, error)

func (*Client) PutDoc

func (c *Client) PutDoc(namespace, collection, id string, document interface{}) (string, error)

func (*Client) SearchDoc

func (c *Client) SearchDoc(namespace, collection string, search *string, raw *bool) (interface{}, error)

type CredsProvider

type CredsProvider interface {
	Get() (string, string, error)
}

type EnvVarCredsProvider

type EnvVarCredsProvider struct {
	UsernameEnv string
	PasswordEnv string
}

func (*EnvVarCredsProvider) Get

func (e *EnvVarCredsProvider) Get() (string, string, error)

type HasCommonParamSetters

type HasCommonParamSetters interface {
	SetContext(ctx context.Context)
	SetHTTPClient(client *http.Client)
	SetXCassandraToken(xCassandraToken string)
}

type StargateToken

type StargateToken struct {
	AuthToken string `json:"authToken"`
}

func Authenticate

func Authenticate(creds CredsProvider, authURL string) (*StargateToken, error)

Jump to

Keyboard shortcuts

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