Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scaleway: migrate account API to IAM API #14733

Merged
Merged
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
12 changes: 6 additions & 6 deletions upup/pkg/fi/cloudup/scaleway/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"os"
"strings"

account "github.com/scaleway/scaleway-sdk-go/api/account/v2alpha1"
iam "github.com/scaleway/scaleway-sdk-go/api/iam/v1alpha1"
"github.com/scaleway/scaleway-sdk-go/api/instance/v1"
"github.com/scaleway/scaleway-sdk-go/scw"
v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -54,7 +54,7 @@ type ScwCloud interface {
Region() string
Zone() string

AccountService() *account.API
IamService() *iam.API
InstanceService() *instance.API

DeleteGroup(group *cloudinstances.CloudInstanceGroup) error
Expand Down Expand Up @@ -83,7 +83,7 @@ type scwCloudImplementation struct {
zone scw.Zone
tags map[string]string

accountAPI *account.API
iamAPI *iam.API
instanceAPI *instance.API
}

Expand Down Expand Up @@ -132,7 +132,7 @@ func NewScwCloud(tags map[string]string) (ScwCloud, error) {
region: region,
zone: zone,
tags: tags,
accountAPI: account.NewAPI(scwClient),
iamAPI: iam.NewAPI(scwClient),
instanceAPI: instance.NewAPI(scwClient),
}, nil
}
Expand Down Expand Up @@ -163,8 +163,8 @@ func (s *scwCloudImplementation) Zone() string {
return string(s.zone)
}

func (s *scwCloudImplementation) AccountService() *account.API {
return s.accountAPI
func (s *scwCloudImplementation) IamService() *iam.API {
return s.iamAPI
}

func (s *scwCloudImplementation) InstanceService() *instance.API {
Expand Down
8 changes: 4 additions & 4 deletions upup/pkg/fi/cloudup/scalewaytasks/sshkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"k8s.io/kops/upup/pkg/fi"
"k8s.io/kops/upup/pkg/fi/cloudup/scaleway"

account "github.com/scaleway/scaleway-sdk-go/api/account/v2alpha1"
iam "github.com/scaleway/scaleway-sdk-go/api/iam/v1alpha1"
"github.com/scaleway/scaleway-sdk-go/scw"
)

Expand All @@ -47,7 +47,7 @@ func (s *SSHKey) CompareWithID() *string {
func (s *SSHKey) Find(c *fi.Context) (*SSHKey, error) {
cloud := c.Cloud.(scaleway.ScwCloud)

keysResp, err := cloud.AccountService().ListSSHKeys(&account.ListSSHKeysRequest{
keysResp, err := cloud.IamService().ListSSHKeys(&iam.ListSSHKeysRequest{
Name: s.Name,
}, scw.WithAllPages())
if err != nil {
Expand Down Expand Up @@ -121,7 +121,7 @@ func (*SSHKey) RenderScw(c *fi.Context, actual, expected, changes *SSHKey) error
}
klog.V(2).Infof("Creating keypair with name: %q", name)

keyArgs := &account.CreateSSHKeyRequest{
keyArgs := &iam.CreateSSHKeyRequest{
Name: name}
if expected.PublicKey != nil {
d, err := fi.ResourceAsString(*expected.PublicKey)
Expand All @@ -131,7 +131,7 @@ func (*SSHKey) RenderScw(c *fi.Context, actual, expected, changes *SSHKey) error
keyArgs.PublicKey = d
}

key, err := cloud.AccountService().CreateSSHKey(keyArgs)
key, err := cloud.IamService().CreateSSHKey(keyArgs)
if err != nil {
return fmt.Errorf("error creating SSH keypair: %w", err)
}
Expand Down
Loading