From 2bcd156cba0c22598ca51056bd886860aad2dda3 Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Sat, 8 Oct 2022 13:24:55 +0530 Subject: [PATCH 01/26] GO SDK for DHCP based NSX-T segment --- pkg/client/networks.go | 4 ---- pkg/models/networks.go | 19 ++++++++----------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/pkg/client/networks.go b/pkg/client/networks.go index e53761e..6876f60 100644 --- a/pkg/client/networks.go +++ b/pkg/client/networks.go @@ -61,10 +61,6 @@ func (n *NetworksAPIService) CreateNetwork( networkReq models.CreateNetworkRequest, ) (models.CreateNetworkResponse, error) { var networksResp models.CreateNetworkResponse - if v, _ := parseVersion("5.4.4"); v <= n.Client.getVersion() { - networkReq.Network.NetworkPool.Pool = networkReq.Network.PoolID - networkReq.Network.PoolID = 0 - } networkAPI := &api{ compatibleVersion: "5.2.13", method: "POST", diff --git a/pkg/models/networks.go b/pkg/models/networks.go index 4e1f191..6f83e0e 100644 --- a/pkg/models/networks.go +++ b/pkg/models/networks.go @@ -77,25 +77,17 @@ type CreateNetwork struct { Name string `json:"name" tf:"name"` Description string `json:"description,omitempty" tf:"description"` DisplayName string `json:"displayName,omitempty" tf:"display_name"` - CloudID int `json:"-" tf:"cloud_id"` - GroupID string `json:"-" tf:"group_id"` - TypeID int `json:"-" tf:"type_id"` - PoolID int `json:"pool,omitempty" tf:"pool_id"` - NetworkDomainID int `json:"-" tf:"domain_id"` Site IDStringModel `json:"site,omitempty"` Type IDModel `json:"type,omitempty"` NetworkDomain *IDModel `json:"networkDomain,omitempty"` NetworkProxy *IDModel `json:"networkProxy,omitempty"` NetworkServer IDModel `json:"networkServer,omitempty"` - NetworkPool PoolModel `json:"networkPool,omitempty"` - NetworkProxyID int `json:"-" tf:"proxy_id"` - ProxyID int `json:"-" tf:"proxy_id"` SearchDomains string `json:"searchDomains,omitempty" tf:"search_domains"` Cidr string `json:"cidr,omitempty" tf:"cidr"` Gateway string `json:"gateway,omitempty" tf:"gateway"` DNSPrimary string `json:"dnsPrimary,omitempty" tf:"primary_dns"` DNSSecondary string `json:"dnsSecondary,omitempty" tf:"secondary_dns"` - Config *CreateNetworkConfig `json:"config,omitempty" tf:"config,sub"` + Config *CreateNetworkConfig `json:"config" tf:"config,sub"` Active bool `json:"active" tf:"active"` DhcpServer bool `json:"dhcpServer"` ScanNetwork bool `json:"scanNetwork" tf:"scan_network"` @@ -107,8 +99,13 @@ type CreateNetwork struct { } type CreateNetworkConfig struct { - ConnectedGateway string `json:"connectedGateway,omitempty" tf:"connected_gateway"` - VlanIDs string `json:"vlanIDs,omitempty" tf:"vlan_ids"` + ConnectedGateway string `json:"connectedGateway,omitempty" tf:"connected_gateway"` + VlanIDs string `json:"vlanIDs,omitempty" tf:"vlan_ids"` + SubnetIPManagementType string `json:"subnetIPManagementType" tf:"Subnet_ip_management_type"` + SubnetIPServerID string `json:"subnetIPServerID" tf:"subnet_ip_serverid"` + SubnetDhcpServerAddress string `json:"subnetDhcpServerAddress" tf:"subnet_dhcp_server_address"` + DhcpRange string `json:"dhcpRange" tf:"dhcp_range"` + SubnetDhcpLeaseTime string `json:"subnetDhcpLeaseTime" tf:"subnet_dhcp_lease_time"` } type GetNetworkTypesResponse struct { From 9cc5b57b1209961fc308c6d50b822751863558c7 Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Sat, 8 Oct 2022 19:07:37 +0530 Subject: [PATCH 02/26] updating the fix --- pkg/models/networks.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/models/networks.go b/pkg/models/networks.go index 6f83e0e..36f21ae 100644 --- a/pkg/models/networks.go +++ b/pkg/models/networks.go @@ -77,24 +77,24 @@ type CreateNetwork struct { Name string `json:"name" tf:"name"` Description string `json:"description,omitempty" tf:"description"` DisplayName string `json:"displayName,omitempty" tf:"display_name"` - Site IDStringModel `json:"site,omitempty"` - Type IDModel `json:"type,omitempty"` - NetworkDomain *IDModel `json:"networkDomain,omitempty"` - NetworkProxy *IDModel `json:"networkProxy,omitempty"` - NetworkServer IDModel `json:"networkServer,omitempty"` + Site IDStringModel `json:"site" tf:"site"` + Type IDModel `json:"type" tf:"type"` + NetworkDomain *IDModel `json:"networkDomain" tf:"network_domain"` + NetworkProxy *IDModel `json:"networkProxy" tf:"network_proxy"` + NetworkServer IDModel `json:"networkServer" tf:"network_server"` SearchDomains string `json:"searchDomains,omitempty" tf:"search_domains"` - Cidr string `json:"cidr,omitempty" tf:"cidr"` + Cidr string `json:"cidr" tf:"cidr"` Gateway string `json:"gateway,omitempty" tf:"gateway"` DNSPrimary string `json:"dnsPrimary,omitempty" tf:"primary_dns"` DNSSecondary string `json:"dnsSecondary,omitempty" tf:"secondary_dns"` Config *CreateNetworkConfig `json:"config" tf:"config,sub"` Active bool `json:"active" tf:"active"` - DhcpServer bool `json:"dhcpServer"` + DhcpServer bool `json:"dhcpServer" tf:"dhcp_server"` ScanNetwork bool `json:"scanNetwork" tf:"scan_network"` AllowStaticOverride bool `json:"allowStaticOverride" tf:"allow_static_override"` AppURLProxyBypass bool `json:"applianceUrlProxyBypass,omitempty" tf:"appliance_url_proxy_bypass"` NoProxy string `json:"noProxy,omitempty" tf:"no_proxy"` - ScopeID string `json:"scopeId,omitempty" tf:"scode_id"` + ScopeID string `json:"scopeId" tf:"scode_id"` ResourcePermissions NetworkResPermission `json:"-" tf:"resource_permissions,sub"` } From 97576d2701ccab42ed8461d1dab39a1ad802a022 Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Sat, 8 Oct 2022 19:25:07 +0530 Subject: [PATCH 03/26] updated --- pkg/models/networks.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/models/networks.go b/pkg/models/networks.go index 36f21ae..f3faf66 100644 --- a/pkg/models/networks.go +++ b/pkg/models/networks.go @@ -101,8 +101,8 @@ type CreateNetwork struct { type CreateNetworkConfig struct { ConnectedGateway string `json:"connectedGateway,omitempty" tf:"connected_gateway"` VlanIDs string `json:"vlanIDs,omitempty" tf:"vlan_ids"` - SubnetIPManagementType string `json:"subnetIPManagementType" tf:"Subnet_ip_management_type"` - SubnetIPServerID string `json:"subnetIPServerID" tf:"subnet_ip_serverid"` + SubnetIPManagementType string `json:"subnetIpManagementType" tf:"subnet_ip_management_type"` + SubnetIPServerID string `json:"subnetIpServerId" tf:"subnet_ip_server_id"` SubnetDhcpServerAddress string `json:"subnetDhcpServerAddress" tf:"subnet_dhcp_server_address"` DhcpRange string `json:"dhcpRange" tf:"dhcp_range"` SubnetDhcpLeaseTime string `json:"subnetDhcpLeaseTime" tf:"subnet_dhcp_lease_time"` From eae4688cb1722b140bd55c250ed93f4d430c6881 Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Sat, 8 Oct 2022 19:39:05 +0530 Subject: [PATCH 04/26] updated the required fileds --- pkg/models/shared_models.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/models/shared_models.go b/pkg/models/shared_models.go index 9cea730..16c7670 100644 --- a/pkg/models/shared_models.go +++ b/pkg/models/shared_models.go @@ -5,11 +5,11 @@ package models import "encoding/json" type IDModel struct { - ID int `json:"id,omitempty" tf:"id"` + ID int `json:"id" tf:"id"` } type IDStringModel struct { - ID string `json:"id,omitempty" tf:"id"` + ID string `json:"id" tf:"id"` } type UserNameModel struct { From 05f18978f2bcdd10fc00c8b4cc95ffd94e49eb93 Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Sun, 9 Oct 2022 11:24:13 +0530 Subject: [PATCH 05/26] addressed --- pkg/models/networks.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pkg/models/networks.go b/pkg/models/networks.go index f3faf66..5d3e96e 100644 --- a/pkg/models/networks.go +++ b/pkg/models/networks.go @@ -77,35 +77,35 @@ type CreateNetwork struct { Name string `json:"name" tf:"name"` Description string `json:"description,omitempty" tf:"description"` DisplayName string `json:"displayName,omitempty" tf:"display_name"` - Site IDStringModel `json:"site" tf:"site"` + Site IDStringModel `json:"site" tf:"group"` Type IDModel `json:"type" tf:"type"` - NetworkDomain *IDModel `json:"networkDomain" tf:"network_domain"` + NetworkDomain *IDModel `json:"networkDomain" tf:"domain"` NetworkProxy *IDModel `json:"networkProxy" tf:"network_proxy"` NetworkServer IDModel `json:"networkServer" tf:"network_server"` SearchDomains string `json:"searchDomains,omitempty" tf:"search_domains"` - Cidr string `json:"cidr" tf:"cidr"` + Cidr string `json:"cidr" tf:"gateway_cidr"` Gateway string `json:"gateway,omitempty" tf:"gateway"` DNSPrimary string `json:"dnsPrimary,omitempty" tf:"primary_dns"` DNSSecondary string `json:"dnsSecondary,omitempty" tf:"secondary_dns"` Config *CreateNetworkConfig `json:"config" tf:"config,sub"` Active bool `json:"active" tf:"active"` - DhcpServer bool `json:"dhcpServer" tf:"dhcp_server"` + DhcpServer bool `json:"dhcpServer" tf:"dhcp_enabled"` ScanNetwork bool `json:"scanNetwork" tf:"scan_network"` - AllowStaticOverride bool `json:"allowStaticOverride" tf:"allow_static_override"` - AppURLProxyBypass bool `json:"applianceUrlProxyBypass,omitempty" tf:"appliance_url_proxy_bypass"` + AllowStaticOverride bool `json:"allowStaticOverride" tf:"allow_ip_override"` + AppURLProxyBypass bool `json:"applianceUrlProxyBypass,omitempty" tf:"bypass_for_appliance_url"` NoProxy string `json:"noProxy,omitempty" tf:"no_proxy"` - ScopeID string `json:"scopeId" tf:"scode_id"` + ScopeID string `json:"scopeId" tf:"transport_zone"` ResourcePermissions NetworkResPermission `json:"-" tf:"resource_permissions,sub"` } type CreateNetworkConfig struct { ConnectedGateway string `json:"connectedGateway,omitempty" tf:"connected_gateway"` - VlanIDs string `json:"vlanIDs,omitempty" tf:"vlan_ids"` - SubnetIPManagementType string `json:"subnetIpManagementType" tf:"subnet_ip_management_type"` - SubnetIPServerID string `json:"subnetIpServerId" tf:"subnet_ip_server_id"` - SubnetDhcpServerAddress string `json:"subnetDhcpServerAddress" tf:"subnet_dhcp_server_address"` + VlanIDs string `json:"vlanIDs,omitempty" tf:"vlan"` + SubnetIPManagementType string `json:"subnetIpManagementType" tf:"dhcp_type"` + SubnetIPServerID string `json:"subnetIpServerId" tf:"dhcp_server"` + SubnetDhcpServerAddress string `json:"subnetDhcpServerAddress" tf:"dhcp_server_address"` DhcpRange string `json:"dhcpRange" tf:"dhcp_range"` - SubnetDhcpLeaseTime string `json:"subnetDhcpLeaseTime" tf:"subnet_dhcp_lease_time"` + SubnetDhcpLeaseTime string `json:"subnetDhcpLeaseTime" tf:"dhcp_lease_time"` } type GetNetworkTypesResponse struct { From 193f0244c04cdcddd2ab100c71abb52b0926dfb1 Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Sun, 9 Oct 2022 11:34:10 +0530 Subject: [PATCH 06/26] addressed the changes --- pkg/models/networks.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/models/networks.go b/pkg/models/networks.go index 5d3e96e..4bd445f 100644 --- a/pkg/models/networks.go +++ b/pkg/models/networks.go @@ -92,7 +92,7 @@ type CreateNetwork struct { DhcpServer bool `json:"dhcpServer" tf:"dhcp_enabled"` ScanNetwork bool `json:"scanNetwork" tf:"scan_network"` AllowStaticOverride bool `json:"allowStaticOverride" tf:"allow_ip_override"` - AppURLProxyBypass bool `json:"applianceUrlProxyBypass,omitempty" tf:"bypass_for_appliance_url"` + AppURLProxyBypass bool `json:"applianceUrlProxyBypass,omitempty" tf:"bypass_proxy_for_appliance_url"` NoProxy string `json:"noProxy,omitempty" tf:"no_proxy"` ScopeID string `json:"scopeId" tf:"transport_zone"` ResourcePermissions NetworkResPermission `json:"-" tf:"resource_permissions,sub"` From a8c6bc2462a6bc945812ef9deec63d430fa5f707 Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Tue, 11 Oct 2022 11:48:49 +0530 Subject: [PATCH 07/26] updated the models --- pkg/client/networks_test.go | 16 ++++-- pkg/models/networks.go | 102 ++++++++++++++++++++++++++---------- 2 files changed, 85 insertions(+), 33 deletions(-) diff --git a/pkg/client/networks_test.go b/pkg/client/networks_test.go index 5595539..6e9e7a4 100644 --- a/pkg/client/networks_test.go +++ b/pkg/client/networks_test.go @@ -163,7 +163,9 @@ func TestNetworksAPIService_CreateNetwork(t *testing.T) { name: "Normal test case 1: Create network", args: models.CreateNetworkRequest{ Network: models.CreateNetwork{ - Name: "tf_net", + TfStaticNetworkConfig: &models.CreateStaticNetwork{ + Name: "tf_net", + }, }, }, given: func(m *MockAPIClientHandler) { @@ -177,7 +179,9 @@ func TestNetworksAPIService_CreateNetwork(t *testing.T) { m.EXPECT().prepareRequest(gomock.Any(), path, method, models.CreateNetworkRequest{ Network: models.CreateNetwork{ - Name: "tf_net", + TfStaticNetworkConfig: &models.CreateStaticNetwork{ + Name: "tf_net", + }, }, }, headers, url.Values{}, url.Values{}, "", nil).Return(req, nil) @@ -249,7 +253,9 @@ func TestNetworksAPIService_UpdateNetwork(t *testing.T) { networkID: 1, request: models.CreateNetworkRequest{ Network: models.CreateNetwork{ - Name: "test_net", + TfStaticNetworkConfig: &models.CreateStaticNetwork{ + Name: "tf_net", + }, }, }, }, @@ -264,7 +270,9 @@ func TestNetworksAPIService_UpdateNetwork(t *testing.T) { m.EXPECT().prepareRequest(gomock.Any(), path, method, models.CreateNetworkRequest{ Network: models.CreateNetwork{ - Name: "test_net", + TfStaticNetworkConfig: &models.CreateStaticNetwork{ + Name: "tf_net", + }, }, }, headers, url.Values{}, url.Values{}, "", nil).Return(req, nil) diff --git a/pkg/models/networks.go b/pkg/models/networks.go index 4bd445f..992ca99 100644 --- a/pkg/models/networks.go +++ b/pkg/models/networks.go @@ -64,41 +64,85 @@ type NetworkResPermissionSites struct { } type CreateNetworkRequest struct { - Network CreateNetwork `json:"network"` - ResourcePermissions NetworkResPermission `json:"resourcePermissions,omitempty"` + Network CreateNetwork `json:"network"` + //ResourcePermissions NetworkResPermission `json:"resourcePermissions,omitempty"` + } +type CreateNetwork struct { + TfStaticNetworkConfig *CreateStaticNetwork `json:"-" tf:"static_network,sub"` + TfDhcpNetworkConfig *CreateDhcpNetwork `json:"-" tf:"dhcp_network,sub"` +} type PoolModel struct { Pool int `json:"pool,omitempty"` } -type CreateNetwork struct { - ID int `json:"-" tf:"id,computed"` - Name string `json:"name" tf:"name"` - Description string `json:"description,omitempty" tf:"description"` - DisplayName string `json:"displayName,omitempty" tf:"display_name"` - Site IDStringModel `json:"site" tf:"group"` - Type IDModel `json:"type" tf:"type"` - NetworkDomain *IDModel `json:"networkDomain" tf:"domain"` - NetworkProxy *IDModel `json:"networkProxy" tf:"network_proxy"` - NetworkServer IDModel `json:"networkServer" tf:"network_server"` - SearchDomains string `json:"searchDomains,omitempty" tf:"search_domains"` - Cidr string `json:"cidr" tf:"gateway_cidr"` - Gateway string `json:"gateway,omitempty" tf:"gateway"` - DNSPrimary string `json:"dnsPrimary,omitempty" tf:"primary_dns"` - DNSSecondary string `json:"dnsSecondary,omitempty" tf:"secondary_dns"` - Config *CreateNetworkConfig `json:"config" tf:"config,sub"` - Active bool `json:"active" tf:"active"` - DhcpServer bool `json:"dhcpServer" tf:"dhcp_enabled"` - ScanNetwork bool `json:"scanNetwork" tf:"scan_network"` - AllowStaticOverride bool `json:"allowStaticOverride" tf:"allow_ip_override"` - AppURLProxyBypass bool `json:"applianceUrlProxyBypass,omitempty" tf:"bypass_proxy_for_appliance_url"` - NoProxy string `json:"noProxy,omitempty" tf:"no_proxy"` - ScopeID string `json:"scopeId" tf:"transport_zone"` - ResourcePermissions NetworkResPermission `json:"-" tf:"resource_permissions,sub"` -} - -type CreateNetworkConfig struct { +type CreateStaticNetwork struct { + ID int `json:"-" tf:"id,computed"` + Name string `json:"name" tf:"name"` + Description string `json:"description,omitempty" tf:"description"` + DisplayName string `json:"displayName,omitempty" tf:"display_name"` + CloudID int `json:"-" tf:"cloud_id"` + GroupID string `json:"-" tf:"group_id"` + TypeID int `json:"-" tf:"type_id"` + PoolID int `json:"pool,omitempty" tf:"pool_id"` + NetworkDomainID int `json:"-" tf:"domain_id"` + Site IDStringModel `json:"site,omitempty"` + Type IDModel `json:"type,omitempty"` + NetworkDomain *IDModel `json:"networkDomain,omitempty"` + NetworkProxy *IDModel `json:"networkProxy,omitempty"` + NetworkServer IDModel `json:"networkServer,omitempty"` + NetworkPool PoolModel `json:"networkPool,omitempty"` + NetworkProxyID int `json:"-" tf:"proxy_id"` + ProxyID int `json:"-" tf:"proxy_id"` + SearchDomains string `json:"searchDomains,omitempty" tf:"search_domains"` + Cidr string `json:"cidr,omitempty" tf:"cidr"` + Gateway string `json:"gateway,omitempty" tf:"gateway"` + DNSPrimary string `json:"dnsPrimary,omitempty" tf:"primary_dns"` + DNSSecondary string `json:"dnsSecondary,omitempty" tf:"secondary_dns"` + Config *CreateStaticNetworkConfig `json:"config,omitempty" tf:"config,sub"` + Active bool `json:"active" tf:"active"` + DhcpServer bool `json:"dhcpServer"` + ScanNetwork bool `json:"scanNetwork" tf:"scan_network"` + AllowStaticOverride bool `json:"allowStaticOverride" tf:"allow_static_override"` + AppURLProxyBypass bool `json:"applianceUrlProxyBypass,omitempty" tf:"appliance_url_proxy_bypass"` + NoProxy string `json:"noProxy,omitempty" tf:"no_proxy"` + ScopeID string `json:"scopeId,omitempty" tf:"scode_id"` + ResourcePermissions NetworkResPermission `json:"-" tf:"resource_permissions,sub"` +} + +type CreateStaticNetworkConfig struct { + ConnectedGateway string `json:"connectedGateway,omitempty" tf:"connected_gateway"` + VlanIDs string `json:"vlanIDs,omitempty" tf:"vlan_ids"` +} + +type CreateDhcpNetwork struct { + ID int `json:"-" tf:"id,computed"` + Name string `json:"name" tf:"name"` + Description string `json:"description,omitempty" tf:"description"` + DisplayName string `json:"displayName,omitempty" tf:"display_name"` + Site IDStringModel `json:"site" tf:"group"` + Type IDModel `json:"type" tf:"type"` + NetworkDomain *IDModel `json:"networkDomain" tf:"domain"` + NetworkProxy *IDModel `json:"networkProxy" tf:"network_proxy"` + NetworkServer IDModel `json:"networkServer" tf:"network_server"` + SearchDomains string `json:"searchDomains,omitempty" tf:"search_domains"` + Cidr string `json:"cidr" tf:"gateway_cidr"` + Gateway string `json:"gateway,omitempty" tf:"gateway"` + DNSPrimary string `json:"dnsPrimary,omitempty" tf:"primary_dns"` + DNSSecondary string `json:"dnsSecondary,omitempty" tf:"secondary_dns"` + Config *CreateDhcpNetworkConfig `json:"config" tf:"config,sub"` + Active bool `json:"active" tf:"active"` + DhcpServer bool `json:"dhcpServer" tf:"dhcp_enabled"` + ScanNetwork bool `json:"scanNetwork" tf:"scan_network"` + AllowStaticOverride bool `json:"allowStaticOverride" tf:"allow_ip_override"` + AppURLProxyBypass bool `json:"applianceUrlProxyBypass,omitempty" tf:"bypass_proxy_for_appliance_url"` + NoProxy string `json:"noProxy,omitempty" tf:"no_proxy"` + ScopeID string `json:"scopeId" tf:"transport_zone"` + ResourcePermissions NetworkResPermission `json:"-" tf:"resource_permissions,sub"` +} + +type CreateDhcpNetworkConfig struct { ConnectedGateway string `json:"connectedGateway,omitempty" tf:"connected_gateway"` VlanIDs string `json:"vlanIDs,omitempty" tf:"vlan"` SubnetIPManagementType string `json:"subnetIpManagementType" tf:"dhcp_type"` From 1991e0586f052b30658f0dd65e2d8d1c2ca8c1f3 Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Tue, 11 Oct 2022 11:53:16 +0530 Subject: [PATCH 08/26] updated the changes --- pkg/client/networks.go | 4 ++++ pkg/models/shared_models.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/client/networks.go b/pkg/client/networks.go index 6876f60..715345b 100644 --- a/pkg/client/networks.go +++ b/pkg/client/networks.go @@ -61,6 +61,10 @@ func (n *NetworksAPIService) CreateNetwork( networkReq models.CreateNetworkRequest, ) (models.CreateNetworkResponse, error) { var networksResp models.CreateNetworkResponse + if v, _ := parseVersion("5.4.4"); v <= n.Client.getVersion() { + networkReq.Network.TfStaticNetworkConfig.NetworkPool.Pool = networkReq.Network.TfStaticNetworkConfig.PoolID + networkReq.Network.TfStaticNetworkConfig.PoolID = 0 + } networkAPI := &api{ compatibleVersion: "5.2.13", method: "POST", diff --git a/pkg/models/shared_models.go b/pkg/models/shared_models.go index 16c7670..49c961c 100644 --- a/pkg/models/shared_models.go +++ b/pkg/models/shared_models.go @@ -5,7 +5,7 @@ package models import "encoding/json" type IDModel struct { - ID int `json:"id" tf:"id"` + ID int `json:"id,omitempty" tf:"id"` } type IDStringModel struct { From e6556f5ab91939865a2f5744103f4b16e68ee693 Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Tue, 11 Oct 2022 11:56:28 +0530 Subject: [PATCH 09/26] updated the changes --- pkg/models/networks.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkg/models/networks.go b/pkg/models/networks.go index 992ca99..b7f2452 100644 --- a/pkg/models/networks.go +++ b/pkg/models/networks.go @@ -65,8 +65,6 @@ type NetworkResPermissionSites struct { type CreateNetworkRequest struct { Network CreateNetwork `json:"network"` - //ResourcePermissions NetworkResPermission `json:"resourcePermissions,omitempty"` - } type CreateNetwork struct { From dd839d9c59a31c4efe2125d2954fd85a60f52b01 Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Tue, 11 Oct 2022 11:59:53 +0530 Subject: [PATCH 10/26] updated the changes --- pkg/models/networks.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/models/networks.go b/pkg/models/networks.go index b7f2452..a3b3a46 100644 --- a/pkg/models/networks.go +++ b/pkg/models/networks.go @@ -71,6 +71,7 @@ type CreateNetwork struct { TfStaticNetworkConfig *CreateStaticNetwork `json:"-" tf:"static_network,sub"` TfDhcpNetworkConfig *CreateDhcpNetwork `json:"-" tf:"dhcp_network,sub"` } + type PoolModel struct { Pool int `json:"pool,omitempty"` } From dabcacd105b921ac8b7d4f4a9eb1fce022f637f8 Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Thu, 13 Oct 2022 11:11:00 +0530 Subject: [PATCH 11/26] reverted the change --- pkg/models/shared_models.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/models/shared_models.go b/pkg/models/shared_models.go index 49c961c..9cea730 100644 --- a/pkg/models/shared_models.go +++ b/pkg/models/shared_models.go @@ -9,7 +9,7 @@ type IDModel struct { } type IDStringModel struct { - ID string `json:"id" tf:"id"` + ID string `json:"id,omitempty" tf:"id"` } type UserNameModel struct { From 50cb08d6a11e09411266a1852318ad72eb08d55e Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Thu, 13 Oct 2022 11:37:25 +0530 Subject: [PATCH 12/26] updated the model --- pkg/models/networks.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/models/networks.go b/pkg/models/networks.go index a3b3a46..1d516cd 100644 --- a/pkg/models/networks.go +++ b/pkg/models/networks.go @@ -68,6 +68,9 @@ type CreateNetworkRequest struct { } type CreateNetwork struct { + ID int `json:"-" tf:"id,computed"` + Type IDModel `json:"type,omitempty"` + NetworkServer IDModel `json:"networkServer,omitempty"` TfStaticNetworkConfig *CreateStaticNetwork `json:"-" tf:"static_network,sub"` TfDhcpNetworkConfig *CreateDhcpNetwork `json:"-" tf:"dhcp_network,sub"` } @@ -77,7 +80,6 @@ type PoolModel struct { } type CreateStaticNetwork struct { - ID int `json:"-" tf:"id,computed"` Name string `json:"name" tf:"name"` Description string `json:"description,omitempty" tf:"description"` DisplayName string `json:"displayName,omitempty" tf:"display_name"` @@ -90,7 +92,6 @@ type CreateStaticNetwork struct { Type IDModel `json:"type,omitempty"` NetworkDomain *IDModel `json:"networkDomain,omitempty"` NetworkProxy *IDModel `json:"networkProxy,omitempty"` - NetworkServer IDModel `json:"networkServer,omitempty"` NetworkPool PoolModel `json:"networkPool,omitempty"` NetworkProxyID int `json:"-" tf:"proxy_id"` ProxyID int `json:"-" tf:"proxy_id"` @@ -124,7 +125,6 @@ type CreateDhcpNetwork struct { Type IDModel `json:"type" tf:"type"` NetworkDomain *IDModel `json:"networkDomain" tf:"domain"` NetworkProxy *IDModel `json:"networkProxy" tf:"network_proxy"` - NetworkServer IDModel `json:"networkServer" tf:"network_server"` SearchDomains string `json:"searchDomains,omitempty" tf:"search_domains"` Cidr string `json:"cidr" tf:"gateway_cidr"` Gateway string `json:"gateway,omitempty" tf:"gateway"` From 29ca53e73eee93357199fcc3d6c81346545a9cba Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Fri, 14 Oct 2022 11:16:02 +0530 Subject: [PATCH 13/26] model updated --- pkg/client/networks.go | 6 +- pkg/client/networks_test.go | 16 +--- pkg/models/networks.go | 186 +++++++++++++++++++++--------------- 3 files changed, 118 insertions(+), 90 deletions(-) diff --git a/pkg/client/networks.go b/pkg/client/networks.go index 715345b..ce89ab1 100644 --- a/pkg/client/networks.go +++ b/pkg/client/networks.go @@ -62,8 +62,10 @@ func (n *NetworksAPIService) CreateNetwork( ) (models.CreateNetworkResponse, error) { var networksResp models.CreateNetworkResponse if v, _ := parseVersion("5.4.4"); v <= n.Client.getVersion() { - networkReq.Network.TfStaticNetworkConfig.NetworkPool.Pool = networkReq.Network.TfStaticNetworkConfig.PoolID - networkReq.Network.TfStaticNetworkConfig.PoolID = 0 + if networkReq.Network.NetworkPool != nil { + networkReq.Network.NetworkPool.Pool = networkReq.Network.PoolID + networkReq.Network.PoolID = 0 + } } networkAPI := &api{ compatibleVersion: "5.2.13", diff --git a/pkg/client/networks_test.go b/pkg/client/networks_test.go index 6e9e7a4..0991ac8 100644 --- a/pkg/client/networks_test.go +++ b/pkg/client/networks_test.go @@ -163,9 +163,7 @@ func TestNetworksAPIService_CreateNetwork(t *testing.T) { name: "Normal test case 1: Create network", args: models.CreateNetworkRequest{ Network: models.CreateNetwork{ - TfStaticNetworkConfig: &models.CreateStaticNetwork{ - Name: "tf_net", - }, + Name: "tf_net", }, }, given: func(m *MockAPIClientHandler) { @@ -179,9 +177,7 @@ func TestNetworksAPIService_CreateNetwork(t *testing.T) { m.EXPECT().prepareRequest(gomock.Any(), path, method, models.CreateNetworkRequest{ Network: models.CreateNetwork{ - TfStaticNetworkConfig: &models.CreateStaticNetwork{ - Name: "tf_net", - }, + Name: "tf_net", }, }, headers, url.Values{}, url.Values{}, "", nil).Return(req, nil) @@ -253,9 +249,7 @@ func TestNetworksAPIService_UpdateNetwork(t *testing.T) { networkID: 1, request: models.CreateNetworkRequest{ Network: models.CreateNetwork{ - TfStaticNetworkConfig: &models.CreateStaticNetwork{ - Name: "tf_net", - }, + Name: "tf_net", }, }, }, @@ -270,9 +264,7 @@ func TestNetworksAPIService_UpdateNetwork(t *testing.T) { m.EXPECT().prepareRequest(gomock.Any(), path, method, models.CreateNetworkRequest{ Network: models.CreateNetwork{ - TfStaticNetworkConfig: &models.CreateStaticNetwork{ - Name: "tf_net", - }, + Name: "tf_net", }, }, headers, url.Values{}, url.Values{}, "", nil).Return(req, nil) diff --git a/pkg/models/networks.go b/pkg/models/networks.go index 1d516cd..4b69ccd 100644 --- a/pkg/models/networks.go +++ b/pkg/models/networks.go @@ -68,87 +68,121 @@ type CreateNetworkRequest struct { } type CreateNetwork struct { - ID int `json:"-" tf:"id,computed"` - Type IDModel `json:"type,omitempty"` - NetworkServer IDModel `json:"networkServer,omitempty"` - TfStaticNetworkConfig *CreateStaticNetwork `json:"-" tf:"static_network,sub"` - TfDhcpNetworkConfig *CreateDhcpNetwork `json:"-" tf:"dhcp_network,sub"` + ID int `json:"-" tf:"id,computed"` + Type IDModel `json:"type,omitempty"` + NetworkServer IDModel `json:"networkServer,omitempty"` + ResourcePermissions NetworkResPermission `json:"resourcePermissions"` + Name string `json:"name" tf:"name"` + Description string `json:"description,omitempty"` + DisplayName string `json:"displayName,omitempty"` + CloudID int `json:"-" tf:"cloud_id"` + GroupID string `json:"-" tf:"group_id"` + TypeID int `json:"-" tf:"type_id"` + PoolID int `json:"pool,omitempty"` + NetworkDomainID int `json:"-" tf:"domain_id"` + Site *IDStringModel `json:"site,omitempty"` + NetworkDomain *IDModel `json:"networkDomain,omitempty"` + NetworkProxy *IDModel `json:"networkProxy,omitempty"` + NetworkPool *PoolModel `json:"networkPool,omitempty"` + NetworkProxyID int `json:"-" tf:"proxy_id"` + ProxyID int `json:"-" tf:"proxy_id"` + SearchDomains string `json:"searchDomains,omitempty"` + Cidr string `json:"cidr,omitempty"` + Gateway string `json:"gateway,omitempty"` + DNSPrimary string `json:"dnsPrimary,omitempty"` + DNSSecondary string `json:"dnsSecondary,omitempty"` + Active bool `json:"active"` + DhcpServer bool `json:"dhcpServer"` + ScanNetwork bool `json:"scanNetwork"` + AllowStaticOverride bool `json:"allowStaticOverride"` + AppURLProxyBypass bool `json:"applianceUrlProxyBypass,omitempty"` + NoProxy string `json:"noProxy,omitempty"` + ScopeID string `json:"scopeId,omitempty"` + TfStaticNetwork *CreateStaticNetwork `json:"-" tf:"static_network,sub"` + TfDhcpNetwork *CreateDhcpNetwork `json:"-" tf:"dhcp_network,sub"` + TfDhcpConfig *TfCreateDhcpNetworkConfig `json:"-" tf:"config,sub"` + TfStaticConfig *TfCreateStaticNetworkConfig `json:"-" tf:"config,sub"` + StaticConfig *CreateStaticConfig `json:"config,omitempty"` + DhcpConfig *CreateDhcpConfig `json:"config"` +} + +type TfCreateStaticNetworkConfig struct { + ConnectedGateway string `json:"" tf:"connected_gateway"` + VlanIDs string `json:"" tf:"vlan_ids"` +} + +type TfCreateDhcpNetworkConfig struct { + ConnectedGateway string `json:"-" tf:"connected_gateway"` + VlanIDs string `json:"-" tf:"vlan"` + SubnetIPManagementType string `json:"-" tf:"dhcp_type"` + SubnetIPServerID string `json:"-" tf:"dhcp_server"` + SubnetDhcpServerAddress string `json:"-" tf:"dhcp_server_address"` + DhcpRange string `json:"-" tf:"dhcp_range"` + SubnetDhcpLeaseTime string `json:"-" tf:"dhcp_lease_time"` +} +type CreateStaticConfig struct { + ConnectedGateway string `json:"connectedGateway,omitempty"` + VlanIDs string `json:"vlanIDs,omitempty"` +} + +type CreateDhcpConfig struct { + ConnectedGateway string `json:"connectedGateway,omitempty"` + VlanIDs string `json:"vlanIDs,omitempty"` + SubnetIPManagementType string `json:"subnetIpManagementType"` + SubnetIPServerID string `json:"subnetIpServerId"` + SubnetDhcpServerAddress string `json:"subnetDhcpServerAddress"` + DhcpRange string `json:"dhcpRange"` + SubnetDhcpLeaseTime string `json:"subnetDhcpLeaseTime"` } - -type PoolModel struct { - Pool int `json:"pool,omitempty"` -} - type CreateStaticNetwork struct { - Name string `json:"name" tf:"name"` - Description string `json:"description,omitempty" tf:"description"` - DisplayName string `json:"displayName,omitempty" tf:"display_name"` - CloudID int `json:"-" tf:"cloud_id"` - GroupID string `json:"-" tf:"group_id"` - TypeID int `json:"-" tf:"type_id"` - PoolID int `json:"pool,omitempty" tf:"pool_id"` - NetworkDomainID int `json:"-" tf:"domain_id"` - Site IDStringModel `json:"site,omitempty"` - Type IDModel `json:"type,omitempty"` - NetworkDomain *IDModel `json:"networkDomain,omitempty"` - NetworkProxy *IDModel `json:"networkProxy,omitempty"` - NetworkPool PoolModel `json:"networkPool,omitempty"` - NetworkProxyID int `json:"-" tf:"proxy_id"` - ProxyID int `json:"-" tf:"proxy_id"` - SearchDomains string `json:"searchDomains,omitempty" tf:"search_domains"` - Cidr string `json:"cidr,omitempty" tf:"cidr"` - Gateway string `json:"gateway,omitempty" tf:"gateway"` - DNSPrimary string `json:"dnsPrimary,omitempty" tf:"primary_dns"` - DNSSecondary string `json:"dnsSecondary,omitempty" tf:"secondary_dns"` - Config *CreateStaticNetworkConfig `json:"config,omitempty" tf:"config,sub"` - Active bool `json:"active" tf:"active"` - DhcpServer bool `json:"dhcpServer"` - ScanNetwork bool `json:"scanNetwork" tf:"scan_network"` - AllowStaticOverride bool `json:"allowStaticOverride" tf:"allow_static_override"` - AppURLProxyBypass bool `json:"applianceUrlProxyBypass,omitempty" tf:"appliance_url_proxy_bypass"` - NoProxy string `json:"noProxy,omitempty" tf:"no_proxy"` - ScopeID string `json:"scopeId,omitempty" tf:"scode_id"` - ResourcePermissions NetworkResPermission `json:"-" tf:"resource_permissions,sub"` -} - -type CreateStaticNetworkConfig struct { - ConnectedGateway string `json:"connectedGateway,omitempty" tf:"connected_gateway"` - VlanIDs string `json:"vlanIDs,omitempty" tf:"vlan_ids"` + Name string `json:"-" tf:"name"` + Description string `json:"-" tf:"description"` + DisplayName string `json:"-" tf:"display_name"` + CloudID int `json:"-" tf:"cloud_id"` + GroupID string `json:"-" tf:"group_id"` + TypeID int `json:"-" tf:"type_id"` + PoolID int `json:"-" tf:"pool_id"` + NetworkDomainID int `json:"-" tf:"domain_id"` + NetworkProxyID int `json:"-" tf:"proxy_id"` + ProxyID int `json:"-" tf:"proxy_id"` + SearchDomains string `json:"-" tf:"search_domains"` + Cidr string `json:"-" tf:"cidr"` + Gateway string `json:"-" tf:"gateway"` + DNSPrimary string `json:"-" tf:"primary_dns"` + DNSSecondary string `json:"-" tf:"secondary_dns"` + Active bool `json:"-" tf:"active"` + ScanNetwork bool `json:"-" tf:"scan_network"` + AllowStaticOverride bool `json:"-" tf:"allow_static_override"` + AppURLProxyBypass bool `json:"-" tf:"appliance_url_proxy_bypass"` + NoProxy string `json:"-" tf:"no_proxy"` + ScopeID string `json:"-" tf:"scode_id"` + ResourcePermissions *NetworkResPermission `json:"-" tf:"resource_permissions,sub"` } type CreateDhcpNetwork struct { - ID int `json:"-" tf:"id,computed"` - Name string `json:"name" tf:"name"` - Description string `json:"description,omitempty" tf:"description"` - DisplayName string `json:"displayName,omitempty" tf:"display_name"` - Site IDStringModel `json:"site" tf:"group"` - Type IDModel `json:"type" tf:"type"` - NetworkDomain *IDModel `json:"networkDomain" tf:"domain"` - NetworkProxy *IDModel `json:"networkProxy" tf:"network_proxy"` - SearchDomains string `json:"searchDomains,omitempty" tf:"search_domains"` - Cidr string `json:"cidr" tf:"gateway_cidr"` - Gateway string `json:"gateway,omitempty" tf:"gateway"` - DNSPrimary string `json:"dnsPrimary,omitempty" tf:"primary_dns"` - DNSSecondary string `json:"dnsSecondary,omitempty" tf:"secondary_dns"` - Config *CreateDhcpNetworkConfig `json:"config" tf:"config,sub"` - Active bool `json:"active" tf:"active"` - DhcpServer bool `json:"dhcpServer" tf:"dhcp_enabled"` - ScanNetwork bool `json:"scanNetwork" tf:"scan_network"` - AllowStaticOverride bool `json:"allowStaticOverride" tf:"allow_ip_override"` - AppURLProxyBypass bool `json:"applianceUrlProxyBypass,omitempty" tf:"bypass_proxy_for_appliance_url"` - NoProxy string `json:"noProxy,omitempty" tf:"no_proxy"` - ScopeID string `json:"scopeId" tf:"transport_zone"` - ResourcePermissions NetworkResPermission `json:"-" tf:"resource_permissions,sub"` -} - -type CreateDhcpNetworkConfig struct { - ConnectedGateway string `json:"connectedGateway,omitempty" tf:"connected_gateway"` - VlanIDs string `json:"vlanIDs,omitempty" tf:"vlan"` - SubnetIPManagementType string `json:"subnetIpManagementType" tf:"dhcp_type"` - SubnetIPServerID string `json:"subnetIpServerId" tf:"dhcp_server"` - SubnetDhcpServerAddress string `json:"subnetDhcpServerAddress" tf:"dhcp_server_address"` - DhcpRange string `json:"dhcpRange" tf:"dhcp_range"` - SubnetDhcpLeaseTime string `json:"subnetDhcpLeaseTime" tf:"dhcp_lease_time"` + Name string `json:"-" tf:"name"` + Description string `json:"-" tf:"description"` + DisplayName string `json:"-" tf:"display_name"` + Site *IDStringModel `json:"-" tf:"group"` + NetworkDomain *IDModel `json:"-" tf:"domain"` + NetworkProxy *IDModel `json:"-" tf:"network_proxy"` + SearchDomains string `json:"-" tf:"search_domains"` + Cidr string `json:"-" tf:"gateway_cidr"` + Gateway string `json:"-" tf:"gateway"` + DNSPrimary string `json:"-" tf:"primary_dns"` + DNSSecondary string `json:"-" tf:"secondary_dns"` + Active bool `json:"-" tf:"active"` + DhcpServer bool `json:"-" tf:"dhcp_enabled"` + ScanNetwork bool `json:"-" tf:"scan_network"` + AllowStaticOverride bool `json:"-" tf:"allow_ip_override"` + AppURLProxyBypass bool `json:"-" tf:"bypass_proxy_for_appliance_url"` + NoProxy string `json:"-" tf:"no_proxy"` + ScopeID string `json:"-" tf:"transport_zone"` + ResourcePermissions *NetworkResPermission `json:"-" tf:"resource_permissions,sub"` +} + +type PoolModel struct { + Pool int `json:"pool,omitempty"` } type GetNetworkTypesResponse struct { From 3445a03e7baaafc7e96ed45de80f779c2ab3a567 Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Fri, 14 Oct 2022 11:59:36 +0530 Subject: [PATCH 14/26] updated the models --- pkg/models/networks.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pkg/models/networks.go b/pkg/models/networks.go index 4b69ccd..f87715a 100644 --- a/pkg/models/networks.go +++ b/pkg/models/networks.go @@ -102,8 +102,7 @@ type CreateNetwork struct { TfDhcpNetwork *CreateDhcpNetwork `json:"-" tf:"dhcp_network,sub"` TfDhcpConfig *TfCreateDhcpNetworkConfig `json:"-" tf:"config,sub"` TfStaticConfig *TfCreateStaticNetworkConfig `json:"-" tf:"config,sub"` - StaticConfig *CreateStaticConfig `json:"config,omitempty"` - DhcpConfig *CreateDhcpConfig `json:"config"` + Config *CreateNetworkConfig `json:"config"` } type TfCreateStaticNetworkConfig struct { @@ -120,12 +119,8 @@ type TfCreateDhcpNetworkConfig struct { DhcpRange string `json:"-" tf:"dhcp_range"` SubnetDhcpLeaseTime string `json:"-" tf:"dhcp_lease_time"` } -type CreateStaticConfig struct { - ConnectedGateway string `json:"connectedGateway,omitempty"` - VlanIDs string `json:"vlanIDs,omitempty"` -} -type CreateDhcpConfig struct { +type CreateNetworkConfig struct { ConnectedGateway string `json:"connectedGateway,omitempty"` VlanIDs string `json:"vlanIDs,omitempty"` SubnetIPManagementType string `json:"subnetIpManagementType"` From 2a14553c9db9bc10db6bf9d2752b57ef8e35c9d9 Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Fri, 14 Oct 2022 12:02:43 +0530 Subject: [PATCH 15/26] updated the models --- pkg/models/networks.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/models/networks.go b/pkg/models/networks.go index f87715a..b9d53ed 100644 --- a/pkg/models/networks.go +++ b/pkg/models/networks.go @@ -129,6 +129,7 @@ type CreateNetworkConfig struct { DhcpRange string `json:"dhcpRange"` SubnetDhcpLeaseTime string `json:"subnetDhcpLeaseTime"` } + type CreateStaticNetwork struct { Name string `json:"-" tf:"name"` Description string `json:"-" tf:"description"` From b24f52e8d3526ea0ff33330ce88817eb86309e99 Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Fri, 14 Oct 2022 12:11:05 +0530 Subject: [PATCH 16/26] updated the comment for understanding --- pkg/client/networks.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/client/networks.go b/pkg/client/networks.go index ce89ab1..550a4a0 100644 --- a/pkg/client/networks.go +++ b/pkg/client/networks.go @@ -62,6 +62,7 @@ func (n *NetworksAPIService) CreateNetwork( ) (models.CreateNetworkResponse, error) { var networksResp models.CreateNetworkResponse if v, _ := parseVersion("5.4.4"); v <= n.Client.getVersion() { + // network Pool is not required for DHCP if networkReq.Network.NetworkPool != nil { networkReq.Network.NetworkPool.Pool = networkReq.Network.PoolID networkReq.Network.PoolID = 0 From 114d308961a906c2c6beccbf3e7142269f8bac39 Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Fri, 14 Oct 2022 15:51:33 +0530 Subject: [PATCH 17/26] updated the proepr model --- pkg/models/networks.go | 158 +++++++++++++---------------------------- 1 file changed, 49 insertions(+), 109 deletions(-) diff --git a/pkg/models/networks.go b/pkg/models/networks.go index b9d53ed..cdb0a9d 100644 --- a/pkg/models/networks.go +++ b/pkg/models/networks.go @@ -64,121 +64,61 @@ type NetworkResPermissionSites struct { } type CreateNetworkRequest struct { - Network CreateNetwork `json:"network"` + Network CreateNetwork `json:"network"` + ResourcePermissions NetworkResPermission `json:"resourcePermissions,omitempty"` } -type CreateNetwork struct { - ID int `json:"-" tf:"id,computed"` - Type IDModel `json:"type,omitempty"` - NetworkServer IDModel `json:"networkServer,omitempty"` - ResourcePermissions NetworkResPermission `json:"resourcePermissions"` - Name string `json:"name" tf:"name"` - Description string `json:"description,omitempty"` - DisplayName string `json:"displayName,omitempty"` - CloudID int `json:"-" tf:"cloud_id"` - GroupID string `json:"-" tf:"group_id"` - TypeID int `json:"-" tf:"type_id"` - PoolID int `json:"pool,omitempty"` - NetworkDomainID int `json:"-" tf:"domain_id"` - Site *IDStringModel `json:"site,omitempty"` - NetworkDomain *IDModel `json:"networkDomain,omitempty"` - NetworkProxy *IDModel `json:"networkProxy,omitempty"` - NetworkPool *PoolModel `json:"networkPool,omitempty"` - NetworkProxyID int `json:"-" tf:"proxy_id"` - ProxyID int `json:"-" tf:"proxy_id"` - SearchDomains string `json:"searchDomains,omitempty"` - Cidr string `json:"cidr,omitempty"` - Gateway string `json:"gateway,omitempty"` - DNSPrimary string `json:"dnsPrimary,omitempty"` - DNSSecondary string `json:"dnsSecondary,omitempty"` - Active bool `json:"active"` - DhcpServer bool `json:"dhcpServer"` - ScanNetwork bool `json:"scanNetwork"` - AllowStaticOverride bool `json:"allowStaticOverride"` - AppURLProxyBypass bool `json:"applianceUrlProxyBypass,omitempty"` - NoProxy string `json:"noProxy,omitempty"` - ScopeID string `json:"scopeId,omitempty"` - TfStaticNetwork *CreateStaticNetwork `json:"-" tf:"static_network,sub"` - TfDhcpNetwork *CreateDhcpNetwork `json:"-" tf:"dhcp_network,sub"` - TfDhcpConfig *TfCreateDhcpNetworkConfig `json:"-" tf:"config,sub"` - TfStaticConfig *TfCreateStaticNetworkConfig `json:"-" tf:"config,sub"` - Config *CreateNetworkConfig `json:"config"` -} - -type TfCreateStaticNetworkConfig struct { - ConnectedGateway string `json:"" tf:"connected_gateway"` - VlanIDs string `json:"" tf:"vlan_ids"` -} - -type TfCreateDhcpNetworkConfig struct { - ConnectedGateway string `json:"-" tf:"connected_gateway"` - VlanIDs string `json:"-" tf:"vlan"` - SubnetIPManagementType string `json:"-" tf:"dhcp_type"` - SubnetIPServerID string `json:"-" tf:"dhcp_server"` - SubnetDhcpServerAddress string `json:"-" tf:"dhcp_server_address"` - DhcpRange string `json:"-" tf:"dhcp_range"` - SubnetDhcpLeaseTime string `json:"-" tf:"dhcp_lease_time"` +type PoolModel struct { + Pool int `json:"pool,omitempty"` } -type CreateNetworkConfig struct { - ConnectedGateway string `json:"connectedGateway,omitempty"` - VlanIDs string `json:"vlanIDs,omitempty"` - SubnetIPManagementType string `json:"subnetIpManagementType"` - SubnetIPServerID string `json:"subnetIpServerId"` - SubnetDhcpServerAddress string `json:"subnetDhcpServerAddress"` - DhcpRange string `json:"dhcpRange"` - SubnetDhcpLeaseTime string `json:"subnetDhcpLeaseTime"` -} - -type CreateStaticNetwork struct { - Name string `json:"-" tf:"name"` - Description string `json:"-" tf:"description"` - DisplayName string `json:"-" tf:"display_name"` - CloudID int `json:"-" tf:"cloud_id"` - GroupID string `json:"-" tf:"group_id"` - TypeID int `json:"-" tf:"type_id"` - PoolID int `json:"-" tf:"pool_id"` - NetworkDomainID int `json:"-" tf:"domain_id"` - NetworkProxyID int `json:"-" tf:"proxy_id"` - ProxyID int `json:"-" tf:"proxy_id"` - SearchDomains string `json:"-" tf:"search_domains"` - Cidr string `json:"-" tf:"cidr"` - Gateway string `json:"-" tf:"gateway"` - DNSPrimary string `json:"-" tf:"primary_dns"` - DNSSecondary string `json:"-" tf:"secondary_dns"` - Active bool `json:"-" tf:"active"` - ScanNetwork bool `json:"-" tf:"scan_network"` - AllowStaticOverride bool `json:"-" tf:"allow_static_override"` - AppURLProxyBypass bool `json:"-" tf:"appliance_url_proxy_bypass"` - NoProxy string `json:"-" tf:"no_proxy"` - ScopeID string `json:"-" tf:"scode_id"` - ResourcePermissions *NetworkResPermission `json:"-" tf:"resource_permissions,sub"` -} - -type CreateDhcpNetwork struct { - Name string `json:"-" tf:"name"` - Description string `json:"-" tf:"description"` - DisplayName string `json:"-" tf:"display_name"` - Site *IDStringModel `json:"-" tf:"group"` - NetworkDomain *IDModel `json:"-" tf:"domain"` - NetworkProxy *IDModel `json:"-" tf:"network_proxy"` - SearchDomains string `json:"-" tf:"search_domains"` - Cidr string `json:"-" tf:"gateway_cidr"` - Gateway string `json:"-" tf:"gateway"` - DNSPrimary string `json:"-" tf:"primary_dns"` - DNSSecondary string `json:"-" tf:"secondary_dns"` - Active bool `json:"-" tf:"active"` - DhcpServer bool `json:"-" tf:"dhcp_enabled"` - ScanNetwork bool `json:"-" tf:"scan_network"` - AllowStaticOverride bool `json:"-" tf:"allow_ip_override"` - AppURLProxyBypass bool `json:"-" tf:"bypass_proxy_for_appliance_url"` - NoProxy string `json:"-" tf:"no_proxy"` - ScopeID string `json:"-" tf:"transport_zone"` - ResourcePermissions *NetworkResPermission `json:"-" tf:"resource_permissions,sub"` +type CreateNetwork struct { + ID int `json:"-" tf:"id,computed"` + Name string `json:"name" tf:"name"` + Description string `json:"description,omitempty" tf:"description"` + DisplayName string `json:"displayName,omitempty" tf:"display_name"` + CloudID int `json:"-" tf:"cloud_id"` + GroupID string `json:"-" tf:"group_id"` + TypeID int `json:"-" tf:"type_id"` + PoolID int `json:"pool,omitempty" tf:"pool_id"` + NetworkDomainID int `json:"-" tf:"domain_id"` + Type IDModel `json:"type,omitempty"` + //NetworkDomain *IDModel `json:"networkDomain,omitempty"` + //NetworkProxy *IDModel `json:"networkProxy,omitempty"` + NetworkServer IDModel `json:"networkServer,omitempty"` + NetworkPool *PoolModel `json:"networkPool,omitempty"` + NetworkProxyID int `json:"-" tf:"proxy_id"` + ProxyID int `json:"-" tf:"proxy_id"` + SearchDomains string `json:"searchDomains,omitempty" tf:"search_domains"` + Cidr string `json:"cidr,omitempty" tf:"cidr"` + Gateway string `json:"gateway,omitempty" tf:"gateway"` + DNSPrimary string `json:"dnsPrimary,omitempty" tf:"primary_dns"` + DNSSecondary string `json:"dnsSecondary,omitempty" tf:"secondary_dns"` + Config *CreateNetworkConfig `json:"config,omitempty" tf:"config,sub"` + Active bool `json:"active" tf:"active"` + ScanNetwork bool `json:"scanNetwork" tf:"scan_network"` + AllowStaticOverride bool `json:"allowStaticOverride" tf:"allow_static_override"` + AppURLProxyBypass bool `json:"applianceUrlProxyBypass,omitempty" tf:"appliance_url_proxy_bypass"` + NoProxy string `json:"noProxy,omitempty" tf:"no_proxy"` + ScopeID string `json:"scopeId,omitempty" tf:"scode_id"` + ResourcePermissions NetworkResPermission `json:"-" tf:"resource_permissions,sub"` + + //DhcpServer + Site IDStringModel `json:"site" tf:"group"` + DhcpServer bool `json:"dhcpServer" tf:"dhcp_enabled"` + NetworkDomain *IDModel `json:"networkDomain" tf:"domain"` + NetworkProxy *IDModel `json:"networkProxy" tf:"network_proxy"` } -type PoolModel struct { - Pool int `json:"pool,omitempty"` +type CreateNetworkConfig struct { + ConnectedGateway string `json:"connectedGateway,omitempty" tf:"connected_gateway"` + VlanIDs string `json:"vlanIDs,omitempty" tf:"vlan_ids"` + //DHCP Server + SubnetIPManagementType string `json:"subnetIpManagementType" tf:"dhcp_type"` + SubnetIPServerID string `json:"subnetIpServerId" tf:"dhcp_server"` + SubnetDhcpServerAddress string `json:"subnetDhcpServerAddress" tf:"dhcp_server_address"` + DhcpRange string `json:"dhcpRange" tf:"dhcp_range"` + SubnetDhcpLeaseTime string `json:"subnetDhcpLeaseTime" tf:"dhcp_lease_time"` } type GetNetworkTypesResponse struct { From 09e8e29b6ea66d416e3cf3db3a225ed9038b1f78 Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Sat, 15 Oct 2022 14:11:36 +0530 Subject: [PATCH 18/26] updated --- pkg/models/networks.go | 97 +++++++++++++++++++++++++++++++----------- 1 file changed, 72 insertions(+), 25 deletions(-) diff --git a/pkg/models/networks.go b/pkg/models/networks.go index cdb0a9d..ec17b38 100644 --- a/pkg/models/networks.go +++ b/pkg/models/networks.go @@ -73,18 +73,17 @@ type PoolModel struct { } type CreateNetwork struct { - ID int `json:"-" tf:"id,computed"` - Name string `json:"name" tf:"name"` - Description string `json:"description,omitempty" tf:"description"` - DisplayName string `json:"displayName,omitempty" tf:"display_name"` - CloudID int `json:"-" tf:"cloud_id"` - GroupID string `json:"-" tf:"group_id"` - TypeID int `json:"-" tf:"type_id"` - PoolID int `json:"pool,omitempty" tf:"pool_id"` - NetworkDomainID int `json:"-" tf:"domain_id"` - Type IDModel `json:"type,omitempty"` - //NetworkDomain *IDModel `json:"networkDomain,omitempty"` - //NetworkProxy *IDModel `json:"networkProxy,omitempty"` + ID int `json:"-" tf:"id,computed"` + Name string `json:"name" tf:"name"` + Description string `json:"description,omitempty" tf:"description"` + DisplayName string `json:"displayName,omitempty" tf:"display_name"` + CloudID int `json:"-" tf:"cloud_id"` + TypeID int `json:"-" tf:"type_id"` + PoolID int `json:"pool,omitempty" tf:"pool_id"` + NetworkDomainID int `json:"-" tf:"domain_id"` + Type IDModel `json:"type,omitempty"` + NetworkDomain *IDModel `json:"networkDomain,omitempty"` + NetworkProxy *IDModel `json:"networkProxy,omitempty"` NetworkServer IDModel `json:"networkServer,omitempty"` NetworkPool *PoolModel `json:"networkPool,omitempty"` NetworkProxyID int `json:"-" tf:"proxy_id"` @@ -94,31 +93,79 @@ type CreateNetwork struct { Gateway string `json:"gateway,omitempty" tf:"gateway"` DNSPrimary string `json:"dnsPrimary,omitempty" tf:"primary_dns"` DNSSecondary string `json:"dnsSecondary,omitempty" tf:"secondary_dns"` - Config *CreateNetworkConfig `json:"config,omitempty" tf:"config,sub"` Active bool `json:"active" tf:"active"` ScanNetwork bool `json:"scanNetwork" tf:"scan_network"` AllowStaticOverride bool `json:"allowStaticOverride" tf:"allow_static_override"` AppURLProxyBypass bool `json:"applianceUrlProxyBypass,omitempty" tf:"appliance_url_proxy_bypass"` NoProxy string `json:"noProxy,omitempty" tf:"no_proxy"` ScopeID string `json:"scopeId,omitempty" tf:"scode_id"` + ExternalID int `json:"externalId"` + InternalID int `json:"internalId"` + UniqueID int `json:"uniqueId"` + Status string `json:"status"` + Code string `json:"code"` + Group IDStringModel `json:"site" tf:"group"` + DhcpServer bool `json:"dhcpServer"` + TfDhcpNetwork *CreateDhcpNetwork `json:"-" tf:"dhcp_network,sub"` + TfStaticNetwork *CreateStaticNetwork `json:"-" tf:"static_network,sub"` + Config CreateNetworkConfig `json:"config"` ResourcePermissions NetworkResPermission `json:"-" tf:"resource_permissions,sub"` +} + +type CreateDhcpNetwork struct { + DhcpServer bool `json:"-" tf:"dhcp_enabled"` + Config *NetworkConfig `json:"-" tf:"config,sub"` +} +type CreateStaticNetwork struct { + ExternalID string `json:"-" tf:"external_id,computed"` + InternalID string `json:"-" tf:"internal_id,computed"` + UniqueID string `json:"-" tf:"unique_id,computed"` + Status string `json:"-" tf:"status,computed"` + Code string `json:"-" tf:"code,computed"` - //DhcpServer - Site IDStringModel `json:"site" tf:"group"` - DhcpServer bool `json:"dhcpServer" tf:"dhcp_enabled"` - NetworkDomain *IDModel `json:"networkDomain" tf:"domain"` - NetworkProxy *IDModel `json:"networkProxy" tf:"network_proxy"` + Config *NetworkConfig `json:"-" tf:"config,sub"` } type CreateNetworkConfig struct { - ConnectedGateway string `json:"connectedGateway,omitempty" tf:"connected_gateway"` - VlanIDs string `json:"vlanIDs,omitempty" tf:"vlan_ids"` + ConnectedGateway string `json:"connectedGateway,omitempty"` + VlanIDs string `json:"vlanIDs,omitempty"` + //DHCP Server + SubnetIPManagementType string `json:"subnetIpManagementType"` + SubnetIPServerID string `json:"subnetIpServerId"` + SubnetDhcpServerAddress string `json:"subnetDhcpServerAddress"` + DhcpRange string `json:"dhcpRange"` + SubnetDhcpLeaseTime string `json:"subnetDhcpLeaseTime"` +} + +type NetworkConfig struct { + ConnectedGateway string `json:"-" tf:"connected_gateway"` + VlanIDs string `json:"-" tf:"vlan_ids"` //DHCP Server - SubnetIPManagementType string `json:"subnetIpManagementType" tf:"dhcp_type"` - SubnetIPServerID string `json:"subnetIpServerId" tf:"dhcp_server"` - SubnetDhcpServerAddress string `json:"subnetDhcpServerAddress" tf:"dhcp_server_address"` - DhcpRange string `json:"dhcpRange" tf:"dhcp_range"` - SubnetDhcpLeaseTime string `json:"subnetDhcpLeaseTime" tf:"dhcp_lease_time"` + SubnetIPManagementType string `json:"-" tf:"dhcp_type"` + SubnetIPServerID string `json:"-" tf:"dhcp_server"` + SubnetDhcpServerAddress string `json:"-" tf:"dhcp_server_address"` + DhcpRange string `json:"-" tf:"dhcp_range"` + SubnetDhcpLeaseTime string `json:"-" tf:"dhcp_lease_time"` +} + +type TfDhcpNetworkConfig struct { + ConnectedGateway string `json:"-" tf:"connected_gateway"` + VlanIDs string `json:"-" tf:"vlan_id"` + SubnetIPManagementType string `json:"-" tf:"dhcp_type"` + SubnetIPServerID string `json:"-" tf:"dhcp_server"` + SubnetDhcpServerAddress string `json:"-" tf:"dhcp_server_address"` + DhcpRange string `json:"-" tf:"dhcp_range"` + SubnetDhcpLeaseTime string `json:"-" tf:"dhcp_lease_time"` +} + +type TfDhcpConfig struct { + ConnectedGateway string `json:"-" tf:"connected_gateway"` + VlanIDs string `json:"-" tf:"vlan"` + SubnetIPManagementType string `json:"-" tf:"dhcp_type"` + SubnetIPServerID string `json:"-" tf:"dhcp_server"` + SubnetDhcpServerAddress string `json:"-" tf:"dhcp_server_address"` + DhcpRange string `json:"-" tf:"dhcp_range"` + SubnetDhcpLeaseTime string `json:"-" tf:"dhcp_lease_time"` } type GetNetworkTypesResponse struct { From 7bf36d39cf812a0e6b3ee05d3d77a59e4eeaf6d6 Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Sat, 15 Oct 2022 14:16:01 +0530 Subject: [PATCH 19/26] updated --- pkg/models/networks.go | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/pkg/models/networks.go b/pkg/models/networks.go index ec17b38..8e900ca 100644 --- a/pkg/models/networks.go +++ b/pkg/models/networks.go @@ -117,19 +117,17 @@ type CreateDhcpNetwork struct { Config *NetworkConfig `json:"-" tf:"config,sub"` } type CreateStaticNetwork struct { - ExternalID string `json:"-" tf:"external_id,computed"` - InternalID string `json:"-" tf:"internal_id,computed"` - UniqueID string `json:"-" tf:"unique_id,computed"` - Status string `json:"-" tf:"status,computed"` - Code string `json:"-" tf:"code,computed"` - - Config *NetworkConfig `json:"-" tf:"config,sub"` + ExternalID string `json:"-" tf:"external_id,computed"` + InternalID string `json:"-" tf:"internal_id,computed"` + UniqueID string `json:"-" tf:"unique_id,computed"` + Status string `json:"-" tf:"status,computed"` + Code string `json:"-" tf:"code,computed"` + Config *NetworkConfig `json:"-" tf:"config,sub"` } type CreateNetworkConfig struct { - ConnectedGateway string `json:"connectedGateway,omitempty"` - VlanIDs string `json:"vlanIDs,omitempty"` - //DHCP Server + ConnectedGateway string `json:"connectedGateway,omitempty"` + VlanIDs string `json:"vlanIDs,omitempty"` SubnetIPManagementType string `json:"subnetIpManagementType"` SubnetIPServerID string `json:"subnetIpServerId"` SubnetDhcpServerAddress string `json:"subnetDhcpServerAddress"` @@ -138,9 +136,8 @@ type CreateNetworkConfig struct { } type NetworkConfig struct { - ConnectedGateway string `json:"-" tf:"connected_gateway"` - VlanIDs string `json:"-" tf:"vlan_ids"` - //DHCP Server + ConnectedGateway string `json:"-" tf:"connected_gateway"` + VlanIDs string `json:"-" tf:"vlan_ids"` SubnetIPManagementType string `json:"-" tf:"dhcp_type"` SubnetIPServerID string `json:"-" tf:"dhcp_server"` SubnetDhcpServerAddress string `json:"-" tf:"dhcp_server_address"` From 56cc40461d938d7bb2663ce07c1c49ca2ac6a9d0 Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Sat, 15 Oct 2022 14:40:09 +0530 Subject: [PATCH 20/26] update --- pkg/models/networks.go | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/pkg/models/networks.go b/pkg/models/networks.go index 8e900ca..3e1de06 100644 --- a/pkg/models/networks.go +++ b/pkg/models/networks.go @@ -145,26 +145,6 @@ type NetworkConfig struct { SubnetDhcpLeaseTime string `json:"-" tf:"dhcp_lease_time"` } -type TfDhcpNetworkConfig struct { - ConnectedGateway string `json:"-" tf:"connected_gateway"` - VlanIDs string `json:"-" tf:"vlan_id"` - SubnetIPManagementType string `json:"-" tf:"dhcp_type"` - SubnetIPServerID string `json:"-" tf:"dhcp_server"` - SubnetDhcpServerAddress string `json:"-" tf:"dhcp_server_address"` - DhcpRange string `json:"-" tf:"dhcp_range"` - SubnetDhcpLeaseTime string `json:"-" tf:"dhcp_lease_time"` -} - -type TfDhcpConfig struct { - ConnectedGateway string `json:"-" tf:"connected_gateway"` - VlanIDs string `json:"-" tf:"vlan"` - SubnetIPManagementType string `json:"-" tf:"dhcp_type"` - SubnetIPServerID string `json:"-" tf:"dhcp_server"` - SubnetDhcpServerAddress string `json:"-" tf:"dhcp_server_address"` - DhcpRange string `json:"-" tf:"dhcp_range"` - SubnetDhcpLeaseTime string `json:"-" tf:"dhcp_lease_time"` -} - type GetNetworkTypesResponse struct { NetworkTypes []GetSpecificNetworkType `json:"networkTypes"` } From b807b5dcafcf891a1e7a9c92182e1481de0aeb0b Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Sat, 15 Oct 2022 20:35:41 +0530 Subject: [PATCH 21/26] checking --- pkg/models/dhcp_server.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/models/dhcp_server.go b/pkg/models/dhcp_server.go index 976b3f8..9f2f0b3 100644 --- a/pkg/models/dhcp_server.go +++ b/pkg/models/dhcp_server.go @@ -28,13 +28,13 @@ type CreateNetworkDhcpServerResp struct { } type GetNetworkDhcpServers struct { - GetNetworkDhcpServerResp []GetNetworkDhcpServerResp `json:"networkDhcpServers"` + GetNetworkDhcpServerRes []GetNetworkDhcpServerResp `json:"networkDhcpServers"` } type GetNetworkDhcpServerResp struct { ID int `json:"id" tf:"id,computed"` DateCreated time.Time `json:"dateCreated"` - ProviderID string `json:"providerId"` + ProviderID string `json:"providerId" tf:"provider_id,computed"` LastUpdated time.Time `json:"lastUpdated"` LeaseTime int `json:"leaseTime"` Name string `json:"name"` @@ -62,7 +62,7 @@ type GetSpecificNetworkDhcpServer struct { type GetSpecificNetworkDhcpServerResp struct { ID int `json:"id" tf:"id,computed"` DateCreated time.Time `json:"dateCreated"` - ProviderID string `json:"providerId"` + ProviderID string `json:"providerId" tf:"provider_id,computed"` LastUpdated time.Time `json:"lastUpdated"` LeaseTime int `json:"leaseTime"` Name string `json:"name"` From 1653290289feef93faf000fb493a04aa863866ea Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Sat, 15 Oct 2022 21:09:48 +0530 Subject: [PATCH 22/26] checking --- pkg/models/networks.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/models/networks.go b/pkg/models/networks.go index 3e1de06..e796621 100644 --- a/pkg/models/networks.go +++ b/pkg/models/networks.go @@ -116,6 +116,7 @@ type CreateDhcpNetwork struct { DhcpServer bool `json:"-" tf:"dhcp_enabled"` Config *NetworkConfig `json:"-" tf:"config,sub"` } + type CreateStaticNetwork struct { ExternalID string `json:"-" tf:"external_id,computed"` InternalID string `json:"-" tf:"internal_id,computed"` From a2caaff04e1f95271c1f36111307b4395768872a Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Sun, 16 Oct 2022 11:04:21 +0530 Subject: [PATCH 23/26] updated --- pkg/models/dhcp_server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/models/dhcp_server.go b/pkg/models/dhcp_server.go index 9f2f0b3..8709737 100644 --- a/pkg/models/dhcp_server.go +++ b/pkg/models/dhcp_server.go @@ -28,7 +28,7 @@ type CreateNetworkDhcpServerResp struct { } type GetNetworkDhcpServers struct { - GetNetworkDhcpServerRes []GetNetworkDhcpServerResp `json:"networkDhcpServers"` + GetNetworkDhcpServerResp []GetNetworkDhcpServerResp `json:"networkDhcpServers"` } type GetNetworkDhcpServerResp struct { From d2b9909c8d9c4755e2035788196fa99169eb9ad0 Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Mon, 17 Oct 2022 11:04:27 +0530 Subject: [PATCH 24/26] addressing the changes --- pkg/models/networks.go | 100 ++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 51 deletions(-) diff --git a/pkg/models/networks.go b/pkg/models/networks.go index e796621..6d6745e 100644 --- a/pkg/models/networks.go +++ b/pkg/models/networks.go @@ -73,57 +73,65 @@ type PoolModel struct { } type CreateNetwork struct { - ID int `json:"-" tf:"id,computed"` - Name string `json:"name" tf:"name"` - Description string `json:"description,omitempty" tf:"description"` - DisplayName string `json:"displayName,omitempty" tf:"display_name"` - CloudID int `json:"-" tf:"cloud_id"` - TypeID int `json:"-" tf:"type_id"` - PoolID int `json:"pool,omitempty" tf:"pool_id"` - NetworkDomainID int `json:"-" tf:"domain_id"` - Type IDModel `json:"type,omitempty"` - NetworkDomain *IDModel `json:"networkDomain,omitempty"` - NetworkProxy *IDModel `json:"networkProxy,omitempty"` - NetworkServer IDModel `json:"networkServer,omitempty"` - NetworkPool *PoolModel `json:"networkPool,omitempty"` - NetworkProxyID int `json:"-" tf:"proxy_id"` - ProxyID int `json:"-" tf:"proxy_id"` - SearchDomains string `json:"searchDomains,omitempty" tf:"search_domains"` - Cidr string `json:"cidr,omitempty" tf:"cidr"` - Gateway string `json:"gateway,omitempty" tf:"gateway"` - DNSPrimary string `json:"dnsPrimary,omitempty" tf:"primary_dns"` - DNSSecondary string `json:"dnsSecondary,omitempty" tf:"secondary_dns"` - Active bool `json:"active" tf:"active"` - ScanNetwork bool `json:"scanNetwork" tf:"scan_network"` - AllowStaticOverride bool `json:"allowStaticOverride" tf:"allow_static_override"` - AppURLProxyBypass bool `json:"applianceUrlProxyBypass,omitempty" tf:"appliance_url_proxy_bypass"` - NoProxy string `json:"noProxy,omitempty" tf:"no_proxy"` - ScopeID string `json:"scopeId,omitempty" tf:"scode_id"` - ExternalID int `json:"externalId"` - InternalID int `json:"internalId"` - UniqueID int `json:"uniqueId"` - Status string `json:"status"` - Code string `json:"code"` - Group IDStringModel `json:"site" tf:"group"` - DhcpServer bool `json:"dhcpServer"` + ID int `json:"-" tf:"id,computed"` + Name string `json:"name" tf:"name"` + Description string `json:"description,omitempty" tf:"description"` + DisplayName string `json:"displayName,omitempty" tf:"display_name"` + CloudID int `json:"-" tf:"cloud_id"` + TypeID int `json:"-" tf:"type_id"` + PoolID int `json:"pool,omitempty"` + NetworkDomainID int `json:"-" tf:"domain_id"` + Type IDModel `json:"type,omitempty"` + NetworkDomain *IDModel `json:"networkDomain,omitempty"` + NetworkProxy *IDModel `json:"networkProxy,omitempty"` + NetworkServer IDModel `json:"networkServer,omitempty"` + NetworkPool *PoolModel `json:"networkPool,omitempty"` + NetworkProxyID int `json:"-" tf:"proxy_id"` + ProxyID int `json:"-" tf:"proxy_id"` + SearchDomains string `json:"searchDomains,omitempty" tf:"search_domains"` + Cidr string `json:"cidr,omitempty" tf:"cidr"` + Gateway string `json:"gateway,omitempty" tf:"gateway"` + DNSPrimary string `json:"dnsPrimary,omitempty" tf:"primary_dns"` + DNSSecondary string `json:"dnsSecondary,omitempty" tf:"secondary_dns"` + Active bool `json:"active" tf:"active"` + ScanNetwork bool `json:"scanNetwork" tf:"scan_network"` + AllowStaticOverride bool `json:"allowStaticOverride" tf:"allow_static_override"` + AppURLProxyBypass bool `json:"applianceUrlProxyBypass,omitempty" tf:"appliance_url_proxy_bypass"` + NoProxy string `json:"noProxy,omitempty" tf:"no_proxy"` + ScopeID string `json:"scopeId,omitempty" tf:"scode_id"` + // ExternalID int `json:"externalId"` + // InternalID int `json:"internalId"` + // UniqueID int `json:"uniqueId"` + //Status string `json:"status"` + //Code string `json:"code"` + //Group IDStringModel `json:"site" tf:"group"` + GroupID string `json:"-" tf:"group_id"` + + DhcpServer bool `json:"dhcpServer" tf:"dhcp_enabled"` TfDhcpNetwork *CreateDhcpNetwork `json:"-" tf:"dhcp_network,sub"` TfStaticNetwork *CreateStaticNetwork `json:"-" tf:"static_network,sub"` Config CreateNetworkConfig `json:"config"` ResourcePermissions NetworkResPermission `json:"-" tf:"resource_permissions,sub"` } +// type NetworkConfig struct { +// } type CreateDhcpNetwork struct { - DhcpServer bool `json:"-" tf:"dhcp_enabled"` - Config *NetworkConfig `json:"-" tf:"config,sub"` + //Config *NetworkConfig `json:"-" tf:"config,sub"` + ConnectedGateway string `json:"-" tf:"connected_gateway"` + VlanIDs string `json:"-" tf:"vlan_ids"` + SubnetIPManagementType string `json:"-" tf:"dhcp_type"` + SubnetIPServerID string `json:"-" tf:"dhcp_server"` + SubnetDhcpServerAddress string `json:"-" tf:"dhcp_server_address"` + DhcpRange string `json:"-" tf:"dhcp_range"` + SubnetDhcpLeaseTime string `json:"-" tf:"dhcp_lease_time"` } type CreateStaticNetwork struct { - ExternalID string `json:"-" tf:"external_id,computed"` - InternalID string `json:"-" tf:"internal_id,computed"` - UniqueID string `json:"-" tf:"unique_id,computed"` - Status string `json:"-" tf:"status,computed"` - Code string `json:"-" tf:"code,computed"` - Config *NetworkConfig `json:"-" tf:"config,sub"` + PoolID int `json:"-" tf:"pool_id"` + //Config *NetworkConfig `json:"-" tf:"config,sub"` + ConnectedGateway string `json:"-" tf:"connected_gateway"` + VlanIDs string `json:"-" tf:"vlan_ids"` } type CreateNetworkConfig struct { @@ -136,16 +144,6 @@ type CreateNetworkConfig struct { SubnetDhcpLeaseTime string `json:"subnetDhcpLeaseTime"` } -type NetworkConfig struct { - ConnectedGateway string `json:"-" tf:"connected_gateway"` - VlanIDs string `json:"-" tf:"vlan_ids"` - SubnetIPManagementType string `json:"-" tf:"dhcp_type"` - SubnetIPServerID string `json:"-" tf:"dhcp_server"` - SubnetDhcpServerAddress string `json:"-" tf:"dhcp_server_address"` - DhcpRange string `json:"-" tf:"dhcp_range"` - SubnetDhcpLeaseTime string `json:"-" tf:"dhcp_lease_time"` -} - type GetNetworkTypesResponse struct { NetworkTypes []GetSpecificNetworkType `json:"networkTypes"` } From da6c30235fba34b248ecb9677418e03ebbc41b11 Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Mon, 17 Oct 2022 11:19:40 +0530 Subject: [PATCH 25/26] updating --- pkg/models/networks.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/models/networks.go b/pkg/models/networks.go index 6d6745e..93b0c99 100644 --- a/pkg/models/networks.go +++ b/pkg/models/networks.go @@ -105,8 +105,9 @@ type CreateNetwork struct { //Status string `json:"status"` //Code string `json:"code"` //Group IDStringModel `json:"site" tf:"group"` - GroupID string `json:"-" tf:"group_id"` - + GroupID string `json:"-" tf:"group_id"` + ConnectedGateway string `json:"connectedGateway,omitempty" tf:"connected_gateway"` + VlanIDs string `json:"vlanIDs,omitempty" tf:"vlan_ids"` DhcpServer bool `json:"dhcpServer" tf:"dhcp_enabled"` TfDhcpNetwork *CreateDhcpNetwork `json:"-" tf:"dhcp_network,sub"` TfStaticNetwork *CreateStaticNetwork `json:"-" tf:"static_network,sub"` @@ -118,8 +119,8 @@ type CreateNetwork struct { // } type CreateDhcpNetwork struct { //Config *NetworkConfig `json:"-" tf:"config,sub"` - ConnectedGateway string `json:"-" tf:"connected_gateway"` - VlanIDs string `json:"-" tf:"vlan_ids"` + //ConnectedGateway string `json:"-" tf:"connected_gateway"` + //VlanIDs string `json:"-" tf:"vlan_ids"` SubnetIPManagementType string `json:"-" tf:"dhcp_type"` SubnetIPServerID string `json:"-" tf:"dhcp_server"` SubnetDhcpServerAddress string `json:"-" tf:"dhcp_server_address"` @@ -130,8 +131,8 @@ type CreateDhcpNetwork struct { type CreateStaticNetwork struct { PoolID int `json:"-" tf:"pool_id"` //Config *NetworkConfig `json:"-" tf:"config,sub"` - ConnectedGateway string `json:"-" tf:"connected_gateway"` - VlanIDs string `json:"-" tf:"vlan_ids"` + //ConnectedGateway string `json:"-" tf:"connected_gateway"` + //VlanIDs string `json:"-" tf:"vlan_ids"` } type CreateNetworkConfig struct { From 27aa7ea3128532c442854b3b57d183d2b70e3f94 Mon Sep 17 00:00:00 2001 From: Pushpalatha555 Date: Mon, 17 Oct 2022 11:40:30 +0530 Subject: [PATCH 26/26] updated --- pkg/models/networks.go | 67 +++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 40 deletions(-) diff --git a/pkg/models/networks.go b/pkg/models/networks.go index 93b0c99..fbb0624 100644 --- a/pkg/models/networks.go +++ b/pkg/models/networks.go @@ -73,38 +73,33 @@ type PoolModel struct { } type CreateNetwork struct { - ID int `json:"-" tf:"id,computed"` - Name string `json:"name" tf:"name"` - Description string `json:"description,omitempty" tf:"description"` - DisplayName string `json:"displayName,omitempty" tf:"display_name"` - CloudID int `json:"-" tf:"cloud_id"` - TypeID int `json:"-" tf:"type_id"` - PoolID int `json:"pool,omitempty"` - NetworkDomainID int `json:"-" tf:"domain_id"` - Type IDModel `json:"type,omitempty"` - NetworkDomain *IDModel `json:"networkDomain,omitempty"` - NetworkProxy *IDModel `json:"networkProxy,omitempty"` - NetworkServer IDModel `json:"networkServer,omitempty"` - NetworkPool *PoolModel `json:"networkPool,omitempty"` - NetworkProxyID int `json:"-" tf:"proxy_id"` - ProxyID int `json:"-" tf:"proxy_id"` - SearchDomains string `json:"searchDomains,omitempty" tf:"search_domains"` - Cidr string `json:"cidr,omitempty" tf:"cidr"` - Gateway string `json:"gateway,omitempty" tf:"gateway"` - DNSPrimary string `json:"dnsPrimary,omitempty" tf:"primary_dns"` - DNSSecondary string `json:"dnsSecondary,omitempty" tf:"secondary_dns"` - Active bool `json:"active" tf:"active"` - ScanNetwork bool `json:"scanNetwork" tf:"scan_network"` - AllowStaticOverride bool `json:"allowStaticOverride" tf:"allow_static_override"` - AppURLProxyBypass bool `json:"applianceUrlProxyBypass,omitempty" tf:"appliance_url_proxy_bypass"` - NoProxy string `json:"noProxy,omitempty" tf:"no_proxy"` - ScopeID string `json:"scopeId,omitempty" tf:"scode_id"` - // ExternalID int `json:"externalId"` - // InternalID int `json:"internalId"` - // UniqueID int `json:"uniqueId"` - //Status string `json:"status"` - //Code string `json:"code"` - //Group IDStringModel `json:"site" tf:"group"` + ID int `json:"-" tf:"id,computed"` + Name string `json:"name" tf:"name"` + Description string `json:"description,omitempty" tf:"description"` + DisplayName string `json:"displayName,omitempty" tf:"display_name"` + CloudID int `json:"-" tf:"cloud_id"` + TypeID int `json:"-" tf:"type_id"` + PoolID int `json:"pool,omitempty"` + NetworkDomainID int `json:"-" tf:"domain_id"` + Site IDStringModel `json:"site,omitempty"` + Type IDModel `json:"type,omitempty"` + NetworkDomain *IDModel `json:"networkDomain,omitempty"` + NetworkProxy *IDModel `json:"networkProxy,omitempty"` + NetworkServer IDModel `json:"networkServer,omitempty"` + NetworkPool *PoolModel `json:"networkPool,omitempty"` + NetworkProxyID int `json:"-" tf:"proxy_id"` + ProxyID int `json:"-" tf:"proxy_id"` + SearchDomains string `json:"searchDomains,omitempty" tf:"search_domains"` + Cidr string `json:"cidr,omitempty" tf:"cidr"` + Gateway string `json:"gateway,omitempty" tf:"gateway"` + DNSPrimary string `json:"dnsPrimary,omitempty" tf:"primary_dns"` + DNSSecondary string `json:"dnsSecondary,omitempty" tf:"secondary_dns"` + Active bool `json:"active" tf:"active"` + ScanNetwork bool `json:"scanNetwork" tf:"scan_network"` + AllowStaticOverride bool `json:"allowStaticOverride" tf:"allow_static_override"` + AppURLProxyBypass bool `json:"applianceUrlProxyBypass,omitempty" tf:"appliance_url_proxy_bypass"` + NoProxy string `json:"noProxy,omitempty" tf:"no_proxy"` + ScopeID string `json:"scopeId,omitempty" tf:"scode_id"` GroupID string `json:"-" tf:"group_id"` ConnectedGateway string `json:"connectedGateway,omitempty" tf:"connected_gateway"` VlanIDs string `json:"vlanIDs,omitempty" tf:"vlan_ids"` @@ -115,12 +110,7 @@ type CreateNetwork struct { ResourcePermissions NetworkResPermission `json:"-" tf:"resource_permissions,sub"` } -// type NetworkConfig struct { -// } type CreateDhcpNetwork struct { - //Config *NetworkConfig `json:"-" tf:"config,sub"` - //ConnectedGateway string `json:"-" tf:"connected_gateway"` - //VlanIDs string `json:"-" tf:"vlan_ids"` SubnetIPManagementType string `json:"-" tf:"dhcp_type"` SubnetIPServerID string `json:"-" tf:"dhcp_server"` SubnetDhcpServerAddress string `json:"-" tf:"dhcp_server_address"` @@ -130,9 +120,6 @@ type CreateDhcpNetwork struct { type CreateStaticNetwork struct { PoolID int `json:"-" tf:"pool_id"` - //Config *NetworkConfig `json:"-" tf:"config,sub"` - //ConnectedGateway string `json:"-" tf:"connected_gateway"` - //VlanIDs string `json:"-" tf:"vlan_ids"` } type CreateNetworkConfig struct {