token

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 2 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"`   // Full User ID, in the `name@realm` format.

	// 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 *util.PVEBool `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        Info   `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) 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"`   // Full User ID, in the `name@realm` format.

}

type FindRequest

type FindRequest struct {
	Tokenid string `url:"tokenid" json:"tokenid"` // User-specific token identifier.
	Userid  string `url:"userid" json:"userid"`   // Full User ID, in the `name@realm` format.

}

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 *util.PVEBool `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"` // Full User ID, in the `name@realm` format.

}

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 *util.PVEBool `url:"privsep,omitempty" json:"privsep,omitempty"` // Restrict API token privileges with separate ACLs (default), or give full privileges of corresponding user.
}

type Info added in v0.0.10

type 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 *util.PVEBool `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"`   // Full User ID, in the `name@realm` format.

	// 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 *util.PVEBool `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 *util.PVEBool `url:"privsep,omitempty" json:"privsep,omitempty"` // Restrict API token privileges with separate ACLs (default), or give full privileges of corresponding user.
}

Updated token information.

Jump to

Keyboard shortcuts

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