Skip to content

Commit

Permalink
Merge pull request #8076 from hamzy/PowerVS-remove-IBM-Cloud/bluemix-…
Browse files Browse the repository at this point in the history
…go-4.15-2

[release-4.15] OCPBUGS-30011: PowerVS: remove IBM-Cloud/bluemix-go/api/account/accountv2 in 4.15
  • Loading branch information
openshift-merge-bot[bot] committed Feb 28, 2024
2 parents b1f2a2f + e18d663 commit be1f89b
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 377 deletions.
10 changes: 1 addition & 9 deletions pkg/asset/installconfig/platformpermscheck.go
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/openshift/installer/pkg/asset"
awsconfig "github.com/openshift/installer/pkg/asset/installconfig/aws"
gcpconfig "github.com/openshift/installer/pkg/asset/installconfig/gcp"
powervsconfig "github.com/openshift/installer/pkg/asset/installconfig/powervs"
"github.com/openshift/installer/pkg/types"
"github.com/openshift/installer/pkg/types/alibabacloud"
"github.com/openshift/installer/pkg/types/aws"
Expand Down Expand Up @@ -121,14 +120,7 @@ func (a *PlatformPermsCheck) Generate(dependencies asset.Parents) error {
case ibmcloud.Name:
// TODO: IBM[#90]: platformpermscheck
case powervs.Name:
bxCli, err := powervsconfig.NewBxClient(false)
if err != nil {
return err
}
err = bxCli.ValidateAccountPermissions()
if err != nil {
return err
}
// Nothing needs to be done here
case azure.Name, baremetal.Name, libvirt.Name, external.Name, none.Name, openstack.Name, ovirt.Name, vsphere.Name, alibabacloud.Name, nutanix.Name:
// no permissions to check
default:
Expand Down
30 changes: 0 additions & 30 deletions pkg/asset/installconfig/powervs/session.go
Expand Up @@ -13,7 +13,6 @@ import (

survey "github.com/AlecAivazis/survey/v2"
"github.com/IBM-Cloud/bluemix-go"
"github.com/IBM-Cloud/bluemix-go/api/account/accountv2"
"github.com/IBM-Cloud/bluemix-go/authentication"
"github.com/IBM-Cloud/bluemix-go/http"
"github.com/IBM-Cloud/bluemix-go/rest"
Expand All @@ -40,7 +39,6 @@ type BxClient struct {
Zone string
PISession *ibmpisession.IBMPISession
User *User
AccountAPIV2 accountv2.Accounts
PowerVSResourceGroup string
}

Expand Down Expand Up @@ -145,12 +143,6 @@ func NewBxClient(survey bool) (*BxClient, error) {
return nil, err
}

accClient, err := accountv2.New(bxSess)
if err != nil {
return nil, err
}

c.AccountAPIV2 = accClient.Accounts()
c.Session.Config.Region = powervs.Regions[sv.Region].VPCRegion

return c, nil
Expand Down Expand Up @@ -227,28 +219,6 @@ func getSessionVars(survey bool) (SessionVars, error) {
return sv, nil
}

// GetAccountType func return the type of account TRAIL/PAID
func (c *BxClient) GetAccountType() (string, error) {
myAccount, err := c.AccountAPIV2.Get((*c.User).Account)
if err != nil {
return "", err
}

return myAccount.Type, nil
}

// ValidateAccountPermissions Checks permission for provisioning Power VS resources
func (c *BxClient) ValidateAccountPermissions() error {
accType, err := c.GetAccountType()
if err != nil {
return err
}
if accType == "TRIAL" {
return fmt.Errorf("account type must be of Pay-As-You-Go/Subscription type for provision Power VS resources")
}
return nil
}

// NewPISession updates pisession details, return error on fail.
func (c *BxClient) NewPISession() error {
var authenticator core.Authenticator = &core.IamAuthenticator{
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit be1f89b

Please sign in to comment.