Exemplo n.º 1
0
 def list_flavor_extra_specs(self, flavor_id):
     """Get extra Specs details of the mentioned flavor."""
     resp, body = self.get('flavors/%s/os-extra_specs' % flavor_id)
     body = json.loads(body)
     self.validate_response(schema_extra_specs.set_get_flavor_extra_specs,
                            resp, body)
     return rest_client.ResponseBody(resp, body)
Exemplo n.º 2
0
 def list_flavor_access(self, flavor_id):
     """Get flavor access information given the flavor id."""
     resp, body = self.get('flavors/%s/os-flavor-access' % flavor_id)
     body = json.loads(body)
     self.validate_response(schema_access.add_remove_list_flavor_access,
                            resp, body)
     return rest_client.ResponseBody(resp, body)
Exemplo n.º 3
0
 def show_baremetal_node(self, baremetal_node_id):
     """Return the details of a single baremetal node."""
     url = 'os-baremetal-nodes/%s' % baremetal_node_id
     resp, body = self.get(url)
     body = json.loads(body)
     self.validate_response(schema.get_baremetal_node, resp, body)
     return rest_client.ResponseBody(resp, body)
 def delete_floating_ips_bulk(self, ip_range):
     """Deletes the provided floating IPs in bulk."""
     post_body = json.dumps({'ip_range': ip_range})
     resp, body = self.put('os-floating-ips-bulk/delete', post_body)
     body = json.loads(body)
     self.validate_response(schema.delete_floating_ips_bulk, resp, body)
     return rest_client.ResponseBody(resp, body)
Exemplo n.º 5
0
 def update_resource(self, uri, post_data):
     req_uri = self.uri_prefix + uri
     req_post_data = json.dumps(post_data)
     resp, body = self.put(req_uri, req_post_data)
     body = json.loads(body)
     self.expected_success(200, resp.status)
     return rest_client.ResponseBody(resp, body)
Exemplo n.º 6
0
 def show_image(self, image_id):
     """Return the details of a single image."""
     resp, body = self.get("images/%s" % image_id)
     self.expected_success(200, resp.status)
     body = json.loads(body)
     self.validate_response(schema.get_image, resp, body)
     return rest_client.ResponseBody(resp, body)
Exemplo n.º 7
0
    def reboot_host(self, hostname):
        """Reboot a host."""

        resp, body = self.get("os-hosts/%s/reboot" % hostname)
        body = json.loads(body)
        self.validate_response(schema.reboot_host, resp, body)
        return rest_client.ResponseBody(resp, body)
Exemplo n.º 8
0
 def show_security_group(self, security_group_id):
     """Get the details of a Security Group."""
     url = "os-security-groups/%s" % security_group_id
     resp, body = self.get(url)
     body = json.loads(body)
     self.validate_response(schema.get_security_group, resp, body)
     return rest_client.ResponseBody(resp, body)
Exemplo n.º 9
0
    def startup_host(self, hostname):
        """Startup a host."""

        resp, body = self.get("os-hosts/%s/startup" % hostname)
        body = json.loads(body)
        self.validate_response(schema.startup_host, resp, body)
        return rest_client.ResponseBody(resp, body)
Exemplo n.º 10
0
    def shutdown_host(self, hostname):
        """Shutdown a host."""

        resp, body = self.get("os-hosts/%s/shutdown" % hostname)
        body = json.loads(body)
        self.validate_response(schema.shutdown_host, resp, body)
        return rest_client.ResponseBody(resp, body)
Exemplo n.º 11
0
    def show_host(self, hostname):
        """Show detail information for the host."""

        resp, body = self.get("os-hosts/%s" % hostname)
        body = json.loads(body)
        self.validate_response(schema.get_host_detail, resp, body)
        return rest_client.ResponseBody(resp, body)
Exemplo n.º 12
0
 def show_volume(self, volume_id):
     """Return the details of a single volume."""
     url = "os-volumes/%s" % volume_id
     resp, body = self.get(url)
     body = json.loads(body)
     self.validate_response(schema.create_get_volume, resp, body)
     return rest_client.ResponseBody(resp, body)
Exemplo n.º 13
0
 def list_instance_actions(self, server_id):
     """List the provided server action."""
     resp, body = self.get("servers/%s/os-instance-actions" %
                           server_id)
     body = json.loads(body)
     self.validate_response(schema.list_instance_actions, resp, body)
     return rest_client.ResponseBody(resp, body)
Exemplo n.º 14
0
 def list_volume_attachments(self, server_id):
     """Returns the list of volume attachments for a given instance."""
     resp, body = self.get('servers/%s/os-volume_attachments' % (
         server_id))
     body = json.loads(body)
     self.validate_response(schema.list_volume_attachments, resp, body)
     return rest_client.ResponseBody(resp, body)
 def list_instance_usage_audit_logs(self):
     url = 'os-instance_usage_audit_log'
     resp, body = self.get(url)
     body = json.loads(body)
     self.validate_response(schema.list_instance_usage_audit_log, resp,
                            body)
     return rest_client.ResponseBody(resp, body)
Exemplo n.º 16
0
 def create_certificate(self):
     """Create a certificate."""
     url = "os-certificates"
     resp, body = self.post(url, None)
     body = json.loads(body)
     self.validate_response(schema.create_certificate, resp, body)
     return rest_client.ResponseBody(resp, body)
Exemplo n.º 17
0
 def list_addresses_by_network(self, server_id, network_id):
     """Lists all addresses of a specific network type for a server."""
     resp, body = self.get("servers/%s/ips/%s" %
                           (server_id, network_id))
     body = json.loads(body)
     self.validate_response(schema.list_addresses_by_network, resp, body)
     return rest_client.ResponseBody(resp, body)
Exemplo n.º 18
0
 def list_virtual_interfaces(self, server_id):
     """List the virtual interfaces used in an instance."""
     resp, body = self.get('/'.join(
         ['servers', server_id, 'os-virtual-interfaces']))
     body = json.loads(body)
     self.validate_response(schema.list_virtual_interfaces, resp, body)
     return rest_client.ResponseBody(resp, body)
 def list_security_group_default_rules(self):
     """List all Security Group default rules."""
     resp, body = self.get('os-security-group-default-rules')
     body = json.loads(body)
     self.validate_response(schema.list_security_group_default_rules, resp,
                            body)
     return rest_client.ResponseBody(resp, body)
Exemplo n.º 20
0
 def show_instance_action(self, server_id, request_id):
     """Returns the action details of the provided server."""
     resp, body = self.get("servers/%s/os-instance-actions/%s" %
                           (server_id, request_id))
     body = json.loads(body)
     self.validate_response(schema.show_instance_action, resp, body)
     return rest_client.ResponseBody(resp, body)
Exemplo n.º 21
0
 def show_floating_ip(self, floating_ip_id):
     """Get the details of a floating IP."""
     url = "os-floating-ips/%s" % floating_ip_id
     resp, body = self.get(url)
     body = json.loads(body)
     self.validate_response(schema.create_get_floating_ip, resp, body)
     return rest_client.ResponseBody(resp, body)
Exemplo n.º 22
0
 def show_volume_attachment(self, server_id, volume_id):
     """Return details about the given volume attachment."""
     resp, body = self.get('servers/%s/os-volume_attachments/%s' %
                           (server_id, volume_id))
     body = json.loads(body)
     self.validate_response(schema.show_volume_attachment, resp, body)
     return rest_client.ResponseBody(resp, body)
Exemplo n.º 23
0
    def show_default_quota_set(self, tenant_id):
        """List the default quota set for a tenant."""

        url = 'os-quota-sets/%s/defaults' % tenant_id
        resp, body = self.get(url)
        body = json.loads(body)
        self.validate_response(schema.get_quota_set, resp, body)
        return rest_client.ResponseBody(resp, body)
 def show_security_group_default_rule(self, security_group_default_rule_id):
     """Return the details of provided Security Group default rule."""
     resp, body = self.get('os-security-group-default-rules/%s' %
                           security_group_default_rule_id)
     body = json.loads(body)
     self.validate_response(schema.create_get_security_group_default_rule,
                            resp, body)
     return rest_client.ResponseBody(resp, body)
 def delete_security_group_default_rule(self,
                                        security_group_default_rule_id):
     """Delete the provided Security Group default rule."""
     resp, body = self.delete('os-security-group-default-rules/%s' %
                              (security_group_default_rule_id))
     self.validate_response(schema.delete_security_group_default_rule, resp,
                            body)
     return rest_client.ResponseBody(resp, body)
Exemplo n.º 26
0
 def update_attached_volume(self, server_id, attachment_id, **kwargs):
     """Swaps a volume attached to an instance for another volume"""
     post_body = json.dumps({'volumeAttachment': kwargs})
     resp, body = self.put(
         'servers/%s/os-volume_attachments/%s' % (server_id, attachment_id),
         post_body)
     self.validate_response(schema.update_attached_volume, resp, body)
     return rest_client.ResponseBody(resp, body)
Exemplo n.º 27
0
 def attach_volume(self, server_id, **kwargs):
     """Attaches a volume to a server instance."""
     post_body = json.dumps({'volumeAttachment': kwargs})
     resp, body = self.post('servers/%s/os-volume_attachments' % server_id,
                            post_body)
     body = json.loads(body)
     self.validate_response(schema.attach_volume, resp, body)
     return rest_client.ResponseBody(resp, body)
Exemplo n.º 28
0
 def set_server_metadata_item(self, server_id, key, meta):
     post_body = json.dumps({'meta': meta})
     resp, body = self.put('servers/%s/metadata/%s' % (server_id, key),
                           post_body)
     body = json.loads(body)
     self.validate_response(schema.set_show_server_metadata_item, resp,
                            body)
     return rest_client.ResponseBody(resp, body)
Exemplo n.º 29
0
    def show_quota_class_set(self, quota_class_id):
        """List the quota class set for a quota class."""

        url = 'os-quota-class-sets/%s' % quota_class_id
        resp, body = self.get(url)
        body = json.loads(body)
        self.validate_response(classes_schema.get_quota_class_set, resp, body)
        return rest_client.ResponseBody(resp, body)
Exemplo n.º 30
0
    def delete_cluster(self, cluster_id):
        """Delete a cluster

        :param cluster_id: The ID of the cluster to delete
        """
        resp, body = self.delete('clusters/%s' % str(cluster_id))
        self.expected_success(202, resp.status)
        return rest_client.ResponseBody(resp, body)