Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Network API Changes for 5.4.4 #47

Merged
merged 1 commit into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/antihax/optional v1.0.0
github.com/golang/mock v1.6.0
golang.org/x/mod v0.4.2 // indirect
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect
golang.org/x/tools v0.1.4 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down
4 changes: 4 additions & 0 deletions pkg/client/networks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.NetworkPool.Pool = networkReq.Network.PoolID
networkReq.Network.PoolID = 0
}
networkAPI := &api{
compatibleVersion: "5.2.13",
method: "POST",
Expand Down
4 changes: 4 additions & 0 deletions pkg/models/networks.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ type CreateNetworkRequest struct {
ResourcePermissions NetworkResPermission `json:"resourcePermissions,omitempty"`
}

type PoolModel struct {
Pool int `json:"pool,omitempty"`
}
type CreateNetwork struct {
ID int `json:"-" tf:"id,computed"`
Name string `json:"name" tf:"name"`
Expand All @@ -83,6 +86,7 @@ type CreateNetwork struct {
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"`
Expand Down