-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'update_router_sdk' of https://github.com/HewlettPackard…
…/hpegl-vmaas-cmp-go-sdk into update_router_sdk
- Loading branch information
Showing
8 changed files
with
367 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// (C) Copyright 2021 Hewlett Packard Enterprise Development LP | ||
|
||
package client | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"fmt" | ||
|
||
consts "github.com/HewlettPackard/hpegl-vmaas-cmp-go-sdk/pkg/common" | ||
"github.com/HewlettPackard/hpegl-vmaas-cmp-go-sdk/pkg/models" | ||
) | ||
|
||
type DomainAPIService struct { | ||
Client APIClientHandler | ||
Cfg Configuration | ||
} | ||
|
||
func (d *DomainAPIService) GetAllDomains( | ||
ctx context.Context, | ||
param map[string]string, | ||
) (models.GetAllDomains, error) { | ||
var domainResp models.GetAllDomains | ||
networkAPI := &api{ | ||
method: "GET", | ||
path: fmt.Sprintf("%s/%s/%s/%s", | ||
d.Cfg.Host, consts.VmaasCmpAPIBasePath, consts.NetworksPath, consts.DomainPath), | ||
client: d.Client, | ||
|
||
jsonParser: func(body []byte) error { | ||
return json.Unmarshal(body, &domainResp) | ||
}, | ||
} | ||
err := networkAPI.do(ctx, nil, param) | ||
|
||
return domainResp, err | ||
} | ||
|
||
func (d *DomainAPIService) GetSpecificDomain( | ||
ctx context.Context, | ||
domainID int, | ||
) (models.GetSpecificDomain, error) { | ||
var domainResp models.GetSpecificDomain | ||
networkAPI := &api{ | ||
method: "GET", | ||
path: fmt.Sprintf("%s/%s/%s/%s/%d", | ||
d.Cfg.Host, consts.VmaasCmpAPIBasePath, consts.NetworksPath, consts.DomainPath, domainID), | ||
client: d.Client, | ||
|
||
jsonParser: func(body []byte) error { | ||
return json.Unmarshal(body, &domainResp) | ||
}, | ||
} | ||
err := networkAPI.do(ctx, nil, nil) | ||
|
||
return domainResp, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// (C) Copyright 2021 Hewlett Packard Enterprise Development LP | ||
|
||
package models | ||
|
||
type GetAllDomains struct { | ||
NetworkDomains []GetDomain `json:"networkDomains"` | ||
|
||
NetworkDomainCount int `json:"networkDomainCount"` | ||
Meta Meta `json:"meta"` | ||
AccountID int `json:"accountId"` | ||
} | ||
|
||
type GetDomain struct { | ||
ID int `json:"id" tf:"id,computed"` | ||
Name string `json:"name" tf:"name"` | ||
Active bool `json:"active" tf:"active,computed"` | ||
Visibility string `json:"visibility"` | ||
DomainController bool `json:"domainController"` | ||
PublicZone bool `json:"publicZone"` | ||
} | ||
|
||
type GetSpecificDomain struct { | ||
NetworkDomain GetDomain `json:"networkDomain"` | ||
SuccessOrErrorMessage | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// (C) Copyright 2021 Hewlett Packard Enterprise Development LP | ||
|
||
package models | ||
|
||
type GetAllNetworkProxies struct { | ||
GetNetworkProxies []GetNetworkProxy `json:"networkProxies"` | ||
NetworkProxyCount int `json:"networkProxyCount"` | ||
Meta Meta `json:"meta"` | ||
} | ||
|
||
type GetNetworkProxy struct { | ||
ID int `json:"id" tf:"id,computed"` | ||
Name string `json:"name" tf:"name"` | ||
ProxyHost string `json:"proxyHost"` | ||
ProxyPort int `json:"proxyPort"` | ||
Visibility string `json:"visibility"` | ||
Account IDModel `json:"account"` | ||
Owner IDModel `json:"owner"` | ||
} |
Oops, something went wrong.