Documentation
¶
Index ¶
- Variables
- func Boolean(v bool) *bool
- func Int(v int) *int
- func String(v string) *string
- type APIBackend
- type APIToken
- type AutoscalingGroup
- type AutoscalingGroupCreateParams
- type AutoscalingGroupDeleteParams
- type AutoscalingGroupGetParams
- type AutoscalingGroupListParams
- type AutoscalingGroupUpdateAttributeParams
- type AutoscalingGroupUpdateParams
- type Backend
- type Client
- func (c Client) CreateAutoscalingGroup(params AutoscalingGroupCreateParams) (AutoscalingGroup, error)
- func (c Client) CreateCluster(params ClusterCreateParams) (Cluster, error)
- func (c Client) CreateMachine(params MachineCreateParams) (Machine, error)
- func (c Client) CreateNetwork(params NetworkCreateParams) (Network, error)
- func (c Client) DeleteAutoscalingGroup(id string, params AutoscalingGroupDeleteParams) error
- func (c Client) DeleteMachine(id string, params MachineDeleteParams) error
- func (c Client) DeleteNetwork(id string, params NetworkDeleteParams) error
- func (c Client) GetAutoscalingGroup(id string, params AutoscalingGroupGetParams) (AutoscalingGroup, error)
- func (c Client) GetAutoscalingGroups(params AutoscalingGroupListParams) ([]AutoscalingGroup, error)
- func (c Client) GetCluster(id string, params ClusterGetParams) (Cluster, error)
- func (c Client) GetClusters(params ClusterListParams) ([]Cluster, error)
- func (c Client) GetMachine(id string, params MachineGetParams) (Machine, error)
- func (c Client) GetMachines(params MachineListParams) ([]Machine, error)
- func (c Client) GetNetwork(id string, params NetworkGetParams) (Network, error)
- func (c Client) GetNetworks(params NetworkListParams) ([]Network, error)
- func (c *Client) Request(method string, url string, params, result interface{}, ...) (*http.Response, error)
- func (c Client) UpdateAutoscalingGroup(id string, params AutoscalingGroupUpdateParams) error
- func (c Client) UpdateCluster(id string, params ClusterUpdateParams) (Cluster, error)
- func (c Client) UpdateMachine(params MachineUpdateParams) (Machine, error)
- type Cluster
- type ClusterCreateParams
- type ClusterGetParams
- type ClusterListParams
- type ClusterPlatformType
- type ClusterUpdateAttributeParams
- type ClusterUpdateParams
- type ClusterUpdateRegistryParams
- type ClusterUpdateS3Params
- type ContainerRegistry
- type Filter
- type Machine
- type MachineCreateParams
- type MachineDeleteParams
- type MachineGetParams
- type MachineListParams
- type MachineState
- type MachineUpdateAttributeParams
- type MachineUpdateParams
- type Network
- type NetworkCreateParams
- type NetworkDeleteParams
- type NetworkGetParams
- type NetworkListParams
- type PaperspaceError
- type PaperspaceErrorResponse
- type RequestParams
- type S3Credential
Constants ¶
This section is empty.
Variables ¶
View Source
var ClusterAWSRegions = []string{
"us-east-1",
"us-east-2",
"us-west-1",
"us-west-2",
"ca-central-1",
"eu-west-1",
"eu-west-2",
"eu-central-1",
"ap-northeast-1",
"ap-northeast-2",
"ap-southeast-1",
"ap-southeast-2",
}
View Source
var ClusterAzureRegions = []string{
"australiacentral",
"australiaeast",
"australiasoutheast",
"brazilsouth",
"brazilsoutheast",
"canadacentral",
"canadaeast",
"centralindia",
"centralus",
"eastasia",
"eastus",
"eastus2",
"francecentral",
"francesouth",
"germanynorth",
"germanywestcentral",
"japaneast",
"japanwest",
"koreacentral",
"koreasouth",
"northcentralus",
"northeurope",
"norwayeast",
"norwaywest",
"southafricanorth",
"southcentralus",
"southindia",
"southeastasia",
"switzerlandnorth",
"switzerlandwest",
"uaecentral",
"uaenorth",
"uksouth",
"ukwest",
"westcentralus",
"westeurope",
"westus",
"westus2",
}
View Source
var ClusterGCPRegions = []string{
"asia-east1",
"europe-west1",
"europe-west4",
"us-central1",
"us-east1",
"us-west1",
}
View Source
var ClusterPlatforms = []ClusterPlatformType{ ClusterPlatformAWS, ClusterPlatformAzure, ClusterPlatformDGX, ClusterPlatformGCP, ClusterPlatformMetal, ClusterPlatformPaperspace, ClusterPlatformGraphcore, ClusterPlatformSambaNova, }
View Source
var DefaultBaseURL = "https://api.paperspace.io"
View Source
var DefaultClusterType = 3
View Source
var RegionMap = map[string]int{
"East Coast (NY2)": 1,
"West Coast (CA1)": 2,
"Europe (AMS1)": 3,
}
View Source
var SuccessStatusCodes = []int{ http.StatusOK, http.StatusCreated, http.StatusAccepted, http.StatusNonAuthoritativeInfo, http.StatusNoContent, }
Functions ¶
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{}, requestParams RequestParams) (res *http.Response, err error)
type AutoscalingGroup ¶ added in v0.3.0
type AutoscalingGroup struct {
ID string `json:"id"`
Name string `json:"name"`
Min int `json:"min"`
Max int `json:"max"`
Current int `json:"current"`
ClusterID string `json:"clusterId"`
MachineType string `json:"machineType"`
TemplateID string `json:"templateId"`
ScriptID string `json:"startupScriptId"`
NetworkID string `json:"networkId"`
Nodes []Machine `json:"nodes"`
}
type AutoscalingGroupCreateParams ¶ added in v0.3.0
type AutoscalingGroupCreateParams struct {
RequestParams
Name string `json:"name"`
Min int `json:"min"`
Max int `json:"max"`
ClusterID string `json:"clusterId"`
MachineType string `json:"machineType"`
TemplateID string `json:"templateId"`
ScriptID string `json:"startupScriptId,omitempty"`
NetworkID string `json:"networkId"`
}
type AutoscalingGroupDeleteParams ¶ added in v0.3.0
type AutoscalingGroupDeleteParams struct {
RequestParams
}
type AutoscalingGroupGetParams ¶ added in v0.3.0
type AutoscalingGroupGetParams struct {
RequestParams
IncludeNodes bool `json:"includeNodes,omitempty"`
}
type AutoscalingGroupListParams ¶ added in v0.3.0
type AutoscalingGroupListParams struct {
RequestParams
Filter Filter `json:"filter,omitempty"`
IncludeNodes bool `json:"includeNodes,omitempty"`
}
type AutoscalingGroupUpdateAttributeParams ¶ added in v0.3.0
type AutoscalingGroupUpdateAttributeParams struct {
Name string `json:"name,omitempty"`
Min *int `json:"min,omitempty"`
Max *int `json:"max,omitempty"`
Current *int `json:"current,omitempty"`
MachineType string `json:"machineType,omitempty"`
TemplateID string `json:"templateId,omitempty"`
ScriptID string `json:"startupScriptId,omitempty"`
NetworkID string `json:"networkId,omitempty"`
}
type AutoscalingGroupUpdateParams ¶ added in v0.3.0
type AutoscalingGroupUpdateParams struct {
RequestParams
Attributes AutoscalingGroupUpdateAttributeParams `json:"attributes,omitempty"`
}
type Client ¶
func NewClientWithBackend ¶
func (Client) CreateAutoscalingGroup ¶ added in v0.3.0
func (c Client) CreateAutoscalingGroup(params AutoscalingGroupCreateParams) (AutoscalingGroup, error)
func (Client) CreateCluster ¶
func (c Client) CreateCluster(params ClusterCreateParams) (Cluster, error)
func (Client) CreateMachine ¶ added in v0.3.0
func (c Client) CreateMachine(params MachineCreateParams) (Machine, error)
func (Client) CreateNetwork ¶ added in v1.0.0
func (c Client) CreateNetwork(params NetworkCreateParams) (Network, error)
func (Client) DeleteAutoscalingGroup ¶ added in v0.3.0
func (c Client) DeleteAutoscalingGroup(id string, params AutoscalingGroupDeleteParams) error
func (Client) DeleteMachine ¶ added in v0.3.0
func (c Client) DeleteMachine(id string, params MachineDeleteParams) error
func (Client) DeleteNetwork ¶ added in v1.0.0
func (c Client) DeleteNetwork(id string, params NetworkDeleteParams) error
func (Client) GetAutoscalingGroup ¶ added in v0.3.0
func (c Client) GetAutoscalingGroup(id string, params AutoscalingGroupGetParams) (AutoscalingGroup, error)
func (Client) GetAutoscalingGroups ¶ added in v0.3.0
func (c Client) GetAutoscalingGroups(params AutoscalingGroupListParams) ([]AutoscalingGroup, error)
func (Client) GetCluster ¶
func (c Client) GetCluster(id string, params ClusterGetParams) (Cluster, error)
func (Client) GetClusters ¶
func (c Client) GetClusters(params ClusterListParams) ([]Cluster, error)
func (Client) GetMachine ¶ added in v0.3.0
func (c Client) GetMachine(id string, params MachineGetParams) (Machine, error)
func (Client) GetMachines ¶ added in v0.3.0
func (c Client) GetMachines(params MachineListParams) ([]Machine, error)
func (Client) GetNetwork ¶ added in v1.0.0
func (c Client) GetNetwork(id string, params NetworkGetParams) (Network, error)
func (Client) GetNetworks ¶ added in v1.0.0
func (c Client) GetNetworks(params NetworkListParams) ([]Network, error)
func (Client) UpdateAutoscalingGroup ¶ added in v0.3.0
func (c Client) UpdateAutoscalingGroup(id string, params AutoscalingGroupUpdateParams) error
func (Client) UpdateCluster ¶
func (c Client) UpdateCluster(id string, params ClusterUpdateParams) (Cluster, error)
func (Client) UpdateMachine ¶ added in v0.3.0
func (c Client) UpdateMachine(params MachineUpdateParams) (Machine, error)
type Cluster ¶
type Cluster struct {
APIToken APIToken `json:"apiToken"`
ClusterSecret string `json:"clusterSecret,omitempty"`
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"`
ContainerRegistry *ContainerRegistry `json:"containerRegistry,omitempty"`
TeamID string `json:"teamId"`
Type string `json:"type,omitempty"`
}
type ClusterCreateParams ¶
type ClusterCreateParams struct {
RequestParams
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"`
ContainerRegistryURL string `json:"containerRegistryUrl,omitempty" yaml:"containerRegistryUrl,omitempty"`
ContainerRegistryRepository string `json:"containerRegistryRepository,omitempty" yaml:"containerRegistryRepository,omitempty"`
ContainerRegistryUsername string `json:"containerRegistryUsername,omitempty" yaml:"containerRegistryUsername,omitempty"`
ContainerRegistryPassword string `json:"containerRegistryPassword,omitempty" yaml:"containerRegistryPassword,omitempty"`
}
type ClusterGetParams ¶ added in v0.3.0
type ClusterGetParams struct {
RequestParams
}
type ClusterListParams ¶
type ClusterListParams struct {
RequestParams
Filter Filter `json:"filter,omitempty"`
}
func NewClusterListParams ¶
func NewClusterListParams() ClusterListParams
type ClusterPlatformType ¶
type ClusterPlatformType string
const ( ClusterPlatformAWS ClusterPlatformType = "aws" ClusterPlatformAzure ClusterPlatformType = "azure" ClusterPlatformGCP ClusterPlatformType = "gcp" ClusterPlatformDGX ClusterPlatformType = "nvidia-dgx" ClusterPlatformMetal ClusterPlatformType = "metal" ClusterPlatformPaperspace ClusterPlatformType = "paperspace-cloud" ClusterPlatformGraphcore ClusterPlatformType = "graphcore" ClusterPlatformSambaNova ClusterPlatformType = "sambanova" )
type ClusterUpdateAttributeParams ¶
type ClusterUpdateAttributeParams struct {
RequestParams
Domain string `json:"fqdn,omitempty" yaml:"domain"`
Name string `json:"name,omitempty" yaml:"name"`
}
type ClusterUpdateParams ¶
type ClusterUpdateParams struct {
RequestParams
Attributes ClusterUpdateAttributeParams `json:"attributes,omitempty"`
CreateNewToken bool `json:"createNewToken,omitempty"`
CreateNewClusterSecret bool `json:"createNewClusterSecret,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 {
RequestParams
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 {
RequestParams
AccessKey string `json:"accessKey,omitempty"`
Bucket string `json:"bucket,omitempty"`
SecretKey string `json:"secretKey,omitempty"`
}
type ContainerRegistry ¶ added in v0.3.3
type Machine ¶ added in v0.3.0
type Machine struct {
ID string `json:"id"`
Name string `json:"name"`
OS string `json:"os"`
RAM int64 `json:"ram,string"`
CPUs int `json:"cpus"`
GPU string `json:"gpu"`
State MachineState `json:"state"`
Region string `json:"region"`
StorageTotal int64 `json:"storageTotal,string"`
StorageUsed int64 `json:"storageUsed,string"`
UsageRate string `json:"usageRate"`
ShutdownTimeoutInHours int `json:"shutdownTimeoutInHours"`
ShutdownTimeoutForces bool `json:"shutdownTimeoutForces"`
AutoSnapshotFrequency int `json:"autoSnapshotFrequency"`
AutoSnapshotSaveCount int `json:"autoSnapshotSaveCount"`
RestorePointSnapshotID string `json:"restorePointSnapshotId"`
RestorePointFrequency string `json:"restorePointFrequency"`
AgentType string `json:"agentType"`
NetworkID string `json:"networkId"`
PrivateIpAddress string `json:"privateIpAddress"`
PublicIpAddress string `json:"publicIpAddress"`
DtCreated time.Time `json:"dtCreated"`
DtDeleted time.Time `json:"dtDeleted"`
UserID string `json:"userId"`
TeamID string `json:"teamId"`
ScriptID string `json:"scriptId"`
DtLastRun string `json:"dtLastRun"`
IsManaged bool `json:"isManaged"`
MachineType string `json:"machineType"`
}
type MachineCreateParams ¶ added in v0.3.0
type MachineCreateParams struct {
RequestParams
Name string `json:"name"`
Region string `json:"region"`
MachineType string `json:"machineType"`
Size int `json:"size"`
BillingType string `json:"billingType"`
TemplateID string `json:"templateId"`
UserID string `json:"userId,omitempty"`
TeamID string `json:"teamId,omitempty"`
ScriptID string `json:"scriptId,omitempty"`
NetworkID string `json:"networkId,omitempty"`
ShutdownTimeoutInHours int `json:"shutdownTimeoutInHours,omitempty"`
AssignPublicIP *bool `json:"assignPublicIP,omitempty"`
IsManaged *bool `json:"isManaged,omitempty"`
StartOnCreate *bool `json:"startOnCreate,omitempty"`
TakeInitialSnapshot *bool `json:"takeInitialSnapshot,omitempty"`
MarkSnapshotAsRestorePoint *bool `json:"markSnapshotAsRestorePoint,omitempty"`
RestorePointFrequency string `json:"restorePointFrequency,omitempty"`
}
type MachineDeleteParams ¶ added in v0.3.0
type MachineDeleteParams struct {
RequestParams
}
type MachineGetParams ¶ added in v0.3.0
type MachineGetParams struct {
RequestParams
}
type MachineListParams ¶ added in v0.3.0
type MachineListParams struct {
RequestParams
Filter Filter `json:"filter,omitempty"`
}
func NewMachineListParams ¶ added in v0.3.0
func NewMachineListParams() MachineListParams
type MachineState ¶ added in v0.3.0
type MachineState string
const ( MachineStateOff MachineState = "off" MachineStateProvisioning MachineState = "provisioning" MachineStateRunning MachineState = "running" )
type MachineUpdateAttributeParams ¶ added in v0.3.0
type MachineUpdateAttributeParams struct {
RequestParams
Name string `json:"name,omitempty" yaml:"name"`
}
type MachineUpdateParams ¶ added in v0.3.0
type MachineUpdateParams struct {
RequestParams
ID string `json:"machineId"`
Name string `json:"machineName,omitempty"`
ShutdownTimeoutInHours int `json:"shutdownTimeoutInHours,omitempty"`
ShutdownTimeoutForces *bool `json:"shutdownTimeoutForces,omitempty"`
AutoSnapshotFrequency string `json:"autoSnapshotFrequency,omitempty"`
AutoSnapshotSaveCount int `json:"autoSnapshotSaveCount,omitempty"`
PerformAutoSnapshot *bool `json:"performAutoSnapshot,omitempty"`
DynamicPublicIP *bool `json:"dynamicPublicIp,omitempty"`
}
type NetworkCreateParams ¶ added in v1.0.0
type NetworkCreateParams struct {
RequestParams
Name string `json:"name"`
Region string `json:"region"`
}
type NetworkDeleteParams ¶ added in v1.0.0
type NetworkDeleteParams struct {
RequestParams
}
type NetworkGetParams ¶ added in v1.0.0
type NetworkGetParams struct {
RequestParams
}
type NetworkListParams ¶ added in v1.0.0
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 RequestParams ¶ added in v0.3.0
type S3Credential ¶
Click to show internal directories.
Click to hide internal directories.