forked from scaleway/scaleway-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb.go
More file actions
37 lines (29 loc) · 798 Bytes
/
web.go
File metadata and controls
37 lines (29 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package web
import (
"net/http"
"github.com/scaleway/scaleway-sdk-go/scw"
)
type Platform struct {
UserAgent string
JWT string
DefaultProjectID string
}
func (p *Platform) CreateClient(client *http.Client, _ string, _ string) (*scw.Client, error) {
opts := []scw.ClientOption{
scw.WithDefaultRegion(scw.RegionFrPar),
scw.WithDefaultZone(scw.ZoneFrPar1),
scw.WithUserAgent(p.UserAgent),
scw.WithUserAgent("cli/web"),
scw.WithProfile(scw.LoadEnvProfile()),
scw.WithHTTPClient(client),
scw.WithJWT(p.JWT),
}
if p.DefaultProjectID != "" {
opts = append(opts, scw.WithDefaultProjectID(p.DefaultProjectID))
}
return scw.NewClient(opts...)
}
func (p *Platform) ScwConfig() *scw.Config {
return nil
}
func (p *Platform) SetScwConfig(_ *scw.Config) {}