func (api *VmAPI) GetMKSTicket(id string) (task *Task, err error) { res, err := rest.Get(api.client.httpClient, api.client.Endpoint+vmUrl+id+"/mks_ticket", api.client.options.TokenOptions.AccessToken) if err != nil { return } defer res.Body.Close() task, err = getTask(getError(res)) return }
// Gets a task by ID. func (api *TasksAPI) Get(id string) (task *Task, err error) { res, err := rest.Get(api.client.httpClient, api.client.Endpoint+taskUrl+"/"+id, api.client.options.TokenOptions.AccessToken) if err != nil { return } defer res.Body.Close() result, err := getTask(getError(res)) return result, err }
// Gets details of flavor with specified ID. func (api *FlavorsAPI) Get(flavorID string) (flavor *Flavor, err error) { res, err := rest.Get(api.client.httpClient, api.client.Endpoint+flavorUrl+"/"+flavorID, api.client.options.TokenOptions.AccessToken) if err != nil { return } defer res.Body.Close() res, err = getError(res) if err != nil { return } flavor = &Flavor{} err = json.NewDecoder(res.Body).Decode(flavor) return }
// Returns the status of an photon endpoint. func (api *StatusAPI) Get() (status *Status, err error) { res, err := rest.Get(api.client.httpClient, api.client.Endpoint+statusUrl, api.client.options.TokenOptions.AccessToken) if err != nil { return } defer res.Body.Close() res, err = getError(res) if err != nil { return } status = &Status{} err = json.NewDecoder(res.Body).Decode(status) return }
// Gets a network with the specified ID. func (api *NetworksAPI) Get(id string) (network *Network, err error) { res, err := rest.Get(api.client.httpClient, api.client.Endpoint+networkUrl+"/"+id, api.client.options.TokenOptions.AccessToken) if err != nil { return } defer res.Body.Close() res, err = getError(res) if err != nil { return } var result Network err = json.NewDecoder(res.Body).Decode(&result) return &result, nil }
// Returns all deployments. func (api *DeploymentsAPI) GetAll() (result *Deployments, err error) { res, err := rest.Get(api.client.httpClient, api.client.Endpoint+deploymentUrl, api.client.options.TokenOptions.AccessToken) if err != nil { return } defer res.Body.Close() res, err = getError(res) if err != nil { return } result = &Deployments{} err = json.NewDecoder(res.Body).Decode(result) return }
// Gets a deployment with the specified ID. func (api *DeploymentsAPI) Get(id string) (deployment *Deployment, err error) { res, err := rest.Get(api.client.httpClient, api.client.Endpoint+deploymentUrl+"/"+id, api.client.options.TokenOptions.AccessToken) if err != nil { return } defer res.Body.Close() res, err = getError(res) if err != nil { return } var result Deployment err = json.NewDecoder(res.Body).Decode(&result) return &result, nil }
// Gets the project with a specified ID. func (api *ProjectsAPI) Get(id string) (project *ProjectCompact, err error) { res, err := rest.Get(api.client.httpClient, api.getEntityUrl(id), api.client.options.TokenOptions.AccessToken) if err != nil { return } defer res.Body.Close() res, err = getError(res) if err != nil { return } project = &ProjectCompact{} err = json.NewDecoder(res.Body).Decode(project) return }
// Gets a cluster with the specified ID. func (api *ClustersAPI) Get(id string) (cluster *Cluster, err error) { res, err := rest.Get(api.client.httpClient, api.client.Endpoint+clusterUrl+id, api.client.options.TokenOptions.AccessToken) if err != nil { return } defer res.Body.Close() res, err = getError(res) if err != nil { return } var result Cluster err = json.NewDecoder(res.Body).Decode(&result) return &result, nil }
func (api *VmAPI) Get(id string) (vm *VM, err error) { res, err := rest.Get(api.client.httpClient, api.client.Endpoint+vmUrl+id, api.client.options.TokenOptions.AccessToken) if err != nil { return } defer res.Body.Close() res, err = getError(res) if err != nil { return } vm = &VM{} err = json.NewDecoder(res.Body).Decode(vm) return }
// Gets availability zone with the specified ID. func (api *AvailabilityZonesAPI) Get(id string) (availabilityzone *AvailabilityZone, err error) { res, err := rest.Get(api.client.httpClient, api.getEntityUrl(id), api.client.options.TokenOptions.AccessToken) if err != nil { return } defer res.Body.Close() res, err = getError(res) if err != nil { return } availabilityzone = &AvailabilityZone{} err = json.NewDecoder(res.Body).Decode(availabilityzone) return }
// Gets all the vms with the specified deployment ID. func (api *HostsAPI) GetVMs(id string) (result *VMs, err error) { res, err := rest.Get(api.client.httpClient, api.client.Endpoint+hostUrl+"/"+id+"/vms", api.client.options.TokenOptions.AccessToken) if err != nil { return } defer res.Body.Close() res, err = getError(res) if err != nil { return } result = &VMs{} err = json.NewDecoder(res.Body).Decode(result) return }
// Gets a PersistentDisk for the disk with specified ID. func (api *DisksAPI) Get(diskID string) (disk *PersistentDisk, err error) { res, err := rest.Get(api.client.httpClient, api.client.Endpoint+diskUrl+diskID, api.client.options.TokenOptions.AccessToken) if err != nil { return } defer res.Body.Close() res, err = getError(res) if err != nil { return } disk = &PersistentDisk{} err = json.NewDecoder(res.Body).Decode(disk) return }
// Gets a tenant with the specified ID. func (api *TenantsAPI) Get(id string) (tenant *Tenant, err error) { res, err := rest.Get(api.client.httpClient, api.getEntityUrl(id), api.client.options.TokenOptions.AccessToken) if err != nil { return } defer res.Body.Close() res, err = getError(res) if err != nil { return } tenant = &Tenant{} err = json.NewDecoder(res.Body).Decode(tenant) return }
// Gets details of image with the specified ID. func (api *ImagesAPI) Get(imageID string) (image *Image, err error) { res, err := rest.Get(api.client.httpClient, api.client.Endpoint+imageUrl+"/"+imageID, api.client.options.TokenOptions.AccessToken) if err != nil { return } defer res.Body.Close() res, err = getError(res) if err != nil { return } var result Image err = json.NewDecoder(res.Body).Decode(&result) return &result, nil }
// Gets authentication info. func (api *AuthAPI) Get() (info *AuthInfo, err error) { res, err := rest.Get(api.client.httpClient, api.client.AuthEndpoint+authUrl, api.client.options.TokenOptions.AccessToken) if err != nil { return } defer res.Body.Close() res, err = getError(res) if err != nil { return } info = &AuthInfo{} err = json.NewDecoder(res.Body).Decode(info) return }