token

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChildCreateRequest

type ChildCreateRequest struct {
	Tokenid string `url:"tokenid",json:"tokenid"` // User-specific token identifier.
	Userid  string `url:"userid",json:"userid"`   // User ID

	// The following parameters are optional
	Comment *string `url:"comment,omitempty",json:"comment,omitempty"`
	Expire  *int    `url:"expire,omitempty",json:"expire,omitempty"`   // API token expiration date (seconds since epoch). '0' means no expiration date.
	Privsep *bool   `url:"privsep,omitempty",json:"privsep,omitempty"` // Restrict API token privileges with separate ACLs (default), or give full privileges of corresponding user.
}

type ChildCreateResponse

type ChildCreateResponse struct {
	FullTokenid string `url:"full-tokenid",json:"full-tokenid"` // The full token id.
	Info        struct {

		// The following parameters are optional
		Comment *string `url:"comment,omitempty",json:"comment,omitempty"`
		Expire  *int    `url:"expire,omitempty",json:"expire,omitempty"`   // API token expiration date (seconds since epoch). '0' means no expiration date.
		Privsep *bool   `url:"privsep,omitempty",json:"privsep,omitempty"` // Restrict API token privileges with separate ACLs (default), or give full privileges of corresponding user.
	} `url:"info",json:"info"`
	Value string `url:"value",json:"value"` // API token value used for authentication.

}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(c HTTPClient) *Client

func (*Client) ChildCreate

func (c *Client) ChildCreate(ctx context.Context, req *ChildCreateRequest) (*ChildCreateResponse, error)

ChildCreate Generate a new API token for a specific user. NOTE: returns API token value, which needs to be stored as it cannot be retrieved afterwards!

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error)

Delete Remove API token for a specific user.

func (*Client) Find

func (c *Client) Find(ctx context.Context, req *FindRequest) (*FindResponse, error)

Find Get specific API token information.

func (*Client) Index

func (c *Client) Index(ctx context.Context, req *IndexRequest) (*IndexResponse, error)

Index Get user API tokens.

func (*Client) Update

func (c *Client) Update(ctx context.Context, req *UpdateRequest) (*UpdateResponse, error)

Update Update API token for a specific user.

type DeleteRequest

type DeleteRequest struct {
	Tokenid string `url:"tokenid",json:"tokenid"` // User-specific token identifier.
	Userid  string `url:"userid",json:"userid"`   // User ID

}

type DeleteResponse

type DeleteResponse map[string]interface{}

type FindRequest

type FindRequest struct {
	Tokenid string `url:"tokenid",json:"tokenid"` // User-specific token identifier.
	Userid  string `url:"userid",json:"userid"`   // User ID

}

type FindResponse

type FindResponse struct {

	// The following parameters are optional
	Comment *string `url:"comment,omitempty",json:"comment,omitempty"`
	Expire  *int    `url:"expire,omitempty",json:"expire,omitempty"`   // API token expiration date (seconds since epoch). '0' means no expiration date.
	Privsep *bool   `url:"privsep,omitempty",json:"privsep,omitempty"` // Restrict API token privileges with separate ACLs (default), or give full privileges of corresponding user.
}

type HTTPClient

type HTTPClient interface {
	Do(context.Context, string, string, interface{}, interface{}) error
}

type IndexRequest

type IndexRequest struct {
	Userid string `url:"userid",json:"userid"` // User ID

}

type IndexResponse

type IndexResponse []*struct {
	Tokenid string `url:"tokenid",json:"tokenid"` // User-specific token identifier.

	// The following parameters are optional
	Comment *string `url:"comment,omitempty",json:"comment,omitempty"`
	Expire  *int    `url:"expire,omitempty",json:"expire,omitempty"`   // API token expiration date (seconds since epoch). '0' means no expiration date.
	Privsep *bool   `url:"privsep,omitempty",json:"privsep,omitempty"` // Restrict API token privileges with separate ACLs (default), or give full privileges of corresponding user.
}

type UpdateRequest

type UpdateRequest struct {
	Tokenid string `url:"tokenid",json:"tokenid"` // User-specific token identifier.
	Userid  string `url:"userid",json:"userid"`   // User ID

	// The following parameters are optional
	Comment *string `url:"comment,omitempty",json:"comment,omitempty"`
	Expire  *int    `url:"expire,omitempty",json:"expire,omitempty"`   // API token expiration date (seconds since epoch). '0' means no expiration date.
	Privsep *bool   `url:"privsep,omitempty",json:"privsep,omitempty"` // Restrict API token privileges with separate ACLs (default), or give full privileges of corresponding user.
}

type UpdateResponse

type UpdateResponse struct {

	// The following parameters are optional
	Comment *string `url:"comment,omitempty",json:"comment,omitempty"`
	Expire  *int    `url:"expire,omitempty",json:"expire,omitempty"`   // API token expiration date (seconds since epoch). '0' means no expiration date.
	Privsep *bool   `url:"privsep,omitempty",json:"privsep,omitempty"` // Restrict API token privileges with separate ACLs (default), or give full privileges of corresponding user.
}

Jump to

Keyboard shortcuts

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