Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): rename send_usage into send_telemetry #313

Merged
merged 2 commits into from
Feb 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions scw/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ const configFileTemplate = `# Scaleway configuration file
# This single default configuration is suitable for most use cases.
{{ if .ActiveProfile }}active_profile: {{ .ActiveProfile }}{{ else }}# active_profile: myProfile{{ end }}

# To improve this tools we rely on diagnostic and usage data.
# Sending such data is optional and can be disable at any time by setting this variable to false.
{{ if .SendUsage }}send_usage: {{ .SendUsage }}{{ else }}# send_usage: false{{ end }}
# To improve the Scaleway CLI we rely on diagnostic and usage data.
# Sending such data is optional and can be disable at any time by setting send_telemetry variable to false.
{{ if .SendTelemetry }}send_telemetry: {{ .SendTelemetry }}{{ else }}# send_telemetry: false{{ end }}

# To work with multiple projects or authorization accounts, you can set up multiple configurations with scw config configurations create and switch among them accordingly.
# You can use a profile by either:
Expand Down Expand Up @@ -98,7 +98,7 @@ profiles:
type Config struct {
Profile `yaml:",inline"`
ActiveProfile *string `yaml:"active_profile,omitempty"`
SendUsage bool `yaml:"send_usage,omitempty"`
SendTelemetry bool `yaml:"send_telemetry,omitempty"`
Profiles map[string]*Profile `yaml:"profiles,omitempty"`
}

Expand Down
42 changes: 21 additions & 21 deletions scw/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var (
v2ValidSecretKey2 = "6f6e6574-6f72-756c-6c74-68656d616c6c" // hint: | xxd -ps -r
v2ValidAPIURL2 = "api-fr-par.scaleway.com"
v2ValidInsecure2 = "true"
v2ValidSendUsage2 = "true"
v2ValidSendTelemetry2 = "true"
v2ValidDefaultOrganizationID2 = "6d6f7264-6f72-6772-6561-74616761696e" // hint: | xxd -ps -r
v2ValidDefaultRegion2 = string(RegionFrPar)
v2ValidDefaultZone2 = string(ZoneFrPar2)
Expand All @@ -28,7 +28,7 @@ var (
v2ValidSecretKey = "7363616c-6577-6573-6862-6f7579616161" // hint: | xxd -ps -r
v2ValidAPIURL = "api.scaleway.com"
v2ValidInsecure = "false"
v2ValidSendUsage = "true"
v2ValidSendTelemetry = "true"
v2ValidDefaultOrganizationID = "6170692e-7363-616c-6577-61792e636f6d" // hint: | xxd -ps -r
v2ValidDefaultRegion = string(RegionNlAms)
v2ValidDefaultZone = string(ZoneNlAms1)
Expand Down Expand Up @@ -64,7 +64,7 @@ profiles:
secret_key: ` + v2ValidSecretKey2 + `
api_url: ` + v2ValidAPIURL2 + `
insecure: ` + v2ValidInsecure2 + `
send_usage: ` + v2ValidSendUsage2 + `
send_telemetry: ` + v2ValidSendTelemetry2 + `
default_organization_id: ` + v2ValidDefaultOrganizationID2 + `
default_region: ` + v2ValidDefaultRegion2 + `
default_zone: ` + v2ValidDefaultZone2 + `
Expand All @@ -75,7 +75,7 @@ access_key: ` + v2ValidAccessKey + `
secret_key: ` + v2ValidSecretKey + `
api_url: ` + v2ValidAPIURL + `
insecure: ` + v2ValidInsecure + `
send_usage: ` + v2ValidSendUsage2 + `
send_telemetry: ` + v2ValidSendTelemetry2 + `
default_organization_id: ` + v2ValidDefaultOrganizationID + `
default_region: ` + v2ValidDefaultRegion + `
default_zone: ` + v2ValidDefaultZone + `
Expand All @@ -96,7 +96,7 @@ access_key: ` + v2ValidAccessKey + `
secret_key: ` + v2ValidSecretKey + `
api_url: ` + v2ValidAPIURL + `
insecure: ` + v2ValidInsecure + `
send_usage: ` + v2ValidSendUsage + `
send_telemetry: ` + v2ValidSendTelemetry + `
default_organization_id: ` + v2ValidDefaultOrganizationID + `
default_region: ` + v2ValidDefaultRegion + `
default_zone: ` + v2ValidDefaultZone + `
Expand Down Expand Up @@ -257,7 +257,7 @@ func TestLoadProfileAndActiveProfile(t *testing.T) {
expectedSecretKey *string
expectedAPIURL *string
expectedInsecure *bool
expectedSendUsage bool
expectedSendTelemetry bool
expectedDefaultOrganizationID *string
expectedDefaultRegion *string
expectedDefaultZone *string
Expand Down Expand Up @@ -366,7 +366,7 @@ func TestLoadProfileAndActiveProfile(t *testing.T) {
expectedDefaultOrganizationID: s(v2ValidDefaultOrganizationID2),
expectedDefaultRegion: s(v2ValidDefaultRegion2),
expectedDefaultZone: s(v2ValidDefaultZone2),
expectedSendUsage: true,
expectedSendTelemetry: true,
},
{
name: "Mixed config with active profile",
Expand All @@ -383,7 +383,7 @@ func TestLoadProfileAndActiveProfile(t *testing.T) {
expectedDefaultOrganizationID: s(v2ValidDefaultOrganizationID),
expectedDefaultRegion: s(v2ValidDefaultRegion),
expectedDefaultZone: s(v2ValidDefaultZone),
expectedSendUsage: true,
expectedSendTelemetry: true,
},
{
name: "Complete config with active profile env variable",
Expand Down Expand Up @@ -465,7 +465,7 @@ func TestLoadProfileAndActiveProfile(t *testing.T) {
testhelpers.Equals(t, test.expectedDefaultRegion, p.DefaultRegion)
testhelpers.Equals(t, test.expectedDefaultZone, p.DefaultZone)
testhelpers.Equals(t, test.expectedInsecure, p.Insecure)
testhelpers.Equals(t, test.expectedSendUsage, config.SendUsage)
testhelpers.Equals(t, test.expectedSendTelemetry, config.SendTelemetry)
} else {
testhelpers.Equals(t, test.expectedError, err.Error())
}
Expand All @@ -480,7 +480,7 @@ func TestConfigString(t *testing.T) {
SecretKey: s(v2ValidSecretKey),
},
ActiveProfile: s(v2ValidProfile),
SendUsage: true,
SendTelemetry: true,
Profiles: map[string]*Profile{
v2ValidProfile: {
AccessKey: s(v2ValidAccessKey2),
Expand All @@ -492,7 +492,7 @@ func TestConfigString(t *testing.T) {
testhelpers.Equals(t, `access_key: SCW1234567890ABCDEFG
secret_key: 7363616c-xxxx-xxxx-xxxx-xxxxxxxxxxxx
active_profile: flantier
send_usage: true
send_telemetry: true
profiles:
flantier:
access_key: SCW234567890ABCDEFGH
Expand Down Expand Up @@ -650,9 +650,9 @@ func TestConfig_ConfigFile(t *testing.T) {
# This single default configuration is suitable for most use cases.
# active_profile: myProfile

# To improve this tools we rely on diagnostic and usage data.
# Sending such data is optional and can be disable at any time by setting this variable to false.
# send_usage: false
# To improve the Scaleway CLI we rely on diagnostic and usage data.
# Sending such data is optional and can be disable at any time by setting send_telemetry variable to false.
# send_telemetry: false

# To work with multiple projects or authorization accounts, you can set up multiple configurations with scw config configurations create and switch among them accordingly.
# You can use a profile by either:
Expand Down Expand Up @@ -719,9 +719,9 @@ access_key: SCW1234567890ABCDEFG
# This single default configuration is suitable for most use cases.
# active_profile: myProfile

# To improve this tools we rely on diagnostic and usage data.
# Sending such data is optional and can be disable at any time by setting this variable to false.
# send_usage: false
# To improve the Scaleway CLI we rely on diagnostic and usage data.
# Sending such data is optional and can be disable at any time by setting send_telemetry variable to false.
# send_telemetry: false

# To work with multiple projects or authorization accounts, you can set up multiple configurations with scw config configurations create and switch among them accordingly.
# You can use a profile by either:
Expand Down Expand Up @@ -750,7 +750,7 @@ access_key: SCW1234567890ABCDEFG
SecretKey: s(v2ValidSecretKey),
},
ActiveProfile: s(v2ValidProfile),
SendUsage: true,
SendTelemetry: true,
Profiles: map[string]*Profile{
"profile1": {
AccessKey: s(v2ValidAccessKey2),
Expand Down Expand Up @@ -802,9 +802,9 @@ secret_key: 7363616c-6577-6573-6862-6f7579616161
# This single default configuration is suitable for most use cases.
active_profile: flantier

# To improve this tools we rely on diagnostic and usage data.
# Sending such data is optional and can be disable at any time by setting this variable to false.
send_usage: true
# To improve the Scaleway CLI we rely on diagnostic and usage data.
# Sending such data is optional and can be disable at any time by setting send_telemetry variable to false.
send_telemetry: true

# To work with multiple projects or authorization accounts, you can set up multiple configurations with scw config configurations create and switch among them accordingly.
# You can use a profile by either:
Expand Down