Update photon controller go SDK in vendor code.
This commit is contained in:
40
vendor/github.com/vmware/photon-controller-go-sdk/photon/networks.go
generated
vendored
40
vendor/github.com/vmware/photon-controller-go-sdk/photon/networks.go
generated
vendored
@@ -15,28 +15,28 @@ import (
|
||||
)
|
||||
|
||||
// Contains functionality for networks API.
|
||||
type SubnetsAPI struct {
|
||||
type NetworksAPI struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// Options used for GetAll API
|
||||
type SubnetGetOptions struct {
|
||||
type NetworkGetOptions struct {
|
||||
Name string `urlParam:"name"`
|
||||
}
|
||||
|
||||
var subnetUrl string = "/subnets"
|
||||
var networkUrl string = rootUrl + "/subnets"
|
||||
|
||||
// Creates a network.
|
||||
func (api *SubnetsAPI) Create(networkSpec *SubnetCreateSpec) (task *Task, err error) {
|
||||
func (api *NetworksAPI) Create(networkSpec *NetworkCreateSpec) (task *Task, err error) {
|
||||
body, err := json.Marshal(networkSpec)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res, err := api.client.restClient.Post(
|
||||
api.client.Endpoint+subnetUrl,
|
||||
api.client.Endpoint+networkUrl,
|
||||
"application/json",
|
||||
bytes.NewBuffer(body),
|
||||
api.client.options.TokenOptions.AccessToken)
|
||||
bytes.NewReader(body),
|
||||
api.client.options.TokenOptions)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -46,8 +46,8 @@ func (api *SubnetsAPI) Create(networkSpec *SubnetCreateSpec) (task *Task, err er
|
||||
}
|
||||
|
||||
// Deletes a network with specified ID.
|
||||
func (api *SubnetsAPI) Delete(id string) (task *Task, err error) {
|
||||
res, err := api.client.restClient.Delete(api.client.Endpoint+subnetUrl+"/"+id, api.client.options.TokenOptions.AccessToken)
|
||||
func (api *NetworksAPI) Delete(id string) (task *Task, err error) {
|
||||
res, err := api.client.restClient.Delete(api.client.Endpoint+networkUrl+"/"+id, api.client.options.TokenOptions)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -57,8 +57,8 @@ func (api *SubnetsAPI) Delete(id string) (task *Task, err error) {
|
||||
}
|
||||
|
||||
// Gets a network with the specified ID.
|
||||
func (api *SubnetsAPI) Get(id string) (network *Subnet, err error) {
|
||||
res, err := api.client.restClient.Get(api.client.Endpoint+subnetUrl+"/"+id, api.client.options.TokenOptions.AccessToken)
|
||||
func (api *NetworksAPI) Get(id string) (network *Network, err error) {
|
||||
res, err := api.client.restClient.Get(api.client.Endpoint+networkUrl+"/"+id, api.client.options.TokenOptions)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -67,31 +67,31 @@ func (api *SubnetsAPI) Get(id string) (network *Subnet, err error) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var result Subnet
|
||||
var result Network
|
||||
err = json.NewDecoder(res.Body).Decode(&result)
|
||||
return &result, nil
|
||||
}
|
||||
|
||||
// Returns all networks
|
||||
func (api *SubnetsAPI) GetAll(options *SubnetGetOptions) (result *Subnets, err error) {
|
||||
uri := api.client.Endpoint + subnetUrl
|
||||
func (api *NetworksAPI) GetAll(options *NetworkGetOptions) (result *Networks, err error) {
|
||||
uri := api.client.Endpoint + networkUrl
|
||||
if options != nil {
|
||||
uri += getQueryString(options)
|
||||
}
|
||||
res, err := api.client.restClient.GetList(api.client.Endpoint, uri, api.client.options.TokenOptions.AccessToken)
|
||||
res, err := api.client.restClient.GetList(api.client.Endpoint, uri, api.client.options.TokenOptions)
|
||||
|
||||
result = &Subnets{}
|
||||
result = &Networks{}
|
||||
err = json.Unmarshal(res, result)
|
||||
return
|
||||
}
|
||||
|
||||
// Sets default network.
|
||||
func (api *SubnetsAPI) SetDefault(id string) (task *Task, err error) {
|
||||
func (api *NetworksAPI) SetDefault(id string) (task *Task, err error) {
|
||||
res, err := api.client.restClient.Post(
|
||||
api.client.Endpoint+subnetUrl+"/"+id+"/set_default",
|
||||
api.client.Endpoint+networkUrl+"/"+id+"/set_default",
|
||||
"application/json",
|
||||
bytes.NewBuffer([]byte("")),
|
||||
api.client.options.TokenOptions.AccessToken)
|
||||
bytes.NewReader([]byte("")),
|
||||
api.client.options.TokenOptions)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user