paperspace

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: ISC Imports: 10 Imported by: 1

README

go-paperspace

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClusterAWSRegions = []string{
	"us-east-1",
	"us-east-2",
	"us-west-2",
	"ca-central-1",
	"sa-east-1",
	"eu-west-1",
	"eu-west-2",
	"eu-west-3",
	"eu-central-1",
	"eu-north-1",
	"me-south-1",
	"ap-east-1",
	"ap-northeast-1",
	"ap-northeast-2",
	"ap-southeast-1",
	"ap-southeast-2",
	"ap-south-1",
}
View Source
var DefaultBaseURL = "https://api.paperspace.io"
View Source
var DefaultClusterType = 3

Functions

This section is empty.

Types

type APIBackend

type APIBackend struct {
	BaseURL    string
	Debug      bool
	DebugBody  bool
	HTTPClient *http.Client
	RetryCount int
}

func NewAPIBackend

func NewAPIBackend() *APIBackend

func (*APIBackend) Request

func (c *APIBackend) Request(method string, url string,
	params, result interface{}, headers map[string]string) (res *http.Response, err error)

type APIToken

type APIToken struct {
	Key string `json:"key"`
}

type Backend

type Backend interface {
	Request(method, url string, params, result interface{}, headers map[string]string) (*http.Response, error)
}

type Client

type Client struct {
	APIKey  string
	Backend Backend
}

func NewClient

func NewClient() *Client

client that makes requests to Gradient API

func NewClientWithBackend

func NewClientWithBackend(backend Backend) *Client

func (Client) CreateCluster

func (c Client) CreateCluster(params ClusterCreateParams) (Cluster, error)

func (Client) GetCluster

func (c Client) GetCluster(ID string) (Cluster, error)

func (Client) GetClusters

func (c Client) GetClusters(p ...ClusterListParams) ([]Cluster, error)

func (*Client) Request

func (c *Client) Request(method, url string, params, result interface{}) (*http.Response, error)

func (Client) UpdateCluster

func (c Client) UpdateCluster(id string, p ClusterUpdateParams) (Cluster, error)

type Cluster

type Cluster struct {
	APIToken     APIToken            `json:"apiToken"`
	Domain       string              `json:"fqdn"`
	Platform     ClusterPlatformType `json:"cloud"`
	Name         string              `json:"name"`
	ID           string              `json:"id"`
	Region       string              `json:"region,omitempty"`
	S3Credential S3Credential        `json:"s3Credential"`
	TeamID       string              `json:"teamId"`
	Type         string              `json:"type,omitempty"`
}

type ClusterCreateParams

type ClusterCreateParams struct {
	ArtifactsAccessKeyID     string `json:"accessKey,omitempty" yaml:"artifactsAccessKeyId,omitempty"`
	ArtifactsBucketPath      string `json:"bucketPath,omitempty" yaml:"artifactsBucketPath,omitempty"`
	ArtifactsSecretAccessKey string `json:"secretKey,omitempty" yaml:"artifactsSecretAccessKey,omitempty"`
	Domain                   string `json:"fqdn" yaml:"domain"`
	IsDefault                bool   `json:"isDefault,omitempty" yaml"isDefault,omitempty"`
	Name                     string `json:"name" yaml:"name"`
	Platform                 string `json:"cloud,omitempty" yaml:"platform,omitempty"`
	Region                   string `json:"region,omitempty, yaml:"region,omitempty"`
	Type                     int    `json:"type,omitempty" yaml:"type,omitempty"`
}

type ClusterListParams

type ClusterListParams struct {
	Filter map[string]string `json:"filter"`
}

func NewClusterListParams

func NewClusterListParams() *ClusterListParams

type ClusterPlatformType

type ClusterPlatformType string
const (
	ClusterPlatformAWS   ClusterPlatformType = "aws"
	ClusterPlatformMetal ClusterPlatformType = "metal"
)

type ClusterUpdateAttributeParams

type ClusterUpdateAttributeParams struct {
	Domain string `json:"fqdn,omitempty" yaml:"domain"`
	Name   string `json:"name,omitempty" yaml:"name"`
}

type ClusterUpdateParams

type ClusterUpdateParams struct {
	Attributes         ClusterUpdateAttributeParams `json:"attributes,omitempty"`
	CreateNewToken     bool                         `json:"createNewToken,omitempty"`
	RegistryAttributes ClusterUpdateRegistryParams  `json:"registryAttributes,omitempty"`
	ID                 string                       `json:"id"`
	RetryWorkflow      bool                         `json:"retryWorkflow,omitempty"`
	S3Attributes       ClusterUpdateS3Params        `json:"s3Attributes,omitempty"`
}

type ClusterUpdateRegistryParams

type ClusterUpdateRegistryParams struct {
	URL        string `json:"url,omitempty"`
	Password   string `json:"password,omitempty"`
	Repository string `json:"repository,omitempty"`
	Username   string `json:"username,omitempty"`
}

type ClusterUpdateS3Params

type ClusterUpdateS3Params struct {
	AccessKey string `json:"accessKey,omitempty"`
	Bucket    string `json:"bucket,omitempty"`
	SecretKey string `json:"secretKey,omitempty"`
}

type PaperspaceError

type PaperspaceError struct {
	Name    string `json:"name"`
	Message string `json:"message"`
	Status  int    `json:"status"`
}

func (PaperspaceError) Error

func (e PaperspaceError) Error() string

type PaperspaceErrorResponse

type PaperspaceErrorResponse struct {
	Error *PaperspaceError `json:"error"`
}

type S3Credential

type S3Credential struct {
	AccessKey string `json:"accessKey"`
	Bucket    string `json:"bucket"`
	SecretKey string `json:"secretKey,omitempty"`
}

Jump to

Keyboard shortcuts

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