Skip to content

Commit b8170b3

Browse files
authored
Merge pull request #438 from IBM-Cloud/version-1.7.0
Changes to create version 1.7.0
2 parents b6bdedd + 31ba197 commit b8170b3

File tree

4 files changed

+41
-1
lines changed

4 files changed

+41
-1
lines changed

bluemix/configuration/core_config/bx_config.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ type BXConfigData struct {
5555
AlphaCommandsEnabled string
5656
HTTPTimeout int
5757
TypeOfSSO string
58+
FallbackAccount models.Account
5859
FallbackIAMTokens struct {
5960
IAMToken string
6061
IAMRefreshToken string
@@ -430,6 +431,13 @@ func (c *bxConfig) TypeOfSSO() (style string) {
430431
return
431432
}
432433

434+
func (c *bxConfig) FallbackAccount() (a models.Account) {
435+
c.read(func() {
436+
a = c.data.FallbackAccount
437+
})
438+
return
439+
}
440+
433441
func (c *bxConfig) FallbackIAMToken() (t string) {
434442
c.read(func() {
435443
t = c.data.FallbackIAMTokens.IAMToken
@@ -669,6 +677,14 @@ func (c *bxConfig) SetTypeOfSSO(style string) {
669677
})
670678
}
671679

680+
func (c *bxConfig) SetFallbackAccount(guid, name, owner string) {
681+
c.write(func() {
682+
c.data.FallbackAccount.GUID = guid
683+
c.data.FallbackAccount.Name = name
684+
c.data.FallbackAccount.Owner = owner
685+
})
686+
}
687+
672688
func (c *bxConfig) SetFallbackIAMTokens(token, refreshToken string) {
673689
c.write(func() {
674690
c.data.FallbackIAMTokens.IAMToken = token

bluemix/configuration/core_config/bx_config_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,28 @@ func TestMOD(t *testing.T) {
454454
t.Cleanup(cleanupConfigFiles)
455455
}
456456

457+
func TestFallback(t *testing.T) {
458+
459+
config := prepareConfigForCLI(`{}`, t)
460+
461+
// check initial state
462+
assert.Empty(t, config.FallbackAccount().GUID)
463+
assert.Empty(t, config.FallbackIAMToken())
464+
assert.Empty(t, config.FallbackIAMRefreshToken())
465+
466+
// update mod time and check that mod should not be checked again
467+
config.SetFallbackAccount("value1", "value2", "value3")
468+
assert.True(t, config.FallbackAccount().GUID == "value1")
469+
assert.True(t, config.FallbackAccount().Name == "value2")
470+
assert.True(t, config.FallbackAccount().Owner == "value3")
471+
472+
config.SetFallbackIAMTokens("value1", "value2")
473+
assert.True(t, config.FallbackIAMToken() == "value1")
474+
assert.True(t, config.FallbackIAMRefreshToken() == "value2")
475+
476+
t.Cleanup(cleanupConfigFiles)
477+
}
478+
457479
func TestLastUpdateSessionTime(t *testing.T) {
458480

459481
config := prepareConfigForCLI(`{}`, t)

bluemix/configuration/core_config/repository.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ type Repository interface {
5454
TypeOfSSO() string
5555
AlphaCommandsEnabled() string
5656
AssumedTrustedProfileId() string
57+
FallbackAccount() models.Account
5758
FallbackIAMToken() string
5859
FallbackIAMRefreshToken() string
5960
HTTPTimeout() int
@@ -95,6 +96,7 @@ type Repository interface {
9596
SetIAMToken(string)
9697
SetIAMRefreshToken(string)
9798
SetFallbackIAMTokens(string, string)
99+
SetFallbackAccount(string, string, string)
98100
SetAssumedTrustedProfileId(string)
99101
ClearSession()
100102
SetAccount(models.Account)

bluemix/version.go

Lines changed: 1 addition & 1 deletion
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: 6, Build: 2}
6+
var Version = VersionType{Major: 1, Minor: 7, Build: 0}
77

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

0 commit comments

Comments
 (0)