apitokens

package
v0.6.28 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIToken

type APIToken struct {
	ID          int                         `json:"id"`
	Name        string                      `json:"name"`
	Description string                      `json:"description"`
	ExpDate     *gcorecloud.JSONRFC3339ZZ   `json:"exp_date"`
	ClientUser  *ClientUser                 `json:"client_user"`
	Deleted     bool                        `json:"deleted"`
	Expired     bool                        `json:"expired"`
	Created     gcorecloud.JSONRFC3339ZZ    `json:"created"`
	LastUsage   *gcorecloud.JSONRFC3339Date `json:"last_usage"`
}

APIToken represents an api token structure.

type ClientRole

type ClientRole struct {
	ID   types.RoleIDType   `json:"id"`
	Name types.RoleNameType `json:"name"`
}

ClientRole represents a client role structure.

type ClientUser

type ClientUser struct {
	Role      ClientRole `json:"role"`
	Deleted   bool       `json:"deleted"`
	UserID    int        `json:"user_id"`
	UserName  string     `json:"user_name"`
	UserEmail string     `json:"user_email"`
	ClientID  int        `json:"client_id"`
}

ClientUser represents a client user structure.

type CreateClientUser

type CreateClientUser struct {
	Role ClientRole `json:"role" validate:"dive"`
}

type CreateOpts

type CreateOpts struct {
	Name        string                   `json:"name" required:"true" validate:"required"`
	Description string                   `json:"description" required:"true" validate:"required"`
	ExpDate     *gcorecloud.JSONRFC3339Z `json:"exp_date"`
	ClientUser  CreateClientUser         `json:"client_user" required:"true" validate:"required"`
}

CreateOpts represents options used to create an api token.

func (CreateOpts) ToApiTokenCreateMap

func (opts CreateOpts) ToApiTokenCreateMap() (map[string]interface{}, error)

ToApiTokenCreateMap builds a request body from CreateOpts.

func (CreateOpts) Validate

func (opts CreateOpts) Validate() error

Validate

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToApiTokenCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type CreateResult

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

CreateResult represents the result of a create operation. Call its Extract method to interpret it as a Token.

func Create

func Create(client *gcorecloud.ServiceClient, clientID int, opts CreateOptsBuilder) (r CreateResult)

Create creates an APIToken.

func (CreateResult) Extract

func (r CreateResult) Extract() (*Token, error)

Extract is a function that accepts a result and extracts a token resource.

func (CreateResult) ExtractInto

func (r CreateResult) ExtractInto(v interface{}) error

type DeleteResult

type DeleteResult struct {
	gcorecloud.ErrResult
}

DeleteResult represents the result of a delete operation

func Delete

func Delete(c *gcorecloud.ServiceClient, clientID, tokenID int) (r DeleteResult)

Delete a specific api token based on its unique ID.

type GetResult

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

GetResult represents the result of a get operation. Call its Extract method to interpret it as an APIToken.

func Get

func Get(c *gcorecloud.ServiceClient, clientID, tokenID int) (r GetResult)

Get retrieves a specific api token based on its unique ID.

func (GetResult) Extract

func (r GetResult) Extract() (*APIToken, error)

Extract is a function that accepts a result and extracts an api token resource.

func (GetResult) ExtractInto

func (r GetResult) ExtractInto(v interface{}) error

type ListOpts

type ListOpts struct {
	RoleID      types.RoleIDType `q:"role,omitempty" validate:"omitempty,enum"`
	IssuedBy    int              `q:"issued_by,omitempty"`
	NotIssuedBy int              `q:"not_issued_by,omitempty"`
	Deleted     bool             `q:"deleted,omitempty"`
}

ListOpts allows the filtering and sorting of paginated collections through the API.

func (ListOpts) ToAPITokenListQuery

func (opts ListOpts) ToAPITokenListQuery() (string, error)

ToAPITokenListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToAPITokenListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request.

type ListResult

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

ListResult represents the result of a get operation. Call its Extract method to interpret it as an []APIToken.

func List

func List(c *gcorecloud.ServiceClient, clientID int, opts ListOptsBuilder) (r ListResult)

List is a convenience function that returns all api tokens

func (ListResult) Extract

func (r ListResult) Extract() ([]APIToken, error)

Extract is a function that accepts a result and extracts an api token resources list.

func (ListResult) ExtractInto

func (r ListResult) ExtractInto(v interface{}) error

type Token

type Token struct {
	Token string `json:"token"`
}

Token represents a token structure.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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