Code stringlengths 103 85.9k | Summary listlengths 0 94 |
|---|---|
Please provide a description of the function:def create(cls, paas_info, vhost, alter_zone, background):
if not background and not cls.intty():
background = True
params = {'paas_id': paas_info['id'],
'vhost': vhost,
'zone_alter': alter_zone}
... | [
" Create a new vhost. "
] |
Please provide a description of the function:def list(gandi, state, id, limit, datacenter):
options = {
'items_per_page': limit,
}
if state:
options['state'] = state
if datacenter:
options['datacenter_id'] = gandi.datacenter.usable_id(datacenter)
output_keys = ['hostnam... | [
"List virtual machines."
] |
Please provide a description of the function:def info(gandi, resource, stat):
output_keys = ['hostname', 'state', 'cores', 'memory', 'console',
'datacenter', 'ip']
justify = 14
if stat is True:
sampler = {'unit': 'hours', 'value': 1, 'function': 'max'}
time_range = 36... | [
"Display information about a virtual machine.\n\n Resource can be a Hostname or an ID\n "
] |
Please provide a description of the function:def reboot(gandi, background, resource):
output_keys = ['id', 'type', 'step']
resource = sorted(tuple(set(resource)))
opers = gandi.iaas.reboot(resource, background)
if background:
for oper in opers:
output_generic(gandi, oper, outpu... | [
"Reboot a virtual machine.\n\n Resource can be a Hostname or an ID\n "
] |
Please provide a description of the function:def delete(gandi, background, force, resource):
output_keys = ['id', 'type', 'step']
resource = sorted(tuple(set(resource)))
possible_resources = gandi.iaas.resource_list()
for item in resource:
if item not in possible_resources:
gan... | [
"Delete a virtual machine.\n\n Resource can be a Hostname or an ID\n "
] |
Please provide a description of the function:def create(gandi, datacenter, memory, cores, ip_version, bandwidth, login,
password, hostname, image, run, background, sshkey, size, vlan, ip,
script, script_args, ssh, gen_password):
try:
gandi.datacenter.is_opened(datacenter, 'iaas')
... | [
"Create a new virtual machine.\n\n you can specify a configuration entry named 'sshkey' containing\n path to your sshkey file\n\n $ gandi config set [-g] sshkey ~/.ssh/id_rsa.pub\n\n or getting the sshkey \"my_key\" from your gandi ssh keyring\n\n $ gandi config set [-g] sshkey my_key\n\n to know ... |
Please provide a description of the function:def update(gandi, resource, memory, cores, console, password, background,
reboot):
pwd = None
if password:
pwd = click.prompt('password', hide_input=True,
confirmation_prompt=True)
max_memory = None
if memor... | [
"Update a virtual machine.\n\n Resource can be a Hostname or an ID\n "
] |
Please provide a description of the function:def console(gandi, resource):
gandi.echo('/!\ Please be aware that if you didn\'t provide a password '
'during creation, console service will be unavailable.')
gandi.echo('/!\ You can use "gandi vm update" command to set a password.')
gandi.ec... | [
"Open a console to virtual machine.\n\n Resource can be a Hostname or an ID\n "
] |
Please provide a description of the function:def ssh(gandi, resource, login, identity, wipe_key, wait, args):
if '@' in resource:
(login, resource) = resource.split('@', 1)
if wipe_key:
gandi.iaas.ssh_keyscan(resource)
if wait:
gandi.iaas.wait_for_sshd(resource)
gandi.iaas.s... | [
"Spawn an SSH session to virtual machine.\n\n Resource can be a Hostname or an ID\n "
] |
Please provide a description of the function:def images(gandi, label, datacenter):
output_keys = ['label', 'os_arch', 'kernel_version', 'disk_id',
'dc', 'name']
datacenters = gandi.datacenter.list()
result = gandi.image.list(datacenter, label)
for num, image in enumerate(result)... | [
"List available system images for virtual machines.\n\n You can also filter results using label, by example:\n\n $ gandi vm images Ubuntu --datacenter LU\n\n or\n\n $ gandi vm images 'Ubuntu 10.04' --datacenter LU\n\n "
] |
Please provide a description of the function:def kernels(gandi, vm, datacenter, flavor, match):
if vm:
vm = gandi.iaas.info(vm)
dc_list = gandi.datacenter.filtered_list(datacenter, vm)
for num, dc in enumerate(dc_list):
if num:
gandi.echo('\n')
output_datacenter(g... | [
"List available kernels."
] |
Please provide a description of the function:def datacenters(gandi, id):
output_keys = ['iso', 'name', 'country', 'dc_code', 'status']
if id:
output_keys.append('id')
result = gandi.datacenter.list()
for num, dc in enumerate(result):
if num:
gandi.separator_line()
... | [
"List available datacenters."
] |
Please provide a description of the function:def migrate(gandi, resource, force, background, finalize):
if not gandi.iaas.check_can_migrate(resource):
return
if not force:
proceed = click.confirm('Are you sure you want to migrate VM %s ?'
% resource)
... | [
" Migrate a virtual machine to another datacenter. "
] |
Please provide a description of the function:def usable_id(cls, id):
hcs = cls.from_fqdn(id)
if hcs:
return [hc_['id'] for hc_ in hcs]
try:
return int(id)
except (TypeError, ValueError):
pass | [
" Retrieve id from single input. "
] |
Please provide a description of the function:def infos(cls, fqdn):
if isinstance(fqdn, (list, tuple)):
ids = []
for fqd_ in fqdn:
ids.extend(cls.infos(fqd_))
return ids
ids = cls.usable_id(fqdn)
if not ids:
return []
... | [
" Display information about hosted certificates for a fqdn. "
] |
Please provide a description of the function:def create(cls, key, crt):
options = {'crt': crt, 'key': key}
return cls.call('cert.hosted.create', options) | [
" Add a new crt in the hosted cert store. "
] |
Please provide a description of the function:def list(gandi, limit):
options = {'items_per_page': limit}
domains = gandi.domain.list(options)
for domain in domains:
gandi.echo(domain['fqdn'])
return domains | [
"List domains."
] |
Please provide a description of the function:def info(gandi, resource):
output_keys = ['fqdn', 'nameservers', 'services', 'zone_id', 'tags',
'created', 'expires', 'updated']
contact_field = ['owner', 'admin', 'bill', 'tech', 'reseller']
result = gandi.domain.info(resource)
outpu... | [
"Display information about a domain."
] |
Please provide a description of the function:def create(gandi, resource, domain, duration, owner, admin, tech, bill,
nameserver, extra_parameter, background):
if domain:
gandi.echo('/!\ --domain option is deprecated and will be removed '
'upon next release.')
gandi... | [
"Buy a domain."
] |
Please provide a description of the function:def renew(gandi, domain, duration, background):
result = gandi.domain.renew(domain, duration, background)
if background:
gandi.pretty_echo(result)
return result | [
"Renew a domain."
] |
Please provide a description of the function:def setup(gandi):
intro =
outro =
gandi.echo(intro)
gandi.init_config()
gandi.echo(outro) | [
" Initialize Gandi CLI configuration.\n\n Create global configuration directory with API credentials\n ",
"Welcome to GandiCLI, let's configure a few things before we \\\nstart.\n",
"\nSetup completed. You can now:\n* use 'gandi' to see all command.\n* use 'gandi vm create' to create and access a Virtual ... |
Please provide a description of the function:def api(gandi):
key_name = 'API version'
result = gandi.api.info()
result[key_name] = result.pop('api_version')
output_generic(gandi, result, [key_name])
return result | [
"Display information about API used."
] |
Please provide a description of the function:def help(ctx, command):
command = ' '.join(command)
if not command:
click.echo(cli.get_help(ctx))
return
cmd = cli.get_command(ctx, command)
if cmd:
click.echo(cmd.get_help(ctx))
else:
click.echo(cli.get_help(ctx)) | [
"Display help for a command."
] |
Please provide a description of the function:def status(gandi, service):
if not service:
global_status = gandi.status.status()
if global_status['status'] == 'FOGGY':
# something is going on but not affecting services
filters = {
'category': 'Incident',
... | [
"Display current status from status.gandi.net."
] |
Please provide a description of the function:def list(gandi, domain, limit):
options = {'items_per_page': limit}
result = gandi.forward.list(domain, options)
for forward in result:
output_forward(gandi, domain, forward)
return result | [
"List mail forwards for a domain."
] |
Please provide a description of the function:def create(gandi, address, destination):
source, domain = address
result = gandi.forward.create(domain, source, destination)
return result | [
"Create a domain mail forward."
] |
Please provide a description of the function:def update(gandi, address, dest_add, dest_del):
source, domain = address
if not dest_add and not dest_del:
gandi.echo('Nothing to update: you must provide destinations to '
'update, use --dest-add/-a or -dest-del/-d parameters.')
... | [
"Update a domain mail forward."
] |
Please provide a description of the function:def delete(gandi, address, force):
source, domain = address
if not force:
proceed = click.confirm('Are you sure to delete the domain '
'mail forward %s@%s ?' % (source, domain))
if not proceed:
return... | [
"Delete a domain mail forward."
] |
Please provide a description of the function:def list(gandi, domain, zone_id, output, format, limit):
options = {
'items_per_page': limit,
}
output_keys = ['name', 'type', 'value', 'ttl']
if not zone_id:
result = gandi.domain.info(domain)
zone_id = result['zone_id']
if... | [
"List DNS zone records for a domain."
] |
Please provide a description of the function:def create(gandi, domain, zone_id, name, type, value, ttl):
if not zone_id:
result = gandi.domain.info(domain)
zone_id = result['zone_id']
if not zone_id:
gandi.echo('No zone records found, domain %s doesn\'t seems to be '
... | [
"Create new DNS zone record entry for a domain."
] |
Please provide a description of the function:def delete(gandi, domain, zone_id, name, type, value):
if not zone_id:
result = gandi.domain.info(domain)
zone_id = result['zone_id']
if not zone_id:
gandi.echo('No zone records found, domain %s doesn\'t seems to be '
... | [
"Delete a record entry for a domain"
] |
Please provide a description of the function:def update(gandi, domain, zone_id, file, record, new_record):
if not zone_id:
result = gandi.domain.info(domain)
zone_id = result['zone_id']
if not zone_id:
gandi.echo('No zone records found, domain %s doesn\'t seems to be'
... | [
"Update records entries for a domain.\n\n You can update an individual record using --record and --new-record\n parameters\n\n Or you can use a plaintext file to update all records of a DNS zone at\n once with --file parameter.\n "
] |
Please provide a description of the function:def create(cls, domain, login, options, alias):
cls.echo('Creating your mailbox.')
result = cls.call('domain.mailbox.create', domain, login, options)
if alias:
cls.echo('Creating aliases.')
result = cls.set_alias(doma... | [
"Create a mailbox."
] |
Please provide a description of the function:def update(cls, domain, login, options, alias_add, alias_del):
cls.echo('Updating your mailbox.')
result = cls.call('domain.mailbox.update', domain, login, options)
if alias_add or alias_del:
current_aliases = cls.info(domain, lo... | [
"Update a mailbox."
] |
Please provide a description of the function:def purge(cls, domain, login, background=False):
oper = cls.call('domain.mailbox.purge', domain, login)
if background:
return oper
else:
cls.echo('Purging in progress')
cls.display_progress(oper) | [
"Purge a mailbox."
] |
Please provide a description of the function:def set_alias(cls, domain, login, aliases):
return cls.call('domain.mailbox.alias.set', domain, login, aliases) | [
"Update aliases on a mailbox."
] |
Please provide a description of the function:def parse_response(self, resp):
p, u = self.getparser()
p.feed(resp.content)
p.close()
return u.close() | [
"\n Parse the xmlrpc response.\n "
] |
Please provide a description of the function:def list(cls, zone_id, options=None):
options = options if options else {}
return cls.call('domain.zone.record.list', zone_id, 0, options) | [
"List zone records for a zone."
] |
Please provide a description of the function:def add(cls, zone_id, version_id, record):
return cls.call('domain.zone.record.add', zone_id, version_id, record) | [
"Add record to a zone."
] |
Please provide a description of the function:def create(cls, zone_id, record):
cls.echo('Creating new zone version')
new_version_id = Zone.new(zone_id)
cls.echo('Updating zone version')
cls.add(zone_id, new_version_id, record)
cls.echo('Activation of new zone version')... | [
"Create a new zone version for record."
] |
Please provide a description of the function:def delete(cls, zone_id, record):
cls.echo('Creating new zone record')
new_version_id = Zone.new(zone_id)
cls.echo('Deleting zone record')
cls.call('domain.zone.record.delete', zone_id, new_version_id, record)
cls.echo('Acti... | [
"Delete a record for a zone"
] |
Please provide a description of the function:def zone_update(cls, zone_id, records):
cls.echo('Creating new zone file')
new_version_id = Zone.new(zone_id)
cls.echo('Updating zone records')
cls.call('domain.zone.record.set', zone_id, new_version_id, records)
cls.echo('A... | [
"Update records for a zone"
] |
Please provide a description of the function:def update(cls, zone_id, old_record, new_record):
cls.echo('Creating new zone file')
new_version_id = Zone.new(zone_id)
new_record = new_record.replace(' IN', '')
new_record = new_record.split(' ', 4)
params_newrecord = {'nam... | [
"Update a record in a zone file"
] |
Please provide a description of the function:def list(gandi, limit, id, names):
options = {
'items_per_page': limit,
}
output_keys = ['name', 'state', 'date_creation']
if id:
# When we will have more than paas vhost, we will append rproxy_id
output_keys.append('paas_id')
... | [
" List vhosts. "
] |
Please provide a description of the function:def info(gandi, resource, id):
output_keys = ['name', 'state', 'date_creation', 'paas_name', 'ssl']
if id:
# When we will have more than paas vhost, we will append rproxy_id
output_keys.append('paas_id')
paas_names = gandi.paas.list_names()... | [
" Display information about a vhost.\n\n Resource must be the vhost fqdn.\n "
] |
Please provide a description of the function:def create(gandi, vhost, paas, ssl, private_key, alter_zone, poll_cert,
background):
if not gandi.hostedcert.activate_ssl(vhost, ssl, private_key, poll_cert):
return
paas_info = gandi.paas.info(paas)
result = gandi.vhost.create(paas_info,... | [
" Create a new vhost. "
] |
Please provide a description of the function:def update(gandi, resource, ssl, private_key, poll_cert):
gandi.hostedcert.activate_ssl(resource, ssl, private_key, poll_cert) | [
" Update a vhost.\n\n Right now you can only activate ssl on the vhost.\n "
] |
Please provide a description of the function:def delete(gandi, resource, force, background):
output_keys = ['name', 'paas_id', 'state', 'date_creation']
if not force:
proceed = click.confirm('Are you sure to delete vhost %s?' %
resource)
if not proceed:
... | [
" Delete a vhost. "
] |
Please provide a description of the function:def option(*param_decls, **attrs):
def decorator(f):
_param_memo(f, GandiOption(param_decls, **attrs))
return f
return decorator | [
"Attach an option to the command.\n\n All positional arguments are passed as parameter declarations\n to :class:`Option`, all keyword arguments are forwarded unchanged.\n This is equivalent to creating an :class:`Option` instance manually and\n attaching it to the :attr:`Command.params` list.\n "
] |
Please provide a description of the function:def choices(self):
if not self._choices:
gandi = self.gandi or GandiContextHelper()
self._choices = self._get_choices(gandi)
if not self._choices:
api = gandi.get_api_connector()
gandi.echo(... | [
" Retrieve choices from API if possible"
] |
Please provide a description of the function:def _get_choices(self, gandi):
iso_codes = []
dc_codes = []
for item in gandi.datacenter.list():
iso_codes.append(item['iso'])
if item.get('dc_code'):
dc_codes.append(item['dc_code'])
return dc_... | [
" Internal method to get choices list "
] |
Please provide a description of the function:def _get_choices(self, gandi):
image_list = []
for item in gandi.image.list():
label = item['label']
if item['visibility'] == 'deprecated':
label = '*%s' % label
image_list.append(label)
dis... | [
" Internal method to get choices list "
] |
Please provide a description of the function:def convert(self, value, param, ctx):
self.gandi = ctx.obj
# remove deprecated * prefix
choices = [choice.replace('*', '') for choice in self.choices]
value = value.replace('*', '')
# Exact match
if value in choices:
... | [
" Try to find correct disk image regarding version. "
] |
Please provide a description of the function:def _get_choices(self, gandi):
kernel_families = list(gandi.kernel.list().values())
return [kernel for klist in kernel_families for kernel in klist] | [
" Internal method to get choices list "
] |
Please provide a description of the function:def convert(self, value, param, ctx):
self.gandi = ctx.obj
# Exact match first
if value in self.choices:
return value
# Also try with x86-64 suffix
new_value = '%s-x86_64' % value
if new_value in self.choi... | [
" Try to find correct kernel regarding version. "
] |
Please provide a description of the function:def _get_choices(self, gandi):
return [str(item['id'])
for item in gandi.snapshotprofile.list(target=self.target)] | [
" Internal method to get choices list "
] |
Please provide a description of the function:def convert(self, value, param, ctx):
self.gandi = ctx.obj
value = click.Choice.convert(self, value, param, ctx)
return int(value) | [
" Convert value to int. "
] |
Please provide a description of the function:def _get_choices(self, gandi):
packages = super(CertificatePackageType, self)._get_choices(gandi)
return list(set([pack.split('_')[1] for pack in packages])) | [
" Internal method to get choices list "
] |
Please provide a description of the function:def _get_choices(self, gandi):
packages = super(CertificatePackageMax, self)._get_choices(gandi)
ret = list(set([pack.split('_')[2] for pack in packages]))
if 'w' in ret:
ret.remove('w')
return ret | [
" Internal method to get choices list "
] |
Please provide a description of the function:def convert(self, value, param, ctx):
rxp = '^[^@]+?@[-.a-z0-9]+$'
regex = re.compile(rxp, re.I)
try:
if regex.match(value):
value = value.split("@")
return value
else:
s... | [
" Validate value using regexp. "
] |
Please provide a description of the function:def convert(self, value, param, ctx):
rxp = "^(((([1]?\d)?\d|2[0-4]\d|25[0-5])\.){3}(([1]?\d)?\d|2[0-4]\d|"\
"25[0-5]))|([\da-fA-F]{1,4}(\:[\da-fA-F]{1,4}){7})|(([\da-fA-F]"\
"{1,4}:){0,5}::([\da-fA-F]{1,4}:)"\
"{0,5... | [
" Validate value using regexp. "
] |
Please provide a description of the function:def display_value(self, ctx, value):
gandi = ctx.obj
gandi.log('%s: %s' % (self.name, (value if value is not None
else 'Not found'))) | [
" Display value to be used for this parameter. "
] |
Please provide a description of the function:def get_default(self, ctx):
value = click.Option.get_default(self, ctx)
if not self.prompt:
# value found in default display it
self.display_value(ctx, value)
return value | [
" Retrieve default value and display it when prompt disabled. "
] |
Please provide a description of the function:def consume_value(self, ctx, opts):
value = click.Option.consume_value(self, ctx, opts)
if not value:
# value not found by click on command line
# now check using our context helper in order into
# local configurat... | [
" Retrieve default value and display it when prompt is disabled. "
] |
Please provide a description of the function:def handle_parse_result(self, ctx, opts, args):
gandi = ctx.obj
needs_update = False
value, args = click.Option.handle_parse_result(self, ctx, opts, args)
if value is not None:
previous_value = gandi.get(global_=True, key... | [
" Save value for this option in configuration\n if key/value pair doesn't already exist.\n Or old value in config was deprecated\n it needs to be updated to the new value format\n but the value keeps the same \"meaning\"\n "
] |
Please provide a description of the function:def create(cls, fqdn, duration, owner, admin, tech, bill, nameserver,
extra_parameter, background):
fqdn = fqdn.lower()
if not background and not cls.intty():
background = True
result = cls.call('domain.available',... | [
"Create a domain."
] |
Please provide a description of the function:def renew(cls, fqdn, duration, background):
fqdn = fqdn.lower()
if not background and not cls.intty():
background = True
domain_info = cls.info(fqdn)
current_year = domain_info['date_registry_end'].year
domain_pa... | [
"Renew a domain."
] |
Please provide a description of the function:def autorenew_deactivate(cls, fqdn):
fqdn = fqdn.lower()
result = cls.call('domain.autorenew.deactivate', fqdn)
return result | [
"Activate deautorenew"
] |
Please provide a description of the function:def autorenew_activate(cls, fqdn):
fqdn = fqdn.lower()
result = cls.call('domain.autorenew.activate', fqdn)
return result | [
"Activate autorenew"
] |
Please provide a description of the function:def from_fqdn(cls, fqdn):
result = cls.list({'fqdn': fqdn})
if len(result) > 0:
return result[0]['id'] | [
"Retrieve domain id associated to a FQDN."
] |
Please provide a description of the function:def list(gandi, only_data, only_snapshot, attached, detached, type, id, vm,
snapshotprofile, datacenter, limit):
options = {
'items_per_page': limit,
}
if attached and detached:
raise UsageError('You cannot use both --attached and -... | [
" List disks. "
] |
Please provide a description of the function:def info(gandi, resource):
output_keys = ['name', 'state', 'size', 'type', 'id', 'dc', 'vm',
'profile', 'kernel', 'cmdline']
resource = sorted(tuple(set(resource)))
vms = dict([(vm['id'], vm) for vm in gandi.iaas.list()])
datacenters ... | [
" Display information about a disk.\n\n Resource can be a disk name or ID\n "
] |
Please provide a description of the function:def detach(gandi, resource, background, force):
resource = sorted(tuple(set(resource)))
if not force:
proceed = click.confirm('Are you sure you want to detach %s?' %
', '.join(resource))
if not proceed:
... | [
" Detach disks from currectly attached vm.\n\n Resource can be a disk name, or ID\n "
] |
Please provide a description of the function:def attach(gandi, disk, vm, position, read_only, background, force):
if not force:
proceed = click.confirm("Are you sure you want to attach disk '%s'"
" to vm '%s'?" % (disk, vm))
if not proceed:
return
... | [
" Attach disk to vm.\n\n disk can be a disk name, or ID\n vm can be a vm name, or ID\n "
] |
Please provide a description of the function:def update(gandi, resource, cmdline, kernel, name, size,
snapshotprofile, delete_snapshotprofile, background):
if snapshotprofile and delete_snapshotprofile:
raise UsageError('You must not set snapshotprofile and '
'delete... | [
" Update a disk.\n\n Resource can be a disk name, or ID\n "
] |
Please provide a description of the function:def delete(gandi, resource, force, background):
output_keys = ['id', 'type', 'step']
resource = sorted(tuple(set(resource)))
if not force:
disk_info = "'%s'" % ', '.join(resource)
proceed = click.confirm('Are you sure you want to delete disk... | [
" Delete a disk. "
] |
Please provide a description of the function:def create(gandi, name, vm, size, snapshotprofile, datacenter, source,
background):
try:
gandi.datacenter.is_opened(datacenter, 'iaas')
except DatacenterLimited as exc:
gandi.echo('/!\ Datacenter %s will be closed on %s, '
... | [
" Create a new disk. "
] |
Please provide a description of the function:def snapshot(gandi, name, resource, background):
name = name or randomstring('snp')
source_info = gandi.disk.info(resource)
datacenter = source_info['datacenter_id']
result = gandi.disk.create(name, None, None, None, datacenter, resource,
... | [
" Create a snapshot on the fly. "
] |
Please provide a description of the function:def rollback(gandi, resource, background):
result = gandi.disk.rollback(resource, background)
if background:
gandi.pretty_echo(result)
return result | [
" Rollback a disk from a snapshot. "
] |
Please provide a description of the function:def migrate(gandi, resource, force, background):
# check it's not attached
source_info = gandi.disk.info(resource)
if source_info['vms_id']:
click.echo('Cannot start the migration: disk %s is attached. '
'Please detach the disk bef... | [
" Migrate a disk to another datacenter. "
] |
Please provide a description of the function:def format_list(data):
if isinstance(data, (list, tuple)):
to_clean = ['[', ']', '(', ')', "'"]
for item in to_clean:
data = str(data).replace("u\"", "\"").replace("u\'", "\'")
data = str(data).replace(item, '')
return dat... | [
" Remove useless characters to output a clean list."
] |
Please provide a description of the function:def output_line(gandi, key, val, justify):
msg = ('%%-%ds:%%s' % justify) % (key, (' %s' % val) if val else '')
gandi.echo(msg) | [
" Base helper to output a key value using left justify."
] |
Please provide a description of the function:def output_generic(gandi, data, output_keys, justify=10):
for key in output_keys:
if key in data:
output_line(gandi, key, data[key], justify) | [
" Generic helper to output info from a data dict."
] |
Please provide a description of the function:def output_account(gandi, account, output_keys, justify=17):
output_generic(gandi, account, output_keys, justify)
if 'prepaid' in output_keys:
prepaid = '%s %s' % (account['prepaid_info']['amount'],
account['prepaid_info']['... | [
" Helper to output an account information."
] |
Please provide a description of the function:def output_vm(gandi, vm, datacenters, output_keys, justify=10):
output_generic(gandi, vm, output_keys, justify)
if 'datacenter' in output_keys:
for dc in datacenters:
if dc['id'] == vm['datacenter_id']:
dc_name = dc.get('dc_c... | [
" Helper to output a vm information."
] |
Please provide a description of the function:def output_metric(gandi, metrics, key, justify=10):
for metric in metrics:
key_name = metric[key].pop()
values = [point.get('value', 0) for point in metric['points']]
graph = sparks(values) if max(values) else ''
# need to encode in u... | [
" Helper to output metrics."
] |
Please provide a description of the function:def output_vhost(gandi, vhost, paas, output_keys, justify=14):
output_generic(gandi, vhost, output_keys, justify)
if 'paas_name' in output_keys:
output_line(gandi, 'paas_name', paas, justify) | [
" Helper to output a vhost information."
] |
Please provide a description of the function:def output_paas(gandi, paas, datacenters, vhosts, output_keys, justify=11):
output_generic(gandi, paas, output_keys, justify)
if 'sftp_server' in output_keys:
output_line(gandi, 'sftp_server', paas['ftp_server'], justify)
if 'vhost' in output_keys:... | [
" Helper to output a paas information."
] |
Please provide a description of the function:def output_image(gandi, image, datacenters, output_keys, justify=14,
warn_deprecated=True):
for key in output_keys:
if key in image:
if (key == 'label' and image['visibility'] == 'deprecated' and
warn_depreca... | [
" Helper to output a disk image."
] |
Please provide a description of the function:def output_kernels(gandi, flavor, name_list, justify=14):
output_line(gandi, 'flavor', flavor, justify)
for name in name_list:
output_line(gandi, 'version', name, justify) | [
" Helper to output kernel flavor versions."
] |
Please provide a description of the function:def output_datacenter(gandi, datacenter, output_keys, justify=14):
output_generic(gandi, datacenter, output_keys, justify)
if 'dc_name' in output_keys:
output_line(gandi, 'datacenter', datacenter['name'], justify)
if 'status' in output_keys:
... | [
" Helper to output datacenter information."
] |
Please provide a description of the function:def output_disk(gandi, disk, datacenters, vms, profiles, output_keys,
justify=10):
output_generic(gandi, disk, output_keys, justify)
if 'kernel' in output_keys and disk.get('kernel_version'):
output_line(gandi, 'kernel', disk['kernel_ver... | [
" Helper to output a disk."
] |
Please provide a description of the function:def output_sshkey(gandi, sshkey, output_keys, justify=12):
output_generic(gandi, sshkey, output_keys, justify) | [
" Helper to output an ssh key information."
] |
Please provide a description of the function:def output_snapshot_profile(gandi, profile, output_keys, justify=13):
schedules = 'schedules' in output_keys
if schedules:
output_keys.remove('schedules')
output_generic(gandi, profile, output_keys, justify)
if schedules:
schedule_keys =... | [
" Helper to output a snapshot_profile."
] |
Please provide a description of the function:def output_contact_info(gandi, data, output_keys, justify=10):
for key in output_keys:
if data[key]:
output_line(gandi, key, data[key]['handle'], justify) | [
"Helper to output chosen contacts info."
] |
Please provide a description of the function:def output_cert(gandi, cert, output_keys, justify=13):
output = list(output_keys)
display_altnames = False
if 'altnames' in output:
display_altnames = True
output.remove('altnames')
display_output = False
if 'cert' in output:
... | [
"Helper to output a certificate information."
] |
Please provide a description of the function:def output_vlan(gandi, vlan, datacenters, output_keys, justify=10):
output_generic(gandi, vlan, output_keys, justify)
if 'dc' in output_keys:
for dc in datacenters:
if dc['id'] == vlan.get('datacenter_id',
... | [
" Helper to output a vlan information."
] |
Please provide a description of the function:def output_iface(gandi, iface, datacenters, vms, output_keys, justify=10):
output_generic(gandi, iface, output_keys, justify)
if 'vm' in output_keys:
vm_name = vms.get(iface['vm_id'], {}).get('hostname')
if vm_name:
output_line(gandi... | [
" Helper to output an iface information."
] |
Please provide a description of the function:def output_ip(gandi, ip, datacenters, vms, ifaces, output_keys, justify=11):
output_generic(gandi, ip, output_keys, justify)
if 'type' in output_keys:
iface = ifaces.get(ip['iface_id'])
type_ = 'private' if iface.get('vlan') else 'public'
... | [
" Helper to output an ip information."
] |
Please provide a description of the function:def output_json(gandi, format, value):
if format == 'json':
gandi.echo(json.dumps(value, default=date_handler, sort_keys=True))
elif format == 'pretty-json':
gandi.echo(json.dumps(value, default=date_handler, sort_keys=True,
... | [
" Helper to show json output "
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.