repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
Gandi/gandi.cli | gandi/cli/commands/record.py | update | def update(gandi, domain, zone_id, file, record, new_record):
"""Update records entries for a domain.
You can update an individual record using --record and --new-record
parameters
Or you can use a plaintext file to update all records of a DNS zone at
once with --file parameter.
"""
if not... | python | def update(gandi, domain, zone_id, file, record, new_record):
"""Update records entries for a domain.
You can update an individual record using --record and --new-record
parameters
Or you can use a plaintext file to update all records of a DNS zone at
once with --file parameter.
"""
if not... | [
"def",
"update",
"(",
"gandi",
",",
"domain",
",",
"zone_id",
",",
"file",
",",
"record",
",",
"new_record",
")",
":",
"if",
"not",
"zone_id",
":",
"result",
"=",
"gandi",
".",
"domain",
".",
"info",
"(",
"domain",
")",
"zone_id",
"=",
"result",
"[",... | Update records entries for a domain.
You can update an individual record using --record and --new-record
parameters
Or you can use a plaintext file to update all records of a DNS zone at
once with --file parameter. | [
"Update",
"records",
"entries",
"for",
"a",
"domain",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/record.py#L174-L200 | train |
Gandi/gandi.cli | gandi/cli/modules/mail.py | Mail.set_alias | def set_alias(cls, domain, login, aliases):
"""Update aliases on a mailbox."""
return cls.call('domain.mailbox.alias.set', domain, login, aliases) | python | def set_alias(cls, domain, login, aliases):
"""Update aliases on a mailbox."""
return cls.call('domain.mailbox.alias.set', domain, login, aliases) | [
"def",
"set_alias",
"(",
"cls",
",",
"domain",
",",
"login",
",",
"aliases",
")",
":",
"return",
"cls",
".",
"call",
"(",
"'domain.mailbox.alias.set'",
",",
"domain",
",",
"login",
",",
"aliases",
")"
] | Update aliases on a mailbox. | [
"Update",
"aliases",
"on",
"a",
"mailbox",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/mail.py#L82-L84 | train |
Gandi/gandi.cli | gandi/cli/modules/record.py | Record.list | def list(cls, zone_id, options=None):
"""List zone records for a zone."""
options = options if options else {}
return cls.call('domain.zone.record.list', zone_id, 0, options) | python | def list(cls, zone_id, options=None):
"""List zone records for a zone."""
options = options if options else {}
return cls.call('domain.zone.record.list', zone_id, 0, options) | [
"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. | [
"List",
"zone",
"records",
"for",
"a",
"zone",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/record.py#L36-L39 | train |
Gandi/gandi.cli | gandi/cli/modules/record.py | Record.add | def add(cls, zone_id, version_id, record):
"""Add record to a zone."""
return cls.call('domain.zone.record.add', zone_id, version_id, record) | python | def add(cls, zone_id, version_id, record):
"""Add record to a zone."""
return cls.call('domain.zone.record.add', zone_id, version_id, record) | [
"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. | [
"Add",
"record",
"to",
"a",
"zone",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/record.py#L42-L44 | train |
Gandi/gandi.cli | gandi/cli/modules/record.py | Record.create | def create(cls, zone_id, record):
"""Create a new zone version for 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')
... | python | def create(cls, zone_id, record):
"""Create a new zone version for 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')
... | [
"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... | Create a new zone version for record. | [
"Create",
"a",
"new",
"zone",
"version",
"for",
"record",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/record.py#L47-L58 | train |
Gandi/gandi.cli | gandi/cli/modules/record.py | Record.delete | def delete(cls, zone_id, record):
"""Delete a record for a zone"""
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('Activation of new... | python | def delete(cls, zone_id, record):
"""Delete a record for a zone"""
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('Activation of new... | [
"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",... | Delete a record for a zone | [
"Delete",
"a",
"record",
"for",
"a",
"zone"
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/record.py#L61-L72 | train |
Gandi/gandi.cli | gandi/cli/modules/record.py | Record.zone_update | def zone_update(cls, zone_id, records):
"""Update records for a zone"""
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('Activation of n... | python | def zone_update(cls, zone_id, records):
"""Update records for a zone"""
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('Activation of n... | [
"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'",
")",
"... | Update records for a zone | [
"Update",
"records",
"for",
"a",
"zone"
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/record.py#L75-L86 | train |
Gandi/gandi.cli | gandi/cli/modules/record.py | Record.update | def update(cls, zone_id, old_record, new_record):
"""Update a record in a zone file"""
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 = {'name': new_r... | python | def update(cls, zone_id, old_record, new_record):
"""Update a record in a zone file"""
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 = {'name': new_r... | [
"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",
".",
"re... | Update a record in a zone file | [
"Update",
"a",
"record",
"in",
"a",
"zone",
"file"
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/record.py#L89-L126 | train |
Gandi/gandi.cli | gandi/cli/commands/vhost.py | list | def list(gandi, limit, id, names):
""" List vhosts. """
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')
paas_names = {}
if... | python | def list(gandi, limit, id, names):
""" List vhosts. """
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')
paas_names = {}
if... | [
"def",
"list",
"(",
"gandi",
",",
"limit",
",",
"id",
",",
"names",
")",
":",
"options",
"=",
"{",
"'items_per_page'",
":",
"limit",
",",
"}",
"output_keys",
"=",
"[",
"'name'",
",",
"'state'",
",",
"'date_creation'",
"]",
"if",
"id",
":",
"# When we w... | List vhosts. | [
"List",
"vhosts",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/vhost.py#L22-L45 | train |
Gandi/gandi.cli | gandi/cli/commands/vhost.py | info | def info(gandi, resource, id):
""" Display information about a vhost.
Resource must be the vhost fqdn.
"""
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')
... | python | def info(gandi, resource, id):
""" Display information about a vhost.
Resource must be the vhost fqdn.
"""
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')
... | [
"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_i... | Display information about a vhost.
Resource must be the vhost fqdn. | [
"Display",
"information",
"about",
"a",
"vhost",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/vhost.py#L52-L79 | train |
Gandi/gandi.cli | gandi/cli/commands/vhost.py | update | def update(gandi, resource, ssl, private_key, poll_cert):
""" Update a vhost.
Right now you can only activate ssl on the vhost.
"""
gandi.hostedcert.activate_ssl(resource, ssl, private_key, poll_cert) | python | def update(gandi, resource, ssl, private_key, poll_cert):
""" Update a vhost.
Right now you can only activate ssl on the vhost.
"""
gandi.hostedcert.activate_ssl(resource, ssl, private_key, poll_cert) | [
"def",
"update",
"(",
"gandi",
",",
"resource",
",",
"ssl",
",",
"private_key",
",",
"poll_cert",
")",
":",
"gandi",
".",
"hostedcert",
".",
"activate_ssl",
"(",
"resource",
",",
"ssl",
",",
"private_key",
",",
"poll_cert",
")"
] | Update a vhost.
Right now you can only activate ssl on the vhost. | [
"Update",
"a",
"vhost",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/vhost.py#L119-L124 | train |
Gandi/gandi.cli | gandi/cli/core/params.py | option | def option(*param_decls, **attrs):
"""Attach an option to the command.
All positional arguments are passed as parameter declarations
to :class:`Option`, all keyword arguments are forwarded unchanged.
This is equivalent to creating an :class:`Option` instance manually and
attaching it to the :attr:`... | python | def option(*param_decls, **attrs):
"""Attach an option to the command.
All positional arguments are passed as parameter declarations
to :class:`Option`, all keyword arguments are forwarded unchanged.
This is equivalent to creating an :class:`Option` instance manually and
attaching it to the :attr:`... | [
"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.
All positional arguments are passed as parameter declarations
to :class:`Option`, all keyword arguments are forwarded unchanged.
This is equivalent to creating an :class:`Option` instance manually and
attaching it to the :attr:`Command.params` list. | [
"Attach",
"an",
"option",
"to",
"the",
"command",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/params.py#L586-L597 | train |
Gandi/gandi.cli | gandi/cli/core/params.py | GandiChoice.choices | def choices(self):
""" Retrieve choices from API if possible"""
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('... | python | def choices(self):
""" Retrieve choices from API if possible"""
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('... | [
"def",
"choices",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_choices",
":",
"gandi",
"=",
"self",
".",
"gandi",
"or",
"GandiContextHelper",
"(",
")",
"self",
".",
"_choices",
"=",
"self",
".",
"_get_choices",
"(",
"gandi",
")",
"if",
"not",
"... | Retrieve choices from API if possible | [
"Retrieve",
"choices",
"from",
"API",
"if",
"possible"
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/params.py#L28-L39 | train |
Gandi/gandi.cli | gandi/cli/core/params.py | DiskImageParamType.convert | def convert(self, value, param, ctx):
""" Try to find correct disk image regarding version. """
self.gandi = ctx.obj
# remove deprecated * prefix
choices = [choice.replace('*', '') for choice in self.choices]
value = value.replace('*', '')
# Exact match
if value i... | python | def convert(self, value, param, ctx):
""" Try to find correct disk image regarding version. """
self.gandi = ctx.obj
# remove deprecated * prefix
choices = [choice.replace('*', '') for choice in self.choices]
value = value.replace('*', '')
# Exact match
if value i... | [
"def",
"convert",
"(",
"self",
",",
"value",
",",
"param",
",",
"ctx",
")",
":",
"self",
".",
"gandi",
"=",
"ctx",
".",
"obj",
"# remove deprecated * prefix",
"choices",
"=",
"[",
"choice",
".",
"replace",
"(",
"'*'",
",",
"''",
")",
"for",
"choice",
... | Try to find correct disk image regarding version. | [
"Try",
"to",
"find",
"correct",
"disk",
"image",
"regarding",
"version",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/params.py#L128-L150 | train |
Gandi/gandi.cli | gandi/cli/core/params.py | KernelParamType.convert | def convert(self, value, param, ctx):
""" Try to find correct kernel regarding version. """
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 s... | python | def convert(self, value, param, ctx):
""" Try to find correct kernel regarding version. """
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 s... | [
"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... | Try to find correct kernel regarding version. | [
"Try",
"to",
"find",
"correct",
"kernel",
"regarding",
"version",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/params.py#L164-L177 | train |
Gandi/gandi.cli | gandi/cli/core/params.py | SnapshotParamType.convert | def convert(self, value, param, ctx):
""" Convert value to int. """
self.gandi = ctx.obj
value = click.Choice.convert(self, value, param, ctx)
return int(value) | python | def convert(self, value, param, ctx):
""" Convert value to int. """
self.gandi = ctx.obj
value = click.Choice.convert(self, value, param, ctx)
return int(value) | [
"def",
"convert",
"(",
"self",
",",
"value",
",",
"param",
",",
"ctx",
")",
":",
"self",
".",
"gandi",
"=",
"ctx",
".",
"obj",
"value",
"=",
"click",
".",
"Choice",
".",
"convert",
"(",
"self",
",",
"value",
",",
"param",
",",
"ctx",
")",
"return... | Convert value to int. | [
"Convert",
"value",
"to",
"int",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/params.py#L198-L202 | train |
Gandi/gandi.cli | gandi/cli/core/params.py | GandiOption.display_value | def display_value(self, ctx, value):
""" Display value to be used for this parameter. """
gandi = ctx.obj
gandi.log('%s: %s' % (self.name, (value if value is not None
else 'Not found'))) | python | def display_value(self, ctx, value):
""" Display value to be used for this parameter. """
gandi = ctx.obj
gandi.log('%s: %s' % (self.name, (value if value is not None
else 'Not found'))) | [
"def",
"display_value",
"(",
"self",
",",
"ctx",
",",
"value",
")",
":",
"gandi",
"=",
"ctx",
".",
"obj",
"gandi",
".",
"log",
"(",
"'%s: %s'",
"%",
"(",
"self",
".",
"name",
",",
"(",
"value",
"if",
"value",
"is",
"not",
"None",
"else",
"'Not foun... | Display value to be used for this parameter. | [
"Display",
"value",
"to",
"be",
"used",
"for",
"this",
"parameter",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/params.py#L526-L530 | train |
Gandi/gandi.cli | gandi/cli/core/params.py | GandiOption.get_default | def get_default(self, ctx):
""" Retrieve default value and display it when prompt disabled. """
value = click.Option.get_default(self, ctx)
if not self.prompt:
# value found in default display it
self.display_value(ctx, value)
return value | python | def get_default(self, ctx):
""" Retrieve default value and display it when prompt disabled. """
value = click.Option.get_default(self, ctx)
if not self.prompt:
# value found in default display it
self.display_value(ctx, value)
return value | [
"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",
"... | Retrieve default value and display it when prompt disabled. | [
"Retrieve",
"default",
"value",
"and",
"display",
"it",
"when",
"prompt",
"disabled",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/params.py#L532-L538 | train |
Gandi/gandi.cli | gandi/cli/core/params.py | GandiOption.consume_value | def consume_value(self, ctx, opts):
""" Retrieve default value and display it when prompt is disabled. """
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
... | python | def consume_value(self, ctx, opts):
""" Retrieve default value and display it when prompt is disabled. """
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
... | [
"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 che... | Retrieve default value and display it when prompt is disabled. | [
"Retrieve",
"default",
"value",
"and",
"display",
"it",
"when",
"prompt",
"is",
"disabled",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/params.py#L540-L560 | train |
Gandi/gandi.cli | gandi/cli/modules/domain.py | Domain.create | def create(cls, fqdn, duration, owner, admin, tech, bill, nameserver,
extra_parameter, background):
"""Create a domain."""
fqdn = fqdn.lower()
if not background and not cls.intty():
background = True
result = cls.call('domain.available', [fqdn])
while ... | python | def create(cls, fqdn, duration, owner, admin, tech, bill, nameserver,
extra_parameter, background):
"""Create a domain."""
fqdn = fqdn.lower()
if not background and not cls.intty():
background = True
result = cls.call('domain.available', [fqdn])
while ... | [
"def",
"create",
"(",
"cls",
",",
"fqdn",
",",
"duration",
",",
"owner",
",",
"admin",
",",
"tech",
",",
"bill",
",",
"nameserver",
",",
"extra_parameter",
",",
"background",
")",
":",
"fqdn",
"=",
"fqdn",
".",
"lower",
"(",
")",
"if",
"not",
"backgr... | Create a domain. | [
"Create",
"a",
"domain",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/domain.py#L30-L77 | train |
Gandi/gandi.cli | gandi/cli/modules/domain.py | Domain.from_fqdn | def from_fqdn(cls, fqdn):
"""Retrieve domain id associated to a FQDN."""
result = cls.list({'fqdn': fqdn})
if len(result) > 0:
return result[0]['id'] | python | def from_fqdn(cls, fqdn):
"""Retrieve domain id associated to a FQDN."""
result = cls.list({'fqdn': fqdn})
if len(result) > 0:
return result[0]['id'] | [
"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. | [
"Retrieve",
"domain",
"id",
"associated",
"to",
"a",
"FQDN",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/domain.py#L122-L126 | train |
Gandi/gandi.cli | gandi/cli/commands/disk.py | list | def list(gandi, only_data, only_snapshot, attached, detached, type, id, vm,
snapshotprofile, datacenter, limit):
""" List disks. """
options = {
'items_per_page': limit,
}
if attached and detached:
raise UsageError('You cannot use both --attached and --detached.')
if only_... | python | def list(gandi, only_data, only_snapshot, attached, detached, type, id, vm,
snapshotprofile, datacenter, limit):
""" List disks. """
options = {
'items_per_page': limit,
}
if attached and detached:
raise UsageError('You cannot use both --attached and --detached.')
if only_... | [
"def",
"list",
"(",
"gandi",
",",
"only_data",
",",
"only_snapshot",
",",
"attached",
",",
"detached",
",",
"type",
",",
"id",
",",
"vm",
",",
"snapshotprofile",
",",
"datacenter",
",",
"limit",
")",
":",
"options",
"=",
"{",
"'items_per_page'",
":",
"li... | List disks. | [
"List",
"disks",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/disk.py#L38-L85 | train |
Gandi/gandi.cli | gandi/cli/commands/disk.py | info | def info(gandi, resource):
""" Display information about a disk.
Resource can be a disk name or ID
"""
output_keys = ['name', 'state', 'size', 'type', 'id', 'dc', 'vm',
'profile', 'kernel', 'cmdline']
resource = sorted(tuple(set(resource)))
vms = dict([(vm['id'], vm) for vm ... | python | def info(gandi, resource):
""" Display information about a disk.
Resource can be a disk name or ID
"""
output_keys = ['name', 'state', 'size', 'type', 'id', 'dc', 'vm',
'profile', 'kernel', 'cmdline']
resource = sorted(tuple(set(resource)))
vms = dict([(vm['id'], vm) for vm ... | [
"def",
"info",
"(",
"gandi",
",",
"resource",
")",
":",
"output_keys",
"=",
"[",
"'name'",
",",
"'state'",
",",
"'size'",
",",
"'type'",
",",
"'id'",
",",
"'dc'",
",",
"'vm'",
",",
"'profile'",
",",
"'kernel'",
",",
"'cmdline'",
"]",
"resource",
"=",
... | Display information about a disk.
Resource can be a disk name or ID | [
"Display",
"information",
"about",
"a",
"disk",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/disk.py#L91-L111 | train |
Gandi/gandi.cli | gandi/cli/commands/disk.py | detach | def detach(gandi, resource, background, force):
""" Detach disks from currectly attached vm.
Resource can be a disk name, or ID
"""
resource = sorted(tuple(set(resource)))
if not force:
proceed = click.confirm('Are you sure you want to detach %s?' %
', '.join... | python | def detach(gandi, resource, background, force):
""" Detach disks from currectly attached vm.
Resource can be a disk name, or ID
"""
resource = sorted(tuple(set(resource)))
if not force:
proceed = click.confirm('Are you sure you want to detach %s?' %
', '.join... | [
"def",
"detach",
"(",
"gandi",
",",
"resource",
",",
"background",
",",
"force",
")",
":",
"resource",
"=",
"sorted",
"(",
"tuple",
"(",
"set",
"(",
"resource",
")",
")",
")",
"if",
"not",
"force",
":",
"proceed",
"=",
"click",
".",
"confirm",
"(",
... | Detach disks from currectly attached vm.
Resource can be a disk name, or ID | [
"Detach",
"disks",
"from",
"currectly",
"attached",
"vm",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/disk.py#L122-L138 | train |
Gandi/gandi.cli | gandi/cli/commands/disk.py | attach | def attach(gandi, disk, vm, position, read_only, background, force):
""" Attach disk to vm.
disk can be a disk name, or ID
vm can be a vm name, or ID
"""
if not force:
proceed = click.confirm("Are you sure you want to attach disk '%s'"
" to vm '%s'?" % (disk,... | python | def attach(gandi, disk, vm, position, read_only, background, force):
""" Attach disk to vm.
disk can be a disk name, or ID
vm can be a vm name, or ID
"""
if not force:
proceed = click.confirm("Are you sure you want to attach disk '%s'"
" to vm '%s'?" % (disk,... | [
"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'\"",
"\"... | Attach disk to vm.
disk can be a disk name, or ID
vm can be a vm name, or ID | [
"Attach",
"disk",
"to",
"vm",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/disk.py#L156-L181 | train |
Gandi/gandi.cli | gandi/cli/commands/disk.py | update | def update(gandi, resource, cmdline, kernel, name, size,
snapshotprofile, delete_snapshotprofile, background):
""" Update a disk.
Resource can be a disk name, or ID
"""
if snapshotprofile and delete_snapshotprofile:
raise UsageError('You must not set snapshotprofile and '
... | python | def update(gandi, resource, cmdline, kernel, name, size,
snapshotprofile, delete_snapshotprofile, background):
""" Update a disk.
Resource can be a disk name, or ID
"""
if snapshotprofile and delete_snapshotprofile:
raise UsageError('You must not set snapshotprofile and '
... | [
"def",
"update",
"(",
"gandi",
",",
"resource",
",",
"cmdline",
",",
"kernel",
",",
"name",
",",
"size",
",",
"snapshotprofile",
",",
"delete_snapshotprofile",
",",
"background",
")",
":",
"if",
"snapshotprofile",
"and",
"delete_snapshotprofile",
":",
"raise",
... | Update a disk.
Resource can be a disk name, or ID | [
"Update",
"a",
"disk",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/disk.py#L204-L229 | train |
Gandi/gandi.cli | gandi/cli/commands/disk.py | delete | def delete(gandi, resource, force, background):
""" Delete a disk. """
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 %s?'
... | python | def delete(gandi, resource, force, background):
""" Delete a disk. """
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 %s?'
... | [
"def",
"delete",
"(",
"gandi",
",",
"resource",
",",
"force",
",",
"background",
")",
":",
"output_keys",
"=",
"[",
"'id'",
",",
"'type'",
",",
"'step'",
"]",
"resource",
"=",
"sorted",
"(",
"tuple",
"(",
"set",
"(",
"resource",
")",
")",
")",
"if",
... | Delete a disk. | [
"Delete",
"a",
"disk",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/disk.py#L240-L258 | train |
Gandi/gandi.cli | gandi/cli/commands/disk.py | create | def create(gandi, name, vm, size, snapshotprofile, datacenter, source,
background):
""" Create a new disk. """
try:
gandi.datacenter.is_opened(datacenter, 'iaas')
except DatacenterLimited as exc:
gandi.echo('/!\ Datacenter %s will be closed on %s, '
'please cons... | python | def create(gandi, name, vm, size, snapshotprofile, datacenter, source,
background):
""" Create a new disk. """
try:
gandi.datacenter.is_opened(datacenter, 'iaas')
except DatacenterLimited as exc:
gandi.echo('/!\ Datacenter %s will be closed on %s, '
'please cons... | [
"def",
"create",
"(",
"gandi",
",",
"name",
",",
"vm",
",",
"size",
",",
"snapshotprofile",
",",
"datacenter",
",",
"source",
",",
"background",
")",
":",
"try",
":",
"gandi",
".",
"datacenter",
".",
"is_opened",
"(",
"datacenter",
",",
"'iaas'",
")",
... | Create a new disk. | [
"Create",
"a",
"new",
"disk",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/disk.py#L280-L309 | train |
Gandi/gandi.cli | gandi/cli/commands/disk.py | snapshot | def snapshot(gandi, name, resource, background):
""" Create a snapshot on the fly. """
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,
... | python | def snapshot(gandi, name, resource, background):
""" Create a snapshot on the fly. """
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,
... | [
"def",
"snapshot",
"(",
"gandi",
",",
"name",
",",
"resource",
",",
"background",
")",
":",
"name",
"=",
"name",
"or",
"randomstring",
"(",
"'snp'",
")",
"source_info",
"=",
"gandi",
".",
"disk",
".",
"info",
"(",
"resource",
")",
"datacenter",
"=",
"s... | Create a snapshot on the fly. | [
"Create",
"a",
"snapshot",
"on",
"the",
"fly",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/disk.py#L319-L330 | train |
Gandi/gandi.cli | gandi/cli/core/utils/__init__.py | format_list | def format_list(data):
""" Remove useless characters to output a clean list."""
if isinstance(data, (list, tuple)):
to_clean = ['[', ']', '(', ')', "'"]
for item in to_clean:
data = str(data).replace("u\"", "\"").replace("u\'", "\'")
data = str(data).replace(item, '')
... | python | def format_list(data):
""" Remove useless characters to output a clean list."""
if isinstance(data, (list, tuple)):
to_clean = ['[', ']', '(', ')', "'"]
for item in to_clean:
data = str(data).replace("u\"", "\"").replace("u\'", "\'")
data = str(data).replace(item, '')
... | [
"def",
"format_list",
"(",
"data",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"to_clean",
"=",
"[",
"'['",
",",
"']'",
",",
"'('",
",",
"')'",
",",
"\"'\"",
"]",
"for",
"item",
"in",
"to_clean",
":",... | Remove useless characters to output a clean list. | [
"Remove",
"useless",
"characters",
"to",
"output",
"a",
"clean",
"list",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L70-L77 | train |
Gandi/gandi.cli | gandi/cli/core/utils/__init__.py | output_account | def output_account(gandi, account, output_keys, justify=17):
""" Helper to output an account information."""
output_generic(gandi, account, output_keys, justify)
if 'prepaid' in output_keys:
prepaid = '%s %s' % (account['prepaid_info']['amount'],
account['prepaid_info']... | python | def output_account(gandi, account, output_keys, justify=17):
""" Helper to output an account information."""
output_generic(gandi, account, output_keys, justify)
if 'prepaid' in output_keys:
prepaid = '%s %s' % (account['prepaid_info']['amount'],
account['prepaid_info']... | [
"def",
"output_account",
"(",
"gandi",
",",
"account",
",",
"output_keys",
",",
"justify",
"=",
"17",
")",
":",
"output_generic",
"(",
"gandi",
",",
"account",
",",
"output_keys",
",",
"justify",
")",
"if",
"'prepaid'",
"in",
"output_keys",
":",
"prepaid",
... | Helper to output an account information. | [
"Helper",
"to",
"output",
"an",
"account",
"information",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L106-L131 | train |
Gandi/gandi.cli | gandi/cli/core/utils/__init__.py | output_vm | def output_vm(gandi, vm, datacenters, output_keys, justify=10):
""" Helper to output a vm information."""
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_code'... | python | def output_vm(gandi, vm, datacenters, output_keys, justify=10):
""" Helper to output a vm information."""
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_code'... | [
"def",
"output_vm",
"(",
"gandi",
",",
"vm",
",",
"datacenters",
",",
"output_keys",
",",
"justify",
"=",
"10",
")",
":",
"output_generic",
"(",
"gandi",
",",
"vm",
",",
"output_keys",
",",
"justify",
")",
"if",
"'datacenter'",
"in",
"output_keys",
":",
... | Helper to output a vm information. | [
"Helper",
"to",
"output",
"a",
"vm",
"information",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L134-L154 | train |
Gandi/gandi.cli | gandi/cli/core/utils/__init__.py | output_metric | def output_metric(gandi, metrics, key, justify=10):
""" Helper to output metrics."""
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 utf-8 to work ... | python | def output_metric(gandi, metrics, key, justify=10):
""" Helper to output metrics."""
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 utf-8 to work ... | [
"def",
"output_metric",
"(",
"gandi",
",",
"metrics",
",",
"key",
",",
"justify",
"=",
"10",
")",
":",
"for",
"metric",
"in",
"metrics",
":",
"key_name",
"=",
"metric",
"[",
"key",
"]",
".",
"pop",
"(",
")",
"values",
"=",
"[",
"point",
".",
"get",... | Helper to output metrics. | [
"Helper",
"to",
"output",
"metrics",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L157-L166 | train |
Gandi/gandi.cli | gandi/cli/core/utils/__init__.py | output_vhost | def output_vhost(gandi, vhost, paas, output_keys, justify=14):
""" Helper to output a vhost information."""
output_generic(gandi, vhost, output_keys, justify)
if 'paas_name' in output_keys:
output_line(gandi, 'paas_name', paas, justify) | python | def output_vhost(gandi, vhost, paas, output_keys, justify=14):
""" Helper to output a vhost information."""
output_generic(gandi, vhost, output_keys, justify)
if 'paas_name' in output_keys:
output_line(gandi, 'paas_name', paas, justify) | [
"def",
"output_vhost",
"(",
"gandi",
",",
"vhost",
",",
"paas",
",",
"output_keys",
",",
"justify",
"=",
"14",
")",
":",
"output_generic",
"(",
"gandi",
",",
"vhost",
",",
"output_keys",
",",
"justify",
")",
"if",
"'paas_name'",
"in",
"output_keys",
":",
... | Helper to output a vhost information. | [
"Helper",
"to",
"output",
"a",
"vhost",
"information",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L169-L174 | train |
Gandi/gandi.cli | gandi/cli/core/utils/__init__.py | output_paas | def output_paas(gandi, paas, datacenters, vhosts, output_keys, justify=11):
""" Helper to output a paas information."""
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:
... | python | def output_paas(gandi, paas, datacenters, vhosts, output_keys, justify=11):
""" Helper to output a paas information."""
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:
... | [
"def",
"output_paas",
"(",
"gandi",
",",
"paas",
",",
"datacenters",
",",
"vhosts",
",",
"output_keys",
",",
"justify",
"=",
"11",
")",
":",
"output_generic",
"(",
"gandi",
",",
"paas",
",",
"output_keys",
",",
"justify",
")",
"if",
"'sftp_server'",
"in",
... | Helper to output a paas information. | [
"Helper",
"to",
"output",
"a",
"paas",
"information",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L177-L213 | train |
Gandi/gandi.cli | gandi/cli/core/utils/__init__.py | output_image | def output_image(gandi, image, datacenters, output_keys, justify=14,
warn_deprecated=True):
""" Helper to output a disk image."""
for key in output_keys:
if key in image:
if (key == 'label' and image['visibility'] == 'deprecated' and
warn_deprecated):
... | python | def output_image(gandi, image, datacenters, output_keys, justify=14,
warn_deprecated=True):
""" Helper to output a disk image."""
for key in output_keys:
if key in image:
if (key == 'label' and image['visibility'] == 'deprecated' and
warn_deprecated):
... | [
"def",
"output_image",
"(",
"gandi",
",",
"image",
",",
"datacenters",
",",
"output_keys",
",",
"justify",
"=",
"14",
",",
"warn_deprecated",
"=",
"True",
")",
":",
"for",
"key",
"in",
"output_keys",
":",
"if",
"key",
"in",
"image",
":",
"if",
"(",
"ke... | Helper to output a disk image. | [
"Helper",
"to",
"output",
"a",
"disk",
"image",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L216-L236 | train |
Gandi/gandi.cli | gandi/cli/core/utils/__init__.py | output_kernels | def output_kernels(gandi, flavor, name_list, justify=14):
""" Helper to output kernel flavor versions."""
output_line(gandi, 'flavor', flavor, justify)
for name in name_list:
output_line(gandi, 'version', name, justify) | python | def output_kernels(gandi, flavor, name_list, justify=14):
""" Helper to output kernel flavor versions."""
output_line(gandi, 'flavor', flavor, justify)
for name in name_list:
output_line(gandi, 'version', name, justify) | [
"def",
"output_kernels",
"(",
"gandi",
",",
"flavor",
",",
"name_list",
",",
"justify",
"=",
"14",
")",
":",
"output_line",
"(",
"gandi",
",",
"'flavor'",
",",
"flavor",
",",
"justify",
")",
"for",
"name",
"in",
"name_list",
":",
"output_line",
"(",
"gan... | Helper to output kernel flavor versions. | [
"Helper",
"to",
"output",
"kernel",
"flavor",
"versions",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L239-L243 | train |
Gandi/gandi.cli | gandi/cli/core/utils/__init__.py | output_datacenter | def output_datacenter(gandi, datacenter, output_keys, justify=14):
""" Helper to output datacenter information."""
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:
... | python | def output_datacenter(gandi, datacenter, output_keys, justify=14):
""" Helper to output datacenter information."""
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:
... | [
"def",
"output_datacenter",
"(",
"gandi",
",",
"datacenter",
",",
"output_keys",
",",
"justify",
"=",
"14",
")",
":",
"output_generic",
"(",
"gandi",
",",
"datacenter",
",",
"output_keys",
",",
"justify",
")",
"if",
"'dc_name'",
"in",
"output_keys",
":",
"ou... | Helper to output datacenter information. | [
"Helper",
"to",
"output",
"datacenter",
"information",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L246-L269 | train |
Gandi/gandi.cli | gandi/cli/core/utils/__init__.py | output_disk | def output_disk(gandi, disk, datacenters, vms, profiles, output_keys,
justify=10):
""" Helper to output a disk."""
output_generic(gandi, disk, output_keys, justify)
if 'kernel' in output_keys and disk.get('kernel_version'):
output_line(gandi, 'kernel', disk['kernel_version'], justif... | python | def output_disk(gandi, disk, datacenters, vms, profiles, output_keys,
justify=10):
""" Helper to output a disk."""
output_generic(gandi, disk, output_keys, justify)
if 'kernel' in output_keys and disk.get('kernel_version'):
output_line(gandi, 'kernel', disk['kernel_version'], justif... | [
"def",
"output_disk",
"(",
"gandi",
",",
"disk",
",",
"datacenters",
",",
"vms",
",",
"profiles",
",",
"output_keys",
",",
"justify",
"=",
"10",
")",
":",
"output_generic",
"(",
"gandi",
",",
"disk",
",",
"output_keys",
",",
"justify",
")",
"if",
"'kerne... | Helper to output a disk. | [
"Helper",
"to",
"output",
"a",
"disk",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L282-L316 | train |
Gandi/gandi.cli | gandi/cli/core/utils/__init__.py | output_sshkey | def output_sshkey(gandi, sshkey, output_keys, justify=12):
""" Helper to output an ssh key information."""
output_generic(gandi, sshkey, output_keys, justify) | python | def output_sshkey(gandi, sshkey, output_keys, justify=12):
""" Helper to output an ssh key information."""
output_generic(gandi, sshkey, output_keys, justify) | [
"def",
"output_sshkey",
"(",
"gandi",
",",
"sshkey",
",",
"output_keys",
",",
"justify",
"=",
"12",
")",
":",
"output_generic",
"(",
"gandi",
",",
"sshkey",
",",
"output_keys",
",",
"justify",
")"
] | Helper to output an ssh key information. | [
"Helper",
"to",
"output",
"an",
"ssh",
"key",
"information",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L319-L321 | train |
Gandi/gandi.cli | gandi/cli/core/utils/__init__.py | output_snapshot_profile | def output_snapshot_profile(gandi, profile, output_keys, justify=13):
""" Helper to output a snapshot_profile."""
schedules = 'schedules' in output_keys
if schedules:
output_keys.remove('schedules')
output_generic(gandi, profile, output_keys, justify)
if schedules:
schedule_keys = [... | python | def output_snapshot_profile(gandi, profile, output_keys, justify=13):
""" Helper to output a snapshot_profile."""
schedules = 'schedules' in output_keys
if schedules:
output_keys.remove('schedules')
output_generic(gandi, profile, output_keys, justify)
if schedules:
schedule_keys = [... | [
"def",
"output_snapshot_profile",
"(",
"gandi",
",",
"profile",
",",
"output_keys",
",",
"justify",
"=",
"13",
")",
":",
"schedules",
"=",
"'schedules'",
"in",
"output_keys",
"if",
"schedules",
":",
"output_keys",
".",
"remove",
"(",
"'schedules'",
")",
"outpu... | Helper to output a snapshot_profile. | [
"Helper",
"to",
"output",
"a",
"snapshot_profile",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L324-L335 | train |
Gandi/gandi.cli | gandi/cli/core/utils/__init__.py | output_contact_info | def output_contact_info(gandi, data, output_keys, justify=10):
"""Helper to output chosen contacts info."""
for key in output_keys:
if data[key]:
output_line(gandi, key, data[key]['handle'], justify) | python | def output_contact_info(gandi, data, output_keys, justify=10):
"""Helper to output chosen contacts info."""
for key in output_keys:
if data[key]:
output_line(gandi, key, data[key]['handle'], justify) | [
"def",
"output_contact_info",
"(",
"gandi",
",",
"data",
",",
"output_keys",
",",
"justify",
"=",
"10",
")",
":",
"for",
"key",
"in",
"output_keys",
":",
"if",
"data",
"[",
"key",
"]",
":",
"output_line",
"(",
"gandi",
",",
"key",
",",
"data",
"[",
"... | Helper to output chosen contacts info. | [
"Helper",
"to",
"output",
"chosen",
"contacts",
"info",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L338-L342 | train |
Gandi/gandi.cli | gandi/cli/core/utils/__init__.py | output_cert | def output_cert(gandi, cert, output_keys, justify=13):
"""Helper to output a certificate information."""
output = list(output_keys)
display_altnames = False
if 'altnames' in output:
display_altnames = True
output.remove('altnames')
display_output = False
if 'cert' in output:
... | python | def output_cert(gandi, cert, output_keys, justify=13):
"""Helper to output a certificate information."""
output = list(output_keys)
display_altnames = False
if 'altnames' in output:
display_altnames = True
output.remove('altnames')
display_output = False
if 'cert' in output:
... | [
"def",
"output_cert",
"(",
"gandi",
",",
"cert",
",",
"output_keys",
",",
"justify",
"=",
"13",
")",
":",
"output",
"=",
"list",
"(",
"output_keys",
")",
"display_altnames",
"=",
"False",
"if",
"'altnames'",
"in",
"output",
":",
"display_altnames",
"=",
"T... | Helper to output a certificate information. | [
"Helper",
"to",
"output",
"a",
"certificate",
"information",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L355-L378 | train |
Gandi/gandi.cli | gandi/cli/core/utils/__init__.py | output_vlan | def output_vlan(gandi, vlan, datacenters, output_keys, justify=10):
""" Helper to output a vlan information."""
output_generic(gandi, vlan, output_keys, justify)
if 'dc' in output_keys:
for dc in datacenters:
if dc['id'] == vlan.get('datacenter_id',
v... | python | def output_vlan(gandi, vlan, datacenters, output_keys, justify=10):
""" Helper to output a vlan information."""
output_generic(gandi, vlan, output_keys, justify)
if 'dc' in output_keys:
for dc in datacenters:
if dc['id'] == vlan.get('datacenter_id',
v... | [
"def",
"output_vlan",
"(",
"gandi",
",",
"vlan",
",",
"datacenters",
",",
"output_keys",
",",
"justify",
"=",
"10",
")",
":",
"output_generic",
"(",
"gandi",
",",
"vlan",
",",
"output_keys",
",",
"justify",
")",
"if",
"'dc'",
"in",
"output_keys",
":",
"f... | Helper to output a vlan information. | [
"Helper",
"to",
"output",
"a",
"vlan",
"information",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L381-L392 | train |
Gandi/gandi.cli | gandi/cli/core/utils/__init__.py | output_iface | def output_iface(gandi, iface, datacenters, vms, output_keys, justify=10):
""" Helper to output an iface information."""
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... | python | def output_iface(gandi, iface, datacenters, vms, output_keys, justify=10):
""" Helper to output an iface information."""
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... | [
"def",
"output_iface",
"(",
"gandi",
",",
"iface",
",",
"datacenters",
",",
"vms",
",",
"output_keys",
",",
"justify",
"=",
"10",
")",
":",
"output_generic",
"(",
"gandi",
",",
"iface",
",",
"output_keys",
",",
"justify",
")",
"if",
"'vm'",
"in",
"output... | Helper to output an iface information. | [
"Helper",
"to",
"output",
"an",
"iface",
"information",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L395-L415 | train |
Gandi/gandi.cli | gandi/cli/core/utils/__init__.py | output_ip | def output_ip(gandi, ip, datacenters, vms, ifaces, output_keys, justify=11):
""" Helper to output an ip information."""
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'
o... | python | def output_ip(gandi, ip, datacenters, vms, ifaces, output_keys, justify=11):
""" Helper to output an ip information."""
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'
o... | [
"def",
"output_ip",
"(",
"gandi",
",",
"ip",
",",
"datacenters",
",",
"vms",
",",
"ifaces",
",",
"output_keys",
",",
"justify",
"=",
"11",
")",
":",
"output_generic",
"(",
"gandi",
",",
"ip",
",",
"output_keys",
",",
"justify",
")",
"if",
"'type'",
"in... | Helper to output an ip information. | [
"Helper",
"to",
"output",
"an",
"ip",
"information",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L418-L444 | train |
Gandi/gandi.cli | gandi/cli/core/utils/__init__.py | output_json | def output_json(gandi, format, value):
""" Helper to show json output """
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,
in... | python | def output_json(gandi, format, value):
""" Helper to show json output """
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,
in... | [
"def",
"output_json",
"(",
"gandi",
",",
"format",
",",
"value",
")",
":",
"if",
"format",
"==",
"'json'",
":",
"gandi",
".",
"echo",
"(",
"json",
".",
"dumps",
"(",
"value",
",",
"default",
"=",
"date_handler",
",",
"sort_keys",
"=",
"True",
")",
")... | Helper to show json output | [
"Helper",
"to",
"show",
"json",
"output"
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L465-L471 | train |
Gandi/gandi.cli | gandi/cli/core/utils/__init__.py | output_service | def output_service(gandi, service, status, justify=10):
""" Helper to output a status service information."""
output_line(gandi, service, status, justify) | python | def output_service(gandi, service, status, justify=10):
""" Helper to output a status service information."""
output_line(gandi, service, status, justify) | [
"def",
"output_service",
"(",
"gandi",
",",
"service",
",",
"status",
",",
"justify",
"=",
"10",
")",
":",
"output_line",
"(",
"gandi",
",",
"service",
",",
"status",
",",
"justify",
")"
] | Helper to output a status service information. | [
"Helper",
"to",
"output",
"a",
"status",
"service",
"information",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L487-L489 | train |
Gandi/gandi.cli | gandi/cli/core/utils/__init__.py | output_domain | def output_domain(gandi, domain, output_keys, justify=12):
""" Helper to output a domain information."""
if 'nameservers' in domain:
domain['nameservers'] = format_list(domain['nameservers'])
if 'services' in domain:
domain['services'] = format_list(domain['services'])
if 'tags' in dom... | python | def output_domain(gandi, domain, output_keys, justify=12):
""" Helper to output a domain information."""
if 'nameservers' in domain:
domain['nameservers'] = format_list(domain['nameservers'])
if 'services' in domain:
domain['services'] = format_list(domain['services'])
if 'tags' in dom... | [
"def",
"output_domain",
"(",
"gandi",
",",
"domain",
",",
"output_keys",
",",
"justify",
"=",
"12",
")",
":",
"if",
"'nameservers'",
"in",
"domain",
":",
"domain",
"[",
"'nameservers'",
"]",
"=",
"format_list",
"(",
"domain",
"[",
"'nameservers'",
"]",
")"... | Helper to output a domain information. | [
"Helper",
"to",
"output",
"a",
"domain",
"information",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L517-L542 | train |
Gandi/gandi.cli | gandi/cli/core/utils/__init__.py | output_mailbox | def output_mailbox(gandi, mailbox, output_keys, justify=16):
""" Helper to output a mailbox information."""
quota = 'quota' in output_keys
responder = 'responder' in output_keys
if quota:
output_keys.pop(output_keys.index('quota'))
if responder:
output_keys.pop(output_keys.index('r... | python | def output_mailbox(gandi, mailbox, output_keys, justify=16):
""" Helper to output a mailbox information."""
quota = 'quota' in output_keys
responder = 'responder' in output_keys
if quota:
output_keys.pop(output_keys.index('quota'))
if responder:
output_keys.pop(output_keys.index('r... | [
"def",
"output_mailbox",
"(",
"gandi",
",",
"mailbox",
",",
"output_keys",
",",
"justify",
"=",
"16",
")",
":",
"quota",
"=",
"'quota'",
"in",
"output_keys",
"responder",
"=",
"'responder'",
"in",
"output_keys",
"if",
"quota",
":",
"output_keys",
".",
"pop",... | Helper to output a mailbox information. | [
"Helper",
"to",
"output",
"a",
"mailbox",
"information",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L545-L577 | train |
Gandi/gandi.cli | gandi/cli/core/utils/__init__.py | output_forward | def output_forward(gandi, domain, forward, justify=14):
""" Helper to output a mail forward information."""
for dest in forward['destinations']:
output_line(gandi, forward['source'], dest, justify) | python | def output_forward(gandi, domain, forward, justify=14):
""" Helper to output a mail forward information."""
for dest in forward['destinations']:
output_line(gandi, forward['source'], dest, justify) | [
"def",
"output_forward",
"(",
"gandi",
",",
"domain",
",",
"forward",
",",
"justify",
"=",
"14",
")",
":",
"for",
"dest",
"in",
"forward",
"[",
"'destinations'",
"]",
":",
"output_line",
"(",
"gandi",
",",
"forward",
"[",
"'source'",
"]",
",",
"dest",
... | Helper to output a mail forward information. | [
"Helper",
"to",
"output",
"a",
"mail",
"forward",
"information",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L580-L583 | train |
Gandi/gandi.cli | gandi/cli/core/utils/__init__.py | output_dns_records | def output_dns_records(gandi, records, output_keys, justify=12):
""" Helper to output a dns records information."""
for key in output_keys:
real_key = 'rrset_%s' % key
if real_key in records:
val = records[real_key]
if key == 'values':
val = format_list(re... | python | def output_dns_records(gandi, records, output_keys, justify=12):
""" Helper to output a dns records information."""
for key in output_keys:
real_key = 'rrset_%s' % key
if real_key in records:
val = records[real_key]
if key == 'values':
val = format_list(re... | [
"def",
"output_dns_records",
"(",
"gandi",
",",
"records",
",",
"output_keys",
",",
"justify",
"=",
"12",
")",
":",
"for",
"key",
"in",
"output_keys",
":",
"real_key",
"=",
"'rrset_%s'",
"%",
"key",
"if",
"real_key",
"in",
"records",
":",
"val",
"=",
"re... | Helper to output a dns records information. | [
"Helper",
"to",
"output",
"a",
"dns",
"records",
"information",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L586-L594 | train |
Gandi/gandi.cli | gandi/cli/commands/ip.py | list | def list(gandi, datacenter, type, id, attached, detached, version, reverse,
vm, vlan):
"""List ips."""
if attached and detached:
gandi.echo("You can't set --attached and --detached at the same time.")
return
output_keys = ['ip', 'state', 'dc', 'type']
if id:
output_keys... | python | def list(gandi, datacenter, type, id, attached, detached, version, reverse,
vm, vlan):
"""List ips."""
if attached and detached:
gandi.echo("You can't set --attached and --detached at the same time.")
return
output_keys = ['ip', 'state', 'dc', 'type']
if id:
output_keys... | [
"def",
"list",
"(",
"gandi",
",",
"datacenter",
",",
"type",
",",
"id",
",",
"attached",
",",
"detached",
",",
"version",
",",
"reverse",
",",
"vm",
",",
"vlan",
")",
":",
"if",
"attached",
"and",
"detached",
":",
"gandi",
".",
"echo",
"(",
"\"You ca... | List ips. | [
"List",
"ips",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/ip.py#L33-L85 | train |
Gandi/gandi.cli | gandi/cli/commands/ip.py | info | def info(gandi, resource):
"""Display information about an ip.
Resource can be an ip or id.
"""
output_keys = ['ip', 'state', 'dc', 'type', 'vm', 'reverse']
datacenters = gandi.datacenter.list()
ip = gandi.ip.info(resource)
iface = gandi.iface.info(ip['iface_id'])
vms = None
if if... | python | def info(gandi, resource):
"""Display information about an ip.
Resource can be an ip or id.
"""
output_keys = ['ip', 'state', 'dc', 'type', 'vm', 'reverse']
datacenters = gandi.datacenter.list()
ip = gandi.ip.info(resource)
iface = gandi.iface.info(ip['iface_id'])
vms = None
if if... | [
"def",
"info",
"(",
"gandi",
",",
"resource",
")",
":",
"output_keys",
"=",
"[",
"'ip'",
",",
"'state'",
",",
"'dc'",
",",
"'type'",
",",
"'vm'",
",",
"'reverse'",
"]",
"datacenters",
"=",
"gandi",
".",
"datacenter",
".",
"list",
"(",
")",
"ip",
"=",... | Display information about an ip.
Resource can be an ip or id. | [
"Display",
"information",
"about",
"an",
"ip",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/ip.py#L91-L110 | train |
Gandi/gandi.cli | gandi/cli/commands/ip.py | update | def update(gandi, ip, reverse, background):
"""Update an ip."""
if not reverse:
return
return gandi.ip.update(ip, {'reverse': reverse}, background) | python | def update(gandi, ip, reverse, background):
"""Update an ip."""
if not reverse:
return
return gandi.ip.update(ip, {'reverse': reverse}, background) | [
"def",
"update",
"(",
"gandi",
",",
"ip",
",",
"reverse",
",",
"background",
")",
":",
"if",
"not",
"reverse",
":",
"return",
"return",
"gandi",
".",
"ip",
".",
"update",
"(",
"ip",
",",
"{",
"'reverse'",
":",
"reverse",
"}",
",",
"background",
")"
] | Update an ip. | [
"Update",
"an",
"ip",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/ip.py#L119-L123 | train |
Gandi/gandi.cli | gandi/cli/commands/ip.py | attach | def attach(gandi, ip, vm, background, force):
"""Attach an ip to a vm.
ip can be an ip id or ip
vm can be a vm id or name.
"""
try:
ip_ = gandi.ip.info(ip)
vm_ = gandi.iaas.info(vm)
except UsageError:
gandi.error("Can't find this ip %s" % ip)
iface = gandi.iface.inf... | python | def attach(gandi, ip, vm, background, force):
"""Attach an ip to a vm.
ip can be an ip id or ip
vm can be a vm id or name.
"""
try:
ip_ = gandi.ip.info(ip)
vm_ = gandi.iaas.info(vm)
except UsageError:
gandi.error("Can't find this ip %s" % ip)
iface = gandi.iface.inf... | [
"def",
"attach",
"(",
"gandi",
",",
"ip",
",",
"vm",
",",
"background",
",",
"force",
")",
":",
"try",
":",
"ip_",
"=",
"gandi",
".",
"ip",
".",
"info",
"(",
"ip",
")",
"vm_",
"=",
"gandi",
".",
"iaas",
".",
"info",
"(",
"vm",
")",
"except",
... | Attach an ip to a vm.
ip can be an ip id or ip
vm can be a vm id or name. | [
"Attach",
"an",
"ip",
"to",
"a",
"vm",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/ip.py#L135-L160 | train |
Gandi/gandi.cli | gandi/cli/commands/ip.py | create | def create(gandi, datacenter, bandwidth, ip_version, vlan, ip, attach,
background):
"""Create a public or private ip
"""
if ip_version != 4 and vlan:
gandi.echo('You must have an --ip-version to 4 when having a vlan.')
return
if ip and not vlan:
gandi.echo('You must h... | python | def create(gandi, datacenter, bandwidth, ip_version, vlan, ip, attach,
background):
"""Create a public or private ip
"""
if ip_version != 4 and vlan:
gandi.echo('You must have an --ip-version to 4 when having a vlan.')
return
if ip and not vlan:
gandi.echo('You must h... | [
"def",
"create",
"(",
"gandi",
",",
"datacenter",
",",
"bandwidth",
",",
"ip_version",
",",
"vlan",
",",
"ip",
",",
"attach",
",",
"background",
")",
":",
"if",
"ip_version",
"!=",
"4",
"and",
"vlan",
":",
"gandi",
".",
"echo",
"(",
"'You must have an --... | Create a public or private ip | [
"Create",
"a",
"public",
"or",
"private",
"ip"
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/ip.py#L177-L209 | train |
Gandi/gandi.cli | gandi/cli/commands/ip.py | detach | def detach(gandi, resource, background, force):
"""Detach an ip from it's currently attached vm.
resource can be an ip id or ip.
"""
if not force:
proceed = click.confirm('Are you sure you want to detach ip %s?' %
resource)
if not proceed:
ret... | python | def detach(gandi, resource, background, force):
"""Detach an ip from it's currently attached vm.
resource can be an ip id or ip.
"""
if not force:
proceed = click.confirm('Are you sure you want to detach ip %s?' %
resource)
if not proceed:
ret... | [
"def",
"detach",
"(",
"gandi",
",",
"resource",
",",
"background",
",",
"force",
")",
":",
"if",
"not",
"force",
":",
"proceed",
"=",
"click",
".",
"confirm",
"(",
"'Are you sure you want to detach ip %s?'",
"%",
"resource",
")",
"if",
"not",
"proceed",
":",... | Detach an ip from it's currently attached vm.
resource can be an ip id or ip. | [
"Detach",
"an",
"ip",
"from",
"it",
"s",
"currently",
"attached",
"vm",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/ip.py#L220-L231 | train |
Gandi/gandi.cli | gandi/cli/commands/config.py | get | def get(gandi, g, key):
"""Display value of a given config key."""
val = gandi.get(key=key, global_=g)
if not val:
gandi.echo("No value found.")
sys.exit(1)
gandi.echo(val) | python | def get(gandi, g, key):
"""Display value of a given config key."""
val = gandi.get(key=key, global_=g)
if not val:
gandi.echo("No value found.")
sys.exit(1)
gandi.echo(val) | [
"def",
"get",
"(",
"gandi",
",",
"g",
",",
"key",
")",
":",
"val",
"=",
"gandi",
".",
"get",
"(",
"key",
"=",
"key",
",",
"global_",
"=",
"g",
")",
"if",
"not",
"val",
":",
"gandi",
".",
"echo",
"(",
"\"No value found.\"",
")",
"sys",
".",
"exi... | Display value of a given config key. | [
"Display",
"value",
"of",
"a",
"given",
"config",
"key",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/config.py#L26-L32 | train |
Gandi/gandi.cli | gandi/cli/commands/config.py | edit | def edit(gandi, g):
"""Edit config file with prefered text editor"""
config_file = gandi.home_config if g else gandi.local_config
path = os.path.expanduser(config_file)
editor = gandi.get('editor')
if not editor:
try:
editor = click.prompt("Please enter the path of your prefered ... | python | def edit(gandi, g):
"""Edit config file with prefered text editor"""
config_file = gandi.home_config if g else gandi.local_config
path = os.path.expanduser(config_file)
editor = gandi.get('editor')
if not editor:
try:
editor = click.prompt("Please enter the path of your prefered ... | [
"def",
"edit",
"(",
"gandi",
",",
"g",
")",
":",
"config_file",
"=",
"gandi",
".",
"home_config",
"if",
"g",
"else",
"gandi",
".",
"local_config",
"path",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"config_file",
")",
"editor",
"=",
"gandi",
".",
... | Edit config file with prefered text editor | [
"Edit",
"config",
"file",
"with",
"prefered",
"text",
"editor"
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/config.py#L50-L66 | train |
Gandi/gandi.cli | gandi/cli/modules/webacc.py | Webacc.delete | def delete(cls, name):
""" Delete a webaccelerator """
result = cls.call('hosting.rproxy.delete', cls.usable_id(name))
cls.echo('Deleting your webaccelerator named %s' % name)
cls.display_progress(result)
cls.echo('Webaccelerator have been deleted')
return result | python | def delete(cls, name):
""" Delete a webaccelerator """
result = cls.call('hosting.rproxy.delete', cls.usable_id(name))
cls.echo('Deleting your webaccelerator named %s' % name)
cls.display_progress(result)
cls.echo('Webaccelerator have been deleted')
return result | [
"def",
"delete",
"(",
"cls",
",",
"name",
")",
":",
"result",
"=",
"cls",
".",
"call",
"(",
"'hosting.rproxy.delete'",
",",
"cls",
".",
"usable_id",
"(",
"name",
")",
")",
"cls",
".",
"echo",
"(",
"'Deleting your webaccelerator named %s'",
"%",
"name",
")"... | Delete a webaccelerator | [
"Delete",
"a",
"webaccelerator"
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/webacc.py#L104-L110 | train |
Gandi/gandi.cli | gandi/cli/modules/webacc.py | Webacc.backend_add | def backend_add(cls, name, backend):
""" Add a backend into a webaccelerator """
oper = cls.call(
'hosting.rproxy.server.create', cls.usable_id(name), backend)
cls.echo('Adding backend %s:%s into webaccelerator' %
(backend['ip'], backend['port']))
cls.display... | python | def backend_add(cls, name, backend):
""" Add a backend into a webaccelerator """
oper = cls.call(
'hosting.rproxy.server.create', cls.usable_id(name), backend)
cls.echo('Adding backend %s:%s into webaccelerator' %
(backend['ip'], backend['port']))
cls.display... | [
"def",
"backend_add",
"(",
"cls",
",",
"name",
",",
"backend",
")",
":",
"oper",
"=",
"cls",
".",
"call",
"(",
"'hosting.rproxy.server.create'",
",",
"cls",
".",
"usable_id",
"(",
"name",
")",
",",
"backend",
")",
"cls",
".",
"echo",
"(",
"'Adding backen... | Add a backend into a webaccelerator | [
"Add",
"a",
"backend",
"into",
"a",
"webaccelerator"
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/webacc.py#L118-L126 | train |
Gandi/gandi.cli | gandi/cli/modules/webacc.py | Webacc.backend_disable | def backend_disable(cls, backend):
""" Disable a backend for a server """
server = cls.backend_list(backend)
oper = cls.call('hosting.rproxy.server.disable',
server[0]['id'])
cls.echo('Desactivating backend on server %s' %
server[0]['ip'])
... | python | def backend_disable(cls, backend):
""" Disable a backend for a server """
server = cls.backend_list(backend)
oper = cls.call('hosting.rproxy.server.disable',
server[0]['id'])
cls.echo('Desactivating backend on server %s' %
server[0]['ip'])
... | [
"def",
"backend_disable",
"(",
"cls",
",",
"backend",
")",
":",
"server",
"=",
"cls",
".",
"backend_list",
"(",
"backend",
")",
"oper",
"=",
"cls",
".",
"call",
"(",
"'hosting.rproxy.server.disable'",
",",
"server",
"[",
"0",
"]",
"[",
"'id'",
"]",
")",
... | Disable a backend for a server | [
"Disable",
"a",
"backend",
"for",
"a",
"server"
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/webacc.py#L156-L165 | train |
Gandi/gandi.cli | gandi/cli/modules/webacc.py | Webacc.vhost_add | def vhost_add(cls, resource, params):
""" Add a vhost into a webaccelerator """
try:
oper = cls.call(
'hosting.rproxy.vhost.create', cls.usable_id(resource), params)
cls.echo('Adding your virtual host (%s) into %s' %
(params['vhost'], resource... | python | def vhost_add(cls, resource, params):
""" Add a vhost into a webaccelerator """
try:
oper = cls.call(
'hosting.rproxy.vhost.create', cls.usable_id(resource), params)
cls.echo('Adding your virtual host (%s) into %s' %
(params['vhost'], resource... | [
"def",
"vhost_add",
"(",
"cls",
",",
"resource",
",",
"params",
")",
":",
"try",
":",
"oper",
"=",
"cls",
".",
"call",
"(",
"'hosting.rproxy.vhost.create'",
",",
"cls",
".",
"usable_id",
"(",
"resource",
")",
",",
"params",
")",
"cls",
".",
"echo",
"("... | Add a vhost into a webaccelerator | [
"Add",
"a",
"vhost",
"into",
"a",
"webaccelerator"
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/webacc.py#L173-L208 | train |
Gandi/gandi.cli | gandi/cli/modules/webacc.py | Webacc.vhost_remove | def vhost_remove(cls, name):
""" Delete a vhost in a webaccelerator """
oper = cls.call('hosting.rproxy.vhost.delete', name)
cls.echo('Deleting your virtual host %s' % name)
cls.display_progress(oper)
cls.echo('Your virtual host have been removed')
return oper | python | def vhost_remove(cls, name):
""" Delete a vhost in a webaccelerator """
oper = cls.call('hosting.rproxy.vhost.delete', name)
cls.echo('Deleting your virtual host %s' % name)
cls.display_progress(oper)
cls.echo('Your virtual host have been removed')
return oper | [
"def",
"vhost_remove",
"(",
"cls",
",",
"name",
")",
":",
"oper",
"=",
"cls",
".",
"call",
"(",
"'hosting.rproxy.vhost.delete'",
",",
"name",
")",
"cls",
".",
"echo",
"(",
"'Deleting your virtual host %s'",
"%",
"name",
")",
"cls",
".",
"display_progress",
"... | Delete a vhost in a webaccelerator | [
"Delete",
"a",
"vhost",
"in",
"a",
"webaccelerator"
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/webacc.py#L211-L217 | train |
Gandi/gandi.cli | gandi/cli/modules/webacc.py | Webacc.probe | def probe(cls, resource, enable, disable, test, host, interval,
http_method, http_response, threshold, timeout, url, window):
""" Set a probe for a webaccelerator """
params = {
'host': host,
'interval': interval,
'method': http_method,
'resp... | python | def probe(cls, resource, enable, disable, test, host, interval,
http_method, http_response, threshold, timeout, url, window):
""" Set a probe for a webaccelerator """
params = {
'host': host,
'interval': interval,
'method': http_method,
'resp... | [
"def",
"probe",
"(",
"cls",
",",
"resource",
",",
"enable",
",",
"disable",
",",
"test",
",",
"host",
",",
"interval",
",",
"http_method",
",",
"http_response",
",",
"threshold",
",",
"timeout",
",",
"url",
",",
"window",
")",
":",
"params",
"=",
"{",
... | Set a probe for a webaccelerator | [
"Set",
"a",
"probe",
"for",
"a",
"webaccelerator"
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/webacc.py#L220-L244 | train |
Gandi/gandi.cli | gandi/cli/modules/webacc.py | Webacc.probe_enable | def probe_enable(cls, resource):
""" Activate a probe on a webaccelerator """
oper = cls.call('hosting.rproxy.probe.enable', cls.usable_id(resource))
cls.echo('Activating probe on %s' % resource)
cls.display_progress(oper)
cls.echo('The probe have been activated')
return ... | python | def probe_enable(cls, resource):
""" Activate a probe on a webaccelerator """
oper = cls.call('hosting.rproxy.probe.enable', cls.usable_id(resource))
cls.echo('Activating probe on %s' % resource)
cls.display_progress(oper)
cls.echo('The probe have been activated')
return ... | [
"def",
"probe_enable",
"(",
"cls",
",",
"resource",
")",
":",
"oper",
"=",
"cls",
".",
"call",
"(",
"'hosting.rproxy.probe.enable'",
",",
"cls",
".",
"usable_id",
"(",
"resource",
")",
")",
"cls",
".",
"echo",
"(",
"'Activating probe on %s'",
"%",
"resource"... | Activate a probe on a webaccelerator | [
"Activate",
"a",
"probe",
"on",
"a",
"webaccelerator"
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/webacc.py#L247-L253 | train |
Gandi/gandi.cli | gandi/cli/modules/webacc.py | Webacc.probe_disable | def probe_disable(cls, resource):
""" Disable a probe on a webaccelerator """
oper = cls.call('hosting.rproxy.probe.disable',
cls.usable_id(resource))
cls.echo('Desactivating probe on %s' % resource)
cls.display_progress(oper)
cls.echo('The probe have been... | python | def probe_disable(cls, resource):
""" Disable a probe on a webaccelerator """
oper = cls.call('hosting.rproxy.probe.disable',
cls.usable_id(resource))
cls.echo('Desactivating probe on %s' % resource)
cls.display_progress(oper)
cls.echo('The probe have been... | [
"def",
"probe_disable",
"(",
"cls",
",",
"resource",
")",
":",
"oper",
"=",
"cls",
".",
"call",
"(",
"'hosting.rproxy.probe.disable'",
",",
"cls",
".",
"usable_id",
"(",
"resource",
")",
")",
"cls",
".",
"echo",
"(",
"'Desactivating probe on %s'",
"%",
"reso... | Disable a probe on a webaccelerator | [
"Disable",
"a",
"probe",
"on",
"a",
"webaccelerator"
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/webacc.py#L256-L263 | train |
Gandi/gandi.cli | gandi/cli/modules/webacc.py | Webacc.usable_id | def usable_id(cls, id):
""" Retrieve id from input which can be hostname, vhost, id. """
try:
# id is maybe a hostname
qry_id = cls.from_name(id)
if not qry_id:
# id is maybe an ip
qry_id = cls.from_ip(id)
if not qry_id:
... | python | def usable_id(cls, id):
""" Retrieve id from input which can be hostname, vhost, id. """
try:
# id is maybe a hostname
qry_id = cls.from_name(id)
if not qry_id:
# id is maybe an ip
qry_id = cls.from_ip(id)
if not qry_id:
... | [
"def",
"usable_id",
"(",
"cls",
",",
"id",
")",
":",
"try",
":",
"# id is maybe a hostname",
"qry_id",
"=",
"cls",
".",
"from_name",
"(",
"id",
")",
"if",
"not",
"qry_id",
":",
"# id is maybe an ip",
"qry_id",
"=",
"cls",
".",
"from_ip",
"(",
"id",
")",
... | Retrieve id from input which can be hostname, vhost, id. | [
"Retrieve",
"id",
"from",
"input",
"which",
"can",
"be",
"hostname",
"vhost",
"id",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/webacc.py#L266-L283 | train |
Gandi/gandi.cli | gandi/cli/modules/webacc.py | Webacc.from_name | def from_name(cls, name):
"""Retrieve webacc id associated to a webacc name."""
result = cls.list({'items_per_page': 500})
webaccs = {}
for webacc in result:
webaccs[webacc['name']] = webacc['id']
return webaccs.get(name) | python | def from_name(cls, name):
"""Retrieve webacc id associated to a webacc name."""
result = cls.list({'items_per_page': 500})
webaccs = {}
for webacc in result:
webaccs[webacc['name']] = webacc['id']
return webaccs.get(name) | [
"def",
"from_name",
"(",
"cls",
",",
"name",
")",
":",
"result",
"=",
"cls",
".",
"list",
"(",
"{",
"'items_per_page'",
":",
"500",
"}",
")",
"webaccs",
"=",
"{",
"}",
"for",
"webacc",
"in",
"result",
":",
"webaccs",
"[",
"webacc",
"[",
"'name'",
"... | Retrieve webacc id associated to a webacc name. | [
"Retrieve",
"webacc",
"id",
"associated",
"to",
"a",
"webacc",
"name",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/webacc.py#L286-L292 | train |
Gandi/gandi.cli | gandi/cli/modules/webacc.py | Webacc.from_ip | def from_ip(cls, ip):
"""Retrieve webacc id associated to a webacc ip"""
result = cls.list({'items_per_page': 500})
webaccs = {}
for webacc in result:
for server in webacc['servers']:
webaccs[server['ip']] = webacc['id']
return webaccs.get(ip) | python | def from_ip(cls, ip):
"""Retrieve webacc id associated to a webacc ip"""
result = cls.list({'items_per_page': 500})
webaccs = {}
for webacc in result:
for server in webacc['servers']:
webaccs[server['ip']] = webacc['id']
return webaccs.get(ip) | [
"def",
"from_ip",
"(",
"cls",
",",
"ip",
")",
":",
"result",
"=",
"cls",
".",
"list",
"(",
"{",
"'items_per_page'",
":",
"500",
"}",
")",
"webaccs",
"=",
"{",
"}",
"for",
"webacc",
"in",
"result",
":",
"for",
"server",
"in",
"webacc",
"[",
"'server... | Retrieve webacc id associated to a webacc ip | [
"Retrieve",
"webacc",
"id",
"associated",
"to",
"a",
"webacc",
"ip"
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/webacc.py#L295-L302 | train |
Gandi/gandi.cli | gandi/cli/modules/webacc.py | Webacc.from_vhost | def from_vhost(cls, vhost):
"""Retrieve webbacc id associated to a webacc vhost"""
result = cls.list({'items_per_page': 500})
webaccs = {}
for webacc in result:
for vhost in webacc['vhosts']:
webaccs[vhost['name']] = webacc['id']
return webaccs.get(vho... | python | def from_vhost(cls, vhost):
"""Retrieve webbacc id associated to a webacc vhost"""
result = cls.list({'items_per_page': 500})
webaccs = {}
for webacc in result:
for vhost in webacc['vhosts']:
webaccs[vhost['name']] = webacc['id']
return webaccs.get(vho... | [
"def",
"from_vhost",
"(",
"cls",
",",
"vhost",
")",
":",
"result",
"=",
"cls",
".",
"list",
"(",
"{",
"'items_per_page'",
":",
"500",
"}",
")",
"webaccs",
"=",
"{",
"}",
"for",
"webacc",
"in",
"result",
":",
"for",
"vhost",
"in",
"webacc",
"[",
"'v... | Retrieve webbacc id associated to a webacc vhost | [
"Retrieve",
"webbacc",
"id",
"associated",
"to",
"a",
"webacc",
"vhost"
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/webacc.py#L305-L312 | train |
Gandi/gandi.cli | gandi/cli/modules/status.py | Status.descriptions | def descriptions(cls):
""" Retrieve status descriptions from status.gandi.net. """
schema = cls.json_get('%s/status/schema' % cls.api_url, empty_key=True,
send_key=False)
descs = {}
for val in schema['fields']['status']['value']:
descs.update(val... | python | def descriptions(cls):
""" Retrieve status descriptions from status.gandi.net. """
schema = cls.json_get('%s/status/schema' % cls.api_url, empty_key=True,
send_key=False)
descs = {}
for val in schema['fields']['status']['value']:
descs.update(val... | [
"def",
"descriptions",
"(",
"cls",
")",
":",
"schema",
"=",
"cls",
".",
"json_get",
"(",
"'%s/status/schema'",
"%",
"cls",
".",
"api_url",
",",
"empty_key",
"=",
"True",
",",
"send_key",
"=",
"False",
")",
"descs",
"=",
"{",
"}",
"for",
"val",
"in",
... | Retrieve status descriptions from status.gandi.net. | [
"Retrieve",
"status",
"descriptions",
"from",
"status",
".",
"gandi",
".",
"net",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/status.py#L23-L30 | train |
Gandi/gandi.cli | gandi/cli/modules/status.py | Status.services | def services(cls):
"""Retrieve services statuses from status.gandi.net."""
return cls.json_get('%s/services' % cls.api_url, empty_key=True,
send_key=False) | python | def services(cls):
"""Retrieve services statuses from status.gandi.net."""
return cls.json_get('%s/services' % cls.api_url, empty_key=True,
send_key=False) | [
"def",
"services",
"(",
"cls",
")",
":",
"return",
"cls",
".",
"json_get",
"(",
"'%s/services'",
"%",
"cls",
".",
"api_url",
",",
"empty_key",
"=",
"True",
",",
"send_key",
"=",
"False",
")"
] | Retrieve services statuses from status.gandi.net. | [
"Retrieve",
"services",
"statuses",
"from",
"status",
".",
"gandi",
".",
"net",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/status.py#L33-L36 | train |
Gandi/gandi.cli | gandi/cli/modules/status.py | Status.status | def status(cls):
"""Retrieve global status from status.gandi.net."""
return cls.json_get('%s/status' % cls.api_url, empty_key=True,
send_key=False) | python | def status(cls):
"""Retrieve global status from status.gandi.net."""
return cls.json_get('%s/status' % cls.api_url, empty_key=True,
send_key=False) | [
"def",
"status",
"(",
"cls",
")",
":",
"return",
"cls",
".",
"json_get",
"(",
"'%s/status'",
"%",
"cls",
".",
"api_url",
",",
"empty_key",
"=",
"True",
",",
"send_key",
"=",
"False",
")"
] | Retrieve global status from status.gandi.net. | [
"Retrieve",
"global",
"status",
"from",
"status",
".",
"gandi",
".",
"net",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/status.py#L39-L42 | train |
Gandi/gandi.cli | gandi/cli/modules/status.py | Status.events | def events(cls, filters):
"""Retrieve events details from status.gandi.net."""
current = filters.pop('current', False)
current_params = []
if current:
current_params = [('current', 'true')]
filter_url = uparse.urlencode(sorted(list(filters.items())) + current_params)... | python | def events(cls, filters):
"""Retrieve events details from status.gandi.net."""
current = filters.pop('current', False)
current_params = []
if current:
current_params = [('current', 'true')]
filter_url = uparse.urlencode(sorted(list(filters.items())) + current_params)... | [
"def",
"events",
"(",
"cls",
",",
"filters",
")",
":",
"current",
"=",
"filters",
".",
"pop",
"(",
"'current'",
",",
"False",
")",
"current_params",
"=",
"[",
"]",
"if",
"current",
":",
"current_params",
"=",
"[",
"(",
"'current'",
",",
"'true'",
")",
... | Retrieve events details from status.gandi.net. | [
"Retrieve",
"events",
"details",
"from",
"status",
".",
"gandi",
".",
"net",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/status.py#L45-L55 | train |
Gandi/gandi.cli | gandi/cli/commands/paas.py | list | def list(gandi, state, id, vhosts, type, limit):
"""List PaaS instances."""
options = {
'items_per_page': limit,
}
if state:
options['state'] = state
output_keys = ['name', 'state']
if id:
output_keys.append('id')
if vhosts:
output_keys.append('vhost')
if... | python | def list(gandi, state, id, vhosts, type, limit):
"""List PaaS instances."""
options = {
'items_per_page': limit,
}
if state:
options['state'] = state
output_keys = ['name', 'state']
if id:
output_keys.append('id')
if vhosts:
output_keys.append('vhost')
if... | [
"def",
"list",
"(",
"gandi",
",",
"state",
",",
"id",
",",
"vhosts",
",",
"type",
",",
"limit",
")",
":",
"options",
"=",
"{",
"'items_per_page'",
":",
"limit",
",",
"}",
"if",
"state",
":",
"options",
"[",
"'state'",
"]",
"=",
"state",
"output_keys"... | List PaaS instances. | [
"List",
"PaaS",
"instances",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/paas.py#L30-L60 | train |
Gandi/gandi.cli | gandi/cli/commands/paas.py | info | def info(gandi, resource, stat):
"""Display information about a PaaS instance.
Resource can be a vhost, a hostname, or an ID
Cache statistics are based on 24 hours data.
"""
output_keys = ['name', 'type', 'size', 'memory', 'console', 'vhost',
'dc', 'sftp_server', 'git_server', 's... | python | def info(gandi, resource, stat):
"""Display information about a PaaS instance.
Resource can be a vhost, a hostname, or an ID
Cache statistics are based on 24 hours data.
"""
output_keys = ['name', 'type', 'size', 'memory', 'console', 'vhost',
'dc', 'sftp_server', 'git_server', 's... | [
"def",
"info",
"(",
"gandi",
",",
"resource",
",",
"stat",
")",
":",
"output_keys",
"=",
"[",
"'name'",
",",
"'type'",
",",
"'size'",
",",
"'memory'",
",",
"'console'",
",",
"'vhost'",
",",
"'dc'",
",",
"'sftp_server'",
",",
"'git_server'",
",",
"'snapsh... | Display information about a PaaS instance.
Resource can be a vhost, a hostname, or an ID
Cache statistics are based on 24 hours data. | [
"Display",
"information",
"about",
"a",
"PaaS",
"instance",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/paas.py#L68-L93 | train |
Gandi/gandi.cli | gandi/cli/commands/paas.py | clone | def clone(gandi, name, vhost, directory, origin):
"""Clone a remote vhost in a local git repository."""
if vhost != 'default':
directory = vhost
else:
directory = name if not directory else directory
return gandi.paas.clone(name, vhost, directory, origin) | python | def clone(gandi, name, vhost, directory, origin):
"""Clone a remote vhost in a local git repository."""
if vhost != 'default':
directory = vhost
else:
directory = name if not directory else directory
return gandi.paas.clone(name, vhost, directory, origin) | [
"def",
"clone",
"(",
"gandi",
",",
"name",
",",
"vhost",
",",
"directory",
",",
"origin",
")",
":",
"if",
"vhost",
"!=",
"'default'",
":",
"directory",
"=",
"vhost",
"else",
":",
"directory",
"=",
"name",
"if",
"not",
"directory",
"else",
"directory",
... | Clone a remote vhost in a local git repository. | [
"Clone",
"a",
"remote",
"vhost",
"in",
"a",
"local",
"git",
"repository",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/paas.py#L102-L109 | train |
Gandi/gandi.cli | gandi/cli/commands/paas.py | attach | def attach(gandi, name, vhost, remote):
"""Add remote for an instance's default vhost to the local git repository.
"""
return gandi.paas.attach(name, vhost, remote) | python | def attach(gandi, name, vhost, remote):
"""Add remote for an instance's default vhost to the local git repository.
"""
return gandi.paas.attach(name, vhost, remote) | [
"def",
"attach",
"(",
"gandi",
",",
"name",
",",
"vhost",
",",
"remote",
")",
":",
"return",
"gandi",
".",
"paas",
".",
"attach",
"(",
"name",
",",
"vhost",
",",
"remote",
")"
] | Add remote for an instance's default vhost to the local git repository. | [
"Add",
"remote",
"for",
"an",
"instance",
"s",
"default",
"vhost",
"to",
"the",
"local",
"git",
"repository",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/paas.py#L119-L122 | train |
Gandi/gandi.cli | gandi/cli/commands/paas.py | create | def create(gandi, name, size, type, quantity, duration, datacenter, vhosts,
password, snapshotprofile, background, sshkey, ssl, private_key,
poll_cert):
"""Create a new PaaS instance and initialize associated git repository.
you can specify a configuration entry named 'sshkey' containing
... | python | def create(gandi, name, size, type, quantity, duration, datacenter, vhosts,
password, snapshotprofile, background, sshkey, ssl, private_key,
poll_cert):
"""Create a new PaaS instance and initialize associated git repository.
you can specify a configuration entry named 'sshkey' containing
... | [
"def",
"create",
"(",
"gandi",
",",
"name",
",",
"size",
",",
"type",
",",
"quantity",
",",
"duration",
",",
"datacenter",
",",
"vhosts",
",",
"password",
",",
"snapshotprofile",
",",
"background",
",",
"sshkey",
",",
"ssl",
",",
"private_key",
",",
"pol... | Create a new PaaS instance and initialize associated git repository.
you can specify a configuration entry named 'sshkey' containing
path to your sshkey file
$ gandi config set [-g] sshkey ~/.ssh/id_rsa.pub
or getting the sshkey "my_key" from your gandi ssh keyring
$ gandi config set [-g] sshkey... | [
"Create",
"a",
"new",
"PaaS",
"instance",
"and",
"initialize",
"associated",
"git",
"repository",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/paas.py#L207-L249 | train |
Gandi/gandi.cli | gandi/cli/commands/paas.py | restart | def restart(gandi, resource, background, force):
"""Restart a PaaS instance.
Resource can be a vhost, a hostname, or an ID
"""
output_keys = ['id', 'type', 'step']
possible_resources = gandi.paas.resource_list()
for item in resource:
if item not in possible_resources:
gandi... | python | def restart(gandi, resource, background, force):
"""Restart a PaaS instance.
Resource can be a vhost, a hostname, or an ID
"""
output_keys = ['id', 'type', 'step']
possible_resources = gandi.paas.resource_list()
for item in resource:
if item not in possible_resources:
gandi... | [
"def",
"restart",
"(",
"gandi",
",",
"resource",
",",
"background",
",",
"force",
")",
":",
"output_keys",
"=",
"[",
"'id'",
",",
"'type'",
",",
"'step'",
"]",
"possible_resources",
"=",
"gandi",
".",
"paas",
".",
"resource_list",
"(",
")",
"for",
"item"... | Restart a PaaS instance.
Resource can be a vhost, a hostname, or an ID | [
"Restart",
"a",
"PaaS",
"instance",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/paas.py#L315-L343 | train |
Gandi/gandi.cli | gandi/cli/commands/paas.py | types | def types(gandi):
"""List types PaaS instances."""
options = {}
types = gandi.paas.type_list(options)
for type_ in types:
gandi.echo(type_['name'])
return types | python | def types(gandi):
"""List types PaaS instances."""
options = {}
types = gandi.paas.type_list(options)
for type_ in types:
gandi.echo(type_['name'])
return types | [
"def",
"types",
"(",
"gandi",
")",
":",
"options",
"=",
"{",
"}",
"types",
"=",
"gandi",
".",
"paas",
".",
"type_list",
"(",
"options",
")",
"for",
"type_",
"in",
"types",
":",
"gandi",
".",
"echo",
"(",
"type_",
"[",
"'name'",
"]",
")",
"return",
... | List types PaaS instances. | [
"List",
"types",
"PaaS",
"instances",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/paas.py#L348-L355 | train |
Gandi/gandi.cli | gandi/cli/commands/sshkey.py | info | def info(gandi, resource, id, value):
"""Display information about an SSH key.
Resource can be a name or an ID
"""
output_keys = ['name', 'fingerprint']
if id:
output_keys.append('id')
if value:
output_keys.append('value')
ret = []
for item in resource:
sshkey ... | python | def info(gandi, resource, id, value):
"""Display information about an SSH key.
Resource can be a name or an ID
"""
output_keys = ['name', 'fingerprint']
if id:
output_keys.append('id')
if value:
output_keys.append('value')
ret = []
for item in resource:
sshkey ... | [
"def",
"info",
"(",
"gandi",
",",
"resource",
",",
"id",
",",
"value",
")",
":",
"output_keys",
"=",
"[",
"'name'",
",",
"'fingerprint'",
"]",
"if",
"id",
":",
"output_keys",
".",
"append",
"(",
"'id'",
")",
"if",
"value",
":",
"output_keys",
".",
"a... | Display information about an SSH key.
Resource can be a name or an ID | [
"Display",
"information",
"about",
"an",
"SSH",
"key",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/sshkey.py#L47-L64 | train |
Gandi/gandi.cli | gandi/cli/commands/sshkey.py | create | def create(gandi, name, value=None, filename=None):
""" Create a new SSH key. """
if not value and not filename:
raise UsageError('You must set value OR filename.')
if value and filename:
raise UsageError('You must not set value AND filename.')
if filename:
value = filename.rea... | python | def create(gandi, name, value=None, filename=None):
""" Create a new SSH key. """
if not value and not filename:
raise UsageError('You must set value OR filename.')
if value and filename:
raise UsageError('You must not set value AND filename.')
if filename:
value = filename.rea... | [
"def",
"create",
"(",
"gandi",
",",
"name",
",",
"value",
"=",
"None",
",",
"filename",
"=",
"None",
")",
":",
"if",
"not",
"value",
"and",
"not",
"filename",
":",
"raise",
"UsageError",
"(",
"'You must set value OR filename.'",
")",
"if",
"value",
"and",
... | Create a new SSH key. | [
"Create",
"a",
"new",
"SSH",
"key",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/sshkey.py#L72-L86 | train |
Gandi/gandi.cli | gandi/cli/modules/account.py | Account.creditusage | def creditusage(cls):
"""Get credit usage per hour"""
rating = cls.call('hosting.rating.list')
if not rating:
return 0
rating = rating.pop()
usage = [sum(resource.values())
for resource in rating.values()
if isinstance(resource, dict... | python | def creditusage(cls):
"""Get credit usage per hour"""
rating = cls.call('hosting.rating.list')
if not rating:
return 0
rating = rating.pop()
usage = [sum(resource.values())
for resource in rating.values()
if isinstance(resource, dict... | [
"def",
"creditusage",
"(",
"cls",
")",
":",
"rating",
"=",
"cls",
".",
"call",
"(",
"'hosting.rating.list'",
")",
"if",
"not",
"rating",
":",
"return",
"0",
"rating",
"=",
"rating",
".",
"pop",
"(",
")",
"usage",
"=",
"[",
"sum",
"(",
"resource",
"."... | Get credit usage per hour | [
"Get",
"credit",
"usage",
"per",
"hour"
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/account.py#L20-L30 | train |
Gandi/gandi.cli | gandi/cli/modules/account.py | Account.all | def all(cls):
""" Get all informations about this account """
account = cls.info()
creditusage = cls.creditusage()
if not creditusage:
return account
left = account['credits'] / creditusage
years, hours = divmod(left, 365 * 24)
months, hours = divmod... | python | def all(cls):
""" Get all informations about this account """
account = cls.info()
creditusage = cls.creditusage()
if not creditusage:
return account
left = account['credits'] / creditusage
years, hours = divmod(left, 365 * 24)
months, hours = divmod... | [
"def",
"all",
"(",
"cls",
")",
":",
"account",
"=",
"cls",
".",
"info",
"(",
")",
"creditusage",
"=",
"cls",
".",
"creditusage",
"(",
")",
"if",
"not",
"creditusage",
":",
"return",
"account",
"left",
"=",
"account",
"[",
"'credits'",
"]",
"/",
"cred... | Get all informations about this account | [
"Get",
"all",
"informations",
"about",
"this",
"account"
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/account.py#L33-L49 | train |
Gandi/gandi.cli | gandi/cli/commands/snapshotprofile.py | list | def list(gandi, only_paas, only_vm):
""" List snapshot profiles. """
target = None
if only_paas and not only_vm:
target = 'paas'
if only_vm and not only_paas:
target = 'vm'
output_keys = ['id', 'name', 'kept_total', 'target']
result = gandi.snapshotprofile.list({}, target=target... | python | def list(gandi, only_paas, only_vm):
""" List snapshot profiles. """
target = None
if only_paas and not only_vm:
target = 'paas'
if only_vm and not only_paas:
target = 'vm'
output_keys = ['id', 'name', 'kept_total', 'target']
result = gandi.snapshotprofile.list({}, target=target... | [
"def",
"list",
"(",
"gandi",
",",
"only_paas",
",",
"only_vm",
")",
":",
"target",
"=",
"None",
"if",
"only_paas",
"and",
"not",
"only_vm",
":",
"target",
"=",
"'paas'",
"if",
"only_vm",
"and",
"not",
"only_paas",
":",
"target",
"=",
"'vm'",
"output_keys... | List snapshot profiles. | [
"List",
"snapshot",
"profiles",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/snapshotprofile.py#L20-L36 | train |
Gandi/gandi.cli | gandi/cli/commands/certificate.py | list | def list(gandi, id, altnames, csr, cert, all_status, status, dates, limit):
""" List certificates. """
options = {'items_per_page': limit}
if not all_status:
options['status'] = ['valid', 'pending']
output_keys = ['cn', 'plan']
if id:
output_keys.append('id')
if status:
... | python | def list(gandi, id, altnames, csr, cert, all_status, status, dates, limit):
""" List certificates. """
options = {'items_per_page': limit}
if not all_status:
options['status'] = ['valid', 'pending']
output_keys = ['cn', 'plan']
if id:
output_keys.append('id')
if status:
... | [
"def",
"list",
"(",
"gandi",
",",
"id",
",",
"altnames",
",",
"csr",
",",
"cert",
",",
"all_status",
",",
"status",
",",
"dates",
",",
"limit",
")",
":",
"options",
"=",
"{",
"'items_per_page'",
":",
"limit",
"}",
"if",
"not",
"all_status",
":",
"opt... | List certificates. | [
"List",
"certificates",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/certificate.py#L114-L148 | train |
Gandi/gandi.cli | gandi/cli/commands/certificate.py | info | def info(gandi, resource, id, altnames, csr, cert, all_status):
""" Display information about a certificate.
Resource can be a CN or an ID
"""
output_keys = ['cn', 'date_created', 'date_end', 'plan', 'status']
if id:
output_keys.append('id')
if altnames:
output_keys.append('al... | python | def info(gandi, resource, id, altnames, csr, cert, all_status):
""" Display information about a certificate.
Resource can be a CN or an ID
"""
output_keys = ['cn', 'date_created', 'date_end', 'plan', 'status']
if id:
output_keys.append('id')
if altnames:
output_keys.append('al... | [
"def",
"info",
"(",
"gandi",
",",
"resource",
",",
"id",
",",
"altnames",
",",
"csr",
",",
"cert",
",",
"all_status",
")",
":",
"output_keys",
"=",
"[",
"'cn'",
",",
"'date_created'",
",",
"'date_end'",
",",
"'plan'",
",",
"'status'",
"]",
"if",
"id",
... | Display information about a certificate.
Resource can be a CN or an ID | [
"Display",
"information",
"about",
"a",
"certificate",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/certificate.py#L159-L193 | train |
Gandi/gandi.cli | gandi/cli/commands/certificate.py | update | def update(gandi, resource, csr, private_key, country, state, city,
organisation, branch, altnames, dcv_method):
""" Update a certificate CSR.
Resource can be a CN or an ID
"""
ids = gandi.certificate.usable_ids(resource)
if len(ids) > 1:
gandi.echo('Will not update, %s is not p... | python | def update(gandi, resource, csr, private_key, country, state, city,
organisation, branch, altnames, dcv_method):
""" Update a certificate CSR.
Resource can be a CN or an ID
"""
ids = gandi.certificate.usable_ids(resource)
if len(ids) > 1:
gandi.echo('Will not update, %s is not p... | [
"def",
"update",
"(",
"gandi",
",",
"resource",
",",
"csr",
",",
"private_key",
",",
"country",
",",
"state",
",",
"city",
",",
"organisation",
",",
"branch",
",",
"altnames",
",",
"dcv_method",
")",
":",
"ids",
"=",
"gandi",
".",
"certificate",
".",
"... | Update a certificate CSR.
Resource can be a CN or an ID | [
"Update",
"a",
"certificate",
"CSR",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/certificate.py#L389-L416 | train |
Gandi/gandi.cli | gandi/cli/commands/certificate.py | follow | def follow(gandi, resource):
""" Get the operation status
Resource is an operation ID
"""
oper = gandi.oper.info(int(resource))
assert(oper['type'].startswith('certificate_'))
output_cert_oper(gandi, oper)
return oper | python | def follow(gandi, resource):
""" Get the operation status
Resource is an operation ID
"""
oper = gandi.oper.info(int(resource))
assert(oper['type'].startswith('certificate_'))
output_cert_oper(gandi, oper)
return oper | [
"def",
"follow",
"(",
"gandi",
",",
"resource",
")",
":",
"oper",
"=",
"gandi",
".",
"oper",
".",
"info",
"(",
"int",
"(",
"resource",
")",
")",
"assert",
"(",
"oper",
"[",
"'type'",
"]",
".",
"startswith",
"(",
"'certificate_'",
")",
")",
"output_ce... | Get the operation status
Resource is an operation ID | [
"Get",
"the",
"operation",
"status"
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/certificate.py#L422-L430 | train |
Gandi/gandi.cli | gandi/cli/commands/certificate.py | change_dcv | def change_dcv(gandi, resource, dcv_method):
""" Change the DCV for a running certificate operation.
Resource can be a CN or an ID
"""
ids = gandi.certificate.usable_ids(resource)
if len(ids) > 1:
gandi.echo('Will not update, %s is not precise enough.' % resource)
gandi.echo(' * c... | python | def change_dcv(gandi, resource, dcv_method):
""" Change the DCV for a running certificate operation.
Resource can be a CN or an ID
"""
ids = gandi.certificate.usable_ids(resource)
if len(ids) > 1:
gandi.echo('Will not update, %s is not precise enough.' % resource)
gandi.echo(' * c... | [
"def",
"change_dcv",
"(",
"gandi",
",",
"resource",
",",
"dcv_method",
")",
":",
"ids",
"=",
"gandi",
".",
"certificate",
".",
"usable_ids",
"(",
"resource",
")",
"if",
"len",
"(",
"ids",
")",
">",
"1",
":",
"gandi",
".",
"echo",
"(",
"'Will not update... | Change the DCV for a running certificate operation.
Resource can be a CN or an ID | [
"Change",
"the",
"DCV",
"for",
"a",
"running",
"certificate",
"operation",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/certificate.py#L438-L472 | train |
Gandi/gandi.cli | gandi/cli/commands/certificate.py | resend_dcv | def resend_dcv(gandi, resource):
""" Resend the DCV mail.
Resource can be a CN or an ID
"""
ids = gandi.certificate.usable_ids(resource)
if len(ids) > 1:
gandi.echo('Will not update, %s is not precise enough.' % resource)
gandi.echo(' * cert : ' +
'\n * cert : ... | python | def resend_dcv(gandi, resource):
""" Resend the DCV mail.
Resource can be a CN or an ID
"""
ids = gandi.certificate.usable_ids(resource)
if len(ids) > 1:
gandi.echo('Will not update, %s is not precise enough.' % resource)
gandi.echo(' * cert : ' +
'\n * cert : ... | [
"def",
"resend_dcv",
"(",
"gandi",
",",
"resource",
")",
":",
"ids",
"=",
"gandi",
".",
"certificate",
".",
"usable_ids",
"(",
"resource",
")",
"if",
"len",
"(",
"ids",
")",
">",
"1",
":",
"gandi",
".",
"echo",
"(",
"'Will not update, %s is not precise eno... | Resend the DCV mail.
Resource can be a CN or an ID | [
"Resend",
"the",
"DCV",
"mail",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/certificate.py#L478-L509 | train |
Gandi/gandi.cli | gandi/cli/commands/certificate.py | delete | def delete(gandi, resource, background, force):
""" Revoke the certificate.
Resource can be a CN or an ID
"""
ids = gandi.certificate.usable_ids(resource)
if len(ids) > 1:
gandi.echo('Will not delete, %s is not precise enough.' % resource)
gandi.echo(' * cert : ' +
... | python | def delete(gandi, resource, background, force):
""" Revoke the certificate.
Resource can be a CN or an ID
"""
ids = gandi.certificate.usable_ids(resource)
if len(ids) > 1:
gandi.echo('Will not delete, %s is not precise enough.' % resource)
gandi.echo(' * cert : ' +
... | [
"def",
"delete",
"(",
"gandi",
",",
"resource",
",",
"background",
",",
"force",
")",
":",
"ids",
"=",
"gandi",
".",
"certificate",
".",
"usable_ids",
"(",
"resource",
")",
"if",
"len",
"(",
"ids",
")",
">",
"1",
":",
"gandi",
".",
"echo",
"(",
"'W... | Revoke the certificate.
Resource can be a CN or an ID | [
"Revoke",
"the",
"certificate",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/certificate.py#L520-L540 | train |
Gandi/gandi.cli | gandi/cli/commands/certstore.py | list | def list(gandi, id, vhosts, dates, fqdns, limit):
""" List hosted certificates. """
justify = 10
options = {'items_per_page': limit, 'state': 'created'}
output_keys = []
if id:
output_keys.append('id')
output_keys.append('subject')
if dates:
output_keys.extend(['date_crea... | python | def list(gandi, id, vhosts, dates, fqdns, limit):
""" List hosted certificates. """
justify = 10
options = {'items_per_page': limit, 'state': 'created'}
output_keys = []
if id:
output_keys.append('id')
output_keys.append('subject')
if dates:
output_keys.extend(['date_crea... | [
"def",
"list",
"(",
"gandi",
",",
"id",
",",
"vhosts",
",",
"dates",
",",
"fqdns",
",",
"limit",
")",
":",
"justify",
"=",
"10",
"options",
"=",
"{",
"'items_per_page'",
":",
"limit",
",",
"'state'",
":",
"'created'",
"}",
"output_keys",
"=",
"[",
"]... | List hosted certificates. | [
"List",
"hosted",
"certificates",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/certstore.py#L33-L66 | train |
Gandi/gandi.cli | gandi/cli/commands/certstore.py | info | def info(gandi, resource):
""" Display information about a hosted certificate.
Resource can be a FQDN or an ID
"""
output_keys = ['id', 'subject', 'date_created', 'date_expire',
'fqdns', 'vhosts']
result = gandi.hostedcert.infos(resource)
for num, hcert in enumerate(result):... | python | def info(gandi, resource):
""" Display information about a hosted certificate.
Resource can be a FQDN or an ID
"""
output_keys = ['id', 'subject', 'date_created', 'date_expire',
'fqdns', 'vhosts']
result = gandi.hostedcert.infos(resource)
for num, hcert in enumerate(result):... | [
"def",
"info",
"(",
"gandi",
",",
"resource",
")",
":",
"output_keys",
"=",
"[",
"'id'",
",",
"'subject'",
",",
"'date_created'",
",",
"'date_expire'",
",",
"'fqdns'",
",",
"'vhosts'",
"]",
"result",
"=",
"gandi",
".",
"hostedcert",
".",
"infos",
"(",
"r... | Display information about a hosted certificate.
Resource can be a FQDN or an ID | [
"Display",
"information",
"about",
"a",
"hosted",
"certificate",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/certstore.py#L72-L86 | train |
Gandi/gandi.cli | gandi/cli/commands/certstore.py | create | def create(gandi, private_key, certificate, certificate_id):
""" Create a new hosted certificate. """
if not certificate and not certificate_id:
gandi.echo('One of --certificate or --certificate-id is needed.')
return
if certificate and certificate_id:
gandi.echo('Only one of --certi... | python | def create(gandi, private_key, certificate, certificate_id):
""" Create a new hosted certificate. """
if not certificate and not certificate_id:
gandi.echo('One of --certificate or --certificate-id is needed.')
return
if certificate and certificate_id:
gandi.echo('Only one of --certi... | [
"def",
"create",
"(",
"gandi",
",",
"private_key",
",",
"certificate",
",",
"certificate_id",
")",
":",
"if",
"not",
"certificate",
"and",
"not",
"certificate_id",
":",
"gandi",
".",
"echo",
"(",
"'One of --certificate or --certificate-id is needed.'",
")",
"return"... | Create a new hosted certificate. | [
"Create",
"a",
"new",
"hosted",
"certificate",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/certstore.py#L97-L124 | train |
Gandi/gandi.cli | gandi/cli/commands/certstore.py | delete | def delete(gandi, resource, force):
""" Delete a hosted certificate.
Resource can be a FQDN or an ID
"""
infos = gandi.hostedcert.infos(resource)
if not infos:
return
if not force:
proceed = click.confirm('Are you sure to delete the following hosted '
... | python | def delete(gandi, resource, force):
""" Delete a hosted certificate.
Resource can be a FQDN or an ID
"""
infos = gandi.hostedcert.infos(resource)
if not infos:
return
if not force:
proceed = click.confirm('Are you sure to delete the following hosted '
... | [
"def",
"delete",
"(",
"gandi",
",",
"resource",
",",
"force",
")",
":",
"infos",
"=",
"gandi",
".",
"hostedcert",
".",
"infos",
"(",
"resource",
")",
"if",
"not",
"infos",
":",
"return",
"if",
"not",
"force",
":",
"proceed",
"=",
"click",
".",
"confi... | Delete a hosted certificate.
Resource can be a FQDN or an ID | [
"Delete",
"a",
"hosted",
"certificate",
"."
] | 6ee5b8fc8ec44b0a6c232043ca610606ad8f693d | https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/certstore.py#L133-L152 | train |
aykut/django-bulk-update | django_bulk_update/helper.py | flatten | def flatten(l, types=(list, float)):
"""
Flat nested list of lists into a single list.
"""
l = [item if isinstance(item, types) else [item] for item in l]
return [item for sublist in l for item in sublist] | python | def flatten(l, types=(list, float)):
"""
Flat nested list of lists into a single list.
"""
l = [item if isinstance(item, types) else [item] for item in l]
return [item for sublist in l for item in sublist] | [
"def",
"flatten",
"(",
"l",
",",
"types",
"=",
"(",
"list",
",",
"float",
")",
")",
":",
"l",
"=",
"[",
"item",
"if",
"isinstance",
"(",
"item",
",",
"types",
")",
"else",
"[",
"item",
"]",
"for",
"item",
"in",
"l",
"]",
"return",
"[",
"item",
... | Flat nested list of lists into a single list. | [
"Flat",
"nested",
"list",
"of",
"lists",
"into",
"a",
"single",
"list",
"."
] | 399e64d820133a79f910682c1cf247938c5c4784 | https://github.com/aykut/django-bulk-update/blob/399e64d820133a79f910682c1cf247938c5c4784/django_bulk_update/helper.py#L41-L46 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.