client

package
v0.0.0-...-7dc8834 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppCacheDir

func AppCacheDir() (string, error)

func PrettyPrintResponse

func PrettyPrintResponse(dict map[string]any)

Types

type AuthRequest

type AuthRequest struct {
	Db        string `json:"dbName"`
	Name      string `json:"name"`
	Password  string `json:"password"`
	SuperUser bool   `json:"superUser"`
}

type AuthToken

type AuthToken struct {
	Db      string `json:"dbName"`
	Expire  int    `json:"expire"`
	Refresh string `json:"refresh"`
	Access  string `json:"access"`
}

type FindInstanceRequest

type FindInstanceRequest struct {
	RootObjectPath string `json:"rootObjectPath"`
	ResultType     string `json:"resultType"`
	PageSize       int    `json:"pageSize"`
	Criteria       struct {
		Condition string     `json:"condition"`
		Rules     []FindRule `json:"rules"`
	} `json:"criteria"`
}

type FindOptions

type FindOptions struct {
	Path    string
	Pattern string
	Type    string
}

type FindRule

type FindRule struct {
	Type     string `json:"type"`
	Value    any    `json:"value"`
	Value2   any    `json:"value2"`
	Operator string `json:"operator"`
}

type MiriaClient

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

func NewMiria

func NewMiria(host string) *MiriaClient

func (*MiriaClient) Authenticate

func (m *MiriaClient) Authenticate(username string, password string) error

Obtain token from username/password ////////////////////////////////////////

func (*MiriaClient) AuthenticateInteractive

func (m *MiriaClient) AuthenticateInteractive(force bool) error

Interactive authentication /////////////////////////////////////////////////

func (*MiriaClient) AuthenticationCache

func (m *MiriaClient) AuthenticationCache() (string, error)

Private method to cache token //////////////////////////////////////////////

func (*MiriaClient) CheckAuthentication

func (m *MiriaClient) CheckAuthentication() error

Check if token exists and is still valid ///////////////////////////////////

func (*MiriaClient) Find

func (m *MiriaClient) Find(opt FindOptions, cout chan []SearchResult, cerr chan error)

Find, meant to be used as a goroutine //////////////////////////////////////

func (*MiriaClient) Get

func (m *MiriaClient) Get(path string, authenticate bool) (map[string]any, error)

GET ////////////////////////////////////////////////////////////////////////

func (*MiriaClient) Post

func (m *MiriaClient) Post(path string, body any, authenticate bool) (map[string]any, error)

POST ///////////////////////////////////////////////////////////////////////

type ObjectId

type ObjectId struct {
	Id   int    `json:"id"`
	Name string `json:"name,omitempty"`
}

type SearchResponse

type SearchResponse struct {
	Next         string         `json:"next"`
	NextPage     string         `json:"nextPage"`
	Previous     any            `json:"previous"`
	PreviousPage any            `json:"previousPage"`
	Results      []SearchResult `json:"results"`
}

type SearchResult

type SearchResult struct {
	InstanceBackupDate string `json:"instanceBackupDate"`
	InstanceId         int    `json:"instanceId"`
	ObjectId           int    `json:"objectId"`
	ObjectName         string `json:"objectName"`
	ObjectPath         string `json:"objectPath"`
	ObjectSize         uint64 `json:"objectSize"`
	ObjectType         string `json:"objectType"`
	RepositoryId       int    `json:"repositoryId"`
}

Jump to

Keyboard shortcuts

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