-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathbx_config.go
864 lines (734 loc) · 18.2 KB
/
bx_config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
package core_config
import (
"encoding/json"
"sort"
"strings"
"sync"
"time"
"github.com/IBM-Cloud/ibm-cloud-cli-sdk/bluemix"
"github.com/IBM-Cloud/ibm-cloud-cli-sdk/bluemix/configuration"
"github.com/IBM-Cloud/ibm-cloud-cli-sdk/bluemix/models"
"github.com/fatih/structs"
)
type raw map[string]interface{}
func (r raw) Marshal() ([]byte, error) {
return json.MarshalIndent(r, "", " ")
}
func (r raw) Unmarshal(bytes []byte) error {
return json.Unmarshal(bytes, r)
}
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
AlphaCommandsEnabled string
HTTPTimeout int
TypeOfSSO string
FallbackAccount models.Account
FallbackIAMTokens struct {
IAMToken string
IAMRefreshToken string
}
AssumedTrustedProfileId string
CLIInfoEndpoint string // overwrite the cli info endpoint
CheckCLIVersionDisabled bool
UsageStatsDisabled bool // deprecated: use UsageStatsEnabled
UsageStatsEnabled bool
UsageStatsEnabledLastUpdate time.Time
SDKVersion string
UpdateCheckInterval time.Duration
UpdateRetryCheckInterval time.Duration
UpdateNotificationInterval time.Duration
PaginationURLs []models.PaginationURL
raw raw
}
func NewBXConfigData() *BXConfigData {
data := new(BXConfigData)
data.raw = make(map[string]interface{})
return data
}
func (data *BXConfigData) Marshal() ([]byte, error) {
return json.MarshalIndent(data, "", " ")
}
func (data *BXConfigData) Unmarshal(bytes []byte) error {
err := json.Unmarshal(bytes, data)
if err != nil {
return err
}
var raw raw
err = json.Unmarshal(bytes, &raw)
if err != nil {
return err
}
data.raw = raw
return nil
}
type bxConfig struct {
data *BXConfigData
persistor configuration.Persistor
initOnce *sync.Once
lock sync.RWMutex
onError func(error)
}
func createBluemixConfigFromPersistor(persistor configuration.Persistor, errHandler func(error)) *bxConfig {
return &bxConfig{
data: NewBXConfigData(),
persistor: persistor,
initOnce: new(sync.Once),
onError: errHandler,
}
}
func (c *bxConfig) init() {
c.initOnce.Do(func() {
err := c.persistor.Load(c.data)
if err != nil {
c.onError(err)
}
})
}
func (c *bxConfig) read(cb func()) {
/* concurrency note: init() calls the persistor's Load(), which has a flock,
via lockedRead() and lockedWrite(), surrounding the critical sections */
c.init()
cb()
}
func (c *bxConfig) write(cb func()) {
c.lock.Lock()
defer c.lock.Unlock()
c.init()
cb()
c.data.SDKVersion = bluemix.Version.String()
c.data.raw = structs.Map(c.data)
err := c.persistor.Save(c.data)
if err != nil {
c.onError(err)
}
}
func (c *bxConfig) writeRaw(cb func()) {
c.lock.Lock()
defer c.lock.Unlock()
c.init()
cb()
err := c.persistor.Save(c.data.raw)
if err != nil {
c.onError(err)
}
}
func (c *bxConfig) APIEndpoint() (endpoint string) {
c.read(func() {
endpoint = c.data.APIEndpoint
})
return
}
func (c *bxConfig) IsPrivateEndpointEnabled() (isPrivate bool) {
c.read(func() {
isPrivate = c.data.IsPrivate
})
return
}
func (c *bxConfig) IsLoggedInAsCRI() (isCRI bool) {
c.read(func() {
isCRI = c.data.IsLoggedInAsCRI
})
return
}
func (c *bxConfig) IsAccessFromVPC() (isVPC bool) {
c.read(func() {
isVPC = c.data.IsAccessFromVPC
})
return
}
func (c *bxConfig) HasAPIEndpoint() bool {
return c.APIEndpoint() != ""
}
func (c *bxConfig) IsSSLDisabled() (disabled bool) {
c.read(func() {
disabled = c.data.SSLDisabled
})
return
}
func (c *bxConfig) ConsoleEndpoints() (endpoints models.Endpoints) {
c.read(func() {
endpoints.PublicEndpoint = c.data.ConsoleEndpoint
endpoints.PrivateEndpoint = c.data.ConsolePrivateEndpoint
endpoints.PrivateVPCEndpoint = c.data.ConsolePrivateVPCEndpoint
})
return
}
func (c *bxConfig) CurrentRegion() (region models.Region) {
c.read(func() {
region = models.Region{
Name: c.data.Region,
}
})
return
}
func (c *bxConfig) HasTargetedRegion() bool {
r := c.CurrentRegion()
return r.Name != ""
}
func (c *bxConfig) CloudName() (cname string) {
c.read(func() {
cname = c.data.CloudName
})
return
}
func (c *bxConfig) CloudType() (ctype string) {
c.read(func() {
ctype = c.data.CloudType
})
return
}
func (c *bxConfig) CRIType() (criType string) {
c.read(func() {
criType = c.data.CRIType
})
return
}
func (c *bxConfig) IAMEndpoints() (endpoints models.Endpoints) {
c.read(func() {
endpoints.PublicEndpoint = c.data.IAMEndpoint
endpoints.PrivateEndpoint = c.data.IAMPrivateEndpoint
endpoints.PrivateVPCEndpoint = c.data.IAMPrivateVPCEndpoint
})
return
}
func (c *bxConfig) LoginAt() (loginAt time.Time) {
c.read(func() {
loginAt = c.data.LoginAt
})
return
}
func (c *bxConfig) IAMToken() (token string) {
c.read(func() {
token = c.data.IAMToken
})
return
}
func (c *bxConfig) IAMRefreshToken() (token string) {
c.read(func() {
token = c.data.IAMRefreshToken
})
return
}
func (c *bxConfig) UserEmail() (email string) {
c.read(func() {
email = NewIAMTokenInfo(c.data.IAMToken).UserEmail
})
return
}
func (c *bxConfig) UserDisplayText() (text string) {
c.read(func() {
token := NewIAMTokenInfo(c.data.IAMToken)
if token.UserEmail != "" {
text = token.UserEmail
} else {
text = token.Subject
}
})
return
}
func (c *bxConfig) IAMID() (guid string) {
c.read(func() {
guid = NewIAMTokenInfo(c.data.IAMToken).IAMID
})
return
}
// IsLoggedIn will check if the user is logged in. To determine if the user is logged in both the
// token and the refresh token will be checked
// If token is near expiration or expired, and a refresh token is present attempt to refresh the token.
// If token refresh was successful, check if the new IAM token is valid. If valid, user is logged in,
// otherwise user can be considered logged out. If refresh failed, then user is considered logged out.
// If no refresh token is present, and token is expired, then user is considered logged out.
func (c *bxConfig) IsLoggedIn() bool {
if token, refresh := c.IAMToken(), c.IAMRefreshToken(); token != "" || refresh != "" {
iamTokenInfo := NewIAMTokenInfo(token)
if iamTokenInfo.HasExpired() && refresh != "" {
repo := newRepository(c)
if _, err := repo.RefreshIAMToken(); err != nil {
return false
}
// Check again to make sure that the new token has not expired
if iamTokenInfo = NewIAMTokenInfo(c.IAMToken()); iamTokenInfo.HasExpired() {
return false
}
return true
} else if iamTokenInfo.HasExpired() && refresh == "" {
return false
} else {
return true
}
}
return false
}
func (c *bxConfig) CurrentAccount() (account models.Account) {
c.read(func() {
account = c.data.Account
})
return
}
func (c *bxConfig) HasTargetedAccount() bool {
return c.CurrentAccount().GUID != ""
}
func (c *bxConfig) HasTargetedProfile() bool {
return c.CurrentProfile().ID != ""
}
func (c *bxConfig) HasTargetedComputeResource() bool {
authn := c.CurrentProfile().ComputeResource
return authn.ID != ""
}
func (c *bxConfig) IMSAccountID() string {
return NewIAMTokenInfo(c.IAMToken()).Accounts.IMSAccountID
}
func (c *bxConfig) CurrentProfile() (profile models.Profile) {
c.read(func() {
profile = c.data.Profile
})
return
}
func (c *bxConfig) CurrentResourceGroup() (group models.ResourceGroup) {
c.read(func() {
group = c.data.ResourceGroup
})
return
}
func (c *bxConfig) HasTargetedResourceGroup() (hasGroup bool) {
c.read(func() {
hasGroup = c.data.ResourceGroup.GUID != "" && c.data.ResourceGroup.Name != ""
})
return
}
func (c *bxConfig) PluginRepos() (repos []models.PluginRepo) {
c.read(func() {
repos = c.data.PluginRepos
})
return
}
func (c *bxConfig) PluginRepo(name string) (models.PluginRepo, bool) {
for _, r := range c.PluginRepos() {
if strings.EqualFold(r.Name, name) {
return r, true
}
}
return models.PluginRepo{}, false
}
func (c *bxConfig) Locale() (locale string) {
c.read(func() {
locale = c.data.Locale
})
return
}
func (c *bxConfig) Trace() (trace string) {
c.read(func() {
trace = c.data.Trace
})
return
}
func (c *bxConfig) ColorEnabled() (enabled string) {
c.read(func() {
enabled = c.data.ColorEnabled
})
return
}
func (c *bxConfig) AlphaCommandsEnabled() (enabled string) {
c.read(func() {
enabled = c.data.AlphaCommandsEnabled
})
return
}
func (c *bxConfig) TypeOfSSO() (style string) {
c.read(func() {
style = c.data.TypeOfSSO
})
return
}
func (c *bxConfig) FallbackAccount() (a models.Account) {
c.read(func() {
a = c.data.FallbackAccount
})
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
})
return
}
func (c *bxConfig) CLIInfoEndpoint() (endpoint string) {
c.read(func() {
endpoint = c.data.CLIInfoEndpoint
})
return endpoint
}
func (c *bxConfig) CheckCLIVersionDisabled() (disabled bool) {
c.read(func() {
disabled = c.data.CheckCLIVersionDisabled
})
return
}
// CheckMessageOfTheDay will return true if the message-of-the-day
// endpoint has not been check in the past 24 hours.
func (c *bxConfig) CheckMessageOfTheDay() bool {
var lastCheck int64
c.read(func() {
lastCheck = c.data.MessageOfTheDayTime
})
if lastCheck <= 0 {
return true
}
currentDate := time.Now()
lastCheckDate := time.Unix(lastCheck, 0)
// If MOD has not been checked in over 1 day
return currentDate.Sub(lastCheckDate).Hours() > 24
}
func (c *bxConfig) UpdateCheckInterval() (interval time.Duration) {
c.read(func() {
interval = c.data.UpdateCheckInterval
})
return
}
func (c *bxConfig) UpdateRetryCheckInterval() (interval time.Duration) {
c.read(func() {
interval = c.data.UpdateRetryCheckInterval
})
return
}
func (c *bxConfig) UpdateNotificationInterval() (interval time.Duration) {
c.read(func() {
interval = c.data.UpdateNotificationInterval
})
return
}
func (c *bxConfig) UsageStatsDisabled() (disabled bool) {
c.read(func() {
disabled = c.data.UsageStatsDisabled
})
return
}
func (c *bxConfig) UsageStatsEnabled() (enabled bool) {
c.read(func() {
enabled = !c.data.UsageStatsEnabledLastUpdate.IsZero() && c.data.UsageStatsEnabled
})
return
}
func (c *bxConfig) UsageStatsEnabledLastUpdate() (lastUpdate time.Time) {
c.read(func() {
lastUpdate = c.data.UsageStatsEnabledLastUpdate
})
return
}
func (c *bxConfig) SDKVersion() (version string) {
c.read(func() {
version = c.data.SDKVersion
})
return
}
func (c *bxConfig) SetAPIEndpoint(endpoint string) {
c.write(func() {
c.data.APIEndpoint = endpoint
})
}
func (c *bxConfig) SetPrivateEndpointEnabled(isPrivate bool) {
c.write(func() {
c.data.IsPrivate = isPrivate
})
}
func (c *bxConfig) SetAccessFromVPC(isVPC bool) {
c.write(func() {
c.data.IsAccessFromVPC = isVPC
})
}
func (c *bxConfig) SetConsoleEndpoints(endpoint models.Endpoints) {
c.write(func() {
c.data.ConsoleEndpoint = endpoint.PublicEndpoint
c.data.ConsolePrivateEndpoint = endpoint.PrivateEndpoint
c.data.ConsolePrivateVPCEndpoint = endpoint.PrivateVPCEndpoint
})
}
func (c *bxConfig) SetRegion(region models.Region) {
c.write(func() {
c.data.Region = region.Name
})
}
func (c *bxConfig) SetIAMEndpoints(endpoints models.Endpoints) {
c.write(func() {
c.data.IAMEndpoint = endpoints.PublicEndpoint
c.data.IAMPrivateEndpoint = endpoints.PrivateEndpoint
c.data.IAMPrivateVPCEndpoint = endpoints.PrivateVPCEndpoint
})
}
func (c *bxConfig) SetIAMToken(token string) {
c.writeRaw(func() {
c.data.IAMToken = token
c.data.raw["IAMToken"] = token
})
}
func (c *bxConfig) SetIAMRefreshToken(token string) {
c.writeRaw(func() {
c.data.IAMRefreshToken = token
c.data.raw["IAMRefreshToken"] = token
})
}
func (c *bxConfig) SetAccount(account models.Account) {
c.write(func() {
c.data.Account = account
})
}
func (c *bxConfig) SetProfile(profile models.Profile) {
c.write(func() {
c.data.Profile = profile
})
}
func (c *bxConfig) SetCRIType(criType string) {
c.write(func() {
c.data.CRIType = criType
})
}
func (c *bxConfig) SetIsLoggedInAsCRI(isCRI bool) {
c.write(func() {
c.data.IsLoggedInAsCRI = isCRI
})
}
func (c *bxConfig) SetResourceGroup(group models.ResourceGroup) {
c.write(func() {
c.data.ResourceGroup = group
})
}
func (c *bxConfig) SetLoginAt(loginAt time.Time) {
c.write(func() {
c.data.LoginAt = loginAt
})
}
func (c *bxConfig) SetPluginRepo(pluginRepo models.PluginRepo) {
c.write(func() {
c.data.PluginRepos = append(c.data.PluginRepos, pluginRepo)
})
}
func (c *bxConfig) UnsetPluginRepo(repoName string) {
c.write(func() {
i := 0
for ; i < len(c.data.PluginRepos); i++ {
if strings.ToLower(c.data.PluginRepos[i].Name) == strings.ToLower(repoName) {
break
}
}
if i != len(c.data.PluginRepos) {
c.data.PluginRepos = append(c.data.PluginRepos[:i], c.data.PluginRepos[i+1:]...)
}
})
}
func (c *bxConfig) SetSSLDisabled(disabled bool) {
c.write(func() {
c.data.SSLDisabled = disabled
})
}
func (c *bxConfig) SetHTTPTimeout(timeout int) {
c.write(func() {
c.data.HTTPTimeout = timeout
})
}
func (c *bxConfig) SetTypeOfSSO(style string) {
c.write(func() {
c.data.TypeOfSSO = style
})
}
func (c *bxConfig) SetFallbackAccount(guid, name, owner string) {
c.write(func() {
c.data.FallbackAccount.GUID = guid
c.data.FallbackAccount.Name = name
c.data.FallbackAccount.Owner = owner
})
}
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
})
}
func (c *bxConfig) SetUpdateCheckInterval(interval time.Duration) {
c.write(func() {
c.data.UpdateCheckInterval = interval
})
}
func (c *bxConfig) SetUpdateRetryCheckInterval(interval time.Duration) {
c.write(func() {
c.data.UpdateRetryCheckInterval = interval
})
}
func (c *bxConfig) SetUpdateNotificationInterval(interval time.Duration) {
c.write(func() {
c.data.UpdateNotificationInterval = interval
})
}
func (c *bxConfig) SetCLIInfoEndpoint(endpoint string) {
c.write(func() {
c.data.CLIInfoEndpoint = endpoint
})
}
func (c *bxConfig) SetUsageStatsDisabled(disabled bool) {
c.write(func() {
c.data.UsageStatsDisabled = disabled
})
}
func (c *bxConfig) SetUsageStatsEnabled(enabled bool) {
c.write(func() {
c.data.UsageStatsEnabled = enabled
c.data.UsageStatsEnabledLastUpdate = time.Now()
})
}
func (c *bxConfig) SetColorEnabled(enabled string) {
c.write(func() {
c.data.ColorEnabled = enabled
})
}
func (c *bxConfig) SetAlphaCommandsEnabled(enabled string) {
c.write(func() {
c.data.AlphaCommandsEnabled = enabled
})
}
func (c *bxConfig) SetLocale(locale string) {
c.write(func() {
c.data.Locale = locale
})
}
func (c *bxConfig) SetTrace(trace string) {
c.write(func() {
c.data.Trace = trace
})
}
func (c *bxConfig) SetCloudType(ctype string) {
c.write(func() {
c.data.CloudType = ctype
})
}
func (c *bxConfig) SetCloudName(cname string) {
c.write(func() {
c.data.CloudName = cname
})
}
func (c *bxConfig) SetMessageOfTheDayTime() {
c.write(func() {
c.data.MessageOfTheDayTime = time.Now().Unix()
})
}
func (c *bxConfig) SetLastSessionUpdateTime() {
c.write(func() {
c.data.LastSessionUpdateTime = time.Now().Unix()
})
}
func (c *bxConfig) LastSessionUpdateTime() (session int64) {
c.read(func() {
session = c.data.LastSessionUpdateTime
})
return
}
func (c *bxConfig) ClearSession() {
c.write(func() {
c.data.IAMToken = ""
c.data.IAMRefreshToken = ""
c.data.Account = models.Account{}
c.data.Profile = models.Profile{}
c.data.CRIType = ""
c.data.IsLoggedInAsCRI = false
c.data.ResourceGroup = models.ResourceGroup{}
c.data.LoginAt = time.Time{}
c.data.PaginationURLs = []models.PaginationURL{}
})
}
func (c *bxConfig) SetPaginationURLs(paginationURLs []models.PaginationURL) {
c.write(func() {
c.data.PaginationURLs = paginationURLs
})
}
func (c *bxConfig) ClearPaginationURLs() {
c.write(func() {
c.data.PaginationURLs = []models.PaginationURL{}
})
}
func (c *bxConfig) AddPaginationURL(index int, url string) {
urls := c.PaginationURLs()
urls = append(urls, models.PaginationURL{
LastIndex: index,
NextURL: url,
})
// sort by last index for easier retrieval
sort.Sort(models.ByLastIndex(urls))
c.SetPaginationURLs(urls)
}
func (c *bxConfig) PaginationURLs() (paginationURLs []models.PaginationURL) {
c.read(func() {
paginationURLs = c.data.PaginationURLs
})
return
}
func (c *bxConfig) UnsetAPI() {
c.write(func() {
c.data.APIEndpoint = ""
c.data.SSLDisabled = false
c.data.IsPrivate = false
c.data.IsAccessFromVPC = false
c.data.Region = ""
c.data.RegionID = ""
c.data.ConsoleEndpoint = ""
c.data.ConsolePrivateEndpoint = ""
c.data.ConsolePrivateVPCEndpoint = ""
c.data.IAMEndpoint = ""
c.data.IAMPrivateEndpoint = ""
c.data.IAMPrivateVPCEndpoint = ""
c.data.CloudName = ""
c.data.CloudType = ""
})
}