Skip to content

Commit cc6fcd4

Browse files
fix(models): Update the underlying struct used for Subnets (#177)
The older struct was missing newer properties that are present in subnet resources e.g. is_external.
1 parent 58c0121 commit cc6fcd4

16 files changed

+2057
-149
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
### Added
99

1010
### Changed
11+
- Updated the v3 Subnet spec struct to match latest swagger spec
12+
1113
## [v0.5.0] - 2024-07-29
1214
### Added
1315
- Added v4 Categories beta APIs to v4 client

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,17 @@ generate-v3-models: ## Generate V3 models using go-swagger
4545
--model=my_ntnx_token \
4646
--model=cluster_reference \
4747
--model=pc_vm_nic_configuration \
48-
--model=network_config
48+
--model=network_config \
49+
--model=subnet \
50+
--model=availability_zone_reference \
51+
--model=subnet_resources \
52+
--model=ip_config \
53+
--model=network_function_chain_reference \
54+
--model=virtual_network_reference \
55+
--model=vpc_reference \
56+
--model=dhcp_options \
57+
--model=address \
58+
--model=ip_pool
4959

5060
clean: ## Remove build related file
5161
rm -fr ./bin vendor hack/tools/bin
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
version: api.keploy.io/v1beta2
2+
kind: Http
3+
name: TestOperations_GetSubnet
4+
spec:
5+
metadata:
6+
name: Http
7+
operation: GET
8+
type: HTTP_CLIENT
9+
req:
10+
method: GET
11+
proto_major: 1
12+
proto_minor: 1
13+
url: https://prism-test.nutanix.com:9440/api/nutanix/v3/subnets/c7938dc6-7659-453e-a688-e26020c68e43
14+
header:
15+
Accept: application/json
16+
Content-Type: application/json
17+
User-Agent: nutanix/v3
18+
body: ""
19+
body_type: utf-8
20+
resp:
21+
status_code: 200
22+
header:
23+
Content-Security-Policy: 'default-src ''self'' https://*.nutanix.com; script-src ''self'' ''unsafe-inline'' ''unsafe-eval''; style-src ''self'' ''unsafe-inline''; connect-src ''self'' wss: https://downloads.frame.nutanix.com https://downloads.frame.nutanix.us; img-src ''self'' blob: data:; frame-src ''self'' https://*.nutanix.com blob: data:'
24+
Content-Type: application/json
25+
Date: Fri, 09 Aug 2024 00:21:37 GMT
26+
Server: envoy
27+
Set-Cookie: Expires=Fri, 09-Aug-2024 00:36:00 GMT;Path=/;Secure;HttpOnly;SameSite=Lax
28+
Strict-Transport-Security: max-age=8640000:includeSubdomains
29+
Vary: Accept-Encoding
30+
X-Content-Type-Options: nosniff
31+
X-Dns-Prefetch-Control: "off"
32+
X-Envoy-Upstream-Service-Time: "744"
33+
X-Frame-Options: SAMEORIGIN
34+
X-Ntnx-Env: pc
35+
X-Ntnx-Product: pc.2024.1.0.1
36+
X-Permitted-Cross-Domain-Policies: master-only
37+
X-Xss-Protection: 1; mode=block
38+
body: '{"api_version": "3.1", "metadata": {"kind": "subnet", "spec_version": 4, "uuid": "c7938dc6-7659-453e-a688-e26020c68e43", "categories": {}, "categories_mapping": {}, "owner_reference": {"kind": "user", "uuid": "00000000-0000-0000-0000-000000000000", "name": "admin"}, "creation_time": "2024-02-05T21:38:33Z", "last_update_time": "2024-02-05T21:44:35Z", "spec_hash": "00000000000000000000000000000000000000000000000000"}, "spec": {"resources": {"subnet_type": "VLAN", "vswitch_name": "br0", "ip_config": {"pool_list": [{"range": "10.40.142.50 10.40.142.250"}], "default_gateway_ip": "10.40.142.1", "prefix_length": 24, "subnet_ip": "10.40.142.0", "dhcp_options": {"domain_name_server_list": ["10.40.64.15"]}, "dhcp_server_address": {"ip": "10.40.142.254"}}, "vlan_id": 508, "virtual_switch_uuid": "5dc597bd-e86f-4440-af9f-65d158ae0588"}, "cluster_reference": {"kind": "cluster", "name": "ganon", "uuid": "0005b0f1-8f43-a0f2-02b7-3cecef193712"}, "name": "sherlock_net"}, "status": {"name": "sherlock_net", "cluster_reference": {"kind": "cluster", "name": "ganon", "uuid": "0005b0f1-8f43-a0f2-02b7-3cecef193712"}, "resources": {"virtual_switch_uuid": "5dc597bd-e86f-4440-af9f-65d158ae0588", "vswitch_name": "br0", "vlan_id": 508, "subnet_type": "VLAN", "ip_config": {"pool_list": [{"range": "10.40.142.50 10.40.142.250"}], "default_gateway_ip": "10.40.142.1", "prefix_length": 24, "subnet_ip": "10.40.142.0", "dhcp_options": {"domain_name_server_list": ["10.40.64.15"]}, "dhcp_server_address": {"ip": "10.40.142.254"}}, "ip_usage_stats": {"num_free_ips": 216, "num_macs": 36, "num_assigned_ips": 40, "ip_pools_stats": [{"num_total_ips": 201, "range": "10.40.142.50 10.40.142.250", "num_free_ips": 168}]}}, "state": "COMPLETE", "execution_context": {"task_uuid": ["29741e1f-159b-4076-a78f-75287690aa29"]}}}'
39+
body_type: utf-8
40+
status_message: ""
41+
proto_major: 0
42+
proto_minor: 0
43+
objects:
44+
- type: error
45+
data: H4sIAAAAAAAA/wEAAP//AAAAAAAAAAA=
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
version: api.keploy.io/v1beta2
2+
kind: Http
3+
name: TestOperations_ListSubnet
4+
spec:
5+
metadata:
6+
name: Http
7+
operation: POST
8+
type: HTTP_CLIENT
9+
req:
10+
method: POST
11+
proto_major: 1
12+
proto_minor: 1
13+
url: https://prism-test.nutanix.com:9440/api/nutanix/v3/subnets/list
14+
header:
15+
Accept: application/json
16+
Content-Type: application/json
17+
User-Agent: nutanix/v3
18+
body: |
19+
{}
20+
body_type: utf-8
21+
resp:
22+
status_code: 200
23+
header:
24+
Content-Security-Policy: 'default-src ''self'' https://*.nutanix.com; script-src ''self'' ''unsafe-inline'' ''unsafe-eval''; style-src ''self'' ''unsafe-inline''; connect-src ''self'' wss: https://downloads.frame.nutanix.com https://downloads.frame.nutanix.us; img-src ''self'' blob: data:; frame-src ''self'' https://*.nutanix.com blob: data:'
25+
Content-Type: application/json
26+
Date: Fri, 09 Aug 2024 00:39:35 GMT
27+
Server: envoy
28+
Set-Cookie: Expires=Fri, 09-Aug-2024 00:54:00 GMT;Path=/;Secure;HttpOnly;SameSite=Lax
29+
Strict-Transport-Security: max-age=8640000:includeSubdomains
30+
Vary: Accept-Encoding
31+
X-Content-Type-Options: nosniff
32+
X-Dns-Prefetch-Control: "off"
33+
X-Envoy-Upstream-Service-Time: "2767"
34+
X-Frame-Options: SAMEORIGIN
35+
X-Ntnx-Env: pc
36+
X-Ntnx-Product: pc.2024.1.0.1
37+
X-Permitted-Cross-Domain-Policies: master-only
38+
X-Xss-Protection: 1; mode=block
39+
body: '{"api_version": "3.1", "metadata": {"kind": "subnet", "offset": 0, "length": 15, "total_matches": 15}, "entities": [{"status": {"name": "sherlock_net", "cluster_reference": {"kind": "cluster", "name": "ganon", "uuid": "0005b0f1-8f43-a0f2-02b7-3cecef193712"}, "resources": {"virtual_switch_uuid": "5dc597bd-e86f-4440-af9f-65d158ae0588", "vswitch_name": "br0", "vlan_id": 508, "subnet_type": "VLAN", "ip_config": {"pool_list": [{"range": "10.40.142.50 10.40.142.250"}], "default_gateway_ip": "10.40.142.1", "prefix_length": 24, "subnet_ip": "10.40.142.0", "dhcp_options": {"domain_name_server_list": ["10.40.64.15"]}, "dhcp_server_address": {"ip": "10.40.142.254"}}, "ip_usage_stats": {"num_macs": 36, "num_free_ips": 216, "num_assigned_ips": 40, "ip_pools_stats": [{"range": "10.40.142.50 10.40.142.250", "num_free_ips": 168, "num_total_ips": 201}]}}, "state": "COMPLETE", "execution_context": {"task_uuid": ["29741e1f-159b-4076-a78f-75287690aa29"]}}, "metadata": {"uuid": "c7938dc6-7659-453e-a688-e26020c68e43", "spec_hash": "00000000000000000000000000000000000000000000000000", "spec_version": 4, "owner_reference": {"kind": "user", "uuid": "00000000-0000-0000-0000-000000000000", "name": "admin"}, "categories": {}, "categories_mapping": {}, "creation_time": "2024-02-05T21:38:33Z", "last_update_time": "2024-02-05T21:44:35Z", "kind": "subnet"}, "spec": {"resources": {"subnet_type": "VLAN", "vswitch_name": "br0", "ip_config": {"pool_list": [{"range": "10.40.142.50 10.40.142.250"}], "default_gateway_ip": "10.40.142.1", "prefix_length": 24, "subnet_ip": "10.40.142.0", "dhcp_options": {"domain_name_server_list": ["10.40.64.15"]}, "dhcp_server_address": {"ip": "10.40.142.254"}}, "vlan_id": 508, "virtual_switch_uuid": "5dc597bd-e86f-4440-af9f-65d158ae0588"}, "cluster_reference": {"kind": "cluster", "name": "ganon", "uuid": "0005b0f1-8f43-a0f2-02b7-3cecef193712"}, "name": "sherlock_net"}}, {"status": {"name": "vpc_ext_net", "cluster_reference": {"kind": "cluster", "name": "bowser", "uuid": "0005a220-027e-400b-7131-ac1f6bcd1533"}, "resources": {"virtual_switch_uuid": "befe98e9-bc14-4384-bad4-030c446383a4", "enable_nat": true, "advanced_networking": true, "external_connectivity_state": "DISABLED", "vlan_id": 1409, "subnet_type": "VLAN", "is_external": true, "ip_config": {"pool_list": [{"range": "10.45.24.70 10.45.24.170"}], "default_gateway_ip": "10.45.24.1", "prefix_length": 24, "subnet_ip": "10.45.24.0"}, "ip_usage_stats": {"num_free_ips": 247, "num_macs": 0, "num_assigned_ips": 9, "ip_pools_stats": [{"num_total_ips": 101, "range": "10.45.24.70 10.45.24.170", "num_free_ips": 94}]}}, "state": "COMPLETE", "execution_context": {"task_uuid": ["601325a7-e151-45ea-b786-2b17f674614e"]}}, "metadata": {"uuid": "9f4312c0-705f-40ea-928b-75c9bfdb3ef5", "spec_hash": "00000000000000000000000000000000000000000000000000", "spec_version": 1, "owner_reference": {"kind": "user", "uuid": "00000000-0000-0000-0000-000000000000", "name": "admin"}, "categories": {}, "categories_mapping": {}, "creation_time": "2024-02-27T14:17:56Z", "last_update_time": "2024-02-27T14:17:56Z", "kind": "subnet"}, "spec": {"resources": {"subnet_type": "VLAN", "is_external": true, "advanced_networking": true, "ip_config": {"pool_list": [{"range": "10.45.24.70 10.45.24.170"}], "default_gateway_ip": "10.45.24.1", "prefix_length": 24, "subnet_ip": "10.45.24.0"}, "enable_nat": true, "external_connectivity_state": "DISABLED", "vlan_id": 1409, "virtual_switch_uuid": "befe98e9-bc14-4384-bad4-030c446383a4"}, "cluster_reference": {"kind": "cluster", "name": "bowser", "uuid": "0005a220-027e-400b-7131-ac1f6bcd1533"}, "name": "vpc_ext_net"}}, {"status": {"name": "airgap", "resources": {"advanced_networking": true, "virtual_network_reference": {"kind": "virtual_network", "uuid": "78de692d-750b-4206-8c08-ba26f39edc3d"}, "external_connectivity_state": "ENABLED", "subnet_type": "OVERLAY", "vpc_reference": {"kind": "vpc", "uuid": "78de692d-750b-4206-8c08-ba26f39edc3d"}, "ip_config": {"pool_list": [{"range": "192.168.0.2 192.168.0.254"}], "default_gateway_ip": "192.168.0.1", "prefix_length": 24, "subnet_ip": "192.168.0.0"}, "ip_usage_stats": {"num_free_ips": 253, "num_macs": 0, "num_assigned_ips": 3, "ip_pools_stats": [{"num_total_ips": 253, "range": "192.168.0.2 192.168.0.254", "num_free_ips": 253}]}}, "state": "COMPLETE", "execution_context": {"task_uuid": ["e5730952-5dda-424e-9ef2-ef6746757382"]}}, "metadata": {"uuid": "0ccc7c20-4028-4665-81ea-6021ca45c462", "spec_hash": "00000000000000000000000000000000000000000000000000", "spec_version": 1, "owner_reference": {"kind": "user", "uuid": "00000000-0000-0000-0000-000000000000", "name": "admin"}, "categories": {}, "categories_mapping": {}, "creation_time": "2024-05-23T23:47:11Z", "last_update_time": "2024-05-23T23:47:12Z", "kind": "subnet"}, "spec": {"resources": {"subnet_type": "OVERLAY", "vpc_reference": {"kind": "vpc", "uuid": "78de692d-750b-4206-8c08-ba26f39edc3d"}, "advanced_networking": true, "ip_config": {"pool_list": [{"range": "192.168.0.2 192.168.0.254"}], "default_gateway_ip": "192.168.0.1", "prefix_length": 24, "subnet_ip": "192.168.0.0"}, "virtual_network_reference": {"kind": "virtual_network", "uuid": "78de692d-750b-4206-8c08-ba26f39edc3d"}, "external_connectivity_state": "ENABLED"}, "name": "airgap"}}]}'
40+
body_type: utf-8
41+
status_message: ""
42+
proto_major: 0
43+
proto_minor: 0
44+
objects:
45+
- type: error
46+
data: H4sIAAAAAAAA/wEAAP//AAAAAAAAAAA=

v3/models/address.go

Lines changed: 145 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)