Skip to content

Commit ecb5605

Browse files
committed
Merge pull request scaleway#86 from moul/fix-85
Fix 85
2 parents 5efa123 + 7eaeb74 commit ecb5605

File tree

5 files changed

+384
-4
lines changed

5 files changed

+384
-4
lines changed

api/api.go

+10-4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"text/template"
2020

2121
log "github.com/scaleway/scaleway-cli/vendor/github.com/Sirupsen/logrus"
22+
"github.com/scaleway/scaleway-cli/vendor/github.com/moul/anonuuid"
2223
)
2324

2425
// ScalewayAPI is the interface used to communicate with the Scaleway API
@@ -34,6 +35,8 @@ type ScalewayAPI struct {
3435

3536
// Cache is used to quickly resolve identifiers from names
3637
Cache *ScalewayCache
38+
39+
anonuuid anonuuid.AnonUUID
3740
}
3841

3942
// ScalewayAPIError represents a Scaleway API Error
@@ -501,12 +504,15 @@ func NewScalewayAPI(endpoint, organization, token string) (*ScalewayAPI, error)
501504
if err != nil {
502505
return nil, err
503506
}
504-
return &ScalewayAPI{
507+
s := &ScalewayAPI{
505508
APIEndPoint: endpoint,
506509
Organization: organization,
507510
Token: token,
508511
Cache: cache,
509-
}, nil
512+
anonuuid: *anonuuid.New(),
513+
}
514+
515+
return s, nil
510516
}
511517

512518
// Sync flushes out the cache to the disk
@@ -1299,7 +1305,7 @@ func (s *ScalewayAPI) GetBootscriptID(needle string) string {
12991305

13001306
// HideAPICredentials removes API credentials from a string
13011307
func (s *ScalewayAPI) HideAPICredentials(input string) string {
1302-
output := strings.Replace(input, s.Token, "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", -1)
1303-
output = strings.Replace(output, s.Organization, "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", -1)
1308+
output := strings.Replace(input, s.Token, s.anonuuid.FakeUUID(s.Token), -1)
1309+
output = strings.Replace(output, s.Organization, s.anonuuid.FakeUUID(s.Organization), -1)
13041310
return output
13051311
}

vendor/github.com/moul/anonuuid/LICENSE

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

vendor/github.com/moul/anonuuid/README.md

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

vendor/github.com/moul/anonuuid/anonuuid.go

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

0 commit comments

Comments
 (0)