platform

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package platform provides the Platform API client.

Package platform provides the Platform API client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIResponse

type APIResponse struct {
	Hint    string `json:"hint"`
	Details string `json:"details"`
	Code    string `json:"code"`
	Message string `json:"message"`
}

APIResponse represents common fields of an API response.

type Client

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

Client provides the Platform API client.

func NewClient

func NewClient(platformCfg ClientConfig) (*Client, error)

NewClient creates a new Platform API client.

func (*Client) CheckPlatformToken

func (p *Client) CheckPlatformToken(ctx context.Context, request TokenCheckRequest) (TokenCheckResponse, error)

CheckPlatformToken makes an HTTP request to check the Platform Access Token.

func (*Client) StartObservationSession

func (p *Client) StartObservationSession(ctx context.Context, request StartObservationRequest) (StartObservationResponse, error)

StartObservationSession makes an HTTP request to notify Platform about start observation.

func (*Client) StopObservationSession

func (p *Client) StopObservationSession(ctx context.Context, request StopObservationRequest) (APIResponse, error)

StopObservationSession makes an HTTP request to notify Platform about stop observation and pass observation details.

func (*Client) UploadObservationArtifact added in v2.4.0

func (p *Client) UploadObservationArtifact(ctx context.Context, data []byte, sessionID, artifactType string) error

UploadObservationArtifact makes an HTTP request to upload an observation artifact to Platform.

func (*Client) UploadObservationLogs

func (p *Client) UploadObservationLogs(ctx context.Context, data []byte, sessionID string) error

UploadObservationLogs makes an HTTP request to upload observation logs to Platform.

type ClientConfig

type ClientConfig struct {
	URL         string
	AccessToken string
}

ClientConfig describes configuration parameters of Postgres.ai Platform client.

type ConfigValidationError

type ConfigValidationError error

ConfigValidationError represents a config validation error.

type StartObservationRequest

type StartObservationRequest struct {
	InstanceID string            `json:"instance_id"`
	CloneID    string            `json:"clone_id"`
	StartedAt  string            `json:"started_at"`
	Config     types.Config      `json:"config"`
	Tags       map[string]string `json:"tags"`
}

StartObservationRequest represents a start observation request.

type StartObservationResponse

type StartObservationResponse struct {
	APIResponse
	SessionID uint64 `json:"id"`
}

StartObservationResponse represents response of a start observation request.

type StopObservationRequest

type StopObservationRequest struct {
	SessionID  uint64                   `json:"id"`
	FinishedAt string                   `json:"finished_at"`
	Result     models.ObservationResult `json:"result"`
}

StopObservationRequest represents a stop observation request.

type TokenCheckRequest

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

TokenCheckRequest represents a token checking request.

type TokenCheckResponse

type TokenCheckResponse struct {
	APIResponse
	OrganizationID uint `json:"org_id"`
	Personal       bool `json:"is_personal"`
}

TokenCheckResponse represents response of a token checking request.

type UploadArtifactResponse added in v2.4.0

type UploadArtifactResponse struct {
	DBLabSessionID int       `json:"dblab_session_id"`
	ArtifactTime   time.Time `json:"artifact_time"`
	ArtifactType   string    `json:"artifact_type"`
}

UploadArtifactResponse represents response of a uploading artifact request.

Jump to

Keyboard shortcuts

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