"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "openstack_dashboard/static/app/core/openstack-service-api/nova.service.js" between
horizon-22.1.0.tar.gz and horizon-23.0.0.tar.gz

About: OpenStack Horizon (Optional Service: Dashboard) provides a web-based self-service portal to interact with underlying OpenStack services, such as launching an instance, assigning IP addresses and configuring access controls.
The "Zed" series (latest release).

nova.service.js  (horizon-22.1.0):nova.service.js  (horizon-23.0.0)
skipping to change at line 101 skipping to change at line 101
// Feature // Feature
/** /**
* @name isFeatureSupported * @name isFeatureSupported
* @description * @description
* Check if the feature is supported. * Check if the feature is supported.
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function isFeatureSupported(feature) { function isFeatureSupported(feature) {
return apiService.get('/api/nova/features/' + feature) return apiService.get('/api/nova/features/' + feature)
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to check the Nova service fe ature.')); toastService.add('error', gettext('Unable to check the Nova service fe ature.'));
}); });
} }
// Nova Services // Nova Services
/** /**
* @name getServices * @name getServices
* @description Get the list of Nova services. * @description Get the list of Nova services.
* *
* @returns {Object} The listing result is an object with property "services ." Each item is * @returns {Object} The listing result is an object with property "services ." Each item is
* a service. * a service.
*/ */
function getServices() { function getServices() {
return apiService.get('/api/nova/services/') return apiService.get('/api/nova/services/')
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to retrieve the nova service s.')); toastService.add('error', gettext('Unable to retrieve the nova service s.'));
}); });
} }
// Keypairs // Keypairs
/** /**
* @name getKeypairs * @name getKeypairs
* @description * @description
* Get a list of keypairs. * Get a list of keypairs.
* *
* @returns {Object} An object with property "items". Each item is a keypair . * @returns {Object} An object with property "items". Each item is a keypair .
*/ */
function getKeypairs() { function getKeypairs() {
return apiService.get('/api/nova/keypairs/') return apiService.get('/api/nova/keypairs/')
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to retrieve the keypairs.')) ; toastService.add('error', gettext('Unable to retrieve the keypairs.')) ;
}); });
} }
/** /**
* @name createKeypair * @name createKeypair
* @description * @description
* Create a new keypair. This returns the new keypair object on success. * Create a new keypair. This returns the new keypair object on success.
* *
* @param {Object} newKeypair * @param {Object} newKeypair
skipping to change at line 155 skipping to change at line 155
* *
* @param {string} newKeypair.name * @param {string} newKeypair.name
* The name of the new keypair. Required. * The name of the new keypair. Required.
* *
* @param {string} newKeypair.public_key * @param {string} newKeypair.public_key
* The public key. Optional. * The public key. Optional.
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function createKeypair(newKeypair) { function createKeypair(newKeypair) {
return apiService.post('/api/nova/keypairs/', newKeypair) return apiService.post('/api/nova/keypairs/', newKeypair)
.error(function () { .catch(function onError() {
if (angular.isDefined(newKeypair.public_key)) { if (angular.isDefined(newKeypair.public_key)) {
toastService.add('error', gettext('Unable to import the keypair.')); toastService.add('error', gettext('Unable to import the keypair.'));
} else { } else {
toastService.add('error', gettext('Unable to create the keypair.')); toastService.add('error', gettext('Unable to create the keypair.'));
} }
}); });
} }
/** /**
* @name getKeypair * @name getKeypair
* @description * @description
* Get a single keypair by name. * Get a single keypair by name.
* *
* @param {string} name * @param {string} name
* The name of the keypair. Required. * The name of the keypair. Required.
* *
* @returns {Object} The result of the API call. * @returns {Object} The result of the API call.
*/ */
function getKeypair(name) { function getKeypair(name) {
return apiService.get('/api/nova/keypairs/' + name) return apiService.get('/api/nova/keypairs/' + name)
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to retrieve the keypair.')); toastService.add('error', gettext('Unable to retrieve the keypair.'));
}); });
} }
/** /**
* @name deleteKeypair * @name deleteKeypair
* @description * @description
* Delete a single keypair by name. * Delete a single keypair by name.
* *
* @param {String} name * @param {String} name
* Keypair to delete * Keypair to delete
* *
* @param {boolean} suppressError * @param {boolean} suppressError
* If passed in, this will not show the default error handling * If passed in, this will not show the default error handling
* (horizon alert). * (horizon alert).
* *
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function deleteKeypair(name, suppressError) { function deleteKeypair(name, suppressError) {
var promise = apiService.delete('/api/nova/keypairs/' + name); var promise = apiService.delete('/api/nova/keypairs/' + name);
return suppressError ? promise : promise.error(function() { return suppressError ? promise : promise.catch(function onError() {
var msg = gettext('Unable to delete the keypair with name: %(name)s'); var msg = gettext('Unable to delete the keypair with name: %(name)s');
toastService.add('error', interpolate(msg, { name: name }, true)); toastService.add('error', interpolate(msg, { name: name }, true));
}); });
} }
// Availability Zones // Availability Zones
/** /**
* @name getAvailabilityZones * @name getAvailabilityZones
* @description * @description
* Get a list of Availability Zones. * Get a list of Availability Zones.
* *
* The listing result is an object with property "items". Each item is * The listing result is an object with property "items". Each item is
* an availability zone. * an availability zone.
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function getAvailabilityZones() { function getAvailabilityZones() {
return apiService.get('/api/nova/availzones/') return apiService.get('/api/nova/availzones/')
.error(function () { .catch(function onError() {
toastService.add('error', toastService.add('error',
gettext('Unable to retrieve the availability zones.')); gettext('Unable to retrieve the availability zones.'));
}); });
} }
// Limits // Limits
/** /**
* @name getLimits * @name getLimits
* @description * @description
skipping to change at line 257 skipping to change at line 257
* "totalInstancesUsed": 1, * "totalInstancesUsed": 1,
* "totalRAMUsed": 512, * "totalRAMUsed": 512,
* "totalSecurityGroupsUsed": 1, * "totalSecurityGroupsUsed": 1,
* "totalServerGroupsUsed": 0 * "totalServerGroupsUsed": 0
* } * }
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function getLimits(reserved) { function getLimits(reserved) {
var params = { params: {reserved: reserved }}; var params = { params: {reserved: reserved }};
return apiService.get('/api/nova/limits/', params) return apiService.get('/api/nova/limits/', params)
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to retrieve the limits.')); toastService.add('error', gettext('Unable to retrieve the limits.'));
}); });
} }
// Servers // Servers
/** /**
* @name createServer * @name createServer
* @param {Object} newServer - The new server * @param {Object} newServer - The new server
* @description * @description
skipping to change at line 285 skipping to change at line 285
* *
* Other parameters are accepted as per the underlying novaclient: * Other parameters are accepted as per the underlying novaclient:
* "block_device_mapping", "block_device_mapping_v2", "nics", "meta", * "block_device_mapping", "block_device_mapping_v2", "nics", "meta",
* "availability_zone", "instance_count", "admin_pass", "disk_config", * "availability_zone", "instance_count", "admin_pass", "disk_config",
* "config_drive" * "config_drive"
* *
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function createServer(newServer) { function createServer(newServer) {
return apiService.post('/api/nova/servers/', newServer) return apiService.post('/api/nova/servers/', newServer)
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to create the server.')); toastService.add('error', gettext('Unable to create the server.'));
}); });
} }
/** /**
* @name getServer * @name getServer
* @description * @description
* Get a single server by ID * Get a single server by ID
* @param {string} id * @param {string} id
* Specifies the id of the server to request. * Specifies the id of the server to request.
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function getServer(id) { function getServer(id) {
return apiService.get('/api/nova/servers/' + id) return apiService.get('/api/nova/servers/' + id)
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to retrieve the server.')); toastService.add('error', gettext('Unable to retrieve the server.'));
}); });
} }
/** /**
* @name getServers * @name getServers
* @description * @description
* Get a list of servers. * Get a list of servers.
* *
* The listing result is an object with property "items". Each item is * The listing result is an object with property "items". Each item is
* a server. * a server.
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function getServers() { function getServers() {
return apiService.get('/api/nova/servers/') return apiService.get('/api/nova/servers/')
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to retrieve instances.')); toastService.add('error', gettext('Unable to retrieve instances.'));
}); });
} }
/** /**
* @name getServerGroup * @name getServerGroup
* @description * @description
* Get a single server group by ID * Get a single server group by ID
* @param {string} id * @param {string} id
* Specifies the id of the server group to request. * Specifies the id of the server group to request.
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function getServerGroup(id) { function getServerGroup(id) {
return apiService.get('/api/nova/servergroups/' + id) return apiService.get('/api/nova/servergroups/' + id)
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to retrieve the server group .')); toastService.add('error', gettext('Unable to retrieve the server group .'));
}); });
} }
/** /**
* @name getServerGroups * @name getServerGroups
* @description * @description
* Get a list of server groups. * Get a list of server groups.
* *
* The listing result is an object with property "items". Each item is * The listing result is an object with property "items". Each item is
* a server group. * a server group.
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function getServerGroups() { function getServerGroups() {
return apiService.get('/api/nova/servergroups/') return apiService.get('/api/nova/servergroups/')
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to retrieve server groups.') ); toastService.add('error', gettext('Unable to retrieve server groups.') );
}); });
} }
/** /**
* @name createServerGroup * @name createServerGroup
* @description * @description
* Create a new server group. This returns the new server group object on su ccess. * Create a new server group. This returns the new server group object on su ccess.
* *
* @param {Object} newServerGroup * @param {Object} newServerGroup
skipping to change at line 369 skipping to change at line 369
* *
* @param {string} newServerGroup.name * @param {string} newServerGroup.name
* The name of the new server group. Required. * The name of the new server group. Required.
* *
* @param {array} newServerGroup.policies * @param {array} newServerGroup.policies
* The policies of the new server group. Required. * The policies of the new server group. Required.
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function createServerGroup(newServerGroup) { function createServerGroup(newServerGroup) {
return apiService.post('/api/nova/servergroups/', newServerGroup) return apiService.post('/api/nova/servergroups/', newServerGroup)
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to create the server group.' )); toastService.add('error', gettext('Unable to create the server group.' ));
}); });
} }
/** /**
* @name deleteServerGroup * @name deleteServerGroup
* @description * @description
* Delete a single server group by ID. * Delete a single server group by ID.
* *
* @param {String} serverGroupId * @param {String} serverGroupId
* Server Group to delete * Server Group to delete
* *
* @param {boolean} suppressError * @param {boolean} suppressError
* If passed in, this will not show the default error handling * If passed in, this will not show the default error handling
* (horizon alert). * (horizon alert).
* *
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function deleteServerGroup(serverGroupId, suppressError) { function deleteServerGroup(serverGroupId, suppressError) {
var promise = apiService.delete('/api/nova/servergroups/' + serverGroupId + '/'); var promise = apiService.delete('/api/nova/servergroups/' + serverGroupId + '/');
return suppressError ? promise : promise.error(function() { return suppressError ? promise : promise.catch(function onError() {
var msg = gettext('Unable to delete the server group with id %(id)s'); var msg = gettext('Unable to delete the server group with id %(id)s');
toastService.add('error', interpolate(msg, { id: serverGroupId }, true)) ; toastService.add('error', interpolate(msg, { id: serverGroupId }, true)) ;
}); });
} }
/* /*
* @name deleteServer * @name deleteServer
* @description * @description
* Delete a single server by ID. * Delete a single server by ID.
* *
* @param {String} serverId * @param {String} serverId
* Server to delete * Server to delete
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function deleteServer(serverId, suppressError) { function deleteServer(serverId, suppressError) {
var promise = apiService.delete('/api/nova/servers/' + serverId); var promise = apiService.delete('/api/nova/servers/' + serverId);
return suppressError ? promise : promise.error(function() { return suppressError ? promise : promise.catch(function onError() {
var msg = gettext('Unable to delete the server with id: %(id)s'); var msg = gettext('Unable to delete the server with id: %(id)s');
toastService.add('error', interpolate(msg, { id: serverId }, true)); toastService.add('error', interpolate(msg, { id: serverId }, true));
}); });
} }
function serverStateOperation(operation, serverId, suppressError, errMsg) { function serverStateOperation(operation, serverId, suppressError, errMsg) {
var instruction = {"operation": operation}; var instruction = {"operation": operation};
var promise = apiService.post('/api/nova/servers/' + serverId, instruction ); var promise = apiService.post('/api/nova/servers/' + serverId, instruction );
return suppressError ? promise : promise.error(function() { return suppressError ? promise : promise.catch(function onError() {
toastService.add('error', interpolate(errMsg, { id: serverId }, true)); toastService.add('error', interpolate(errMsg, { id: serverId }, true));
}); });
} }
/** /**
* @name startServer * @name startServer
* @description * @description
* Start a single server by ID. * Start a single server by ID.
* *
skipping to change at line 552 skipping to change at line 552
* a flavor. * a flavor.
* *
* @param {Object} params (optional) * @param {Object} params (optional)
* Parameters that should be passed to the API call. Currently those can * Parameters that should be passed to the API call. Currently those can
* be "is_public" and "get_extras", both of them boolean. * be "is_public" and "get_extras", both of them boolean.
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function getFlavors(params) { function getFlavors(params) {
var config = params ? { 'params' : params} : { 'params' : {} }; var config = params ? { 'params' : params} : { 'params' : {} };
return apiService.get('/api/nova/flavors/', config) return apiService.get('/api/nova/flavors/', config)
.success(function (data) { .then(function onSuccess(response) {
// The colon character ':' in the flavor data causes problems when use d // The colon character ':' in the flavor data causes problems when use d
// in Angular $parse() statements. Since these values are used as keys // in Angular $parse() statements. Since these values are used as keys
// to lookup data (and may end up in a $parse()) provide "user-friendl y" // to lookup data (and may end up in a $parse()) provide "user-friendl y"
// attributes // attributes
if (data && data.items) { if (response.data && response.data.items) {
data.items.map(function(item) { response.data.items.map(function(item) {
if (item.hasOwnProperty('OS-FLV-EXT-DATA:ephemeral')) { if (item.hasOwnProperty('OS-FLV-EXT-DATA:ephemeral')) {
item.ephemeral = item['OS-FLV-EXT-DATA:ephemeral']; item.ephemeral = item['OS-FLV-EXT-DATA:ephemeral'];
} }
if (item.hasOwnProperty('OS-FLV-DISABLED:disabled')) { if (item.hasOwnProperty('OS-FLV-DISABLED:disabled')) {
item.disabled = item['OS-FLV-DISABLED:disabled']; item.disabled = item['OS-FLV-DISABLED:disabled'];
} }
if (item.hasOwnProperty('os-flavor-access:is_public')) { if (item.hasOwnProperty('os-flavor-access:is_public')) {
item.is_public = item['os-flavor-access:is_public']; item.is_public = item['os-flavor-access:is_public'];
} }
}); });
} }
return response;
}) })
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to retrieve the flavors.')); toastService.add('error', gettext('Unable to retrieve the flavors.'));
}); });
} }
/** /**
* @name getFlavor * @name getFlavor
* @description * @description
* Get a single flavor by ID. * Get a single flavor by ID.
* @param {string} id * @param {string} id
* Specifies the id of the flavor to request. * Specifies the id of the flavor to request.
skipping to change at line 596 skipping to change at line 597
*/ */
function getFlavor(id, getExtras, getAccessList) { function getFlavor(id, getExtras, getAccessList) {
var config = {'params': {}}; var config = {'params': {}};
if (getExtras) { if (getExtras) {
config.params.get_extras = 'true'; config.params.get_extras = 'true';
} }
if (getAccessList) { if (getAccessList) {
config.params.get_access_list = 'true'; config.params.get_access_list = 'true';
} }
return apiService.get('/api/nova/flavors/' + id + '/' , config) return apiService.get('/api/nova/flavors/' + id + '/' , config)
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to retrieve the flavor.')); toastService.add('error', gettext('Unable to retrieve the flavor.'));
}); });
} }
/** /**
* @name createFlavor * @name createFlavor
* @description * @description
* Create a single flavor. * Create a single flavor.
* @param {flavor} flavor * @param {flavor} flavor
* Flavor to create * Flavor to create
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function createFlavor(flavor) { function createFlavor(flavor) {
return apiService.post('/api/nova/flavors/', flavor) return apiService.post('/api/nova/flavors/', flavor)
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to create the flavor.')); toastService.add('error', gettext('Unable to create the flavor.'));
}); });
} }
/** /**
* @name updateFlavor * @name updateFlavor
* @description * @description
* Update a single flavor. * Update a single flavor.
* @param {flavor} flavor * @param {flavor} flavor
* Flavor to update * Flavor to update
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function updateFlavor(flavor) { function updateFlavor(flavor) {
return apiService.patch('/api/nova/flavors/' + flavor.id + '/', flavor) return apiService.patch('/api/nova/flavors/' + flavor.id + '/', flavor)
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to update the flavor.')); toastService.add('error', gettext('Unable to update the flavor.'));
}); });
} }
/** /**
* @name deleteFlavor * @name deleteFlavor
* @description * @description
* Delete a single flavor by ID. * Delete a single flavor by ID.
* *
* @param {String} flavorId * @param {String} flavorId
skipping to change at line 648 skipping to change at line 649
* *
* @param {boolean} suppressError * @param {boolean} suppressError
* If passed in, this will not show the default error handling * If passed in, this will not show the default error handling
* (horizon alert). The glance API may not have metadata definitions * (horizon alert). The glance API may not have metadata definitions
* enabled. * enabled.
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function deleteFlavor(flavorId, suppressError) { function deleteFlavor(flavorId, suppressError) {
var promise = apiService.delete('/api/nova/flavors/' + flavorId + '/'); var promise = apiService.delete('/api/nova/flavors/' + flavorId + '/');
return suppressError ? promise : promise.error(function() { return suppressError ? promise : promise.catch(function onError() {
var msg = gettext('Unable to delete the flavor with id: %(id)s'); var msg = gettext('Unable to delete the flavor with id: %(id)s');
toastService.add('error', interpolate(msg, { id: flavorId }, true)); toastService.add('error', interpolate(msg, { id: flavorId }, true));
}); });
} }
/** /**
* @name getFlavorExtraSpecs * @name getFlavorExtraSpecs
* @description * @description
* Get a single flavor's extra specs by ID. * Get a single flavor's extra specs by ID.
* @param {string} id * @param {string} id
* Specifies the id of the flavor to request the extra specs. * Specifies the id of the flavor to request the extra specs.
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function getFlavorExtraSpecs(id) { function getFlavorExtraSpecs(id) {
return apiService.get('/api/nova/flavors/' + id + '/extra-specs/') return apiService.get('/api/nova/flavors/' + id + '/extra-specs/')
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to retrieve the flavor extra specs.')); toastService.add('error', gettext('Unable to retrieve the flavor extra specs.'));
}); });
} }
/** /**
* @name editFlavorExtraSpecs * @name editFlavorExtraSpecs
* @description * @description
* Update a single flavor's extra specs by ID. * Update a single flavor's extra specs by ID.
* @param {string} id * @param {string} id
* @param {object} updated New extra specs. * @param {object} updated New extra specs.
* @param {[]} removed Names of removed extra specs. * @param {[]} removed Names of removed extra specs.
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function editFlavorExtraSpecs(id, updated, removed) { function editFlavorExtraSpecs(id, updated, removed) {
return apiService.patch( return apiService.patch(
'/api/nova/flavors/' + id + '/extra-specs/', '/api/nova/flavors/' + id + '/extra-specs/',
{ {
updated: updated, updated: updated,
removed: removed removed: removed
} }
).error(function () { ).catch(function onError() {
toastService.add('error', gettext('Unable to edit the flavor extra specs .')); toastService.add('error', gettext('Unable to edit the flavor extra specs .'));
}); });
} }
/** /**
* @name getAggregateExtraSpecs * @name getAggregateExtraSpecs
* @description * @description
* Get a single aggregate's extra specs by ID. * Get a single aggregate's extra specs by ID.
* @param {string} id * @param {string} id
* Specifies the id of the flavor to request the extra specs. * Specifies the id of the flavor to request the extra specs.
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function getAggregateExtraSpecs(id) { function getAggregateExtraSpecs(id) {
return apiService.get('/api/nova/aggregates/' + id + '/extra-specs/') return apiService.get('/api/nova/aggregates/' + id + '/extra-specs/')
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to retrieve the aggregate ex tra specs.')); toastService.add('error', gettext('Unable to retrieve the aggregate ex tra specs.'));
}); });
} }
/** /**
* @name editAggregateExtraSpecs * @name editAggregateExtraSpecs
* @description * @description
* Update a single aggregate's extra specs by ID. * Update a single aggregate's extra specs by ID.
* @param {string} id * @param {string} id
* @param {object} updated New extra specs. * @param {object} updated New extra specs.
* @param {[]} removed Names of removed extra specs. * @param {[]} removed Names of removed extra specs.
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function editAggregateExtraSpecs(id, updated, removed) { function editAggregateExtraSpecs(id, updated, removed) {
return apiService.patch( return apiService.patch(
'/api/nova/aggregates/' + id + '/extra-specs/', '/api/nova/aggregates/' + id + '/extra-specs/',
{ {
updated: updated, updated: updated,
removed: removed removed: removed
} }
).error(function () { ).catch(function onError() {
toastService.add('error', gettext('Unable to edit the aggregate extra sp ecs.')); toastService.add('error', gettext('Unable to edit the aggregate extra sp ecs.'));
}); });
} }
/** /**
* @name getInstanceMetadata * @name getInstanceMetadata
* @description * @description
* Get a single instance's metadata by ID. * Get a single instance's metadata by ID.
* @param {string} id * @param {string} id
* Specifies the id of the instance to request the metadata. * Specifies the id of the instance to request the metadata.
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function getInstanceMetadata(id) { function getInstanceMetadata(id) {
return apiService.get('/api/nova/servers/' + id + '/metadata') return apiService.get('/api/nova/servers/' + id + '/metadata')
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to retrieve instance metadat a.')); toastService.add('error', gettext('Unable to retrieve instance metadat a.'));
}); });
} }
/** /**
* @name editInstanceMetadata * @name editInstanceMetadata
* @description * @description
* Update a single instance's metadata by ID. * Update a single instance's metadata by ID.
* @param {string} id * @param {string} id
* @param {object} updated New metadata. * @param {object} updated New metadata.
* @param {[]} removed Names of removed metadata items. * @param {[]} removed Names of removed metadata items.
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function editInstanceMetadata(id, updated, removed) { function editInstanceMetadata(id, updated, removed) {
return apiService.patch( return apiService.patch(
'/api/nova/servers/' + id + '/metadata', '/api/nova/servers/' + id + '/metadata',
{ {
updated: updated, updated: updated,
removed: removed removed: removed
} }
).error(function () { ).catch(function onError() {
toastService.add('error', gettext('Unable to edit instance metadata.')); toastService.add('error', gettext('Unable to edit instance metadata.'));
}); });
} }
// Default Quota Sets // Default Quota Sets
/** /**
* @name getDefaultQuotaSets * @name getDefaultQuotaSets
* @description * @description
* Get default quotasets * Get default quotasets
* *
* The listing result is an object with property "items." Each item is * The listing result is an object with property "items." Each item is
* a quota. * a quota.
* *
*/ */
function getDefaultQuotaSets() { function getDefaultQuotaSets() {
return apiService.get('/api/nova/quota-sets/defaults/') return apiService.get('/api/nova/quota-sets/defaults/')
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to retrieve the default quot as.')); toastService.add('error', gettext('Unable to retrieve the default quot as.'));
}); });
} }
/** /**
* @name setDefaultQuotaSets * @name setDefaultQuotaSets
* @description * @description
* Set default quotasets * Set default quotasets
* *
*/ */
function setDefaultQuotaSets(quotas) { function setDefaultQuotaSets(quotas) {
return apiService.patch('/api/nova/quota-sets/defaults/', quotas) return apiService.patch('/api/nova/quota-sets/defaults/', quotas)
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to set the default quotas.') ); toastService.add('error', gettext('Unable to set the default quotas.') );
}); });
} }
// Quota Sets // Quota Sets
/** /**
* @name getEditableQuotas * @name getEditableQuotas
* @description * @description
* Get a list of editable quota fields. * Get a list of editable quota fields.
* The listing result is an object with property "items." Each item is * The listing result is an object with property "items." Each item is
* an editable quota field. * an editable quota field.
* *
*/ */
function getEditableQuotas() { function getEditableQuotas() {
return apiService.get('/api/nova/quota-sets/editable/') return apiService.get('/api/nova/quota-sets/editable/')
.error(function() { .catch(function onError() {
toastService.add('error', gettext('Unable to retrieve the editable quo tas.')); toastService.add('error', gettext('Unable to retrieve the editable quo tas.'));
}); });
} }
/** /**
* @name updateProjectQuota * @name updateProjectQuota
* @description * @description
* Update a single project quota data. * Update a single project quota data.
* @param {application/json} quota * @param {application/json} quota
* A JSON object with the attributes to set to new quota values. * A JSON object with the attributes to set to new quota values.
* @param {string} projectId * @param {string} projectId
* Specifies the id of the project that'll have the quota data updated. * Specifies the id of the project that'll have the quota data updated.
*/ */
function updateProjectQuota(quota, projectId) { function updateProjectQuota(quota, projectId) {
var url = '/api/nova/quota-sets/' + projectId; var url = '/api/nova/quota-sets/' + projectId;
return apiService.patch(url, quota) return apiService.patch(url, quota)
.error(function() { .catch(function onError() {
toastService.add('error', gettext('Unable to update project quota data .')); toastService.add('error', gettext('Unable to update project quota data .'));
}); });
} }
/** /**
* @name createServerSnapshot * @name createServerSnapshot
* @param {Object} newSnapshot - The new server snapshot * @param {Object} newSnapshot - The new server snapshot
* @description * @description
* Create a server snapshot using the parameters supplied in the * Create a server snapshot using the parameters supplied in the
* newSnapshot. The required parameters: * newSnapshot. The required parameters:
* *
* "name", "instance_id" * "name", "instance_id"
* All strings * All strings
* *
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function createServerSnapshot(newSnapshot) { function createServerSnapshot(newSnapshot) {
return apiService.post('/api/nova/snapshots/', newSnapshot) return apiService.post('/api/nova/snapshots/', newSnapshot)
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to create the server snapsho t.')); toastService.add('error', gettext('Unable to create the server snapsho t.'));
}); });
} }
/** /**
* @name getActionList * @name getActionList
* @param {String} ID - The server ID * @param {String} ID - The server ID
* @description * @description
* Retrieves a list of actions performed on the server. * Retrieves a list of actions performed on the server.
* *
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function getActionList(instanceId) { function getActionList(instanceId) {
return apiService.get('/api/nova/servers/' + instanceId + '/actions/') return apiService.get('/api/nova/servers/' + instanceId + '/actions/')
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to load the server actions.' )); toastService.add('error', gettext('Unable to load the server actions.' ));
}); });
} }
/** /**
* @name getConsoleLog * @name getConsoleLog
* @param {String} instanceId - The server ID * @param {String} instanceId - The server ID
* @param {Number} length - The number of lines to retrieve (optional) * @param {Number} length - The number of lines to retrieve (optional)
* @description * @description
* Retrieves a list of most recent console log lines from the server. * Retrieves a list of most recent console log lines from the server.
* *
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function getConsoleLog(instanceId, length) { function getConsoleLog(instanceId, length) {
var config = {}; var config = {};
if (length) { if (length) {
config.length = length; config.length = length;
} }
return apiService.post('/api/nova/servers/' + instanceId + '/console-outpu t/', config) return apiService.post('/api/nova/servers/' + instanceId + '/console-outpu t/', config)
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to load the server console l og.')); toastService.add('error', gettext('Unable to load the server console l og.'));
}); });
} }
/** /**
* @name getConsoleInfo * @name getConsoleInfo
* @param {String} instanceId - The server ID * @param {String} instanceId - The server ID
* @param {String} type - The type of console to use (optional) * @param {String} type - The type of console to use (optional)
* @description * @description
* Retrieves information used to get to a remote console for the given host. * Retrieves information used to get to a remote console for the given host.
* *
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function getConsoleInfo(instanceId, type) { function getConsoleInfo(instanceId, type) {
var config = {}; var config = {};
if (type) { if (type) {
config.console_type = type; config.console_type = type;
} }
return apiService.post('/api/nova/servers/' + instanceId + '/console-info/ ', config) return apiService.post('/api/nova/servers/' + instanceId + '/console-info/ ', config)
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to load the server console i nfo.')); toastService.add('error', gettext('Unable to load the server console i nfo.'));
}); });
} }
/** /**
* @name getServerVolumes * @name getServerVolumes
* @param {String} instanceId - The server ID * @param {String} instanceId - The server ID
* @description * @description
* Retrieves information about volumes associated with the server * Retrieves information about volumes associated with the server
* *
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function getServerVolumes(instanceId) { function getServerVolumes(instanceId) {
return apiService.get('/api/nova/servers/' + instanceId + '/volumes/') return apiService.get('/api/nova/servers/' + instanceId + '/volumes/')
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to load the server volumes.' )); toastService.add('error', gettext('Unable to load the server volumes.' ));
}); });
} }
/** /**
* @name getServerSecurityGroups * @name getServerSecurityGroups
* @param {String} ID - The server ID * @param {String} ID - The server ID
* @description * @description
* Retrieves information about security groups associated with the server * Retrieves information about security groups associated with the server
* *
* @returns {Object} The result of the API call * @returns {Object} The result of the API call
*/ */
function getServerSecurityGroups(instanceId) { function getServerSecurityGroups(instanceId) {
return apiService.get('/api/nova/servers/' + instanceId + '/security-group s/') return apiService.get('/api/nova/servers/' + instanceId + '/security-group s/')
.error(function () { .catch(function onError() {
toastService.add('error', gettext('Unable to load the server security groups.')); toastService.add('error', gettext('Unable to load the server security groups.'));
}); });
} }
} }
}()); }());
 End of changes. 41 change blocks. 
41 lines changed or deleted 42 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)