Update photon controller go SDK in vendor code.
This commit is contained in:
53
vendor/github.com/vmware/photon-controller-go-sdk/photon/projects.go
generated
vendored
53
vendor/github.com/vmware/photon-controller-go-sdk/photon/projects.go
generated
vendored
@@ -29,11 +29,11 @@ type VmGetOptions struct {
|
||||
Name string `urlParam:"name"`
|
||||
}
|
||||
|
||||
var projectUrl string = "/projects/"
|
||||
var projectUrl string = rootUrl + "/projects/"
|
||||
|
||||
// Deletes the project with specified ID. Any VMs, disks, etc., owned by the project must be deleted first.
|
||||
func (api *ProjectsAPI) Delete(projectID string) (task *Task, err error) {
|
||||
res, err := api.client.restClient.Delete(api.client.Endpoint+projectUrl+projectID, api.client.options.TokenOptions.AccessToken)
|
||||
res, err := api.client.restClient.Delete(api.client.Endpoint+projectUrl+projectID, api.client.options.TokenOptions)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -52,7 +52,7 @@ func (api *ProjectsAPI) CreateDisk(projectID string, spec *DiskCreateSpec) (task
|
||||
api.client.Endpoint+projectUrl+projectID+"/disks",
|
||||
"application/json",
|
||||
bytes.NewReader(body),
|
||||
api.client.options.TokenOptions.AccessToken)
|
||||
api.client.options.TokenOptions)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -68,7 +68,7 @@ func (api *ProjectsAPI) GetDisks(projectID string, options *DiskGetOptions) (res
|
||||
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)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -88,7 +88,7 @@ func (api *ProjectsAPI) CreateVM(projectID string, spec *VmCreateSpec) (task *Ta
|
||||
api.client.Endpoint+projectUrl+projectID+"/vms",
|
||||
"application/json",
|
||||
bytes.NewReader(body),
|
||||
api.client.options.TokenOptions.AccessToken)
|
||||
api.client.options.TokenOptions)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -104,7 +104,7 @@ func (api *ProjectsAPI) GetTasks(id string, options *TaskGetOptions) (result *Ta
|
||||
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)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -121,7 +121,7 @@ func (api *ProjectsAPI) GetVMs(projectID string, options *VmGetOptions) (result
|
||||
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)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -131,17 +131,17 @@ func (api *ProjectsAPI) GetVMs(projectID string, options *VmGetOptions) (result
|
||||
return
|
||||
}
|
||||
|
||||
// Creates a cluster on the specified project.
|
||||
func (api *ProjectsAPI) CreateCluster(projectID string, spec *ClusterCreateSpec) (task *Task, err error) {
|
||||
// Creates a service on the specified project.
|
||||
func (api *ProjectsAPI) CreateService(projectID string, spec *ServiceCreateSpec) (task *Task, err error) {
|
||||
body, err := json.Marshal(spec)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res, err := api.client.restClient.Post(
|
||||
api.client.Endpoint+projectUrl+projectID+"/clusters",
|
||||
api.client.Endpoint+projectUrl+projectID+"/services",
|
||||
"application/json",
|
||||
bytes.NewReader(body),
|
||||
api.client.options.TokenOptions.AccessToken)
|
||||
api.client.options.TokenOptions)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -150,22 +150,22 @@ func (api *ProjectsAPI) CreateCluster(projectID string, spec *ClusterCreateSpec)
|
||||
return
|
||||
}
|
||||
|
||||
// Gets clusters for project with the specified ID
|
||||
func (api *ProjectsAPI) GetClusters(projectID string) (result *Clusters, err error) {
|
||||
uri := api.client.Endpoint + projectUrl + projectID + "/clusters"
|
||||
res, err := api.client.restClient.GetList(api.client.Endpoint, uri, api.client.options.TokenOptions.AccessToken)
|
||||
// Gets services for project with the specified ID
|
||||
func (api *ProjectsAPI) GetServices(projectID string) (result *Services, err error) {
|
||||
uri := api.client.Endpoint + projectUrl + projectID + "/services"
|
||||
res, err := api.client.restClient.GetList(api.client.Endpoint, uri, api.client.options.TokenOptions)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
result = &Clusters{}
|
||||
result = &Services{}
|
||||
err = json.Unmarshal(res, result)
|
||||
return
|
||||
}
|
||||
|
||||
// Gets the project with a specified ID.
|
||||
func (api *ProjectsAPI) Get(id string) (project *ProjectCompact, err error) {
|
||||
res, err := api.client.restClient.Get(api.getEntityUrl(id), api.client.options.TokenOptions.AccessToken)
|
||||
res, err := api.client.restClient.Get(api.getEntityUrl(id), api.client.options.TokenOptions)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -187,3 +187,22 @@ func (api *ProjectsAPI) SetSecurityGroups(projectID string, securityGroups *Secu
|
||||
func (api *ProjectsAPI) getEntityUrl(id string) string {
|
||||
return api.client.Endpoint + projectUrl + id
|
||||
}
|
||||
|
||||
// Creates a router on the specified project.
|
||||
func (api *ProjectsAPI) CreateRouter(projectID string, spec *RouterCreateSpec) (task *Task, err error) {
|
||||
body, err := json.Marshal(spec)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res, err := api.client.restClient.Post(
|
||||
api.client.Endpoint+projectUrl+projectID+"/routers",
|
||||
"application/json",
|
||||
bytes.NewReader(body),
|
||||
api.client.options.TokenOptions)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer res.Body.Close()
|
||||
task, err = getTask(getError(res))
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user