Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions .github/workflows/validation-lambdalabs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ on:
# Allow manual triggering
pull_request:
paths:
- 'internal/lambdalabs/**'
- 'lambdalabs/**'
- 'internal/validation/**'
- 'pkg/v1/**'
- '**/*.go'
branches: [ main ]

jobs:
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
TEST_PUBLIC_KEY_BASE64: ${{ secrets.TEST_PUBLIC_KEY_BASE64 }}
VALIDATION_TEST: true
run: |
cd internal/lambdalabs
cd lambdalabs
go test -v -short=false -timeout=30m ./...

- name: Upload test results
Expand All @@ -56,4 +56,4 @@ jobs:
with:
name: lambdalabs-validation-results
path: |
internal/lambdalabs/coverage.out
lambdalabs/coverage.out
8 changes: 4 additions & 4 deletions .github/workflows/validation-shadeform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ on:
# Allow manual triggering
pull_request:
paths:
- 'internal/shadeform/**'
- 'shadeform/**'
- 'internal/validation/**'
- 'pkg/v1/**'
- '**/*.go'
branches: [ main ]

jobs:
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
TEST_PUBLIC_KEY_BASE64: ${{ secrets.TEST_PUBLIC_KEY_BASE64 }}
VALIDATION_TEST: true
run: |
cd internal/shadeform
cd shadeform
go test -v -short=false -timeout=30m ./...

- name: Upload test results
Expand All @@ -56,4 +56,4 @@ jobs:
with:
name: shadeform-validation-results
path: |
internal/shadeform/coverage.out
shadeform/coverage.out
7 changes: 7 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": []
}
File renamed without changes.
2 changes: 1 addition & 1 deletion pkg/v1/capabilities.go → cloud/capabilities.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v1
package cloud

type Capability string

Expand Down
2 changes: 1 addition & 1 deletion pkg/v1/client.go → cloud/client.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v1
package cloud

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/v1/errors.go → cloud/errors.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v1
package cloud

import "errors"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Generate fluidstack client
generate-fluidstack-client:
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v7.8.0 generate \
--additional-properties disallowAdditionalPropertiesIfNotPresent=false \
Expand All @@ -7,5 +8,5 @@ generate-fluidstack-client:
--git-repo-id cloud \
-o /local/gen/fluidstack
sudo chown -R $(shell id -u):$(shell id -g) gen/fluidstack
gofmt -s -w gen/fluidstack
gofmt -s -w internal/gen/fluidstack
rm -rf gen/fluidstack/go.mod gen/fluidstack/go.sum
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions cloud/fluidstack/capabilities.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package fluidstack

import (
"context"

"github.com/brevdev/sdk/cloud"
)

func (c *FluidStackClient) GetCapabilities(_ context.Context) (cloud.Capabilities, error) {
capabilities := cloud.Capabilities{
cloud.CapabilityCreateInstance,
cloud.CapabilityTerminateInstance,
cloud.CapabilityStopStartInstance,
cloud.CapabilityTags,
cloud.CapabilityInstanceUserData,
}

return capabilities, nil
}
30 changes: 15 additions & 15 deletions internal/fluidstack/v1/client.go → cloud/fluidstack/client.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package v1
package fluidstack

import (
"context"
"crypto/sha256"
"fmt"
"net/http"

openapi "github.com/brevdev/cloud/internal/fluidstack/gen/fluidstack"
"github.com/brevdev/cloud/pkg/v1"
"github.com/brevdev/sdk/cloud"
openapi "github.com/brevdev/sdk/cloud/fluidstack/gen/fluidstack"
)

const CloudProviderID = "fluidstack"
Expand All @@ -18,7 +18,7 @@ type FluidStackCredential struct {
APIKey string
}

var _ v1.CloudCredential = &FluidStackCredential{}
var _ cloud.CloudCredential = &FluidStackCredential{}

func NewFluidStackCredential(refID, apiKey string) *FluidStackCredential {
return &FluidStackCredential{
Expand All @@ -33,12 +33,12 @@ func (c *FluidStackCredential) GetReferenceID() string {
}

// GetAPIType returns the API type for FluidStack
func (c *FluidStackCredential) GetAPIType() v1.APIType {
return v1.APITypeGlobal
func (c *FluidStackCredential) GetAPIType() cloud.APIType {
return cloud.APITypeGlobal
}

// GetCloudProviderID returns the cloud provider ID for FluidStack
func (c *FluidStackCredential) GetCloudProviderID() v1.CloudProviderID {
func (c *FluidStackCredential) GetCloudProviderID() cloud.CloudProviderID {
return CloudProviderID
}

Expand All @@ -48,7 +48,7 @@ func (c *FluidStackCredential) GetTenantID() (string, error) {
}

// GetCapabilities returns the capabilities for FluidStack
func (c *FluidStackCredential) GetCapabilities(ctx context.Context) (v1.Capabilities, error) {
func (c *FluidStackCredential) GetCapabilities(ctx context.Context) (cloud.Capabilities, error) {
client, err := c.MakeClient(ctx, "")
if err != nil {
return nil, err
Expand All @@ -57,22 +57,22 @@ func (c *FluidStackCredential) GetCapabilities(ctx context.Context) (v1.Capabili
}

// MakeClient creates a new FluidStack client from this credential
func (c *FluidStackCredential) MakeClient(_ context.Context, _ string) (v1.CloudClient, error) {
func (c *FluidStackCredential) MakeClient(_ context.Context, _ string) (cloud.CloudClient, error) {
return NewFluidStackClient(c.RefID, c.APIKey), nil
}

// FluidStackClient implements the CloudClient interface for FluidStack
// It embeds NotImplCloudClient to handle unsupported features
type FluidStackClient struct {
v1.NotImplCloudClient
cloud.NotImplCloudClient
refID string
apiKey string
baseURL string
projectID string
client *openapi.APIClient
}

var _ v1.CloudClient = &FluidStackClient{}
var _ cloud.CloudClient = &FluidStackClient{}

func NewFluidStackClient(refID, apiKey string) *FluidStackClient {
config := openapi.NewConfiguration()
Expand All @@ -88,17 +88,17 @@ func NewFluidStackClient(refID, apiKey string) *FluidStackClient {
}

// GetAPIType returns the API type for FluidStack
func (c *FluidStackClient) GetAPIType() v1.APIType {
return v1.APITypeGlobal
func (c *FluidStackClient) GetAPIType() cloud.APIType {
return cloud.APITypeGlobal
}

// GetCloudProviderID returns the cloud provider ID for FluidStack
func (c *FluidStackClient) GetCloudProviderID() v1.CloudProviderID {
func (c *FluidStackClient) GetCloudProviderID() cloud.CloudProviderID {
return CloudProviderID
}

// MakeClient creates a new client instance
func (c *FluidStackClient) MakeClient(_ context.Context, _ string) (v1.CloudClient, error) {
func (c *FluidStackClient) MakeClient(_ context.Context, _ string) (cloud.CloudClient, error) {
return c, nil
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading