Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ require (
github.com/prometheus/common v0.66.1 // indirect
github.com/prometheus/procfs v0.17.0 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
github.com/sfcompute/sfc-go v0.0.0-20260416201327-643324aa73f0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/afero v1.15.0 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/spyzhov/ajson v0.8.0 // indirect
github.com/tidwall/gjson v1.18.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,16 @@ github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0t
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/sfcompute/nodes-go v0.1.0-alpha.4 h1:oFBWcMPSpqLYm/NDs5I1jTvzgx9rsXDL9Ghsm30Hc0Q=
github.com/sfcompute/nodes-go v0.1.0-alpha.4/go.mod h1:nUviHgK+Fgt2hDFcRL3M8VoyiypC8fc0dsY8C30QU8M=
github.com/sfcompute/sfc-go v0.0.0-20260416201327-643324aa73f0 h1:nBXgsBKgPRWpY2zVtHBceMG+RuEcE41Uvzb5U4gVdks=
github.com/sfcompute/sfc-go v0.0.0-20260416201327-643324aa73f0/go.mod h1:vhUpRpAHKitZzzWPg87RjreC+pzK57PGe4ZuSIQSk94=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg=
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spyzhov/ajson v0.8.0 h1:sFXyMbi4Y/BKjrsfkUZHSjA2JM1184enheSjjoT/zCc=
github.com/spyzhov/ajson v0.8.0/go.mod h1:63V+CGM6f1Bu/p4nLIN8885ojBdt88TbLoSFzyqMuVA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
Expand Down
27 changes: 18 additions & 9 deletions v1/providers/sfcompute/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package v1

import (
"context"
"net/http"
"sync"
"time"

v1 "github.com/brevdev/cloud/v1"
"github.com/sfcompute/nodes-go/option"

sfcnodes "github.com/sfcompute/nodes-go"
sfc "github.com/sfcompute/sfc-go"
)

const CloudProviderID = "sfcompute"
Expand Down Expand Up @@ -47,8 +48,13 @@ type SFCClient struct {
refID string
location string
apiKey string
client sfcnodes.Client
client *sfc.Sfc
baseURL string
httpClient *http.Client
logger v1.Logger

workspaceMu sync.Mutex
defaultWorkspace string
}

var _ v1.CloudClient = &SFCClient{}
Expand All @@ -62,12 +68,15 @@ func WithLogger(logger v1.Logger) SFCClientOption {
}

func (c *SFCCredential) MakeClientWithOptions(_ context.Context, location string, opts ...SFCClientOption) (v1.CloudClient, error) {
httpClient := &http.Client{Timeout: 60 * time.Second}
sfcClient := &SFCClient{
refID: c.RefID,
apiKey: c.APIKey,
client: sfcnodes.NewClient(option.WithBearerToken(c.APIKey)),
location: location,
logger: &v1.NoopLogger{},
refID: c.RefID,
apiKey: c.APIKey,
client: sfc.New(sfc.WithSecurity(c.APIKey), sfc.WithClient(httpClient), sfc.WithTimeout(60*time.Second)),
baseURL: "https://api.sfcompute.com",
httpClient: httpClient,
location: location,
logger: &v1.NoopLogger{},
}

for _, opt := range opts {
Expand Down
Loading