List and manage agents.
    (admin privilege required)
439798
def agents(status, all):
    '''
    
    '''
    fields = [
        ('ID', 'id'),
        ('Status', 'status'),
        ('Region', 'region'),
        ('First Contact', 'first_contact'),
        ('CPU Usage (%)', 'cpu_cur_pct'),
        ('Used Memory (MiB)', 'mem_cur_bytes'),
        ('Total slots', 'available_slots'),
        ('Occupied slots', 'occupied_slots'),
    ]
    if is_legacy_server():
        del fields[9]
        del fields[6]

    def execute_paginated_query(limit, offset):
        try:
            resp_agents = session.Agent.list_with_limit(
                limit, offset, status, fields=(item[1] for item in fields))
        except Exception as e:
            print_error(e)
            sys.exit(1)
        return resp_agents

    def round_mem(results):
        for item in results:
            if 'mem_cur_bytes' in item and item['mem_cur_bytes'] is not None:
                item['mem_cur_bytes'] = round(item['mem_cur_bytes'] / 2 ** 20, 1)
        return results

    def _generate_paginated_results(interval):
        offset = 0
        is_first = True
        total_count = -1
        while True:
            limit = (interval if is_first else
                    min(interval, total_count - offset))
            try:
                result = execute_paginated_query(limit, offset)
            except Exception as e:
                print_error(e)
                sys.exit(1)
            offset += interval
            total_count = result['total_count']
            items = result['items']
            items = round_mem(items)
            table = tabulate((item.values() for item in items),
                                headers=(item[0] for item in fields))
            if is_first:
                is_first = False
            else:
                table_rows = table.split('\n')
                table = '\n'.join(table_rows[2:])
            yield table + '\n'

            if not offset < total_count:
                break

    with Session() as session:
        paginating_interval = 10
        if all:
            click.echo_via_pager(_generate_paginated_results(paginating_interval))
        else:
            result = execute_paginated_query(paginating_interval, offset=0)
            total_count = result['total_count']
            if total_count == 0:
                print('There are no matching agents.')
                return
            items = result['items']
            items = round_mem(items)
            fields = [field for field in fields if field[1] in items[0]]
            print(tabulate((item.values() for item in items),
                            headers=(item[0] for item in fields)))
            if total_count > paginating_interval:
                print("More agents can be displayed by using --all option.")
608801
def agent_list(self, deep_sorted=False):
        """"""
        ag_list = []
        for ag_name in self._agent_order:
            ag_attr = getattr(self, ag_name)
            if isinstance(ag_attr, Concept) or ag_attr is None:
                ag_list.append(ag_attr)
            elif isinstance(ag_attr, list):
                if not all([isinstance(ag, Concept) for ag in ag_attr]):
                    raise TypeError("Expected all elements of list to be Agent "
                                    "and/or Concept, but got: %s"
                                    % {type(ag) for ag in ag_attr})
                if deep_sorted:
                    ag_attr = sorted_agents(ag_attr)
                ag_list.extend(ag_attr)
            else:
                raise TypeError("Expected type Agent, Concept, or list, got "
                                "type %s." % type(ag_attr))
        return ag_list
862119
def get_agents():
    """"""

    agent_list = []
    agents = __get_all_agents()
    for agent in agents:
        agent_list.append(agent["hostname"])

    return agent_list
1189246
def add_workflow_responsibilities(role, agents)
        Hyrax::Workflow::PermissionGenerator.call(roles: role,
                                                  workflow: self,
                                                  agents: agents)
      end
386290
def profiles(self):
        '''
        
        '''
        limit = []

        if self.is_admin():
            limit.append(_("Administrator"))
        limit.sort()

        return limit
296907
def list_loadbalancers_on_lbaas_agent(self, lbaas_agent, **_params):
        """"""
        return self.get((self.agent_path + self.AGENT_LOADBALANCERS) %
                        lbaas_agent, params=_params)
177400
def create_permissao_administrativa(self):
        """"""
        return PermissaoAdministrativa(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
866836
def get_couchdb_admins():
    '''
        
    '''
    user_list = []
    req = curl_couchdb('/_config/admins/')

    for user in req.json().keys():
        user_list.append(user)

    return user_list
895975
def agents():
    """"""
    print 'The following LiveSync agents are active:'
    agent_list = LiveSyncAgent.find().order_by(LiveSyncAgent.backend_name, db.func.lower(LiveSyncAgent.name)).all()
    table_data = [['ID', 'Name', 'Backend', 'Initial Export', 'Queue']]
    for agent in agent_list:
        initial = (cformat('%{green!}done%{reset}') if agent.initial_data_exported else
                   cformat('%{yellow!}pending%{reset}'))
        if agent.backend is None:
            backend_title = cformat('%{red!}invalid backend ({})%{reset}').format(agent.backend_name)
        else:
            backend_title = agent.backend.title
        table_data.append([unicode(agent.id), agent.name, backend_title, initial,
                           unicode(agent.queue.filter_by(processed=False).count())])
    table = AsciiTable(table_data)
    table.justify_columns[4] = 'right'
    print table.table
    if not all(a.initial_data_exported for a in agent_list):
        print
        print "You need to perform the initial data export for some agents."
        print cformat("To do so, run "
                      "%{yellow!}indico livesync initial_export %{reset}%{yellow}<agent_id>%{reset} for those agents.")
1213075
def list_agents(self):
        ''''''
        t = text_helper.Table(fields=("Agent ID", "Agent class", "State"),
                              lengths=(40, 25, 15))

        return t.render((a._descriptor.doc_id, a.log_category,
                         a._get_machine_state().name)
                        for a in self._agents)
366438
def list_account_admins(self, account_id, user_id=None):
        
        path = {}
        data = {}
        params = {}

        # REQUIRED - PATH - account_id
        """ID"""
        path["account_id"] = account_id

        # OPTIONAL - user_id
        """Scope the results to those with user IDs equal to any of the IDs specified here."""
        if user_id is not None:
            params["user_id"] = user_id

        self.logger.debug("GET /api/v1/accounts/{account_id}/admins with query params: {params} and form data: {data}".format(params=params, data=data, **path))
        return self.generic_request("GET", "/api/v1/accounts/{account_id}/admins".format(**path), data=data, params=params, all_pages=True)
751267
def user_agent_excluded?
      request.user_agent.to_s.downcase =~ Regexp.union([self.mobylette_options[:skip_user_agents]].flatten.map(&:to_s))
    end
134760
def get_agents(self):
        
        if self.retrieved:
            raise errors.IllegalState('List has already been retrieved.')
        self.retrieved = True
        return objects.AgentList(self._results, runtime=self._runtime)
12996
public function listAction(Request $request)
    {
        $this->denyAccessUnlessGranted('ROLE_SUPER_ADMIN');

        $em = $this->getDoctrine()->getManager();
        /* @var AdminList $adminlist */
        $adminlist = $this->container->get('kunstmaan_adminlist.factory')->createList(new RoleAdminListConfigurator($em));
        $adminlist->bindRequest($request);

        return array(
            'adminlist' => $adminlist,
        );
    }
1285253
def list_users(self, limit=None, marker=None):
        """"""
        return self._user_manager.list(limit=limit, marker=marker)
528102
function (list, location, ext, sequence, perms, title, src) {
			var actions = list.get_userCustomActions();

			var action = actions.add();

			action.set_title(title);
			action.set_location(location);
			action.set_commandUIExtension(ext);
			action.set_sequence(sequence || 0);
			(src && action.set_scriptSrc(src));
			if (perms)
				action.set_rights(perms);
			action.update();
			ctx.load(action);
			var dfd = $.Deferred();

			ctx.executeQueryAsync(function () {
				trace.log("addCustomAction.done");
				dfd.resolve(action);
			}, function (r, a) { ns.sp.reqFailure(r, a, "addCustomAction", dfd); });

			return dfd.promise();
		}
235554
def cli(env, identifier):
    """"""

    mgr = SoftLayer.ObjectStorageManager(env.client)
    credential_list = mgr.list_credential(identifier)
    table = formatting.Table(['id', 'password', 'username', 'type_name'])

    for credential in credential_list:
        table.add_row([
            credential['id'],
            credential['password'],
            credential['username'],
            credential['type']['name']
        ])

    env.fout(table)