Ejemplo n.º 1
0
// Returns all networks
func (api *NetworksAPI) GetAll(options *NetworkGetOptions) (result *Networks, err error) {
	uri := api.client.Endpoint + networkUrl
	if options != nil {
		uri += getQueryString(options)
	}
	res, err := rest.GetList(api.client.httpClient, api.client.Endpoint, uri, api.client.options.TokenOptions.AccessToken)

	result = &Networks{}
	err = json.Unmarshal(res, result)
	return
}
Ejemplo n.º 2
0
// Returns all availability zones on an photon instance.
func (api *AvailabilityZonesAPI) GetAll() (result *AvailabilityZones, err error) {
	uri := api.client.Endpoint + availabilityzoneUrl
	res, err := rest.GetList(api.client.httpClient, api.client.Endpoint, uri, api.client.options.TokenOptions.AccessToken)
	if err != nil {
		return
	}

	result = &AvailabilityZones{}
	err = json.Unmarshal(res, result)
	return
}
Ejemplo n.º 3
0
// Gets all the vms with the specified deployment ID.
func (api *DeploymentsAPI) GetVms(id string) (result *VMs, err error) {
	uri := api.client.Endpoint + deploymentUrl + "/" + id + "/vms"
	res, err := rest.GetList(api.client.httpClient, api.client.Endpoint, uri, api.client.options.TokenOptions.AccessToken)
	if err != nil {
		return
	}

	result = &VMs{}
	err = json.Unmarshal(res, result)
	return
}
Ejemplo n.º 4
0
// 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 := rest.GetList(api.client.httpClient, api.client.Endpoint, uri, api.client.options.TokenOptions.AccessToken)
	if err != nil {
		return
	}

	result = &Clusters{}
	err = json.Unmarshal(res, result)
	return
}
Ejemplo n.º 5
0
// Returns all tenants on an photon instance.
func (api *TenantsAPI) GetAll() (result *Tenants, err error) {
	uri := api.client.Endpoint + tenantUrl
	res, err := rest.GetList(api.client.httpClient, api.client.Endpoint, uri, api.client.options.TokenOptions.AccessToken)
	if err != nil {
		return
	}

	result = &Tenants{}
	err = json.Unmarshal(res, result)
	return
}
Ejemplo n.º 6
0
// Gets all images on this photon instance.
func (api *ImagesAPI) GetAll() (images *Images, err error) {
	uri := api.client.Endpoint + imageUrl
	res, err := rest.GetList(api.client.httpClient, api.client.Endpoint, uri, api.client.options.TokenOptions.AccessToken)
	if err != nil {
		return
	}

	images = &Images{}
	err = json.Unmarshal(res, images)
	return
}
Ejemplo n.º 7
0
// Gets flavors using options to filter results. Returns all flavors if options is nil.
func (api *FlavorsAPI) GetAll(options *FlavorGetOptions) (flavors *FlavorList, err error) {
	uri := api.client.Endpoint + flavorUrl
	if options != nil {
		uri += getQueryString(options)
	}
	res, err := rest.GetList(api.client.httpClient, api.client.Endpoint, uri, api.client.options.TokenOptions.AccessToken)
	if err != nil {
		return
	}

	flavors = &FlavorList{}
	err = json.Unmarshal(res, flavors)
	return
}
Ejemplo n.º 8
0
// Gets disks for project with the specified ID, using options to filter the results.
// If options is nil, no filtering will occur.
func (api *ProjectsAPI) GetDisks(projectID string, options *DiskGetOptions) (result *DiskList, err error) {
	uri := api.client.Endpoint + projectUrl + projectID + "/disks"
	if options != nil {
		uri += getQueryString(options)
	}
	res, err := rest.GetList(api.client.httpClient, api.client.Endpoint, uri, api.client.options.TokenOptions.AccessToken)
	if err != nil {
		return
	}

	result = &DiskList{}
	err = json.Unmarshal(res, result)
	return
}
Ejemplo n.º 9
0
// Gets all tasks with the specified vm ID, using options to filter the results.
// If options is nil, no filtering will occur.
func (api *VmAPI) GetTasks(id string, options *TaskGetOptions) (result *TaskList, err error) {
	uri := api.client.Endpoint + vmUrl + id + "/tasks"
	if options != nil {
		uri += getQueryString(options)
	}
	res, err := rest.GetList(api.client.httpClient, api.client.Endpoint, uri, api.client.options.TokenOptions.AccessToken)
	if err != nil {
		return
	}

	result = &TaskList{}
	err = json.Unmarshal(res, result)
	return
}
Ejemplo n.º 10
0
// Gets resource tickets for tenant with the specified ID, using options to filter the results.
// If options is nil, no filtering will occur.
func (api *TenantsAPI) GetResourceTickets(tenantId string, options *ResourceTicketGetOptions) (tickets *ResourceList, err error) {
	uri := api.client.Endpoint + tenantUrl + "/" + tenantId + "/resource-tickets"
	if options != nil {
		uri += getQueryString(options)
	}
	res, err := rest.GetList(api.client.httpClient, api.client.Endpoint, uri, api.client.options.TokenOptions.AccessToken)
	if err != nil {
		return
	}

	tickets = &ResourceList{}
	err = json.Unmarshal(res, tickets)
	return
}
Ejemplo n.º 11
0
// Gets the projects for tenant with the specified ID, using options to filter the results.
// If options is nil, no filtering will occur.
func (api *TenantsAPI) GetProjects(tenantId string, options *ProjectGetOptions) (result *ProjectList, err error) {
	uri := api.client.Endpoint + tenantUrl + "/" + tenantId + "/projects"
	if options != nil {
		uri += getQueryString(options)
	}
	res, err := rest.GetList(api.client.httpClient, api.client.Endpoint, uri, api.client.options.TokenOptions.AccessToken)
	if err != nil {
		return
	}

	result = &(ProjectList{})
	err = json.Unmarshal(res, result)
	return
}