sdk

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServerList = []string{

	"https://cloud.lambdalabs.com/api/v1/",
	"https:///api/v1/",
}

ServerList contains the list of servers available to the SDK

Functions

func Bool

func Bool(b bool) *bool

Bool provides a helper function to return a pointer to a bool

func Float32

func Float32(f float32) *float32

Float32 provides a helper function to return a pointer to a float32

func Float64

func Float64(f float64) *float64

Float64 provides a helper function to return a pointer to a float64

func Int

func Int(i int) *int

Int provides a helper function to return a pointer to an int

func Int64

func Int64(i int64) *int64

Int64 provides a helper function to return a pointer to an int64

func Pointer

func Pointer[T any](v T) *T

Pointer provides a helper function to return a pointer to a type

func String

func String(s string) *string

String provides a helper function to return a pointer to a string

Types

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient provides an interface for suplying the SDK with a custom HTTP client

type Lambda

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

Lambda Provider: API for interacting with the Lambda GPU Cloud

func New

func New(opts ...SDKOption) *Lambda

New creates a new instance of the SDK with the provided options

func (*Lambda) AddSSHKey

func (s *Lambda) AddSSHKey(ctx context.Context, request shared.AddSSHKey, opts ...operations.Option) (*operations.AddSSHKeyResponse, error)

AddSSHKey - Add SSH key Add an SSH key

To use an existing key pair, enter the public key for the `public_key` property of the request body.

To generate a new key pair, omit the `public_key` property from the request body. Save the `private_key` from the response somewhere secure. For example, with curl:

```

curl https://cloud.lambdalabs.com/api/v1/ssh-keys \
  --fail \
  -u ${LAMBDA_API_KEY}: \
  -X POST \
  -d '{"name": "new key"}' \
  | jq -r '.data.private_key' > key.pem

chmod 400 key.pem ```

Then, after you launch an instance with `new key` attached to it: ``` ssh -i key.pem <instance IP> ```

func (*Lambda) DeleteSSHKey

DeleteSSHKey - Delete SSH key Delete an SSH key.

func (*Lambda) GetInstance

GetInstance - List details of a specific instance Retrieves details of a specific instance, including whether or not the instance is running.

func (*Lambda) InstanceTypes

func (s *Lambda) InstanceTypes(ctx context.Context, opts ...operations.Option) (*operations.InstanceTypesResponse, error)

InstanceTypes - Retrieve list of offered instance types Returns a detailed list of the instance types offered by Lambda GPU Cloud. The details include the regions, if any, in which each instance type is currently available.

func (*Lambda) LaunchInstance

func (s *Lambda) LaunchInstance(ctx context.Context, request shared.Launch, opts ...operations.Option) (*operations.LaunchInstanceResponse, error)

LaunchInstance - Launch instances Launches one or more instances of a given instance type.

func (*Lambda) ListFileSystems

func (s *Lambda) ListFileSystems(ctx context.Context, opts ...operations.Option) (*operations.ListFileSystemsResponse, error)

ListFileSystems - List file systems Retrieve the list of file systems

func (*Lambda) ListInstances

func (s *Lambda) ListInstances(ctx context.Context, opts ...operations.Option) (*operations.ListInstancesResponse, error)

ListInstances - List running instances Retrieves a detailed list of running instances.

func (*Lambda) ListSSHKeys

func (s *Lambda) ListSSHKeys(ctx context.Context, opts ...operations.Option) (*operations.ListSSHKeysResponse, error)

ListSSHKeys - List SSH keys Retrieve the list of SSH keys

func (*Lambda) RestartInstance

func (s *Lambda) RestartInstance(ctx context.Context, request shared.Restart, opts ...operations.Option) (*operations.RestartInstanceResponse, error)

RestartInstance - Restart instances Restarts the given instances.

func (*Lambda) TerminateInstance

func (s *Lambda) TerminateInstance(ctx context.Context, request shared.Terminate, opts ...operations.Option) (*operations.TerminateInstanceResponse, error)

TerminateInstance - Terminate an instance Terminates a given instance.

type SDKOption

type SDKOption func(*Lambda)

func WithClient

func WithClient(client HTTPClient) SDKOption

WithClient allows the overriding of the default HTTP client used by the SDK

func WithRetryConfig

func WithRetryConfig(retryConfig retry.Config) SDKOption

func WithSecurity

func WithSecurity(security shared.Security) SDKOption

WithSecurity configures the SDK to use the provided security details

func WithSecuritySource

func WithSecuritySource(security func(context.Context) (shared.Security, error)) SDKOption

WithSecuritySource configures the SDK to invoke the Security Source function on each method call to determine authentication

func WithServerIndex

func WithServerIndex(serverIndex int) SDKOption

WithServerIndex allows the overriding of the default server by index

func WithServerURL

func WithServerURL(serverURL string) SDKOption

WithServerURL allows the overriding of the default server URL

func WithTemplatedServerURL

func WithTemplatedServerURL(serverURL string, params map[string]string) SDKOption

WithTemplatedServerURL allows the overriding of the default server URL with a templated URL populated with the provided parameters

func WithTimeout

func WithTimeout(timeout time.Duration) SDKOption

WithTimeout Optional request timeout applied to each operation

Directories

Path Synopsis
internal
models

Jump to

Keyboard shortcuts

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