Skip to content

Commit ae88c30

Browse files
authored
Merge pull request #89 from Arubacloud/chore/upgrade-sdk-go-v0.1.28
chore(deps): upgrade sdk-go to v0.1.28
2 parents 541c6e2 + 9756704 commit ae88c30

9 files changed

Lines changed: 69 additions & 36 deletions

File tree

cmd/compute.cloudserver.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,11 @@ Billing period: Hour (default), Month, or Year.`,
227227

228228
// Optionally set Elastic IP
229229
if elasticIPURI != "" {
230-
createRequest.Properties.ElasticIP = types.ReferenceResource{URI: elasticIPURI}
230+
createRequest.Properties.ElasticIP = &types.ReferenceResource{URI: elasticIPURI}
231231
}
232232

233233
if keypairURI != "" {
234-
createRequest.Properties.KeyPair = types.ReferenceResource{
234+
createRequest.Properties.KeyPair = &types.ReferenceResource{
235235
URI: keypairURI,
236236
}
237237
}
@@ -462,7 +462,7 @@ var cloudserverUpdateCmd = &cobra.Command{
462462
}
463463

464464
if current.Properties.KeyPair.URI != "" {
465-
updateRequest.Properties.KeyPair = current.Properties.KeyPair
465+
updateRequest.Properties.KeyPair = &current.Properties.KeyPair
466466
}
467467

468468
// Apply updates

cmd/network.vpcpeeringroute.go

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ func init() {
2323
vpcpeeringrouteCreateCmd.Flags().String("name", "", "VPC Peering Route name (required)")
2424
vpcpeeringrouteCreateCmd.Flags().String("local-network", "", "Local network address in CIDR notation (required)")
2525
vpcpeeringrouteCreateCmd.Flags().String("remote-network", "", "Remote network address in CIDR notation (required)")
26+
vpcpeeringrouteCreateCmd.Flags().String("region", "", "Region code (required)")
2627
vpcpeeringrouteCreateCmd.Flags().String("billing-period", "Hour", "Billing period: Hour, Month, Year")
2728
vpcpeeringrouteCreateCmd.Flags().StringSlice("tags", []string{}, "Tags (comma-separated)")
2829
vpcpeeringrouteCreateCmd.Flags().BoolP("verbose", "v", false, "Show detailed debug information")
2930
vpcpeeringrouteCreateCmd.MarkFlagRequired("name")
3031
vpcpeeringrouteCreateCmd.MarkFlagRequired("local-network")
3132
vpcpeeringrouteCreateCmd.MarkFlagRequired("remote-network")
33+
vpcpeeringrouteCreateCmd.MarkFlagRequired("region")
3234

3335
vpcpeeringrouteGetCmd.Flags().String("project-id", "", "Project ID (uses context if not specified)")
3436

@@ -107,6 +109,7 @@ with --remote-network. Both values should be valid CIDR blocks.
107109
Billing period: Hour (default), Month, or Year.`,
108110
Example: ` acloud network vpcpeeringroute create <vpc-id> <peering-id> \
109111
--name my-route \
112+
--region ITBG-Bergamo \
110113
--local-network 10.0.0.0/24 \
111114
--remote-network 10.1.0.0/24`,
112115
Args: cobra.ExactArgs(2),
@@ -115,6 +118,7 @@ Billing period: Hour (default), Month, or Year.`,
115118
peeringID := args[1]
116119

117120
name, _ := cmd.Flags().GetString("name")
121+
region, _ := cmd.Flags().GetString("region")
118122
localNetwork, _ := cmd.Flags().GetString("local-network")
119123
remoteNetwork, _ := cmd.Flags().GetString("remote-network")
120124
billingPeriod, _ := cmd.Flags().GetString("billing-period")
@@ -133,9 +137,12 @@ Billing period: Hour (default), Month, or Year.`,
133137

134138
// Build the create request
135139
req := types.VPCPeeringRouteRequest{
136-
Metadata: types.ResourceMetadataRequest{
137-
Name: name,
138-
Tags: tags,
140+
Metadata: types.RegionalResourceMetadataRequest{
141+
ResourceMetadataRequest: types.ResourceMetadataRequest{
142+
Name: name,
143+
Tags: tags,
144+
},
145+
Location: types.LocationRequest{Value: region},
139146
},
140147
Properties: types.VPCPeeringRoutePropertiesRequest{
141148
LocalNetworkAddress: localNetwork,
@@ -375,27 +382,36 @@ var vpcpeeringrouteUpdateCmd = &cobra.Command{
375382
return fmt.Errorf("cannot update VPC peering route while it is in 'InCreation' state. Please wait until the VPC peering route is fully created")
376383
}
377384

385+
// Preserve the region from the current resource for the update request.
386+
var regionValue string
387+
if current.Metadata.LocationResponse != nil {
388+
regionValue = current.Metadata.LocationResponse.Value
389+
}
390+
378391
// Build update request by merging user input with current values
379392
req := types.VPCPeeringRouteRequest{
380-
Metadata: types.ResourceMetadataRequest{
381-
Name: func() string {
382-
if name != "" {
383-
return name
384-
}
385-
if current.Metadata.Name != nil {
386-
return *current.Metadata.Name
387-
}
388-
return ""
389-
}(),
390-
Tags: func() []string {
391-
if cmd.Flags().Changed("tags") {
392-
return tags
393-
}
394-
if current.Metadata.Tags != nil {
395-
return current.Metadata.Tags
396-
}
397-
return []string{}
398-
}(),
393+
Metadata: types.RegionalResourceMetadataRequest{
394+
ResourceMetadataRequest: types.ResourceMetadataRequest{
395+
Name: func() string {
396+
if name != "" {
397+
return name
398+
}
399+
if current.Metadata.Name != nil {
400+
return *current.Metadata.Name
401+
}
402+
return ""
403+
}(),
404+
Tags: func() []string {
405+
if cmd.Flags().Changed("tags") {
406+
return tags
407+
}
408+
if current.Metadata.Tags != nil {
409+
return current.Metadata.Tags
410+
}
411+
return []string{}
412+
}(),
413+
},
414+
Location: types.LocationRequest{Value: regionValue},
399415
},
400416
Properties: types.VPCPeeringRoutePropertiesRequest{
401417
LocalNetworkAddress: func() string {

cmd/network.vpcpeeringroute_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ func TestVPCPeeringRouteCreateCmd(t *testing.T) {
204204
"network", "vpcpeeringroute", "create", "vpc-001", "peer-001",
205205
"--project-id", "proj-123",
206206
"--name", "my-route",
207+
"--region", "ITBG-Bergamo",
207208
"--local-network", "10.0.0.0/24",
208209
"--remote-network", "10.1.0.0/24",
209210
},
@@ -222,6 +223,7 @@ func TestVPCPeeringRouteCreateCmd(t *testing.T) {
222223
"network", "vpcpeeringroute", "create", "vpc-001", "peer-001",
223224
"--project-id", "proj-123",
224225
"--name", "my-route",
226+
"--region", "ITBG-Bergamo",
225227
"--local-network", "10.0.0.0/24",
226228
"--remote-network", "10.1.0.0/24",
227229
},
@@ -238,7 +240,7 @@ func TestVPCPeeringRouteCreateCmd(t *testing.T) {
238240
},
239241
{
240242
name: "missing required flag --name",
241-
args: []string{"network", "vpcpeeringroute", "create", "vpc-001", "peer-001", "--project-id", "proj-123", "--local-network", "10.0.0.0/24", "--remote-network", "10.1.0.0/24"},
243+
args: []string{"network", "vpcpeeringroute", "create", "vpc-001", "peer-001", "--project-id", "proj-123", "--region", "ITBG-Bergamo", "--local-network", "10.0.0.0/24", "--remote-network", "10.1.0.0/24"},
242244
wantErr: true, errContains: "name",
243245
},
244246
{
@@ -247,6 +249,7 @@ func TestVPCPeeringRouteCreateCmd(t *testing.T) {
247249
"network", "vpcpeeringroute", "create", "vpc-001", "peer-001",
248250
"--project-id", "proj-123",
249251
"--name", "my-route",
252+
"--region", "ITBG-Bergamo",
250253
"--local-network", "10.0.0.0/24",
251254
"--remote-network", "10.1.0.0/24",
252255
},
@@ -264,6 +267,7 @@ func TestVPCPeeringRouteCreateCmd(t *testing.T) {
264267
"network", "vpcpeeringroute", "create", "vpc-001", "peer-001",
265268
"--project-id", "proj-123",
266269
"--name", "my-route",
270+
"--region", "ITBG-Bergamo",
267271
"--local-network", "10.0.0.0/24",
268272
"--remote-network", "10.1.0.0/24",
269273
},

cmd/network.vpntunnel.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,20 @@ func init() {
3434
vpntunnelCreateCmd.Flags().StringSlice("tags", []string{}, "Tags (comma-separated)")
3535
// IKE settings
3636
vpntunnelCreateCmd.Flags().Int32("ike-lifetime", 0, "IKE lifetime (seconds)")
37-
vpntunnelCreateCmd.Flags().String("ike-encryption", "", "IKE encryption algorithm")
38-
vpntunnelCreateCmd.Flags().String("ike-hash", "", "IKE hash algorithm")
39-
vpntunnelCreateCmd.Flags().String("ike-dh-group", "", "IKE DH group")
40-
vpntunnelCreateCmd.Flags().String("ike-dpd-action", "", "IKE DPD action")
37+
vpntunnelCreateCmd.Flags().String("ike-encryption", "", "IKE encryption algorithm (e.g. aes128, aes256, 3des, chacha20poly1305)")
38+
vpntunnelCreateCmd.Flags().String("ike-hash", "", "IKE hash algorithm (e.g. sha1, sha256, sha384, sha512, md5)")
39+
vpntunnelCreateCmd.Flags().String("ike-dh-group", "", "IKE DH group (e.g. 1, 2, 5, 14, 15, 16, 19, 20, 21)")
40+
vpntunnelCreateCmd.Flags().String("ike-dpd-action", "", "IKE DPD action (trap, clear, restart)")
4141
vpntunnelCreateCmd.Flags().Int32("ike-dpd-interval", 0, "IKE DPD interval (seconds)")
4242
vpntunnelCreateCmd.Flags().Int32("ike-dpd-timeout", 0, "IKE DPD timeout (seconds)")
4343
// ESP settings
4444
vpntunnelCreateCmd.Flags().Int32("esp-lifetime", 0, "ESP lifetime (seconds)")
45-
vpntunnelCreateCmd.Flags().String("esp-encryption", "", "ESP encryption algorithm")
46-
vpntunnelCreateCmd.Flags().String("esp-hash", "", "ESP hash algorithm")
47-
vpntunnelCreateCmd.Flags().String("esp-pfs", "", "ESP PFS group")
45+
vpntunnelCreateCmd.Flags().String("esp-encryption", "", "ESP encryption algorithm (e.g. aes128, aes256, 3des, chacha20poly1305)")
46+
vpntunnelCreateCmd.Flags().String("esp-hash", "", "ESP hash algorithm (e.g. sha1, sha256, sha384, sha512, md5)")
47+
vpntunnelCreateCmd.Flags().String("esp-pfs", "", "ESP PFS group (enable, disable, dh-group1, dh-group2, dh-group5, dh-group14…dh-group32)")
4848
// PSK settings
49-
vpntunnelCreateCmd.Flags().String("psk-cloud-site", "", "PSK cloud site")
50-
vpntunnelCreateCmd.Flags().String("psk-onprem-site", "", "PSK on-prem site")
49+
vpntunnelCreateCmd.Flags().String("psk-cloud-site", "", "PSK cloud site identifier")
50+
vpntunnelCreateCmd.Flags().String("psk-onprem-site", "", "PSK on-prem site identifier")
5151
vpntunnelCreateCmd.Flags().String("psk", "", "Pre-shared key for authentication (PSK secret)")
5252
vpntunnelCreateCmd.MarkFlagRequired("name")
5353
vpntunnelCreateCmd.MarkFlagRequired("region")

docs/website/docs/resources/network/vpcpeeringroute.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ acloud network vpcpeeringroute create <vpc-id> <peering-id> [flags]
7878

7979
**Required Flags:**
8080
- `--name string` - VPC Peering Route name
81+
- `--region string` - Region code (e.g. ITBG-Bergamo)
8182
- `--local-network string` - Local network address in CIDR notation
8283
- `--remote-network string` - Remote network address in CIDR notation
8384

@@ -92,12 +93,14 @@ acloud network vpcpeeringroute create <vpc-id> <peering-id> [flags]
9293
# Create a basic VPC peering route
9394
acloud network vpcpeeringroute create 689307f4745108d3c6343b5a 6949666e4d0cdc87949b7204 \
9495
--name "route-1" \
96+
--region ITBG-Bergamo \
9597
--local-network "10.0.1.0/24" \
9698
--remote-network "10.1.1.0/24"
9799

98100
# Create VPC peering route with billing period and tags
99101
acloud network vpcpeeringroute create 689307f4745108d3c6343b5a 6949666e4d0cdc87949b7204 \
100102
--name "production-route" \
103+
--region ITBG-Bergamo \
101104
--local-network "10.0.2.0/24" \
102105
--remote-network "10.1.2.0/24" \
103106
--billing-period Month \
@@ -291,11 +294,13 @@ done
291294
# 3. Create routes for different subnets
292295
acloud network vpcpeeringroute create $VPC_ID $PEERING_ID \
293296
--name "subnet-1-route" \
297+
--region ITBG-Bergamo \
294298
--local-network "10.0.1.0/24" \
295299
--remote-network "10.1.1.0/24"
296300

297301
acloud network vpcpeeringroute create $VPC_ID $PEERING_ID \
298302
--name "subnet-2-route" \
303+
--region ITBG-Bergamo \
299304
--local-network "10.0.2.0/24" \
300305
--remote-network "10.1.2.0/24" \
301306
--billing-period Month

docs/website/i18n/it/docusaurus-plugin-content-docs/current/resources/network/vpcpeeringroute.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ acloud network vpcpeeringroute create <vpc-id> <peering-id> [flags]
7878

7979
**Flag Richiesti:**
8080
- `--name string` - Nome VPC Peering Route
81+
- `--region string` - Codice regione (es. ITBG-Bergamo)
8182
- `--local-network string` - Indirizzo di rete locale in notazione CIDR
8283
- `--remote-network string` - Indirizzo di rete remoto in notazione CIDR
8384

@@ -92,12 +93,14 @@ acloud network vpcpeeringroute create <vpc-id> <peering-id> [flags]
9293
# Crea una VPC peering route base
9394
acloud network vpcpeeringroute create 689307f4745108d3c6343b5a 6949666e4d0cdc87949b7204 \
9495
--name "route-1" \
96+
--region ITBG-Bergamo \
9597
--local-network "10.0.1.0/24" \
9698
--remote-network "10.1.1.0/24"
9799

98100
# Crea VPC peering route con periodo di fatturazione e tag
99101
acloud network vpcpeeringroute create 689307f4745108d3c6343b5a 6949666e4d0cdc87949b7204 \
100102
--name "production-route" \
103+
--region ITBG-Bergamo \
101104
--local-network "10.0.2.0/24" \
102105
--remote-network "10.1.2.0/24" \
103106
--billing-period Month \

e2e/network/test.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,7 @@ test_vpc_peering_route() {
682682
local create_out
683683
create_out=$($ACLOUD_CMD network vpcpeeringroute create "$VPC_ID" "$PEERING_ID" \
684684
--name "${RESOURCE_PREFIX}-route" \
685+
--region "$REGION" \
685686
--local-network 10.0.1.0/24 \
686687
--remote-network 10.0.2.0/24 \
687688
--billing-period Hour 2>&1)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module acloud
33
go 1.25.0
44

55
require (
6-
github.com/Arubacloud/sdk-go v0.1.27
6+
github.com/Arubacloud/sdk-go v0.1.28
77
github.com/spf13/cobra v1.10.2
88
github.com/spf13/pflag v1.0.10
99
golang.org/x/term v0.42.0

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
github.com/Arubacloud/sdk-go v0.1.27 h1:/S10UjYq7ppm8mL4BwuKmbJWzXUuU0BPJQxsDysrV/Q=
22
github.com/Arubacloud/sdk-go v0.1.27/go.mod h1:4lXc0Dte8HqeKag8eMo0/TClwsgMqXW0KbKaQ2BYlXA=
3+
github.com/Arubacloud/sdk-go v0.1.28-0.20260428150839-29dadc76c9fb h1:S7wCrRugJkdsv5RV7/g9MhOBnbf3SdIh9xRsESiBv38=
4+
github.com/Arubacloud/sdk-go v0.1.28-0.20260428150839-29dadc76c9fb/go.mod h1:4lXc0Dte8HqeKag8eMo0/TClwsgMqXW0KbKaQ2BYlXA=
5+
github.com/Arubacloud/sdk-go v0.1.28 h1:F8Qf5UTwP5H1RZKz14YQdeRyahGZGOJ9qrq6kHlqZ3c=
6+
github.com/Arubacloud/sdk-go v0.1.28/go.mod h1:4lXc0Dte8HqeKag8eMo0/TClwsgMqXW0KbKaQ2BYlXA=
37
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
48
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
59
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=

0 commit comments

Comments
 (0)