def create(self, params=None):
        '''Creates a new provision request on the account

        :param dict params: Additional POST request data
        :returns: ProvisionRequest dictionary object
        '''
        params = update_params(params, {'action': 'create'})
        return normalize_object(
            self.client.call('post', '/provision_requests', data=params))
    def create(self, params=None):
        '''Creates a new provision request on the account

        :param dict params: Additional POST request data
        :returns: ProvisionRequest dictionary object
        '''
        params = update_params(params, {'action': 'create'})
        return normalize_object(
            self.client.call('post', '/provision_requests', data=params))
    def perform_action(self, _id, action, params=None):
        '''Sends a request to perform an action on a provision request

        :param string _id: Specifies which provision request the request is for
        :param string action: The action to request (delete, refresh, etc.)
        :param dict params: Additional POST request data
        :returns: ProvisionRequest dictionary object
        '''
        params = update_params(params, {'action': action})
        return normalize_object(
            self.client.call('post', '/provision_requests/%s' %
                             _id, data=params))
    def perform_action(self, _id, action, params=None):
        '''Sends a request to perform an action on a provision request

        :param string _id: Specifies which provision request the request is for
        :param string action: The action to request (delete, refresh, etc.)
        :param dict params: Additional POST request data
        :returns: ProvisionRequest dictionary object
        '''
        params = update_params(params, {'action': action})
        return normalize_object(
            self.client.call('post',
                             '/provision_requests/%s' % _id,
                             data=params))
Beispiel #5
0
    def get(self, _id, params=None):
        '''Retrieve details about a task on the account

        :param string _id: Specifies which task the request is for
        :param dict params: response-level options (attributes, limit, etc.)
        :returns: Dictionary representing the matching task

        Example::

            # Gets a list of all tasks (returns IDs only)
            tasks = task_mgr.list({'attributes': 'id'})
            for task in tasks:
                task_details = task_mgr.get(task['id'])
        '''
        params = update_params(params, {'expand': 'resources'})
        return normalize_object(
            self.client.call('get', '/tasks/%s' % _id, params=params))
Beispiel #6
0
    def get(self, _id, params=None):
        '''Retrieve details about a tag on the account

        :param string _id: Specifies which tag the request is for
        :param dict params: response-level options (attributes, limit, etc.)
        :returns: Dictionary representing the matching tag

        Example::

            # Gets a list of all tags (returns IDs only)
            tags = tag_mgr.list({'attributes': 'id'})
            for tag in tags:
                tag_details = tag_mgr.get(tag['id'])
        '''
        params = update_params(params, {'expand': 'resources'})
        return normalize_object(
            self.client.call('get', '/tags/%s' % _id, params=params))
Beispiel #7
0
    def get(self, _id, params=None):
        '''Retrieve details about a virtual server on the account

        :param string _id: Specifies which virtual server the request is for
        :param dict params: response-level options (attributes, limit, etc.)
        :returns: Dictionary representing the matching virtual server

        Example::

            # Gets a list of all virtual server instances (returns IDs only)
            instances = vs_mgr.list({'attributes': 'id'})
            for instance in instances:
                vs_details = vs_mgr.get(instance['id'])
        '''
        params = update_params(params, {'expand': 'resources'})
        return normalize_object(
            self.client.call('get', '/vms/%s' % _id, params=params))
Beispiel #8
0
    def get(self, _id, params=None):
        '''Retrieve details about a provider on the account

        :param string _id: Specifies which provider the request is for
        :param dict params: response-level options (attributes, limit, etc.)
        :returns: Dictionary representing the matching provider

        Example::

            # Gets a list of all providers (returns IDs only)
            providers = provider_mgr.list({'attributes': 'id'})
            for provider in providers:
                provider_details = provider_mgr.get(provider['id'])
        '''
        params = update_params(params, {'expand': 'resources'})
        return normalize_object(
            self.client.call('get', '/providers/%s' % _id, params=params))
Beispiel #9
0
    def get(self, _id, params=None):
        '''Retrieve details about a virtual server on the account

        :param string _id: Specifies which virtual server the request is for
        :param dict params: response-level options (attributes, limit, etc.)
        :returns: Dictionary representing the matching virtual server

        Example::

            # Gets a list of all virtual server instances (returns IDs only)
            instances = vs_mgr.list({'attributes': 'id'})
            for instance in instances:
                vs_details = vs_mgr.get(instance['id'])
        '''
        params = update_params(params, {'expand': 'resources'})
        return normalize_object(
            self.client.call('get', '/vms/%s' % _id, params=params))
Beispiel #10
0
    def get(self, _id, params=None):
        '''Retrieve details about a provider on the account

        :param string _id: Specifies which provider the request is for
        :param dict params: response-level options (attributes, limit, etc.)
        :returns: Dictionary representing the matching provider

        Example::

            # Gets a list of all providers (returns IDs only)
            providers = provider_mgr.list({'attributes': 'id'})
            for provider in providers:
                provider_details = provider_mgr.get(provider['id'])
        '''
        params = update_params(params, {'expand': 'resources'})
        return normalize_object(
            self.client.call('get', '/providers/%s' % _id, params=params))
Beispiel #11
0
    def perform_action(self, _id, action, params=None):
        '''Sends a request to perform an action on a virtual server

        :param string _id: Specifies which virtual server the request is for
        :param string action: The action to request (start, stop, suspend)
        :param dict params: Additional POST request data
        :returns: Task request dictionary (see TaskManager)

        Example::

            # Gets a list of all virtual server instances
            for vsi in vs_mgr.list():
                # Send requests to start all virtual server instances
                vs_mgr.perform_action(vsi['id'], 'start')
        '''
        params = update_params(params, {'action': action})
        return normalize_object(
            self.client.call('post', '/vms/%s' % _id, data=params))
Beispiel #12
0
    def perform_action(self, _id, action, params=None):
        '''Sends a request to perform an action on a provider

        :param string _id: Specifies which provider the request is for
        :param string action: The action to request (delete, refresh, etc.)
        :param dict params: Additional POST request data
        :returns: Task request, or Provider, dictionary object

        Example::

            # Gets a list of all providers
            for provider in provider_mgr.list():
                # Send requests to refresh all providers
                provider_mgr.perform_action(provider['id'], 'refresh')
        '''
        params = update_params(params, {'action': action})
        return normalize_object(
            self.client.call('post', '/providers/%s' % _id, data=params))
Beispiel #13
0
    def perform_action(self, _id, action, params=None):
        '''Sends a request to perform an action on a virtual server

        :param string _id: Specifies which virtual server the request is for
        :param string action: The action to request (start, stop, suspend)
        :param dict params: Additional POST request data
        :returns: Task request dictionary (see TaskManager)

        Example::

            # Gets a list of all virtual server instances
            for vsi in vs_mgr.list():
                # Send requests to start all virtual server instances
                vs_mgr.perform_action(vsi['id'], 'start')
        '''
        params = update_params(params, {'action': action})
        return normalize_object(
            self.client.call('post', '/vms/%s' % _id, data=params))
Beispiel #14
0
    def perform_action(self, _id, action, params=None):
        '''Sends a request to perform an action on a provider

        :param string _id: Specifies which provider the request is for
        :param string action: The action to request (delete, refresh, etc.)
        :param dict params: Additional POST request data
        :returns: Task request, or Provider, dictionary object

        Example::

            # Gets a list of all providers
            for provider in provider_mgr.list():
                # Send requests to refresh all providers
                provider_mgr.perform_action(provider['id'], 'refresh')
        '''
        params = update_params(params, {'action': action})
        return normalize_object(
            self.client.call('post', '/providers/%s' % _id, data=params))
Beispiel #15
0
    def create(self, params=None):
        '''Creates a new provider on the account (pass-through params)

        :param dict params: Additional POST request data
        :returns: Provider dictionary object

        Example::

            # Creates a new provider using pass-through params
            provider = provider_mgr.create({
                'type': 'EmsRedhat',
                'name': 'rhevm101',
                'hostname': 'rhevm101',
                'ipaddress': '127.0.0.1',
                'credentials': {
                    'userid': 'admin',
                    'password': '******'
                }
            })
            # Refresh the provider
            provider_mgr.refresh(provider['id'])
        '''
        return normalize_object(
            self.client.call('post', '/providers', data=params))
Beispiel #16
0
    def create(self, params=None):
        '''Creates a new provider on the account (pass-through params)

        :param dict params: Additional POST request data
        :returns: Provider dictionary object

        Example::

            # Creates a new provider using pass-through params
            provider = provider_mgr.create({
                'type': 'EmsRedhat',
                'name': 'rhevm101',
                'hostname': 'rhevm101',
                'ipaddress': '127.0.0.1',
                'credentials': {
                    'userid': 'admin',
                    'password': '******'
                }
            })
            # Refresh the provider
            provider_mgr.refresh(provider['id'])
        '''
        return normalize_object(
            self.client.call('post', '/providers', data=params))