Skip to content

Commit 01ae518

Browse files
feat(instance): add support for projects in ip (#1150)
1 parent 785ba29 commit 01ae518

28 files changed

+242
-140
lines changed

cmd/scw/testdata/test-all-usage-config-get-usage.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ EXAMPLES:
1313
scw -p prod config get default_region
1414

1515
ARGS:
16-
key the key to get from the configt (access-key | secret-key | api-url | insecure | default-organization-id | default-region | default-zone | send-telemetry)
16+
key the key to get from the configt (access-key | secret-key | api-url | insecure | default-organization-id | default-project-id | default-region | default-zone | send-telemetry)
1717

1818
FLAGS:
1919
-h, --help help for get

cmd/scw/testdata/test-all-usage-config-unset-usage.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ USAGE:
66
scw config unset <key ...> [arg=value ...]
77

88
ARGS:
9-
key the config config key name to unset (access-key | secret-key | api-url | insecure | default-organization-id | default-region | default-zone | send-telemetry)
9+
key the config config key name to unset (access-key | secret-key | api-url | insecure | default-organization-id | default-project-id | default-region | default-zone | send-telemetry)
1010

1111
FLAGS:
1212
-h, --help help for unset

cmd/scw/testdata/test-all-usage-instance-ip-create-usage.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ EXAMPLES:
1616
scw instance ip create server=11111111-1111-1111-1111-111111111111
1717

1818
ARGS:
19-
[project] The project ID the IP is reserved in
19+
[project-id] The project ID the IP is reserved in
2020
[server] UUID of the server you want to attach the IP to
2121
[tags.{index}] An array of keywords you want to tag this IP with
2222
[organization-id] Organization ID to use. If none is passed will use default organization ID from the config

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ require (
2121
github.com/mattn/go-colorable v0.1.4
2222
github.com/mattn/go-isatty v0.0.11
2323
github.com/pkg/errors v0.9.1 // indirect
24-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200622150328-6c000c76bc65
24+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200707130522-abc4aeb2a4e6
2525
github.com/sergi/go-diff v1.0.0 // indirect
2626
github.com/spf13/cobra v0.0.5
2727
github.com/spf13/pflag v1.0.5

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200622145638-4884584cccc2
7171
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200622145638-4884584cccc2/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8=
7272
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200622150328-6c000c76bc65 h1:QhG9tN5aUb20f6W8ecoH9XZwa4+0sg6ovBZrYKkp7C0=
7373
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200622150328-6c000c76bc65/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8=
74+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200624111939-0a4e128e532e h1:Ef+KTOg0kjZe14rHHoC7VOjiZBrxvuViVGaga7/BLM8=
75+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200624111939-0a4e128e532e/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8=
76+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200707130522-abc4aeb2a4e6 h1:mCYMQVdy3ciDx7jtDnRuxTk9IUB525PhZYkCTjMWQUI=
77+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200707130522-abc4aeb2a4e6/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8=
7478
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
7579
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
7680
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=

internal/core/validate.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -173,19 +173,6 @@ func ValidateOrganizationID() ArgSpecValidateFunc {
173173
if value == "" && !argSpec.Required {
174174
return nil
175175
}
176-
return ValidateOrganizationIDRequired()(argSpec, valueI)
177-
}
178-
}
179-
180-
// ValidateOrganizationIDRequired validates a required organization ID.
181-
// We do not allow empty-string value "".
182-
func ValidateOrganizationIDRequired() ArgSpecValidateFunc {
183-
return func(argSpec *ArgSpec, valueI interface{}) error {
184-
value := valueI.(string)
185-
err := DefaultArgSpecValidateFunc()(argSpec, value)
186-
if err != nil {
187-
return err
188-
}
189176
if !validation.IsOrganizationID(value) {
190177
return InvalidOrganizationIDError(value)
191178
}

internal/e2e/testdata/test-human-create-simple.golden

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ IsHappy false
1414
EyesColor unknown
1515
Status stopped
1616
Name -
17+
ProjectID 11111111-1111-1111-1111-111111111111
1718
Region fr-par
1819
🟩🟩🟩 JSON STDOUT 🟩🟩🟩
1920
{
@@ -31,5 +32,6 @@ Region fr-par
3132
"eyes_color": "unknown",
3233
"status": "stopped",
3334
"name": "",
35+
"project_id": "11111111-1111-1111-1111-111111111111",
3436
"region": "fr-par"
3537
}

internal/e2e/testdata/test-human-create-with-args.golden

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ IsHappy true
1414
EyesColor amber
1515
Status stopped
1616
Name -
17+
ProjectID b3ba839a-dcf2-4b0a-ac81-fc32370052a0
1718
Region fr-par
1819
🟩🟩🟩 JSON STDOUT 🟩🟩🟩
1920
{
@@ -31,5 +32,6 @@ Region fr-par
3132
"eyes_color": "amber",
3233
"status": "stopped",
3334
"name": "",
35+
"project_id": "b3ba839a-dcf2-4b0a-ac81-fc32370052a0",
3436
"region": "fr-par"
3537
}

internal/e2e/testdata/test-human-delete-simple.golden

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ IsHappy true
1414
EyesColor blue
1515
Status stopped
1616
Name -
17+
ProjectID b3ba839a-dcf2-4b0a-ac81-fc32370052a0
1718
Region fr-par
1819
🟩🟩🟩 JSON STDOUT 🟩🟩🟩
1920
{
@@ -31,5 +32,6 @@ Region fr-par
3132
"eyes_color": "blue",
3233
"status": "stopped",
3334
"name": "",
35+
"project_id": "b3ba839a-dcf2-4b0a-ac81-fc32370052a0",
3436
"region": "fr-par"
3537
}

internal/e2e/testdata/test-human-get-simple.golden

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ IsHappy true
1414
EyesColor blue
1515
Status stopped
1616
Name -
17+
ProjectID b3ba839a-dcf2-4b0a-ac81-fc32370052a0
1718
Region fr-par
1819
🟩🟩🟩 JSON STDOUT 🟩🟩🟩
1920
{
@@ -31,5 +32,6 @@ Region fr-par
3132
"eyes_color": "blue",
3233
"status": "stopped",
3334
"name": "",
35+
"project_id": "b3ba839a-dcf2-4b0a-ac81-fc32370052a0",
3436
"region": "fr-par"
3537
}

0 commit comments

Comments
 (0)