Skip to content

Commit f6bda08

Browse files
authoredJul 5, 2024
Merge pull request #410 from IBM-Cloud/dev
chore: merge `dev` branch to `master` for version 1.5.0
2 parents bfe8b18 + 9a70219 commit f6bda08

File tree

8 files changed

+1678
-32
lines changed

8 files changed

+1678
-32
lines changed
 

‎bluemix/configuration/core_config/bx_config.go

+69-30
Original file line numberDiff line numberDiff line change
@@ -24,36 +24,41 @@ func (r raw) Unmarshal(bytes []byte) error {
2424
}
2525

2626
type BXConfigData struct {
27-
APIEndpoint string
28-
IsPrivate bool
29-
IsAccessFromVPC bool
30-
ConsoleEndpoint string
31-
ConsolePrivateEndpoint string
32-
ConsolePrivateVPCEndpoint string
33-
CloudType string
34-
CloudName string
35-
CRIType string
36-
Region string
37-
RegionID string
38-
IAMEndpoint string
39-
IAMPrivateEndpoint string
40-
IAMPrivateVPCEndpoint string
41-
IAMToken string
42-
IAMRefreshToken string
43-
IsLoggedInAsCRI bool
44-
Account models.Account
45-
Profile models.Profile
46-
ResourceGroup models.ResourceGroup
47-
LoginAt time.Time
48-
PluginRepos []models.PluginRepo
49-
SSLDisabled bool
50-
Locale string
51-
MessageOfTheDayTime int64
52-
LastSessionUpdateTime int64
53-
Trace string
54-
ColorEnabled string
55-
HTTPTimeout int
56-
TypeOfSSO string
27+
APIEndpoint string
28+
IsPrivate bool
29+
IsAccessFromVPC bool
30+
ConsoleEndpoint string
31+
ConsolePrivateEndpoint string
32+
ConsolePrivateVPCEndpoint string
33+
CloudType string
34+
CloudName string
35+
CRIType string
36+
Region string
37+
RegionID string
38+
IAMEndpoint string
39+
IAMPrivateEndpoint string
40+
IAMPrivateVPCEndpoint string
41+
IAMToken string
42+
IAMRefreshToken string
43+
IsLoggedInAsCRI bool
44+
Account models.Account
45+
Profile models.Profile
46+
ResourceGroup models.ResourceGroup
47+
LoginAt time.Time
48+
PluginRepos []models.PluginRepo
49+
SSLDisabled bool
50+
Locale string
51+
MessageOfTheDayTime int64
52+
LastSessionUpdateTime int64
53+
Trace string
54+
ColorEnabled string
55+
HTTPTimeout int
56+
TypeOfSSO string
57+
FallbackIAMTokens struct {
58+
IAMToken string
59+
IAMRefreshToken string
60+
}
61+
AssumedTrustedProfileId string
5762
CLIInfoEndpoint string // overwrite the cli info endpoint
5863
CheckCLIVersionDisabled bool
5964
UsageStatsDisabled bool // deprecated: use UsageStatsEnabled
@@ -417,6 +422,27 @@ func (c *bxConfig) TypeOfSSO() (style string) {
417422
return
418423
}
419424

425+
func (c *bxConfig) FallbackIAMToken() (t string) {
426+
c.read(func() {
427+
t = c.data.FallbackIAMTokens.IAMToken
428+
})
429+
return
430+
}
431+
432+
func (c *bxConfig) FallbackIAMRefreshToken() (t string) {
433+
c.read(func() {
434+
t = c.data.FallbackIAMTokens.IAMRefreshToken
435+
})
436+
return
437+
}
438+
439+
func (c *bxConfig) AssumedTrustedProfileId() (id string) {
440+
c.read(func() {
441+
id = c.data.AssumedTrustedProfileId
442+
})
443+
return
444+
}
445+
420446
func (c *bxConfig) HTTPTimeout() (timeout int) {
421447
c.read(func() {
422448
timeout = c.data.HTTPTimeout
@@ -635,6 +661,19 @@ func (c *bxConfig) SetTypeOfSSO(style string) {
635661
})
636662
}
637663

664+
func (c *bxConfig) SetFallbackIAMTokens(token, refreshToken string) {
665+
c.write(func() {
666+
c.data.FallbackIAMTokens.IAMToken = token
667+
c.data.FallbackIAMTokens.IAMRefreshToken = refreshToken
668+
})
669+
}
670+
671+
func (c *bxConfig) SetAssumedTrustedProfileId(id string) {
672+
c.write(func() {
673+
c.data.AssumedTrustedProfileId = id
674+
})
675+
}
676+
638677
func (c *bxConfig) SetCheckCLIVersionDisabled(disabled bool) {
639678
c.write(func() {
640679
c.data.CheckCLIVersionDisabled = disabled

‎bluemix/configuration/core_config/repository.go

+5
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ type Repository interface {
5252
PluginRepo(string) (models.PluginRepo, bool)
5353
IsSSLDisabled() bool
5454
TypeOfSSO() string
55+
AssumedTrustedProfileId() string
56+
FallbackIAMToken() string
57+
FallbackIAMRefreshToken() string
5558
HTTPTimeout() int
5659
CLIInfoEndpoint() string
5760
CheckCLIVersionDisabled() bool
@@ -90,6 +93,8 @@ type Repository interface {
9093
SetRegion(models.Region)
9194
SetIAMToken(string)
9295
SetIAMRefreshToken(string)
96+
SetFallbackIAMTokens(string, string)
97+
SetAssumedTrustedProfileId(string)
9398
ClearSession()
9499
SetAccount(models.Account)
95100
SetProfile(models.Profile)

‎bluemix/crn/crn.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func Parse(s string) (CRN, error) {
114114
}
115115

116116
func (c CRN) String() string {
117-
return strings.Join([]string{
117+
joinedValue := strings.Join([]string{
118118
c.Scheme,
119119
c.Version,
120120
c.CName,
@@ -126,6 +126,10 @@ func (c CRN) String() string {
126126
c.ResourceType,
127127
c.Resource,
128128
}, crnSeparator)
129+
if joinedValue == ":::::::::" {
130+
return "" // do not return a CRN that is just a series of separators, with no string content
131+
}
132+
return joinedValue
129133
}
130134

131135
func (c CRN) ScopeSegment() string {

‎bluemix/version.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package bluemix
33
import "fmt"
44

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

88
// VersionType describe version info
99
type VersionType struct {

‎plugin/plugin.go

+2
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ type Flag struct {
143143
}
144144

145145
// Plugin is an interface for Bluemix CLI plugins.
146+
//
147+
//go:generate counterfeiter . Plugin
146148
type Plugin interface {
147149
// GetMetadata returns the metadata of the plugin.
148150
GetMetadata() PluginMetadata

‎plugin/plugin_config.go

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ func (e PluginConfigInvalidTypeError) Error() string {
2525

2626
// PluginConfig defines methods to access plug-in's private configuration stored
2727
// in a JSON format.
28+
//
29+
//go:generate counterfeiter . PluginConfig
2830
type PluginConfig interface {
2931
// Get returns the value for a given key.
3032
// The value can be float64, bool, string, []interface{},

‎plugin/pluginfakes/fake_plugin.go

+148
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Failed to load comments.