From c86442a663f52b398658e6d86ceaa883c30e9b55 Mon Sep 17 00:00:00 2001 From: Pratik Patel Date: Tue, 28 Jul 2026 12:44:43 -0700 Subject: [PATCH] remove unused lambda, this functionality is in dev-plane --- .github/workflows/validation-lambdalabs.yml | 59 - .golangci.bck.yml | 2 - .golangci.yml | 2 - docs/CloudManual.md | 76 +- docs/IntegrationGuide.md | 48 +- docs/VALIDATION_TESTING.md | 16 +- docs/example-dot-env | 3 +- go.mod | 2 - go.sum | 6 - v1/providers/lambdalabs/CONTRIBUTE.md | 48 - v1/providers/lambdalabs/Makefile | 11 - v1/providers/lambdalabs/README.md | 79 - v1/providers/lambdalabs/SECURITY.md | 82 - v1/providers/lambdalabs/capabilities.go | 38 - v1/providers/lambdalabs/capabilities_test.go | 33 - v1/providers/lambdalabs/client.go | 150 -- v1/providers/lambdalabs/client_test.go | 92 - v1/providers/lambdalabs/common_test.go | 54 - v1/providers/lambdalabs/credential.go | 54 - v1/providers/lambdalabs/credential_test.go | 52 - v1/providers/lambdalabs/errors.go | 51 - v1/providers/lambdalabs/errors_test.go | 327 ---- .../lambdalabs/gen/lambdalabs/.gitignore | 24 - .../gen/lambdalabs/.openapi-generator-ignore | 23 - .../gen/lambdalabs/.openapi-generator/FILES | 67 - .../gen/lambdalabs/.openapi-generator/VERSION | 1 - .../lambdalabs/gen/lambdalabs/.travis.yml | 8 - .../lambdalabs/gen/lambdalabs/README.md | 173 -- .../gen/lambdalabs/api/openapi.yaml | 1591 ----------------- .../lambdalabs/gen/lambdalabs/api_default.go | 1426 --------------- .../lambdalabs/gen/lambdalabs/client.go | 661 ------- .../gen/lambdalabs/configuration.go | 228 --- .../lambdalabs/docs/AddSSHKey200Response.md | 51 - .../gen/lambdalabs/docs/AddSSHKeyRequest.md | 77 - .../gen/lambdalabs/docs/DefaultAPI.md | 664 ------- .../gen/lambdalabs/docs/ErrorCode.md | 29 - .../gen/lambdalabs/docs/ErrorResponseBody.md | 77 - .../gen/lambdalabs/docs/FileSystem.md | 203 --- .../lambdalabs/docs/GetInstance200Response.md | 51 - .../gen/lambdalabs/docs/Instance.md | 408 ----- .../gen/lambdalabs/docs/InstanceType.md | 135 -- .../gen/lambdalabs/docs/InstanceTypeSpecs.md | 114 -- .../docs/InstanceTypes200Response.md | 51 - .../docs/InstanceTypes200ResponseDataValue.md | 72 - .../docs/LaunchInstance200Response.md | 51 - .../docs/LaunchInstance200ResponseData.md | 51 - .../lambdalabs/docs/LaunchInstanceRequest.md | 181 -- .../docs/ListFileSystems200Response.md | 51 - .../docs/ListInstances200Response.md | 51 - .../lambdalabs/docs/ListSSHKeys200Response.md | 51 - .../gen/lambdalabs/docs/ModelError.md | 108 -- .../lambdalabs/gen/lambdalabs/docs/Region.md | 72 - .../docs/RestartInstance200Response.md | 51 - .../docs/RestartInstance200ResponseData.md | 51 - .../lambdalabs/docs/RestartInstanceRequest.md | 51 - .../lambdalabs/gen/lambdalabs/docs/SshKey.md | 129 -- .../docs/TerminateInstance200Response.md | 51 - .../docs/TerminateInstance200ResponseData.md | 51 - .../docs/TerminateInstanceRequest.md | 51 - .../lambdalabs/gen/lambdalabs/docs/User.md | 93 - .../lambdalabs/gen/lambdalabs/git_push.sh | 57 - .../model_add_ssh_key_200_response.go | 156 -- .../lambdalabs/model_add_ssh_key_request.go | 194 -- .../lambdalabs/gen/lambdalabs/model_error.go | 233 --- .../gen/lambdalabs/model_error_code.go | 126 -- .../lambdalabs/model_error_response_body.go | 193 -- .../gen/lambdalabs/model_file_system.go | 366 ---- .../model_get_instance_200_response.go | 156 -- .../gen/lambdalabs/model_instance.go | 663 ------- .../gen/lambdalabs/model_instance_type.go | 272 --- .../lambdalabs/model_instance_type_specs.go | 244 --- .../model_instance_types_200_response.go | 157 -- ..._instance_types_200_response_data_value.go | 185 -- .../model_launch_instance_200_response.go | 156 -- ...model_launch_instance_200_response_data.go | 157 -- .../model_launch_instance_request.go | 341 ---- .../model_list_file_systems_200_response.go | 156 -- .../model_list_instances_200_response.go | 156 -- .../model_list_ssh_keys_200_response.go | 156 -- .../lambdalabs/gen/lambdalabs/model_region.go | 186 -- .../model_restart_instance_200_response.go | 156 -- ...odel_restart_instance_200_response_data.go | 157 -- .../model_restart_instance_request.go | 157 -- .../gen/lambdalabs/model_ssh_key.go | 268 --- .../model_terminate_instance_200_response.go | 156 -- ...el_terminate_instance_200_response_data.go | 157 -- .../model_terminate_instance_request.go | 157 -- .../lambdalabs/gen/lambdalabs/model_user.go | 215 --- .../lambdalabs/gen/lambdalabs/response.go | 47 - .../gen/lambdalabs/test/api_default_test.go | 127 -- .../lambdalabs/gen/lambdalabs/utils.go | 361 ---- v1/providers/lambdalabs/helpers_test.go | 79 - v1/providers/lambdalabs/instance.go | 332 ---- v1/providers/lambdalabs/instance_test.go | 307 ---- v1/providers/lambdalabs/instancetype.go | 212 --- v1/providers/lambdalabs/instancetype_test.go | 266 --- v1/providers/lambdalabs/location.go | 63 - v1/providers/lambdalabs/location_test.go | 1 - v1/providers/lambdalabs/validation_test.go | 46 - 99 files changed, 58 insertions(+), 16079 deletions(-) delete mode 100644 .github/workflows/validation-lambdalabs.yml delete mode 100644 v1/providers/lambdalabs/CONTRIBUTE.md delete mode 100644 v1/providers/lambdalabs/Makefile delete mode 100644 v1/providers/lambdalabs/README.md delete mode 100644 v1/providers/lambdalabs/SECURITY.md delete mode 100644 v1/providers/lambdalabs/capabilities.go delete mode 100644 v1/providers/lambdalabs/capabilities_test.go delete mode 100644 v1/providers/lambdalabs/client.go delete mode 100644 v1/providers/lambdalabs/client_test.go delete mode 100644 v1/providers/lambdalabs/common_test.go delete mode 100644 v1/providers/lambdalabs/credential.go delete mode 100644 v1/providers/lambdalabs/credential_test.go delete mode 100644 v1/providers/lambdalabs/errors.go delete mode 100644 v1/providers/lambdalabs/errors_test.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/.gitignore delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/.openapi-generator-ignore delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/.openapi-generator/FILES delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/.openapi-generator/VERSION delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/.travis.yml delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/README.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/api/openapi.yaml delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/api_default.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/client.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/configuration.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/AddSSHKey200Response.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/AddSSHKeyRequest.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/DefaultAPI.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/ErrorCode.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/ErrorResponseBody.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/FileSystem.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/GetInstance200Response.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/Instance.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/InstanceType.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/InstanceTypeSpecs.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/InstanceTypes200Response.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/InstanceTypes200ResponseDataValue.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/LaunchInstance200Response.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/LaunchInstance200ResponseData.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/LaunchInstanceRequest.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/ListFileSystems200Response.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/ListInstances200Response.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/ListSSHKeys200Response.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/ModelError.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/Region.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/RestartInstance200Response.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/RestartInstance200ResponseData.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/RestartInstanceRequest.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/SshKey.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/TerminateInstance200Response.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/TerminateInstance200ResponseData.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/TerminateInstanceRequest.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/docs/User.md delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/git_push.sh delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_add_ssh_key_200_response.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_add_ssh_key_request.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_error.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_error_code.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_error_response_body.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_file_system.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_get_instance_200_response.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_instance.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_instance_type.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_instance_type_specs.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_instance_types_200_response.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_instance_types_200_response_data_value.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_launch_instance_200_response.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_launch_instance_200_response_data.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_launch_instance_request.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_list_file_systems_200_response.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_list_instances_200_response.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_list_ssh_keys_200_response.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_region.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_restart_instance_200_response.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_restart_instance_200_response_data.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_restart_instance_request.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_ssh_key.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_terminate_instance_200_response.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_terminate_instance_200_response_data.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_terminate_instance_request.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/model_user.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/response.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/test/api_default_test.go delete mode 100644 v1/providers/lambdalabs/gen/lambdalabs/utils.go delete mode 100644 v1/providers/lambdalabs/helpers_test.go delete mode 100644 v1/providers/lambdalabs/instance.go delete mode 100644 v1/providers/lambdalabs/instance_test.go delete mode 100644 v1/providers/lambdalabs/instancetype.go delete mode 100644 v1/providers/lambdalabs/instancetype_test.go delete mode 100644 v1/providers/lambdalabs/location.go delete mode 100644 v1/providers/lambdalabs/location_test.go delete mode 100644 v1/providers/lambdalabs/validation_test.go diff --git a/.github/workflows/validation-lambdalabs.yml b/.github/workflows/validation-lambdalabs.yml deleted file mode 100644 index 965be4d4..00000000 --- a/.github/workflows/validation-lambdalabs.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: LambdaLabs Validation Tests - -on: - schedule: - # Run daily at 2 AM UTC - - cron: '0 2 * * *' - workflow_dispatch: - # Allow manual triggering - pull_request: - paths: - - 'v1/providers/lambdalabs/**' - - 'internal/validation/**' - - 'v1/**' - branches: [ main ] - -jobs: - lambdalabs-validation: - name: LambdaLabs Provider Validation - runs-on: ubuntu-latest - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' - - steps: - - uses: actions/checkout@v4 - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version-file: 'go.mod' - - - name: Cache Go modules - uses: actions/cache@v4 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - - name: Install dependencies - run: make deps - - - name: Run LambdaLabs validation tests - env: - LAMBDALABS_API_KEY: ${{ secrets.LAMBDALABS_API_KEY }} - TEST_PRIVATE_KEY_BASE64: ${{ secrets.TEST_PRIVATE_KEY_BASE64 }} - TEST_PUBLIC_KEY_BASE64: ${{ secrets.TEST_PUBLIC_KEY_BASE64 }} - VALIDATION_TEST: true - run: | - cd v1/providers/lambdalabs - go test -v -short=false -timeout=30m ./... - - - name: Upload test results - uses: actions/upload-artifact@v4 - if: always() - with: - name: lambdalabs-validation-results - path: | - v1/providers/lambdalabs/coverage.out diff --git a/.golangci.bck.yml b/.golangci.bck.yml index ebc0dce3..c23f4aa8 100644 --- a/.golangci.bck.yml +++ b/.golangci.bck.yml @@ -105,5 +105,3 @@ issues: exclude-use-default: false exclude: - composites - exclude-dirs: - - internal/lambdalabs/gen \ No newline at end of file diff --git a/.golangci.yml b/.golangci.yml index 91568d70..f26e51a5 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -90,7 +90,6 @@ linters: - path: (.+)\.go$ text: composites paths: - - internal/lambdalabs/gen - third_party$ - builtin$ - examples$ @@ -104,7 +103,6 @@ formatters: exclusions: generated: lax paths: - - internal/lambdalabs/gen - third_party$ - builtin$ - examples$ diff --git a/docs/CloudManual.md b/docs/CloudManual.md index 0ea098cb..dcf071b5 100644 --- a/docs/CloudManual.md +++ b/docs/CloudManual.md @@ -157,7 +157,7 @@ We need an API endpoint that returns your available instance types. For each typ **Example: Converting Provider Data to `v1.InstanceType`** -From Lambda Labs implementation (`cloud/v1/providers/lambdalabs/instancetype.go`): +Example conversion: ```go it := v1.InstanceType{ @@ -195,19 +195,23 @@ When implementing the Cloud SDK, you declare how Brev's control plane should que **You handle the mapping internally.** The SDK doesn't call your API directly—your implementation does. Whether your cloud's native API is regional, global, or something else entirely, you write the conversion logic in `GetInstanceTypes()`. -**Example: Global API (Lambda Labs)** -Lambda Labs' API returns all instance types with regional availability embedded. The SDK implementation fetches once and expands to per-region `v1.InstanceType` entries: +**Example: Global API (Launchpad)** +Launchpad's catalog returns instance types with per-region capacity. The SDK implementation fetches the catalog once and expands available entries into per-region `v1.InstanceType` values: ```go -// Simplified from cloud/v1/providers/lambdalabs/instancetype.go -func (c *LambdaLabsClient) GetInstanceTypes(ctx context.Context, args v1.GetInstanceTypeArgs) ([]v1.InstanceType, error) { - resp, _ := c.client.InstanceTypes(ctx) // Single API call returns all types - - // Expand each type to all its available regions - for _, instType := range resp.Data { - for _, region := range locations { - isAvailable := slices.Contains(instType.RegionsWithCapacityAvailable, region.Name) - instanceTypes = append(instanceTypes, convertToV1(region.Name, instType, isAvailable)) +// Simplified from cloud/v1/providers/launchpad/instancetype.go +func (c *LaunchpadClient) GetInstanceTypes(ctx context.Context, args v1.GetInstanceTypeArgs) ([]v1.InstanceType, error) { + catalog, _ := c.paginateInstanceTypes(ctx, 100) + + for _, nativeType := range catalog { + for region, capacity := range nativeType.Capacity { + if capacity == 0 { + continue + } + instanceType, _ := launchpadInstanceTypeToInstanceType(nativeType, region) + if v1.IsSelectedByArgs(*instanceType, args) { + instanceTypes = append(instanceTypes, *instanceType) + } } } return instanceTypes, nil @@ -248,7 +252,7 @@ When we ingest your instance types, we normalize them to the `v1.InstanceType` s | Field | Type | Description | |-------|------|-------------| | `ID` | `InstanceTypeID` | Stable, unique identifier (you define the format—see below) | -| `Cloud` | `string` | Your cloud identifier (e.g., `"lambdalabs"`, `"crusoe"`) | +| `Cloud` | `string` | Your cloud identifier (e.g., `"nebius"`, `"shadeform"`) | | `Provider` | `string` | Provider identifier (often same as `Cloud`) | | `Type` | `string` | Your native type name | | `Location` | `string` | Primary region identifier | @@ -506,18 +510,6 @@ type GPU struct { ### Provider Examples -**Lambda Labs** (`cloud/v1/providers/lambdalabs/instancetype.go:parseGPUFromDescription`) - -Parses `"8x A100 (40 GB SXM4)"` using regex: - -```go -gpu.Count = int32(count) // from (\d+)x -gpu.Name = nameStr // from x (.*?) \( -gpu.MemoryBytes = v1.NewBytes(v1.BytesValue(memoryGiB), v1.Gibibyte) -gpu.NetworkDetails = networkDetails // remainder after "GB" -gpu.Manufacturer = "NVIDIA" -``` - **Launchpad** (`cloud/v1/providers/launchpad/instancetype.go:launchpadGpusToGpus`) Maps structured API fields: @@ -590,7 +582,6 @@ Providers define their own credential struct with whatever fields they need. The | Provider | Struct Fields | JSON Fields | |----------|---------------|-------------| -| **Lambda Labs** | `APIKey string` | `api_key` | | **Shadeform** | `APIKey string` | `api_key` | | **FluidStack** | `APIKey string` | `api_key` | | **AWS** | `AccessKeyID`, `SecretAccessKey` | `access_key_id`, `secret_access_key` | @@ -698,24 +689,21 @@ The SDK defines these states in `LifecycleStatus` (from `cloud/v1/instance.go`): | `SSHPort` | Always | SSH port (typically `22`) | | `RefID` | Always | Echo back the input `RefID` | -**Example flow (from Lambda Labs implementation):** +**Example flow:** ```go // 1. Register the SSH key with your API -keyPairResp, err := c.addSSHKey(ctx, openapi.AddSSHKeyRequest{ - Name: attrs.RefID, - PublicKey: &attrs.PublicKey, -}) +keyID, err := c.ensureSSHKey(ctx, attrs.RefID, attrs.PublicKey) // 2. Launch the instance with the key -resp, err := c.launchInstance(ctx, openapi.LaunchInstanceRequest{ - RegionName: attrs.Location, - InstanceTypeName: attrs.InstanceType, - SshKeyNames: []string{keyPairName}, +instanceID, err := c.launchInstance(ctx, providerLaunchRequest{ + Region: attrs.Location, + InstanceType: attrs.InstanceType, + SSHKeyID: keyID, }) // 3. Return instance details -return c.GetInstance(ctx, v1.CloudProviderInstanceID(resp.Data.InstanceIds[0])) +return c.GetInstance(ctx, v1.CloudProviderInstanceID(instanceID)) ``` ### Terminate Instance (Required) @@ -740,7 +728,7 @@ return c.GetInstance(ctx, v1.CloudProviderInstanceID(resp.Data.InstanceIds[0])) - Return `nil` once the stop operation is initiated. - Instance should transition: `running` → `stopping` → `stopped` -**When to implement:** Only if your platform supports instances that can stop and preserve storage. Lambda Labs does not support this, but Nebius does. +**When to implement:** Only if your platform supports instances that can stop and preserve storage. Nebius is an example that supports this capability. ### Start Instance (Optional) @@ -783,7 +771,7 @@ instance := v1.Instance{ } ``` -**Example - Lambda Labs (no stop/start support):** +**Example - provider without stop/start support:** ```go // In GetCapabilities() // CapabilityStopStartInstance NOT included @@ -1091,7 +1079,7 @@ cloudCredRefID := tags["cloudCredRefID"] If your API doesn't support tags, you **still must** persist and return `RefID` and `CloudCredRefID`. Use creative alternatives: -**Example (Lambda Labs without tags):** +**Example (provider without tags):** ```go // At creation - encode CloudCredRefID in instance name name := fmt.Sprintf("%s--%s", c.GetReferenceID(), time.Now().UTC().Format(timeFormat)) @@ -1165,14 +1153,6 @@ if shadeformErrorResponse.ErrorCode == outOfStockErrorCode { } ``` -**Example from Lambda Labs provider** ([`v1/providers/lambdalabs/errors.go`](v1/providers/lambdalabs/errors.go)): - -```go -if strings.Contains(e.Error(), "Not enough capacity") || strings.Contains(e.Error(), "insufficient-capacity") { - return v1.ErrInsufficientResources -} -``` - --- ## 12. Billing and Pricing @@ -1242,7 +1222,7 @@ You don't need to do anything special—just ensure the SSH public key from `Cre To begin integration: -1. **Follow the Integration Guide and copy the template** — Start with the [Integration Guide](IntegrationGuide.md), which walks through the v1 interfaces, directory layout, and a copy/paste scaffold. Use the Lambda Labs provider as your canonical reference. +1. **Follow the Integration Guide and copy the template** — Start with the [Integration Guide](IntegrationGuide.md), which walks through the v1 interfaces, directory layout, and a copy/paste scaffold. Use the existing provider whose API model most closely matches yours as a reference. 2. **Implement your Cloud provider** — Build out instance lifecycle, instance types, capabilities, and security conformance under `internal/{provider}/v1/`. Embed `NotImplCloudClient` for any unsupported operations. 3. **Run the local Validation Tests** — Wire up `validation_test.go` using real credentials and run `make test-validation` locally. This exercises instance create/get/list/terminate, instance types, and capability checks against your live API. 4. **Provide Brev with a test account** — Give Brev access to run validation independently. This typically means a console account or provided API credentials, but exact requirements vary by provider. diff --git a/docs/IntegrationGuide.md b/docs/IntegrationGuide.md index a9d37c97..c0d6cf0e 100644 --- a/docs/IntegrationGuide.md +++ b/docs/IntegrationGuide.md @@ -1,6 +1,6 @@ # How to Add a Cloud Provider -Practical guide to implementing a new cloud provider in the Brev Cloud SDK (v1). The Lambda Labs provider is the best working, well-tested example—use it as your canonical reference. +Practical guide to implementing a new cloud provider in the Brev Cloud SDK (v1). Use the existing providers as references, choosing the one whose API model most closely matches your integration. For deeper context on the SDK’s design, interfaces, and provider expectations, see the [Cloud Manual](CloudManual.md). @@ -11,9 +11,9 @@ Background: - v1 design notes: ../pkg/v1/V1_DESIGN_NOTES.md Provider examples: -- Lambda Labs (canonical): ../internal/lambdalabs/v1/README.md -- Nebius (in progress): ../internal/nebius/v1/README.md -- Fluidstack (in progress): ../internal/fluidstack/v1/README.md +- Nebius: ../v1/providers/nebius/README.md +- TestKube: ../v1/providers/testkube/README.md +- FluidStack: ../v1/providers/fluidstack/README.md --- @@ -63,10 +63,10 @@ Create a new provider folder: - networking.go, image.go, storage.go, tags.go, quota.go, location.go (as applicable) - validation_test.go (validation suite entry point) -Use Lambda Labs as the pattern: -- ../internal/lambdalabs/v1/client.go -- ../internal/lambdalabs/v1/instance.go -- ../internal/lambdalabs/v1/capabilities.go +For a complete implementation, see: +- ../v1/providers/nebius/client.go +- ../v1/providers/nebius/instance.go +- ../v1/providers/nebius/capabilities.go --- @@ -100,7 +100,7 @@ func New{Provider}Credential(refID string /* auth fields */) *{Provider}Credenti func (c *{Provider}Credential) GetReferenceID() string { return c.RefID } func (c *{Provider}Credential) GetAPIType() v1.APIType { return v1.APITypeLocational /* or v1.APITypeGlobal */ } func (c *{Provider}Credential) GetCloudProviderID() v1.CloudProviderID { - return "{provider-id}" // e.g., "lambdalabs" + return "{provider-id}" // e.g., "nebius" } func (c *{Provider}Credential) GetTenantID() (string, error) { // Derive stable tenant ID for quota/account scoping if possible @@ -215,10 +215,10 @@ func (c *{Provider}Client) MergeInstanceForUpdate(_ v1.Instance, newInst v1.Inst func (c *{Provider}Client) MergeInstanceTypeForUpdate(_ v1.InstanceType, newIt v1.InstanceType) v1.Type { return newIt } ``` -See the canonical mapping and conversion logic in Lambda Labs: -- Create/terminate/list/reboot: ../internal/lambdalabs/v1/instance.go -- Capabilities: ../internal/lambdalabs/v1/capabilities.go -- Client/credential + NotImpl: ../internal/lambdalabs/v1/client.go +See the Nebius implementation for mapping and conversion examples: +- Create/terminate/list/reboot: ../v1/providers/nebius/instance.go +- Capabilities: ../v1/providers/nebius/capabilities.go +- Client/credential + NotImpl: ../v1/providers/nebius/client.go Implement instance types in internal/{provider}/v1/instancetype.go: @@ -238,9 +238,7 @@ Implement instance types in internal/{provider}/v1/instancetype.go: The SDK uses a three-level capability system to accurately represent what operations are supported: ### 1. Provider-Level Capabilities -These are high-level features that your cloud provider's API supports, declared in your `GetCapabilities()` method. Capability flags live in ../pkg/v1/capabilities.go. Only include capabilities your API actually supports. For example, Lambda Labs supports: -- Create/terminate/reboot instance (`CapabilityCreateInstance`, `CapabilityTerminateInstance`, `CapabilityRebootInstance`) -- Does not (currently) support stop/start, resize volume, machine image, tags +These are high-level features that your cloud provider's API supports, declared in your `GetCapabilities()` method. Capability flags live in ../pkg/v1/capabilities.go. Only include capabilities your API actually supports. For example, Nebius advertises create, terminate, reboot, stop/start, volume resize, machine image, and tag capabilities. ### 2. Instance Type Capabilities These are hardware-specific features that vary by instance configuration, expressed as boolean fields on the `InstanceType` struct: @@ -257,7 +255,7 @@ These are capability boolean fields replicated on individual `Instance` objects, These fields must be kept accurate and in sync with the corresponding InstanceType capabilities, even though they appear redundant. They can also reflect runtime state-dependent variations - for example, a running instance might support certain operations that a stopped instance cannot, based on the current `LifecycleStatus`. Reference: -- Lambda capabilities: ../internal/lambdalabs/v1/capabilities.go +- Nebius capabilities: ../v1/providers/nebius/capabilities.go --- @@ -270,9 +268,7 @@ All providers must conform to ../docs/SECURITY.md: - If your provider’s firewall model is global/project-scoped rather than per-instance, document limitations in internal/{provider}/SECURITY.md and reflect that by omitting CapabilityModifyFirewall if applicable. Provider-specific security doc examples: -- Lambda Labs: ../internal/lambdalabs/SECURITY.md -- Nebius: ../internal/nebius/SECURITY.md -- Fluidstack: ../internal/fluidstack/v1/SECURITY.md +- FluidStack: ../v1/providers/fluidstack/SECURITY.md --- @@ -319,7 +315,7 @@ func TestValidationFunctions(t *testing.T) { - make test-all # runs everything 3) CI workflow (recommended): -- Add .github/workflows/validation-{provider}.yml (copy Lambda Labs workflow if available or follow VALIDATION_TESTING.md). +- Add .github/workflows/validation-{provider}.yml following VALIDATION_TESTING.md. - Store secrets in GitHub Actions (e.g., YOUR_PROVIDER_API_KEY). --- @@ -346,8 +342,8 @@ func TestValidationFunctions(t *testing.T) { - Capabilities: ../pkg/v1/capabilities.go - Instance lifecycle and validations: ../pkg/v1/instance.go - Instance types and validations: ../pkg/v1/instancetype.go -- Lambda Labs example: - - Client/Credential: ../internal/lambdalabs/v1/client.go - - Capabilities: ../internal/lambdalabs/v1/capabilities.go - - Instance operations: ../internal/lambdalabs/v1/instance.go - - Provider README: ../internal/lambdalabs/v1/README.md +- Nebius example: + - Client/Credential: ../v1/providers/nebius/client.go + - Capabilities: ../v1/providers/nebius/capabilities.go + - Instance operations: ../v1/providers/nebius/instance.go + - Provider README: ../v1/providers/nebius/README.md diff --git a/docs/VALIDATION_TESTING.md b/docs/VALIDATION_TESTING.md index 95e0a4e6..f7033411 100644 --- a/docs/VALIDATION_TESTING.md +++ b/docs/VALIDATION_TESTING.md @@ -23,9 +23,7 @@ make test-all ### Environment Variables -Each provider requires specific environment variables: - -- **LambdaLabs**: `LAMBDALABS_API_KEY` +Each provider's validation test documents the environment variables it requires. ### CI/CD @@ -36,7 +34,7 @@ Validation tests run automatically: ## Adding New Providers -1. Create validation test file: `internal/{provider}/v1/validation_test.go` +1. Create validation test file: `v1/providers/{provider}/validation_test.go` 2. Use the shared validation package with provider-specific configuration: ```go @@ -118,18 +116,18 @@ The framework tests all validation functions from the SDK: ### Debugging ```bash -# Run specific validation test -go test -v -short=false -run TestValidationFunctions ./internal/lambdalabs/v1/ +# Run a specific provider's validation test +go test -v -short=false -run TestValidationFunctions ./v1/providers/{provider}/ # Run with verbose output -go test -v -short=false -timeout=20m ./internal/lambdalabs/v1/ +go test -v -short=false -timeout=20m ./v1/providers/{provider}/ ``` ## Contributing When adding new validation functions: -1. Add the validation function to the appropriate `pkg/v1/*.go` file -2. Add corresponding test in `internal/{provider}/v1/validation_test.go` +1. Add the validation function to the appropriate `v1/*.go` file +2. Add corresponding test in `v1/providers/{provider}/validation_test.go` 3. Ensure proper cleanup and error handling 4. Update this documentation diff --git a/docs/example-dot-env b/docs/example-dot-env index eb7fbbfc..fb2e6fc9 100644 --- a/docs/example-dot-env +++ b/docs/example-dot-env @@ -1,3 +1,2 @@ -LAMBDALABS_API_KEY=secret_my-api-key_********** TEST_PRIVATE_KEY_BASE64=LS0tLS1CRUdJTiBSU0EgUFJJVk... -TEST_PUBLIC_KEY_BASE64=LS0tLS1CRUdJTiBQVUJMSUMgS0V... \ No newline at end of file +TEST_PUBLIC_KEY_BASE64=LS0tLS1CRUdJTiBQVUJMSUMgS0V... diff --git a/go.mod b/go.mod index bef604f7..b44c82e5 100644 --- a/go.mod +++ b/go.mod @@ -12,13 +12,11 @@ require ( github.com/aws/aws-sdk-go-v2/service/iam v1.47.5 github.com/aws/smithy-go v1.23.0 github.com/bojanz/currency v1.3.1 - github.com/cenkalti/backoff v2.2.1+incompatible github.com/cenkalti/backoff/v4 v4.3.0 github.com/gliderlabs/ssh v0.3.8 github.com/go-ozzo/ozzo-validation/v4 v4.3.0 github.com/google/go-cmp v0.7.0 github.com/google/uuid v1.6.0 - github.com/jarcoal/httpmock v1.4.0 github.com/nebius/gosdk v0.2.22 github.com/pkg/errors v0.9.1 github.com/sfcompute/nodes-go v0.1.0-alpha.4 diff --git a/go.sum b/go.sum index 370e6f35..61bb01bc 100644 --- a/go.sum +++ b/go.sum @@ -42,8 +42,6 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bojanz/currency v1.3.1 h1:3BUAvy/5hU/Pzqg5nrQslVihV50QG+A2xKPoQw1RKH4= github.com/bojanz/currency v1.3.1/go.mod h1:jNoZiJyRTqoU5DFoa+n+9lputxPUDa8Fz8BdDrW06Go= -github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= -github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= @@ -117,8 +115,6 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2 h1:sGm2vDRFUrQJO/Veii4h4zG2vvqG6uWNkBHSTqXOZk0= github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2/go.mod h1:wd1YpapPLivG6nQgbf7ZkG1hhSOXDhhn4MLTknx2aAc= -github.com/jarcoal/httpmock v1.4.0 h1:BvhqnH0JAYbNudL2GMJKgOHe2CtKlzJ/5rWKyp+hc2k= -github.com/jarcoal/httpmock v1.4.0/go.mod h1:ftW1xULwo+j0R0JJkJIIi7UKigZUXCLLanykgjwBXL0= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -129,8 +125,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/maxatome/go-testdeep v1.14.0 h1:rRlLv1+kI8eOI3OaBXZwb3O7xY3exRzdW5QyX48g9wI= -github.com/maxatome/go-testdeep v1.14.0/go.mod h1:lPZc/HAcJMP92l7yI6TRz1aZN5URwUBUAfUNvrclaNM= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= diff --git a/v1/providers/lambdalabs/CONTRIBUTE.md b/v1/providers/lambdalabs/CONTRIBUTE.md deleted file mode 100644 index 6366b1a5..00000000 --- a/v1/providers/lambdalabs/CONTRIBUTE.md +++ /dev/null @@ -1,48 +0,0 @@ -# Contributing to Lambda Labs - -## Setup - -- Create a `.env` file in the root of the project with the following: - -``` -LAMBDALABS_API_KEY=secret_my-api-key_********** -``` - -## Running Tests - -Use the vscode "run tests" task to run the tests. - - -## Useful Prompts -``` -can you take a look at the file structure in @v1 this is supposed to be the reference/interface for providers. can you replicate the file structure in @lambdalabs ? I just want the file structure and maybe some stubs if they make sense. -``` - -``` -Please analyze the Lambda Labs @lambdalabs implementation in and research their actual API capabilities to determine which features are supported vs unsupported. - -**Required Research Steps:** -1. **API Documentation Analysis**: Find and review Lambda Labs' official API documentation at @https://cloud.lambda.ai/api/v1/openapi.json to identify supported endpoints and features -2. **Feature-by-Feature Verification**: For each CloudClient interface method, verify if Lambda Labs actually supports it by checking their API docs -3. **Evidence-Based Decisions**: Only mark features as "supported" if you find concrete evidence in their documentation - -**Implementation Approach:** -- Use the existing NotImplCloudClient pattern for unsupported features -- Return ErrNotImplemented for features that Lambda Labs doesn't support -- Maintain full CloudClient interface compliance - -**Key Questions to Answer:** -- What instance management operations does Lambda Labs actually support? (create, terminate, list, stop/start, reboot?) -- Do they support volume resizing, instance type changing, or machine images? -- What networking features do they provide? (firewall rules, security groups?) -- Do they have quota management APIs? -- What authentication and location management do they support? - -**Deliverables:** -1. Evidence-based list of supported vs unsupported features -2. Refactored implementation using NotImplCloudClient -3. Updated documentation reflecting actual capabilities -4. Remove any files/methods that are completely unnecessary - -Please provide specific citations from Lambda Labs' API documentation for any features you mark as supported. Make sure we list features that the client implements NOT the API. -``` \ No newline at end of file diff --git a/v1/providers/lambdalabs/Makefile b/v1/providers/lambdalabs/Makefile deleted file mode 100644 index d62dedec..00000000 --- a/v1/providers/lambdalabs/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -generate-lambdalabs-client: - docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v7.8.0 generate \ - --additional-properties disallowAdditionalPropertiesIfNotPresent=false \ - -i https://cloud.lambdalabs.com/static/api/v1/openapi.yaml \ - -g go \ - --git-user-id brevdev \ - --git-repo-id cloud \ - -o /local/gen/lambdalabs - sudo chown -R $(shell id -u):$(shell id -g) gen/lambdalabs - gofmt -s -w gen/lambdalabs - rm -rf gen/lambdalabs/go.mod gen/lambdalabs/go.sum \ No newline at end of file diff --git a/v1/providers/lambdalabs/README.md b/v1/providers/lambdalabs/README.md deleted file mode 100644 index 26e88c67..00000000 --- a/v1/providers/lambdalabs/README.md +++ /dev/null @@ -1,79 +0,0 @@ -# Lambda Labs Provider - -This directory contains the Lambda Labs provider implementation for the compute package. - -## Overview - -The Lambda Labs provider implements the CloudClient interface defined in `pkg/v1` to provide access to Lambda Labs cloud infrastructure. This implementation is based on the official Lambda Labs API documentation at https://cloud.lambda.ai/api/v1/openapi.json. - -## Supported Features - -Based on the Lambda Labs API documentation, the following features are **SUPPORTED**: - -### Instance Management -- ✅ **Create Instance**: `POST /api/v1/instance-operations/launch` -- ✅ **Get Instance**: `GET /api/v1/instances/{id}` -- ✅ **List Instances**: `GET /api/v1/instances` -- ✅ **Terminate Instance**: `POST /api/v1/instance-operations/terminate` -- ✅ **Reboot Instance**: `POST /api/v1/instance-operations/restart` - -### Instance Types -- ✅ **Get Instance Types**: `GET /api/v1/instance-types` - -### Firewall Management -- ✅ **Create Firewall Ruleset**: `POST /api/v1/firewall-rulesets` -- ✅ **Get Firewall Rulesets**: `GET /api/v1/firewall-rulesets` -- ✅ **Update Firewall Ruleset**: `PATCH /api/v1/firewall-rulesets/{id}` -- ✅ **Delete Firewall Ruleset**: `DELETE /api/v1/firewall-rulesets/{id}` -- ✅ **Global Firewall Rules**: `GET /api/v1/firewall-rulesets/global` - -## Unsupported Features - -The following features are **NOT SUPPORTED** (no API endpoints found): - -### Instance Operations -- ❌ **Stop/Start Instance**: No stop or start endpoints found -- ❌ **Change Instance Type**: No instance type modification endpoint -- ❌ **Instance Tags**: No tagging endpoints found - -### Volume Management -- ❌ **Resize Instance Volume**: No volume resizing endpoints found - -### Machine Images -- ❌ **Get Images**: No image listing endpoints found - -### Quota Management -- ❌ **Get Instance Type Quotas**: No quota endpoints found - -### Location Management -- ❌ **Get Locations**: No location listing endpoints found - -## Implementation Approach - -This implementation uses the `NotImplCloudClient` pattern for unsupported features: -- Supported features have TODO implementations with API endpoint references -- Unsupported features return `ErrNotImplemented` (handled by embedded NotImplCloudClient) -- Full CloudClient interface compliance is maintained - -## Lambda Labs API - -The provider integrates with the Lambda Labs Cloud API: -- Base URL: `https://cloud.lambda.ai/api/v1` -- Authentication: API key based (Bearer token) -- Documentation: https://cloud.lambda.ai/api/v1/openapi.json - -## Key Features - -Lambda Labs is known for: -- GPU instances (A10, A100, H100, etc.) -- Global API (not location-specific) -- Simple pricing model -- Fast instance provisioning -- Firewall rulesets for network security - -## TODO - -- [ ] Implement actual API integration for supported features -- [ ] Add comprehensive error handling -- [ ] Add logging and monitoring -- [ ] Add comprehensive testing \ No newline at end of file diff --git a/v1/providers/lambdalabs/SECURITY.md b/v1/providers/lambdalabs/SECURITY.md deleted file mode 100644 index c7336d49..00000000 --- a/v1/providers/lambdalabs/SECURITY.md +++ /dev/null @@ -1,82 +0,0 @@ -# Lambda Labs SECURITY.md for Brev Cloud SDK - -This document outlines how the Lambda Labs integration complies with Brev Cloud SDK's security architecture using Lambda Cloud primitives such as firewall rules and virtual network isolation. - -## 🔑 SSH Access Requirements - -**Lambda Labs instances must support SSH server functionality and SSH key-based authentication for Brev access.** - -### SSH Implementation -- **SSH Server**: All Lambda Labs instances have SSH server (OpenSSH) pre-installed and running -- **SSH Key Authentication**: Lambda Labs supports SSH key injection during instance creation -- **Key Management**: Public SSH keys are automatically configured in `~/.ssh/authorized_keys` -- **Access Method**: SSH provides the primary secure access method for instance managementn. - ---- - -## 🔐 Network Security - -### Current Model - -Lambda Labs recently introduced support for per-instance and per-cluster firewalls, enabling more granular network security controls. **However, the Brev Cloud SDK integration does _not yet_ utilize these new per-instance/cluster firewall features.** - -**Currently, we rely on Lambda Labs' account-level global firewall rules to enforce network security.** This means: - -- **Inbound:** By default, all inbound traffic is restricted at the account level except for SSH (TCP/22), which is required for instance access and management. All other inbound ports and protocols are closed unless explicitly allowed at the account/global level. -- **Outbound:** All outbound traffic is **unrestricted by default**. Lambda Cloud does not impose egress restrictions, so instances can freely initiate outbound connections. - -> **Note:** The configuration of these global firewall rules is performed _outside_ of the Brev Cloud SDK's cloud integration package. Setting up these account-level firewall rules to restrict all inbound traffic except SSH is a **prerequisite for securely adding a new Lambda Labs account** to Brev. - -### Explicit Inbound Access - -- Brev restricts inbound access to SSH only (TCP/22) using Lambda Labs' global firewall rules. -- No other inbound ports are open by default. If additional access is required, it must be configured at the account/global firewall level (not per-instance). -- The new per-instance/cluster firewall features are not yet integrated with Brev's `FirewallRule` abstraction. - -### Implementation Notes - -- **Inbound Deny (except SSH):** Achieved by configuring Lambda Labs' global firewall rules to allow only SSH and deny all other inbound traffic. -- **Outbound Allow:** No changes needed; outbound access is unrestricted by Lambda by default. -- **FirewallRule Mapping:** At this time, Brev's `FirewallRule` resources are not mapped to Lambda Labs' new per-instance/cluster firewall APIs. All restrictions are enforced at the account/global level. - -> **Planned Improvement:** We plan to update the integration to leverage Lambda Labs' per-instance/cluster firewalls for finer-grained network control in a future release. - ---- - -## 🔒 Data Protection - -### Encryption at Rest - -- All persistent storage is encrypted at rest using industry-standard encryption (e.g., AES-256) by default. -- Lambda Cloud does not currently support customer-managed encryption keys. - -### Encryption in Transit - -- All Brev SDK and control plane communication uses HTTPS with TLS 1.2+. -- Users are encouraged to use secure protocols (e.g., SSH, HTTPS) for application-level traffic to and from their instances. - -### Key Management - -- Provider-managed keys are used for at-rest encryption. -- No customer-managed key option is currently available. - ---- - -## ✅ Implementation Checklist - -- [x] **Inbound Deny by Default** using Lambda Labs firewall configuration -- [x] **Outbound Allow by Default** (no action required) -- [x] **Explicit Inbound Access** mapped to Brev `FirewallRule` ➝ Lambda firewall rule -- [x] **Persistent Disk Encryption** enabled by default (AES-256) -- [x] **TLS 1.2+** enforced for all Brev SDK and API communication -- [x] **Provider-Managed Keys** for encryption at rest - ---- - -## 🛡️ Security Contact - -For security issues or vulnerability disclosures related to this integration, please contact: - -**Email:** [brev@nvidia.com](mailto:brev@nvidia.com) - -Please report any vulnerabilities privately before disclosing them publicly. diff --git a/v1/providers/lambdalabs/capabilities.go b/v1/providers/lambdalabs/capabilities.go deleted file mode 100644 index 253fe13e..00000000 --- a/v1/providers/lambdalabs/capabilities.go +++ /dev/null @@ -1,38 +0,0 @@ -package v1 - -import ( - "context" - - v1 "github.com/brevdev/cloud/v1" -) - -// getLambdaLabsCapabilities returns the unified capabilities for Lambda Labs -// Based on API documentation at https://cloud.lambda.ai/api/v1/openapi.json -func getLambdaLabsCapabilities() v1.Capabilities { - return v1.Capabilities{ - // SUPPORTED FEATURES (with API evidence): - - // Instance Management - v1.CapabilityCreateInstance, // POST /api/v1/instance-operations/launch - v1.CapabilityTerminateInstance, // POST /api/v1/instance-operations/terminate - v1.CapabilityCreateTerminateInstance, // Combined create/terminate capability - v1.CapabilityRebootInstance, // POST /api/v1/instance-operations/restart - - // UNSUPPORTED FEATURES (no API evidence found): - // - v1.CapabilityModifyFirewall // Firewall management is project-level, not instance-level - // - v1.CapabilityStopStartInstance // No stop/start endpoints - // - v1.CapabilityResizeInstanceVolume // No volume resizing endpoints - // - v1.CapabilityMachineImage // No image endpoints - // - v1.CapabilityTags // No tagging endpoints - } -} - -// GetCapabilities returns the capabilities of Lambda Labs client -func (c *LambdaLabsClient) GetCapabilities(_ context.Context) (v1.Capabilities, error) { - return getLambdaLabsCapabilities(), nil -} - -// GetCapabilities returns the capabilities for Lambda Labs credential -func (c *LambdaLabsCredential) GetCapabilities(_ context.Context) (v1.Capabilities, error) { - return getLambdaLabsCapabilities(), nil -} diff --git a/v1/providers/lambdalabs/capabilities_test.go b/v1/providers/lambdalabs/capabilities_test.go deleted file mode 100644 index bbbdf2e7..00000000 --- a/v1/providers/lambdalabs/capabilities_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package v1 - -import ( - "context" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - v1 "github.com/brevdev/cloud/v1" -) - -func TestLambdaLabsClient_GetCapabilities(t *testing.T) { - client := &LambdaLabsClient{} - capabilities, err := client.GetCapabilities(context.Background()) - require.NoError(t, err) - - assert.Contains(t, capabilities, v1.CapabilityCreateInstance) - assert.Contains(t, capabilities, v1.CapabilityTerminateInstance) - assert.Contains(t, capabilities, v1.CapabilityRebootInstance) - assert.NotContains(t, capabilities, v1.CapabilityStopStartInstance) -} - -func TestLambdaLabsCredential_GetCapabilities(t *testing.T) { - cred := &LambdaLabsCredential{} - capabilities, err := cred.GetCapabilities(context.Background()) - require.NoError(t, err) - - assert.Contains(t, capabilities, v1.CapabilityCreateInstance) - assert.Contains(t, capabilities, v1.CapabilityTerminateInstance) - assert.Contains(t, capabilities, v1.CapabilityRebootInstance) - assert.NotContains(t, capabilities, v1.CapabilityStopStartInstance) -} diff --git a/v1/providers/lambdalabs/client.go b/v1/providers/lambdalabs/client.go deleted file mode 100644 index 75db8bc9..00000000 --- a/v1/providers/lambdalabs/client.go +++ /dev/null @@ -1,150 +0,0 @@ -package v1 - -import ( - "context" - "fmt" - "net/http" - "time" - - v1 "github.com/brevdev/cloud/v1" - openapi "github.com/brevdev/cloud/v1/providers/lambdalabs/gen/lambdalabs" - "github.com/cenkalti/backoff/v4" -) - -const ( - defaultBaseURL = "https://cloud.lambda.ai/api/v1" - defaultBackoffInitialInterval = 1000 * time.Millisecond - defaultBackoffMaxElapsedTime = 120 * time.Second -) - -// LambdaLabsClient implements the CloudClient interface for Lambda Labs -// It embeds NotImplCloudClient to handle unsupported features -type LambdaLabsClient struct { - v1.NotImplCloudClient - refID string - apiKey string - baseURL string - client *openapi.APIClient - location string - backoff backoff.BackOff -} - -var _ v1.CloudClient = &LambdaLabsClient{} - -type options struct { - baseURL string - client *openapi.APIClient - location string - backoff backoff.BackOff -} - -type Option func(options *options) error - -// WithBaseURL sets the base URL for the Lambda Labs client -func WithBaseURL(baseURL string) Option { - return func(options *options) error { - options.baseURL = baseURL - return nil - } -} - -// WithClient sets the OpenAPI HTTP client for the Lambda Labs client -func WithClient(client *openapi.APIClient) Option { - return func(options *options) error { - options.client = client - return nil - } -} - -// WithLocation sets the location for the Lambda Labs client -func WithLocation(location string) Option { - return func(options *options) error { - options.location = location - return nil - } -} - -// WithBackoff sets the backoff settings used to retry API calls for the Lambda Labs client -func WithBackoff(backoff backoff.BackOff) Option { - return func(options *options) error { - options.backoff = backoff - return nil - } -} - -// NewLambdaLabsClient creates a new Lambda Labs client -func NewLambdaLabsClient(refID, apiKey string, opts ...Option) (*LambdaLabsClient, error) { - var options options - for _, opt := range opts { - if err := opt(&options); err != nil { - return nil, err - } - } - - if refID == "" || apiKey == "" { - return nil, fmt.Errorf("refID and apiKey are required") - } - - if options.baseURL == "" { - options.baseURL = defaultBaseURL - } - - if options.client == nil { - config := openapi.NewConfiguration() - config.HTTPClient = http.DefaultClient - options.client = openapi.NewAPIClient(config) - } - - if options.backoff == nil { - bo := backoff.NewExponentialBackOff() - bo.InitialInterval = defaultBackoffInitialInterval - bo.MaxElapsedTime = defaultBackoffMaxElapsedTime - options.backoff = bo - } - - return &LambdaLabsClient{ - refID: refID, - apiKey: apiKey, - baseURL: options.baseURL, - client: options.client, - location: options.location, - backoff: options.backoff, - }, nil -} - -// GetAPIType returns the API type for Lambda Labs -func (c *LambdaLabsClient) GetAPIType() v1.APIType { - return v1.APITypeGlobal // Lambda Labs uses a global API -} - -// GetCloudProviderID returns the cloud provider ID for Lambda Labs -func (c *LambdaLabsClient) GetCloudProviderID() v1.CloudProviderID { - return CloudProviderID -} - -// MakeClient creates a new client instance -func (c *LambdaLabsClient) MakeClient(_ context.Context, location string) (v1.CloudClient, error) { - if location == "" { - location = DefaultRegion - } - c.location = location - return c, nil -} - -// GetTenantID returns the tenant ID for Lambda Labs -func (c *LambdaLabsClient) GetTenantID() (string, error) { - // TODO: Implement tenant ID retrieval for Lambda Labs - // This could be derived from the API key or account information - return "", nil -} - -// GetReferenceID returns the reference ID for this client -func (c *LambdaLabsClient) GetReferenceID() string { - return c.refID -} - -func (c *LambdaLabsClient) makeAuthContext(ctx context.Context) context.Context { - return context.WithValue(ctx, openapi.ContextBasicAuth, openapi.BasicAuth{ - UserName: c.apiKey, - }) -} diff --git a/v1/providers/lambdalabs/client_test.go b/v1/providers/lambdalabs/client_test.go deleted file mode 100644 index 6e258a88..00000000 --- a/v1/providers/lambdalabs/client_test.go +++ /dev/null @@ -1,92 +0,0 @@ -package v1 - -import ( - "context" - "testing" - - "github.com/cenkalti/backoff" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - v1 "github.com/brevdev/cloud/v1" - openapi "github.com/brevdev/cloud/v1/providers/lambdalabs/gen/lambdalabs" -) - -func TestLambdaLabsClient_GetAPIType(t *testing.T) { - client := &LambdaLabsClient{} - assert.Equal(t, v1.APITypeGlobal, client.GetAPIType()) -} - -func TestLambdaLabsClient_GetCloudProviderID(t *testing.T) { - client := &LambdaLabsClient{} - assert.Equal(t, v1.CloudProviderID(CloudProviderID), client.GetCloudProviderID()) -} - -func TestLambdaLabsClient_MakeClient(t *testing.T) { - client := &LambdaLabsClient{ - refID: "test-ref-id", - apiKey: "test-api-key", - } - - newClient, err := client.MakeClient(context.Background(), "test-tenant") - require.NoError(t, err) - lambdaClient, ok := newClient.(*LambdaLabsClient) - require.True(t, ok) - assert.Equal(t, client, lambdaClient) -} - -func TestLambdaLabsClient_GetReferenceID(t *testing.T) { - client := &LambdaLabsClient{refID: "test-ref-id"} - assert.Equal(t, "test-ref-id", client.GetReferenceID()) -} - -func TestLambdaLabsClient_makeAuthContext(t *testing.T) { - client := &LambdaLabsClient{apiKey: "test-api-key"} - ctx := client.makeAuthContext(context.Background()) - - auth := ctx.Value(openapi.ContextBasicAuth) - require.NotNil(t, auth) - - basicAuth, ok := auth.(openapi.BasicAuth) - require.True(t, ok) - assert.Equal(t, "test-api-key", basicAuth.UserName) - assert.Equal(t, "", basicAuth.Password) -} - -func TestLambdaLabsClient_NewLambdaLabsClientRequiredFields(t *testing.T) { - _, err := NewLambdaLabsClient("", "") - require.Error(t, err) - assert.Equal(t, "refID and apiKey are required", err.Error()) -} - -func TestLambdaLabsClient_NewLambdaLabsClientWithBaseURL(t *testing.T) { - baseURL := "https://test.lambda.ai/api/v1" - - client, err := NewLambdaLabsClient("test-ref-id", "test-api-key", WithBaseURL(baseURL)) - require.NoError(t, err) - assert.Equal(t, baseURL, client.baseURL) -} - -func TestLambdaLabsClient_NewLambdaLabsClientWithClient(t *testing.T) { - apiClient := openapi.NewAPIClient(openapi.NewConfiguration()) - - client, err := NewLambdaLabsClient("test-ref-id", "test-api-key", WithClient(apiClient)) - require.NoError(t, err) - assert.Equal(t, apiClient, client.client) -} - -func TestLambdaLabsClient_NewLambdaLabsClientWithLocation(t *testing.T) { - location := "us-west-1" - - client, err := NewLambdaLabsClient("test-ref-id", "test-api-key", WithLocation(location)) - require.NoError(t, err) - assert.Equal(t, location, client.location) -} - -func TestLambdaLabsClient_NewLambdaLabsClientWithBackoff(t *testing.T) { - backoff := &backoff.ZeroBackOff{} - - client, err := NewLambdaLabsClient("test-ref-id", "test-api-key", WithBackoff(backoff)) - require.NoError(t, err) - assert.Equal(t, backoff, client.backoff) -} diff --git a/v1/providers/lambdalabs/common_test.go b/v1/providers/lambdalabs/common_test.go deleted file mode 100644 index a5d7b7de..00000000 --- a/v1/providers/lambdalabs/common_test.go +++ /dev/null @@ -1,54 +0,0 @@ -package v1 - -import ( - openapi "github.com/brevdev/cloud/v1/providers/lambdalabs/gen/lambdalabs" - "github.com/cenkalti/backoff/v4" - "github.com/jarcoal/httpmock" -) - -const ( - testInstanceID = "test-instance-id" - nonexistentInstance = "nonexistent-instance" - testPublicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQ test@example.com" -) - -func setupMockClient() (*LambdaLabsClient, func()) { - httpmock.Activate() - client, err := NewLambdaLabsClient("test-ref-id", "test-api-key", WithBackoff(&backoff.StopBackOff{})) - if err != nil { - panic(err) - } - return client, httpmock.DeactivateAndReset -} - -func createMockInstance(instanceID string) openapi.Instance { - name := "test-instance" - ip := "192.168.1.100" - privateIP := "10.0.1.100" - hostname := "test-instance.lambda.ai" - - return openapi.Instance{ - Id: instanceID, - Name: *openapi.NewNullableString(&name), - Ip: *openapi.NewNullableString(&ip), - PrivateIp: *openapi.NewNullableString(&privateIP), - Status: "active", - SshKeyNames: []string{"test-key"}, - FileSystemNames: []string{}, - Region: &openapi.Region{ - Name: "us-west-1", - Description: "US West 1", - }, - InstanceType: &openapi.InstanceType{ - Name: "gpu_1x_a10", - Description: "1x NVIDIA A10 GPU", - GpuDescription: "NVIDIA A10", - PriceCentsPerHour: 100, - Specs: openapi.InstanceTypeSpecs{ - MemoryGib: 32, - StorageGib: 512, - }, - }, - Hostname: *openapi.NewNullableString(&hostname), - } -} diff --git a/v1/providers/lambdalabs/credential.go b/v1/providers/lambdalabs/credential.go deleted file mode 100644 index 87985a54..00000000 --- a/v1/providers/lambdalabs/credential.go +++ /dev/null @@ -1,54 +0,0 @@ -package v1 - -import ( - "context" - "crypto/sha256" - "fmt" - - v1 "github.com/brevdev/cloud/v1" -) - -const CloudProviderID = "lambda-labs" - -const DefaultRegion string = "us-west-1" - -// LambdaLabsCredential implements the CloudCredential interface for Lambda Labs -type LambdaLabsCredential struct { - RefID string - APIKey string -} - -var _ v1.CloudCredential = &LambdaLabsCredential{} - -// NewLambdaLabsCredential creates a new Lambda Labs credential -func NewLambdaLabsCredential(refID, apiKey string) *LambdaLabsCredential { - return &LambdaLabsCredential{ - RefID: refID, - APIKey: apiKey, - } -} - -// GetReferenceID returns the reference ID for this credential -func (c *LambdaLabsCredential) GetReferenceID() string { - return c.RefID -} - -// GetAPIType returns the API type for Lambda Labs -func (c *LambdaLabsCredential) GetAPIType() v1.APIType { - return v1.APITypeGlobal -} - -// GetCloudProviderID returns the cloud provider ID for Lambda Labs -func (c *LambdaLabsCredential) GetCloudProviderID() v1.CloudProviderID { - return CloudProviderID -} - -// GetTenantID returns the tenant ID for Lambda Labs -func (c *LambdaLabsCredential) GetTenantID() (string, error) { - return fmt.Sprintf("lambdalabs-%x", sha256.Sum256([]byte(c.APIKey))), nil -} - -// MakeClient creates a new Lambda Labs client from this credential -func (c *LambdaLabsCredential) MakeClient(_ context.Context, _ string) (v1.CloudClient, error) { - return NewLambdaLabsClient(c.RefID, c.APIKey) -} diff --git a/v1/providers/lambdalabs/credential_test.go b/v1/providers/lambdalabs/credential_test.go deleted file mode 100644 index ab278001..00000000 --- a/v1/providers/lambdalabs/credential_test.go +++ /dev/null @@ -1,52 +0,0 @@ -package v1 - -import ( - "context" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - v1 "github.com/brevdev/cloud/v1" -) - -func TestLambdaLabsCredential_GetReferenceID(t *testing.T) { - cred := &LambdaLabsCredential{ - RefID: "test-ref-id", - APIKey: "test-api-key", - } - - assert.Equal(t, "test-ref-id", cred.GetReferenceID()) -} - -func TestLambdaLabsCredential_GetAPIType(t *testing.T) { - cred := &LambdaLabsCredential{} - assert.Equal(t, v1.APITypeGlobal, cred.GetAPIType()) -} - -func TestLambdaLabsCredential_GetCloudProviderID(t *testing.T) { - cred := &LambdaLabsCredential{} - assert.Equal(t, v1.CloudProviderID("lambda-labs"), cred.GetCloudProviderID()) -} - -func TestLambdaLabsCredential_GetTenantID(t *testing.T) { - cred := &LambdaLabsCredential{APIKey: "test-key"} - tenantID, err := cred.GetTenantID() - assert.NoError(t, err) - assert.Contains(t, tenantID, "lambdalabs-") -} - -func TestLambdaLabsCredential_MakeClient(t *testing.T) { - cred := &LambdaLabsCredential{ - RefID: "test-ref-id", - APIKey: "test-api-key", - } - - client, err := cred.MakeClient(context.Background(), "test-tenant") - require.NoError(t, err) - - lambdaClient, ok := client.(*LambdaLabsClient) - require.True(t, ok) - assert.Equal(t, "test-ref-id", lambdaClient.refID) - assert.Equal(t, "test-api-key", lambdaClient.apiKey) -} diff --git a/v1/providers/lambdalabs/errors.go b/v1/providers/lambdalabs/errors.go deleted file mode 100644 index b809c3d7..00000000 --- a/v1/providers/lambdalabs/errors.go +++ /dev/null @@ -1,51 +0,0 @@ -package v1 - -import ( - "context" - "fmt" - "io" - "net/http" - "strings" - - v1 "github.com/brevdev/cloud/v1" - openapi "github.com/brevdev/cloud/v1/providers/lambdalabs/gen/lambdalabs" - "github.com/cenkalti/backoff/v4" -) - -func handleAPIError(_ context.Context, resp *http.Response, err error) error { - body := "" - e, ok := err.(openapi.GenericOpenAPIError) - if ok { - body = string(e.Body()) - } - if body == "" { - bodyBytes, errr := io.ReadAll(resp.Body) - if errr != nil { - fmt.Printf("Error reading response body: %v\n", errr) - } - body = string(bodyBytes) - } - outErr := fmt.Errorf("LambdaLabs API error\n%s\n%s:\nErr: %s\n%s", resp.Request.URL, resp.Status, err.Error(), body) - if strings.Contains(body, "instance does not exist") { //nolint:gocritic // ignore - return backoff.Permanent(v1.ErrInstanceNotFound) - } else if strings.Contains(body, "banned you temporarily") { - return outErr - } else if resp.StatusCode < 500 && resp.StatusCode != 429 { // 429 Too Many Requests (use back off) - return backoff.Permanent(outErr) - } else { - return outErr - } -} - -func handleErrToCloudErr(e error) error { - if e == nil { - return nil - } - if strings.Contains(e.Error(), "Not enough capacity") || strings.Contains(e.Error(), "insufficient-capacity") { //nolint:gocritic // ignore - return v1.ErrInsufficientResources - } else if strings.Contains(e.Error(), "global/invalid-parameters") && strings.Contains(e.Error(), "Region") && strings.Contains(e.Error(), "does not exist") { - return v1.ErrInsufficientResources - } else { - return e - } -} diff --git a/v1/providers/lambdalabs/errors_test.go b/v1/providers/lambdalabs/errors_test.go deleted file mode 100644 index 8e49b77e..00000000 --- a/v1/providers/lambdalabs/errors_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package v1 - -import ( - "context" - "errors" - "io" - "net/http" - "net/url" - "strings" - "testing" - - "github.com/cenkalti/backoff/v4" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - v1 "github.com/brevdev/cloud/v1" - openapi "github.com/brevdev/cloud/v1/providers/lambdalabs/gen/lambdalabs" -) - -func TestHandleAPIError_InstanceNotFound(t *testing.T) { - body := `{"error": {"message": "instance does not exist"}}` - resp := &http.Response{ - StatusCode: 404, - Body: io.NopCloser(strings.NewReader(body)), - Request: &http.Request{URL: &url.URL{Path: "/test"}}, - Status: "404 Not Found", - } - - err := handleAPIError(context.Background(), resp, errors.New("not found")) - - var permanentErr *backoff.PermanentError - require.True(t, errors.As(err, &permanentErr)) - assert.Equal(t, v1.ErrInstanceNotFound, permanentErr.Err) -} - -func TestHandleAPIError_BannedTemporarily(t *testing.T) { - body := `{"error": {"message": "banned you temporarily"}}` - resp := &http.Response{ - StatusCode: 429, - Body: io.NopCloser(strings.NewReader(body)), - Request: &http.Request{URL: &url.URL{Path: "/test"}}, - Status: "429 Too Many Requests", - } - - err := handleAPIError(context.Background(), resp, errors.New("rate limited")) - - var permanentErr *backoff.PermanentError - assert.False(t, errors.As(err, &permanentErr)) - assert.Contains(t, err.Error(), "LambdaLabs API error") - assert.Contains(t, err.Error(), "banned you temporarily") -} - -func TestHandleAPIError_ClientError(t *testing.T) { - tests := []struct { - name string - statusCode int - status string - }{ - {"bad request", 400, "400 Bad Request"}, - {"unauthorized", 401, "401 Unauthorized"}, - {"forbidden", 403, "403 Forbidden"}, - {"not found", 404, "404 Not Found"}, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - body := `{"error": {"message": "client error"}}` - resp := &http.Response{ - StatusCode: tt.statusCode, - Body: io.NopCloser(strings.NewReader(body)), - Request: &http.Request{URL: &url.URL{Path: "/test"}}, - Status: tt.status, - } - - err := handleAPIError(context.Background(), resp, errors.New("client error")) - - var permanentErr *backoff.PermanentError - require.True(t, errors.As(err, &permanentErr)) - assert.Contains(t, permanentErr.Err.Error(), "LambdaLabs API error") - }) - } -} - -func TestHandleAPIError_TooManyRequests(t *testing.T) { - body := `{"error": {"message": "too many requests"}}` - resp := &http.Response{ - StatusCode: 429, - Body: io.NopCloser(strings.NewReader(body)), - Request: &http.Request{URL: &url.URL{Path: "/test"}}, - Status: "429 Too Many Requests", - } - - err := handleAPIError(context.Background(), resp, errors.New("rate limited")) - - var permanentErr *backoff.PermanentError - assert.False(t, errors.As(err, &permanentErr)) - assert.Contains(t, err.Error(), "LambdaLabs API error") -} - -func TestHandleAPIError_ServerError(t *testing.T) { - tests := []struct { - name string - statusCode int - status string - }{ - {"internal server error", 500, "500 Internal Server Error"}, - {"bad gateway", 502, "502 Bad Gateway"}, - {"service unavailable", 503, "503 Service Unavailable"}, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - body := `{"error": {"message": "server error"}}` - resp := &http.Response{ - StatusCode: tt.statusCode, - Body: io.NopCloser(strings.NewReader(body)), - Request: &http.Request{URL: &url.URL{Path: "/test"}}, - Status: tt.status, - } - - err := handleAPIError(context.Background(), resp, errors.New("server error")) - - var permanentErr *backoff.PermanentError - assert.False(t, errors.As(err, &permanentErr)) - assert.Contains(t, err.Error(), "LambdaLabs API error") - }) - } -} - -func TestHandleAPIError_OpenAPIError(t *testing.T) { - body := `{"error": {"message": "test error"}}` - - openAPIErr := openapi.GenericOpenAPIError{} - - resp := &http.Response{ - StatusCode: 400, - Body: io.NopCloser(strings.NewReader(body)), - Request: &http.Request{URL: &url.URL{Path: "/test"}}, - Status: "400 Bad Request", - } - - err := handleAPIError(context.Background(), resp, openAPIErr) - - var permanentErr *backoff.PermanentError - require.True(t, errors.As(err, &permanentErr)) - assert.Contains(t, permanentErr.Err.Error(), "LambdaLabs API error") - assert.Contains(t, permanentErr.Err.Error(), "/test") - assert.Contains(t, permanentErr.Err.Error(), "400 Bad Request") -} - -func TestHandleAPIError_EmptyBody(t *testing.T) { - resp := &http.Response{ - StatusCode: 400, - Body: io.NopCloser(strings.NewReader("")), - Request: &http.Request{URL: &url.URL{Path: "/test"}}, - Status: "400 Bad Request", - } - - err := handleAPIError(context.Background(), resp, errors.New("test error")) - - var permanentErr *backoff.PermanentError - require.True(t, errors.As(err, &permanentErr)) - assert.Contains(t, permanentErr.Err.Error(), "LambdaLabs API error") - assert.Contains(t, permanentErr.Err.Error(), "test error") -} - -func TestHandleAPIError_BodyReadError(t *testing.T) { - resp := &http.Response{ - StatusCode: 400, - Body: &errorReader{}, - Request: &http.Request{URL: &url.URL{Path: "/test"}}, - Status: "400 Bad Request", - } - - err := handleAPIError(context.Background(), resp, errors.New("test error")) - - var permanentErr *backoff.PermanentError - require.True(t, errors.As(err, &permanentErr)) - assert.Contains(t, permanentErr.Err.Error(), "LambdaLabs API error") -} - -type errorReader struct{} - -func (e *errorReader) Read(_ []byte) (n int, err error) { - return 0, errors.New("read error") -} - -func (e *errorReader) Close() error { - return nil -} - -func TestHandleErrToCloudErr_NilError(t *testing.T) { - result := handleErrToCloudErr(nil) - assert.Nil(t, result) -} - -func TestHandleErrToCloudErr_CapacityErrors(t *testing.T) { - tests := []struct { - name string - errMsg string - expected error - }{ - { - name: "not enough capacity", - errMsg: "Not enough capacity in region", - expected: v1.ErrInsufficientResources, - }, - { - name: "insufficient capacity", - errMsg: "insufficient-capacity error occurred", - expected: v1.ErrInsufficientResources, - }, - { - name: "capacity with mixed case", - errMsg: "Error: Not enough capacity available", - expected: v1.ErrInsufficientResources, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - inputErr := errors.New(tt.errMsg) - result := handleErrToCloudErr(inputErr) - assert.Equal(t, tt.expected, result) - }) - } -} - -func TestHandleErrToCloudErr_RegionErrors(t *testing.T) { - tests := []struct { - name string - errMsg string - expected error - }{ - { - name: "region does not exist", - errMsg: "global/invalid-parameters: Region us-invalid-1 does not exist", - expected: v1.ErrInsufficientResources, - }, - { - name: "region error with different format", - errMsg: "global/invalid-parameters error: Region eu-central-99 does not exist in this zone", - expected: v1.ErrInsufficientResources, - }, - { - name: "invalid parameters without region", - errMsg: "global/invalid-parameters: Invalid instance type", - expected: errors.New("global/invalid-parameters: Invalid instance type"), - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - inputErr := errors.New(tt.errMsg) - result := handleErrToCloudErr(inputErr) - if tt.expected == v1.ErrInsufficientResources { - assert.Equal(t, tt.expected, result) - } else { - assert.Equal(t, tt.expected.Error(), result.Error()) - } - }) - } -} - -func TestHandleErrToCloudErr_OtherErrors(t *testing.T) { - tests := []struct { - name string - errMsg string - }{ - { - name: "authentication error", - errMsg: "invalid API key provided", - }, - { - name: "network error", - errMsg: "connection timeout", - }, - { - name: "generic error", - errMsg: "something went wrong", - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - inputErr := errors.New(tt.errMsg) - result := handleErrToCloudErr(inputErr) - assert.Equal(t, inputErr, result) - }) - } -} - -func TestHandleErrToCloudErr_EdgeCases(t *testing.T) { - tests := []struct { - name string - errMsg string - expected error - }{ - { - name: "empty error message", - errMsg: "", - expected: errors.New(""), - }, - { - name: "capacity substring in larger message", - errMsg: "The request failed because Not enough capacity is available in the selected region", - expected: v1.ErrInsufficientResources, - }, - { - name: "insufficient capacity with prefix", - errMsg: "API Error: insufficient-capacity - please try again later", - expected: v1.ErrInsufficientResources, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - inputErr := errors.New(tt.errMsg) - result := handleErrToCloudErr(inputErr) - if tt.expected == v1.ErrInsufficientResources { - assert.Equal(t, tt.expected, result) - } else { - assert.Equal(t, tt.expected.Error(), result.Error()) - } - }) - } -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/.gitignore b/v1/providers/lambdalabs/gen/lambdalabs/.gitignore deleted file mode 100644 index daf913b1..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test -*.prof diff --git a/v1/providers/lambdalabs/gen/lambdalabs/.openapi-generator-ignore b/v1/providers/lambdalabs/gen/lambdalabs/.openapi-generator-ignore deleted file mode 100644 index 7484ee59..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/v1/providers/lambdalabs/gen/lambdalabs/.openapi-generator/FILES b/v1/providers/lambdalabs/gen/lambdalabs/.openapi-generator/FILES deleted file mode 100644 index 178a9ee6..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/.openapi-generator/FILES +++ /dev/null @@ -1,67 +0,0 @@ -.gitignore -.travis.yml -README.md -api/openapi.yaml -api_default.go -client.go -configuration.go -docs/AddSSHKey200Response.md -docs/AddSSHKeyRequest.md -docs/DefaultAPI.md -docs/ErrorCode.md -docs/ErrorResponseBody.md -docs/FileSystem.md -docs/GetInstance200Response.md -docs/Instance.md -docs/InstanceType.md -docs/InstanceTypeSpecs.md -docs/InstanceTypes200Response.md -docs/InstanceTypes200ResponseDataValue.md -docs/LaunchInstance200Response.md -docs/LaunchInstance200ResponseData.md -docs/LaunchInstanceRequest.md -docs/ListFileSystems200Response.md -docs/ListInstances200Response.md -docs/ListSSHKeys200Response.md -docs/ModelError.md -docs/Region.md -docs/RestartInstance200Response.md -docs/RestartInstance200ResponseData.md -docs/RestartInstanceRequest.md -docs/SshKey.md -docs/TerminateInstance200Response.md -docs/TerminateInstance200ResponseData.md -docs/TerminateInstanceRequest.md -docs/User.md -git_push.sh -go.mod -go.sum -model_add_ssh_key_200_response.go -model_add_ssh_key_request.go -model_error.go -model_error_code.go -model_error_response_body.go -model_file_system.go -model_get_instance_200_response.go -model_instance.go -model_instance_type.go -model_instance_type_specs.go -model_instance_types_200_response.go -model_instance_types_200_response_data_value.go -model_launch_instance_200_response.go -model_launch_instance_200_response_data.go -model_launch_instance_request.go -model_list_file_systems_200_response.go -model_list_instances_200_response.go -model_list_ssh_keys_200_response.go -model_region.go -model_restart_instance_200_response.go -model_restart_instance_200_response_data.go -model_restart_instance_request.go -model_ssh_key.go -model_terminate_instance_200_response.go -model_terminate_instance_200_response_data.go -model_terminate_instance_request.go -model_user.go -response.go -utils.go diff --git a/v1/providers/lambdalabs/gen/lambdalabs/.openapi-generator/VERSION b/v1/providers/lambdalabs/gen/lambdalabs/.openapi-generator/VERSION deleted file mode 100644 index 09a6d308..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -7.8.0 diff --git a/v1/providers/lambdalabs/gen/lambdalabs/.travis.yml b/v1/providers/lambdalabs/gen/lambdalabs/.travis.yml deleted file mode 100644 index f5cb2ce9..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: go - -install: - - go get -d -v . - -script: - - go build -v ./ - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/README.md b/v1/providers/lambdalabs/gen/lambdalabs/README.md deleted file mode 100644 index a1d0f043..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/README.md +++ /dev/null @@ -1,173 +0,0 @@ -# Go API client for openapi - -API for interacting with the Lambda GPU Cloud - -## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. - -- API version: 1.5.3 -- Package version: 1.0.0 -- Generator version: 7.8.0 -- Build package: org.openapitools.codegen.languages.GoClientCodegen - -## Installation - -Install the following dependencies: - -```sh -go get github.com/stretchr/testify/assert -go get golang.org/x/net/context -``` - -Put the package under your project folder and add the following in import: - -```go -import openapi "github.com/brevdev/cloud" -``` - -To use a proxy, set the environment variable `HTTP_PROXY`: - -```go -os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") -``` - -## Configuration of Server URL - -Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification. - -### Select Server Configuration - -For using other server than the one defined on index 0 set context value `openapi.ContextServerIndex` of type `int`. - -```go -ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1) -``` - -### Templated Server URL - -Templated server URL is formatted using default variables from configuration or from context value `openapi.ContextServerVariables` of type `map[string]string`. - -```go -ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{ - "basePath": "v2", -}) -``` - -Note, enum values are always validated and all unused variables are silently ignored. - -### URLs Configuration per Operation - -Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. -An operation is uniquely identified by `"{classname}Service.{nickname}"` string. -Similar rules for overriding default operation server index and variables applies by using `openapi.ContextOperationServerIndices` and `openapi.ContextOperationServerVariables` context maps. - -```go -ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{ - "{classname}Service.{nickname}": 2, -}) -ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{ - "{classname}Service.{nickname}": { - "port": "8443", - }, -}) -``` - -## Documentation for API Endpoints - -All URIs are relative to *https://cloud.lambda.ai/api/v1* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*DefaultAPI* | [**AddSSHKey**](docs/DefaultAPI.md#addsshkey) | **Post** /ssh-keys | Add SSH key -*DefaultAPI* | [**DeleteSSHKey**](docs/DefaultAPI.md#deletesshkey) | **Delete** /ssh-keys/{id} | Delete SSH key -*DefaultAPI* | [**GetInstance**](docs/DefaultAPI.md#getinstance) | **Get** /instances/{id} | List details of a specific instance -*DefaultAPI* | [**InstanceTypes**](docs/DefaultAPI.md#instancetypes) | **Get** /instance-types | Retrieve list of offered instance types -*DefaultAPI* | [**LaunchInstance**](docs/DefaultAPI.md#launchinstance) | **Post** /instance-operations/launch | Launch instances -*DefaultAPI* | [**ListFileSystems**](docs/DefaultAPI.md#listfilesystems) | **Get** /file-systems | List file systems -*DefaultAPI* | [**ListInstances**](docs/DefaultAPI.md#listinstances) | **Get** /instances | List running instances -*DefaultAPI* | [**ListSSHKeys**](docs/DefaultAPI.md#listsshkeys) | **Get** /ssh-keys | List SSH keys -*DefaultAPI* | [**RestartInstance**](docs/DefaultAPI.md#restartinstance) | **Post** /instance-operations/restart | Restart instances -*DefaultAPI* | [**TerminateInstance**](docs/DefaultAPI.md#terminateinstance) | **Post** /instance-operations/terminate | Terminate an instance - - -## Documentation For Models - - - [AddSSHKey200Response](docs/AddSSHKey200Response.md) - - [AddSSHKeyRequest](docs/AddSSHKeyRequest.md) - - [ErrorCode](docs/ErrorCode.md) - - [ErrorResponseBody](docs/ErrorResponseBody.md) - - [FileSystem](docs/FileSystem.md) - - [GetInstance200Response](docs/GetInstance200Response.md) - - [Instance](docs/Instance.md) - - [InstanceType](docs/InstanceType.md) - - [InstanceTypeSpecs](docs/InstanceTypeSpecs.md) - - [InstanceTypes200Response](docs/InstanceTypes200Response.md) - - [InstanceTypes200ResponseDataValue](docs/InstanceTypes200ResponseDataValue.md) - - [LaunchInstance200Response](docs/LaunchInstance200Response.md) - - [LaunchInstance200ResponseData](docs/LaunchInstance200ResponseData.md) - - [LaunchInstanceRequest](docs/LaunchInstanceRequest.md) - - [ListFileSystems200Response](docs/ListFileSystems200Response.md) - - [ListInstances200Response](docs/ListInstances200Response.md) - - [ListSSHKeys200Response](docs/ListSSHKeys200Response.md) - - [ModelError](docs/ModelError.md) - - [Region](docs/Region.md) - - [RestartInstance200Response](docs/RestartInstance200Response.md) - - [RestartInstance200ResponseData](docs/RestartInstance200ResponseData.md) - - [RestartInstanceRequest](docs/RestartInstanceRequest.md) - - [SshKey](docs/SshKey.md) - - [TerminateInstance200Response](docs/TerminateInstance200Response.md) - - [TerminateInstance200ResponseData](docs/TerminateInstance200ResponseData.md) - - [TerminateInstanceRequest](docs/TerminateInstanceRequest.md) - - [User](docs/User.md) - - -## Documentation For Authorization - - -Authentication schemes defined for the API: -### basicAuth - -- **Type**: HTTP basic authentication - -Example - -```go -auth := context.WithValue(context.Background(), openapi.ContextBasicAuth, openapi.BasicAuth{ - UserName: "username", - Password: "password", -}) -r, err := client.Service.Operation(auth, args) -``` - -### bearerAuth - -- **Type**: HTTP Bearer token authentication - -Example - -```go -auth := context.WithValue(context.Background(), openapi.ContextAccessToken, "BEARER_TOKEN_STRING") -r, err := client.Service.Operation(auth, args) -``` - - -## Documentation for Utility Methods - -Due to the fact that model structure members are all pointers, this package contains -a number of utility functions to easily obtain pointers to values of basic types. -Each of these functions takes a value of the given basic type and returns a pointer to it: - -* `PtrBool` -* `PtrInt` -* `PtrInt32` -* `PtrInt64` -* `PtrFloat` -* `PtrFloat32` -* `PtrFloat64` -* `PtrString` -* `PtrTime` - -## Author - - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/api/openapi.yaml b/v1/providers/lambdalabs/gen/lambdalabs/api/openapi.yaml deleted file mode 100644 index b1f47b62..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/api/openapi.yaml +++ /dev/null @@ -1,1591 +0,0 @@ -openapi: 3.0.0 -info: - description: API for interacting with the Lambda GPU Cloud - title: Lambda Cloud API - version: 1.5.3 -servers: -- description: Production server - url: https://cloud.lambda.ai/api/v1/ -- description: Secondary production server (deprecated) - url: https://cloud.lambdalabs.com/api/v1/ -- url: https://cloud.lambdalabs.com/api/v1/ -security: -- basicAuth: [] -- bearerAuth: [] -paths: - /instance-types: - get: - description: | - 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. - operationId: instanceTypes - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/instanceTypes_200_response' - description: OK - "401": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Unauthorized. - "403": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Forbidden. - summary: Retrieve list of offered instance types - /instances: - get: - description: Retrieves a detailed list of running instances. - operationId: listInstances - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/listInstances_200_response' - description: OK - "401": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Unauthorized. - "403": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Forbidden. - summary: List running instances - x-cli-aliases: - - ls - /instances/{id}: - get: - description: | - Retrieves details of a specific instance, including whether or not the instance is running. - operationId: getInstance - parameters: - - description: The unique identifier (ID) of the instance - explode: false - in: path - name: id - required: true - schema: - $ref: '#/components/schemas/instanceId' - style: simple - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/getInstance_200_response' - description: OK - "401": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Unauthorized. - "403": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Forbidden. - "404": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Object does not exist. - summary: List details of a specific instance - /instance-operations/launch: - post: - description: Launches one or more instances of a given instance type. - operationId: launchInstance - requestBody: - $ref: '#/components/requestBodies/launch' - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/launchInstance_200_response' - description: OK - "401": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Unauthorized. - "403": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Forbidden. - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Request parameters were invalid. - "404": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Object does not exist. - "500": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Something unexpected occurred. - summary: Launch instances - /instance-operations/terminate: - post: - description: Terminates a given instance. - operationId: terminateInstance - requestBody: - $ref: '#/components/requestBodies/terminate' - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/terminateInstance_200_response' - description: OK - "401": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Unauthorized. - "403": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Forbidden. - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Request parameters were invalid. - "404": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Object does not exist. - "500": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Something unexpected occurred. - summary: Terminate an instance - /instance-operations/restart: - post: - description: Restarts the given instances. - operationId: restartInstance - requestBody: - $ref: '#/components/requestBodies/restart' - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/restartInstance_200_response' - description: OK - "401": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Unauthorized. - "403": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Forbidden. - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Request parameters were invalid. - "404": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Object does not exist. - "500": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Something unexpected occurred. - summary: Restart instances - /ssh-keys: - get: - description: Retrieve the list of SSH keys - operationId: listSSHKeys - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/listSSHKeys_200_response' - description: OK - "401": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Unauthorized. - "403": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Forbidden. - summary: List SSH keys - post: - description: | - 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.lambda.ai/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 - ``` - operationId: addSSHKey - requestBody: - $ref: '#/components/requestBodies/addSSHKey' - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/addSSHKey_200_response' - description: OK - "401": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Unauthorized. - "403": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Forbidden. - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Request parameters were invalid. - summary: Add SSH key - /ssh-keys/{id}: - delete: - description: Delete an SSH key. - operationId: deleteSSHKey - parameters: - - description: The unique identifier (ID) of the SSH key - explode: false - in: path - name: id - required: true - schema: - $ref: '#/components/schemas/sshKeyId' - style: simple - responses: - "200": - description: Deletion successful - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Request parameters were invalid. - "401": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Unauthorized. - "403": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Forbidden. - summary: Delete SSH key - /file-systems: - get: - description: Retrieve the list of file systems - operationId: listFileSystems - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/listFileSystems_200_response' - description: OK - "401": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Unauthorized. - "403": - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Forbidden. - summary: List file systems -components: - requestBodies: - launch: - content: - application/json: - schema: - $ref: '#/components/schemas/launchInstance_request' - required: true - terminate: - content: - application/json: - schema: - $ref: '#/components/schemas/terminateInstance_request' - required: true - restart: - content: - application/json: - schema: - $ref: '#/components/schemas/restartInstance_request' - required: true - addSSHKey: - content: - application/json: - schema: - $ref: '#/components/schemas/addSSHKey_request' - required: true - responses: - unauthorized: - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Unauthorized. - forbidden: - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Forbidden. - notFound: - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Object does not exist. - badRequest: - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Request parameters were invalid. - internalServerError: - content: - application/json: - schema: - $ref: '#/components/schemas/errorResponseBody' - description: Something unexpected occurred. - instances: - content: - application/json: - schema: - $ref: '#/components/schemas/listInstances_200_response' - description: OK - instance: - content: - application/json: - schema: - $ref: '#/components/schemas/getInstance_200_response' - description: OK - instanceTypes: - content: - application/json: - schema: - $ref: '#/components/schemas/instanceTypes_200_response' - description: OK - launch: - content: - application/json: - schema: - $ref: '#/components/schemas/launchInstance_200_response' - description: OK - terminate: - content: - application/json: - schema: - $ref: '#/components/schemas/terminateInstance_200_response' - description: OK - restart: - content: - application/json: - schema: - $ref: '#/components/schemas/restartInstance_200_response' - description: OK - sshKeys: - content: - application/json: - schema: - $ref: '#/components/schemas/listSSHKeys_200_response' - description: OK - addSSHKey: - content: - application/json: - schema: - $ref: '#/components/schemas/addSSHKey_200_response' - description: OK - fileSystems: - content: - application/json: - schema: - $ref: '#/components/schemas/listFileSystems_200_response' - description: OK - schemas: - errorCode: - description: Unique identifier for the type of error - enum: - - global/unknown - - global/invalid-api-key - - global/account-inactive - - global/invalid-address - - global/invalid-parameters - - global/object-does-not-exist - - global/quota-exceeded - - instance-operations/launch/insufficient-capacity - - instance-operations/launch/file-system-in-wrong-region - - ssh-keys/key-in-use - type: string - error: - additionalProperties: false - example: - code: global/unknown - suggestion: Create a new API key and try again. - message: "API key is invalid, expired, or deleted." - properties: - code: - $ref: '#/components/schemas/errorCode' - message: - description: Detailed description of the error - example: "API key is invalid, expired, or deleted." - type: string - suggestion: - description: Suggestion of possible ways to fix the error. - example: Create a new API key and try again. - nullable: true - type: string - required: - - code - - message - type: object - errorResponseBody: - additionalProperties: false - example: - field_errors: - key: - code: global/unknown - suggestion: Create a new API key and try again. - message: "API key is invalid, expired, or deleted." - error: - code: global/unknown - suggestion: Create a new API key and try again. - message: "API key is invalid, expired, or deleted." - properties: - error: - $ref: '#/components/schemas/error' - field_errors: - additionalProperties: - $ref: '#/components/schemas/error' - description: Details about errors on a per-parameter basis - type: object - required: - - error - type: object - datetime: - description: "A date and time, formatted as an ISO 8601 time stamp" - example: 2023-02-24T20:48:56+00:00 - type: string - user: - additionalProperties: false - description: Information about a user in your team - example: - id: 0920582c7ff041399e34823a0be62549 - email: teammate@example.com - status: active - properties: - id: - description: Unique identifier for the user - example: 0920582c7ff041399e34823a0be62549 - type: string - email: - description: Email address of the user - example: teammate@example.com - type: string - status: - description: Status of the user's account - enum: - - active - - deactivated - type: string - required: - - email - - id - - status - type: object - regionName: - description: Short name of a region - example: us-tx-1 - type: string - region: - additionalProperties: false - example: - name: us-tx-1 - description: "Austin, Texas" - properties: - name: - description: Short name of a region - example: us-tx-1 - type: string - description: - description: Long name of a region - example: "Austin, Texas" - type: string - required: - - description - - name - type: object - instanceId: - description: Unique identifier (ID) of an instance - example: 0920582c7ff041399e34823a0be62549 - type: string - sshKeyId: - description: Unique identifier (ID) of an SSH key - example: 0920582c7ff041399e34823a0be62548 - type: string - fileSystemId: - description: Unique identifier (ID) of a file system - example: 0920582c7ff041399e34823a0be62547 - type: string - sshKeyName: - description: Name of the SSH key - example: macbook-pro - maxLength: 64 - type: string - sshPublicKey: - description: Public key for the SSH key - example: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDfKpav4ILY54InZe27G user - maxLength: 4096 - type: string - sshPrivateKey: - description: Private key for the SSH key. Only returned when generating a new - key pair. - example: | - -----BEGIN RSA PRIVATE KEY----- - MIIEpQIBAAKCAQEA5IGybv8/wdQM6Y4yYTGiEem4TscBZiAW+9xyW2pDt8S7VDtm - ... - eCW4938W9u8N3R/kpGwi1tZYiGMLBU4Ks0qKFi/VeEaE9OLeP5WQ8Pk= - -----END RSA PRIVATE KEY----- - nullable: true - type: string - sshKey: - additionalProperties: false - description: "Information about a stored SSH key, which can be used to access\ - \ instances over SSH" - example: - public_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDfKpav4ILY54InZe27G user - name: macbook-pro - private_key: | - -----BEGIN RSA PRIVATE KEY----- - MIIEpQIBAAKCAQEA5IGybv8/wdQM6Y4yYTGiEem4TscBZiAW+9xyW2pDt8S7VDtm - ... - eCW4938W9u8N3R/kpGwi1tZYiGMLBU4Ks0qKFi/VeEaE9OLeP5WQ8Pk= - -----END RSA PRIVATE KEY----- - id: 0920582c7ff041399e34823a0be62548 - properties: - id: - description: Unique identifier (ID) of an SSH key - example: 0920582c7ff041399e34823a0be62548 - type: string - name: - description: Name of the SSH key - example: macbook-pro - maxLength: 64 - type: string - public_key: - description: Public key for the SSH key - example: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDfKpav4ILY54InZe27G user - maxLength: 4096 - type: string - private_key: - description: Private key for the SSH key. Only returned when generating - a new key pair. - example: | - -----BEGIN RSA PRIVATE KEY----- - MIIEpQIBAAKCAQEA5IGybv8/wdQM6Y4yYTGiEem4TscBZiAW+9xyW2pDt8S7VDtm - ... - eCW4938W9u8N3R/kpGwi1tZYiGMLBU4Ks0qKFi/VeEaE9OLeP5WQ8Pk= - -----END RSA PRIVATE KEY----- - nullable: true - type: string - required: - - id - - name - - public_key - type: object - fileSystemName: - description: Name of a file system - example: shared-fs - type: string - fileSystem: - additionalProperties: false - description: Information about a shared file system - example: - is_in_use: true - bytes_used: 2147483648 - created: 2023-02-24T20:48:56+00:00 - mount_point: /lambda/nfs/shared-fs - name: shared-fs - id: 0920582c7ff041399e34823a0be62547 - region: - name: us-tx-1 - description: "Austin, Texas" - created_by: - id: 0920582c7ff041399e34823a0be62549 - email: teammate@example.com - status: active - properties: - id: - description: Unique identifier (ID) of a file system - example: 0920582c7ff041399e34823a0be62547 - type: string - name: - description: Name of a file system - example: shared-fs - type: string - created: - description: "A date and time, formatted as an ISO 8601 time stamp" - example: 2023-02-24T20:48:56+00:00 - type: string - created_by: - $ref: '#/components/schemas/user' - mount_point: - description: Absolute path indicating where on instances the file system - will be mounted - example: /lambda/nfs/shared-fs - type: string - region: - $ref: '#/components/schemas/region' - is_in_use: - description: Whether the file system is currently in use by an instance. - File systems that are in use cannot be deleted. - type: boolean - bytes_used: - description: "Approximate amount of storage used by the file system, in\ - \ bytes. This value is an estimate that is updated every several hours." - example: 2147483648 - type: integer - required: - - created - - created_by - - id - - is_in_use - - mount_point - - name - - region - type: object - instanceTypeName: - description: Name of an instance type - example: gpu_1x_a100 - type: string - instanceName: - description: User-provided name for the instance - example: training-node-1 - maxLength: 64 - minLength: 1 - nullable: true - type: string - instanceType: - additionalProperties: false - description: Hardware configuration and pricing of an instance type - example: - specs: - memory_gib: 800 - gpus: 4 - vcpus: 24 - storage_gib: 512 - name: gpu_1x_a100 - description: 1x RTX A100 (24 GB) - price_cents_per_hour: 110 - gpu_description: RTX A100 (24 GB) - properties: - name: - description: Name of an instance type - example: gpu_1x_a100 - type: string - description: - description: Long name of the instance type - example: 1x RTX A100 (24 GB) - type: string - gpu_description: - description: Description of the GPU(s) in the instance type - example: RTX A100 (24 GB) - type: string - price_cents_per_hour: - description: "Price of the instance type, in US cents per hour" - example: 110 - type: integer - specs: - $ref: '#/components/schemas/instanceType_specs' - required: - - description - - gpu_description - - name - - price_cents_per_hour - - specs - type: object - instance: - description: Virtual machine (VM) in Lambda Cloud - example: - ip: 198.51.100.2 - private_ip: 10.0.2.100 - jupyter_token: 53968f128c4a4489b688c2c0a181d083 - is_reserved: true - hostname: 10.0.8.196 - file_system_names: - - shared-fs - - shared-fs - name: training-node-1 - id: 0920582c7ff041399e34823a0be62549 - region: - name: us-tx-1 - description: "Austin, Texas" - jupyter_url: https://jupyter-3ac4c5c6-9026-47d2-9a33-71efccbcd0ee.lambdaspaces.com/?token=53968f128c4a4489b688c2c0a181d083 - instance_type: - specs: - memory_gib: 800 - gpus: 4 - vcpus: 24 - storage_gib: 512 - name: gpu_1x_a100 - description: 1x RTX A100 (24 GB) - price_cents_per_hour: 110 - gpu_description: RTX A100 (24 GB) - status: active - ssh_key_names: - - macbook-pro - - macbook-pro - properties: - id: - description: Unique identifier (ID) of an instance - example: 0920582c7ff041399e34823a0be62549 - type: string - name: - description: User-provided name for the instance - example: training-node-1 - maxLength: 64 - minLength: 1 - nullable: true - type: string - ip: - description: IPv4 address of the instance - example: 198.51.100.2 - nullable: true - type: string - private_ip: - description: Private IPv4 address of the instance - example: 10.0.2.100 - nullable: true - type: string - status: - description: The current status of the instance - enum: - - active - - booting - - unhealthy - - terminating - - terminated - type: string - ssh_key_names: - description: Names of the SSH keys allowed to access the instance - items: - $ref: '#/components/schemas/sshKeyName' - type: array - file_system_names: - description: "Names of the file systems, if any, attached to the instance" - items: - $ref: '#/components/schemas/fileSystemName' - type: array - region: - $ref: '#/components/schemas/region' - instance_type: - $ref: '#/components/schemas/instanceType' - hostname: - description: "Hostname assigned to this instance, which resolves to the\ - \ instance's IP." - example: 10.0.8.196 - nullable: true - type: string - jupyter_token: - description: Secret token used to log into the jupyter lab server hosted - on the instance. - example: 53968f128c4a4489b688c2c0a181d083 - nullable: true - type: string - jupyter_url: - description: URL that opens a jupyter lab notebook on the instance. - example: https://jupyter-3ac4c5c6-9026-47d2-9a33-71efccbcd0ee.lambdaspaces.com/?token=53968f128c4a4489b688c2c0a181d083 - nullable: true - type: string - is_reserved: - description: Whether the instance is reserved. - type: boolean - required: - - file_system_names - - id - - ssh_key_names - - status - type: object - instanceTypes_200_response_data_value: - additionalProperties: false - properties: - instance_type: - $ref: '#/components/schemas/instanceType' - regions_with_capacity_available: - description: "List of regions, if any, that have this instance type available" - items: - $ref: '#/components/schemas/region' - type: array - required: - - instance_type - - regions_with_capacity_available - type: object - instanceTypes_200_response: - additionalProperties: false - example: - data: - gpu_1x_a100: - instance_type: - name: gpu_1x_a100 - description: 1x RTX A100 (24 GB) - price_cents_per_hour: "80" - specs: - vcpus: 24 - memory_gib: 800 - storage_gib: 512 - regions_with_capacity_available: - - name: us-tx-1 - description: "Austin, Texas" - gpu_4x_a6000: - instance_type: - name: gpu_4x_a6000 - description: 4x RTX 6000 (24 GB) - price_cents_per_hour: "110" - specs: - vcpus: 24 - memory_gib: 800 - storage_gib: 512 - regions_with_capacity_available: - - name: us-phoenix-1 - description: "Phoenix, Arizona" - properties: - data: - additionalProperties: - $ref: '#/components/schemas/instanceTypes_200_response_data_value' - description: Dict of instance_type_name to instance_type and region availability. - example: - gpu_1x_a100: - instance_type: - name: gpu_1x_a100 - description: 1x RTX A100 (24 GB) - price_cents_per_hour: "80" - specs: - vcpus: 24 - memory_gib: 800 - storage_gib: 512 - regions_with_capacity_available: - - name: us-tx-1 - description: "Austin, Texas" - gpu_4x_a6000: - instance_type: - name: gpu_4x_a6000 - description: 4x RTX 6000 (24 GB) - price_cents_per_hour: "110" - specs: - vcpus: 24 - memory_gib: 800 - storage_gib: 512 - regions_with_capacity_available: - - name: us-phoenix-1 - description: "Phoenix, Arizona" - type: object - required: - - data - type: object - listInstances_200_response: - additionalProperties: false - example: - data: - - ip: 198.51.100.2 - private_ip: 10.0.2.100 - jupyter_token: 53968f128c4a4489b688c2c0a181d083 - is_reserved: true - hostname: 10.0.8.196 - file_system_names: - - shared-fs - - shared-fs - name: training-node-1 - id: 0920582c7ff041399e34823a0be62549 - region: - name: us-tx-1 - description: "Austin, Texas" - jupyter_url: https://jupyter-3ac4c5c6-9026-47d2-9a33-71efccbcd0ee.lambdaspaces.com/?token=53968f128c4a4489b688c2c0a181d083 - instance_type: - specs: - memory_gib: 800 - gpus: 4 - vcpus: 24 - storage_gib: 512 - name: gpu_1x_a100 - description: 1x RTX A100 (24 GB) - price_cents_per_hour: 110 - gpu_description: RTX A100 (24 GB) - status: active - ssh_key_names: - - macbook-pro - - macbook-pro - - ip: 198.51.100.2 - private_ip: 10.0.2.100 - jupyter_token: 53968f128c4a4489b688c2c0a181d083 - is_reserved: true - hostname: 10.0.8.196 - file_system_names: - - shared-fs - - shared-fs - name: training-node-1 - id: 0920582c7ff041399e34823a0be62549 - region: - name: us-tx-1 - description: "Austin, Texas" - jupyter_url: https://jupyter-3ac4c5c6-9026-47d2-9a33-71efccbcd0ee.lambdaspaces.com/?token=53968f128c4a4489b688c2c0a181d083 - instance_type: - specs: - memory_gib: 800 - gpus: 4 - vcpus: 24 - storage_gib: 512 - name: gpu_1x_a100 - description: 1x RTX A100 (24 GB) - price_cents_per_hour: 110 - gpu_description: RTX A100 (24 GB) - status: active - ssh_key_names: - - macbook-pro - - macbook-pro - properties: - data: - items: - $ref: '#/components/schemas/instance' - type: array - required: - - data - type: object - getInstance_200_response: - additionalProperties: false - example: - data: - ip: 198.51.100.2 - private_ip: 10.0.2.100 - jupyter_token: 53968f128c4a4489b688c2c0a181d083 - is_reserved: true - hostname: 10.0.8.196 - file_system_names: - - shared-fs - - shared-fs - name: training-node-1 - id: 0920582c7ff041399e34823a0be62549 - region: - name: us-tx-1 - description: "Austin, Texas" - jupyter_url: https://jupyter-3ac4c5c6-9026-47d2-9a33-71efccbcd0ee.lambdaspaces.com/?token=53968f128c4a4489b688c2c0a181d083 - instance_type: - specs: - memory_gib: 800 - gpus: 4 - vcpus: 24 - storage_gib: 512 - name: gpu_1x_a100 - description: 1x RTX A100 (24 GB) - price_cents_per_hour: 110 - gpu_description: RTX A100 (24 GB) - status: active - ssh_key_names: - - macbook-pro - - macbook-pro - properties: - data: - $ref: '#/components/schemas/instance' - required: - - data - type: object - launchInstance_request: - additionalProperties: false - properties: - region_name: - description: Short name of a region - example: us-tx-1 - type: string - instance_type_name: - description: Name of an instance type - example: gpu_1x_a100 - type: string - ssh_key_names: - description: "Names of the SSH keys to allow access to the instances. Currently,\ - \ exactly one SSH key must be specified." - items: - $ref: '#/components/schemas/sshKeyName' - maxItems: 1 - minItems: 1 - type: array - file_system_names: - description: "Names of the file systems to attach to the instances. Currently,\ - \ only one (if any) file system may be specified." - items: - $ref: '#/components/schemas/fileSystemName' - maxItems: 1 - type: array - quantity: - default: 1 - description: Number of instances to launch - maximum: 1 - minimum: 1 - type: integer - name: - description: User-provided name for the instance - example: training-node-1 - maxLength: 64 - minLength: 1 - nullable: true - type: string - required: - - instance_type_name - - region_name - - ssh_key_names - type: object - launchInstance_200_response_data: - additionalProperties: false - example: - instance_ids: - - 0920582c7ff041399e34823a0be62549 - - 0920582c7ff041399e34823a0be62549 - properties: - instance_ids: - description: "The unique identifiers (IDs) of the launched instances. Note:\ - \ if a quantity was specified, fewer than the requested quantity might\ - \ have been launched." - items: - $ref: '#/components/schemas/instanceId' - type: array - required: - - instance_ids - type: object - launchInstance_200_response: - additionalProperties: false - example: - data: - instance_ids: - - 0920582c7ff041399e34823a0be62549 - - 0920582c7ff041399e34823a0be62549 - properties: - data: - $ref: '#/components/schemas/launchInstance_200_response_data' - required: - - data - type: object - terminateInstance_request: - additionalProperties: false - properties: - instance_ids: - description: The unique identifiers (IDs) of the instances to terminate - items: - $ref: '#/components/schemas/instanceId' - type: array - required: - - instance_ids - type: object - terminateInstance_200_response_data: - additionalProperties: false - example: - terminated_instances: - - ip: 198.51.100.2 - private_ip: 10.0.2.100 - jupyter_token: 53968f128c4a4489b688c2c0a181d083 - is_reserved: true - hostname: 10.0.8.196 - file_system_names: - - shared-fs - - shared-fs - name: training-node-1 - id: 0920582c7ff041399e34823a0be62549 - region: - name: us-tx-1 - description: "Austin, Texas" - jupyter_url: https://jupyter-3ac4c5c6-9026-47d2-9a33-71efccbcd0ee.lambdaspaces.com/?token=53968f128c4a4489b688c2c0a181d083 - instance_type: - specs: - memory_gib: 800 - gpus: 4 - vcpus: 24 - storage_gib: 512 - name: gpu_1x_a100 - description: 1x RTX A100 (24 GB) - price_cents_per_hour: 110 - gpu_description: RTX A100 (24 GB) - status: active - ssh_key_names: - - macbook-pro - - macbook-pro - - ip: 198.51.100.2 - private_ip: 10.0.2.100 - jupyter_token: 53968f128c4a4489b688c2c0a181d083 - is_reserved: true - hostname: 10.0.8.196 - file_system_names: - - shared-fs - - shared-fs - name: training-node-1 - id: 0920582c7ff041399e34823a0be62549 - region: - name: us-tx-1 - description: "Austin, Texas" - jupyter_url: https://jupyter-3ac4c5c6-9026-47d2-9a33-71efccbcd0ee.lambdaspaces.com/?token=53968f128c4a4489b688c2c0a181d083 - instance_type: - specs: - memory_gib: 800 - gpus: 4 - vcpus: 24 - storage_gib: 512 - name: gpu_1x_a100 - description: 1x RTX A100 (24 GB) - price_cents_per_hour: 110 - gpu_description: RTX A100 (24 GB) - status: active - ssh_key_names: - - macbook-pro - - macbook-pro - properties: - terminated_instances: - description: "List of instances that were terminated. Note: this list might\ - \ not contain all instances requested to be terminated." - items: - $ref: '#/components/schemas/instance' - type: array - required: - - terminated_instances - type: object - terminateInstance_200_response: - additionalProperties: false - example: - data: - terminated_instances: - - ip: 198.51.100.2 - private_ip: 10.0.2.100 - jupyter_token: 53968f128c4a4489b688c2c0a181d083 - is_reserved: true - hostname: 10.0.8.196 - file_system_names: - - shared-fs - - shared-fs - name: training-node-1 - id: 0920582c7ff041399e34823a0be62549 - region: - name: us-tx-1 - description: "Austin, Texas" - jupyter_url: https://jupyter-3ac4c5c6-9026-47d2-9a33-71efccbcd0ee.lambdaspaces.com/?token=53968f128c4a4489b688c2c0a181d083 - instance_type: - specs: - memory_gib: 800 - gpus: 4 - vcpus: 24 - storage_gib: 512 - name: gpu_1x_a100 - description: 1x RTX A100 (24 GB) - price_cents_per_hour: 110 - gpu_description: RTX A100 (24 GB) - status: active - ssh_key_names: - - macbook-pro - - macbook-pro - - ip: 198.51.100.2 - private_ip: 10.0.2.100 - jupyter_token: 53968f128c4a4489b688c2c0a181d083 - is_reserved: true - hostname: 10.0.8.196 - file_system_names: - - shared-fs - - shared-fs - name: training-node-1 - id: 0920582c7ff041399e34823a0be62549 - region: - name: us-tx-1 - description: "Austin, Texas" - jupyter_url: https://jupyter-3ac4c5c6-9026-47d2-9a33-71efccbcd0ee.lambdaspaces.com/?token=53968f128c4a4489b688c2c0a181d083 - instance_type: - specs: - memory_gib: 800 - gpus: 4 - vcpus: 24 - storage_gib: 512 - name: gpu_1x_a100 - description: 1x RTX A100 (24 GB) - price_cents_per_hour: 110 - gpu_description: RTX A100 (24 GB) - status: active - ssh_key_names: - - macbook-pro - - macbook-pro - properties: - data: - $ref: '#/components/schemas/terminateInstance_200_response_data' - required: - - data - type: object - restartInstance_request: - additionalProperties: false - properties: - instance_ids: - description: The unique identifiers (IDs) of the instances to restart - items: - $ref: '#/components/schemas/instanceId' - type: array - required: - - instance_ids - type: object - restartInstance_200_response_data: - additionalProperties: false - example: - restarted_instances: - - ip: 198.51.100.2 - private_ip: 10.0.2.100 - jupyter_token: 53968f128c4a4489b688c2c0a181d083 - is_reserved: true - hostname: 10.0.8.196 - file_system_names: - - shared-fs - - shared-fs - name: training-node-1 - id: 0920582c7ff041399e34823a0be62549 - region: - name: us-tx-1 - description: "Austin, Texas" - jupyter_url: https://jupyter-3ac4c5c6-9026-47d2-9a33-71efccbcd0ee.lambdaspaces.com/?token=53968f128c4a4489b688c2c0a181d083 - instance_type: - specs: - memory_gib: 800 - gpus: 4 - vcpus: 24 - storage_gib: 512 - name: gpu_1x_a100 - description: 1x RTX A100 (24 GB) - price_cents_per_hour: 110 - gpu_description: RTX A100 (24 GB) - status: active - ssh_key_names: - - macbook-pro - - macbook-pro - - ip: 198.51.100.2 - private_ip: 10.0.2.100 - jupyter_token: 53968f128c4a4489b688c2c0a181d083 - is_reserved: true - hostname: 10.0.8.196 - file_system_names: - - shared-fs - - shared-fs - name: training-node-1 - id: 0920582c7ff041399e34823a0be62549 - region: - name: us-tx-1 - description: "Austin, Texas" - jupyter_url: https://jupyter-3ac4c5c6-9026-47d2-9a33-71efccbcd0ee.lambdaspaces.com/?token=53968f128c4a4489b688c2c0a181d083 - instance_type: - specs: - memory_gib: 800 - gpus: 4 - vcpus: 24 - storage_gib: 512 - name: gpu_1x_a100 - description: 1x RTX A100 (24 GB) - price_cents_per_hour: 110 - gpu_description: RTX A100 (24 GB) - status: active - ssh_key_names: - - macbook-pro - - macbook-pro - properties: - restarted_instances: - description: "List of instances that were restarted. Note: this list might\ - \ not contain all instances requested to be restarted." - items: - $ref: '#/components/schemas/instance' - type: array - required: - - restarted_instances - type: object - restartInstance_200_response: - additionalProperties: false - example: - data: - restarted_instances: - - ip: 198.51.100.2 - private_ip: 10.0.2.100 - jupyter_token: 53968f128c4a4489b688c2c0a181d083 - is_reserved: true - hostname: 10.0.8.196 - file_system_names: - - shared-fs - - shared-fs - name: training-node-1 - id: 0920582c7ff041399e34823a0be62549 - region: - name: us-tx-1 - description: "Austin, Texas" - jupyter_url: https://jupyter-3ac4c5c6-9026-47d2-9a33-71efccbcd0ee.lambdaspaces.com/?token=53968f128c4a4489b688c2c0a181d083 - instance_type: - specs: - memory_gib: 800 - gpus: 4 - vcpus: 24 - storage_gib: 512 - name: gpu_1x_a100 - description: 1x RTX A100 (24 GB) - price_cents_per_hour: 110 - gpu_description: RTX A100 (24 GB) - status: active - ssh_key_names: - - macbook-pro - - macbook-pro - - ip: 198.51.100.2 - private_ip: 10.0.2.100 - jupyter_token: 53968f128c4a4489b688c2c0a181d083 - is_reserved: true - hostname: 10.0.8.196 - file_system_names: - - shared-fs - - shared-fs - name: training-node-1 - id: 0920582c7ff041399e34823a0be62549 - region: - name: us-tx-1 - description: "Austin, Texas" - jupyter_url: https://jupyter-3ac4c5c6-9026-47d2-9a33-71efccbcd0ee.lambdaspaces.com/?token=53968f128c4a4489b688c2c0a181d083 - instance_type: - specs: - memory_gib: 800 - gpus: 4 - vcpus: 24 - storage_gib: 512 - name: gpu_1x_a100 - description: 1x RTX A100 (24 GB) - price_cents_per_hour: 110 - gpu_description: RTX A100 (24 GB) - status: active - ssh_key_names: - - macbook-pro - - macbook-pro - properties: - data: - $ref: '#/components/schemas/restartInstance_200_response_data' - required: - - data - type: object - listSSHKeys_200_response: - additionalProperties: false - example: - data: - - public_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDfKpav4ILY54InZe27G user - name: macbook-pro - private_key: | - -----BEGIN RSA PRIVATE KEY----- - MIIEpQIBAAKCAQEA5IGybv8/wdQM6Y4yYTGiEem4TscBZiAW+9xyW2pDt8S7VDtm - ... - eCW4938W9u8N3R/kpGwi1tZYiGMLBU4Ks0qKFi/VeEaE9OLeP5WQ8Pk= - -----END RSA PRIVATE KEY----- - id: 0920582c7ff041399e34823a0be62548 - - public_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDfKpav4ILY54InZe27G user - name: macbook-pro - private_key: | - -----BEGIN RSA PRIVATE KEY----- - MIIEpQIBAAKCAQEA5IGybv8/wdQM6Y4yYTGiEem4TscBZiAW+9xyW2pDt8S7VDtm - ... - eCW4938W9u8N3R/kpGwi1tZYiGMLBU4Ks0qKFi/VeEaE9OLeP5WQ8Pk= - -----END RSA PRIVATE KEY----- - id: 0920582c7ff041399e34823a0be62548 - properties: - data: - items: - $ref: '#/components/schemas/sshKey' - type: array - required: - - data - type: object - addSSHKey_request: - additionalProperties: false - description: "The name for the SSH key. Optionally, an existing public key can\ - \ be supplied for the `public_key` property. If the `public_key` property\ - \ is omitted, a new key pair is generated. The private key is returned in\ - \ the response." - example: - name: newly-generated-key - properties: - name: - description: Name of the SSH key - example: macbook-pro - maxLength: 64 - type: string - public_key: - description: Public key for the SSH key - example: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDfKpav4ILY54InZe27G user - maxLength: 4096 - type: string - required: - - name - type: object - addSSHKey_200_response: - additionalProperties: false - description: "The added or generated SSH public key. If a new key pair was generated,\ - \ the response body contains a `private_key` property that *must* be saved\ - \ locally. Lambda Cloud does not store private keys." - example: - data: - id: 0920582c7ff041399e34823a0be62548 - name: newly-generated-key - public_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDfKpav4ILY54InZe27G user - private_key: | - -----BEGIN RSA PRIVATE KEY----- - KEY CONTENT-----END RSA PRIVATE KEY----- - properties: - data: - $ref: '#/components/schemas/sshKey' - required: - - data - type: object - listFileSystems_200_response: - additionalProperties: false - example: - data: - - is_in_use: true - bytes_used: 2147483648 - created: 2023-02-24T20:48:56+00:00 - mount_point: /lambda/nfs/shared-fs - name: shared-fs - id: 0920582c7ff041399e34823a0be62547 - region: - name: us-tx-1 - description: "Austin, Texas" - created_by: - id: 0920582c7ff041399e34823a0be62549 - email: teammate@example.com - status: active - - is_in_use: true - bytes_used: 2147483648 - created: 2023-02-24T20:48:56+00:00 - mount_point: /lambda/nfs/shared-fs - name: shared-fs - id: 0920582c7ff041399e34823a0be62547 - region: - name: us-tx-1 - description: "Austin, Texas" - created_by: - id: 0920582c7ff041399e34823a0be62549 - email: teammate@example.com - status: active - properties: - data: - items: - $ref: '#/components/schemas/fileSystem' - type: array - required: - - data - type: object - instanceType_specs: - additionalProperties: false - example: - memory_gib: 800 - gpus: 4 - vcpus: 24 - storage_gib: 512 - properties: - vcpus: - description: Number of virtual CPUs - example: 24 - type: integer - memory_gib: - description: "Amount of RAM, in gibibytes (GiB)" - example: 800 - type: integer - storage_gib: - description: "Amount of storage, in gibibytes (GiB)." - example: 512 - type: integer - gpus: - description: Number of GPUs - example: 4 - type: integer - required: - - gpus - - memory_gib - - storage_gib - - vcpus - type: object - securitySchemes: - basicAuth: - description: "Basic HTTP authentication. Allowed headers-- `Authorization: Basic\ - \ :` | `Authorization: Basic `" - scheme: basic - type: http - bearerAuth: - bearerFormat: auth-scheme - description: "Bearer HTTP authentication. Allowed headers-- `Authorization:\ - \ Bearer `" - scheme: bearer - type: http diff --git a/v1/providers/lambdalabs/gen/lambdalabs/api_default.go b/v1/providers/lambdalabs/gen/lambdalabs/api_default.go deleted file mode 100644 index ffd80b3a..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/api_default.go +++ /dev/null @@ -1,1426 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "context" - "io" - "net/http" - "net/url" - "strings" -) - -// DefaultAPIService DefaultAPI service -type DefaultAPIService service - -type ApiAddSSHKeyRequest struct { - ctx context.Context - ApiService *DefaultAPIService - addSSHKeyRequest *AddSSHKeyRequest -} - -func (r ApiAddSSHKeyRequest) AddSSHKeyRequest(addSSHKeyRequest AddSSHKeyRequest) ApiAddSSHKeyRequest { - r.addSSHKeyRequest = &addSSHKeyRequest - return r -} - -func (r ApiAddSSHKeyRequest) Execute() (*AddSSHKey200Response, *http.Response, error) { - return r.ApiService.AddSSHKeyExecute(r) -} - -/* -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.lambda.ai/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 -``` - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiAddSSHKeyRequest -*/ -func (a *DefaultAPIService) AddSSHKey(ctx context.Context) ApiAddSSHKeyRequest { - return ApiAddSSHKeyRequest{ - ApiService: a, - ctx: ctx, - } -} - -// Execute executes the request -// -// @return AddSSHKey200Response -func (a *DefaultAPIService) AddSSHKeyExecute(r ApiAddSSHKeyRequest) (*AddSSHKey200Response, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *AddSSHKey200Response - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.AddSSHKey") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/ssh-keys" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - if r.addSSHKeyRequest == nil { - return localVarReturnValue, nil, reportError("addSSHKeyRequest is required and must be specified") - } - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - // body params - localVarPostBody = r.addSSHKeyRequest - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 401 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 400 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type ApiDeleteSSHKeyRequest struct { - ctx context.Context - ApiService *DefaultAPIService - id string -} - -func (r ApiDeleteSSHKeyRequest) Execute() (*http.Response, error) { - return r.ApiService.DeleteSSHKeyExecute(r) -} - -/* -DeleteSSHKey Delete SSH key - -Delete an SSH key. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id The unique identifier (ID) of the SSH key - @return ApiDeleteSSHKeyRequest -*/ -func (a *DefaultAPIService) DeleteSSHKey(ctx context.Context, id string) ApiDeleteSSHKeyRequest { - return ApiDeleteSSHKeyRequest{ - ApiService: a, - ctx: ctx, - id: id, - } -} - -// Execute executes the request -func (a *DefaultAPIService) DeleteSSHKeyExecute(r ApiDeleteSSHKeyRequest) (*http.Response, error) { - var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteSSHKey") - if err != nil { - return nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/ssh-keys/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 401 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type ApiGetInstanceRequest struct { - ctx context.Context - ApiService *DefaultAPIService - id string -} - -func (r ApiGetInstanceRequest) Execute() (*GetInstance200Response, *http.Response, error) { - return r.ApiService.GetInstanceExecute(r) -} - -/* -GetInstance List details of a specific instance - -Retrieves details of a specific instance, including whether or not the instance is running. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id The unique identifier (ID) of the instance - @return ApiGetInstanceRequest -*/ -func (a *DefaultAPIService) GetInstance(ctx context.Context, id string) ApiGetInstanceRequest { - return ApiGetInstanceRequest{ - ApiService: a, - ctx: ctx, - id: id, - } -} - -// Execute executes the request -// -// @return GetInstance200Response -func (a *DefaultAPIService) GetInstanceExecute(r ApiGetInstanceRequest) (*GetInstance200Response, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *GetInstance200Response - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetInstance") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/instances/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 401 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type ApiInstanceTypesRequest struct { - ctx context.Context - ApiService *DefaultAPIService -} - -func (r ApiInstanceTypesRequest) Execute() (*InstanceTypes200Response, *http.Response, error) { - return r.ApiService.InstanceTypesExecute(r) -} - -/* -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. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiInstanceTypesRequest -*/ -func (a *DefaultAPIService) InstanceTypes(ctx context.Context) ApiInstanceTypesRequest { - return ApiInstanceTypesRequest{ - ApiService: a, - ctx: ctx, - } -} - -// Execute executes the request -// -// @return InstanceTypes200Response -func (a *DefaultAPIService) InstanceTypesExecute(r ApiInstanceTypesRequest) (*InstanceTypes200Response, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *InstanceTypes200Response - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.InstanceTypes") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/instance-types" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 401 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type ApiLaunchInstanceRequest struct { - ctx context.Context - ApiService *DefaultAPIService - launchInstanceRequest *LaunchInstanceRequest -} - -func (r ApiLaunchInstanceRequest) LaunchInstanceRequest(launchInstanceRequest LaunchInstanceRequest) ApiLaunchInstanceRequest { - r.launchInstanceRequest = &launchInstanceRequest - return r -} - -func (r ApiLaunchInstanceRequest) Execute() (*LaunchInstance200Response, *http.Response, error) { - return r.ApiService.LaunchInstanceExecute(r) -} - -/* -LaunchInstance Launch instances - -Launches one or more instances of a given instance type. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiLaunchInstanceRequest -*/ -func (a *DefaultAPIService) LaunchInstance(ctx context.Context) ApiLaunchInstanceRequest { - return ApiLaunchInstanceRequest{ - ApiService: a, - ctx: ctx, - } -} - -// Execute executes the request -// -// @return LaunchInstance200Response -func (a *DefaultAPIService) LaunchInstanceExecute(r ApiLaunchInstanceRequest) (*LaunchInstance200Response, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *LaunchInstance200Response - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.LaunchInstance") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/instance-operations/launch" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - if r.launchInstanceRequest == nil { - return localVarReturnValue, nil, reportError("launchInstanceRequest is required and must be specified") - } - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - // body params - localVarPostBody = r.launchInstanceRequest - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 401 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 400 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 500 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type ApiListFileSystemsRequest struct { - ctx context.Context - ApiService *DefaultAPIService -} - -func (r ApiListFileSystemsRequest) Execute() (*ListFileSystems200Response, *http.Response, error) { - return r.ApiService.ListFileSystemsExecute(r) -} - -/* -ListFileSystems List file systems - -Retrieve the list of file systems - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiListFileSystemsRequest -*/ -func (a *DefaultAPIService) ListFileSystems(ctx context.Context) ApiListFileSystemsRequest { - return ApiListFileSystemsRequest{ - ApiService: a, - ctx: ctx, - } -} - -// Execute executes the request -// -// @return ListFileSystems200Response -func (a *DefaultAPIService) ListFileSystemsExecute(r ApiListFileSystemsRequest) (*ListFileSystems200Response, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *ListFileSystems200Response - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListFileSystems") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/file-systems" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 401 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type ApiListInstancesRequest struct { - ctx context.Context - ApiService *DefaultAPIService -} - -func (r ApiListInstancesRequest) Execute() (*ListInstances200Response, *http.Response, error) { - return r.ApiService.ListInstancesExecute(r) -} - -/* -ListInstances List running instances - -Retrieves a detailed list of running instances. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiListInstancesRequest -*/ -func (a *DefaultAPIService) ListInstances(ctx context.Context) ApiListInstancesRequest { - return ApiListInstancesRequest{ - ApiService: a, - ctx: ctx, - } -} - -// Execute executes the request -// -// @return ListInstances200Response -func (a *DefaultAPIService) ListInstancesExecute(r ApiListInstancesRequest) (*ListInstances200Response, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *ListInstances200Response - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListInstances") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/instances" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 401 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type ApiListSSHKeysRequest struct { - ctx context.Context - ApiService *DefaultAPIService -} - -func (r ApiListSSHKeysRequest) Execute() (*ListSSHKeys200Response, *http.Response, error) { - return r.ApiService.ListSSHKeysExecute(r) -} - -/* -ListSSHKeys List SSH keys - -Retrieve the list of SSH keys - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiListSSHKeysRequest -*/ -func (a *DefaultAPIService) ListSSHKeys(ctx context.Context) ApiListSSHKeysRequest { - return ApiListSSHKeysRequest{ - ApiService: a, - ctx: ctx, - } -} - -// Execute executes the request -// -// @return ListSSHKeys200Response -func (a *DefaultAPIService) ListSSHKeysExecute(r ApiListSSHKeysRequest) (*ListSSHKeys200Response, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *ListSSHKeys200Response - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListSSHKeys") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/ssh-keys" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 401 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type ApiRestartInstanceRequest struct { - ctx context.Context - ApiService *DefaultAPIService - restartInstanceRequest *RestartInstanceRequest -} - -func (r ApiRestartInstanceRequest) RestartInstanceRequest(restartInstanceRequest RestartInstanceRequest) ApiRestartInstanceRequest { - r.restartInstanceRequest = &restartInstanceRequest - return r -} - -func (r ApiRestartInstanceRequest) Execute() (*RestartInstance200Response, *http.Response, error) { - return r.ApiService.RestartInstanceExecute(r) -} - -/* -RestartInstance Restart instances - -Restarts the given instances. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiRestartInstanceRequest -*/ -func (a *DefaultAPIService) RestartInstance(ctx context.Context) ApiRestartInstanceRequest { - return ApiRestartInstanceRequest{ - ApiService: a, - ctx: ctx, - } -} - -// Execute executes the request -// -// @return RestartInstance200Response -func (a *DefaultAPIService) RestartInstanceExecute(r ApiRestartInstanceRequest) (*RestartInstance200Response, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *RestartInstance200Response - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.RestartInstance") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/instance-operations/restart" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - if r.restartInstanceRequest == nil { - return localVarReturnValue, nil, reportError("restartInstanceRequest is required and must be specified") - } - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - // body params - localVarPostBody = r.restartInstanceRequest - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 401 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 400 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 500 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type ApiTerminateInstanceRequest struct { - ctx context.Context - ApiService *DefaultAPIService - terminateInstanceRequest *TerminateInstanceRequest -} - -func (r ApiTerminateInstanceRequest) TerminateInstanceRequest(terminateInstanceRequest TerminateInstanceRequest) ApiTerminateInstanceRequest { - r.terminateInstanceRequest = &terminateInstanceRequest - return r -} - -func (r ApiTerminateInstanceRequest) Execute() (*TerminateInstance200Response, *http.Response, error) { - return r.ApiService.TerminateInstanceExecute(r) -} - -/* -TerminateInstance Terminate an instance - -Terminates a given instance. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiTerminateInstanceRequest -*/ -func (a *DefaultAPIService) TerminateInstance(ctx context.Context) ApiTerminateInstanceRequest { - return ApiTerminateInstanceRequest{ - ApiService: a, - ctx: ctx, - } -} - -// Execute executes the request -// -// @return TerminateInstance200Response -func (a *DefaultAPIService) TerminateInstanceExecute(r ApiTerminateInstanceRequest) (*TerminateInstance200Response, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *TerminateInstance200Response - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.TerminateInstance") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/instance-operations/terminate" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - if r.terminateInstanceRequest == nil { - return localVarReturnValue, nil, reportError("terminateInstanceRequest is required and must be specified") - } - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - // body params - localVarPostBody = r.terminateInstanceRequest - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 401 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 400 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 500 { - var v ErrorResponseBody - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/client.go b/v1/providers/lambdalabs/gen/lambdalabs/client.go deleted file mode 100644 index eb1cb43b..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/client.go +++ /dev/null @@ -1,661 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "context" - "encoding/json" - "encoding/xml" - "errors" - "fmt" - "io" - "log" - "mime/multipart" - "net/http" - "net/http/httputil" - "net/url" - "os" - "path/filepath" - "reflect" - "regexp" - "strconv" - "strings" - "time" - "unicode/utf8" -) - -var ( - JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) - XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) - queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) - queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") -) - -// APIClient manages communication with the Lambda Cloud API API v1.5.3 -// In most cases there should be only one, shared, APIClient. -type APIClient struct { - cfg *Configuration - common service // Reuse a single struct instead of allocating one for each service on the heap. - - // API Services - - DefaultAPI *DefaultAPIService -} - -type service struct { - client *APIClient -} - -// NewAPIClient creates a new API client. Requires a userAgent string describing your application. -// optionally a custom http.Client to allow for advanced features such as caching. -func NewAPIClient(cfg *Configuration) *APIClient { - if cfg.HTTPClient == nil { - cfg.HTTPClient = http.DefaultClient - } - - c := &APIClient{} - c.cfg = cfg - c.common.client = c - - // API Services - c.DefaultAPI = (*DefaultAPIService)(&c.common) - - return c -} - -func atoi(in string) (int, error) { - return strconv.Atoi(in) -} - -// selectHeaderContentType select a content type from the available list. -func selectHeaderContentType(contentTypes []string) string { - if len(contentTypes) == 0 { - return "" - } - if contains(contentTypes, "application/json") { - return "application/json" - } - return contentTypes[0] // use the first content type specified in 'consumes' -} - -// selectHeaderAccept join all accept types and return -func selectHeaderAccept(accepts []string) string { - if len(accepts) == 0 { - return "" - } - - if contains(accepts, "application/json") { - return "application/json" - } - - return strings.Join(accepts, ",") -} - -// contains is a case insensitive match, finding needle in a haystack -func contains(haystack []string, needle string) bool { - for _, a := range haystack { - if strings.EqualFold(a, needle) { - return true - } - } - return false -} - -// Verify optional parameters are of the correct type. -func typeCheckParameter(obj interface{}, expected string, name string) error { - // Make sure there is an object. - if obj == nil { - return nil - } - - // Check the type is as expected. - if reflect.TypeOf(obj).String() != expected { - return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) - } - return nil -} - -func parameterValueToString(obj interface{}, key string) string { - if reflect.TypeOf(obj).Kind() != reflect.Ptr { - return fmt.Sprintf("%v", obj) - } - var param, ok = obj.(MappedNullable) - if !ok { - return "" - } - dataMap, err := param.ToMap() - if err != nil { - return "" - } - return fmt.Sprintf("%v", dataMap[key]) -} - -// parameterAddToHeaderOrQuery adds the provided object to the request header or url query -// supporting deep object syntax -func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { - var v = reflect.ValueOf(obj) - var value = "" - if v == reflect.ValueOf(nil) { - value = "null" - } else { - switch v.Kind() { - case reflect.Invalid: - value = "invalid" - - case reflect.Struct: - if t, ok := obj.(MappedNullable); ok { - dataMap, err := t.ToMap() - if err != nil { - return - } - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType) - return - } - if t, ok := obj.(time.Time); ok { - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType) - return - } - value = v.Type().String() + " value" - case reflect.Slice: - var indValue = reflect.ValueOf(obj) - if indValue == reflect.ValueOf(nil) { - return - } - var lenIndValue = indValue.Len() - for i := 0; i < lenIndValue; i++ { - var arrayValue = indValue.Index(i) - var keyPrefixForCollectionType = keyPrefix - if style == "deepObject" { - keyPrefixForCollectionType = keyPrefix + "[" + strconv.Itoa(i) + "]" - } - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefixForCollectionType, arrayValue.Interface(), style, collectionType) - } - return - - case reflect.Map: - var indValue = reflect.ValueOf(obj) - if indValue == reflect.ValueOf(nil) { - return - } - iter := indValue.MapRange() - for iter.Next() { - k, v := iter.Key(), iter.Value() - parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), style, collectionType) - } - return - - case reflect.Interface: - fallthrough - case reflect.Ptr: - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), style, collectionType) - return - - case reflect.Int, reflect.Int8, reflect.Int16, - reflect.Int32, reflect.Int64: - value = strconv.FormatInt(v.Int(), 10) - case reflect.Uint, reflect.Uint8, reflect.Uint16, - reflect.Uint32, reflect.Uint64, reflect.Uintptr: - value = strconv.FormatUint(v.Uint(), 10) - case reflect.Float32, reflect.Float64: - value = strconv.FormatFloat(v.Float(), 'g', -1, 32) - case reflect.Bool: - value = strconv.FormatBool(v.Bool()) - case reflect.String: - value = v.String() - default: - value = v.Type().String() + " value" - } - } - - switch valuesMap := headerOrQueryParams.(type) { - case url.Values: - if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { - valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) - } else { - valuesMap.Add(keyPrefix, value) - } - break - case map[string]string: - valuesMap[keyPrefix] = value - break - } -} - -// helper for converting interface{} parameters to json strings -func parameterToJson(obj interface{}) (string, error) { - jsonBuf, err := json.Marshal(obj) - if err != nil { - return "", err - } - return string(jsonBuf), err -} - -// callAPI do the request. -func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { - if c.cfg.Debug { - dump, err := httputil.DumpRequestOut(request, true) - if err != nil { - return nil, err - } - log.Printf("\n%s\n", string(dump)) - } - - resp, err := c.cfg.HTTPClient.Do(request) - if err != nil { - return resp, err - } - - if c.cfg.Debug { - dump, err := httputil.DumpResponse(resp, true) - if err != nil { - return resp, err - } - log.Printf("\n%s\n", string(dump)) - } - return resp, err -} - -// Allow modification of underlying config for alternate implementations and testing -// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior -func (c *APIClient) GetConfig() *Configuration { - return c.cfg -} - -type formFile struct { - fileBytes []byte - fileName string - formFileName string -} - -// prepareRequest build the request -func (c *APIClient) prepareRequest( - ctx context.Context, - path string, method string, - postBody interface{}, - headerParams map[string]string, - queryParams url.Values, - formParams url.Values, - formFiles []formFile) (localVarRequest *http.Request, err error) { - - var body *bytes.Buffer - - // Detect postBody type and post. - if postBody != nil { - contentType := headerParams["Content-Type"] - if contentType == "" { - contentType = detectContentType(postBody) - headerParams["Content-Type"] = contentType - } - - body, err = setBody(postBody, contentType) - if err != nil { - return nil, err - } - } - - // add form parameters and file if available. - if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { - if body != nil { - return nil, errors.New("Cannot specify postBody and multipart form at the same time.") - } - body = &bytes.Buffer{} - w := multipart.NewWriter(body) - - for k, v := range formParams { - for _, iv := range v { - if strings.HasPrefix(k, "@") { // file - err = addFile(w, k[1:], iv) - if err != nil { - return nil, err - } - } else { // form value - w.WriteField(k, iv) - } - } - } - for _, formFile := range formFiles { - if len(formFile.fileBytes) > 0 && formFile.fileName != "" { - w.Boundary() - part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) - if err != nil { - return nil, err - } - _, err = part.Write(formFile.fileBytes) - if err != nil { - return nil, err - } - } - } - - // Set the Boundary in the Content-Type - headerParams["Content-Type"] = w.FormDataContentType() - - // Set Content-Length - headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) - w.Close() - } - - if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { - if body != nil { - return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") - } - body = &bytes.Buffer{} - body.WriteString(formParams.Encode()) - // Set Content-Length - headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) - } - - // Setup path and query parameters - url, err := url.Parse(path) - if err != nil { - return nil, err - } - - // Override request host, if applicable - if c.cfg.Host != "" { - url.Host = c.cfg.Host - } - - // Override request scheme, if applicable - if c.cfg.Scheme != "" { - url.Scheme = c.cfg.Scheme - } - - // Adding Query Param - query := url.Query() - for k, v := range queryParams { - for _, iv := range v { - query.Add(k, iv) - } - } - - // Encode the parameters. - url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { - pieces := strings.Split(s, "=") - pieces[0] = queryDescape.Replace(pieces[0]) - return strings.Join(pieces, "=") - }) - - // Generate a new request - if body != nil { - localVarRequest, err = http.NewRequest(method, url.String(), body) - } else { - localVarRequest, err = http.NewRequest(method, url.String(), nil) - } - if err != nil { - return nil, err - } - - // add header parameters, if any - if len(headerParams) > 0 { - headers := http.Header{} - for h, v := range headerParams { - headers[h] = []string{v} - } - localVarRequest.Header = headers - } - - // Add the user agent to the request. - localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) - - if ctx != nil { - // add context to the request - localVarRequest = localVarRequest.WithContext(ctx) - - // Walk through any authentication. - - // Basic HTTP Authentication - if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { - localVarRequest.SetBasicAuth(auth.UserName, auth.Password) - } - - // AccessToken Authentication - if auth, ok := ctx.Value(ContextAccessToken).(string); ok { - localVarRequest.Header.Add("Authorization", "Bearer "+auth) - } - - } - - for header, value := range c.cfg.DefaultHeader { - localVarRequest.Header.Add(header, value) - } - return localVarRequest, nil -} - -func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { - if len(b) == 0 { - return nil - } - if s, ok := v.(*string); ok { - *s = string(b) - return nil - } - if f, ok := v.(*os.File); ok { - f, err = os.CreateTemp("", "HttpClientFile") - if err != nil { - return - } - _, err = f.Write(b) - if err != nil { - return - } - _, err = f.Seek(0, io.SeekStart) - return - } - if f, ok := v.(**os.File); ok { - *f, err = os.CreateTemp("", "HttpClientFile") - if err != nil { - return - } - _, err = (*f).Write(b) - if err != nil { - return - } - _, err = (*f).Seek(0, io.SeekStart) - return - } - if XmlCheck.MatchString(contentType) { - if err = xml.Unmarshal(b, v); err != nil { - return err - } - return nil - } - if JsonCheck.MatchString(contentType) { - if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas - if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined - if err = unmarshalObj.UnmarshalJSON(b); err != nil { - return err - } - } else { - return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") - } - } else if err = json.Unmarshal(b, v); err != nil { // simple model - return err - } - return nil - } - return errors.New("undefined response type") -} - -// Add a file to the multipart request -func addFile(w *multipart.Writer, fieldName, path string) error { - file, err := os.Open(filepath.Clean(path)) - if err != nil { - return err - } - err = file.Close() - if err != nil { - return err - } - - part, err := w.CreateFormFile(fieldName, filepath.Base(path)) - if err != nil { - return err - } - _, err = io.Copy(part, file) - - return err -} - -// Set request body from an interface{} -func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { - if bodyBuf == nil { - bodyBuf = &bytes.Buffer{} - } - - if reader, ok := body.(io.Reader); ok { - _, err = bodyBuf.ReadFrom(reader) - } else if fp, ok := body.(*os.File); ok { - _, err = bodyBuf.ReadFrom(fp) - } else if b, ok := body.([]byte); ok { - _, err = bodyBuf.Write(b) - } else if s, ok := body.(string); ok { - _, err = bodyBuf.WriteString(s) - } else if s, ok := body.(*string); ok { - _, err = bodyBuf.WriteString(*s) - } else if JsonCheck.MatchString(contentType) { - err = json.NewEncoder(bodyBuf).Encode(body) - } else if XmlCheck.MatchString(contentType) { - var bs []byte - bs, err = xml.Marshal(body) - if err == nil { - bodyBuf.Write(bs) - } - } - - if err != nil { - return nil, err - } - - if bodyBuf.Len() == 0 { - err = fmt.Errorf("invalid body type %s\n", contentType) - return nil, err - } - return bodyBuf, nil -} - -// detectContentType method is used to figure out `Request.Body` content type for request header -func detectContentType(body interface{}) string { - contentType := "text/plain; charset=utf-8" - kind := reflect.TypeOf(body).Kind() - - switch kind { - case reflect.Struct, reflect.Map, reflect.Ptr: - contentType = "application/json; charset=utf-8" - case reflect.String: - contentType = "text/plain; charset=utf-8" - default: - if b, ok := body.([]byte); ok { - contentType = http.DetectContentType(b) - } else if kind == reflect.Slice { - contentType = "application/json; charset=utf-8" - } - } - - return contentType -} - -// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go -type cacheControl map[string]string - -func parseCacheControl(headers http.Header) cacheControl { - cc := cacheControl{} - ccHeader := headers.Get("Cache-Control") - for _, part := range strings.Split(ccHeader, ",") { - part = strings.Trim(part, " ") - if part == "" { - continue - } - if strings.ContainsRune(part, '=') { - keyval := strings.Split(part, "=") - cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") - } else { - cc[part] = "" - } - } - return cc -} - -// CacheExpires helper function to determine remaining time before repeating a request. -func CacheExpires(r *http.Response) time.Time { - // Figure out when the cache expires. - var expires time.Time - now, err := time.Parse(time.RFC1123, r.Header.Get("date")) - if err != nil { - return time.Now() - } - respCacheControl := parseCacheControl(r.Header) - - if maxAge, ok := respCacheControl["max-age"]; ok { - lifetime, err := time.ParseDuration(maxAge + "s") - if err != nil { - expires = now - } else { - expires = now.Add(lifetime) - } - } else { - expiresHeader := r.Header.Get("Expires") - if expiresHeader != "" { - expires, err = time.Parse(time.RFC1123, expiresHeader) - if err != nil { - expires = now - } - } - } - return expires -} - -func strlen(s string) int { - return utf8.RuneCountInString(s) -} - -// GenericOpenAPIError Provides access to the body, error and model on returned errors. -type GenericOpenAPIError struct { - body []byte - error string - model interface{} -} - -// Error returns non-empty string if there was an error. -func (e GenericOpenAPIError) Error() string { - return e.error -} - -// Body returns the raw bytes of the response -func (e GenericOpenAPIError) Body() []byte { - return e.body -} - -// Model returns the unpacked model of the error -func (e GenericOpenAPIError) Model() interface{} { - return e.model -} - -// format error message using title and detail when model implements rfc7807 -func formatErrorMessage(status string, v interface{}) string { - str := "" - metaValue := reflect.ValueOf(v).Elem() - - if metaValue.Kind() == reflect.Struct { - field := metaValue.FieldByName("Title") - if field != (reflect.Value{}) { - str = fmt.Sprintf("%s", field.Interface()) - } - - field = metaValue.FieldByName("Detail") - if field != (reflect.Value{}) { - str = fmt.Sprintf("%s (%s)", str, field.Interface()) - } - } - - return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/configuration.go b/v1/providers/lambdalabs/gen/lambdalabs/configuration.go deleted file mode 100644 index 451ccbbf..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/configuration.go +++ /dev/null @@ -1,228 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "context" - "fmt" - "net/http" - "strings" -) - -// contextKeys are used to identify the type of value in the context. -// Since these are string, it is possible to get a short description of the -// context key for logging and debugging using key.String(). - -type contextKey string - -func (c contextKey) String() string { - return "auth " + string(c) -} - -var ( - // ContextBasicAuth takes BasicAuth as authentication for the request. - ContextBasicAuth = contextKey("basic") - - // ContextAccessToken takes a string oauth2 access token as authentication for the request. - ContextAccessToken = contextKey("accesstoken") - - // ContextServerIndex uses a server configuration from the index. - ContextServerIndex = contextKey("serverIndex") - - // ContextOperationServerIndices uses a server configuration from the index mapping. - ContextOperationServerIndices = contextKey("serverOperationIndices") - - // ContextServerVariables overrides a server configuration variables. - ContextServerVariables = contextKey("serverVariables") - - // ContextOperationServerVariables overrides a server configuration variables using operation specific values. - ContextOperationServerVariables = contextKey("serverOperationVariables") -) - -// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth -type BasicAuth struct { - UserName string `json:"userName,omitempty"` - Password string `json:"password,omitempty"` -} - -// APIKey provides API key based authentication to a request passed via context using ContextAPIKey -type APIKey struct { - Key string - Prefix string -} - -// ServerVariable stores the information about a server variable -type ServerVariable struct { - Description string - DefaultValue string - EnumValues []string -} - -// ServerConfiguration stores the information about a server -type ServerConfiguration struct { - URL string - Description string - Variables map[string]ServerVariable -} - -// ServerConfigurations stores multiple ServerConfiguration items -type ServerConfigurations []ServerConfiguration - -// Configuration stores the configuration of the API client -type Configuration struct { - Host string `json:"host,omitempty"` - Scheme string `json:"scheme,omitempty"` - DefaultHeader map[string]string `json:"defaultHeader,omitempty"` - UserAgent string `json:"userAgent,omitempty"` - Debug bool `json:"debug,omitempty"` - Servers ServerConfigurations - OperationServers map[string]ServerConfigurations - HTTPClient *http.Client -} - -// NewConfiguration returns a new Configuration object -func NewConfiguration() *Configuration { - cfg := &Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Servers: ServerConfigurations{ - { - URL: "https://cloud.lambda.ai/api/v1", - Description: "Production server", - }, - { - URL: "https://cloud.lambdalabs.com/api/v1", - Description: "Secondary production server (deprecated)", - }, - { - URL: "https://cloud.lambdalabs.com/api/v1", - Description: "No description provided", - }, - }, - OperationServers: map[string]ServerConfigurations{}, - } - return cfg -} - -// AddDefaultHeader adds a new HTTP header to the default header in the request -func (c *Configuration) AddDefaultHeader(key string, value string) { - c.DefaultHeader[key] = value -} - -// URL formats template on a index using given variables -func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { - if index < 0 || len(sc) <= index { - return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1) - } - server := sc[index] - url := server.URL - - // go through variables and replace placeholders - for name, variable := range server.Variables { - if value, ok := variables[name]; ok { - found := bool(len(variable.EnumValues) == 0) - for _, enumValue := range variable.EnumValues { - if value == enumValue { - found = true - } - } - if !found { - return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) - } - url = strings.Replace(url, "{"+name+"}", value, -1) - } else { - url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) - } - } - return url, nil -} - -// ServerURL returns URL based on server settings -func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { - return c.Servers.URL(index, variables) -} - -func getServerIndex(ctx context.Context) (int, error) { - si := ctx.Value(ContextServerIndex) - if si != nil { - if index, ok := si.(int); ok { - return index, nil - } - return 0, reportError("Invalid type %T should be int", si) - } - return 0, nil -} - -func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { - osi := ctx.Value(ContextOperationServerIndices) - if osi != nil { - if operationIndices, ok := osi.(map[string]int); !ok { - return 0, reportError("Invalid type %T should be map[string]int", osi) - } else { - index, ok := operationIndices[endpoint] - if ok { - return index, nil - } - } - } - return getServerIndex(ctx) -} - -func getServerVariables(ctx context.Context) (map[string]string, error) { - sv := ctx.Value(ContextServerVariables) - if sv != nil { - if variables, ok := sv.(map[string]string); ok { - return variables, nil - } - return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) - } - return nil, nil -} - -func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { - osv := ctx.Value(ContextOperationServerVariables) - if osv != nil { - if operationVariables, ok := osv.(map[string]map[string]string); !ok { - return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) - } else { - variables, ok := operationVariables[endpoint] - if ok { - return variables, nil - } - } - } - return getServerVariables(ctx) -} - -// ServerURLWithContext returns a new server URL given an endpoint -func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { - sc, ok := c.OperationServers[endpoint] - if !ok { - sc = c.Servers - } - - if ctx == nil { - return sc.URL(0, nil) - } - - index, err := getServerOperationIndex(ctx, endpoint) - if err != nil { - return "", err - } - - variables, err := getServerOperationVariables(ctx, endpoint) - if err != nil { - return "", err - } - - return sc.URL(index, variables) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/AddSSHKey200Response.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/AddSSHKey200Response.md deleted file mode 100644 index 427afd14..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/AddSSHKey200Response.md +++ /dev/null @@ -1,51 +0,0 @@ -# AddSSHKey200Response - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Data** | [**SshKey**](SshKey.md) | | - -## Methods - -### NewAddSSHKey200Response - -`func NewAddSSHKey200Response(data SshKey, ) *AddSSHKey200Response` - -NewAddSSHKey200Response instantiates a new AddSSHKey200Response object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewAddSSHKey200ResponseWithDefaults - -`func NewAddSSHKey200ResponseWithDefaults() *AddSSHKey200Response` - -NewAddSSHKey200ResponseWithDefaults instantiates a new AddSSHKey200Response object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetData - -`func (o *AddSSHKey200Response) GetData() SshKey` - -GetData returns the Data field if non-nil, zero value otherwise. - -### GetDataOk - -`func (o *AddSSHKey200Response) GetDataOk() (*SshKey, bool)` - -GetDataOk returns a tuple with the Data field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetData - -`func (o *AddSSHKey200Response) SetData(v SshKey)` - -SetData sets Data field to given value. - - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/AddSSHKeyRequest.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/AddSSHKeyRequest.md deleted file mode 100644 index 3f46e3ce..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/AddSSHKeyRequest.md +++ /dev/null @@ -1,77 +0,0 @@ -# AddSSHKeyRequest - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Name** | **string** | Name of the SSH key | -**PublicKey** | Pointer to **string** | Public key for the SSH key | [optional] - -## Methods - -### NewAddSSHKeyRequest - -`func NewAddSSHKeyRequest(name string, ) *AddSSHKeyRequest` - -NewAddSSHKeyRequest instantiates a new AddSSHKeyRequest object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewAddSSHKeyRequestWithDefaults - -`func NewAddSSHKeyRequestWithDefaults() *AddSSHKeyRequest` - -NewAddSSHKeyRequestWithDefaults instantiates a new AddSSHKeyRequest object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetName - -`func (o *AddSSHKeyRequest) GetName() string` - -GetName returns the Name field if non-nil, zero value otherwise. - -### GetNameOk - -`func (o *AddSSHKeyRequest) GetNameOk() (*string, bool)` - -GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetName - -`func (o *AddSSHKeyRequest) SetName(v string)` - -SetName sets Name field to given value. - - -### GetPublicKey - -`func (o *AddSSHKeyRequest) GetPublicKey() string` - -GetPublicKey returns the PublicKey field if non-nil, zero value otherwise. - -### GetPublicKeyOk - -`func (o *AddSSHKeyRequest) GetPublicKeyOk() (*string, bool)` - -GetPublicKeyOk returns a tuple with the PublicKey field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetPublicKey - -`func (o *AddSSHKeyRequest) SetPublicKey(v string)` - -SetPublicKey sets PublicKey field to given value. - -### HasPublicKey - -`func (o *AddSSHKeyRequest) HasPublicKey() bool` - -HasPublicKey returns a boolean if a field has been set. - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/DefaultAPI.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/DefaultAPI.md deleted file mode 100644 index 9a28dfd1..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/DefaultAPI.md +++ /dev/null @@ -1,664 +0,0 @@ -# \DefaultAPI - -All URIs are relative to *https://cloud.lambda.ai/api/v1* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**AddSSHKey**](DefaultAPI.md#AddSSHKey) | **Post** /ssh-keys | Add SSH key -[**DeleteSSHKey**](DefaultAPI.md#DeleteSSHKey) | **Delete** /ssh-keys/{id} | Delete SSH key -[**GetInstance**](DefaultAPI.md#GetInstance) | **Get** /instances/{id} | List details of a specific instance -[**InstanceTypes**](DefaultAPI.md#InstanceTypes) | **Get** /instance-types | Retrieve list of offered instance types -[**LaunchInstance**](DefaultAPI.md#LaunchInstance) | **Post** /instance-operations/launch | Launch instances -[**ListFileSystems**](DefaultAPI.md#ListFileSystems) | **Get** /file-systems | List file systems -[**ListInstances**](DefaultAPI.md#ListInstances) | **Get** /instances | List running instances -[**ListSSHKeys**](DefaultAPI.md#ListSSHKeys) | **Get** /ssh-keys | List SSH keys -[**RestartInstance**](DefaultAPI.md#RestartInstance) | **Post** /instance-operations/restart | Restart instances -[**TerminateInstance**](DefaultAPI.md#TerminateInstance) | **Post** /instance-operations/terminate | Terminate an instance - - - -## AddSSHKey - -> AddSSHKey200Response AddSSHKey(ctx).AddSSHKeyRequest(addSSHKeyRequest).Execute() - -Add SSH key - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "github.com/brevdev/cloud" -) - -func main() { - addSSHKeyRequest := *openapiclient.NewAddSSHKeyRequest("macbook-pro") // AddSSHKeyRequest | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.AddSSHKey(context.Background()).AddSSHKeyRequest(addSSHKeyRequest).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.AddSSHKey``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `AddSSHKey`: AddSSHKey200Response - fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.AddSSHKey`: %v\n", resp) -} -``` - -### Path Parameters - - - -### Other Parameters - -Other parameters are passed through a pointer to a apiAddSSHKeyRequest struct via the builder pattern - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **addSSHKeyRequest** | [**AddSSHKeyRequest**](AddSSHKeyRequest.md) | | - -### Return type - -[**AddSSHKey200Response**](AddSSHKey200Response.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - - -## DeleteSSHKey - -> DeleteSSHKey(ctx, id).Execute() - -Delete SSH key - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "github.com/brevdev/cloud" -) - -func main() { - id := "id_example" // string | The unique identifier (ID) of the SSH key - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.DefaultAPI.DeleteSSHKey(context.Background(), id).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.DeleteSSHKey``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } -} -``` - -### Path Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**id** | **string** | The unique identifier (ID) of the SSH key | - -### Other Parameters - -Other parameters are passed through a pointer to a apiDeleteSSHKeyRequest struct via the builder pattern - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - - -### Return type - - (empty response body) - -### Authorization - -[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - - -## GetInstance - -> GetInstance200Response GetInstance(ctx, id).Execute() - -List details of a specific instance - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "github.com/brevdev/cloud" -) - -func main() { - id := "id_example" // string | The unique identifier (ID) of the instance - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.GetInstance(context.Background(), id).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.GetInstance``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `GetInstance`: GetInstance200Response - fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.GetInstance`: %v\n", resp) -} -``` - -### Path Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**id** | **string** | The unique identifier (ID) of the instance | - -### Other Parameters - -Other parameters are passed through a pointer to a apiGetInstanceRequest struct via the builder pattern - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - - -### Return type - -[**GetInstance200Response**](GetInstance200Response.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - - -## InstanceTypes - -> InstanceTypes200Response InstanceTypes(ctx).Execute() - -Retrieve list of offered instance types - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "github.com/brevdev/cloud" -) - -func main() { - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.InstanceTypes(context.Background()).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.InstanceTypes``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `InstanceTypes`: InstanceTypes200Response - fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.InstanceTypes`: %v\n", resp) -} -``` - -### Path Parameters - -This endpoint does not need any parameter. - -### Other Parameters - -Other parameters are passed through a pointer to a apiInstanceTypesRequest struct via the builder pattern - - -### Return type - -[**InstanceTypes200Response**](InstanceTypes200Response.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - - -## LaunchInstance - -> LaunchInstance200Response LaunchInstance(ctx).LaunchInstanceRequest(launchInstanceRequest).Execute() - -Launch instances - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "github.com/brevdev/cloud" -) - -func main() { - launchInstanceRequest := *openapiclient.NewLaunchInstanceRequest("us-tx-1", "gpu_1x_a100", []string{"macbook-pro"}) // LaunchInstanceRequest | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.LaunchInstance(context.Background()).LaunchInstanceRequest(launchInstanceRequest).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.LaunchInstance``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `LaunchInstance`: LaunchInstance200Response - fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.LaunchInstance`: %v\n", resp) -} -``` - -### Path Parameters - - - -### Other Parameters - -Other parameters are passed through a pointer to a apiLaunchInstanceRequest struct via the builder pattern - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **launchInstanceRequest** | [**LaunchInstanceRequest**](LaunchInstanceRequest.md) | | - -### Return type - -[**LaunchInstance200Response**](LaunchInstance200Response.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - - -## ListFileSystems - -> ListFileSystems200Response ListFileSystems(ctx).Execute() - -List file systems - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "github.com/brevdev/cloud" -) - -func main() { - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.ListFileSystems(context.Background()).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ListFileSystems``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ListFileSystems`: ListFileSystems200Response - fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ListFileSystems`: %v\n", resp) -} -``` - -### Path Parameters - -This endpoint does not need any parameter. - -### Other Parameters - -Other parameters are passed through a pointer to a apiListFileSystemsRequest struct via the builder pattern - - -### Return type - -[**ListFileSystems200Response**](ListFileSystems200Response.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - - -## ListInstances - -> ListInstances200Response ListInstances(ctx).Execute() - -List running instances - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "github.com/brevdev/cloud" -) - -func main() { - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.ListInstances(context.Background()).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ListInstances``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ListInstances`: ListInstances200Response - fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ListInstances`: %v\n", resp) -} -``` - -### Path Parameters - -This endpoint does not need any parameter. - -### Other Parameters - -Other parameters are passed through a pointer to a apiListInstancesRequest struct via the builder pattern - - -### Return type - -[**ListInstances200Response**](ListInstances200Response.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - - -## ListSSHKeys - -> ListSSHKeys200Response ListSSHKeys(ctx).Execute() - -List SSH keys - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "github.com/brevdev/cloud" -) - -func main() { - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.ListSSHKeys(context.Background()).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.ListSSHKeys``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ListSSHKeys`: ListSSHKeys200Response - fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.ListSSHKeys`: %v\n", resp) -} -``` - -### Path Parameters - -This endpoint does not need any parameter. - -### Other Parameters - -Other parameters are passed through a pointer to a apiListSSHKeysRequest struct via the builder pattern - - -### Return type - -[**ListSSHKeys200Response**](ListSSHKeys200Response.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - - -## RestartInstance - -> RestartInstance200Response RestartInstance(ctx).RestartInstanceRequest(restartInstanceRequest).Execute() - -Restart instances - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "github.com/brevdev/cloud" -) - -func main() { - restartInstanceRequest := *openapiclient.NewRestartInstanceRequest([]string{"0920582c7ff041399e34823a0be62549"}) // RestartInstanceRequest | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.RestartInstance(context.Background()).RestartInstanceRequest(restartInstanceRequest).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.RestartInstance``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `RestartInstance`: RestartInstance200Response - fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.RestartInstance`: %v\n", resp) -} -``` - -### Path Parameters - - - -### Other Parameters - -Other parameters are passed through a pointer to a apiRestartInstanceRequest struct via the builder pattern - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **restartInstanceRequest** | [**RestartInstanceRequest**](RestartInstanceRequest.md) | | - -### Return type - -[**RestartInstance200Response**](RestartInstance200Response.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - - -## TerminateInstance - -> TerminateInstance200Response TerminateInstance(ctx).TerminateInstanceRequest(terminateInstanceRequest).Execute() - -Terminate an instance - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "github.com/brevdev/cloud" -) - -func main() { - terminateInstanceRequest := *openapiclient.NewTerminateInstanceRequest([]string{"0920582c7ff041399e34823a0be62549"}) // TerminateInstanceRequest | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.TerminateInstance(context.Background()).TerminateInstanceRequest(terminateInstanceRequest).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.TerminateInstance``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `TerminateInstance`: TerminateInstance200Response - fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.TerminateInstance`: %v\n", resp) -} -``` - -### Path Parameters - - - -### Other Parameters - -Other parameters are passed through a pointer to a apiTerminateInstanceRequest struct via the builder pattern - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **terminateInstanceRequest** | [**TerminateInstanceRequest**](TerminateInstanceRequest.md) | | - -### Return type - -[**TerminateInstance200Response**](TerminateInstance200Response.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/ErrorCode.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/ErrorCode.md deleted file mode 100644 index b2eeed1a..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/ErrorCode.md +++ /dev/null @@ -1,29 +0,0 @@ -# ErrorCode - -## Enum - - -* `GLOBAL_UNKNOWN` (value: `"global/unknown"`) - -* `GLOBAL_INVALID_API_KEY` (value: `"global/invalid-api-key"`) - -* `GLOBAL_ACCOUNT_INACTIVE` (value: `"global/account-inactive"`) - -* `GLOBAL_INVALID_ADDRESS` (value: `"global/invalid-address"`) - -* `GLOBAL_INVALID_PARAMETERS` (value: `"global/invalid-parameters"`) - -* `GLOBAL_OBJECT_DOES_NOT_EXIST` (value: `"global/object-does-not-exist"`) - -* `GLOBAL_QUOTA_EXCEEDED` (value: `"global/quota-exceeded"`) - -* `INSTANCE_OPERATIONS_LAUNCH_INSUFFICIENT_CAPACITY` (value: `"instance-operations/launch/insufficient-capacity"`) - -* `INSTANCE_OPERATIONS_LAUNCH_FILE_SYSTEM_IN_WRONG_REGION` (value: `"instance-operations/launch/file-system-in-wrong-region"`) - -* `SSH_KEYS_KEY_IN_USE` (value: `"ssh-keys/key-in-use"`) - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/ErrorResponseBody.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/ErrorResponseBody.md deleted file mode 100644 index ad02a581..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/ErrorResponseBody.md +++ /dev/null @@ -1,77 +0,0 @@ -# ErrorResponseBody - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Error** | [**ModelError**](ModelError.md) | | -**FieldErrors** | Pointer to [**map[string]ModelError**](ModelError.md) | Details about errors on a per-parameter basis | [optional] - -## Methods - -### NewErrorResponseBody - -`func NewErrorResponseBody(error_ ModelError, ) *ErrorResponseBody` - -NewErrorResponseBody instantiates a new ErrorResponseBody object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewErrorResponseBodyWithDefaults - -`func NewErrorResponseBodyWithDefaults() *ErrorResponseBody` - -NewErrorResponseBodyWithDefaults instantiates a new ErrorResponseBody object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetError - -`func (o *ErrorResponseBody) GetError() ModelError` - -GetError returns the Error field if non-nil, zero value otherwise. - -### GetErrorOk - -`func (o *ErrorResponseBody) GetErrorOk() (*ModelError, bool)` - -GetErrorOk returns a tuple with the Error field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetError - -`func (o *ErrorResponseBody) SetError(v ModelError)` - -SetError sets Error field to given value. - - -### GetFieldErrors - -`func (o *ErrorResponseBody) GetFieldErrors() map[string]ModelError` - -GetFieldErrors returns the FieldErrors field if non-nil, zero value otherwise. - -### GetFieldErrorsOk - -`func (o *ErrorResponseBody) GetFieldErrorsOk() (*map[string]ModelError, bool)` - -GetFieldErrorsOk returns a tuple with the FieldErrors field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetFieldErrors - -`func (o *ErrorResponseBody) SetFieldErrors(v map[string]ModelError)` - -SetFieldErrors sets FieldErrors field to given value. - -### HasFieldErrors - -`func (o *ErrorResponseBody) HasFieldErrors() bool` - -HasFieldErrors returns a boolean if a field has been set. - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/FileSystem.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/FileSystem.md deleted file mode 100644 index 44cb8276..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/FileSystem.md +++ /dev/null @@ -1,203 +0,0 @@ -# FileSystem - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Id** | **string** | Unique identifier (ID) of a file system | -**Name** | **string** | Name of a file system | -**Created** | **string** | A date and time, formatted as an ISO 8601 time stamp | -**CreatedBy** | [**User**](User.md) | | -**MountPoint** | **string** | Absolute path indicating where on instances the file system will be mounted | -**Region** | [**Region**](Region.md) | | -**IsInUse** | **bool** | Whether the file system is currently in use by an instance. File systems that are in use cannot be deleted. | -**BytesUsed** | Pointer to **int32** | Approximate amount of storage used by the file system, in bytes. This value is an estimate that is updated every several hours. | [optional] - -## Methods - -### NewFileSystem - -`func NewFileSystem(id string, name string, created string, createdBy User, mountPoint string, region Region, isInUse bool, ) *FileSystem` - -NewFileSystem instantiates a new FileSystem object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewFileSystemWithDefaults - -`func NewFileSystemWithDefaults() *FileSystem` - -NewFileSystemWithDefaults instantiates a new FileSystem object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetId - -`func (o *FileSystem) GetId() string` - -GetId returns the Id field if non-nil, zero value otherwise. - -### GetIdOk - -`func (o *FileSystem) GetIdOk() (*string, bool)` - -GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetId - -`func (o *FileSystem) SetId(v string)` - -SetId sets Id field to given value. - - -### GetName - -`func (o *FileSystem) GetName() string` - -GetName returns the Name field if non-nil, zero value otherwise. - -### GetNameOk - -`func (o *FileSystem) GetNameOk() (*string, bool)` - -GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetName - -`func (o *FileSystem) SetName(v string)` - -SetName sets Name field to given value. - - -### GetCreated - -`func (o *FileSystem) GetCreated() string` - -GetCreated returns the Created field if non-nil, zero value otherwise. - -### GetCreatedOk - -`func (o *FileSystem) GetCreatedOk() (*string, bool)` - -GetCreatedOk returns a tuple with the Created field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetCreated - -`func (o *FileSystem) SetCreated(v string)` - -SetCreated sets Created field to given value. - - -### GetCreatedBy - -`func (o *FileSystem) GetCreatedBy() User` - -GetCreatedBy returns the CreatedBy field if non-nil, zero value otherwise. - -### GetCreatedByOk - -`func (o *FileSystem) GetCreatedByOk() (*User, bool)` - -GetCreatedByOk returns a tuple with the CreatedBy field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetCreatedBy - -`func (o *FileSystem) SetCreatedBy(v User)` - -SetCreatedBy sets CreatedBy field to given value. - - -### GetMountPoint - -`func (o *FileSystem) GetMountPoint() string` - -GetMountPoint returns the MountPoint field if non-nil, zero value otherwise. - -### GetMountPointOk - -`func (o *FileSystem) GetMountPointOk() (*string, bool)` - -GetMountPointOk returns a tuple with the MountPoint field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetMountPoint - -`func (o *FileSystem) SetMountPoint(v string)` - -SetMountPoint sets MountPoint field to given value. - - -### GetRegion - -`func (o *FileSystem) GetRegion() Region` - -GetRegion returns the Region field if non-nil, zero value otherwise. - -### GetRegionOk - -`func (o *FileSystem) GetRegionOk() (*Region, bool)` - -GetRegionOk returns a tuple with the Region field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetRegion - -`func (o *FileSystem) SetRegion(v Region)` - -SetRegion sets Region field to given value. - - -### GetIsInUse - -`func (o *FileSystem) GetIsInUse() bool` - -GetIsInUse returns the IsInUse field if non-nil, zero value otherwise. - -### GetIsInUseOk - -`func (o *FileSystem) GetIsInUseOk() (*bool, bool)` - -GetIsInUseOk returns a tuple with the IsInUse field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetIsInUse - -`func (o *FileSystem) SetIsInUse(v bool)` - -SetIsInUse sets IsInUse field to given value. - - -### GetBytesUsed - -`func (o *FileSystem) GetBytesUsed() int32` - -GetBytesUsed returns the BytesUsed field if non-nil, zero value otherwise. - -### GetBytesUsedOk - -`func (o *FileSystem) GetBytesUsedOk() (*int32, bool)` - -GetBytesUsedOk returns a tuple with the BytesUsed field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetBytesUsed - -`func (o *FileSystem) SetBytesUsed(v int32)` - -SetBytesUsed sets BytesUsed field to given value. - -### HasBytesUsed - -`func (o *FileSystem) HasBytesUsed() bool` - -HasBytesUsed returns a boolean if a field has been set. - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/GetInstance200Response.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/GetInstance200Response.md deleted file mode 100644 index c5a76338..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/GetInstance200Response.md +++ /dev/null @@ -1,51 +0,0 @@ -# GetInstance200Response - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Data** | [**Instance**](Instance.md) | | - -## Methods - -### NewGetInstance200Response - -`func NewGetInstance200Response(data Instance, ) *GetInstance200Response` - -NewGetInstance200Response instantiates a new GetInstance200Response object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewGetInstance200ResponseWithDefaults - -`func NewGetInstance200ResponseWithDefaults() *GetInstance200Response` - -NewGetInstance200ResponseWithDefaults instantiates a new GetInstance200Response object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetData - -`func (o *GetInstance200Response) GetData() Instance` - -GetData returns the Data field if non-nil, zero value otherwise. - -### GetDataOk - -`func (o *GetInstance200Response) GetDataOk() (*Instance, bool)` - -GetDataOk returns a tuple with the Data field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetData - -`func (o *GetInstance200Response) SetData(v Instance)` - -SetData sets Data field to given value. - - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/Instance.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/Instance.md deleted file mode 100644 index 1c1e143b..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/Instance.md +++ /dev/null @@ -1,408 +0,0 @@ -# Instance - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Id** | **string** | Unique identifier (ID) of an instance | -**Name** | Pointer to **NullableString** | User-provided name for the instance | [optional] -**Ip** | Pointer to **NullableString** | IPv4 address of the instance | [optional] -**PrivateIp** | Pointer to **NullableString** | Private IPv4 address of the instance | [optional] -**Status** | **string** | The current status of the instance | -**SshKeyNames** | **[]string** | Names of the SSH keys allowed to access the instance | -**FileSystemNames** | **[]string** | Names of the file systems, if any, attached to the instance | -**Region** | Pointer to [**Region**](Region.md) | | [optional] -**InstanceType** | Pointer to [**InstanceType**](InstanceType.md) | | [optional] -**Hostname** | Pointer to **NullableString** | Hostname assigned to this instance, which resolves to the instance's IP. | [optional] -**JupyterToken** | Pointer to **NullableString** | Secret token used to log into the jupyter lab server hosted on the instance. | [optional] -**JupyterUrl** | Pointer to **NullableString** | URL that opens a jupyter lab notebook on the instance. | [optional] -**IsReserved** | Pointer to **bool** | Whether the instance is reserved. | [optional] - -## Methods - -### NewInstance - -`func NewInstance(id string, status string, sshKeyNames []string, fileSystemNames []string, ) *Instance` - -NewInstance instantiates a new Instance object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewInstanceWithDefaults - -`func NewInstanceWithDefaults() *Instance` - -NewInstanceWithDefaults instantiates a new Instance object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetId - -`func (o *Instance) GetId() string` - -GetId returns the Id field if non-nil, zero value otherwise. - -### GetIdOk - -`func (o *Instance) GetIdOk() (*string, bool)` - -GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetId - -`func (o *Instance) SetId(v string)` - -SetId sets Id field to given value. - - -### GetName - -`func (o *Instance) GetName() string` - -GetName returns the Name field if non-nil, zero value otherwise. - -### GetNameOk - -`func (o *Instance) GetNameOk() (*string, bool)` - -GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetName - -`func (o *Instance) SetName(v string)` - -SetName sets Name field to given value. - -### HasName - -`func (o *Instance) HasName() bool` - -HasName returns a boolean if a field has been set. - -### SetNameNil - -`func (o *Instance) SetNameNil(b bool)` - - SetNameNil sets the value for Name to be an explicit nil - -### UnsetName -`func (o *Instance) UnsetName()` - -UnsetName ensures that no value is present for Name, not even an explicit nil -### GetIp - -`func (o *Instance) GetIp() string` - -GetIp returns the Ip field if non-nil, zero value otherwise. - -### GetIpOk - -`func (o *Instance) GetIpOk() (*string, bool)` - -GetIpOk returns a tuple with the Ip field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetIp - -`func (o *Instance) SetIp(v string)` - -SetIp sets Ip field to given value. - -### HasIp - -`func (o *Instance) HasIp() bool` - -HasIp returns a boolean if a field has been set. - -### SetIpNil - -`func (o *Instance) SetIpNil(b bool)` - - SetIpNil sets the value for Ip to be an explicit nil - -### UnsetIp -`func (o *Instance) UnsetIp()` - -UnsetIp ensures that no value is present for Ip, not even an explicit nil -### GetPrivateIp - -`func (o *Instance) GetPrivateIp() string` - -GetPrivateIp returns the PrivateIp field if non-nil, zero value otherwise. - -### GetPrivateIpOk - -`func (o *Instance) GetPrivateIpOk() (*string, bool)` - -GetPrivateIpOk returns a tuple with the PrivateIp field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetPrivateIp - -`func (o *Instance) SetPrivateIp(v string)` - -SetPrivateIp sets PrivateIp field to given value. - -### HasPrivateIp - -`func (o *Instance) HasPrivateIp() bool` - -HasPrivateIp returns a boolean if a field has been set. - -### SetPrivateIpNil - -`func (o *Instance) SetPrivateIpNil(b bool)` - - SetPrivateIpNil sets the value for PrivateIp to be an explicit nil - -### UnsetPrivateIp -`func (o *Instance) UnsetPrivateIp()` - -UnsetPrivateIp ensures that no value is present for PrivateIp, not even an explicit nil -### GetStatus - -`func (o *Instance) GetStatus() string` - -GetStatus returns the Status field if non-nil, zero value otherwise. - -### GetStatusOk - -`func (o *Instance) GetStatusOk() (*string, bool)` - -GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetStatus - -`func (o *Instance) SetStatus(v string)` - -SetStatus sets Status field to given value. - - -### GetSshKeyNames - -`func (o *Instance) GetSshKeyNames() []string` - -GetSshKeyNames returns the SshKeyNames field if non-nil, zero value otherwise. - -### GetSshKeyNamesOk - -`func (o *Instance) GetSshKeyNamesOk() (*[]string, bool)` - -GetSshKeyNamesOk returns a tuple with the SshKeyNames field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetSshKeyNames - -`func (o *Instance) SetSshKeyNames(v []string)` - -SetSshKeyNames sets SshKeyNames field to given value. - - -### GetFileSystemNames - -`func (o *Instance) GetFileSystemNames() []string` - -GetFileSystemNames returns the FileSystemNames field if non-nil, zero value otherwise. - -### GetFileSystemNamesOk - -`func (o *Instance) GetFileSystemNamesOk() (*[]string, bool)` - -GetFileSystemNamesOk returns a tuple with the FileSystemNames field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetFileSystemNames - -`func (o *Instance) SetFileSystemNames(v []string)` - -SetFileSystemNames sets FileSystemNames field to given value. - - -### GetRegion - -`func (o *Instance) GetRegion() Region` - -GetRegion returns the Region field if non-nil, zero value otherwise. - -### GetRegionOk - -`func (o *Instance) GetRegionOk() (*Region, bool)` - -GetRegionOk returns a tuple with the Region field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetRegion - -`func (o *Instance) SetRegion(v Region)` - -SetRegion sets Region field to given value. - -### HasRegion - -`func (o *Instance) HasRegion() bool` - -HasRegion returns a boolean if a field has been set. - -### GetInstanceType - -`func (o *Instance) GetInstanceType() InstanceType` - -GetInstanceType returns the InstanceType field if non-nil, zero value otherwise. - -### GetInstanceTypeOk - -`func (o *Instance) GetInstanceTypeOk() (*InstanceType, bool)` - -GetInstanceTypeOk returns a tuple with the InstanceType field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetInstanceType - -`func (o *Instance) SetInstanceType(v InstanceType)` - -SetInstanceType sets InstanceType field to given value. - -### HasInstanceType - -`func (o *Instance) HasInstanceType() bool` - -HasInstanceType returns a boolean if a field has been set. - -### GetHostname - -`func (o *Instance) GetHostname() string` - -GetHostname returns the Hostname field if non-nil, zero value otherwise. - -### GetHostnameOk - -`func (o *Instance) GetHostnameOk() (*string, bool)` - -GetHostnameOk returns a tuple with the Hostname field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetHostname - -`func (o *Instance) SetHostname(v string)` - -SetHostname sets Hostname field to given value. - -### HasHostname - -`func (o *Instance) HasHostname() bool` - -HasHostname returns a boolean if a field has been set. - -### SetHostnameNil - -`func (o *Instance) SetHostnameNil(b bool)` - - SetHostnameNil sets the value for Hostname to be an explicit nil - -### UnsetHostname -`func (o *Instance) UnsetHostname()` - -UnsetHostname ensures that no value is present for Hostname, not even an explicit nil -### GetJupyterToken - -`func (o *Instance) GetJupyterToken() string` - -GetJupyterToken returns the JupyterToken field if non-nil, zero value otherwise. - -### GetJupyterTokenOk - -`func (o *Instance) GetJupyterTokenOk() (*string, bool)` - -GetJupyterTokenOk returns a tuple with the JupyterToken field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetJupyterToken - -`func (o *Instance) SetJupyterToken(v string)` - -SetJupyterToken sets JupyterToken field to given value. - -### HasJupyterToken - -`func (o *Instance) HasJupyterToken() bool` - -HasJupyterToken returns a boolean if a field has been set. - -### SetJupyterTokenNil - -`func (o *Instance) SetJupyterTokenNil(b bool)` - - SetJupyterTokenNil sets the value for JupyterToken to be an explicit nil - -### UnsetJupyterToken -`func (o *Instance) UnsetJupyterToken()` - -UnsetJupyterToken ensures that no value is present for JupyterToken, not even an explicit nil -### GetJupyterUrl - -`func (o *Instance) GetJupyterUrl() string` - -GetJupyterUrl returns the JupyterUrl field if non-nil, zero value otherwise. - -### GetJupyterUrlOk - -`func (o *Instance) GetJupyterUrlOk() (*string, bool)` - -GetJupyterUrlOk returns a tuple with the JupyterUrl field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetJupyterUrl - -`func (o *Instance) SetJupyterUrl(v string)` - -SetJupyterUrl sets JupyterUrl field to given value. - -### HasJupyterUrl - -`func (o *Instance) HasJupyterUrl() bool` - -HasJupyterUrl returns a boolean if a field has been set. - -### SetJupyterUrlNil - -`func (o *Instance) SetJupyterUrlNil(b bool)` - - SetJupyterUrlNil sets the value for JupyterUrl to be an explicit nil - -### UnsetJupyterUrl -`func (o *Instance) UnsetJupyterUrl()` - -UnsetJupyterUrl ensures that no value is present for JupyterUrl, not even an explicit nil -### GetIsReserved - -`func (o *Instance) GetIsReserved() bool` - -GetIsReserved returns the IsReserved field if non-nil, zero value otherwise. - -### GetIsReservedOk - -`func (o *Instance) GetIsReservedOk() (*bool, bool)` - -GetIsReservedOk returns a tuple with the IsReserved field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetIsReserved - -`func (o *Instance) SetIsReserved(v bool)` - -SetIsReserved sets IsReserved field to given value. - -### HasIsReserved - -`func (o *Instance) HasIsReserved() bool` - -HasIsReserved returns a boolean if a field has been set. - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/InstanceType.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/InstanceType.md deleted file mode 100644 index cba64fa4..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/InstanceType.md +++ /dev/null @@ -1,135 +0,0 @@ -# InstanceType - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Name** | **string** | Name of an instance type | -**Description** | **string** | Long name of the instance type | -**GpuDescription** | **string** | Description of the GPU(s) in the instance type | -**PriceCentsPerHour** | **int32** | Price of the instance type, in US cents per hour | -**Specs** | [**InstanceTypeSpecs**](InstanceTypeSpecs.md) | | - -## Methods - -### NewInstanceType - -`func NewInstanceType(name string, description string, gpuDescription string, priceCentsPerHour int32, specs InstanceTypeSpecs, ) *InstanceType` - -NewInstanceType instantiates a new InstanceType object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewInstanceTypeWithDefaults - -`func NewInstanceTypeWithDefaults() *InstanceType` - -NewInstanceTypeWithDefaults instantiates a new InstanceType object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetName - -`func (o *InstanceType) GetName() string` - -GetName returns the Name field if non-nil, zero value otherwise. - -### GetNameOk - -`func (o *InstanceType) GetNameOk() (*string, bool)` - -GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetName - -`func (o *InstanceType) SetName(v string)` - -SetName sets Name field to given value. - - -### GetDescription - -`func (o *InstanceType) GetDescription() string` - -GetDescription returns the Description field if non-nil, zero value otherwise. - -### GetDescriptionOk - -`func (o *InstanceType) GetDescriptionOk() (*string, bool)` - -GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetDescription - -`func (o *InstanceType) SetDescription(v string)` - -SetDescription sets Description field to given value. - - -### GetGpuDescription - -`func (o *InstanceType) GetGpuDescription() string` - -GetGpuDescription returns the GpuDescription field if non-nil, zero value otherwise. - -### GetGpuDescriptionOk - -`func (o *InstanceType) GetGpuDescriptionOk() (*string, bool)` - -GetGpuDescriptionOk returns a tuple with the GpuDescription field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetGpuDescription - -`func (o *InstanceType) SetGpuDescription(v string)` - -SetGpuDescription sets GpuDescription field to given value. - - -### GetPriceCentsPerHour - -`func (o *InstanceType) GetPriceCentsPerHour() int32` - -GetPriceCentsPerHour returns the PriceCentsPerHour field if non-nil, zero value otherwise. - -### GetPriceCentsPerHourOk - -`func (o *InstanceType) GetPriceCentsPerHourOk() (*int32, bool)` - -GetPriceCentsPerHourOk returns a tuple with the PriceCentsPerHour field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetPriceCentsPerHour - -`func (o *InstanceType) SetPriceCentsPerHour(v int32)` - -SetPriceCentsPerHour sets PriceCentsPerHour field to given value. - - -### GetSpecs - -`func (o *InstanceType) GetSpecs() InstanceTypeSpecs` - -GetSpecs returns the Specs field if non-nil, zero value otherwise. - -### GetSpecsOk - -`func (o *InstanceType) GetSpecsOk() (*InstanceTypeSpecs, bool)` - -GetSpecsOk returns a tuple with the Specs field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetSpecs - -`func (o *InstanceType) SetSpecs(v InstanceTypeSpecs)` - -SetSpecs sets Specs field to given value. - - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/InstanceTypeSpecs.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/InstanceTypeSpecs.md deleted file mode 100644 index 59cb4428..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/InstanceTypeSpecs.md +++ /dev/null @@ -1,114 +0,0 @@ -# InstanceTypeSpecs - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Vcpus** | **int32** | Number of virtual CPUs | -**MemoryGib** | **int32** | Amount of RAM, in gibibytes (GiB) | -**StorageGib** | **int32** | Amount of storage, in gibibytes (GiB). | -**Gpus** | **int32** | Number of GPUs | - -## Methods - -### NewInstanceTypeSpecs - -`func NewInstanceTypeSpecs(vcpus int32, memoryGib int32, storageGib int32, gpus int32, ) *InstanceTypeSpecs` - -NewInstanceTypeSpecs instantiates a new InstanceTypeSpecs object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewInstanceTypeSpecsWithDefaults - -`func NewInstanceTypeSpecsWithDefaults() *InstanceTypeSpecs` - -NewInstanceTypeSpecsWithDefaults instantiates a new InstanceTypeSpecs object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetVcpus - -`func (o *InstanceTypeSpecs) GetVcpus() int32` - -GetVcpus returns the Vcpus field if non-nil, zero value otherwise. - -### GetVcpusOk - -`func (o *InstanceTypeSpecs) GetVcpusOk() (*int32, bool)` - -GetVcpusOk returns a tuple with the Vcpus field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetVcpus - -`func (o *InstanceTypeSpecs) SetVcpus(v int32)` - -SetVcpus sets Vcpus field to given value. - - -### GetMemoryGib - -`func (o *InstanceTypeSpecs) GetMemoryGib() int32` - -GetMemoryGib returns the MemoryGib field if non-nil, zero value otherwise. - -### GetMemoryGibOk - -`func (o *InstanceTypeSpecs) GetMemoryGibOk() (*int32, bool)` - -GetMemoryGibOk returns a tuple with the MemoryGib field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetMemoryGib - -`func (o *InstanceTypeSpecs) SetMemoryGib(v int32)` - -SetMemoryGib sets MemoryGib field to given value. - - -### GetStorageGib - -`func (o *InstanceTypeSpecs) GetStorageGib() int32` - -GetStorageGib returns the StorageGib field if non-nil, zero value otherwise. - -### GetStorageGibOk - -`func (o *InstanceTypeSpecs) GetStorageGibOk() (*int32, bool)` - -GetStorageGibOk returns a tuple with the StorageGib field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetStorageGib - -`func (o *InstanceTypeSpecs) SetStorageGib(v int32)` - -SetStorageGib sets StorageGib field to given value. - - -### GetGpus - -`func (o *InstanceTypeSpecs) GetGpus() int32` - -GetGpus returns the Gpus field if non-nil, zero value otherwise. - -### GetGpusOk - -`func (o *InstanceTypeSpecs) GetGpusOk() (*int32, bool)` - -GetGpusOk returns a tuple with the Gpus field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetGpus - -`func (o *InstanceTypeSpecs) SetGpus(v int32)` - -SetGpus sets Gpus field to given value. - - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/InstanceTypes200Response.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/InstanceTypes200Response.md deleted file mode 100644 index b69134d2..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/InstanceTypes200Response.md +++ /dev/null @@ -1,51 +0,0 @@ -# InstanceTypes200Response - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Data** | [**map[string]InstanceTypes200ResponseDataValue**](InstanceTypes200ResponseDataValue.md) | Dict of instance_type_name to instance_type and region availability. | - -## Methods - -### NewInstanceTypes200Response - -`func NewInstanceTypes200Response(data map[string]InstanceTypes200ResponseDataValue, ) *InstanceTypes200Response` - -NewInstanceTypes200Response instantiates a new InstanceTypes200Response object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewInstanceTypes200ResponseWithDefaults - -`func NewInstanceTypes200ResponseWithDefaults() *InstanceTypes200Response` - -NewInstanceTypes200ResponseWithDefaults instantiates a new InstanceTypes200Response object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetData - -`func (o *InstanceTypes200Response) GetData() map[string]InstanceTypes200ResponseDataValue` - -GetData returns the Data field if non-nil, zero value otherwise. - -### GetDataOk - -`func (o *InstanceTypes200Response) GetDataOk() (*map[string]InstanceTypes200ResponseDataValue, bool)` - -GetDataOk returns a tuple with the Data field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetData - -`func (o *InstanceTypes200Response) SetData(v map[string]InstanceTypes200ResponseDataValue)` - -SetData sets Data field to given value. - - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/InstanceTypes200ResponseDataValue.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/InstanceTypes200ResponseDataValue.md deleted file mode 100644 index 14292d8c..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/InstanceTypes200ResponseDataValue.md +++ /dev/null @@ -1,72 +0,0 @@ -# InstanceTypes200ResponseDataValue - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**InstanceType** | [**InstanceType**](InstanceType.md) | | -**RegionsWithCapacityAvailable** | [**[]Region**](Region.md) | List of regions, if any, that have this instance type available | - -## Methods - -### NewInstanceTypes200ResponseDataValue - -`func NewInstanceTypes200ResponseDataValue(instanceType InstanceType, regionsWithCapacityAvailable []Region, ) *InstanceTypes200ResponseDataValue` - -NewInstanceTypes200ResponseDataValue instantiates a new InstanceTypes200ResponseDataValue object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewInstanceTypes200ResponseDataValueWithDefaults - -`func NewInstanceTypes200ResponseDataValueWithDefaults() *InstanceTypes200ResponseDataValue` - -NewInstanceTypes200ResponseDataValueWithDefaults instantiates a new InstanceTypes200ResponseDataValue object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetInstanceType - -`func (o *InstanceTypes200ResponseDataValue) GetInstanceType() InstanceType` - -GetInstanceType returns the InstanceType field if non-nil, zero value otherwise. - -### GetInstanceTypeOk - -`func (o *InstanceTypes200ResponseDataValue) GetInstanceTypeOk() (*InstanceType, bool)` - -GetInstanceTypeOk returns a tuple with the InstanceType field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetInstanceType - -`func (o *InstanceTypes200ResponseDataValue) SetInstanceType(v InstanceType)` - -SetInstanceType sets InstanceType field to given value. - - -### GetRegionsWithCapacityAvailable - -`func (o *InstanceTypes200ResponseDataValue) GetRegionsWithCapacityAvailable() []Region` - -GetRegionsWithCapacityAvailable returns the RegionsWithCapacityAvailable field if non-nil, zero value otherwise. - -### GetRegionsWithCapacityAvailableOk - -`func (o *InstanceTypes200ResponseDataValue) GetRegionsWithCapacityAvailableOk() (*[]Region, bool)` - -GetRegionsWithCapacityAvailableOk returns a tuple with the RegionsWithCapacityAvailable field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetRegionsWithCapacityAvailable - -`func (o *InstanceTypes200ResponseDataValue) SetRegionsWithCapacityAvailable(v []Region)` - -SetRegionsWithCapacityAvailable sets RegionsWithCapacityAvailable field to given value. - - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/LaunchInstance200Response.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/LaunchInstance200Response.md deleted file mode 100644 index 27805bbf..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/LaunchInstance200Response.md +++ /dev/null @@ -1,51 +0,0 @@ -# LaunchInstance200Response - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Data** | [**LaunchInstance200ResponseData**](LaunchInstance200ResponseData.md) | | - -## Methods - -### NewLaunchInstance200Response - -`func NewLaunchInstance200Response(data LaunchInstance200ResponseData, ) *LaunchInstance200Response` - -NewLaunchInstance200Response instantiates a new LaunchInstance200Response object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewLaunchInstance200ResponseWithDefaults - -`func NewLaunchInstance200ResponseWithDefaults() *LaunchInstance200Response` - -NewLaunchInstance200ResponseWithDefaults instantiates a new LaunchInstance200Response object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetData - -`func (o *LaunchInstance200Response) GetData() LaunchInstance200ResponseData` - -GetData returns the Data field if non-nil, zero value otherwise. - -### GetDataOk - -`func (o *LaunchInstance200Response) GetDataOk() (*LaunchInstance200ResponseData, bool)` - -GetDataOk returns a tuple with the Data field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetData - -`func (o *LaunchInstance200Response) SetData(v LaunchInstance200ResponseData)` - -SetData sets Data field to given value. - - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/LaunchInstance200ResponseData.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/LaunchInstance200ResponseData.md deleted file mode 100644 index 56fa6768..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/LaunchInstance200ResponseData.md +++ /dev/null @@ -1,51 +0,0 @@ -# LaunchInstance200ResponseData - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**InstanceIds** | **[]string** | The unique identifiers (IDs) of the launched instances. Note: if a quantity was specified, fewer than the requested quantity might have been launched. | - -## Methods - -### NewLaunchInstance200ResponseData - -`func NewLaunchInstance200ResponseData(instanceIds []string, ) *LaunchInstance200ResponseData` - -NewLaunchInstance200ResponseData instantiates a new LaunchInstance200ResponseData object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewLaunchInstance200ResponseDataWithDefaults - -`func NewLaunchInstance200ResponseDataWithDefaults() *LaunchInstance200ResponseData` - -NewLaunchInstance200ResponseDataWithDefaults instantiates a new LaunchInstance200ResponseData object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetInstanceIds - -`func (o *LaunchInstance200ResponseData) GetInstanceIds() []string` - -GetInstanceIds returns the InstanceIds field if non-nil, zero value otherwise. - -### GetInstanceIdsOk - -`func (o *LaunchInstance200ResponseData) GetInstanceIdsOk() (*[]string, bool)` - -GetInstanceIdsOk returns a tuple with the InstanceIds field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetInstanceIds - -`func (o *LaunchInstance200ResponseData) SetInstanceIds(v []string)` - -SetInstanceIds sets InstanceIds field to given value. - - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/LaunchInstanceRequest.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/LaunchInstanceRequest.md deleted file mode 100644 index 329ed876..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/LaunchInstanceRequest.md +++ /dev/null @@ -1,181 +0,0 @@ -# LaunchInstanceRequest - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**RegionName** | **string** | Short name of a region | -**InstanceTypeName** | **string** | Name of an instance type | -**SshKeyNames** | **[]string** | Names of the SSH keys to allow access to the instances. Currently, exactly one SSH key must be specified. | -**FileSystemNames** | Pointer to **[]string** | Names of the file systems to attach to the instances. Currently, only one (if any) file system may be specified. | [optional] -**Quantity** | Pointer to **int32** | Number of instances to launch | [optional] [default to 1] -**Name** | Pointer to **NullableString** | User-provided name for the instance | [optional] - -## Methods - -### NewLaunchInstanceRequest - -`func NewLaunchInstanceRequest(regionName string, instanceTypeName string, sshKeyNames []string, ) *LaunchInstanceRequest` - -NewLaunchInstanceRequest instantiates a new LaunchInstanceRequest object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewLaunchInstanceRequestWithDefaults - -`func NewLaunchInstanceRequestWithDefaults() *LaunchInstanceRequest` - -NewLaunchInstanceRequestWithDefaults instantiates a new LaunchInstanceRequest object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetRegionName - -`func (o *LaunchInstanceRequest) GetRegionName() string` - -GetRegionName returns the RegionName field if non-nil, zero value otherwise. - -### GetRegionNameOk - -`func (o *LaunchInstanceRequest) GetRegionNameOk() (*string, bool)` - -GetRegionNameOk returns a tuple with the RegionName field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetRegionName - -`func (o *LaunchInstanceRequest) SetRegionName(v string)` - -SetRegionName sets RegionName field to given value. - - -### GetInstanceTypeName - -`func (o *LaunchInstanceRequest) GetInstanceTypeName() string` - -GetInstanceTypeName returns the InstanceTypeName field if non-nil, zero value otherwise. - -### GetInstanceTypeNameOk - -`func (o *LaunchInstanceRequest) GetInstanceTypeNameOk() (*string, bool)` - -GetInstanceTypeNameOk returns a tuple with the InstanceTypeName field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetInstanceTypeName - -`func (o *LaunchInstanceRequest) SetInstanceTypeName(v string)` - -SetInstanceTypeName sets InstanceTypeName field to given value. - - -### GetSshKeyNames - -`func (o *LaunchInstanceRequest) GetSshKeyNames() []string` - -GetSshKeyNames returns the SshKeyNames field if non-nil, zero value otherwise. - -### GetSshKeyNamesOk - -`func (o *LaunchInstanceRequest) GetSshKeyNamesOk() (*[]string, bool)` - -GetSshKeyNamesOk returns a tuple with the SshKeyNames field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetSshKeyNames - -`func (o *LaunchInstanceRequest) SetSshKeyNames(v []string)` - -SetSshKeyNames sets SshKeyNames field to given value. - - -### GetFileSystemNames - -`func (o *LaunchInstanceRequest) GetFileSystemNames() []string` - -GetFileSystemNames returns the FileSystemNames field if non-nil, zero value otherwise. - -### GetFileSystemNamesOk - -`func (o *LaunchInstanceRequest) GetFileSystemNamesOk() (*[]string, bool)` - -GetFileSystemNamesOk returns a tuple with the FileSystemNames field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetFileSystemNames - -`func (o *LaunchInstanceRequest) SetFileSystemNames(v []string)` - -SetFileSystemNames sets FileSystemNames field to given value. - -### HasFileSystemNames - -`func (o *LaunchInstanceRequest) HasFileSystemNames() bool` - -HasFileSystemNames returns a boolean if a field has been set. - -### GetQuantity - -`func (o *LaunchInstanceRequest) GetQuantity() int32` - -GetQuantity returns the Quantity field if non-nil, zero value otherwise. - -### GetQuantityOk - -`func (o *LaunchInstanceRequest) GetQuantityOk() (*int32, bool)` - -GetQuantityOk returns a tuple with the Quantity field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetQuantity - -`func (o *LaunchInstanceRequest) SetQuantity(v int32)` - -SetQuantity sets Quantity field to given value. - -### HasQuantity - -`func (o *LaunchInstanceRequest) HasQuantity() bool` - -HasQuantity returns a boolean if a field has been set. - -### GetName - -`func (o *LaunchInstanceRequest) GetName() string` - -GetName returns the Name field if non-nil, zero value otherwise. - -### GetNameOk - -`func (o *LaunchInstanceRequest) GetNameOk() (*string, bool)` - -GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetName - -`func (o *LaunchInstanceRequest) SetName(v string)` - -SetName sets Name field to given value. - -### HasName - -`func (o *LaunchInstanceRequest) HasName() bool` - -HasName returns a boolean if a field has been set. - -### SetNameNil - -`func (o *LaunchInstanceRequest) SetNameNil(b bool)` - - SetNameNil sets the value for Name to be an explicit nil - -### UnsetName -`func (o *LaunchInstanceRequest) UnsetName()` - -UnsetName ensures that no value is present for Name, not even an explicit nil - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/ListFileSystems200Response.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/ListFileSystems200Response.md deleted file mode 100644 index 42203c5b..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/ListFileSystems200Response.md +++ /dev/null @@ -1,51 +0,0 @@ -# ListFileSystems200Response - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Data** | [**[]FileSystem**](FileSystem.md) | | - -## Methods - -### NewListFileSystems200Response - -`func NewListFileSystems200Response(data []FileSystem, ) *ListFileSystems200Response` - -NewListFileSystems200Response instantiates a new ListFileSystems200Response object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewListFileSystems200ResponseWithDefaults - -`func NewListFileSystems200ResponseWithDefaults() *ListFileSystems200Response` - -NewListFileSystems200ResponseWithDefaults instantiates a new ListFileSystems200Response object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetData - -`func (o *ListFileSystems200Response) GetData() []FileSystem` - -GetData returns the Data field if non-nil, zero value otherwise. - -### GetDataOk - -`func (o *ListFileSystems200Response) GetDataOk() (*[]FileSystem, bool)` - -GetDataOk returns a tuple with the Data field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetData - -`func (o *ListFileSystems200Response) SetData(v []FileSystem)` - -SetData sets Data field to given value. - - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/ListInstances200Response.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/ListInstances200Response.md deleted file mode 100644 index 113ecc7c..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/ListInstances200Response.md +++ /dev/null @@ -1,51 +0,0 @@ -# ListInstances200Response - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Data** | [**[]Instance**](Instance.md) | | - -## Methods - -### NewListInstances200Response - -`func NewListInstances200Response(data []Instance, ) *ListInstances200Response` - -NewListInstances200Response instantiates a new ListInstances200Response object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewListInstances200ResponseWithDefaults - -`func NewListInstances200ResponseWithDefaults() *ListInstances200Response` - -NewListInstances200ResponseWithDefaults instantiates a new ListInstances200Response object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetData - -`func (o *ListInstances200Response) GetData() []Instance` - -GetData returns the Data field if non-nil, zero value otherwise. - -### GetDataOk - -`func (o *ListInstances200Response) GetDataOk() (*[]Instance, bool)` - -GetDataOk returns a tuple with the Data field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetData - -`func (o *ListInstances200Response) SetData(v []Instance)` - -SetData sets Data field to given value. - - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/ListSSHKeys200Response.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/ListSSHKeys200Response.md deleted file mode 100644 index 052447b2..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/ListSSHKeys200Response.md +++ /dev/null @@ -1,51 +0,0 @@ -# ListSSHKeys200Response - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Data** | [**[]SshKey**](SshKey.md) | | - -## Methods - -### NewListSSHKeys200Response - -`func NewListSSHKeys200Response(data []SshKey, ) *ListSSHKeys200Response` - -NewListSSHKeys200Response instantiates a new ListSSHKeys200Response object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewListSSHKeys200ResponseWithDefaults - -`func NewListSSHKeys200ResponseWithDefaults() *ListSSHKeys200Response` - -NewListSSHKeys200ResponseWithDefaults instantiates a new ListSSHKeys200Response object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetData - -`func (o *ListSSHKeys200Response) GetData() []SshKey` - -GetData returns the Data field if non-nil, zero value otherwise. - -### GetDataOk - -`func (o *ListSSHKeys200Response) GetDataOk() (*[]SshKey, bool)` - -GetDataOk returns a tuple with the Data field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetData - -`func (o *ListSSHKeys200Response) SetData(v []SshKey)` - -SetData sets Data field to given value. - - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/ModelError.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/ModelError.md deleted file mode 100644 index 3e75571b..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/ModelError.md +++ /dev/null @@ -1,108 +0,0 @@ -# ModelError - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Code** | [**ErrorCode**](ErrorCode.md) | | -**Message** | **string** | Detailed description of the error | -**Suggestion** | Pointer to **NullableString** | Suggestion of possible ways to fix the error. | [optional] - -## Methods - -### NewModelError - -`func NewModelError(code ErrorCode, message string, ) *ModelError` - -NewModelError instantiates a new ModelError object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewModelErrorWithDefaults - -`func NewModelErrorWithDefaults() *ModelError` - -NewModelErrorWithDefaults instantiates a new ModelError object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetCode - -`func (o *ModelError) GetCode() ErrorCode` - -GetCode returns the Code field if non-nil, zero value otherwise. - -### GetCodeOk - -`func (o *ModelError) GetCodeOk() (*ErrorCode, bool)` - -GetCodeOk returns a tuple with the Code field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetCode - -`func (o *ModelError) SetCode(v ErrorCode)` - -SetCode sets Code field to given value. - - -### GetMessage - -`func (o *ModelError) GetMessage() string` - -GetMessage returns the Message field if non-nil, zero value otherwise. - -### GetMessageOk - -`func (o *ModelError) GetMessageOk() (*string, bool)` - -GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetMessage - -`func (o *ModelError) SetMessage(v string)` - -SetMessage sets Message field to given value. - - -### GetSuggestion - -`func (o *ModelError) GetSuggestion() string` - -GetSuggestion returns the Suggestion field if non-nil, zero value otherwise. - -### GetSuggestionOk - -`func (o *ModelError) GetSuggestionOk() (*string, bool)` - -GetSuggestionOk returns a tuple with the Suggestion field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetSuggestion - -`func (o *ModelError) SetSuggestion(v string)` - -SetSuggestion sets Suggestion field to given value. - -### HasSuggestion - -`func (o *ModelError) HasSuggestion() bool` - -HasSuggestion returns a boolean if a field has been set. - -### SetSuggestionNil - -`func (o *ModelError) SetSuggestionNil(b bool)` - - SetSuggestionNil sets the value for Suggestion to be an explicit nil - -### UnsetSuggestion -`func (o *ModelError) UnsetSuggestion()` - -UnsetSuggestion ensures that no value is present for Suggestion, not even an explicit nil - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/Region.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/Region.md deleted file mode 100644 index 3eae7597..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/Region.md +++ /dev/null @@ -1,72 +0,0 @@ -# Region - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Name** | **string** | Short name of a region | -**Description** | **string** | Long name of a region | - -## Methods - -### NewRegion - -`func NewRegion(name string, description string, ) *Region` - -NewRegion instantiates a new Region object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewRegionWithDefaults - -`func NewRegionWithDefaults() *Region` - -NewRegionWithDefaults instantiates a new Region object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetName - -`func (o *Region) GetName() string` - -GetName returns the Name field if non-nil, zero value otherwise. - -### GetNameOk - -`func (o *Region) GetNameOk() (*string, bool)` - -GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetName - -`func (o *Region) SetName(v string)` - -SetName sets Name field to given value. - - -### GetDescription - -`func (o *Region) GetDescription() string` - -GetDescription returns the Description field if non-nil, zero value otherwise. - -### GetDescriptionOk - -`func (o *Region) GetDescriptionOk() (*string, bool)` - -GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetDescription - -`func (o *Region) SetDescription(v string)` - -SetDescription sets Description field to given value. - - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/RestartInstance200Response.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/RestartInstance200Response.md deleted file mode 100644 index 1df969be..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/RestartInstance200Response.md +++ /dev/null @@ -1,51 +0,0 @@ -# RestartInstance200Response - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Data** | [**RestartInstance200ResponseData**](RestartInstance200ResponseData.md) | | - -## Methods - -### NewRestartInstance200Response - -`func NewRestartInstance200Response(data RestartInstance200ResponseData, ) *RestartInstance200Response` - -NewRestartInstance200Response instantiates a new RestartInstance200Response object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewRestartInstance200ResponseWithDefaults - -`func NewRestartInstance200ResponseWithDefaults() *RestartInstance200Response` - -NewRestartInstance200ResponseWithDefaults instantiates a new RestartInstance200Response object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetData - -`func (o *RestartInstance200Response) GetData() RestartInstance200ResponseData` - -GetData returns the Data field if non-nil, zero value otherwise. - -### GetDataOk - -`func (o *RestartInstance200Response) GetDataOk() (*RestartInstance200ResponseData, bool)` - -GetDataOk returns a tuple with the Data field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetData - -`func (o *RestartInstance200Response) SetData(v RestartInstance200ResponseData)` - -SetData sets Data field to given value. - - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/RestartInstance200ResponseData.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/RestartInstance200ResponseData.md deleted file mode 100644 index 413662a1..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/RestartInstance200ResponseData.md +++ /dev/null @@ -1,51 +0,0 @@ -# RestartInstance200ResponseData - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**RestartedInstances** | [**[]Instance**](Instance.md) | List of instances that were restarted. Note: this list might not contain all instances requested to be restarted. | - -## Methods - -### NewRestartInstance200ResponseData - -`func NewRestartInstance200ResponseData(restartedInstances []Instance, ) *RestartInstance200ResponseData` - -NewRestartInstance200ResponseData instantiates a new RestartInstance200ResponseData object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewRestartInstance200ResponseDataWithDefaults - -`func NewRestartInstance200ResponseDataWithDefaults() *RestartInstance200ResponseData` - -NewRestartInstance200ResponseDataWithDefaults instantiates a new RestartInstance200ResponseData object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetRestartedInstances - -`func (o *RestartInstance200ResponseData) GetRestartedInstances() []Instance` - -GetRestartedInstances returns the RestartedInstances field if non-nil, zero value otherwise. - -### GetRestartedInstancesOk - -`func (o *RestartInstance200ResponseData) GetRestartedInstancesOk() (*[]Instance, bool)` - -GetRestartedInstancesOk returns a tuple with the RestartedInstances field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetRestartedInstances - -`func (o *RestartInstance200ResponseData) SetRestartedInstances(v []Instance)` - -SetRestartedInstances sets RestartedInstances field to given value. - - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/RestartInstanceRequest.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/RestartInstanceRequest.md deleted file mode 100644 index 0381a344..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/RestartInstanceRequest.md +++ /dev/null @@ -1,51 +0,0 @@ -# RestartInstanceRequest - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**InstanceIds** | **[]string** | The unique identifiers (IDs) of the instances to restart | - -## Methods - -### NewRestartInstanceRequest - -`func NewRestartInstanceRequest(instanceIds []string, ) *RestartInstanceRequest` - -NewRestartInstanceRequest instantiates a new RestartInstanceRequest object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewRestartInstanceRequestWithDefaults - -`func NewRestartInstanceRequestWithDefaults() *RestartInstanceRequest` - -NewRestartInstanceRequestWithDefaults instantiates a new RestartInstanceRequest object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetInstanceIds - -`func (o *RestartInstanceRequest) GetInstanceIds() []string` - -GetInstanceIds returns the InstanceIds field if non-nil, zero value otherwise. - -### GetInstanceIdsOk - -`func (o *RestartInstanceRequest) GetInstanceIdsOk() (*[]string, bool)` - -GetInstanceIdsOk returns a tuple with the InstanceIds field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetInstanceIds - -`func (o *RestartInstanceRequest) SetInstanceIds(v []string)` - -SetInstanceIds sets InstanceIds field to given value. - - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/SshKey.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/SshKey.md deleted file mode 100644 index 31e75e21..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/SshKey.md +++ /dev/null @@ -1,129 +0,0 @@ -# SshKey - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Id** | **string** | Unique identifier (ID) of an SSH key | -**Name** | **string** | Name of the SSH key | -**PublicKey** | **string** | Public key for the SSH key | -**PrivateKey** | Pointer to **NullableString** | Private key for the SSH key. Only returned when generating a new key pair. | [optional] - -## Methods - -### NewSshKey - -`func NewSshKey(id string, name string, publicKey string, ) *SshKey` - -NewSshKey instantiates a new SshKey object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewSshKeyWithDefaults - -`func NewSshKeyWithDefaults() *SshKey` - -NewSshKeyWithDefaults instantiates a new SshKey object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetId - -`func (o *SshKey) GetId() string` - -GetId returns the Id field if non-nil, zero value otherwise. - -### GetIdOk - -`func (o *SshKey) GetIdOk() (*string, bool)` - -GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetId - -`func (o *SshKey) SetId(v string)` - -SetId sets Id field to given value. - - -### GetName - -`func (o *SshKey) GetName() string` - -GetName returns the Name field if non-nil, zero value otherwise. - -### GetNameOk - -`func (o *SshKey) GetNameOk() (*string, bool)` - -GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetName - -`func (o *SshKey) SetName(v string)` - -SetName sets Name field to given value. - - -### GetPublicKey - -`func (o *SshKey) GetPublicKey() string` - -GetPublicKey returns the PublicKey field if non-nil, zero value otherwise. - -### GetPublicKeyOk - -`func (o *SshKey) GetPublicKeyOk() (*string, bool)` - -GetPublicKeyOk returns a tuple with the PublicKey field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetPublicKey - -`func (o *SshKey) SetPublicKey(v string)` - -SetPublicKey sets PublicKey field to given value. - - -### GetPrivateKey - -`func (o *SshKey) GetPrivateKey() string` - -GetPrivateKey returns the PrivateKey field if non-nil, zero value otherwise. - -### GetPrivateKeyOk - -`func (o *SshKey) GetPrivateKeyOk() (*string, bool)` - -GetPrivateKeyOk returns a tuple with the PrivateKey field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetPrivateKey - -`func (o *SshKey) SetPrivateKey(v string)` - -SetPrivateKey sets PrivateKey field to given value. - -### HasPrivateKey - -`func (o *SshKey) HasPrivateKey() bool` - -HasPrivateKey returns a boolean if a field has been set. - -### SetPrivateKeyNil - -`func (o *SshKey) SetPrivateKeyNil(b bool)` - - SetPrivateKeyNil sets the value for PrivateKey to be an explicit nil - -### UnsetPrivateKey -`func (o *SshKey) UnsetPrivateKey()` - -UnsetPrivateKey ensures that no value is present for PrivateKey, not even an explicit nil - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/TerminateInstance200Response.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/TerminateInstance200Response.md deleted file mode 100644 index 36df9136..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/TerminateInstance200Response.md +++ /dev/null @@ -1,51 +0,0 @@ -# TerminateInstance200Response - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Data** | [**TerminateInstance200ResponseData**](TerminateInstance200ResponseData.md) | | - -## Methods - -### NewTerminateInstance200Response - -`func NewTerminateInstance200Response(data TerminateInstance200ResponseData, ) *TerminateInstance200Response` - -NewTerminateInstance200Response instantiates a new TerminateInstance200Response object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewTerminateInstance200ResponseWithDefaults - -`func NewTerminateInstance200ResponseWithDefaults() *TerminateInstance200Response` - -NewTerminateInstance200ResponseWithDefaults instantiates a new TerminateInstance200Response object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetData - -`func (o *TerminateInstance200Response) GetData() TerminateInstance200ResponseData` - -GetData returns the Data field if non-nil, zero value otherwise. - -### GetDataOk - -`func (o *TerminateInstance200Response) GetDataOk() (*TerminateInstance200ResponseData, bool)` - -GetDataOk returns a tuple with the Data field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetData - -`func (o *TerminateInstance200Response) SetData(v TerminateInstance200ResponseData)` - -SetData sets Data field to given value. - - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/TerminateInstance200ResponseData.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/TerminateInstance200ResponseData.md deleted file mode 100644 index 16ca4b38..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/TerminateInstance200ResponseData.md +++ /dev/null @@ -1,51 +0,0 @@ -# TerminateInstance200ResponseData - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**TerminatedInstances** | [**[]Instance**](Instance.md) | List of instances that were terminated. Note: this list might not contain all instances requested to be terminated. | - -## Methods - -### NewTerminateInstance200ResponseData - -`func NewTerminateInstance200ResponseData(terminatedInstances []Instance, ) *TerminateInstance200ResponseData` - -NewTerminateInstance200ResponseData instantiates a new TerminateInstance200ResponseData object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewTerminateInstance200ResponseDataWithDefaults - -`func NewTerminateInstance200ResponseDataWithDefaults() *TerminateInstance200ResponseData` - -NewTerminateInstance200ResponseDataWithDefaults instantiates a new TerminateInstance200ResponseData object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetTerminatedInstances - -`func (o *TerminateInstance200ResponseData) GetTerminatedInstances() []Instance` - -GetTerminatedInstances returns the TerminatedInstances field if non-nil, zero value otherwise. - -### GetTerminatedInstancesOk - -`func (o *TerminateInstance200ResponseData) GetTerminatedInstancesOk() (*[]Instance, bool)` - -GetTerminatedInstancesOk returns a tuple with the TerminatedInstances field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetTerminatedInstances - -`func (o *TerminateInstance200ResponseData) SetTerminatedInstances(v []Instance)` - -SetTerminatedInstances sets TerminatedInstances field to given value. - - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/TerminateInstanceRequest.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/TerminateInstanceRequest.md deleted file mode 100644 index 9b99ecd9..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/TerminateInstanceRequest.md +++ /dev/null @@ -1,51 +0,0 @@ -# TerminateInstanceRequest - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**InstanceIds** | **[]string** | The unique identifiers (IDs) of the instances to terminate | - -## Methods - -### NewTerminateInstanceRequest - -`func NewTerminateInstanceRequest(instanceIds []string, ) *TerminateInstanceRequest` - -NewTerminateInstanceRequest instantiates a new TerminateInstanceRequest object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewTerminateInstanceRequestWithDefaults - -`func NewTerminateInstanceRequestWithDefaults() *TerminateInstanceRequest` - -NewTerminateInstanceRequestWithDefaults instantiates a new TerminateInstanceRequest object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetInstanceIds - -`func (o *TerminateInstanceRequest) GetInstanceIds() []string` - -GetInstanceIds returns the InstanceIds field if non-nil, zero value otherwise. - -### GetInstanceIdsOk - -`func (o *TerminateInstanceRequest) GetInstanceIdsOk() (*[]string, bool)` - -GetInstanceIdsOk returns a tuple with the InstanceIds field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetInstanceIds - -`func (o *TerminateInstanceRequest) SetInstanceIds(v []string)` - -SetInstanceIds sets InstanceIds field to given value. - - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/docs/User.md b/v1/providers/lambdalabs/gen/lambdalabs/docs/User.md deleted file mode 100644 index dc3ae9e5..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/docs/User.md +++ /dev/null @@ -1,93 +0,0 @@ -# User - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Id** | **string** | Unique identifier for the user | -**Email** | **string** | Email address of the user | -**Status** | **string** | Status of the user's account | - -## Methods - -### NewUser - -`func NewUser(id string, email string, status string, ) *User` - -NewUser instantiates a new User object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewUserWithDefaults - -`func NewUserWithDefaults() *User` - -NewUserWithDefaults instantiates a new User object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetId - -`func (o *User) GetId() string` - -GetId returns the Id field if non-nil, zero value otherwise. - -### GetIdOk - -`func (o *User) GetIdOk() (*string, bool)` - -GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetId - -`func (o *User) SetId(v string)` - -SetId sets Id field to given value. - - -### GetEmail - -`func (o *User) GetEmail() string` - -GetEmail returns the Email field if non-nil, zero value otherwise. - -### GetEmailOk - -`func (o *User) GetEmailOk() (*string, bool)` - -GetEmailOk returns a tuple with the Email field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetEmail - -`func (o *User) SetEmail(v string)` - -SetEmail sets Email field to given value. - - -### GetStatus - -`func (o *User) GetStatus() string` - -GetStatus returns the Status field if non-nil, zero value otherwise. - -### GetStatusOk - -`func (o *User) GetStatusOk() (*string, bool)` - -GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetStatus - -`func (o *User) SetStatus(v string)` - -SetStatus sets Status field to given value. - - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/v1/providers/lambdalabs/gen/lambdalabs/git_push.sh b/v1/providers/lambdalabs/gen/lambdalabs/git_push.sh deleted file mode 100644 index ccffd509..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="github.com" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="brevdev" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="cloud" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=$(git remote) -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_add_ssh_key_200_response.go b/v1/providers/lambdalabs/gen/lambdalabs/model_add_ssh_key_200_response.go deleted file mode 100644 index 770cb93a..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_add_ssh_key_200_response.go +++ /dev/null @@ -1,156 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the AddSSHKey200Response type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &AddSSHKey200Response{} - -// AddSSHKey200Response The added or generated SSH public key. If a new key pair was generated, the response body contains a `private_key` property that *must* be saved locally. Lambda Cloud does not store private keys. -type AddSSHKey200Response struct { - Data SshKey `json:"data"` -} - -type _AddSSHKey200Response AddSSHKey200Response - -// NewAddSSHKey200Response instantiates a new AddSSHKey200Response object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewAddSSHKey200Response(data SshKey) *AddSSHKey200Response { - this := AddSSHKey200Response{} - this.Data = data - return &this -} - -// NewAddSSHKey200ResponseWithDefaults instantiates a new AddSSHKey200Response object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewAddSSHKey200ResponseWithDefaults() *AddSSHKey200Response { - this := AddSSHKey200Response{} - return &this -} - -// GetData returns the Data field value -func (o *AddSSHKey200Response) GetData() SshKey { - if o == nil { - var ret SshKey - return ret - } - - return o.Data -} - -// GetDataOk returns a tuple with the Data field value -// and a boolean to check if the value has been set. -func (o *AddSSHKey200Response) GetDataOk() (*SshKey, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value -func (o *AddSSHKey200Response) SetData(v SshKey) { - o.Data = v -} - -func (o AddSSHKey200Response) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o AddSSHKey200Response) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["data"] = o.Data - return toSerialize, nil -} - -func (o *AddSSHKey200Response) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "data", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varAddSSHKey200Response := _AddSSHKey200Response{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varAddSSHKey200Response) - - if err != nil { - return err - } - - *o = AddSSHKey200Response(varAddSSHKey200Response) - - return err -} - -type NullableAddSSHKey200Response struct { - value *AddSSHKey200Response - isSet bool -} - -func (v NullableAddSSHKey200Response) Get() *AddSSHKey200Response { - return v.value -} - -func (v *NullableAddSSHKey200Response) Set(val *AddSSHKey200Response) { - v.value = val - v.isSet = true -} - -func (v NullableAddSSHKey200Response) IsSet() bool { - return v.isSet -} - -func (v *NullableAddSSHKey200Response) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableAddSSHKey200Response(val *AddSSHKey200Response) *NullableAddSSHKey200Response { - return &NullableAddSSHKey200Response{value: val, isSet: true} -} - -func (v NullableAddSSHKey200Response) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableAddSSHKey200Response) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_add_ssh_key_request.go b/v1/providers/lambdalabs/gen/lambdalabs/model_add_ssh_key_request.go deleted file mode 100644 index c1d48bf8..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_add_ssh_key_request.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the AddSSHKeyRequest type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &AddSSHKeyRequest{} - -// AddSSHKeyRequest The name for the SSH key. Optionally, an existing public key can be supplied for the `public_key` property. If the `public_key` property is omitted, a new key pair is generated. The private key is returned in the response. -type AddSSHKeyRequest struct { - // Name of the SSH key - Name string `json:"name"` - // Public key for the SSH key - PublicKey *string `json:"public_key,omitempty"` -} - -type _AddSSHKeyRequest AddSSHKeyRequest - -// NewAddSSHKeyRequest instantiates a new AddSSHKeyRequest object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewAddSSHKeyRequest(name string) *AddSSHKeyRequest { - this := AddSSHKeyRequest{} - this.Name = name - return &this -} - -// NewAddSSHKeyRequestWithDefaults instantiates a new AddSSHKeyRequest object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewAddSSHKeyRequestWithDefaults() *AddSSHKeyRequest { - this := AddSSHKeyRequest{} - return &this -} - -// GetName returns the Name field value -func (o *AddSSHKeyRequest) GetName() string { - if o == nil { - var ret string - return ret - } - - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *AddSSHKeyRequest) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value -func (o *AddSSHKeyRequest) SetName(v string) { - o.Name = v -} - -// GetPublicKey returns the PublicKey field value if set, zero value otherwise. -func (o *AddSSHKeyRequest) GetPublicKey() string { - if o == nil || IsNil(o.PublicKey) { - var ret string - return ret - } - return *o.PublicKey -} - -// GetPublicKeyOk returns a tuple with the PublicKey field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AddSSHKeyRequest) GetPublicKeyOk() (*string, bool) { - if o == nil || IsNil(o.PublicKey) { - return nil, false - } - return o.PublicKey, true -} - -// HasPublicKey returns a boolean if a field has been set. -func (o *AddSSHKeyRequest) HasPublicKey() bool { - if o != nil && !IsNil(o.PublicKey) { - return true - } - - return false -} - -// SetPublicKey gets a reference to the given string and assigns it to the PublicKey field. -func (o *AddSSHKeyRequest) SetPublicKey(v string) { - o.PublicKey = &v -} - -func (o AddSSHKeyRequest) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o AddSSHKeyRequest) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["name"] = o.Name - if !IsNil(o.PublicKey) { - toSerialize["public_key"] = o.PublicKey - } - return toSerialize, nil -} - -func (o *AddSSHKeyRequest) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "name", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varAddSSHKeyRequest := _AddSSHKeyRequest{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varAddSSHKeyRequest) - - if err != nil { - return err - } - - *o = AddSSHKeyRequest(varAddSSHKeyRequest) - - return err -} - -type NullableAddSSHKeyRequest struct { - value *AddSSHKeyRequest - isSet bool -} - -func (v NullableAddSSHKeyRequest) Get() *AddSSHKeyRequest { - return v.value -} - -func (v *NullableAddSSHKeyRequest) Set(val *AddSSHKeyRequest) { - v.value = val - v.isSet = true -} - -func (v NullableAddSSHKeyRequest) IsSet() bool { - return v.isSet -} - -func (v *NullableAddSSHKeyRequest) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableAddSSHKeyRequest(val *AddSSHKeyRequest) *NullableAddSSHKeyRequest { - return &NullableAddSSHKeyRequest{value: val, isSet: true} -} - -func (v NullableAddSSHKeyRequest) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableAddSSHKeyRequest) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_error.go b/v1/providers/lambdalabs/gen/lambdalabs/model_error.go deleted file mode 100644 index 4f3e0fa8..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_error.go +++ /dev/null @@ -1,233 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the ModelError type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &ModelError{} - -// ModelError struct for ModelError -type ModelError struct { - Code ErrorCode `json:"code"` - // Detailed description of the error - Message string `json:"message"` - // Suggestion of possible ways to fix the error. - Suggestion NullableString `json:"suggestion,omitempty"` -} - -type _ModelError ModelError - -// NewModelError instantiates a new ModelError object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewModelError(code ErrorCode, message string) *ModelError { - this := ModelError{} - this.Code = code - this.Message = message - return &this -} - -// NewModelErrorWithDefaults instantiates a new ModelError object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewModelErrorWithDefaults() *ModelError { - this := ModelError{} - return &this -} - -// GetCode returns the Code field value -func (o *ModelError) GetCode() ErrorCode { - if o == nil { - var ret ErrorCode - return ret - } - - return o.Code -} - -// GetCodeOk returns a tuple with the Code field value -// and a boolean to check if the value has been set. -func (o *ModelError) GetCodeOk() (*ErrorCode, bool) { - if o == nil { - return nil, false - } - return &o.Code, true -} - -// SetCode sets field value -func (o *ModelError) SetCode(v ErrorCode) { - o.Code = v -} - -// GetMessage returns the Message field value -func (o *ModelError) GetMessage() string { - if o == nil { - var ret string - return ret - } - - return o.Message -} - -// GetMessageOk returns a tuple with the Message field value -// and a boolean to check if the value has been set. -func (o *ModelError) GetMessageOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Message, true -} - -// SetMessage sets field value -func (o *ModelError) SetMessage(v string) { - o.Message = v -} - -// GetSuggestion returns the Suggestion field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *ModelError) GetSuggestion() string { - if o == nil || IsNil(o.Suggestion.Get()) { - var ret string - return ret - } - return *o.Suggestion.Get() -} - -// GetSuggestionOk returns a tuple with the Suggestion field value if set, nil otherwise -// and a boolean to check if the value has been set. -// NOTE: If the value is an explicit nil, `nil, true` will be returned -func (o *ModelError) GetSuggestionOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Suggestion.Get(), o.Suggestion.IsSet() -} - -// HasSuggestion returns a boolean if a field has been set. -func (o *ModelError) HasSuggestion() bool { - if o != nil && o.Suggestion.IsSet() { - return true - } - - return false -} - -// SetSuggestion gets a reference to the given NullableString and assigns it to the Suggestion field. -func (o *ModelError) SetSuggestion(v string) { - o.Suggestion.Set(&v) -} - -// SetSuggestionNil sets the value for Suggestion to be an explicit nil -func (o *ModelError) SetSuggestionNil() { - o.Suggestion.Set(nil) -} - -// UnsetSuggestion ensures that no value is present for Suggestion, not even an explicit nil -func (o *ModelError) UnsetSuggestion() { - o.Suggestion.Unset() -} - -func (o ModelError) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o ModelError) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["code"] = o.Code - toSerialize["message"] = o.Message - if o.Suggestion.IsSet() { - toSerialize["suggestion"] = o.Suggestion.Get() - } - return toSerialize, nil -} - -func (o *ModelError) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "code", - "message", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varModelError := _ModelError{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varModelError) - - if err != nil { - return err - } - - *o = ModelError(varModelError) - - return err -} - -type NullableModelError struct { - value *ModelError - isSet bool -} - -func (v NullableModelError) Get() *ModelError { - return v.value -} - -func (v *NullableModelError) Set(val *ModelError) { - v.value = val - v.isSet = true -} - -func (v NullableModelError) IsSet() bool { - return v.isSet -} - -func (v *NullableModelError) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableModelError(val *ModelError) *NullableModelError { - return &NullableModelError{value: val, isSet: true} -} - -func (v NullableModelError) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableModelError) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_error_code.go b/v1/providers/lambdalabs/gen/lambdalabs/model_error_code.go deleted file mode 100644 index 424365e9..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_error_code.go +++ /dev/null @@ -1,126 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "encoding/json" - "fmt" -) - -// ErrorCode Unique identifier for the type of error -type ErrorCode string - -// List of errorCode -const ( - GLOBAL_UNKNOWN ErrorCode = "global/unknown" - GLOBAL_INVALID_API_KEY ErrorCode = "global/invalid-api-key" - GLOBAL_ACCOUNT_INACTIVE ErrorCode = "global/account-inactive" - GLOBAL_INVALID_ADDRESS ErrorCode = "global/invalid-address" - GLOBAL_INVALID_PARAMETERS ErrorCode = "global/invalid-parameters" - GLOBAL_OBJECT_DOES_NOT_EXIST ErrorCode = "global/object-does-not-exist" - GLOBAL_QUOTA_EXCEEDED ErrorCode = "global/quota-exceeded" - INSTANCE_OPERATIONS_LAUNCH_INSUFFICIENT_CAPACITY ErrorCode = "instance-operations/launch/insufficient-capacity" - INSTANCE_OPERATIONS_LAUNCH_FILE_SYSTEM_IN_WRONG_REGION ErrorCode = "instance-operations/launch/file-system-in-wrong-region" - SSH_KEYS_KEY_IN_USE ErrorCode = "ssh-keys/key-in-use" -) - -// All allowed values of ErrorCode enum -var AllowedErrorCodeEnumValues = []ErrorCode{ - "global/unknown", - "global/invalid-api-key", - "global/account-inactive", - "global/invalid-address", - "global/invalid-parameters", - "global/object-does-not-exist", - "global/quota-exceeded", - "instance-operations/launch/insufficient-capacity", - "instance-operations/launch/file-system-in-wrong-region", - "ssh-keys/key-in-use", -} - -func (v *ErrorCode) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := ErrorCode(value) - for _, existing := range AllowedErrorCodeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid ErrorCode", value) -} - -// NewErrorCodeFromValue returns a pointer to a valid ErrorCode -// for the value passed as argument, or an error if the value passed is not allowed by the enum -func NewErrorCodeFromValue(v string) (*ErrorCode, error) { - ev := ErrorCode(v) - if ev.IsValid() { - return &ev, nil - } else { - return nil, fmt.Errorf("invalid value '%v' for ErrorCode: valid values are %v", v, AllowedErrorCodeEnumValues) - } -} - -// IsValid return true if the value is valid for the enum, false otherwise -func (v ErrorCode) IsValid() bool { - for _, existing := range AllowedErrorCodeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to errorCode value -func (v ErrorCode) Ptr() *ErrorCode { - return &v -} - -type NullableErrorCode struct { - value *ErrorCode - isSet bool -} - -func (v NullableErrorCode) Get() *ErrorCode { - return v.value -} - -func (v *NullableErrorCode) Set(val *ErrorCode) { - v.value = val - v.isSet = true -} - -func (v NullableErrorCode) IsSet() bool { - return v.isSet -} - -func (v *NullableErrorCode) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableErrorCode(val *ErrorCode) *NullableErrorCode { - return &NullableErrorCode{value: val, isSet: true} -} - -func (v NullableErrorCode) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableErrorCode) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_error_response_body.go b/v1/providers/lambdalabs/gen/lambdalabs/model_error_response_body.go deleted file mode 100644 index 1b84ae62..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_error_response_body.go +++ /dev/null @@ -1,193 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the ErrorResponseBody type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &ErrorResponseBody{} - -// ErrorResponseBody struct for ErrorResponseBody -type ErrorResponseBody struct { - Error ModelError `json:"error"` - // Details about errors on a per-parameter basis - FieldErrors *map[string]ModelError `json:"field_errors,omitempty"` -} - -type _ErrorResponseBody ErrorResponseBody - -// NewErrorResponseBody instantiates a new ErrorResponseBody object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewErrorResponseBody(error_ ModelError) *ErrorResponseBody { - this := ErrorResponseBody{} - this.Error = error_ - return &this -} - -// NewErrorResponseBodyWithDefaults instantiates a new ErrorResponseBody object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewErrorResponseBodyWithDefaults() *ErrorResponseBody { - this := ErrorResponseBody{} - return &this -} - -// GetError returns the Error field value -func (o *ErrorResponseBody) GetError() ModelError { - if o == nil { - var ret ModelError - return ret - } - - return o.Error -} - -// GetErrorOk returns a tuple with the Error field value -// and a boolean to check if the value has been set. -func (o *ErrorResponseBody) GetErrorOk() (*ModelError, bool) { - if o == nil { - return nil, false - } - return &o.Error, true -} - -// SetError sets field value -func (o *ErrorResponseBody) SetError(v ModelError) { - o.Error = v -} - -// GetFieldErrors returns the FieldErrors field value if set, zero value otherwise. -func (o *ErrorResponseBody) GetFieldErrors() map[string]ModelError { - if o == nil || IsNil(o.FieldErrors) { - var ret map[string]ModelError - return ret - } - return *o.FieldErrors -} - -// GetFieldErrorsOk returns a tuple with the FieldErrors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ErrorResponseBody) GetFieldErrorsOk() (*map[string]ModelError, bool) { - if o == nil || IsNil(o.FieldErrors) { - return nil, false - } - return o.FieldErrors, true -} - -// HasFieldErrors returns a boolean if a field has been set. -func (o *ErrorResponseBody) HasFieldErrors() bool { - if o != nil && !IsNil(o.FieldErrors) { - return true - } - - return false -} - -// SetFieldErrors gets a reference to the given map[string]ModelError and assigns it to the FieldErrors field. -func (o *ErrorResponseBody) SetFieldErrors(v map[string]ModelError) { - o.FieldErrors = &v -} - -func (o ErrorResponseBody) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o ErrorResponseBody) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["error"] = o.Error - if !IsNil(o.FieldErrors) { - toSerialize["field_errors"] = o.FieldErrors - } - return toSerialize, nil -} - -func (o *ErrorResponseBody) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "error", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varErrorResponseBody := _ErrorResponseBody{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varErrorResponseBody) - - if err != nil { - return err - } - - *o = ErrorResponseBody(varErrorResponseBody) - - return err -} - -type NullableErrorResponseBody struct { - value *ErrorResponseBody - isSet bool -} - -func (v NullableErrorResponseBody) Get() *ErrorResponseBody { - return v.value -} - -func (v *NullableErrorResponseBody) Set(val *ErrorResponseBody) { - v.value = val - v.isSet = true -} - -func (v NullableErrorResponseBody) IsSet() bool { - return v.isSet -} - -func (v *NullableErrorResponseBody) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableErrorResponseBody(val *ErrorResponseBody) *NullableErrorResponseBody { - return &NullableErrorResponseBody{value: val, isSet: true} -} - -func (v NullableErrorResponseBody) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableErrorResponseBody) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_file_system.go b/v1/providers/lambdalabs/gen/lambdalabs/model_file_system.go deleted file mode 100644 index 683227df..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_file_system.go +++ /dev/null @@ -1,366 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the FileSystem type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &FileSystem{} - -// FileSystem Information about a shared file system -type FileSystem struct { - // Unique identifier (ID) of a file system - Id string `json:"id"` - // Name of a file system - Name string `json:"name"` - // A date and time, formatted as an ISO 8601 time stamp - Created string `json:"created"` - CreatedBy User `json:"created_by"` - // Absolute path indicating where on instances the file system will be mounted - MountPoint string `json:"mount_point"` - Region Region `json:"region"` - // Whether the file system is currently in use by an instance. File systems that are in use cannot be deleted. - IsInUse bool `json:"is_in_use"` - // Approximate amount of storage used by the file system, in bytes. This value is an estimate that is updated every several hours. - BytesUsed *int32 `json:"bytes_used,omitempty"` -} - -type _FileSystem FileSystem - -// NewFileSystem instantiates a new FileSystem object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewFileSystem(id string, name string, created string, createdBy User, mountPoint string, region Region, isInUse bool) *FileSystem { - this := FileSystem{} - this.Id = id - this.Name = name - this.Created = created - this.CreatedBy = createdBy - this.MountPoint = mountPoint - this.Region = region - this.IsInUse = isInUse - return &this -} - -// NewFileSystemWithDefaults instantiates a new FileSystem object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewFileSystemWithDefaults() *FileSystem { - this := FileSystem{} - return &this -} - -// GetId returns the Id field value -func (o *FileSystem) GetId() string { - if o == nil { - var ret string - return ret - } - - return o.Id -} - -// GetIdOk returns a tuple with the Id field value -// and a boolean to check if the value has been set. -func (o *FileSystem) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value -func (o *FileSystem) SetId(v string) { - o.Id = v -} - -// GetName returns the Name field value -func (o *FileSystem) GetName() string { - if o == nil { - var ret string - return ret - } - - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *FileSystem) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value -func (o *FileSystem) SetName(v string) { - o.Name = v -} - -// GetCreated returns the Created field value -func (o *FileSystem) GetCreated() string { - if o == nil { - var ret string - return ret - } - - return o.Created -} - -// GetCreatedOk returns a tuple with the Created field value -// and a boolean to check if the value has been set. -func (o *FileSystem) GetCreatedOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Created, true -} - -// SetCreated sets field value -func (o *FileSystem) SetCreated(v string) { - o.Created = v -} - -// GetCreatedBy returns the CreatedBy field value -func (o *FileSystem) GetCreatedBy() User { - if o == nil { - var ret User - return ret - } - - return o.CreatedBy -} - -// GetCreatedByOk returns a tuple with the CreatedBy field value -// and a boolean to check if the value has been set. -func (o *FileSystem) GetCreatedByOk() (*User, bool) { - if o == nil { - return nil, false - } - return &o.CreatedBy, true -} - -// SetCreatedBy sets field value -func (o *FileSystem) SetCreatedBy(v User) { - o.CreatedBy = v -} - -// GetMountPoint returns the MountPoint field value -func (o *FileSystem) GetMountPoint() string { - if o == nil { - var ret string - return ret - } - - return o.MountPoint -} - -// GetMountPointOk returns a tuple with the MountPoint field value -// and a boolean to check if the value has been set. -func (o *FileSystem) GetMountPointOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.MountPoint, true -} - -// SetMountPoint sets field value -func (o *FileSystem) SetMountPoint(v string) { - o.MountPoint = v -} - -// GetRegion returns the Region field value -func (o *FileSystem) GetRegion() Region { - if o == nil { - var ret Region - return ret - } - - return o.Region -} - -// GetRegionOk returns a tuple with the Region field value -// and a boolean to check if the value has been set. -func (o *FileSystem) GetRegionOk() (*Region, bool) { - if o == nil { - return nil, false - } - return &o.Region, true -} - -// SetRegion sets field value -func (o *FileSystem) SetRegion(v Region) { - o.Region = v -} - -// GetIsInUse returns the IsInUse field value -func (o *FileSystem) GetIsInUse() bool { - if o == nil { - var ret bool - return ret - } - - return o.IsInUse -} - -// GetIsInUseOk returns a tuple with the IsInUse field value -// and a boolean to check if the value has been set. -func (o *FileSystem) GetIsInUseOk() (*bool, bool) { - if o == nil { - return nil, false - } - return &o.IsInUse, true -} - -// SetIsInUse sets field value -func (o *FileSystem) SetIsInUse(v bool) { - o.IsInUse = v -} - -// GetBytesUsed returns the BytesUsed field value if set, zero value otherwise. -func (o *FileSystem) GetBytesUsed() int32 { - if o == nil || IsNil(o.BytesUsed) { - var ret int32 - return ret - } - return *o.BytesUsed -} - -// GetBytesUsedOk returns a tuple with the BytesUsed field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *FileSystem) GetBytesUsedOk() (*int32, bool) { - if o == nil || IsNil(o.BytesUsed) { - return nil, false - } - return o.BytesUsed, true -} - -// HasBytesUsed returns a boolean if a field has been set. -func (o *FileSystem) HasBytesUsed() bool { - if o != nil && !IsNil(o.BytesUsed) { - return true - } - - return false -} - -// SetBytesUsed gets a reference to the given int32 and assigns it to the BytesUsed field. -func (o *FileSystem) SetBytesUsed(v int32) { - o.BytesUsed = &v -} - -func (o FileSystem) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o FileSystem) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["id"] = o.Id - toSerialize["name"] = o.Name - toSerialize["created"] = o.Created - toSerialize["created_by"] = o.CreatedBy - toSerialize["mount_point"] = o.MountPoint - toSerialize["region"] = o.Region - toSerialize["is_in_use"] = o.IsInUse - if !IsNil(o.BytesUsed) { - toSerialize["bytes_used"] = o.BytesUsed - } - return toSerialize, nil -} - -func (o *FileSystem) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "id", - "name", - "created", - "created_by", - "mount_point", - "region", - "is_in_use", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varFileSystem := _FileSystem{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varFileSystem) - - if err != nil { - return err - } - - *o = FileSystem(varFileSystem) - - return err -} - -type NullableFileSystem struct { - value *FileSystem - isSet bool -} - -func (v NullableFileSystem) Get() *FileSystem { - return v.value -} - -func (v *NullableFileSystem) Set(val *FileSystem) { - v.value = val - v.isSet = true -} - -func (v NullableFileSystem) IsSet() bool { - return v.isSet -} - -func (v *NullableFileSystem) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableFileSystem(val *FileSystem) *NullableFileSystem { - return &NullableFileSystem{value: val, isSet: true} -} - -func (v NullableFileSystem) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableFileSystem) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_get_instance_200_response.go b/v1/providers/lambdalabs/gen/lambdalabs/model_get_instance_200_response.go deleted file mode 100644 index 82f1cacb..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_get_instance_200_response.go +++ /dev/null @@ -1,156 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the GetInstance200Response type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &GetInstance200Response{} - -// GetInstance200Response struct for GetInstance200Response -type GetInstance200Response struct { - Data Instance `json:"data"` -} - -type _GetInstance200Response GetInstance200Response - -// NewGetInstance200Response instantiates a new GetInstance200Response object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewGetInstance200Response(data Instance) *GetInstance200Response { - this := GetInstance200Response{} - this.Data = data - return &this -} - -// NewGetInstance200ResponseWithDefaults instantiates a new GetInstance200Response object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewGetInstance200ResponseWithDefaults() *GetInstance200Response { - this := GetInstance200Response{} - return &this -} - -// GetData returns the Data field value -func (o *GetInstance200Response) GetData() Instance { - if o == nil { - var ret Instance - return ret - } - - return o.Data -} - -// GetDataOk returns a tuple with the Data field value -// and a boolean to check if the value has been set. -func (o *GetInstance200Response) GetDataOk() (*Instance, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value -func (o *GetInstance200Response) SetData(v Instance) { - o.Data = v -} - -func (o GetInstance200Response) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o GetInstance200Response) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["data"] = o.Data - return toSerialize, nil -} - -func (o *GetInstance200Response) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "data", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varGetInstance200Response := _GetInstance200Response{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varGetInstance200Response) - - if err != nil { - return err - } - - *o = GetInstance200Response(varGetInstance200Response) - - return err -} - -type NullableGetInstance200Response struct { - value *GetInstance200Response - isSet bool -} - -func (v NullableGetInstance200Response) Get() *GetInstance200Response { - return v.value -} - -func (v *NullableGetInstance200Response) Set(val *GetInstance200Response) { - v.value = val - v.isSet = true -} - -func (v NullableGetInstance200Response) IsSet() bool { - return v.isSet -} - -func (v *NullableGetInstance200Response) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableGetInstance200Response(val *GetInstance200Response) *NullableGetInstance200Response { - return &NullableGetInstance200Response{value: val, isSet: true} -} - -func (v NullableGetInstance200Response) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableGetInstance200Response) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_instance.go b/v1/providers/lambdalabs/gen/lambdalabs/model_instance.go deleted file mode 100644 index b25e5df2..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_instance.go +++ /dev/null @@ -1,663 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "encoding/json" - "fmt" -) - -// checks if the Instance type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &Instance{} - -// Instance Virtual machine (VM) in Lambda Cloud -type Instance struct { - // Unique identifier (ID) of an instance - Id string `json:"id"` - // User-provided name for the instance - Name NullableString `json:"name,omitempty"` - // IPv4 address of the instance - Ip NullableString `json:"ip,omitempty"` - // Private IPv4 address of the instance - PrivateIp NullableString `json:"private_ip,omitempty"` - // The current status of the instance - Status string `json:"status"` - // Names of the SSH keys allowed to access the instance - SshKeyNames []string `json:"ssh_key_names"` - // Names of the file systems, if any, attached to the instance - FileSystemNames []string `json:"file_system_names"` - Region *Region `json:"region,omitempty"` - InstanceType *InstanceType `json:"instance_type,omitempty"` - // Hostname assigned to this instance, which resolves to the instance's IP. - Hostname NullableString `json:"hostname,omitempty"` - // Secret token used to log into the jupyter lab server hosted on the instance. - JupyterToken NullableString `json:"jupyter_token,omitempty"` - // URL that opens a jupyter lab notebook on the instance. - JupyterUrl NullableString `json:"jupyter_url,omitempty"` - // Whether the instance is reserved. - IsReserved *bool `json:"is_reserved,omitempty"` - AdditionalProperties map[string]interface{} -} - -type _Instance Instance - -// NewInstance instantiates a new Instance object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewInstance(id string, status string, sshKeyNames []string, fileSystemNames []string) *Instance { - this := Instance{} - this.Id = id - this.Status = status - this.SshKeyNames = sshKeyNames - this.FileSystemNames = fileSystemNames - return &this -} - -// NewInstanceWithDefaults instantiates a new Instance object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewInstanceWithDefaults() *Instance { - this := Instance{} - return &this -} - -// GetId returns the Id field value -func (o *Instance) GetId() string { - if o == nil { - var ret string - return ret - } - - return o.Id -} - -// GetIdOk returns a tuple with the Id field value -// and a boolean to check if the value has been set. -func (o *Instance) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value -func (o *Instance) SetId(v string) { - o.Id = v -} - -// GetName returns the Name field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Instance) GetName() string { - if o == nil || IsNil(o.Name.Get()) { - var ret string - return ret - } - return *o.Name.Get() -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -// NOTE: If the value is an explicit nil, `nil, true` will be returned -func (o *Instance) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Name.Get(), o.Name.IsSet() -} - -// HasName returns a boolean if a field has been set. -func (o *Instance) HasName() bool { - if o != nil && o.Name.IsSet() { - return true - } - - return false -} - -// SetName gets a reference to the given NullableString and assigns it to the Name field. -func (o *Instance) SetName(v string) { - o.Name.Set(&v) -} - -// SetNameNil sets the value for Name to be an explicit nil -func (o *Instance) SetNameNil() { - o.Name.Set(nil) -} - -// UnsetName ensures that no value is present for Name, not even an explicit nil -func (o *Instance) UnsetName() { - o.Name.Unset() -} - -// GetIp returns the Ip field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Instance) GetIp() string { - if o == nil || IsNil(o.Ip.Get()) { - var ret string - return ret - } - return *o.Ip.Get() -} - -// GetIpOk returns a tuple with the Ip field value if set, nil otherwise -// and a boolean to check if the value has been set. -// NOTE: If the value is an explicit nil, `nil, true` will be returned -func (o *Instance) GetIpOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Ip.Get(), o.Ip.IsSet() -} - -// HasIp returns a boolean if a field has been set. -func (o *Instance) HasIp() bool { - if o != nil && o.Ip.IsSet() { - return true - } - - return false -} - -// SetIp gets a reference to the given NullableString and assigns it to the Ip field. -func (o *Instance) SetIp(v string) { - o.Ip.Set(&v) -} - -// SetIpNil sets the value for Ip to be an explicit nil -func (o *Instance) SetIpNil() { - o.Ip.Set(nil) -} - -// UnsetIp ensures that no value is present for Ip, not even an explicit nil -func (o *Instance) UnsetIp() { - o.Ip.Unset() -} - -// GetPrivateIp returns the PrivateIp field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Instance) GetPrivateIp() string { - if o == nil || IsNil(o.PrivateIp.Get()) { - var ret string - return ret - } - return *o.PrivateIp.Get() -} - -// GetPrivateIpOk returns a tuple with the PrivateIp field value if set, nil otherwise -// and a boolean to check if the value has been set. -// NOTE: If the value is an explicit nil, `nil, true` will be returned -func (o *Instance) GetPrivateIpOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.PrivateIp.Get(), o.PrivateIp.IsSet() -} - -// HasPrivateIp returns a boolean if a field has been set. -func (o *Instance) HasPrivateIp() bool { - if o != nil && o.PrivateIp.IsSet() { - return true - } - - return false -} - -// SetPrivateIp gets a reference to the given NullableString and assigns it to the PrivateIp field. -func (o *Instance) SetPrivateIp(v string) { - o.PrivateIp.Set(&v) -} - -// SetPrivateIpNil sets the value for PrivateIp to be an explicit nil -func (o *Instance) SetPrivateIpNil() { - o.PrivateIp.Set(nil) -} - -// UnsetPrivateIp ensures that no value is present for PrivateIp, not even an explicit nil -func (o *Instance) UnsetPrivateIp() { - o.PrivateIp.Unset() -} - -// GetStatus returns the Status field value -func (o *Instance) GetStatus() string { - if o == nil { - var ret string - return ret - } - - return o.Status -} - -// GetStatusOk returns a tuple with the Status field value -// and a boolean to check if the value has been set. -func (o *Instance) GetStatusOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Status, true -} - -// SetStatus sets field value -func (o *Instance) SetStatus(v string) { - o.Status = v -} - -// GetSshKeyNames returns the SshKeyNames field value -func (o *Instance) GetSshKeyNames() []string { - if o == nil { - var ret []string - return ret - } - - return o.SshKeyNames -} - -// GetSshKeyNamesOk returns a tuple with the SshKeyNames field value -// and a boolean to check if the value has been set. -func (o *Instance) GetSshKeyNamesOk() ([]string, bool) { - if o == nil { - return nil, false - } - return o.SshKeyNames, true -} - -// SetSshKeyNames sets field value -func (o *Instance) SetSshKeyNames(v []string) { - o.SshKeyNames = v -} - -// GetFileSystemNames returns the FileSystemNames field value -func (o *Instance) GetFileSystemNames() []string { - if o == nil { - var ret []string - return ret - } - - return o.FileSystemNames -} - -// GetFileSystemNamesOk returns a tuple with the FileSystemNames field value -// and a boolean to check if the value has been set. -func (o *Instance) GetFileSystemNamesOk() ([]string, bool) { - if o == nil { - return nil, false - } - return o.FileSystemNames, true -} - -// SetFileSystemNames sets field value -func (o *Instance) SetFileSystemNames(v []string) { - o.FileSystemNames = v -} - -// GetRegion returns the Region field value if set, zero value otherwise. -func (o *Instance) GetRegion() Region { - if o == nil || IsNil(o.Region) { - var ret Region - return ret - } - return *o.Region -} - -// GetRegionOk returns a tuple with the Region field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Instance) GetRegionOk() (*Region, bool) { - if o == nil || IsNil(o.Region) { - return nil, false - } - return o.Region, true -} - -// HasRegion returns a boolean if a field has been set. -func (o *Instance) HasRegion() bool { - if o != nil && !IsNil(o.Region) { - return true - } - - return false -} - -// SetRegion gets a reference to the given Region and assigns it to the Region field. -func (o *Instance) SetRegion(v Region) { - o.Region = &v -} - -// GetInstanceType returns the InstanceType field value if set, zero value otherwise. -func (o *Instance) GetInstanceType() InstanceType { - if o == nil || IsNil(o.InstanceType) { - var ret InstanceType - return ret - } - return *o.InstanceType -} - -// GetInstanceTypeOk returns a tuple with the InstanceType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Instance) GetInstanceTypeOk() (*InstanceType, bool) { - if o == nil || IsNil(o.InstanceType) { - return nil, false - } - return o.InstanceType, true -} - -// HasInstanceType returns a boolean if a field has been set. -func (o *Instance) HasInstanceType() bool { - if o != nil && !IsNil(o.InstanceType) { - return true - } - - return false -} - -// SetInstanceType gets a reference to the given InstanceType and assigns it to the InstanceType field. -func (o *Instance) SetInstanceType(v InstanceType) { - o.InstanceType = &v -} - -// GetHostname returns the Hostname field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Instance) GetHostname() string { - if o == nil || IsNil(o.Hostname.Get()) { - var ret string - return ret - } - return *o.Hostname.Get() -} - -// GetHostnameOk returns a tuple with the Hostname field value if set, nil otherwise -// and a boolean to check if the value has been set. -// NOTE: If the value is an explicit nil, `nil, true` will be returned -func (o *Instance) GetHostnameOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Hostname.Get(), o.Hostname.IsSet() -} - -// HasHostname returns a boolean if a field has been set. -func (o *Instance) HasHostname() bool { - if o != nil && o.Hostname.IsSet() { - return true - } - - return false -} - -// SetHostname gets a reference to the given NullableString and assigns it to the Hostname field. -func (o *Instance) SetHostname(v string) { - o.Hostname.Set(&v) -} - -// SetHostnameNil sets the value for Hostname to be an explicit nil -func (o *Instance) SetHostnameNil() { - o.Hostname.Set(nil) -} - -// UnsetHostname ensures that no value is present for Hostname, not even an explicit nil -func (o *Instance) UnsetHostname() { - o.Hostname.Unset() -} - -// GetJupyterToken returns the JupyterToken field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Instance) GetJupyterToken() string { - if o == nil || IsNil(o.JupyterToken.Get()) { - var ret string - return ret - } - return *o.JupyterToken.Get() -} - -// GetJupyterTokenOk returns a tuple with the JupyterToken field value if set, nil otherwise -// and a boolean to check if the value has been set. -// NOTE: If the value is an explicit nil, `nil, true` will be returned -func (o *Instance) GetJupyterTokenOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.JupyterToken.Get(), o.JupyterToken.IsSet() -} - -// HasJupyterToken returns a boolean if a field has been set. -func (o *Instance) HasJupyterToken() bool { - if o != nil && o.JupyterToken.IsSet() { - return true - } - - return false -} - -// SetJupyterToken gets a reference to the given NullableString and assigns it to the JupyterToken field. -func (o *Instance) SetJupyterToken(v string) { - o.JupyterToken.Set(&v) -} - -// SetJupyterTokenNil sets the value for JupyterToken to be an explicit nil -func (o *Instance) SetJupyterTokenNil() { - o.JupyterToken.Set(nil) -} - -// UnsetJupyterToken ensures that no value is present for JupyterToken, not even an explicit nil -func (o *Instance) UnsetJupyterToken() { - o.JupyterToken.Unset() -} - -// GetJupyterUrl returns the JupyterUrl field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Instance) GetJupyterUrl() string { - if o == nil || IsNil(o.JupyterUrl.Get()) { - var ret string - return ret - } - return *o.JupyterUrl.Get() -} - -// GetJupyterUrlOk returns a tuple with the JupyterUrl field value if set, nil otherwise -// and a boolean to check if the value has been set. -// NOTE: If the value is an explicit nil, `nil, true` will be returned -func (o *Instance) GetJupyterUrlOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.JupyterUrl.Get(), o.JupyterUrl.IsSet() -} - -// HasJupyterUrl returns a boolean if a field has been set. -func (o *Instance) HasJupyterUrl() bool { - if o != nil && o.JupyterUrl.IsSet() { - return true - } - - return false -} - -// SetJupyterUrl gets a reference to the given NullableString and assigns it to the JupyterUrl field. -func (o *Instance) SetJupyterUrl(v string) { - o.JupyterUrl.Set(&v) -} - -// SetJupyterUrlNil sets the value for JupyterUrl to be an explicit nil -func (o *Instance) SetJupyterUrlNil() { - o.JupyterUrl.Set(nil) -} - -// UnsetJupyterUrl ensures that no value is present for JupyterUrl, not even an explicit nil -func (o *Instance) UnsetJupyterUrl() { - o.JupyterUrl.Unset() -} - -// GetIsReserved returns the IsReserved field value if set, zero value otherwise. -func (o *Instance) GetIsReserved() bool { - if o == nil || IsNil(o.IsReserved) { - var ret bool - return ret - } - return *o.IsReserved -} - -// GetIsReservedOk returns a tuple with the IsReserved field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Instance) GetIsReservedOk() (*bool, bool) { - if o == nil || IsNil(o.IsReserved) { - return nil, false - } - return o.IsReserved, true -} - -// HasIsReserved returns a boolean if a field has been set. -func (o *Instance) HasIsReserved() bool { - if o != nil && !IsNil(o.IsReserved) { - return true - } - - return false -} - -// SetIsReserved gets a reference to the given bool and assigns it to the IsReserved field. -func (o *Instance) SetIsReserved(v bool) { - o.IsReserved = &v -} - -func (o Instance) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o Instance) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["id"] = o.Id - if o.Name.IsSet() { - toSerialize["name"] = o.Name.Get() - } - if o.Ip.IsSet() { - toSerialize["ip"] = o.Ip.Get() - } - if o.PrivateIp.IsSet() { - toSerialize["private_ip"] = o.PrivateIp.Get() - } - toSerialize["status"] = o.Status - toSerialize["ssh_key_names"] = o.SshKeyNames - toSerialize["file_system_names"] = o.FileSystemNames - if !IsNil(o.Region) { - toSerialize["region"] = o.Region - } - if !IsNil(o.InstanceType) { - toSerialize["instance_type"] = o.InstanceType - } - if o.Hostname.IsSet() { - toSerialize["hostname"] = o.Hostname.Get() - } - if o.JupyterToken.IsSet() { - toSerialize["jupyter_token"] = o.JupyterToken.Get() - } - if o.JupyterUrl.IsSet() { - toSerialize["jupyter_url"] = o.JupyterUrl.Get() - } - if !IsNil(o.IsReserved) { - toSerialize["is_reserved"] = o.IsReserved - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *Instance) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "id", - "status", - "ssh_key_names", - "file_system_names", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varInstance := _Instance{} - - err = json.Unmarshal(data, &varInstance) - - if err != nil { - return err - } - - *o = Instance(varInstance) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "id") - delete(additionalProperties, "name") - delete(additionalProperties, "ip") - delete(additionalProperties, "private_ip") - delete(additionalProperties, "status") - delete(additionalProperties, "ssh_key_names") - delete(additionalProperties, "file_system_names") - delete(additionalProperties, "region") - delete(additionalProperties, "instance_type") - delete(additionalProperties, "hostname") - delete(additionalProperties, "jupyter_token") - delete(additionalProperties, "jupyter_url") - delete(additionalProperties, "is_reserved") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableInstance struct { - value *Instance - isSet bool -} - -func (v NullableInstance) Get() *Instance { - return v.value -} - -func (v *NullableInstance) Set(val *Instance) { - v.value = val - v.isSet = true -} - -func (v NullableInstance) IsSet() bool { - return v.isSet -} - -func (v *NullableInstance) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableInstance(val *Instance) *NullableInstance { - return &NullableInstance{value: val, isSet: true} -} - -func (v NullableInstance) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableInstance) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_instance_type.go b/v1/providers/lambdalabs/gen/lambdalabs/model_instance_type.go deleted file mode 100644 index 89d4cf94..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_instance_type.go +++ /dev/null @@ -1,272 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the InstanceType type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &InstanceType{} - -// InstanceType Hardware configuration and pricing of an instance type -type InstanceType struct { - // Name of an instance type - Name string `json:"name"` - // Long name of the instance type - Description string `json:"description"` - // Description of the GPU(s) in the instance type - GpuDescription string `json:"gpu_description"` - // Price of the instance type, in US cents per hour - PriceCentsPerHour int32 `json:"price_cents_per_hour"` - Specs InstanceTypeSpecs `json:"specs"` -} - -type _InstanceType InstanceType - -// NewInstanceType instantiates a new InstanceType object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewInstanceType(name string, description string, gpuDescription string, priceCentsPerHour int32, specs InstanceTypeSpecs) *InstanceType { - this := InstanceType{} - this.Name = name - this.Description = description - this.GpuDescription = gpuDescription - this.PriceCentsPerHour = priceCentsPerHour - this.Specs = specs - return &this -} - -// NewInstanceTypeWithDefaults instantiates a new InstanceType object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewInstanceTypeWithDefaults() *InstanceType { - this := InstanceType{} - return &this -} - -// GetName returns the Name field value -func (o *InstanceType) GetName() string { - if o == nil { - var ret string - return ret - } - - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *InstanceType) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value -func (o *InstanceType) SetName(v string) { - o.Name = v -} - -// GetDescription returns the Description field value -func (o *InstanceType) GetDescription() string { - if o == nil { - var ret string - return ret - } - - return o.Description -} - -// GetDescriptionOk returns a tuple with the Description field value -// and a boolean to check if the value has been set. -func (o *InstanceType) GetDescriptionOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Description, true -} - -// SetDescription sets field value -func (o *InstanceType) SetDescription(v string) { - o.Description = v -} - -// GetGpuDescription returns the GpuDescription field value -func (o *InstanceType) GetGpuDescription() string { - if o == nil { - var ret string - return ret - } - - return o.GpuDescription -} - -// GetGpuDescriptionOk returns a tuple with the GpuDescription field value -// and a boolean to check if the value has been set. -func (o *InstanceType) GetGpuDescriptionOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.GpuDescription, true -} - -// SetGpuDescription sets field value -func (o *InstanceType) SetGpuDescription(v string) { - o.GpuDescription = v -} - -// GetPriceCentsPerHour returns the PriceCentsPerHour field value -func (o *InstanceType) GetPriceCentsPerHour() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.PriceCentsPerHour -} - -// GetPriceCentsPerHourOk returns a tuple with the PriceCentsPerHour field value -// and a boolean to check if the value has been set. -func (o *InstanceType) GetPriceCentsPerHourOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.PriceCentsPerHour, true -} - -// SetPriceCentsPerHour sets field value -func (o *InstanceType) SetPriceCentsPerHour(v int32) { - o.PriceCentsPerHour = v -} - -// GetSpecs returns the Specs field value -func (o *InstanceType) GetSpecs() InstanceTypeSpecs { - if o == nil { - var ret InstanceTypeSpecs - return ret - } - - return o.Specs -} - -// GetSpecsOk returns a tuple with the Specs field value -// and a boolean to check if the value has been set. -func (o *InstanceType) GetSpecsOk() (*InstanceTypeSpecs, bool) { - if o == nil { - return nil, false - } - return &o.Specs, true -} - -// SetSpecs sets field value -func (o *InstanceType) SetSpecs(v InstanceTypeSpecs) { - o.Specs = v -} - -func (o InstanceType) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o InstanceType) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["name"] = o.Name - toSerialize["description"] = o.Description - toSerialize["gpu_description"] = o.GpuDescription - toSerialize["price_cents_per_hour"] = o.PriceCentsPerHour - toSerialize["specs"] = o.Specs - return toSerialize, nil -} - -func (o *InstanceType) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "name", - "description", - "gpu_description", - "price_cents_per_hour", - "specs", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varInstanceType := _InstanceType{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varInstanceType) - - if err != nil { - return err - } - - *o = InstanceType(varInstanceType) - - return err -} - -type NullableInstanceType struct { - value *InstanceType - isSet bool -} - -func (v NullableInstanceType) Get() *InstanceType { - return v.value -} - -func (v *NullableInstanceType) Set(val *InstanceType) { - v.value = val - v.isSet = true -} - -func (v NullableInstanceType) IsSet() bool { - return v.isSet -} - -func (v *NullableInstanceType) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableInstanceType(val *InstanceType) *NullableInstanceType { - return &NullableInstanceType{value: val, isSet: true} -} - -func (v NullableInstanceType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableInstanceType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_instance_type_specs.go b/v1/providers/lambdalabs/gen/lambdalabs/model_instance_type_specs.go deleted file mode 100644 index fee56dda..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_instance_type_specs.go +++ /dev/null @@ -1,244 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the InstanceTypeSpecs type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &InstanceTypeSpecs{} - -// InstanceTypeSpecs struct for InstanceTypeSpecs -type InstanceTypeSpecs struct { - // Number of virtual CPUs - Vcpus int32 `json:"vcpus"` - // Amount of RAM, in gibibytes (GiB) - MemoryGib int32 `json:"memory_gib"` - // Amount of storage, in gibibytes (GiB). - StorageGib int32 `json:"storage_gib"` - // Number of GPUs - Gpus int32 `json:"gpus"` -} - -type _InstanceTypeSpecs InstanceTypeSpecs - -// NewInstanceTypeSpecs instantiates a new InstanceTypeSpecs object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewInstanceTypeSpecs(vcpus int32, memoryGib int32, storageGib int32, gpus int32) *InstanceTypeSpecs { - this := InstanceTypeSpecs{} - this.Vcpus = vcpus - this.MemoryGib = memoryGib - this.StorageGib = storageGib - this.Gpus = gpus - return &this -} - -// NewInstanceTypeSpecsWithDefaults instantiates a new InstanceTypeSpecs object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewInstanceTypeSpecsWithDefaults() *InstanceTypeSpecs { - this := InstanceTypeSpecs{} - return &this -} - -// GetVcpus returns the Vcpus field value -func (o *InstanceTypeSpecs) GetVcpus() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.Vcpus -} - -// GetVcpusOk returns a tuple with the Vcpus field value -// and a boolean to check if the value has been set. -func (o *InstanceTypeSpecs) GetVcpusOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.Vcpus, true -} - -// SetVcpus sets field value -func (o *InstanceTypeSpecs) SetVcpus(v int32) { - o.Vcpus = v -} - -// GetMemoryGib returns the MemoryGib field value -func (o *InstanceTypeSpecs) GetMemoryGib() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.MemoryGib -} - -// GetMemoryGibOk returns a tuple with the MemoryGib field value -// and a boolean to check if the value has been set. -func (o *InstanceTypeSpecs) GetMemoryGibOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.MemoryGib, true -} - -// SetMemoryGib sets field value -func (o *InstanceTypeSpecs) SetMemoryGib(v int32) { - o.MemoryGib = v -} - -// GetStorageGib returns the StorageGib field value -func (o *InstanceTypeSpecs) GetStorageGib() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.StorageGib -} - -// GetStorageGibOk returns a tuple with the StorageGib field value -// and a boolean to check if the value has been set. -func (o *InstanceTypeSpecs) GetStorageGibOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.StorageGib, true -} - -// SetStorageGib sets field value -func (o *InstanceTypeSpecs) SetStorageGib(v int32) { - o.StorageGib = v -} - -// GetGpus returns the Gpus field value -func (o *InstanceTypeSpecs) GetGpus() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.Gpus -} - -// GetGpusOk returns a tuple with the Gpus field value -// and a boolean to check if the value has been set. -func (o *InstanceTypeSpecs) GetGpusOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.Gpus, true -} - -// SetGpus sets field value -func (o *InstanceTypeSpecs) SetGpus(v int32) { - o.Gpus = v -} - -func (o InstanceTypeSpecs) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o InstanceTypeSpecs) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["vcpus"] = o.Vcpus - toSerialize["memory_gib"] = o.MemoryGib - toSerialize["storage_gib"] = o.StorageGib - toSerialize["gpus"] = o.Gpus - return toSerialize, nil -} - -func (o *InstanceTypeSpecs) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "vcpus", - "memory_gib", - "storage_gib", - "gpus", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varInstanceTypeSpecs := _InstanceTypeSpecs{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varInstanceTypeSpecs) - - if err != nil { - return err - } - - *o = InstanceTypeSpecs(varInstanceTypeSpecs) - - return err -} - -type NullableInstanceTypeSpecs struct { - value *InstanceTypeSpecs - isSet bool -} - -func (v NullableInstanceTypeSpecs) Get() *InstanceTypeSpecs { - return v.value -} - -func (v *NullableInstanceTypeSpecs) Set(val *InstanceTypeSpecs) { - v.value = val - v.isSet = true -} - -func (v NullableInstanceTypeSpecs) IsSet() bool { - return v.isSet -} - -func (v *NullableInstanceTypeSpecs) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableInstanceTypeSpecs(val *InstanceTypeSpecs) *NullableInstanceTypeSpecs { - return &NullableInstanceTypeSpecs{value: val, isSet: true} -} - -func (v NullableInstanceTypeSpecs) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableInstanceTypeSpecs) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_instance_types_200_response.go b/v1/providers/lambdalabs/gen/lambdalabs/model_instance_types_200_response.go deleted file mode 100644 index 776da7e0..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_instance_types_200_response.go +++ /dev/null @@ -1,157 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the InstanceTypes200Response type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &InstanceTypes200Response{} - -// InstanceTypes200Response struct for InstanceTypes200Response -type InstanceTypes200Response struct { - // Dict of instance_type_name to instance_type and region availability. - Data map[string]InstanceTypes200ResponseDataValue `json:"data"` -} - -type _InstanceTypes200Response InstanceTypes200Response - -// NewInstanceTypes200Response instantiates a new InstanceTypes200Response object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewInstanceTypes200Response(data map[string]InstanceTypes200ResponseDataValue) *InstanceTypes200Response { - this := InstanceTypes200Response{} - this.Data = data - return &this -} - -// NewInstanceTypes200ResponseWithDefaults instantiates a new InstanceTypes200Response object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewInstanceTypes200ResponseWithDefaults() *InstanceTypes200Response { - this := InstanceTypes200Response{} - return &this -} - -// GetData returns the Data field value -func (o *InstanceTypes200Response) GetData() map[string]InstanceTypes200ResponseDataValue { - if o == nil { - var ret map[string]InstanceTypes200ResponseDataValue - return ret - } - - return o.Data -} - -// GetDataOk returns a tuple with the Data field value -// and a boolean to check if the value has been set. -func (o *InstanceTypes200Response) GetDataOk() (*map[string]InstanceTypes200ResponseDataValue, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value -func (o *InstanceTypes200Response) SetData(v map[string]InstanceTypes200ResponseDataValue) { - o.Data = v -} - -func (o InstanceTypes200Response) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o InstanceTypes200Response) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["data"] = o.Data - return toSerialize, nil -} - -func (o *InstanceTypes200Response) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "data", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varInstanceTypes200Response := _InstanceTypes200Response{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varInstanceTypes200Response) - - if err != nil { - return err - } - - *o = InstanceTypes200Response(varInstanceTypes200Response) - - return err -} - -type NullableInstanceTypes200Response struct { - value *InstanceTypes200Response - isSet bool -} - -func (v NullableInstanceTypes200Response) Get() *InstanceTypes200Response { - return v.value -} - -func (v *NullableInstanceTypes200Response) Set(val *InstanceTypes200Response) { - v.value = val - v.isSet = true -} - -func (v NullableInstanceTypes200Response) IsSet() bool { - return v.isSet -} - -func (v *NullableInstanceTypes200Response) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableInstanceTypes200Response(val *InstanceTypes200Response) *NullableInstanceTypes200Response { - return &NullableInstanceTypes200Response{value: val, isSet: true} -} - -func (v NullableInstanceTypes200Response) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableInstanceTypes200Response) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_instance_types_200_response_data_value.go b/v1/providers/lambdalabs/gen/lambdalabs/model_instance_types_200_response_data_value.go deleted file mode 100644 index e3d9c1cd..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_instance_types_200_response_data_value.go +++ /dev/null @@ -1,185 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the InstanceTypes200ResponseDataValue type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &InstanceTypes200ResponseDataValue{} - -// InstanceTypes200ResponseDataValue struct for InstanceTypes200ResponseDataValue -type InstanceTypes200ResponseDataValue struct { - InstanceType InstanceType `json:"instance_type"` - // List of regions, if any, that have this instance type available - RegionsWithCapacityAvailable []Region `json:"regions_with_capacity_available"` -} - -type _InstanceTypes200ResponseDataValue InstanceTypes200ResponseDataValue - -// NewInstanceTypes200ResponseDataValue instantiates a new InstanceTypes200ResponseDataValue object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewInstanceTypes200ResponseDataValue(instanceType InstanceType, regionsWithCapacityAvailable []Region) *InstanceTypes200ResponseDataValue { - this := InstanceTypes200ResponseDataValue{} - this.InstanceType = instanceType - this.RegionsWithCapacityAvailable = regionsWithCapacityAvailable - return &this -} - -// NewInstanceTypes200ResponseDataValueWithDefaults instantiates a new InstanceTypes200ResponseDataValue object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewInstanceTypes200ResponseDataValueWithDefaults() *InstanceTypes200ResponseDataValue { - this := InstanceTypes200ResponseDataValue{} - return &this -} - -// GetInstanceType returns the InstanceType field value -func (o *InstanceTypes200ResponseDataValue) GetInstanceType() InstanceType { - if o == nil { - var ret InstanceType - return ret - } - - return o.InstanceType -} - -// GetInstanceTypeOk returns a tuple with the InstanceType field value -// and a boolean to check if the value has been set. -func (o *InstanceTypes200ResponseDataValue) GetInstanceTypeOk() (*InstanceType, bool) { - if o == nil { - return nil, false - } - return &o.InstanceType, true -} - -// SetInstanceType sets field value -func (o *InstanceTypes200ResponseDataValue) SetInstanceType(v InstanceType) { - o.InstanceType = v -} - -// GetRegionsWithCapacityAvailable returns the RegionsWithCapacityAvailable field value -func (o *InstanceTypes200ResponseDataValue) GetRegionsWithCapacityAvailable() []Region { - if o == nil { - var ret []Region - return ret - } - - return o.RegionsWithCapacityAvailable -} - -// GetRegionsWithCapacityAvailableOk returns a tuple with the RegionsWithCapacityAvailable field value -// and a boolean to check if the value has been set. -func (o *InstanceTypes200ResponseDataValue) GetRegionsWithCapacityAvailableOk() ([]Region, bool) { - if o == nil { - return nil, false - } - return o.RegionsWithCapacityAvailable, true -} - -// SetRegionsWithCapacityAvailable sets field value -func (o *InstanceTypes200ResponseDataValue) SetRegionsWithCapacityAvailable(v []Region) { - o.RegionsWithCapacityAvailable = v -} - -func (o InstanceTypes200ResponseDataValue) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o InstanceTypes200ResponseDataValue) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["instance_type"] = o.InstanceType - toSerialize["regions_with_capacity_available"] = o.RegionsWithCapacityAvailable - return toSerialize, nil -} - -func (o *InstanceTypes200ResponseDataValue) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "instance_type", - "regions_with_capacity_available", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varInstanceTypes200ResponseDataValue := _InstanceTypes200ResponseDataValue{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varInstanceTypes200ResponseDataValue) - - if err != nil { - return err - } - - *o = InstanceTypes200ResponseDataValue(varInstanceTypes200ResponseDataValue) - - return err -} - -type NullableInstanceTypes200ResponseDataValue struct { - value *InstanceTypes200ResponseDataValue - isSet bool -} - -func (v NullableInstanceTypes200ResponseDataValue) Get() *InstanceTypes200ResponseDataValue { - return v.value -} - -func (v *NullableInstanceTypes200ResponseDataValue) Set(val *InstanceTypes200ResponseDataValue) { - v.value = val - v.isSet = true -} - -func (v NullableInstanceTypes200ResponseDataValue) IsSet() bool { - return v.isSet -} - -func (v *NullableInstanceTypes200ResponseDataValue) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableInstanceTypes200ResponseDataValue(val *InstanceTypes200ResponseDataValue) *NullableInstanceTypes200ResponseDataValue { - return &NullableInstanceTypes200ResponseDataValue{value: val, isSet: true} -} - -func (v NullableInstanceTypes200ResponseDataValue) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableInstanceTypes200ResponseDataValue) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_launch_instance_200_response.go b/v1/providers/lambdalabs/gen/lambdalabs/model_launch_instance_200_response.go deleted file mode 100644 index fb73cfab..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_launch_instance_200_response.go +++ /dev/null @@ -1,156 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the LaunchInstance200Response type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &LaunchInstance200Response{} - -// LaunchInstance200Response struct for LaunchInstance200Response -type LaunchInstance200Response struct { - Data LaunchInstance200ResponseData `json:"data"` -} - -type _LaunchInstance200Response LaunchInstance200Response - -// NewLaunchInstance200Response instantiates a new LaunchInstance200Response object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewLaunchInstance200Response(data LaunchInstance200ResponseData) *LaunchInstance200Response { - this := LaunchInstance200Response{} - this.Data = data - return &this -} - -// NewLaunchInstance200ResponseWithDefaults instantiates a new LaunchInstance200Response object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewLaunchInstance200ResponseWithDefaults() *LaunchInstance200Response { - this := LaunchInstance200Response{} - return &this -} - -// GetData returns the Data field value -func (o *LaunchInstance200Response) GetData() LaunchInstance200ResponseData { - if o == nil { - var ret LaunchInstance200ResponseData - return ret - } - - return o.Data -} - -// GetDataOk returns a tuple with the Data field value -// and a boolean to check if the value has been set. -func (o *LaunchInstance200Response) GetDataOk() (*LaunchInstance200ResponseData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value -func (o *LaunchInstance200Response) SetData(v LaunchInstance200ResponseData) { - o.Data = v -} - -func (o LaunchInstance200Response) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o LaunchInstance200Response) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["data"] = o.Data - return toSerialize, nil -} - -func (o *LaunchInstance200Response) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "data", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varLaunchInstance200Response := _LaunchInstance200Response{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varLaunchInstance200Response) - - if err != nil { - return err - } - - *o = LaunchInstance200Response(varLaunchInstance200Response) - - return err -} - -type NullableLaunchInstance200Response struct { - value *LaunchInstance200Response - isSet bool -} - -func (v NullableLaunchInstance200Response) Get() *LaunchInstance200Response { - return v.value -} - -func (v *NullableLaunchInstance200Response) Set(val *LaunchInstance200Response) { - v.value = val - v.isSet = true -} - -func (v NullableLaunchInstance200Response) IsSet() bool { - return v.isSet -} - -func (v *NullableLaunchInstance200Response) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableLaunchInstance200Response(val *LaunchInstance200Response) *NullableLaunchInstance200Response { - return &NullableLaunchInstance200Response{value: val, isSet: true} -} - -func (v NullableLaunchInstance200Response) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableLaunchInstance200Response) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_launch_instance_200_response_data.go b/v1/providers/lambdalabs/gen/lambdalabs/model_launch_instance_200_response_data.go deleted file mode 100644 index 16154f2b..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_launch_instance_200_response_data.go +++ /dev/null @@ -1,157 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the LaunchInstance200ResponseData type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &LaunchInstance200ResponseData{} - -// LaunchInstance200ResponseData struct for LaunchInstance200ResponseData -type LaunchInstance200ResponseData struct { - // The unique identifiers (IDs) of the launched instances. Note: if a quantity was specified, fewer than the requested quantity might have been launched. - InstanceIds []string `json:"instance_ids"` -} - -type _LaunchInstance200ResponseData LaunchInstance200ResponseData - -// NewLaunchInstance200ResponseData instantiates a new LaunchInstance200ResponseData object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewLaunchInstance200ResponseData(instanceIds []string) *LaunchInstance200ResponseData { - this := LaunchInstance200ResponseData{} - this.InstanceIds = instanceIds - return &this -} - -// NewLaunchInstance200ResponseDataWithDefaults instantiates a new LaunchInstance200ResponseData object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewLaunchInstance200ResponseDataWithDefaults() *LaunchInstance200ResponseData { - this := LaunchInstance200ResponseData{} - return &this -} - -// GetInstanceIds returns the InstanceIds field value -func (o *LaunchInstance200ResponseData) GetInstanceIds() []string { - if o == nil { - var ret []string - return ret - } - - return o.InstanceIds -} - -// GetInstanceIdsOk returns a tuple with the InstanceIds field value -// and a boolean to check if the value has been set. -func (o *LaunchInstance200ResponseData) GetInstanceIdsOk() ([]string, bool) { - if o == nil { - return nil, false - } - return o.InstanceIds, true -} - -// SetInstanceIds sets field value -func (o *LaunchInstance200ResponseData) SetInstanceIds(v []string) { - o.InstanceIds = v -} - -func (o LaunchInstance200ResponseData) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o LaunchInstance200ResponseData) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["instance_ids"] = o.InstanceIds - return toSerialize, nil -} - -func (o *LaunchInstance200ResponseData) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "instance_ids", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varLaunchInstance200ResponseData := _LaunchInstance200ResponseData{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varLaunchInstance200ResponseData) - - if err != nil { - return err - } - - *o = LaunchInstance200ResponseData(varLaunchInstance200ResponseData) - - return err -} - -type NullableLaunchInstance200ResponseData struct { - value *LaunchInstance200ResponseData - isSet bool -} - -func (v NullableLaunchInstance200ResponseData) Get() *LaunchInstance200ResponseData { - return v.value -} - -func (v *NullableLaunchInstance200ResponseData) Set(val *LaunchInstance200ResponseData) { - v.value = val - v.isSet = true -} - -func (v NullableLaunchInstance200ResponseData) IsSet() bool { - return v.isSet -} - -func (v *NullableLaunchInstance200ResponseData) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableLaunchInstance200ResponseData(val *LaunchInstance200ResponseData) *NullableLaunchInstance200ResponseData { - return &NullableLaunchInstance200ResponseData{value: val, isSet: true} -} - -func (v NullableLaunchInstance200ResponseData) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableLaunchInstance200ResponseData) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_launch_instance_request.go b/v1/providers/lambdalabs/gen/lambdalabs/model_launch_instance_request.go deleted file mode 100644 index 05c9eabb..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_launch_instance_request.go +++ /dev/null @@ -1,341 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the LaunchInstanceRequest type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &LaunchInstanceRequest{} - -// LaunchInstanceRequest struct for LaunchInstanceRequest -type LaunchInstanceRequest struct { - // Short name of a region - RegionName string `json:"region_name"` - // Name of an instance type - InstanceTypeName string `json:"instance_type_name"` - // Names of the SSH keys to allow access to the instances. Currently, exactly one SSH key must be specified. - SshKeyNames []string `json:"ssh_key_names"` - // Names of the file systems to attach to the instances. Currently, only one (if any) file system may be specified. - FileSystemNames []string `json:"file_system_names,omitempty"` - // Number of instances to launch - Quantity *int32 `json:"quantity,omitempty"` - // User-provided name for the instance - Name NullableString `json:"name,omitempty"` -} - -type _LaunchInstanceRequest LaunchInstanceRequest - -// NewLaunchInstanceRequest instantiates a new LaunchInstanceRequest object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewLaunchInstanceRequest(regionName string, instanceTypeName string, sshKeyNames []string) *LaunchInstanceRequest { - this := LaunchInstanceRequest{} - this.RegionName = regionName - this.InstanceTypeName = instanceTypeName - this.SshKeyNames = sshKeyNames - var quantity int32 = 1 - this.Quantity = &quantity - return &this -} - -// NewLaunchInstanceRequestWithDefaults instantiates a new LaunchInstanceRequest object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewLaunchInstanceRequestWithDefaults() *LaunchInstanceRequest { - this := LaunchInstanceRequest{} - var quantity int32 = 1 - this.Quantity = &quantity - return &this -} - -// GetRegionName returns the RegionName field value -func (o *LaunchInstanceRequest) GetRegionName() string { - if o == nil { - var ret string - return ret - } - - return o.RegionName -} - -// GetRegionNameOk returns a tuple with the RegionName field value -// and a boolean to check if the value has been set. -func (o *LaunchInstanceRequest) GetRegionNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.RegionName, true -} - -// SetRegionName sets field value -func (o *LaunchInstanceRequest) SetRegionName(v string) { - o.RegionName = v -} - -// GetInstanceTypeName returns the InstanceTypeName field value -func (o *LaunchInstanceRequest) GetInstanceTypeName() string { - if o == nil { - var ret string - return ret - } - - return o.InstanceTypeName -} - -// GetInstanceTypeNameOk returns a tuple with the InstanceTypeName field value -// and a boolean to check if the value has been set. -func (o *LaunchInstanceRequest) GetInstanceTypeNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.InstanceTypeName, true -} - -// SetInstanceTypeName sets field value -func (o *LaunchInstanceRequest) SetInstanceTypeName(v string) { - o.InstanceTypeName = v -} - -// GetSshKeyNames returns the SshKeyNames field value -func (o *LaunchInstanceRequest) GetSshKeyNames() []string { - if o == nil { - var ret []string - return ret - } - - return o.SshKeyNames -} - -// GetSshKeyNamesOk returns a tuple with the SshKeyNames field value -// and a boolean to check if the value has been set. -func (o *LaunchInstanceRequest) GetSshKeyNamesOk() ([]string, bool) { - if o == nil { - return nil, false - } - return o.SshKeyNames, true -} - -// SetSshKeyNames sets field value -func (o *LaunchInstanceRequest) SetSshKeyNames(v []string) { - o.SshKeyNames = v -} - -// GetFileSystemNames returns the FileSystemNames field value if set, zero value otherwise. -func (o *LaunchInstanceRequest) GetFileSystemNames() []string { - if o == nil || IsNil(o.FileSystemNames) { - var ret []string - return ret - } - return o.FileSystemNames -} - -// GetFileSystemNamesOk returns a tuple with the FileSystemNames field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LaunchInstanceRequest) GetFileSystemNamesOk() ([]string, bool) { - if o == nil || IsNil(o.FileSystemNames) { - return nil, false - } - return o.FileSystemNames, true -} - -// HasFileSystemNames returns a boolean if a field has been set. -func (o *LaunchInstanceRequest) HasFileSystemNames() bool { - if o != nil && !IsNil(o.FileSystemNames) { - return true - } - - return false -} - -// SetFileSystemNames gets a reference to the given []string and assigns it to the FileSystemNames field. -func (o *LaunchInstanceRequest) SetFileSystemNames(v []string) { - o.FileSystemNames = v -} - -// GetQuantity returns the Quantity field value if set, zero value otherwise. -func (o *LaunchInstanceRequest) GetQuantity() int32 { - if o == nil || IsNil(o.Quantity) { - var ret int32 - return ret - } - return *o.Quantity -} - -// GetQuantityOk returns a tuple with the Quantity field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *LaunchInstanceRequest) GetQuantityOk() (*int32, bool) { - if o == nil || IsNil(o.Quantity) { - return nil, false - } - return o.Quantity, true -} - -// HasQuantity returns a boolean if a field has been set. -func (o *LaunchInstanceRequest) HasQuantity() bool { - if o != nil && !IsNil(o.Quantity) { - return true - } - - return false -} - -// SetQuantity gets a reference to the given int32 and assigns it to the Quantity field. -func (o *LaunchInstanceRequest) SetQuantity(v int32) { - o.Quantity = &v -} - -// GetName returns the Name field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *LaunchInstanceRequest) GetName() string { - if o == nil || IsNil(o.Name.Get()) { - var ret string - return ret - } - return *o.Name.Get() -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -// NOTE: If the value is an explicit nil, `nil, true` will be returned -func (o *LaunchInstanceRequest) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Name.Get(), o.Name.IsSet() -} - -// HasName returns a boolean if a field has been set. -func (o *LaunchInstanceRequest) HasName() bool { - if o != nil && o.Name.IsSet() { - return true - } - - return false -} - -// SetName gets a reference to the given NullableString and assigns it to the Name field. -func (o *LaunchInstanceRequest) SetName(v string) { - o.Name.Set(&v) -} - -// SetNameNil sets the value for Name to be an explicit nil -func (o *LaunchInstanceRequest) SetNameNil() { - o.Name.Set(nil) -} - -// UnsetName ensures that no value is present for Name, not even an explicit nil -func (o *LaunchInstanceRequest) UnsetName() { - o.Name.Unset() -} - -func (o LaunchInstanceRequest) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o LaunchInstanceRequest) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["region_name"] = o.RegionName - toSerialize["instance_type_name"] = o.InstanceTypeName - toSerialize["ssh_key_names"] = o.SshKeyNames - if !IsNil(o.FileSystemNames) { - toSerialize["file_system_names"] = o.FileSystemNames - } - if !IsNil(o.Quantity) { - toSerialize["quantity"] = o.Quantity - } - if o.Name.IsSet() { - toSerialize["name"] = o.Name.Get() - } - return toSerialize, nil -} - -func (o *LaunchInstanceRequest) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "region_name", - "instance_type_name", - "ssh_key_names", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varLaunchInstanceRequest := _LaunchInstanceRequest{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varLaunchInstanceRequest) - - if err != nil { - return err - } - - *o = LaunchInstanceRequest(varLaunchInstanceRequest) - - return err -} - -type NullableLaunchInstanceRequest struct { - value *LaunchInstanceRequest - isSet bool -} - -func (v NullableLaunchInstanceRequest) Get() *LaunchInstanceRequest { - return v.value -} - -func (v *NullableLaunchInstanceRequest) Set(val *LaunchInstanceRequest) { - v.value = val - v.isSet = true -} - -func (v NullableLaunchInstanceRequest) IsSet() bool { - return v.isSet -} - -func (v *NullableLaunchInstanceRequest) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableLaunchInstanceRequest(val *LaunchInstanceRequest) *NullableLaunchInstanceRequest { - return &NullableLaunchInstanceRequest{value: val, isSet: true} -} - -func (v NullableLaunchInstanceRequest) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableLaunchInstanceRequest) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_list_file_systems_200_response.go b/v1/providers/lambdalabs/gen/lambdalabs/model_list_file_systems_200_response.go deleted file mode 100644 index 8ac324ad..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_list_file_systems_200_response.go +++ /dev/null @@ -1,156 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the ListFileSystems200Response type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &ListFileSystems200Response{} - -// ListFileSystems200Response struct for ListFileSystems200Response -type ListFileSystems200Response struct { - Data []FileSystem `json:"data"` -} - -type _ListFileSystems200Response ListFileSystems200Response - -// NewListFileSystems200Response instantiates a new ListFileSystems200Response object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewListFileSystems200Response(data []FileSystem) *ListFileSystems200Response { - this := ListFileSystems200Response{} - this.Data = data - return &this -} - -// NewListFileSystems200ResponseWithDefaults instantiates a new ListFileSystems200Response object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewListFileSystems200ResponseWithDefaults() *ListFileSystems200Response { - this := ListFileSystems200Response{} - return &this -} - -// GetData returns the Data field value -func (o *ListFileSystems200Response) GetData() []FileSystem { - if o == nil { - var ret []FileSystem - return ret - } - - return o.Data -} - -// GetDataOk returns a tuple with the Data field value -// and a boolean to check if the value has been set. -func (o *ListFileSystems200Response) GetDataOk() ([]FileSystem, bool) { - if o == nil { - return nil, false - } - return o.Data, true -} - -// SetData sets field value -func (o *ListFileSystems200Response) SetData(v []FileSystem) { - o.Data = v -} - -func (o ListFileSystems200Response) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o ListFileSystems200Response) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["data"] = o.Data - return toSerialize, nil -} - -func (o *ListFileSystems200Response) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "data", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varListFileSystems200Response := _ListFileSystems200Response{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varListFileSystems200Response) - - if err != nil { - return err - } - - *o = ListFileSystems200Response(varListFileSystems200Response) - - return err -} - -type NullableListFileSystems200Response struct { - value *ListFileSystems200Response - isSet bool -} - -func (v NullableListFileSystems200Response) Get() *ListFileSystems200Response { - return v.value -} - -func (v *NullableListFileSystems200Response) Set(val *ListFileSystems200Response) { - v.value = val - v.isSet = true -} - -func (v NullableListFileSystems200Response) IsSet() bool { - return v.isSet -} - -func (v *NullableListFileSystems200Response) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableListFileSystems200Response(val *ListFileSystems200Response) *NullableListFileSystems200Response { - return &NullableListFileSystems200Response{value: val, isSet: true} -} - -func (v NullableListFileSystems200Response) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableListFileSystems200Response) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_list_instances_200_response.go b/v1/providers/lambdalabs/gen/lambdalabs/model_list_instances_200_response.go deleted file mode 100644 index af9152f8..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_list_instances_200_response.go +++ /dev/null @@ -1,156 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the ListInstances200Response type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &ListInstances200Response{} - -// ListInstances200Response struct for ListInstances200Response -type ListInstances200Response struct { - Data []Instance `json:"data"` -} - -type _ListInstances200Response ListInstances200Response - -// NewListInstances200Response instantiates a new ListInstances200Response object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewListInstances200Response(data []Instance) *ListInstances200Response { - this := ListInstances200Response{} - this.Data = data - return &this -} - -// NewListInstances200ResponseWithDefaults instantiates a new ListInstances200Response object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewListInstances200ResponseWithDefaults() *ListInstances200Response { - this := ListInstances200Response{} - return &this -} - -// GetData returns the Data field value -func (o *ListInstances200Response) GetData() []Instance { - if o == nil { - var ret []Instance - return ret - } - - return o.Data -} - -// GetDataOk returns a tuple with the Data field value -// and a boolean to check if the value has been set. -func (o *ListInstances200Response) GetDataOk() ([]Instance, bool) { - if o == nil { - return nil, false - } - return o.Data, true -} - -// SetData sets field value -func (o *ListInstances200Response) SetData(v []Instance) { - o.Data = v -} - -func (o ListInstances200Response) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o ListInstances200Response) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["data"] = o.Data - return toSerialize, nil -} - -func (o *ListInstances200Response) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "data", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varListInstances200Response := _ListInstances200Response{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varListInstances200Response) - - if err != nil { - return err - } - - *o = ListInstances200Response(varListInstances200Response) - - return err -} - -type NullableListInstances200Response struct { - value *ListInstances200Response - isSet bool -} - -func (v NullableListInstances200Response) Get() *ListInstances200Response { - return v.value -} - -func (v *NullableListInstances200Response) Set(val *ListInstances200Response) { - v.value = val - v.isSet = true -} - -func (v NullableListInstances200Response) IsSet() bool { - return v.isSet -} - -func (v *NullableListInstances200Response) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableListInstances200Response(val *ListInstances200Response) *NullableListInstances200Response { - return &NullableListInstances200Response{value: val, isSet: true} -} - -func (v NullableListInstances200Response) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableListInstances200Response) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_list_ssh_keys_200_response.go b/v1/providers/lambdalabs/gen/lambdalabs/model_list_ssh_keys_200_response.go deleted file mode 100644 index 71c2349c..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_list_ssh_keys_200_response.go +++ /dev/null @@ -1,156 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the ListSSHKeys200Response type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &ListSSHKeys200Response{} - -// ListSSHKeys200Response struct for ListSSHKeys200Response -type ListSSHKeys200Response struct { - Data []SshKey `json:"data"` -} - -type _ListSSHKeys200Response ListSSHKeys200Response - -// NewListSSHKeys200Response instantiates a new ListSSHKeys200Response object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewListSSHKeys200Response(data []SshKey) *ListSSHKeys200Response { - this := ListSSHKeys200Response{} - this.Data = data - return &this -} - -// NewListSSHKeys200ResponseWithDefaults instantiates a new ListSSHKeys200Response object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewListSSHKeys200ResponseWithDefaults() *ListSSHKeys200Response { - this := ListSSHKeys200Response{} - return &this -} - -// GetData returns the Data field value -func (o *ListSSHKeys200Response) GetData() []SshKey { - if o == nil { - var ret []SshKey - return ret - } - - return o.Data -} - -// GetDataOk returns a tuple with the Data field value -// and a boolean to check if the value has been set. -func (o *ListSSHKeys200Response) GetDataOk() ([]SshKey, bool) { - if o == nil { - return nil, false - } - return o.Data, true -} - -// SetData sets field value -func (o *ListSSHKeys200Response) SetData(v []SshKey) { - o.Data = v -} - -func (o ListSSHKeys200Response) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o ListSSHKeys200Response) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["data"] = o.Data - return toSerialize, nil -} - -func (o *ListSSHKeys200Response) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "data", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varListSSHKeys200Response := _ListSSHKeys200Response{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varListSSHKeys200Response) - - if err != nil { - return err - } - - *o = ListSSHKeys200Response(varListSSHKeys200Response) - - return err -} - -type NullableListSSHKeys200Response struct { - value *ListSSHKeys200Response - isSet bool -} - -func (v NullableListSSHKeys200Response) Get() *ListSSHKeys200Response { - return v.value -} - -func (v *NullableListSSHKeys200Response) Set(val *ListSSHKeys200Response) { - v.value = val - v.isSet = true -} - -func (v NullableListSSHKeys200Response) IsSet() bool { - return v.isSet -} - -func (v *NullableListSSHKeys200Response) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableListSSHKeys200Response(val *ListSSHKeys200Response) *NullableListSSHKeys200Response { - return &NullableListSSHKeys200Response{value: val, isSet: true} -} - -func (v NullableListSSHKeys200Response) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableListSSHKeys200Response) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_region.go b/v1/providers/lambdalabs/gen/lambdalabs/model_region.go deleted file mode 100644 index 5eb5e456..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_region.go +++ /dev/null @@ -1,186 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the Region type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &Region{} - -// Region struct for Region -type Region struct { - // Short name of a region - Name string `json:"name"` - // Long name of a region - Description string `json:"description"` -} - -type _Region Region - -// NewRegion instantiates a new Region object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewRegion(name string, description string) *Region { - this := Region{} - this.Name = name - this.Description = description - return &this -} - -// NewRegionWithDefaults instantiates a new Region object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewRegionWithDefaults() *Region { - this := Region{} - return &this -} - -// GetName returns the Name field value -func (o *Region) GetName() string { - if o == nil { - var ret string - return ret - } - - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *Region) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value -func (o *Region) SetName(v string) { - o.Name = v -} - -// GetDescription returns the Description field value -func (o *Region) GetDescription() string { - if o == nil { - var ret string - return ret - } - - return o.Description -} - -// GetDescriptionOk returns a tuple with the Description field value -// and a boolean to check if the value has been set. -func (o *Region) GetDescriptionOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Description, true -} - -// SetDescription sets field value -func (o *Region) SetDescription(v string) { - o.Description = v -} - -func (o Region) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o Region) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["name"] = o.Name - toSerialize["description"] = o.Description - return toSerialize, nil -} - -func (o *Region) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "name", - "description", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varRegion := _Region{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varRegion) - - if err != nil { - return err - } - - *o = Region(varRegion) - - return err -} - -type NullableRegion struct { - value *Region - isSet bool -} - -func (v NullableRegion) Get() *Region { - return v.value -} - -func (v *NullableRegion) Set(val *Region) { - v.value = val - v.isSet = true -} - -func (v NullableRegion) IsSet() bool { - return v.isSet -} - -func (v *NullableRegion) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableRegion(val *Region) *NullableRegion { - return &NullableRegion{value: val, isSet: true} -} - -func (v NullableRegion) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableRegion) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_restart_instance_200_response.go b/v1/providers/lambdalabs/gen/lambdalabs/model_restart_instance_200_response.go deleted file mode 100644 index 6dd3e052..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_restart_instance_200_response.go +++ /dev/null @@ -1,156 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the RestartInstance200Response type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &RestartInstance200Response{} - -// RestartInstance200Response struct for RestartInstance200Response -type RestartInstance200Response struct { - Data RestartInstance200ResponseData `json:"data"` -} - -type _RestartInstance200Response RestartInstance200Response - -// NewRestartInstance200Response instantiates a new RestartInstance200Response object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewRestartInstance200Response(data RestartInstance200ResponseData) *RestartInstance200Response { - this := RestartInstance200Response{} - this.Data = data - return &this -} - -// NewRestartInstance200ResponseWithDefaults instantiates a new RestartInstance200Response object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewRestartInstance200ResponseWithDefaults() *RestartInstance200Response { - this := RestartInstance200Response{} - return &this -} - -// GetData returns the Data field value -func (o *RestartInstance200Response) GetData() RestartInstance200ResponseData { - if o == nil { - var ret RestartInstance200ResponseData - return ret - } - - return o.Data -} - -// GetDataOk returns a tuple with the Data field value -// and a boolean to check if the value has been set. -func (o *RestartInstance200Response) GetDataOk() (*RestartInstance200ResponseData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value -func (o *RestartInstance200Response) SetData(v RestartInstance200ResponseData) { - o.Data = v -} - -func (o RestartInstance200Response) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o RestartInstance200Response) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["data"] = o.Data - return toSerialize, nil -} - -func (o *RestartInstance200Response) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "data", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varRestartInstance200Response := _RestartInstance200Response{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varRestartInstance200Response) - - if err != nil { - return err - } - - *o = RestartInstance200Response(varRestartInstance200Response) - - return err -} - -type NullableRestartInstance200Response struct { - value *RestartInstance200Response - isSet bool -} - -func (v NullableRestartInstance200Response) Get() *RestartInstance200Response { - return v.value -} - -func (v *NullableRestartInstance200Response) Set(val *RestartInstance200Response) { - v.value = val - v.isSet = true -} - -func (v NullableRestartInstance200Response) IsSet() bool { - return v.isSet -} - -func (v *NullableRestartInstance200Response) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableRestartInstance200Response(val *RestartInstance200Response) *NullableRestartInstance200Response { - return &NullableRestartInstance200Response{value: val, isSet: true} -} - -func (v NullableRestartInstance200Response) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableRestartInstance200Response) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_restart_instance_200_response_data.go b/v1/providers/lambdalabs/gen/lambdalabs/model_restart_instance_200_response_data.go deleted file mode 100644 index aef3e1b5..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_restart_instance_200_response_data.go +++ /dev/null @@ -1,157 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the RestartInstance200ResponseData type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &RestartInstance200ResponseData{} - -// RestartInstance200ResponseData struct for RestartInstance200ResponseData -type RestartInstance200ResponseData struct { - // List of instances that were restarted. Note: this list might not contain all instances requested to be restarted. - RestartedInstances []Instance `json:"restarted_instances"` -} - -type _RestartInstance200ResponseData RestartInstance200ResponseData - -// NewRestartInstance200ResponseData instantiates a new RestartInstance200ResponseData object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewRestartInstance200ResponseData(restartedInstances []Instance) *RestartInstance200ResponseData { - this := RestartInstance200ResponseData{} - this.RestartedInstances = restartedInstances - return &this -} - -// NewRestartInstance200ResponseDataWithDefaults instantiates a new RestartInstance200ResponseData object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewRestartInstance200ResponseDataWithDefaults() *RestartInstance200ResponseData { - this := RestartInstance200ResponseData{} - return &this -} - -// GetRestartedInstances returns the RestartedInstances field value -func (o *RestartInstance200ResponseData) GetRestartedInstances() []Instance { - if o == nil { - var ret []Instance - return ret - } - - return o.RestartedInstances -} - -// GetRestartedInstancesOk returns a tuple with the RestartedInstances field value -// and a boolean to check if the value has been set. -func (o *RestartInstance200ResponseData) GetRestartedInstancesOk() ([]Instance, bool) { - if o == nil { - return nil, false - } - return o.RestartedInstances, true -} - -// SetRestartedInstances sets field value -func (o *RestartInstance200ResponseData) SetRestartedInstances(v []Instance) { - o.RestartedInstances = v -} - -func (o RestartInstance200ResponseData) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o RestartInstance200ResponseData) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["restarted_instances"] = o.RestartedInstances - return toSerialize, nil -} - -func (o *RestartInstance200ResponseData) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "restarted_instances", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varRestartInstance200ResponseData := _RestartInstance200ResponseData{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varRestartInstance200ResponseData) - - if err != nil { - return err - } - - *o = RestartInstance200ResponseData(varRestartInstance200ResponseData) - - return err -} - -type NullableRestartInstance200ResponseData struct { - value *RestartInstance200ResponseData - isSet bool -} - -func (v NullableRestartInstance200ResponseData) Get() *RestartInstance200ResponseData { - return v.value -} - -func (v *NullableRestartInstance200ResponseData) Set(val *RestartInstance200ResponseData) { - v.value = val - v.isSet = true -} - -func (v NullableRestartInstance200ResponseData) IsSet() bool { - return v.isSet -} - -func (v *NullableRestartInstance200ResponseData) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableRestartInstance200ResponseData(val *RestartInstance200ResponseData) *NullableRestartInstance200ResponseData { - return &NullableRestartInstance200ResponseData{value: val, isSet: true} -} - -func (v NullableRestartInstance200ResponseData) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableRestartInstance200ResponseData) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_restart_instance_request.go b/v1/providers/lambdalabs/gen/lambdalabs/model_restart_instance_request.go deleted file mode 100644 index d1031311..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_restart_instance_request.go +++ /dev/null @@ -1,157 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the RestartInstanceRequest type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &RestartInstanceRequest{} - -// RestartInstanceRequest struct for RestartInstanceRequest -type RestartInstanceRequest struct { - // The unique identifiers (IDs) of the instances to restart - InstanceIds []string `json:"instance_ids"` -} - -type _RestartInstanceRequest RestartInstanceRequest - -// NewRestartInstanceRequest instantiates a new RestartInstanceRequest object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewRestartInstanceRequest(instanceIds []string) *RestartInstanceRequest { - this := RestartInstanceRequest{} - this.InstanceIds = instanceIds - return &this -} - -// NewRestartInstanceRequestWithDefaults instantiates a new RestartInstanceRequest object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewRestartInstanceRequestWithDefaults() *RestartInstanceRequest { - this := RestartInstanceRequest{} - return &this -} - -// GetInstanceIds returns the InstanceIds field value -func (o *RestartInstanceRequest) GetInstanceIds() []string { - if o == nil { - var ret []string - return ret - } - - return o.InstanceIds -} - -// GetInstanceIdsOk returns a tuple with the InstanceIds field value -// and a boolean to check if the value has been set. -func (o *RestartInstanceRequest) GetInstanceIdsOk() ([]string, bool) { - if o == nil { - return nil, false - } - return o.InstanceIds, true -} - -// SetInstanceIds sets field value -func (o *RestartInstanceRequest) SetInstanceIds(v []string) { - o.InstanceIds = v -} - -func (o RestartInstanceRequest) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o RestartInstanceRequest) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["instance_ids"] = o.InstanceIds - return toSerialize, nil -} - -func (o *RestartInstanceRequest) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "instance_ids", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varRestartInstanceRequest := _RestartInstanceRequest{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varRestartInstanceRequest) - - if err != nil { - return err - } - - *o = RestartInstanceRequest(varRestartInstanceRequest) - - return err -} - -type NullableRestartInstanceRequest struct { - value *RestartInstanceRequest - isSet bool -} - -func (v NullableRestartInstanceRequest) Get() *RestartInstanceRequest { - return v.value -} - -func (v *NullableRestartInstanceRequest) Set(val *RestartInstanceRequest) { - v.value = val - v.isSet = true -} - -func (v NullableRestartInstanceRequest) IsSet() bool { - return v.isSet -} - -func (v *NullableRestartInstanceRequest) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableRestartInstanceRequest(val *RestartInstanceRequest) *NullableRestartInstanceRequest { - return &NullableRestartInstanceRequest{value: val, isSet: true} -} - -func (v NullableRestartInstanceRequest) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableRestartInstanceRequest) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_ssh_key.go b/v1/providers/lambdalabs/gen/lambdalabs/model_ssh_key.go deleted file mode 100644 index 78260189..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_ssh_key.go +++ /dev/null @@ -1,268 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the SshKey type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &SshKey{} - -// SshKey Information about a stored SSH key, which can be used to access instances over SSH -type SshKey struct { - // Unique identifier (ID) of an SSH key - Id string `json:"id"` - // Name of the SSH key - Name string `json:"name"` - // Public key for the SSH key - PublicKey string `json:"public_key"` - // Private key for the SSH key. Only returned when generating a new key pair. - PrivateKey NullableString `json:"private_key,omitempty"` - // Workspace ID associated with the SSH key. - WorkspaceId *string `json:"workspace_id,omitempty"` -} - -type _SshKey SshKey - -// NewSshKey instantiates a new SshKey object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewSshKey(id string, name string, publicKey string) *SshKey { - this := SshKey{} - this.Id = id - this.Name = name - this.PublicKey = publicKey - return &this -} - -// NewSshKeyWithDefaults instantiates a new SshKey object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewSshKeyWithDefaults() *SshKey { - this := SshKey{} - return &this -} - -// GetId returns the Id field value -func (o *SshKey) GetId() string { - if o == nil { - var ret string - return ret - } - - return o.Id -} - -// GetIdOk returns a tuple with the Id field value -// and a boolean to check if the value has been set. -func (o *SshKey) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value -func (o *SshKey) SetId(v string) { - o.Id = v -} - -// GetName returns the Name field value -func (o *SshKey) GetName() string { - if o == nil { - var ret string - return ret - } - - return o.Name -} - -// GetNameOk returns a tuple with the Name field value -// and a boolean to check if the value has been set. -func (o *SshKey) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Name, true -} - -// SetName sets field value -func (o *SshKey) SetName(v string) { - o.Name = v -} - -// GetPublicKey returns the PublicKey field value -func (o *SshKey) GetPublicKey() string { - if o == nil { - var ret string - return ret - } - - return o.PublicKey -} - -// GetPublicKeyOk returns a tuple with the PublicKey field value -// and a boolean to check if the value has been set. -func (o *SshKey) GetPublicKeyOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.PublicKey, true -} - -// SetPublicKey sets field value -func (o *SshKey) SetPublicKey(v string) { - o.PublicKey = v -} - -// GetPrivateKey returns the PrivateKey field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *SshKey) GetPrivateKey() string { - if o == nil || IsNil(o.PrivateKey.Get()) { - var ret string - return ret - } - return *o.PrivateKey.Get() -} - -// GetPrivateKeyOk returns a tuple with the PrivateKey field value if set, nil otherwise -// and a boolean to check if the value has been set. -// NOTE: If the value is an explicit nil, `nil, true` will be returned -func (o *SshKey) GetPrivateKeyOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.PrivateKey.Get(), o.PrivateKey.IsSet() -} - -// HasPrivateKey returns a boolean if a field has been set. -func (o *SshKey) HasPrivateKey() bool { - if o != nil && o.PrivateKey.IsSet() { - return true - } - - return false -} - -// SetPrivateKey gets a reference to the given NullableString and assigns it to the PrivateKey field. -func (o *SshKey) SetPrivateKey(v string) { - o.PrivateKey.Set(&v) -} - -// SetPrivateKeyNil sets the value for PrivateKey to be an explicit nil -func (o *SshKey) SetPrivateKeyNil() { - o.PrivateKey.Set(nil) -} - -// UnsetPrivateKey ensures that no value is present for PrivateKey, not even an explicit nil -func (o *SshKey) UnsetPrivateKey() { - o.PrivateKey.Unset() -} - -func (o SshKey) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o SshKey) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["id"] = o.Id - toSerialize["name"] = o.Name - toSerialize["public_key"] = o.PublicKey - if o.PrivateKey.IsSet() { - toSerialize["private_key"] = o.PrivateKey.Get() - } - if !IsNil(o.WorkspaceId) { - toSerialize["workspace_id"] = o.WorkspaceId - } - return toSerialize, nil -} - -func (o *SshKey) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "id", - "name", - "public_key", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varSshKey := _SshKey{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varSshKey) - - if err != nil { - return err - } - - *o = SshKey(varSshKey) - - return err -} - -type NullableSshKey struct { - value *SshKey - isSet bool -} - -func (v NullableSshKey) Get() *SshKey { - return v.value -} - -func (v *NullableSshKey) Set(val *SshKey) { - v.value = val - v.isSet = true -} - -func (v NullableSshKey) IsSet() bool { - return v.isSet -} - -func (v *NullableSshKey) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableSshKey(val *SshKey) *NullableSshKey { - return &NullableSshKey{value: val, isSet: true} -} - -func (v NullableSshKey) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableSshKey) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_terminate_instance_200_response.go b/v1/providers/lambdalabs/gen/lambdalabs/model_terminate_instance_200_response.go deleted file mode 100644 index cc314177..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_terminate_instance_200_response.go +++ /dev/null @@ -1,156 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the TerminateInstance200Response type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &TerminateInstance200Response{} - -// TerminateInstance200Response struct for TerminateInstance200Response -type TerminateInstance200Response struct { - Data TerminateInstance200ResponseData `json:"data"` -} - -type _TerminateInstance200Response TerminateInstance200Response - -// NewTerminateInstance200Response instantiates a new TerminateInstance200Response object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewTerminateInstance200Response(data TerminateInstance200ResponseData) *TerminateInstance200Response { - this := TerminateInstance200Response{} - this.Data = data - return &this -} - -// NewTerminateInstance200ResponseWithDefaults instantiates a new TerminateInstance200Response object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewTerminateInstance200ResponseWithDefaults() *TerminateInstance200Response { - this := TerminateInstance200Response{} - return &this -} - -// GetData returns the Data field value -func (o *TerminateInstance200Response) GetData() TerminateInstance200ResponseData { - if o == nil { - var ret TerminateInstance200ResponseData - return ret - } - - return o.Data -} - -// GetDataOk returns a tuple with the Data field value -// and a boolean to check if the value has been set. -func (o *TerminateInstance200Response) GetDataOk() (*TerminateInstance200ResponseData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value -func (o *TerminateInstance200Response) SetData(v TerminateInstance200ResponseData) { - o.Data = v -} - -func (o TerminateInstance200Response) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o TerminateInstance200Response) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["data"] = o.Data - return toSerialize, nil -} - -func (o *TerminateInstance200Response) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "data", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varTerminateInstance200Response := _TerminateInstance200Response{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varTerminateInstance200Response) - - if err != nil { - return err - } - - *o = TerminateInstance200Response(varTerminateInstance200Response) - - return err -} - -type NullableTerminateInstance200Response struct { - value *TerminateInstance200Response - isSet bool -} - -func (v NullableTerminateInstance200Response) Get() *TerminateInstance200Response { - return v.value -} - -func (v *NullableTerminateInstance200Response) Set(val *TerminateInstance200Response) { - v.value = val - v.isSet = true -} - -func (v NullableTerminateInstance200Response) IsSet() bool { - return v.isSet -} - -func (v *NullableTerminateInstance200Response) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableTerminateInstance200Response(val *TerminateInstance200Response) *NullableTerminateInstance200Response { - return &NullableTerminateInstance200Response{value: val, isSet: true} -} - -func (v NullableTerminateInstance200Response) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableTerminateInstance200Response) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_terminate_instance_200_response_data.go b/v1/providers/lambdalabs/gen/lambdalabs/model_terminate_instance_200_response_data.go deleted file mode 100644 index 91b3abdb..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_terminate_instance_200_response_data.go +++ /dev/null @@ -1,157 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the TerminateInstance200ResponseData type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &TerminateInstance200ResponseData{} - -// TerminateInstance200ResponseData struct for TerminateInstance200ResponseData -type TerminateInstance200ResponseData struct { - // List of instances that were terminated. Note: this list might not contain all instances requested to be terminated. - TerminatedInstances []Instance `json:"terminated_instances"` -} - -type _TerminateInstance200ResponseData TerminateInstance200ResponseData - -// NewTerminateInstance200ResponseData instantiates a new TerminateInstance200ResponseData object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewTerminateInstance200ResponseData(terminatedInstances []Instance) *TerminateInstance200ResponseData { - this := TerminateInstance200ResponseData{} - this.TerminatedInstances = terminatedInstances - return &this -} - -// NewTerminateInstance200ResponseDataWithDefaults instantiates a new TerminateInstance200ResponseData object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewTerminateInstance200ResponseDataWithDefaults() *TerminateInstance200ResponseData { - this := TerminateInstance200ResponseData{} - return &this -} - -// GetTerminatedInstances returns the TerminatedInstances field value -func (o *TerminateInstance200ResponseData) GetTerminatedInstances() []Instance { - if o == nil { - var ret []Instance - return ret - } - - return o.TerminatedInstances -} - -// GetTerminatedInstancesOk returns a tuple with the TerminatedInstances field value -// and a boolean to check if the value has been set. -func (o *TerminateInstance200ResponseData) GetTerminatedInstancesOk() ([]Instance, bool) { - if o == nil { - return nil, false - } - return o.TerminatedInstances, true -} - -// SetTerminatedInstances sets field value -func (o *TerminateInstance200ResponseData) SetTerminatedInstances(v []Instance) { - o.TerminatedInstances = v -} - -func (o TerminateInstance200ResponseData) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o TerminateInstance200ResponseData) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["terminated_instances"] = o.TerminatedInstances - return toSerialize, nil -} - -func (o *TerminateInstance200ResponseData) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "terminated_instances", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varTerminateInstance200ResponseData := _TerminateInstance200ResponseData{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varTerminateInstance200ResponseData) - - if err != nil { - return err - } - - *o = TerminateInstance200ResponseData(varTerminateInstance200ResponseData) - - return err -} - -type NullableTerminateInstance200ResponseData struct { - value *TerminateInstance200ResponseData - isSet bool -} - -func (v NullableTerminateInstance200ResponseData) Get() *TerminateInstance200ResponseData { - return v.value -} - -func (v *NullableTerminateInstance200ResponseData) Set(val *TerminateInstance200ResponseData) { - v.value = val - v.isSet = true -} - -func (v NullableTerminateInstance200ResponseData) IsSet() bool { - return v.isSet -} - -func (v *NullableTerminateInstance200ResponseData) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableTerminateInstance200ResponseData(val *TerminateInstance200ResponseData) *NullableTerminateInstance200ResponseData { - return &NullableTerminateInstance200ResponseData{value: val, isSet: true} -} - -func (v NullableTerminateInstance200ResponseData) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableTerminateInstance200ResponseData) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_terminate_instance_request.go b/v1/providers/lambdalabs/gen/lambdalabs/model_terminate_instance_request.go deleted file mode 100644 index 2bc396af..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_terminate_instance_request.go +++ /dev/null @@ -1,157 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the TerminateInstanceRequest type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &TerminateInstanceRequest{} - -// TerminateInstanceRequest struct for TerminateInstanceRequest -type TerminateInstanceRequest struct { - // The unique identifiers (IDs) of the instances to terminate - InstanceIds []string `json:"instance_ids"` -} - -type _TerminateInstanceRequest TerminateInstanceRequest - -// NewTerminateInstanceRequest instantiates a new TerminateInstanceRequest object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewTerminateInstanceRequest(instanceIds []string) *TerminateInstanceRequest { - this := TerminateInstanceRequest{} - this.InstanceIds = instanceIds - return &this -} - -// NewTerminateInstanceRequestWithDefaults instantiates a new TerminateInstanceRequest object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewTerminateInstanceRequestWithDefaults() *TerminateInstanceRequest { - this := TerminateInstanceRequest{} - return &this -} - -// GetInstanceIds returns the InstanceIds field value -func (o *TerminateInstanceRequest) GetInstanceIds() []string { - if o == nil { - var ret []string - return ret - } - - return o.InstanceIds -} - -// GetInstanceIdsOk returns a tuple with the InstanceIds field value -// and a boolean to check if the value has been set. -func (o *TerminateInstanceRequest) GetInstanceIdsOk() ([]string, bool) { - if o == nil { - return nil, false - } - return o.InstanceIds, true -} - -// SetInstanceIds sets field value -func (o *TerminateInstanceRequest) SetInstanceIds(v []string) { - o.InstanceIds = v -} - -func (o TerminateInstanceRequest) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o TerminateInstanceRequest) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["instance_ids"] = o.InstanceIds - return toSerialize, nil -} - -func (o *TerminateInstanceRequest) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "instance_ids", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varTerminateInstanceRequest := _TerminateInstanceRequest{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varTerminateInstanceRequest) - - if err != nil { - return err - } - - *o = TerminateInstanceRequest(varTerminateInstanceRequest) - - return err -} - -type NullableTerminateInstanceRequest struct { - value *TerminateInstanceRequest - isSet bool -} - -func (v NullableTerminateInstanceRequest) Get() *TerminateInstanceRequest { - return v.value -} - -func (v *NullableTerminateInstanceRequest) Set(val *TerminateInstanceRequest) { - v.value = val - v.isSet = true -} - -func (v NullableTerminateInstanceRequest) IsSet() bool { - return v.isSet -} - -func (v *NullableTerminateInstanceRequest) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableTerminateInstanceRequest(val *TerminateInstanceRequest) *NullableTerminateInstanceRequest { - return &NullableTerminateInstanceRequest{value: val, isSet: true} -} - -func (v NullableTerminateInstanceRequest) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableTerminateInstanceRequest) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/model_user.go b/v1/providers/lambdalabs/gen/lambdalabs/model_user.go deleted file mode 100644 index 1d8366a6..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/model_user.go +++ /dev/null @@ -1,215 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the User type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &User{} - -// User Information about a user in your team -type User struct { - // Unique identifier for the user - Id string `json:"id"` - // Email address of the user - Email string `json:"email"` - // Status of the user's account - Status string `json:"status"` -} - -type _User User - -// NewUser instantiates a new User object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewUser(id string, email string, status string) *User { - this := User{} - this.Id = id - this.Email = email - this.Status = status - return &this -} - -// NewUserWithDefaults instantiates a new User object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewUserWithDefaults() *User { - this := User{} - return &this -} - -// GetId returns the Id field value -func (o *User) GetId() string { - if o == nil { - var ret string - return ret - } - - return o.Id -} - -// GetIdOk returns a tuple with the Id field value -// and a boolean to check if the value has been set. -func (o *User) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value -func (o *User) SetId(v string) { - o.Id = v -} - -// GetEmail returns the Email field value -func (o *User) GetEmail() string { - if o == nil { - var ret string - return ret - } - - return o.Email -} - -// GetEmailOk returns a tuple with the Email field value -// and a boolean to check if the value has been set. -func (o *User) GetEmailOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Email, true -} - -// SetEmail sets field value -func (o *User) SetEmail(v string) { - o.Email = v -} - -// GetStatus returns the Status field value -func (o *User) GetStatus() string { - if o == nil { - var ret string - return ret - } - - return o.Status -} - -// GetStatusOk returns a tuple with the Status field value -// and a boolean to check if the value has been set. -func (o *User) GetStatusOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Status, true -} - -// SetStatus sets field value -func (o *User) SetStatus(v string) { - o.Status = v -} - -func (o User) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o User) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["id"] = o.Id - toSerialize["email"] = o.Email - toSerialize["status"] = o.Status - return toSerialize, nil -} - -func (o *User) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "id", - "email", - "status", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varUser := _User{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varUser) - - if err != nil { - return err - } - - *o = User(varUser) - - return err -} - -type NullableUser struct { - value *User - isSet bool -} - -func (v NullableUser) Get() *User { - return v.value -} - -func (v *NullableUser) Set(val *User) { - v.value = val - v.isSet = true -} - -func (v NullableUser) IsSet() bool { - return v.isSet -} - -func (v *NullableUser) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableUser(val *User) *NullableUser { - return &NullableUser{value: val, isSet: true} -} - -func (v NullableUser) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableUser) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/response.go b/v1/providers/lambdalabs/gen/lambdalabs/response.go deleted file mode 100644 index a1e05c8a..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/response.go +++ /dev/null @@ -1,47 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "net/http" -) - -// APIResponse stores the API response returned by the server. -type APIResponse struct { - *http.Response `json:"-"` - Message string `json:"message,omitempty"` - // Operation is the name of the OpenAPI operation. - Operation string `json:"operation,omitempty"` - // RequestURL is the request URL. This value is always available, even if the - // embedded *http.Response is nil. - RequestURL string `json:"url,omitempty"` - // Method is the HTTP method used for the request. This value is always - // available, even if the embedded *http.Response is nil. - Method string `json:"method,omitempty"` - // Payload holds the contents of the response body (which may be nil or empty). - // This is provided here as the raw response.Body() reader will have already - // been drained. - Payload []byte `json:"-"` -} - -// NewAPIResponse returns a new APIResponse object. -func NewAPIResponse(r *http.Response) *APIResponse { - - response := &APIResponse{Response: r} - return response -} - -// NewAPIResponseWithError returns a new APIResponse object with the provided error message. -func NewAPIResponseWithError(errorMessage string) *APIResponse { - - response := &APIResponse{Message: errorMessage} - return response -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/test/api_default_test.go b/v1/providers/lambdalabs/gen/lambdalabs/test/api_default_test.go deleted file mode 100644 index 7296e42e..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/test/api_default_test.go +++ /dev/null @@ -1,127 +0,0 @@ -/* -Lambda Cloud API - -Testing DefaultAPIService - -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); - -package openapi - -import ( - "context" - "testing" - - openapiclient "github.com/brevdev/cloud/v1/providers/lambdalabs/gen/lambdalabs" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func Test_openapi_DefaultAPIService(t *testing.T) { - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - - t.Run("Test DefaultAPIService AddSSHKey", func(t *testing.T) { - t.Skip("skip test") // remove to run test - - resp, httpRes, err := apiClient.DefaultAPI.AddSSHKey(context.Background()).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - }) - - t.Run("Test DefaultAPIService DeleteSSHKey", func(t *testing.T) { - t.Skip("skip test") // remove to run test - - var id string - - httpRes, err := apiClient.DefaultAPI.DeleteSSHKey(context.Background(), id).Execute() - - require.Nil(t, err) - assert.Equal(t, 200, httpRes.StatusCode) - }) - - t.Run("Test DefaultAPIService GetInstance", func(t *testing.T) { - t.Skip("skip test") // remove to run test - - var id string - - resp, httpRes, err := apiClient.DefaultAPI.GetInstance(context.Background(), id).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - }) - - t.Run("Test DefaultAPIService InstanceTypes", func(t *testing.T) { - t.Skip("skip test") // remove to run test - - resp, httpRes, err := apiClient.DefaultAPI.InstanceTypes(context.Background()).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - }) - - t.Run("Test DefaultAPIService LaunchInstance", func(t *testing.T) { - t.Skip("skip test") // remove to run test - - resp, httpRes, err := apiClient.DefaultAPI.LaunchInstance(context.Background()).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - }) - - t.Run("Test DefaultAPIService ListFileSystems", func(t *testing.T) { - t.Skip("skip test") // remove to run test - - resp, httpRes, err := apiClient.DefaultAPI.ListFileSystems(context.Background()).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - }) - - t.Run("Test DefaultAPIService ListInstances", func(t *testing.T) { - t.Skip("skip test") // remove to run test - - resp, httpRes, err := apiClient.DefaultAPI.ListInstances(context.Background()).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - }) - - t.Run("Test DefaultAPIService ListSSHKeys", func(t *testing.T) { - t.Skip("skip test") // remove to run test - - resp, httpRes, err := apiClient.DefaultAPI.ListSSHKeys(context.Background()).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - }) - - t.Run("Test DefaultAPIService RestartInstance", func(t *testing.T) { - t.Skip("skip test") // remove to run test - - resp, httpRes, err := apiClient.DefaultAPI.RestartInstance(context.Background()).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - }) - - t.Run("Test DefaultAPIService TerminateInstance", func(t *testing.T) { - t.Skip("skip test") // remove to run test - - resp, httpRes, err := apiClient.DefaultAPI.TerminateInstance(context.Background()).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - }) -} diff --git a/v1/providers/lambdalabs/gen/lambdalabs/utils.go b/v1/providers/lambdalabs/gen/lambdalabs/utils.go deleted file mode 100644 index c45c4c84..00000000 --- a/v1/providers/lambdalabs/gen/lambdalabs/utils.go +++ /dev/null @@ -1,361 +0,0 @@ -/* -Lambda Cloud API - -API for interacting with the Lambda GPU Cloud - -API version: 1.5.3 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "bytes" - "encoding/json" - "fmt" - "reflect" - "time" -) - -// PtrBool is a helper routine that returns a pointer to given boolean value. -func PtrBool(v bool) *bool { return &v } - -// PtrInt is a helper routine that returns a pointer to given integer value. -func PtrInt(v int) *int { return &v } - -// PtrInt32 is a helper routine that returns a pointer to given integer value. -func PtrInt32(v int32) *int32 { return &v } - -// PtrInt64 is a helper routine that returns a pointer to given integer value. -func PtrInt64(v int64) *int64 { return &v } - -// PtrFloat32 is a helper routine that returns a pointer to given float value. -func PtrFloat32(v float32) *float32 { return &v } - -// PtrFloat64 is a helper routine that returns a pointer to given float value. -func PtrFloat64(v float64) *float64 { return &v } - -// PtrString is a helper routine that returns a pointer to given string value. -func PtrString(v string) *string { return &v } - -// PtrTime is helper routine that returns a pointer to given Time value. -func PtrTime(v time.Time) *time.Time { return &v } - -type NullableBool struct { - value *bool - isSet bool -} - -func (v NullableBool) Get() *bool { - return v.value -} - -func (v *NullableBool) Set(val *bool) { - v.value = val - v.isSet = true -} - -func (v NullableBool) IsSet() bool { - return v.isSet -} - -func (v *NullableBool) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableBool(val *bool) *NullableBool { - return &NullableBool{value: val, isSet: true} -} - -func (v NullableBool) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableBool) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -type NullableInt struct { - value *int - isSet bool -} - -func (v NullableInt) Get() *int { - return v.value -} - -func (v *NullableInt) Set(val *int) { - v.value = val - v.isSet = true -} - -func (v NullableInt) IsSet() bool { - return v.isSet -} - -func (v *NullableInt) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableInt(val *int) *NullableInt { - return &NullableInt{value: val, isSet: true} -} - -func (v NullableInt) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableInt) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -type NullableInt32 struct { - value *int32 - isSet bool -} - -func (v NullableInt32) Get() *int32 { - return v.value -} - -func (v *NullableInt32) Set(val *int32) { - v.value = val - v.isSet = true -} - -func (v NullableInt32) IsSet() bool { - return v.isSet -} - -func (v *NullableInt32) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableInt32(val *int32) *NullableInt32 { - return &NullableInt32{value: val, isSet: true} -} - -func (v NullableInt32) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableInt32) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -type NullableInt64 struct { - value *int64 - isSet bool -} - -func (v NullableInt64) Get() *int64 { - return v.value -} - -func (v *NullableInt64) Set(val *int64) { - v.value = val - v.isSet = true -} - -func (v NullableInt64) IsSet() bool { - return v.isSet -} - -func (v *NullableInt64) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableInt64(val *int64) *NullableInt64 { - return &NullableInt64{value: val, isSet: true} -} - -func (v NullableInt64) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableInt64) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -type NullableFloat32 struct { - value *float32 - isSet bool -} - -func (v NullableFloat32) Get() *float32 { - return v.value -} - -func (v *NullableFloat32) Set(val *float32) { - v.value = val - v.isSet = true -} - -func (v NullableFloat32) IsSet() bool { - return v.isSet -} - -func (v *NullableFloat32) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableFloat32(val *float32) *NullableFloat32 { - return &NullableFloat32{value: val, isSet: true} -} - -func (v NullableFloat32) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableFloat32) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -type NullableFloat64 struct { - value *float64 - isSet bool -} - -func (v NullableFloat64) Get() *float64 { - return v.value -} - -func (v *NullableFloat64) Set(val *float64) { - v.value = val - v.isSet = true -} - -func (v NullableFloat64) IsSet() bool { - return v.isSet -} - -func (v *NullableFloat64) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableFloat64(val *float64) *NullableFloat64 { - return &NullableFloat64{value: val, isSet: true} -} - -func (v NullableFloat64) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableFloat64) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -type NullableString struct { - value *string - isSet bool -} - -func (v NullableString) Get() *string { - return v.value -} - -func (v *NullableString) Set(val *string) { - v.value = val - v.isSet = true -} - -func (v NullableString) IsSet() bool { - return v.isSet -} - -func (v *NullableString) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableString(val *string) *NullableString { - return &NullableString{value: val, isSet: true} -} - -func (v NullableString) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableString) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -type NullableTime struct { - value *time.Time - isSet bool -} - -func (v NullableTime) Get() *time.Time { - return v.value -} - -func (v *NullableTime) Set(val *time.Time) { - v.value = val - v.isSet = true -} - -func (v NullableTime) IsSet() bool { - return v.isSet -} - -func (v *NullableTime) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableTime(val *time.Time) *NullableTime { - return &NullableTime{value: val, isSet: true} -} - -func (v NullableTime) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableTime) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -// IsNil checks if an input is nil -func IsNil(i interface{}) bool { - if i == nil { - return true - } - switch reflect.TypeOf(i).Kind() { - case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: - return reflect.ValueOf(i).IsNil() - case reflect.Array: - return reflect.ValueOf(i).IsZero() - } - return false -} - -type MappedNullable interface { - ToMap() (map[string]interface{}, error) -} - -// A wrapper for strict JSON decoding -func newStrictDecoder(data []byte) *json.Decoder { - dec := json.NewDecoder(bytes.NewBuffer(data)) - dec.DisallowUnknownFields() - return dec -} - -// Prevent trying to import "fmt" -func reportError(format string, a ...interface{}) error { - return fmt.Errorf(format, a...) -} diff --git a/v1/providers/lambdalabs/helpers_test.go b/v1/providers/lambdalabs/helpers_test.go deleted file mode 100644 index 9ec4861a..00000000 --- a/v1/providers/lambdalabs/helpers_test.go +++ /dev/null @@ -1,79 +0,0 @@ -package v1 - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - v1 "github.com/brevdev/cloud/v1" -) - -func TestConvertLambdaLabsInstanceToV1Instance(t *testing.T) { - lambdaInstance := createMockInstance("test-instance-id") - - v1Instance := convertLambdaLabsInstanceToV1Instance(lambdaInstance) - - assert.Equal(t, "test-instance-id", string(v1Instance.CloudID)) - assert.Equal(t, "test-instance", v1Instance.Name) - assert.Equal(t, v1.LifecycleStatusRunning, v1Instance.Status.LifecycleStatus) - assert.Equal(t, "192.168.1.100", v1Instance.PublicIP) - assert.Equal(t, "10.0.1.100", v1Instance.PrivateIP) - assert.Equal(t, "us-west-1", v1Instance.Location) - assert.Equal(t, "gpu_1x_a10", v1Instance.InstanceType) -} - -func TestConvertLambdaLabsStatusToV1Status(t *testing.T) { - tests := []struct { - lambdaStatus string - expected v1.LifecycleStatus - }{ - {"active", v1.LifecycleStatusRunning}, - {"booting", v1.LifecycleStatusPending}, - {"unhealthy", v1.LifecycleStatusRunning}, - {"terminating", v1.LifecycleStatusTerminating}, - {"terminated", v1.LifecycleStatusTerminated}, - {"error", v1.LifecycleStatusFailed}, - } - - for _, test := range tests { - t.Run(test.lambdaStatus, func(t *testing.T) { - result := convertLambdaLabsStatusToV1Status(test.lambdaStatus) - assert.Equal(t, test.expected, result) - }) - } -} - -func TestMergeInstanceForUpdate(t *testing.T) { - client := &LambdaLabsClient{} - original := v1.Instance{ - CloudID: "test-id", - Name: "original-name", - Status: v1.Status{LifecycleStatus: v1.LifecycleStatusRunning}, - } - - update := v1.Instance{ - Name: "updated-name", - Status: v1.Status{LifecycleStatus: v1.LifecycleStatusTerminated}, - } - - merged := client.MergeInstanceForUpdate(original, update) - - assert.Equal(t, "updated-name", merged.Name) - assert.Equal(t, v1.LifecycleStatusTerminated, merged.Status.LifecycleStatus) -} - -func TestMergeInstanceTypeForUpdate(t *testing.T) { - client := &LambdaLabsClient{} - original := v1.InstanceType{ - ID: "test-id", - Type: "original-type", - } - - update := v1.InstanceType{ - Type: "updated-type", - } - - merged := client.MergeInstanceTypeForUpdate(original, update) - - assert.Equal(t, "updated-type", merged.Type) -} diff --git a/v1/providers/lambdalabs/instance.go b/v1/providers/lambdalabs/instance.go deleted file mode 100644 index c47d5033..00000000 --- a/v1/providers/lambdalabs/instance.go +++ /dev/null @@ -1,332 +0,0 @@ -package v1 - -import ( - "context" - "errors" - "fmt" - "strings" - "time" - - "github.com/alecthomas/units" - "github.com/brevdev/cloud/internal/collections" - v1 "github.com/brevdev/cloud/v1" - openapi "github.com/brevdev/cloud/v1/providers/lambdalabs/gen/lambdalabs" -) - -const lambdaLabsTimeNameFormat = "2006-01-02-15-04-05Z07-00" - -// CreateInstance creates a new instance in Lambda Labs -// Supported via: POST /api/v1/instance-operations/launch -func (c *LambdaLabsClient) CreateInstance(ctx context.Context, attrs v1.CreateInstanceAttrs) (*v1.Instance, error) { - keyPairName := attrs.RefID - if attrs.KeyPairName != nil { - keyPairName = *attrs.KeyPairName - } - - if attrs.PublicKey != "" { - request := openapi.AddSSHKeyRequest{ - Name: keyPairName, - PublicKey: &attrs.PublicKey, - } - keyPairResp, err := c.addSSHKey(ctx, request) - if err != nil && !strings.Contains(err.Error(), "name must be unique") { - return nil, fmt.Errorf("failed to add SSH key: %w", err) - } - keyPairName = keyPairResp.Data.Name - } - if keyPairName == "" { - return nil, errors.New("keyPairName is required if public key not provided") - } - - location := attrs.Location - if location == "" { - location = c.location - } - - quantity := int32(1) - request := openapi.LaunchInstanceRequest{ - RegionName: location, - InstanceTypeName: attrs.InstanceType, - SshKeyNames: []string{keyPairName}, - Quantity: &quantity, - FileSystemNames: []string{}, - } - - name := fmt.Sprintf("%s--%s", c.GetReferenceID(), time.Now().UTC().Format(lambdaLabsTimeNameFormat)) - if len(name) > 64 { - return nil, errors.New("name is too long") - } - - request.Name = *openapi.NewNullableString(&name) - - resp, err := c.launchInstance(ctx, request) - if err != nil { - return nil, fmt.Errorf("failed to launch instance: %w", handleErrToCloudErr(err)) - } - - if len(resp.Data.InstanceIds) != 1 { - return nil, fmt.Errorf("expected 1 instance ID, got %d", len(resp.Data.InstanceIds)) - } - - instanceID := v1.CloudProviderInstanceID(resp.Data.InstanceIds[0]) - return c.GetInstance(ctx, instanceID) -} - -// GetInstance retrieves an instance by ID -// Supported via: GET /api/v1/instances/{id} -func (c *LambdaLabsClient) GetInstance(ctx context.Context, instanceID v1.CloudProviderInstanceID) (*v1.Instance, error) { - resp, err := c.getInstance(ctx, string(instanceID)) - if err != nil { - return nil, fmt.Errorf("failed to get instance: %w", err) - } - - return convertLambdaLabsInstanceToV1Instance(resp.Data), nil -} - -// TerminateInstance terminates an instance -// Supported via: POST /api/v1/instance-operations/terminate -func (c *LambdaLabsClient) TerminateInstance(ctx context.Context, instanceID v1.CloudProviderInstanceID) error { - request := openapi.TerminateInstanceRequest{ - InstanceIds: []string{string(instanceID)}, - } - - // TODO: since "createInstance" also creates an SSH key, we should consider cleaning up the key pair here - _, err := c.terminateInstance(ctx, request) - if err != nil { - return fmt.Errorf("failed to terminate instance: %w", err) - } - - return nil -} - -// ListInstances lists all instances -// Supported via: GET /api/v1/instances -func (c *LambdaLabsClient) ListInstances(ctx context.Context, _ v1.ListInstancesArgs) ([]v1.Instance, error) { - resp, err := c.listInstances(ctx) - if err != nil { - return nil, fmt.Errorf("failed to list instances: %w", err) - } - - instances := make([]v1.Instance, len(resp.Data)) - for i, llInstance := range resp.Data { - instances[i] = *convertLambdaLabsInstanceToV1Instance(llInstance) - } - - return instances, nil -} - -// RebootInstance reboots an instance -// Supported via: POST /api/v1/instance-operations/restart -func (c *LambdaLabsClient) RebootInstance(ctx context.Context, instanceID v1.CloudProviderInstanceID) error { - request := openapi.RestartInstanceRequest{ - InstanceIds: []string{string(instanceID)}, - } - - _, err := c.restartInstance(ctx, request) - if err != nil { - return fmt.Errorf("failed to reboot instance: %w", err) - } - - return nil -} - -// MergeInstanceForUpdate merges instance data for updates -func convertLambdaLabsInstanceToV1Instance(instance openapi.Instance) *v1.Instance { - var instanceIP string - if instance.Ip.IsSet() { - instanceIP = *instance.Ip.Get() - } - - var instanceName string - if instance.Name.IsSet() { - instanceName = *instance.Name.Get() - } - - var instanceHostname string - if instance.Hostname.IsSet() { - instanceHostname = *instance.Hostname.Get() - } - - nameSplit := strings.Split(instanceName, "--") - var cloudCredRefID string - if len(nameSplit) > 0 { - cloudCredRefID = nameSplit[0] - } - var createTime time.Time - if len(nameSplit) > 1 { - createTimeStr := nameSplit[1] - createTime, _ = time.Parse(lambdaLabsTimeNameFormat, createTimeStr) - } - - var instancePrivateIP string - if instance.PrivateIp.IsSet() { - instancePrivateIP = *instance.PrivateIp.Get() - } - - inst := v1.Instance{ - RefID: instance.SshKeyNames[0], - CloudCredRefID: cloudCredRefID, - CreatedAt: createTime, - CloudID: v1.CloudProviderInstanceID(instance.Id), - Name: instanceName, - PublicIP: instanceIP, - PublicDNS: instanceIP, - PrivateIP: instancePrivateIP, - Hostname: instanceHostname, - Status: v1.Status{ - LifecycleStatus: convertLambdaLabsStatusToV1Status(instance.Status), - }, - InstanceType: instance.InstanceType.Name, - VolumeType: "ssd", - DiskSize: units.GiB * units.Base2Bytes(instance.InstanceType.Specs.StorageGib), - DiskSizeBytes: v1.NewBytes(v1.BytesValue(instance.InstanceType.Specs.StorageGib), v1.Gibibyte), - FirewallRules: v1.FirewallRules{ - IngressRules: []v1.FirewallRule{generateFirewallRouteFromPort(22), generateFirewallRouteFromPort(2222)}, // TODO pull from api - EgressRules: []v1.FirewallRule{generateFirewallRouteFromPort(22), generateFirewallRouteFromPort(2222)}, // TODO pull from api - }, - SSHUser: "ubuntu", - SSHPort: 22, - Stoppable: false, - Rebootable: true, - Location: instance.Region.Name, - } - inst.InstanceTypeID = v1.MakeGenericInstanceTypeIDFromInstance(inst) - return &inst -} - -func generateFirewallRouteFromPort(port int32) v1.FirewallRule { - return v1.FirewallRule{ - FromPort: port, - ToPort: port, - IPRanges: []string{"0.0.0.0/0"}, - } -} - -func convertLambdaLabsStatusToV1Status(status string) v1.LifecycleStatus { - switch status { - case "booting": - return v1.LifecycleStatusPending - case "active": - return v1.LifecycleStatusRunning - case "terminating": - return v1.LifecycleStatusTerminating - case "terminated": - return v1.LifecycleStatusTerminated - case "error": - return v1.LifecycleStatusFailed - case "unhealthy": - return v1.LifecycleStatusRunning - default: - return v1.LifecycleStatusPending - } -} - -func (c *LambdaLabsClient) MergeInstanceForUpdate(_ v1.Instance, newInst v1.Instance) v1.Instance { - return newInst -} - -func (c *LambdaLabsClient) MergeInstanceTypeForUpdate(_ v1.InstanceType, newIt v1.InstanceType) v1.InstanceType { - return newIt -} - -func (c *LambdaLabsClient) addSSHKey(ctx context.Context, request openapi.AddSSHKeyRequest) (*openapi.AddSSHKey200Response, error) { - result, err := collections.RetryWithDataAndAttemptCount(func() (*openapi.AddSSHKey200Response, error) { - res, resp, err := c.client.DefaultAPI.AddSSHKey(c.makeAuthContext(ctx)).AddSSHKeyRequest(request).Execute() - if resp != nil { - defer resp.Body.Close() //nolint:errcheck // ignore because using defer (for some reason HandleErrDefer) - } - if err != nil { - return &openapi.AddSSHKey200Response{}, handleAPIError(ctx, resp, err) - } - return res, nil - }, c.backoff) - if err != nil { - return nil, err - } - return result, nil -} - -func (c *LambdaLabsClient) launchInstance(ctx context.Context, request openapi.LaunchInstanceRequest) (*openapi.LaunchInstance200Response, error) { - result, err := collections.RetryWithDataAndAttemptCount(func() (*openapi.LaunchInstance200Response, error) { - res, resp, err := c.client.DefaultAPI.LaunchInstance(c.makeAuthContext(ctx)).LaunchInstanceRequest(request).Execute() - if resp != nil { - defer resp.Body.Close() //nolint:errcheck // ignore because using defer (for some reason HandleErrDefer) - } - if err != nil { - return &openapi.LaunchInstance200Response{}, handleAPIError(ctx, resp, err) - } - return res, nil - }, c.backoff) - if err != nil { - return nil, err - } - return result, nil -} - -func (c *LambdaLabsClient) getInstance(ctx context.Context, instanceID string) (*openapi.GetInstance200Response, error) { - result, err := collections.RetryWithDataAndAttemptCount(func() (*openapi.GetInstance200Response, error) { - res, resp, err := c.client.DefaultAPI.GetInstance(c.makeAuthContext(ctx), instanceID).Execute() - if resp != nil { - defer resp.Body.Close() //nolint:errcheck // ignore because using defer (for some reason HandleErrDefer) - } - if err != nil { - return &openapi.GetInstance200Response{}, handleAPIError(ctx, resp, err) - } - return res, nil - }, c.backoff) - if err != nil { - return nil, err - } - return result, nil -} - -func (c *LambdaLabsClient) terminateInstance(ctx context.Context, request openapi.TerminateInstanceRequest) (*openapi.TerminateInstance200Response, error) { - result, err := collections.RetryWithDataAndAttemptCount(func() (*openapi.TerminateInstance200Response, error) { - res, resp, err := c.client.DefaultAPI.TerminateInstance(c.makeAuthContext(ctx)).TerminateInstanceRequest(request).Execute() - if resp != nil { - defer resp.Body.Close() //nolint:errcheck // ignore because using defer (for some reason HandleErrDefer) - } - if err != nil { - return &openapi.TerminateInstance200Response{}, handleAPIError(ctx, resp, err) - } - return res, nil - }, c.backoff) - if err != nil { - return nil, err - } - return result, nil -} - -func (c *LambdaLabsClient) listInstances(ctx context.Context) (*openapi.ListInstances200Response, error) { - result, err := collections.RetryWithDataAndAttemptCount(func() (*openapi.ListInstances200Response, error) { - res, resp, err := c.client.DefaultAPI.ListInstances(c.makeAuthContext(ctx)).Execute() - if resp != nil { - defer resp.Body.Close() //nolint:errcheck // ignore because using defer (for some reason HandleErrDefer) - } - if err != nil { - return &openapi.ListInstances200Response{}, handleAPIError(ctx, resp, err) - } - return res, nil - }, c.backoff) - if err != nil { - return nil, err - } - return result, nil -} - -func (c *LambdaLabsClient) restartInstance(ctx context.Context, request openapi.RestartInstanceRequest) (*openapi.RestartInstance200Response, error) { - result, err := collections.RetryWithDataAndAttemptCount(func() (*openapi.RestartInstance200Response, error) { - res, resp, err := c.client.DefaultAPI.RestartInstance(c.makeAuthContext(ctx)).RestartInstanceRequest(request).Execute() - if resp != nil { - defer resp.Body.Close() //nolint:errcheck // ignore because using defer (for some reason HandleErrDefer) - } - if err != nil { - return &openapi.RestartInstance200Response{}, handleAPIError(ctx, resp, err) - } - return res, nil - }, c.backoff) - if err != nil { - return nil, err - } - return result, nil -} diff --git a/v1/providers/lambdalabs/instance_test.go b/v1/providers/lambdalabs/instance_test.go deleted file mode 100644 index 2f994002..00000000 --- a/v1/providers/lambdalabs/instance_test.go +++ /dev/null @@ -1,307 +0,0 @@ -package v1 - -import ( - "context" - "encoding/json" - "fmt" - "testing" - - "github.com/jarcoal/httpmock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/brevdev/cloud/internal/collections" - v1 "github.com/brevdev/cloud/v1" - openapi "github.com/brevdev/cloud/v1/providers/lambdalabs/gen/lambdalabs" -) - -func TestLambdaLabsClient_CreateInstance_Success(t *testing.T) { - client, cleanup := setupMockClient() - defer cleanup() - - instanceID := testInstanceID - publicKey := testPublicKey - - workspaceID := "ff393b16489f4f02838062b093181016" - httpmock.RegisterResponder("POST", "https://cloud.lambda.ai/api/v1/ssh-keys", - httpmock.NewJsonResponderOrPanic(200, openapi.AddSSHKey200Response{ - Data: openapi.SshKey{ - Id: "ssh-key-id", - Name: "test-instance-id", - PublicKey: publicKey, - WorkspaceId: &workspaceID, - }, - })) - - httpmock.RegisterResponder("POST", "https://cloud.lambda.ai/api/v1/instance-operations/launch", - httpmock.NewJsonResponderOrPanic(200, openapi.LaunchInstance200Response{ - Data: openapi.LaunchInstance200ResponseData{ - InstanceIds: []string{instanceID}, - }, - })) - - mockInstance := createMockInstance(instanceID) - httpmock.RegisterResponder("GET", fmt.Sprintf("https://cloud.lambda.ai/api/v1/instances/%s", instanceID), - httpmock.NewJsonResponderOrPanic(200, openapi.GetInstance200Response{ - Data: mockInstance, - })) - - args := v1.CreateInstanceAttrs{ - InstanceType: "gpu_1x_a10", - Location: "us-west-1", - PublicKey: publicKey, - Name: "test-instance", - } - - instance, err := client.CreateInstance(context.Background(), args) - require.NoError(t, err) - assert.Equal(t, instanceID, string(instance.CloudID)) - assert.Contains(t, instance.Name, "test-instance") - assert.Equal(t, v1.LifecycleStatusRunning, instance.Status.LifecycleStatus) -} - -func TestLambdaLabsClient_CreateInstance_WithoutPublicKey(t *testing.T) { - client, cleanup := setupMockClient() - defer cleanup() - - instanceID := testInstanceID - - httpmock.RegisterResponder("POST", "https://cloud.lambda.ai/api/v1/instance-operations/launch", - httpmock.NewJsonResponderOrPanic(200, openapi.LaunchInstance200Response{ - Data: openapi.LaunchInstance200ResponseData{ - InstanceIds: []string{instanceID}, - }, - })) - - mockInstance := createMockInstance(instanceID) - httpmock.RegisterResponder("GET", fmt.Sprintf("https://cloud.lambda.ai/api/v1/instances/%s", instanceID), - httpmock.NewJsonResponderOrPanic(200, openapi.GetInstance200Response{ - Data: mockInstance, - })) - - args := v1.CreateInstanceAttrs{ - InstanceType: "gpu_1x_a10", - Location: "us-west-1", - Name: "test-instance", - KeyPairName: collections.Ptr("test-key-pair"), - } - - instance, err := client.CreateInstance(context.Background(), args) - require.NoError(t, err) - assert.Equal(t, instanceID, string(instance.CloudID)) -} - -func TestLambdaLabsClient_CreateInstance_SSHKeyError(t *testing.T) { - client, cleanup := setupMockClient() - defer cleanup() - - publicKey := testPublicKey - - httpmock.RegisterResponder("POST", "https://cloud.lambda.ai/api/v1/ssh-keys", - httpmock.NewStringResponder(400, `{"error": {"code": "INVALID_REQUEST", "message": "SSH key already exists"}}`)) - - args := v1.CreateInstanceAttrs{ - InstanceType: "gpu_1x_a10", - Location: "us-west-1", - PublicKey: publicKey, - Name: "test-instance", - } - - _, err := client.CreateInstance(context.Background(), args) - assert.Error(t, err) -} - -func TestLambdaLabsClient_CreateInstance_LaunchError(t *testing.T) { - client, cleanup := setupMockClient() - defer cleanup() - - httpmock.RegisterResponder("POST", "https://cloud.lambda.ai/api/v1/instance-operations/launch", - httpmock.NewStringResponder(400, `{"error": {"code": "INVALID_REQUEST", "message": "Instance type not available"}}`)) - - args := v1.CreateInstanceAttrs{ - InstanceType: "gpu_1x_a10", - Location: "us-west-1", - Name: "test-instance", - } - - _, err := client.CreateInstance(context.Background(), args) - assert.Error(t, err) -} - -func TestLambdaLabsClient_GetInstance_Success(t *testing.T) { - client, cleanup := setupMockClient() - defer cleanup() - - instanceID := testInstanceID - mockInstance := createMockInstance(instanceID) - - httpmock.RegisterResponder("GET", fmt.Sprintf("https://cloud.lambda.ai/api/v1/instances/%s", instanceID), - httpmock.NewJsonResponderOrPanic(200, openapi.GetInstance200Response{ - Data: mockInstance, - })) - - instance, err := client.GetInstance(context.Background(), v1.CloudProviderInstanceID(instanceID)) - require.NoError(t, err) - assert.Equal(t, instanceID, string(instance.CloudID)) - assert.Equal(t, "test-instance", instance.Name) - assert.Equal(t, v1.LifecycleStatusRunning, instance.Status.LifecycleStatus) -} - -func TestLambdaLabsClient_GetInstance_NotFound(t *testing.T) { - client, cleanup := setupMockClient() - defer cleanup() - - instanceID := nonexistentInstance - - httpmock.RegisterResponder("GET", fmt.Sprintf("https://cloud.lambda.ai/api/v1/instances/%s", instanceID), - httpmock.NewStringResponder(404, `{"error": {"code": "NOT_FOUND", "message": "Instance not found"}}`)) - - _, err := client.GetInstance(context.Background(), v1.CloudProviderInstanceID(instanceID)) - assert.Error(t, err) -} - -func TestLambdaLabsClient_ListInstances_Success(t *testing.T) { - client, cleanup := setupMockClient() - defer cleanup() - - mockInstances := []openapi.Instance{ - createMockInstance("instance-1"), - createMockInstance("instance-2"), - } - - httpmock.RegisterResponder("GET", "https://cloud.lambda.ai/api/v1/instances", - httpmock.NewJsonResponderOrPanic(200, openapi.ListInstances200Response{ - Data: mockInstances, - })) - - instances, err := client.ListInstances(context.Background(), v1.ListInstancesArgs{}) - require.NoError(t, err) - assert.Len(t, instances, 2) - assert.Equal(t, "instance-1", string(instances[0].CloudID)) - assert.Equal(t, "instance-2", string(instances[1].CloudID)) -} - -func TestLambdaLabsClient_ListInstances_Empty(t *testing.T) { - client, cleanup := setupMockClient() - defer cleanup() - - httpmock.RegisterResponder("GET", "https://cloud.lambda.ai/api/v1/instances", - httpmock.NewJsonResponderOrPanic(200, openapi.ListInstances200Response{ - Data: []openapi.Instance{}, - })) - - instances, err := client.ListInstances(context.Background(), v1.ListInstancesArgs{}) - require.NoError(t, err) - assert.Len(t, instances, 0) -} - -func TestLambdaLabsClient_ListInstances_Error(t *testing.T) { - client, cleanup := setupMockClient() - defer cleanup() - - httpmock.RegisterResponder("GET", "https://cloud.lambda.ai/api/v1/instances", - httpmock.NewStringResponder(500, `{"error": {"code": "INTERNAL_ERROR", "message": "Internal server error"}}`)) - - _, err := client.ListInstances(context.Background(), v1.ListInstancesArgs{}) - assert.Error(t, err) -} - -func TestLambdaLabsClient_TerminateInstance_Success(t *testing.T) { - client, cleanup := setupMockClient() - defer cleanup() - - instanceID := testInstanceID - - httpmock.RegisterResponder("POST", "https://cloud.lambda.ai/api/v1/instance-operations/terminate", - httpmock.NewJsonResponderOrPanic(200, openapi.TerminateInstance200Response{ - Data: openapi.TerminateInstance200ResponseData{ - TerminatedInstances: []openapi.Instance{ - createMockInstance(instanceID), - }, - }, - })) - - err := client.TerminateInstance(context.Background(), v1.CloudProviderInstanceID(instanceID)) - assert.NoError(t, err) -} - -func TestLambdaLabsClient_TerminateInstance_Error(t *testing.T) { - client, cleanup := setupMockClient() - defer cleanup() - - instanceID := nonexistentInstance - - httpmock.RegisterResponder("POST", "https://cloud.lambda.ai/api/v1/instance-operations/terminate", - httpmock.NewStringResponder(404, `{"error": {"code": "NOT_FOUND", "message": "Instance not found"}}`)) - - err := client.TerminateInstance(context.Background(), v1.CloudProviderInstanceID(instanceID)) - assert.Error(t, err) -} - -func TestLambdaLabsClient_RebootInstance_Success(t *testing.T) { - client, cleanup := setupMockClient() - defer cleanup() - - instanceID := testInstanceID - - httpmock.RegisterResponder("POST", "https://cloud.lambda.ai/api/v1/instance-operations/restart", - httpmock.NewJsonResponderOrPanic(200, openapi.RestartInstance200Response{ - Data: openapi.RestartInstance200ResponseData{ - RestartedInstances: []openapi.Instance{ - createMockInstance(instanceID), - }, - }, - })) - - err := client.RebootInstance(context.Background(), v1.CloudProviderInstanceID(instanceID)) - assert.NoError(t, err) -} - -func TestLambdaLabsClient_RebootInstance_Error(t *testing.T) { - client, cleanup := setupMockClient() - defer cleanup() - - instanceID := nonexistentInstance - - httpmock.RegisterResponder("POST", "https://cloud.lambda.ai/api/v1/instance-operations/restart", - httpmock.NewStringResponder(404, `{"error": {"code": "NOT_FOUND", "message": "Instance not found"}}`)) - - err := client.RebootInstance(context.Background(), v1.CloudProviderInstanceID(instanceID)) - assert.Error(t, err) -} - -func TestLambdaLabsClient_CreateInstance_SSHKeyResponseWithWorkspaceID(t *testing.T) { - client, cleanup := setupMockClient() - defer cleanup() - - instanceID := testInstanceID - publicKey := testPublicKey - - // Raw JSON simulating Lambda Labs response after their Workspaces launch (June 2026). - // DisallowUnknownFields() in UnmarshalJSON would hard-error without WorkspaceId in the struct. - httpmock.RegisterResponder("POST", "https://cloud.lambda.ai/api/v1/ssh-keys", - httpmock.NewJsonResponderOrPanic(200, json.RawMessage(`{"data":{"id":"ssh-key-id","name":"test-instance-id","public_key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQ test@example.com","workspace_id":"ff393b16489f4f02838062b093181016"}}`))) - - httpmock.RegisterResponder("POST", "https://cloud.lambda.ai/api/v1/instance-operations/launch", - httpmock.NewJsonResponderOrPanic(200, openapi.LaunchInstance200Response{ - Data: openapi.LaunchInstance200ResponseData{ - InstanceIds: []string{instanceID}, - }, - })) - - mockInstance := createMockInstance(instanceID) - httpmock.RegisterResponder("GET", fmt.Sprintf("https://cloud.lambda.ai/api/v1/instances/%s", instanceID), - httpmock.NewJsonResponderOrPanic(200, openapi.GetInstance200Response{ - Data: mockInstance, - })) - - args := v1.CreateInstanceAttrs{ - InstanceType: "gpu_1x_a10", - Location: "us-west-1", - PublicKey: publicKey, - Name: "test-instance", - } - - _, err := client.CreateInstance(context.Background(), args) - require.NoError(t, err, "should not fail when Lambda Labs returns workspace_id in SSH key response") -} diff --git a/v1/providers/lambdalabs/instancetype.go b/v1/providers/lambdalabs/instancetype.go deleted file mode 100644 index 2f91c6d2..00000000 --- a/v1/providers/lambdalabs/instancetype.go +++ /dev/null @@ -1,212 +0,0 @@ -package v1 - -import ( - "context" - "fmt" - "math" - "regexp" - "strconv" - "strings" - "time" - - "github.com/alecthomas/units" - "github.com/bojanz/currency" - "github.com/brevdev/cloud/internal/collections" - v1 "github.com/brevdev/cloud/v1" - openapi "github.com/brevdev/cloud/v1/providers/lambdalabs/gen/lambdalabs" -) - -// GetInstanceTypePollTime returns the polling interval for instance types -func (c *LambdaLabsClient) GetInstanceTypePollTime() time.Duration { - return 5 * time.Minute -} - -func (c *LambdaLabsClient) GetInstanceTypes(ctx context.Context, args v1.GetInstanceTypeArgs) ([]v1.InstanceType, error) { - instanceTypesResp, err := c.getInstanceTypes(ctx) - if err != nil { - return nil, err - } - - locations, err := c.GetLocations(ctx, v1.GetLocationsArgs{}) - if err != nil { - return nil, err - } - - instanceTypes, err := collections.MapE(collections.GetMapValues(instanceTypesResp.Data), func(resp openapi.InstanceTypes200ResponseDataValue) ([]v1.InstanceType, error) { - currentlyAvailableRegions := collections.GroupBy(resp.RegionsWithCapacityAvailable, func(lambdaRegion openapi.Region) string { - return lambdaRegion.Name - }) - its, err1 := collections.MapE(locations, func(region v1.Location) (v1.InstanceType, error) { - isAvailable := false - if _, ok := currentlyAvailableRegions[region.Name]; ok { - isAvailable = true - } - it, err2 := convertLambdaLabsInstanceTypeToV1InstanceType(region.Name, resp.InstanceType, isAvailable) - if err2 != nil { - return v1.InstanceType{}, err2 - } - return it, nil - }) - if err1 != nil { - return []v1.InstanceType{}, err1 - } - return its, nil - }) - if err != nil { - return nil, err - } - instanceTypesFlattened := collections.Flatten(instanceTypes) - - if len(args.Locations) == 0 { - if c.location != "" { - args.Locations = []string{c.location} - } else { - args.Locations = v1.All - } - } - - if !args.Locations.IsAll() { - instanceTypesFlattened = collections.Filter(instanceTypesFlattened, func(it v1.InstanceType) bool { - return collections.ListContains(args.Locations, it.Location) - }) - } - - if args.ArchitectureFilter != nil { - instanceTypesFlattened = collections.Filter(instanceTypesFlattened, func(instanceType v1.InstanceType) bool { - for _, arch := range instanceType.SupportedArchitectures { - if args.ArchitectureFilter.IsAllowed(arch) { - return true - } - } - return false - }) - } - if len(args.InstanceTypes) > 0 { - instanceTypesFlattened = collections.Filter(instanceTypesFlattened, func(instanceType v1.InstanceType) bool { - return collections.ListContains(args.InstanceTypes, instanceType.Type) - }) - } - - return instanceTypesFlattened, nil -} - -func (c *LambdaLabsClient) getInstanceTypes(ctx context.Context) (*openapi.InstanceTypes200Response, error) { - ilr, err := collections.RetryWithDataAndAttemptCount(func() (*openapi.InstanceTypes200Response, error) { - res, resp, err := c.client.DefaultAPI.InstanceTypes(c.makeAuthContext(ctx)).Execute() - if resp != nil { - defer resp.Body.Close() //nolint:errcheck // ignore because using defer (for some reason HandleErrDefer) - } - if err != nil { - return &openapi.InstanceTypes200Response{}, handleAPIError(ctx, resp, err) - } - return res, nil - }, c.backoff) - if err != nil { - return nil, err - } - - return ilr, nil -} - -func parseGPUFromDescription(input string) (v1.GPU, error) { - var gpu v1.GPU - - // Extract the count - countRegex := regexp.MustCompile(`(\d+)x`) - countMatch := countRegex.FindStringSubmatch(input) - if len(countMatch) == 0 { - return v1.GPU{}, fmt.Errorf("could not find count in %s", input) - } - count, _ := strconv.ParseInt(countMatch[1], 10, 32) - gpu.Count = int32(count) - - // Extract the memory - memoryRegex := regexp.MustCompile(`(\d+) GB`) - memoryMatch := memoryRegex.FindStringSubmatch(input) - if len(memoryMatch) == 0 { - return v1.GPU{}, fmt.Errorf("could not find memory in %s", input) - } - memoryStr := memoryMatch[1] - memoryGiB, _ := strconv.Atoi(memoryStr) - if memoryGiB > math.MaxInt32 { - memoryGiB = math.MaxInt32 - } - gpu.Memory = units.GiB * units.Base2Bytes(memoryGiB) - gpu.MemoryBytes = v1.NewBytes(v1.BytesValue(memoryGiB), v1.Gibibyte) - - // Extract the network details - networkRegex := regexp.MustCompile(`(\w+\s?)+\)`) - networkMatch := networkRegex.FindStringSubmatch(input) - if len(networkMatch) == 0 { - return v1.GPU{}, fmt.Errorf("could not find network details in %s", input) - } - networkStr := strings.TrimSuffix(networkMatch[0], ")") - networkDetails := strings.TrimSpace(strings.ReplaceAll(networkStr, memoryStr+" GB", "")) - gpu.NetworkDetails = networkDetails - - // Extract the name - nameRegex := regexp.MustCompile(`x (.*?) \(`) - nameMatch := nameRegex.FindStringSubmatch(input) - if len(nameMatch) == 0 { - return v1.GPU{}, fmt.Errorf("could not find name in %s", input) - } - nameStr := strings.TrimRight(strings.TrimLeft(nameMatch[0], "x "), " (") - nameStr = regexp.MustCompile(`(?i)^Tesla\s+`).ReplaceAllString(nameStr, "") - gpu.Name = nameStr - if networkDetails != "" { - gpu.Type = nameStr + "." + networkDetails - } else { - gpu.Type = nameStr - } - - gpu.Manufacturer = "NVIDIA" - - return gpu, nil -} - -func convertLambdaLabsInstanceTypeToV1InstanceType(location string, instType openapi.InstanceType, isAvailable bool) (v1.InstanceType, error) { - gpus := []v1.GPU{} - if !strings.Contains(instType.Description, "CPU") { - gpu, err := parseGPUFromDescription(instType.Description) - if err != nil { - return v1.InstanceType{}, err - } - gpus = append(gpus, gpu) - } - amount, err := currency.NewAmountFromInt64(int64(instType.PriceCentsPerHour), "USD") - if err != nil { - return v1.InstanceType{}, err - } - - it := v1.InstanceType{ - Location: location, - Type: instType.Name, - SupportedGPUs: gpus, - SupportedStorage: []v1.Storage{ - { - Type: "ssd", - Count: 1, - Size: units.GiB * units.Base2Bytes(instType.Specs.StorageGib), - SizeBytes: v1.NewBytes(v1.BytesValue(instType.Specs.StorageGib), v1.Gibibyte), - }, - }, - SupportedUsageClasses: []string{"on-demand"}, - Memory: units.GiB * units.Base2Bytes(instType.Specs.MemoryGib), - MemoryBytes: v1.NewBytes(v1.BytesValue(instType.Specs.MemoryGib), v1.Gibibyte), - MaximumNetworkInterfaces: 0, - NetworkPerformance: "", - SupportedNumCores: []int32{}, - DefaultCores: 0, - VCPU: instType.Specs.Vcpus, - SupportedArchitectures: []v1.Architecture{v1.ArchitectureX86_64}, - ClockSpeedInGhz: 0, - Stoppable: false, - Rebootable: true, - IsAvailable: isAvailable, - BasePrice: &amount, - Provider: CloudProviderID, - Cloud: CloudProviderID, - } - it.ID = v1.MakeGenericInstanceTypeID(it) - return it, nil -} diff --git a/v1/providers/lambdalabs/instancetype_test.go b/v1/providers/lambdalabs/instancetype_test.go deleted file mode 100644 index 9295d7f5..00000000 --- a/v1/providers/lambdalabs/instancetype_test.go +++ /dev/null @@ -1,266 +0,0 @@ -package v1 - -import ( - "context" - "testing" - "time" - - "github.com/alecthomas/units" - "github.com/jarcoal/httpmock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - v1 "github.com/brevdev/cloud/v1" - openapi "github.com/brevdev/cloud/v1/providers/lambdalabs/gen/lambdalabs" -) - -func TestLambdaLabsClient_GetInstanceTypes_Success(t *testing.T) { - client, cleanup := setupMockClient() - defer cleanup() - - mockResponse := createMockInstanceTypeResponse() - httpmock.RegisterResponder("GET", "https://cloud.lambda.ai/api/v1/instance-types", - httpmock.NewJsonResponderOrPanic(200, mockResponse)) - - instanceTypes, err := client.GetInstanceTypes(context.Background(), v1.GetInstanceTypeArgs{}) - require.NoError(t, err) - locations, err := getLambdaLabsLocations() - require.NoError(t, err) - assert.Len(t, instanceTypes, len(locations)*2) - - a10Type := findInstanceTypeByName(instanceTypes, "gpu_1x_a10") - require.NotNil(t, a10Type) - assert.Equal(t, "gpu_1x_a10", a10Type.Type) - assert.True(t, a10Type.IsAvailable) - assert.Len(t, a10Type.SupportedGPUs, 1) - assert.Equal(t, int32(1), a10Type.SupportedGPUs[0].Count) - assert.Equal(t, v1.ManufacturerNVIDIA, a10Type.SupportedGPUs[0].Manufacturer) - assert.Equal(t, "A10", a10Type.SupportedGPUs[0].Name) -} - -func TestLambdaLabsClient_GetInstanceTypes_FilterByLocation(t *testing.T) { - client, cleanup := setupMockClient() - defer cleanup() - - mockResponse := createMockInstanceTypeResponse() - httpmock.RegisterResponder("GET", "https://cloud.lambda.ai/api/v1/instance-types", - httpmock.NewJsonResponderOrPanic(200, mockResponse)) - - instanceTypes, err := client.GetInstanceTypes(context.Background(), v1.GetInstanceTypeArgs{ - Locations: v1.LocationsFilter{"us-west-1"}, - }) - require.NoError(t, err) - assert.Len(t, instanceTypes, 2) - - for _, instanceType := range instanceTypes { - assert.Equal(t, "us-west-1", instanceType.Location) - } -} - -func TestLambdaLabsClient_GetInstanceTypes_FilterByInstanceType(t *testing.T) { - client, cleanup := setupMockClient() - defer cleanup() - - mockResponse := createMockInstanceTypeResponse() - httpmock.RegisterResponder("GET", "https://cloud.lambda.ai/api/v1/instance-types", - httpmock.NewJsonResponderOrPanic(200, mockResponse)) - - instanceTypes, err := client.GetInstanceTypes(context.Background(), v1.GetInstanceTypeArgs{ - InstanceTypes: []string{"gpu_1x_a10"}, - }) - require.NoError(t, err) - locations, err := getLambdaLabsLocations() - require.NoError(t, err) - assert.Len(t, instanceTypes, len(locations)) - - for _, instanceType := range instanceTypes { - assert.Equal(t, "gpu_1x_a10", instanceType.Type) - } -} - -func TestLambdaLabsClient_GetInstanceTypes_FilterBoth(t *testing.T) { - client, cleanup := setupMockClient() - defer cleanup() - - mockResponse := createMockInstanceTypeResponse() - httpmock.RegisterResponder("GET", "https://cloud.lambda.ai/api/v1/instance-types", - httpmock.NewJsonResponderOrPanic(200, mockResponse)) - - instanceTypes, err := client.GetInstanceTypes(context.Background(), v1.GetInstanceTypeArgs{ - Locations: v1.LocationsFilter{"us-east-1"}, - InstanceTypes: []string{"gpu_8x_h100"}, - }) - require.NoError(t, err) - assert.Len(t, instanceTypes, 1) - assert.Equal(t, "gpu_8x_h100", instanceTypes[0].Type) - assert.Equal(t, "us-east-1", instanceTypes[0].Location) -} - -func TestLambdaLabsClient_GetInstanceTypes_Empty(t *testing.T) { - client, cleanup := setupMockClient() - defer cleanup() - - emptyResponse := openapi.InstanceTypes200Response{ - Data: map[string]openapi.InstanceTypes200ResponseDataValue{}, - } - httpmock.RegisterResponder("GET", "https://cloud.lambda.ai/api/v1/instance-types", - httpmock.NewJsonResponderOrPanic(200, emptyResponse)) - - instanceTypes, err := client.GetInstanceTypes(context.Background(), v1.GetInstanceTypeArgs{}) - require.NoError(t, err) - assert.Len(t, instanceTypes, 0) -} - -func TestLambdaLabsClient_GetInstanceTypes_Error(t *testing.T) { - client, cleanup := setupMockClient() - defer cleanup() - - httpmock.RegisterResponder("GET", "https://cloud.lambda.ai/api/v1/instance-types", - httpmock.NewStringResponder(500, `{"error": {"code": "INTERNAL_ERROR", "message": "Internal server error"}}`)) - - _, err := client.GetInstanceTypes(context.Background(), v1.GetInstanceTypeArgs{}) - assert.Error(t, err) -} - -func TestLambdaLabsClient_GetInstanceTypePollTime(t *testing.T) { - client := &LambdaLabsClient{} - pollTime := client.GetInstanceTypePollTime() - assert.Equal(t, 5*time.Minute, pollTime) -} - -func TestConvertLambdaLabsInstanceTypeToV1InstanceType(t *testing.T) { - llInstanceType := createMockLambdaLabsInstanceType("gpu_1x_a10", "1x NVIDIA A10 (24 GB)", "NVIDIA A10", 100) - - v1InstanceType, err := convertLambdaLabsInstanceTypeToV1InstanceType("us-west-1", llInstanceType, true) - require.NoError(t, err) - - assert.Equal(t, "gpu_1x_a10", v1InstanceType.Type) - assert.Equal(t, "us-west-1", v1InstanceType.Location) - assert.True(t, v1InstanceType.IsAvailable) - assert.Len(t, v1InstanceType.SupportedGPUs, 1) - - gpu := v1InstanceType.SupportedGPUs[0] - assert.Equal(t, int32(1), gpu.Count) - assert.Equal(t, v1.ManufacturerNVIDIA, gpu.Manufacturer) - assert.Equal(t, "NVIDIA A10", gpu.Name) - assert.Equal(t, "NVIDIA A10", gpu.Type) - assert.Equal(t, units.Base2Bytes(24*1024*1024*1024), gpu.Memory) - - assert.NotNil(t, v1InstanceType.BasePrice) - assert.Equal(t, "USD", v1InstanceType.BasePrice.CurrencyCode()) - assert.Equal(t, "1.00", v1InstanceType.BasePrice.Number()) -} - -func TestConvertLambdaLabsInstanceTypeToV1InstanceType_CPUOnly(t *testing.T) { - llInstanceType := createMockLambdaLabsInstanceType("cpu_4x", "4x CPU cores", "", 50) - - v1InstanceType, err := convertLambdaLabsInstanceTypeToV1InstanceType("us-west-1", llInstanceType, true) - require.NoError(t, err) - - assert.Equal(t, "cpu_4x", v1InstanceType.Type) - assert.Equal(t, "us-west-1", v1InstanceType.Location) - assert.True(t, v1InstanceType.IsAvailable) - assert.Len(t, v1InstanceType.SupportedGPUs, 0) -} - -func TestParseGPUFromDescription(t *testing.T) { - tests := []struct { - description string - expected v1.GPU - }{ - { - description: "1x H100 (80 GB SXM5)", - expected: v1.GPU{ - Count: 1, - Manufacturer: v1.ManufacturerNVIDIA, - Name: "H100", - Type: "H100.SXM5", - Memory: 80 * 1024 * 1024 * 1024, - NetworkDetails: "80 GB SXM5", - MemoryDetails: "80 GB", - }, - }, - { - description: "8x Tesla V100 (16 GB)", - expected: v1.GPU{ - Count: 8, - Manufacturer: v1.ManufacturerNVIDIA, - Name: "V100", - Type: "V100", - Memory: 16 * 1024 * 1024 * 1024, - MemoryDetails: "16 GB", - }, - }, - } - - for _, tt := range tests { - t.Run(tt.description, func(t *testing.T) { - gpu, err := parseGPUFromDescription(tt.description) - require.NoError(t, err) - assert.Equal(t, tt.expected.Count, gpu.Count) - assert.Equal(t, tt.expected.Manufacturer, gpu.Manufacturer) - assert.Equal(t, tt.expected.Name, gpu.Name) - assert.Equal(t, tt.expected.Type, gpu.Type) - assert.Equal(t, tt.expected.Memory, gpu.Memory) - }) - } -} - -func createMockInstanceTypeResponse() openapi.InstanceTypes200Response { - return openapi.InstanceTypes200Response{ - Data: map[string]openapi.InstanceTypes200ResponseDataValue{ - "gpu_1x_a10": { - InstanceType: createMockLambdaLabsInstanceType("gpu_1x_a10", "1x A10 (24 GB)", "A10", 100), - RegionsWithCapacityAvailable: []openapi.Region{ - createMockRegion("us-west-1", "US West 1"), - createMockRegion("us-east-1", "US East 1"), - }, - }, - "gpu_8x_h100": { - InstanceType: createMockLambdaLabsInstanceType("gpu_8x_h100", "8x H100 (80 GB SXM5)", "H100", 3200), - RegionsWithCapacityAvailable: []openapi.Region{ - createMockRegion("us-east-1", "US East 1"), - }, - }, - }, - } -} - -func createMockLambdaLabsInstanceType(name, description, gpuDescription string, priceCents int32) openapi.InstanceType { - gpuCount := int32(0) - if gpuDescription != "" { - gpuCount = 1 - if name == "gpu_8x_h100" { - gpuCount = 8 - } - } - - return openapi.InstanceType{ - Name: name, - Description: description, - GpuDescription: gpuDescription, - PriceCentsPerHour: priceCents, - Specs: openapi.InstanceTypeSpecs{ - Vcpus: 8, - MemoryGib: 32, - StorageGib: 512, - Gpus: gpuCount, - }, - } -} - -func createMockRegion(name, description string) openapi.Region { - return openapi.Region{ - Name: name, - Description: description, - } -} - -func findInstanceTypeByName(instanceTypes []v1.InstanceType, name string) *v1.InstanceType { - for _, instanceType := range instanceTypes { - if instanceType.Type == name { - return &instanceType - } - } - return nil -} diff --git a/v1/providers/lambdalabs/location.go b/v1/providers/lambdalabs/location.go deleted file mode 100644 index 411f1147..00000000 --- a/v1/providers/lambdalabs/location.go +++ /dev/null @@ -1,63 +0,0 @@ -package v1 - -import ( - "context" - "encoding/json" - "fmt" - - v1 "github.com/brevdev/cloud/v1" -) - -const lambdaLocationsData = `[ - {"location_name": "us-west-1", "description": "California, USA", "country": "USA"}, - {"location_name": "us-west-2", "description": "Arizona, USA", "country": "USA"}, - {"location_name": "us-west-3", "description": "Utah, USA", "country": "USA"}, - {"location_name": "us-south-1", "description": "Texas, USA", "country": "USA"}, - {"location_name": "us-east-1", "description": "Virginia, USA", "country": "USA"}, - {"location_name": "us-midwest-1", "description": "Illinois, USA", "country": "USA"}, - {"location_name": "australia-southeast-1", "description": "Australia", "country": "AUS"}, - {"location_name": "europe-central-1", "description": "Germany", "country": "DEU"}, - {"location_name": "asia-south-1", "description": "India", "country": "IND"}, - {"location_name": "me-west-1", "description": "Israel", "country": "ISR"}, - {"location_name": "europe-south-1", "description": "Italy", "country": "ITA"}, - {"location_name": "asia-northeast-1", "description": "Osaka, Japan", "country": "JPN"}, - {"location_name": "asia-northeast-2", "description": "Tokyo, Japan", "country": "JPN"}, - {"location_name": "us-east-3", "description": "Washington D.C, USA", "country": "USA"}, - {"location_name": "us-east-2", "description": "Washington D.C, USA", "country": "USA"}, - {"location_name": "australia-east-1", "description": "Sydney, Australia", "country": "AUS"}, - {"location_name": "us-south-3", "description": "Central Texas, USA", "country": "USA"}, - {"location_name": "us-south-2", "description": "North Texas, USA", "country": "USA"} -]` - -type LambdaLocation struct { - LocationName string `json:"location_name"` - Description string `json:"description"` - Country string `json:"country"` -} - -func getLambdaLabsLocations() ([]LambdaLocation, error) { - var locationData []LambdaLocation - if err := json.Unmarshal([]byte(lambdaLocationsData), &locationData); err != nil { - return nil, fmt.Errorf("failed to parse location data: %w", err) - } - return locationData, nil -} - -func (c *LambdaLabsClient) GetLocations(_ context.Context, _ v1.GetLocationsArgs) ([]v1.Location, error) { - locationData, err := getLambdaLabsLocations() - if err != nil { - return nil, err - } - - locations := make([]v1.Location, 0, len(locationData)) - for _, location := range locationData { - locations = append(locations, v1.Location{ - Name: location.LocationName, - Description: location.Description, - Available: true, - Country: location.Country, - }) - } - - return locations, nil -} diff --git a/v1/providers/lambdalabs/location_test.go b/v1/providers/lambdalabs/location_test.go deleted file mode 100644 index b7b1f993..00000000 --- a/v1/providers/lambdalabs/location_test.go +++ /dev/null @@ -1 +0,0 @@ -package v1 diff --git a/v1/providers/lambdalabs/validation_test.go b/v1/providers/lambdalabs/validation_test.go deleted file mode 100644 index 8778becf..00000000 --- a/v1/providers/lambdalabs/validation_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package v1 - -import ( - "os" - "testing" - - "github.com/brevdev/cloud/internal/validation" - v1 "github.com/brevdev/cloud/v1" -) - -func TestValidationFunctions(t *testing.T) { - checkSkip(t) - apiKey := getAPIKey() - - config := validation.ProviderConfig{ - Credential: NewLambdaLabsCredential("validation-test", apiKey), - StableIDs: []v1.InstanceTypeID{"us-west-1-noSub-gpu_8x_a100_80gb_sxm4", "us-east-1-noSub-gpu_8x_a100_80gb_sxm4"}, - } - - validation.RunValidationSuite(t, config) -} - -func TestInstanceLifecycleValidation(t *testing.T) { - checkSkip(t) - apiKey := getAPIKey() - - config := validation.ProviderConfig{ - Credential: NewLambdaLabsCredential("validation-test", apiKey), - } - - validation.RunInstanceLifecycleValidation(t, config) -} - -func checkSkip(t *testing.T) { - apiKey := getAPIKey() - isValidationTest := os.Getenv("VALIDATION_TEST") - if apiKey == "" && isValidationTest != "" { - t.Fatal("LAMBDALABS_API_KEY not set, but VALIDATION_TEST is set") - } else if apiKey == "" && isValidationTest == "" { - t.Skip("LAMBDALABS_API_KEY not set, skipping LambdaLabs validation tests") - } -} - -func getAPIKey() string { - return os.Getenv("LAMBDALABS_API_KEY") -}