Shows various details about the account & servers
323207
def dump_info():
    ''''''
    vultr = Vultr(API_KEY)

    try:
        logging.info('Listing account info:\n%s', dumps(
            vultr.account.info(), indent=2
        ))

        logging.info('Listing apps:\n%s', dumps(
            vultr.app.list(), indent=2
        ))

        logging.info('Listing backups:\n%s', dumps(
            vultr.backup.list(), indent=2
        ))

        logging.info('Listing DNS:\n%s', dumps(
            vultr.dns.list(), indent=2
        ))

        logging.info('Listing ISOs:\n%s', dumps(
            vultr.iso.list(), indent=2
        ))

        logging.info('Listing OSs:\n%s', dumps(
            vultr.os.list(), indent=2
        ))

        logging.info('Listing plans:\n%s', dumps(
            vultr.plans.list(), indent=2
        ))

        logging.info('Listing regions:\n%s', dumps(
            vultr.regions.list(), indent=2
        ))

        logging.info('Listing servers:\n%s', dumps(
            vultr.server.list(), indent=2
        ))

        logging.info('Listing snapshots:\n%s', dumps(
            vultr.snapshot.list(), indent=2
        ))

        logging.info('Listing SSH keys:\n%s', dumps(
            vultr.sshkey.list(), indent=2
        ))

        logging.info('Listing startup scripts:\n%s', dumps(
            vultr.startupscript.list(), indent=2
        ))
    except VultrError as ex:
        logging.error('VultrError: %s', ex)
434576
def show(self, username):
        """"""
        filter = ['(objectclass=posixAccount)', "(uid={})".format(username)]
        return self.client.search(filter)
148152
def summary(self):
        """"""
        return "\n".join([
            "Transaction:",
            "  When:        " + self.date.strftime("%a %d %b %Y"),
            "  Description: " + self.desc.replace('\n', ' '),
            "  For amount:  {}".format(self.amount),
            "  From:        {}".format(
                ", ".join(map(lambda x: x.account, self.src)) if self.src \
                    else "UNKNOWN"
            ),
            "  To:          {}".format(
                ", ".join(map(lambda x: x.account, self.dst)) if self.dst \
                    else "UNKNOWN"
            ),
            ""
        ])
709810
def _debug_info(self):
        
        self._msg('DEBUG')
        self._msg2('WorkDir: {0}'.format(self._curdir))
        self._msg2('Cookies: {0}'.format(self._session.cookies))
        self._msg2('Headers: {0}'.format(self._session.headers))
        self._msg2('Configs: {0}'.format(self._config))
        self._msg2('Customs: {0}'.format(self._custom))
        self._msg2('Account: {0}'.format(self._account))
1048269
def user_info(self):
        
        account_uri = self.uri.split('/api/v1')[0] + '/account'
        req = self.request(account_uri)
        account_info = req.get()
        user_data = HTMLParser(account_info.content)
        return user_data
49156
def server_list_detailed(self):
        '''
        
        '''
        nt_ks = self.compute_conn
        ret = {}
        for item in nt_ks.servers.list():
            try:
                ret[item.name] = {
                    'OS-EXT-SRV-ATTR': {},
                    'OS-EXT-STS': {},
                    'accessIPv4': item.accessIPv4,
                    'accessIPv6': item.accessIPv6,
                    'addresses': item.addresses,
                    'created': item.created,
                    'flavor': {'id': item.flavor['id'],
                               'links': item.flavor['links']},
                    'hostId': item.hostId,
                    'id': item.id,
                    'image': {'id': item.image['id'] if item.image else 'Boot From Volume',
                              'links': item.image['links'] if item.image else ''},
                    'key_name': item.key_name,
                    'links': item.links,
                    'metadata': item.metadata,
                    'name': item.name,
                    'state': item.status,
                    'tenant_id': item.tenant_id,
                    'updated': item.updated,
                    'user_id': item.user_id,
                }
            except TypeError:
                continue

            ret[item.name]['progress'] = getattr(item, 'progress', '0')

            if hasattr(item.__dict__, 'OS-DCF:diskConfig'):
                ret[item.name]['OS-DCF'] = {
                    'diskConfig': item.__dict__['OS-DCF:diskConfig']
                }
            if hasattr(item.__dict__, 'OS-EXT-SRV-ATTR:host'):
                ret[item.name]['OS-EXT-SRV-ATTR']['host'] = \
                    item.__dict__['OS-EXT-SRV-ATTR:host']
            if hasattr(item.__dict__, 'OS-EXT-SRV-ATTR:hypervisor_hostname'):
                ret[item.name]['OS-EXT-SRV-ATTR']['hypervisor_hostname'] = \
                    item.__dict__['OS-EXT-SRV-ATTR:hypervisor_hostname']
            if hasattr(item.__dict__, 'OS-EXT-SRV-ATTR:instance_name'):
                ret[item.name]['OS-EXT-SRV-ATTR']['instance_name'] = \
                    item.__dict__['OS-EXT-SRV-ATTR:instance_name']
            if hasattr(item.__dict__, 'OS-EXT-STS:power_state'):
                ret[item.name]['OS-EXT-STS']['power_state'] = \
                    item.__dict__['OS-EXT-STS:power_state']
            if hasattr(item.__dict__, 'OS-EXT-STS:task_state'):
                ret[item.name]['OS-EXT-STS']['task_state'] = \
                    item.__dict__['OS-EXT-STS:task_state']
            if hasattr(item.__dict__, 'OS-EXT-STS:vm_state'):
                ret[item.name]['OS-EXT-STS']['vm_state'] = \
                    item.__dict__['OS-EXT-STS:vm_state']
            if hasattr(item.__dict__, 'security_groups'):
                ret[item.name]['security_groups'] = \
                    item.__dict__['security_groups']
        return ret
664020
def params(self):
        
        params = {}
        params["access_token"] = self.access_token
        params["account_id"] = self.account_id
        params["alert_id"] = self.alert_id

        if self.since_id:
            params["since_id"] = self.since_id
        else:
            params["before_date"] = self.before_date if self.before_date else ""
            params["not_before_date"] = self.not_before_date if self.before_date else ""
            params["cursor"] = self.cursor if self.cursor else ""

        if self.unread:
            params["unread"] = self.unread
        else:
            if (self.favorite) and (
                (self.folder == "inbox") or (self.folder == "archive")):
                params["favorite"] = self.favorite
                params["folder"] = self.folder
            else:
                 params["folder"] = self.folder if self.folder else ""   
            params["q"] = self.q if self.q else ""
            params["tone"] = self.tone if self.tone else ""

        if int(self.limit) > 1000:
            params["limit"] = "1000"
        elif int(self.limit) < 1:
            params["limit"] = ""
        else:
            params["limit"] = self.limit

        params["source"] = self.source if self.source else ""

        params["countries"] = self.countries if self.countries else ""
        params["include_children"] = self.include_children if self.include_children else ""
        params["sort"] = self.sort if self.sort else ""
        params["languages"] = self.languages if self.languages else ""
        params["timezone"] = self.timezone if self.timezone else ""

        # Deletes parameter if it does not have a value
        for key, value in list(params.items()):
            if value == '':
                del params[key]

        return params
567784
function(accountInfo) {
    var self = this,
      rpcs = this.getRPCs(),
      schema = {
        'name' : this.getName(),
        'title' : this.getTitle(),
        'description' : this.getDescription(),
        'icon' : this.getIcon(accountInfo),
        'auth' : this.getAuth(),
        'rpcs' : this.getRPCs(),
        'url' : this.getBPMAttr('url'),
        'actions' : this.formatActions(),
        'tags' : this.getTags()
      },
      authType = this.getAuth().strategy;

    // attach auth binders
    if (authType == 'oauth') {
      schema.auth.scopes = this.getConfig().oauth.scopes || [];
      schema.auth._href = self.options.baseUrl + '/rpc/oauth/' + this.getName() + '/auth';
    } else if (authType == 'issuer_token') {
      schema.auth._href = self.options.baseUrl + '/rpc/issuer_token/' +  this.getName() + '/set';
    }

    schema.auth.properties = this.getAuthProperties();

    return schema;
  }
1138121
def process_account(account_info):
    """"""
    log = logging.getLogger('salactus.bucket-iterator')
    log.info("processing account %s", account_info)
    session = get_session(account_info)
    client = session.client('s3', config=s3config)
    buckets = client.list_buckets()['Buckets']

    connection.hset(
        'bucket-accounts', account_info['name'], json.dumps(account_info))

    for b in buckets:
        connection.hset(
            'bucket-ages', bucket_id(account_info, b['Name']),
            b['CreationDate'].isoformat())

    account_buckets = account_info.pop('buckets', None)
    buckets = [n['Name'] for n in buckets
               if not account_buckets or
               n['Name'] in account_buckets]
    account_not_buckets = account_info.pop('not-buckets', None)
    buckets = [n for n in buckets
               if not account_not_buckets or
               n not in account_not_buckets]
    log.info("processing %d buckets in account %s",
             len(buckets), account_info['name'])
    for bucket_set in chunks(buckets, 50):
        invoke(process_bucket_set, account_info, bucket_set)
827431
def system_info(self):
        """"""
        res = self.client.service.SystemInfo()
        res = {ustr(x[0]): x[1] for x in res[0]}

        to_str = lambda arr: '.'.join([ustr(x) for x in arr[0]])
        res['OSVersion'] = to_str(res['OSVersion'])
        res['RuntimeVersion'] = to_str(res['RuntimeVersion'])
        res['Version'] = to_str(res['Version'])

        res['Name'] = ustr(res['Name'])
        res['Server'] = ustr(res['Server'])
        res['LocalNameCheck'] = ustr(res['LocalNameCheck'])
        res['UserHostAddress'] = ustr(res['UserHostAddress'])

        return res
292991
function accountInfo(callback) {
    var path  = '/' + config.version + '/account/info.php';
    var params = {};
    return apiMethod(path, params, callback);
  }
741245
def show_account():
    
    click.echo("# tonomi api")
    for (key, env) in REVERSE_MAPPING.items():
        value = QUBELL.get(key, None)
        if value:
            click.echo("export %s='%s'" % (env, value))
    if any(map(lambda x: PROVIDER.get(x), REVERSE_PROVIDER_MAPPING.keys())):
        click.echo("# cloud account")
        for (key, env) in REVERSE_PROVIDER_MAPPING.items():
            value = PROVIDER.get(key, None)
            if value:
                click.echo("export %s='%s'" % (env, value))
833218
private CloudInstance getCloudInstanceDetails(String account,
                                                  Instance currInstance, Map<String, String> autoScaleMap, CloudInstanceRepository repository) {

        long lastUpdated = System.currentTimeMillis();
        CloudInstance instance = repository.findByInstanceId(currInstance.getInstanceId());
        if (instance != null) {
            lastUpdated = instance.getLastUpdatedDate();
        }
        CloudInstance object = new CloudInstance();
        object.setAccountNumber(account);
        object.setLastUpdatedDate(System.currentTimeMillis());
        object.setAge(getInstanceAge(currInstance));
        object.setCpuUtilization(getInstanceCPUSinceLastRun(currInstance.getInstanceId(), lastUpdated));
        object.setIsTagged(isInstanceTagged(currInstance));
        object.setIsStopped(isInstanceStopped(currInstance));
        object.setNetworkIn(getLastHourInstanceNetworkIn(currInstance.getInstanceId(), lastUpdated));
        object.setNetworkOut(getLastHourIntanceNetworkOut(currInstance.getInstanceId(), lastUpdated));
        object.setDiskRead(getLastHourInstanceDiskRead(currInstance.getInstanceId(), lastUpdated));
        object.setDiskWrite(getLastInstanceHourDiskWrite(currInstance.getInstanceId()));
        // rest of the details
        object.setImageId(currInstance.getImageId());
        object.setInstanceId(currInstance.getInstanceId());
        object.setInstanceType(currInstance.getInstanceType());
        object.setIsMonitored("enabled".equalsIgnoreCase(currInstance.getMonitoring().getState()));
        object.setPrivateDns(currInstance.getPrivateDnsName());
        object.setPrivateIp(currInstance.getPrivateIpAddress());
        object.setPublicDns(currInstance.getPublicDnsName());
        object.setPublicIp(currInstance.getPublicIpAddress());
        object.setVirtualNetworkId(currInstance.getVpcId());
        object.setRootDeviceName(currInstance.getRootDeviceName());
        object.setSubnetId(currInstance.getSubnetId());
        object.setAutoScaleName(autoScaleMap.getOrDefault(currInstance.getInstanceId(), "NONE"));
        object.setLastAction("ADD");
        List<Tag> tags = currInstance.getTags();

        if (!CollectionUtils.isEmpty(tags)) {
            for (Tag tag : tags) {
                NameValue nv = new NameValue(tag.getKey(), tag.getValue());
                object.getTags().add(nv);
            }
        }
        List<GroupIdentifier> groups = currInstance.getSecurityGroups();
        for (GroupIdentifier gi : groups) {
            object.addSecurityGroups(gi.getGroupName());
        }

        return object;
    }
52323
def show_info(self):
        """"""

        deltas = self.__get_delta_files()

        table = [['Version', 'Name', 'Type', 'Status']]

        for dir_ in deltas:
            print('delta files in dir: ', dir_)

            for delta in deltas[dir_]:
                line = [delta.get_version(), delta.get_name()]
                if delta.get_type() == DeltaType.PRE_PYTHON:
                    line.append('pre py')
                elif delta.get_type() == DeltaType.PRE_SQL:
                    line.append('pre sql')
                elif delta.get_type() == DeltaType.PYTHON:
                    line.append('delta py')
                elif delta.get_type() == DeltaType.SQL:
                    line.append('delta sql')
                elif delta.get_type() == DeltaType.POST_PYTHON:
                    line.append('post py')
                elif delta.get_type() == DeltaType.POST_SQL:
                    line.append('post sql')

                if self.__is_applied(delta):
                    line.append('Applied')
                else:
                    line.append('Pending')

                table.append(line)

        self.__print_table(table)

        print('')
        print('Applied upgrades in database')

        query = """SELECT
                version,
                description,
                type,
                installed_by,
                installed_on,
                success
                FROM {}
                """.format(self.upgrades_table)

        self.cursor.execute(query)
        records = self.cursor.fetchall()

        table = [['Version', 'Name', 'Type', 'Installed by', 'Installed on',
                  'Status']]

        for i in records:
            line = [str(i[0]), str(i[1])]
            delta_type = i[2]
            if delta_type == 0:
                line.append('baseline')
            elif delta_type == DeltaType.PRE_PYTHON:
                line.append('pre py')
            elif delta_type == DeltaType.PRE_SQL:
                line.append('pre sql')
            elif delta_type == DeltaType.PYTHON:
                line.append('delta py')
            elif delta_type == DeltaType.SQL:
                line.append('delta sql')
            elif delta_type == DeltaType.POST_PYTHON:
                line.append('post py')
            elif delta_type == DeltaType.POST_SQL:
                line.append('post sql')

            line.append(str(i[3]))
            line.append(str(i[4]))

            success = str(i[5])
            if success == 'True':
                line.append('Success')
            else:
                line.append('Failed')

            table.append(line)

        self.__print_table(table)
1230103
def network_info(host=None,
                 admin_username=None,
                 admin_password=None,
                 module=None):
    '''
    
    '''

    inv = inventory(host=host, admin_username=admin_username,
                    admin_password=admin_password)
    if inv is None:
        cmd = {}
        cmd['retcode'] = -1
        cmd['stdout'] = 'Problem getting switch inventory'
        return cmd

    if module not in inv.get('switch') and module not in inv.get('server'):
        cmd = {}
        cmd['retcode'] = -1
        cmd['stdout'] = 'No module {0} found.'.format(module)
        return cmd

    cmd = __execute_ret('getniccfg', host=host,
                        admin_username=admin_username,
                        admin_password=admin_password,
                        module=module)

    if cmd['retcode'] != 0:
        log.warning('racadm returned an exit code of %s', cmd['retcode'])

    cmd['stdout'] = 'Network:\n' + 'Device = ' + module + '\n' + \
                    cmd['stdout']
    return __parse_drac(cmd['stdout'])
964478
def get_account_details(self, account):
        
        result = self.get_user(account.username)
        if result is None:
            result = {}
        return result
560290
def listaccounts(ctx):
    
    t = PrettyTable(["Name", "Key", "Owner", "Active", "Memo"])
    for key in ctx.blockchain.wallet.getPublicKeys(True):
        for account in ctx.blockchain.wallet.getAccountsFromPublicKey(key):
            account = Account(account)
            is_owner = key in [x[0] for x in account["owner"]["key_auths"]]
            is_active = key in [x[0] for x in account["active"]["key_auths"]]
            is_memo = key == account["options"]["memo_key"]
            t.add_row(
                [
                    account["name"],
                    key,
                    "x" if is_owner else "",
                    "x" if is_active else "",
                    "x" if is_memo else "",
                ]
            )
    click.echo(t)