Skip to content

Commit

Permalink
Merge pull request #410 from IBM-Cloud/dev
Browse files Browse the repository at this point in the history
chore: merge `dev` branch to `master` for version 1.5.0
  • Loading branch information
steveclay authored Jul 5, 2024
2 parents bfe8b18 + 9a70219 commit f6bda08
Show file tree
Hide file tree
Showing 8 changed files with 1,678 additions and 32 deletions.
99 changes: 69 additions & 30 deletions bluemix/configuration/core_config/bx_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,41 @@ func (r raw) Unmarshal(bytes []byte) error {
}

type BXConfigData struct {
APIEndpoint string
IsPrivate bool
IsAccessFromVPC bool
ConsoleEndpoint string
ConsolePrivateEndpoint string
ConsolePrivateVPCEndpoint string
CloudType string
CloudName string
CRIType string
Region string
RegionID string
IAMEndpoint string
IAMPrivateEndpoint string
IAMPrivateVPCEndpoint string
IAMToken string
IAMRefreshToken string
IsLoggedInAsCRI bool
Account models.Account
Profile models.Profile
ResourceGroup models.ResourceGroup
LoginAt time.Time
PluginRepos []models.PluginRepo
SSLDisabled bool
Locale string
MessageOfTheDayTime int64
LastSessionUpdateTime int64
Trace string
ColorEnabled string
HTTPTimeout int
TypeOfSSO string
APIEndpoint string
IsPrivate bool
IsAccessFromVPC bool
ConsoleEndpoint string
ConsolePrivateEndpoint string
ConsolePrivateVPCEndpoint string
CloudType string
CloudName string
CRIType string
Region string
RegionID string
IAMEndpoint string
IAMPrivateEndpoint string
IAMPrivateVPCEndpoint string
IAMToken string
IAMRefreshToken string
IsLoggedInAsCRI bool
Account models.Account
Profile models.Profile
ResourceGroup models.ResourceGroup
LoginAt time.Time
PluginRepos []models.PluginRepo
SSLDisabled bool
Locale string
MessageOfTheDayTime int64
LastSessionUpdateTime int64
Trace string
ColorEnabled string
HTTPTimeout int
TypeOfSSO string
FallbackIAMTokens struct {
IAMToken string
IAMRefreshToken string
}
AssumedTrustedProfileId string
CLIInfoEndpoint string // overwrite the cli info endpoint
CheckCLIVersionDisabled bool
UsageStatsDisabled bool // deprecated: use UsageStatsEnabled
Expand Down Expand Up @@ -417,6 +422,27 @@ func (c *bxConfig) TypeOfSSO() (style string) {
return
}

func (c *bxConfig) FallbackIAMToken() (t string) {
c.read(func() {
t = c.data.FallbackIAMTokens.IAMToken
})
return
}

func (c *bxConfig) FallbackIAMRefreshToken() (t string) {
c.read(func() {
t = c.data.FallbackIAMTokens.IAMRefreshToken
})
return
}

func (c *bxConfig) AssumedTrustedProfileId() (id string) {
c.read(func() {
id = c.data.AssumedTrustedProfileId
})
return
}

func (c *bxConfig) HTTPTimeout() (timeout int) {
c.read(func() {
timeout = c.data.HTTPTimeout
Expand Down Expand Up @@ -635,6 +661,19 @@ func (c *bxConfig) SetTypeOfSSO(style string) {
})
}

func (c *bxConfig) SetFallbackIAMTokens(token, refreshToken string) {
c.write(func() {
c.data.FallbackIAMTokens.IAMToken = token
c.data.FallbackIAMTokens.IAMRefreshToken = refreshToken
})
}

func (c *bxConfig) SetAssumedTrustedProfileId(id string) {
c.write(func() {
c.data.AssumedTrustedProfileId = id
})
}

func (c *bxConfig) SetCheckCLIVersionDisabled(disabled bool) {
c.write(func() {
c.data.CheckCLIVersionDisabled = disabled
Expand Down
5 changes: 5 additions & 0 deletions bluemix/configuration/core_config/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ type Repository interface {
PluginRepo(string) (models.PluginRepo, bool)
IsSSLDisabled() bool
TypeOfSSO() string
AssumedTrustedProfileId() string
FallbackIAMToken() string
FallbackIAMRefreshToken() string
HTTPTimeout() int
CLIInfoEndpoint() string
CheckCLIVersionDisabled() bool
Expand Down Expand Up @@ -90,6 +93,8 @@ type Repository interface {
SetRegion(models.Region)
SetIAMToken(string)
SetIAMRefreshToken(string)
SetFallbackIAMTokens(string, string)
SetAssumedTrustedProfileId(string)
ClearSession()
SetAccount(models.Account)
SetProfile(models.Profile)
Expand Down
6 changes: 5 additions & 1 deletion bluemix/crn/crn.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func Parse(s string) (CRN, error) {
}

func (c CRN) String() string {
return strings.Join([]string{
joinedValue := strings.Join([]string{
c.Scheme,
c.Version,
c.CName,
Expand All @@ -126,6 +126,10 @@ func (c CRN) String() string {
c.ResourceType,
c.Resource,
}, crnSeparator)
if joinedValue == ":::::::::" {
return "" // do not return a CRN that is just a series of separators, with no string content
}
return joinedValue
}

func (c CRN) ScopeSegment() string {
Expand Down
2 changes: 1 addition & 1 deletion bluemix/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package bluemix
import "fmt"

// Version is the SDK version
var Version = VersionType{Major: 1, Minor: 4, Build: 0}
var Version = VersionType{Major: 1, Minor: 5, Build: 0}

// VersionType describe version info
type VersionType struct {
Expand Down
2 changes: 2 additions & 0 deletions plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ type Flag struct {
}

// Plugin is an interface for Bluemix CLI plugins.
//
//go:generate counterfeiter . Plugin
type Plugin interface {
// GetMetadata returns the metadata of the plugin.
GetMetadata() PluginMetadata
Expand Down
2 changes: 2 additions & 0 deletions plugin/plugin_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ func (e PluginConfigInvalidTypeError) Error() string {

// PluginConfig defines methods to access plug-in's private configuration stored
// in a JSON format.
//
//go:generate counterfeiter . PluginConfig
type PluginConfig interface {
// Get returns the value for a given key.
// The value can be float64, bool, string, []interface{},
Expand Down
148 changes: 148 additions & 0 deletions plugin/pluginfakes/fake_plugin.go

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

Loading

0 comments on commit f6bda08

Please sign in to comment.