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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
softlayer/softlayer-python | SoftLayer/managers/account.py | AccountManager.get_invoices | def get_invoices(self, limit=50, closed=False, get_all=False):
"""Gets an accounts invoices.
:param int limit: Number of invoices to get back in a single call.
:param bool closed: If True, will also get CLOSED invoices
:param bool get_all: If True, will paginate through invoices until a... | python | def get_invoices(self, limit=50, closed=False, get_all=False):
"""Gets an accounts invoices.
:param int limit: Number of invoices to get back in a single call.
:param bool closed: If True, will also get CLOSED invoices
:param bool get_all: If True, will paginate through invoices until a... | [
"def",
"get_invoices",
"(",
"self",
",",
"limit",
"=",
"50",
",",
"closed",
"=",
"False",
",",
"get_all",
"=",
"False",
")",
":",
"mask",
"=",
"\"mask[invoiceTotalAmount, itemCount]\"",
"_filter",
"=",
"{",
"'invoices'",
":",
"{",
"'createDate'",
":",
"{",
... | Gets an accounts invoices.
:param int limit: Number of invoices to get back in a single call.
:param bool closed: If True, will also get CLOSED invoices
:param bool get_all: If True, will paginate through invoices until all have been retrieved.
:return: Billing_Invoice | [
"Gets",
"an",
"accounts",
"invoices",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/account.py#L94-L118 | train |
softlayer/softlayer-python | SoftLayer/CLI/loadbal/create_options.py | cli | def cli(env):
"""Get price options to create a load balancer with."""
mgr = SoftLayer.LoadBalancerManager(env.client)
table = formatting.Table(['price_id', 'capacity', 'description', 'price'])
table.sortby = 'price'
table.align['price'] = 'r'
table.align['capacity'] = 'r'
table.align['id'... | python | def cli(env):
"""Get price options to create a load balancer with."""
mgr = SoftLayer.LoadBalancerManager(env.client)
table = formatting.Table(['price_id', 'capacity', 'description', 'price'])
table.sortby = 'price'
table.align['price'] = 'r'
table.align['capacity'] = 'r'
table.align['id'... | [
"def",
"cli",
"(",
"env",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"LoadBalancerManager",
"(",
"env",
".",
"client",
")",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"'price_id'",
",",
"'capacity'",
",",
"'description'",
",",
"'price'",
"]",
")",
... | Get price options to create a load balancer with. | [
"Get",
"price",
"options",
"to",
"create",
"a",
"load",
"balancer",
"with",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/loadbal/create_options.py#L13-L35 | train |
softlayer/softlayer-python | SoftLayer/CLI/virt/credentials.py | cli | def cli(env, identifier):
"""List virtual server credentials."""
vsi = SoftLayer.VSManager(env.client)
vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS')
instance = vsi.get_instance(vs_id)
table = formatting.Table(['username', 'password'])
for item in instance['operatingSystem']['pa... | python | def cli(env, identifier):
"""List virtual server credentials."""
vsi = SoftLayer.VSManager(env.client)
vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS')
instance = vsi.get_instance(vs_id)
table = formatting.Table(['username', 'password'])
for item in instance['operatingSystem']['pa... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"vsi",
"=",
"SoftLayer",
".",
"VSManager",
"(",
"env",
".",
"client",
")",
"vs_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"vsi",
".",
"resolve_ids",
",",
"identifier",
",",
"'VS'",
")",
"instance... | List virtual server credentials. | [
"List",
"virtual",
"server",
"credentials",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/credentials.py#L15-L25 | train |
softlayer/softlayer-python | SoftLayer/CLI/dns/record_edit.py | cli | def cli(env, zone_id, by_record, by_id, data, ttl):
"""Update DNS record."""
manager = SoftLayer.DNSManager(env.client)
zone_id = helpers.resolve_id(manager.resolve_ids, zone_id, name='zone')
results = manager.get_records(zone_id, host=by_record)
for result in results:
if by_id and str(res... | python | def cli(env, zone_id, by_record, by_id, data, ttl):
"""Update DNS record."""
manager = SoftLayer.DNSManager(env.client)
zone_id = helpers.resolve_id(manager.resolve_ids, zone_id, name='zone')
results = manager.get_records(zone_id, host=by_record)
for result in results:
if by_id and str(res... | [
"def",
"cli",
"(",
"env",
",",
"zone_id",
",",
"by_record",
",",
"by_id",
",",
"data",
",",
"ttl",
")",
":",
"manager",
"=",
"SoftLayer",
".",
"DNSManager",
"(",
"env",
".",
"client",
")",
"zone_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"manager",
... | Update DNS record. | [
"Update",
"DNS",
"record",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/dns/record_edit.py#L21-L33 | train |
softlayer/softlayer-python | SoftLayer/CLI/hardware/ready.py | cli | def cli(env, identifier, wait):
"""Check if a server is ready."""
compute = SoftLayer.HardwareManager(env.client)
compute_id = helpers.resolve_id(compute.resolve_ids, identifier,
'hardware')
ready = compute.wait_for_ready(compute_id, wait)
if ready:
env.f... | python | def cli(env, identifier, wait):
"""Check if a server is ready."""
compute = SoftLayer.HardwareManager(env.client)
compute_id = helpers.resolve_id(compute.resolve_ids, identifier,
'hardware')
ready = compute.wait_for_ready(compute_id, wait)
if ready:
env.f... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
",",
"wait",
")",
":",
"compute",
"=",
"SoftLayer",
".",
"HardwareManager",
"(",
"env",
".",
"client",
")",
"compute_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"compute",
".",
"resolve_ids",
",",
"identifier",... | Check if a server is ready. | [
"Check",
"if",
"a",
"server",
"is",
"ready",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/hardware/ready.py#L17-L27 | train |
softlayer/softlayer-python | SoftLayer/CLI/ticket/summary.py | cli | def cli(env):
"""Summary info about tickets."""
mask = ('openTicketCount, closedTicketCount, '
'openBillingTicketCount, openOtherTicketCount, '
'openSalesTicketCount, openSupportTicketCount, '
'openAccountingTicketCount')
account = env.client['Account'].getObject(mask=ma... | python | def cli(env):
"""Summary info about tickets."""
mask = ('openTicketCount, closedTicketCount, '
'openBillingTicketCount, openOtherTicketCount, '
'openSalesTicketCount, openSupportTicketCount, '
'openAccountingTicketCount')
account = env.client['Account'].getObject(mask=ma... | [
"def",
"cli",
"(",
"env",
")",
":",
"mask",
"=",
"(",
"'openTicketCount, closedTicketCount, '",
"'openBillingTicketCount, openOtherTicketCount, '",
"'openSalesTicketCount, openSupportTicketCount, '",
"'openAccountingTicketCount'",
")",
"account",
"=",
"env",
".",
"client",
"[",... | Summary info about tickets. | [
"Summary",
"info",
"about",
"tickets",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/ticket/summary.py#L12-L33 | train |
softlayer/softlayer-python | SoftLayer/CLI/globalip/list.py | cli | def cli(env, ip_version):
"""List all global IPs."""
mgr = SoftLayer.NetworkManager(env.client)
table = formatting.Table(['id', 'ip', 'assigned', 'target'])
version = None
if ip_version == 'v4':
version = 4
elif ip_version == 'v6':
version = 6
ips = mgr.list_global_ips(ve... | python | def cli(env, ip_version):
"""List all global IPs."""
mgr = SoftLayer.NetworkManager(env.client)
table = formatting.Table(['id', 'ip', 'assigned', 'target'])
version = None
if ip_version == 'v4':
version = 4
elif ip_version == 'v6':
version = 6
ips = mgr.list_global_ips(ve... | [
"def",
"cli",
"(",
"env",
",",
"ip_version",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"NetworkManager",
"(",
"env",
".",
"client",
")",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"'id'",
",",
"'ip'",
",",
"'assigned'",
",",
"'target'",
"]",
"... | List all global IPs. | [
"List",
"all",
"global",
"IPs",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/globalip/list.py#L16-L50 | train |
softlayer/softlayer-python | SoftLayer/CLI/globalip/cancel.py | cli | def cli(env, identifier):
"""Cancel global IP."""
mgr = SoftLayer.NetworkManager(env.client)
global_ip_id = helpers.resolve_id(mgr.resolve_global_ip_ids, identifier,
name='global ip')
if not (env.skip_confirmations or formatting.no_going_back(global_ip_id)):
... | python | def cli(env, identifier):
"""Cancel global IP."""
mgr = SoftLayer.NetworkManager(env.client)
global_ip_id = helpers.resolve_id(mgr.resolve_global_ip_ids, identifier,
name='global ip')
if not (env.skip_confirmations or formatting.no_going_back(global_ip_id)):
... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"NetworkManager",
"(",
"env",
".",
"client",
")",
"global_ip_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"mgr",
".",
"resolve_global_ip_ids",
",",
"identifier",
",",
"nam... | Cancel global IP. | [
"Cancel",
"global",
"IP",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/globalip/cancel.py#L16-L26 | train |
softlayer/softlayer-python | SoftLayer/API.py | create_client_from_env | def create_client_from_env(username=None,
api_key=None,
endpoint_url=None,
timeout=None,
auth=None,
config_file=None,
proxy=None,
u... | python | def create_client_from_env(username=None,
api_key=None,
endpoint_url=None,
timeout=None,
auth=None,
config_file=None,
proxy=None,
u... | [
"def",
"create_client_from_env",
"(",
"username",
"=",
"None",
",",
"api_key",
"=",
"None",
",",
"endpoint_url",
"=",
"None",
",",
"timeout",
"=",
"None",
",",
"auth",
"=",
"None",
",",
"config_file",
"=",
"None",
",",
"proxy",
"=",
"None",
",",
"user_ag... | Creates a SoftLayer API client using your environment.
Settings are loaded via keyword arguments, environemtal variables and
config file.
:param username: an optional API username if you wish to bypass the
package's built-in username
:param api_key: an optional API key if you wish to bypass th... | [
"Creates",
"a",
"SoftLayer",
"API",
"client",
"using",
"your",
"environment",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/API.py#L41-L131 | train |
softlayer/softlayer-python | SoftLayer/API.py | BaseClient.call | def call(self, service, method, *args, **kwargs):
"""Make a SoftLayer API call.
:param method: the method to call on the service
:param \\*args: (optional) arguments for the remote call
:param id: (optional) id for the resource
:param mask: (optional) object mask
:param ... | python | def call(self, service, method, *args, **kwargs):
"""Make a SoftLayer API call.
:param method: the method to call on the service
:param \\*args: (optional) arguments for the remote call
:param id: (optional) id for the resource
:param mask: (optional) object mask
:param ... | [
"def",
"call",
"(",
"self",
",",
"service",
",",
"method",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"if",
"kwargs",
".",
"pop",
"(",
"'iter'",
",",
"False",
")",
":",
"return",
"list",
"(",
"self",
".",
"iter_call",
"(",
"service",
",",
"... | Make a SoftLayer API call.
:param method: the method to call on the service
:param \\*args: (optional) arguments for the remote call
:param id: (optional) id for the resource
:param mask: (optional) object mask
:param dict filter: (optional) filter dict
:param dict heade... | [
"Make",
"a",
"SoftLayer",
"API",
"call",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/API.py#L193-L265 | train |
softlayer/softlayer-python | SoftLayer/API.py | Service.call | def call(self, name, *args, **kwargs):
"""Make a SoftLayer API call
:param service: the name of the SoftLayer API service
:param method: the method to call on the service
:param \\*args: same optional arguments that ``BaseClient.call`` takes
:param \\*\\*kwargs: same optional ke... | python | def call(self, name, *args, **kwargs):
"""Make a SoftLayer API call
:param service: the name of the SoftLayer API service
:param method: the method to call on the service
:param \\*args: same optional arguments that ``BaseClient.call`` takes
:param \\*\\*kwargs: same optional ke... | [
"def",
"call",
"(",
"self",
",",
"name",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"return",
"self",
".",
"client",
".",
"call",
"(",
"self",
".",
"name",
",",
"name",
",",
"*",
"args",
",",
"**",
"kwargs",
")"
] | Make a SoftLayer API call
:param service: the name of the SoftLayer API service
:param method: the method to call on the service
:param \\*args: same optional arguments that ``BaseClient.call`` takes
:param \\*\\*kwargs: same optional keyword arguments that
``... | [
"Make",
"a",
"SoftLayer",
"API",
"call"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/API.py#L339-L357 | train |
softlayer/softlayer-python | SoftLayer/CLI/object_storage/credential/list.py | cli | def cli(env, identifier):
"""Retrieve credentials used for generating an AWS signature. Max of 2."""
mgr = SoftLayer.ObjectStorageManager(env.client)
credential_list = mgr.list_credential(identifier)
table = formatting.Table(['id', 'password', 'username', 'type_name'])
for credential in credential... | python | def cli(env, identifier):
"""Retrieve credentials used for generating an AWS signature. Max of 2."""
mgr = SoftLayer.ObjectStorageManager(env.client)
credential_list = mgr.list_credential(identifier)
table = formatting.Table(['id', 'password', 'username', 'type_name'])
for credential in credential... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"ObjectStorageManager",
"(",
"env",
".",
"client",
")",
"credential_list",
"=",
"mgr",
".",
"list_credential",
"(",
"identifier",
")",
"table",
"=",
"formatting",
".",
"Ta... | Retrieve credentials used for generating an AWS signature. Max of 2. | [
"Retrieve",
"credentials",
"used",
"for",
"generating",
"an",
"AWS",
"signature",
".",
"Max",
"of",
"2",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/object_storage/credential/list.py#L14-L29 | train |
softlayer/softlayer-python | SoftLayer/CLI/dedicatedhost/list.py | cli | def cli(env, sortby, cpu, columns, datacenter, name, memory, disk, tag):
"""List dedicated host."""
mgr = SoftLayer.DedicatedHostManager(env.client)
hosts = mgr.list_instances(cpus=cpu,
datacenter=datacenter,
hostname=name,
... | python | def cli(env, sortby, cpu, columns, datacenter, name, memory, disk, tag):
"""List dedicated host."""
mgr = SoftLayer.DedicatedHostManager(env.client)
hosts = mgr.list_instances(cpus=cpu,
datacenter=datacenter,
hostname=name,
... | [
"def",
"cli",
"(",
"env",
",",
"sortby",
",",
"cpu",
",",
"columns",
",",
"datacenter",
",",
"name",
",",
"memory",
",",
"disk",
",",
"tag",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"DedicatedHostManager",
"(",
"env",
".",
"client",
")",
"hosts",
"=",... | List dedicated host. | [
"List",
"dedicated",
"host",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/dedicatedhost/list.py#L52-L70 | train |
softlayer/softlayer-python | SoftLayer/CLI/environment.py | Environment.input | def input(self, prompt, default=None, show_default=True):
"""Provide a command prompt."""
return click.prompt(prompt, default=default, show_default=show_default) | python | def input(self, prompt, default=None, show_default=True):
"""Provide a command prompt."""
return click.prompt(prompt, default=default, show_default=show_default) | [
"def",
"input",
"(",
"self",
",",
"prompt",
",",
"default",
"=",
"None",
",",
"show_default",
"=",
"True",
")",
":",
"return",
"click",
".",
"prompt",
"(",
"prompt",
",",
"default",
"=",
"default",
",",
"show_default",
"=",
"show_default",
")"
] | Provide a command prompt. | [
"Provide",
"a",
"command",
"prompt",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/environment.py#L58-L60 | train |
softlayer/softlayer-python | SoftLayer/CLI/environment.py | Environment.getpass | def getpass(self, prompt, default=None):
"""Provide a password prompt."""
return click.prompt(prompt, hide_input=True, default=default) | python | def getpass(self, prompt, default=None):
"""Provide a password prompt."""
return click.prompt(prompt, hide_input=True, default=default) | [
"def",
"getpass",
"(",
"self",
",",
"prompt",
",",
"default",
"=",
"None",
")",
":",
"return",
"click",
".",
"prompt",
"(",
"prompt",
",",
"hide_input",
"=",
"True",
",",
"default",
"=",
"default",
")"
] | Provide a password prompt. | [
"Provide",
"a",
"password",
"prompt",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/environment.py#L62-L64 | train |
softlayer/softlayer-python | SoftLayer/CLI/environment.py | Environment.list_commands | def list_commands(self, *path):
"""Command listing."""
path_str = ':'.join(path)
commands = []
for command in self.commands:
# Filter based on prefix and the segment length
if all([command.startswith(path_str),
len(path) == command.count(":")... | python | def list_commands(self, *path):
"""Command listing."""
path_str = ':'.join(path)
commands = []
for command in self.commands:
# Filter based on prefix and the segment length
if all([command.startswith(path_str),
len(path) == command.count(":")... | [
"def",
"list_commands",
"(",
"self",
",",
"*",
"path",
")",
":",
"path_str",
"=",
"':'",
".",
"join",
"(",
"path",
")",
"commands",
"=",
"[",
"]",
"for",
"command",
"in",
"self",
".",
"commands",
":",
"if",
"all",
"(",
"[",
"command",
".",
"startsw... | Command listing. | [
"Command",
"listing",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/environment.py#L67-L82 | train |
softlayer/softlayer-python | SoftLayer/CLI/environment.py | Environment.get_command | def get_command(self, *path):
"""Return command at the given path or raise error."""
path_str = ':'.join(path)
if path_str in self.commands:
return self.commands[path_str].load()
return None | python | def get_command(self, *path):
"""Return command at the given path or raise error."""
path_str = ':'.join(path)
if path_str in self.commands:
return self.commands[path_str].load()
return None | [
"def",
"get_command",
"(",
"self",
",",
"*",
"path",
")",
":",
"path_str",
"=",
"':'",
".",
"join",
"(",
"path",
")",
"if",
"path_str",
"in",
"self",
".",
"commands",
":",
"return",
"self",
".",
"commands",
"[",
"path_str",
"]",
".",
"load",
"(",
"... | Return command at the given path or raise error. | [
"Return",
"command",
"at",
"the",
"given",
"path",
"or",
"raise",
"error",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/environment.py#L84-L91 | train |
softlayer/softlayer-python | SoftLayer/CLI/environment.py | Environment.resolve_alias | def resolve_alias(self, path_str):
"""Returns the actual command name. Uses the alias mapping."""
if path_str in self.aliases:
return self.aliases[path_str]
return path_str | python | def resolve_alias(self, path_str):
"""Returns the actual command name. Uses the alias mapping."""
if path_str in self.aliases:
return self.aliases[path_str]
return path_str | [
"def",
"resolve_alias",
"(",
"self",
",",
"path_str",
")",
":",
"if",
"path_str",
"in",
"self",
".",
"aliases",
":",
"return",
"self",
".",
"aliases",
"[",
"path_str",
"]",
"return",
"path_str"
] | Returns the actual command name. Uses the alias mapping. | [
"Returns",
"the",
"actual",
"command",
"name",
".",
"Uses",
"the",
"alias",
"mapping",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/environment.py#L93-L97 | train |
softlayer/softlayer-python | SoftLayer/CLI/environment.py | Environment.load | def load(self):
"""Loads all modules."""
if self._modules_loaded is True:
return
self.load_modules_from_python(routes.ALL_ROUTES)
self.aliases.update(routes.ALL_ALIASES)
self._load_modules_from_entry_points('softlayer.cli')
self._modules_loaded = True | python | def load(self):
"""Loads all modules."""
if self._modules_loaded is True:
return
self.load_modules_from_python(routes.ALL_ROUTES)
self.aliases.update(routes.ALL_ALIASES)
self._load_modules_from_entry_points('softlayer.cli')
self._modules_loaded = True | [
"def",
"load",
"(",
"self",
")",
":",
"if",
"self",
".",
"_modules_loaded",
"is",
"True",
":",
"return",
"self",
".",
"load_modules_from_python",
"(",
"routes",
".",
"ALL_ROUTES",
")",
"self",
".",
"aliases",
".",
"update",
"(",
"routes",
".",
"ALL_ALIASES... | Loads all modules. | [
"Loads",
"all",
"modules",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/environment.py#L99-L108 | train |
softlayer/softlayer-python | SoftLayer/CLI/environment.py | Environment.load_modules_from_python | def load_modules_from_python(self, route_list):
"""Load modules from the native python source."""
for name, modpath in route_list:
if ':' in modpath:
path, attr = modpath.split(':', 1)
else:
path, attr = modpath, None
self.commands[name... | python | def load_modules_from_python(self, route_list):
"""Load modules from the native python source."""
for name, modpath in route_list:
if ':' in modpath:
path, attr = modpath.split(':', 1)
else:
path, attr = modpath, None
self.commands[name... | [
"def",
"load_modules_from_python",
"(",
"self",
",",
"route_list",
")",
":",
"for",
"name",
",",
"modpath",
"in",
"route_list",
":",
"if",
"':'",
"in",
"modpath",
":",
"path",
",",
"attr",
"=",
"modpath",
".",
"split",
"(",
"':'",
",",
"1",
")",
"else"... | Load modules from the native python source. | [
"Load",
"modules",
"from",
"the",
"native",
"python",
"source",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/environment.py#L110-L117 | train |
softlayer/softlayer-python | SoftLayer/CLI/environment.py | Environment.ensure_client | def ensure_client(self, config_file=None, is_demo=False, proxy=None):
"""Create a new SLAPI client to the environment.
This will be a no-op if there is already a client in this environment.
"""
if self.client is not None:
return
# Environment can be passed in explic... | python | def ensure_client(self, config_file=None, is_demo=False, proxy=None):
"""Create a new SLAPI client to the environment.
This will be a no-op if there is already a client in this environment.
"""
if self.client is not None:
return
# Environment can be passed in explic... | [
"def",
"ensure_client",
"(",
"self",
",",
"config_file",
"=",
"None",
",",
"is_demo",
"=",
"False",
",",
"proxy",
"=",
"None",
")",
":",
"if",
"self",
".",
"client",
"is",
"not",
"None",
":",
"return",
"if",
"is_demo",
":",
"client",
"=",
"SoftLayer",
... | Create a new SLAPI client to the environment.
This will be a no-op if there is already a client in this environment. | [
"Create",
"a",
"new",
"SLAPI",
"client",
"to",
"the",
"environment",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/environment.py#L133-L153 | train |
softlayer/softlayer-python | SoftLayer/CLI/helpers.py | multi_option | def multi_option(*param_decls, **attrs):
"""modify help text and indicate option is permitted multiple times
:param param_decls:
:param attrs:
:return:
"""
attrhelp = attrs.get('help', None)
if attrhelp is not None:
newhelp = attrhelp + " (multiple occurrence permitted)"
at... | python | def multi_option(*param_decls, **attrs):
"""modify help text and indicate option is permitted multiple times
:param param_decls:
:param attrs:
:return:
"""
attrhelp = attrs.get('help', None)
if attrhelp is not None:
newhelp = attrhelp + " (multiple occurrence permitted)"
at... | [
"def",
"multi_option",
"(",
"*",
"param_decls",
",",
"**",
"attrs",
")",
":",
"attrhelp",
"=",
"attrs",
".",
"get",
"(",
"'help'",
",",
"None",
")",
"if",
"attrhelp",
"is",
"not",
"None",
":",
"newhelp",
"=",
"attrhelp",
"+",
"\" (multiple occurrence permi... | modify help text and indicate option is permitted multiple times
:param param_decls:
:param attrs:
:return: | [
"modify",
"help",
"text",
"and",
"indicate",
"option",
"is",
"permitted",
"multiple",
"times"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/helpers.py#L14-L27 | train |
softlayer/softlayer-python | SoftLayer/CLI/helpers.py | resolve_id | def resolve_id(resolver, identifier, name='object'):
"""Resolves a single id using a resolver function.
:param resolver: function that resolves ids. Should return None or a list of ids.
:param string identifier: a string identifier used to resolve ids
:param string name: the object type, to be used in ... | python | def resolve_id(resolver, identifier, name='object'):
"""Resolves a single id using a resolver function.
:param resolver: function that resolves ids. Should return None or a list of ids.
:param string identifier: a string identifier used to resolve ids
:param string name: the object type, to be used in ... | [
"def",
"resolve_id",
"(",
"resolver",
",",
"identifier",
",",
"name",
"=",
"'object'",
")",
":",
"try",
":",
"return",
"int",
"(",
"identifier",
")",
"except",
"ValueError",
":",
"pass",
"ids",
"=",
"resolver",
"(",
"identifier",
")",
"if",
"len",
"(",
... | Resolves a single id using a resolver function.
:param resolver: function that resolves ids. Should return None or a list of ids.
:param string identifier: a string identifier used to resolve ids
:param string name: the object type, to be used in error messages | [
"Resolves",
"a",
"single",
"id",
"using",
"a",
"resolver",
"function",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/helpers.py#L30-L53 | train |
softlayer/softlayer-python | SoftLayer/CLI/ssl/remove.py | cli | def cli(env, identifier):
"""Remove SSL certificate."""
manager = SoftLayer.SSLManager(env.client)
if not (env.skip_confirmations or formatting.no_going_back('yes')):
raise exceptions.CLIAbort("Aborted.")
manager.remove_certificate(identifier) | python | def cli(env, identifier):
"""Remove SSL certificate."""
manager = SoftLayer.SSLManager(env.client)
if not (env.skip_confirmations or formatting.no_going_back('yes')):
raise exceptions.CLIAbort("Aborted.")
manager.remove_certificate(identifier) | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"manager",
"=",
"SoftLayer",
".",
"SSLManager",
"(",
"env",
".",
"client",
")",
"if",
"not",
"(",
"env",
".",
"skip_confirmations",
"or",
"formatting",
".",
"no_going_back",
"(",
"'yes'",
")",
")",
... | Remove SSL certificate. | [
"Remove",
"SSL",
"certificate",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/ssl/remove.py#L15-L22 | train |
softlayer/softlayer-python | SoftLayer/CLI/file/snapshot/order.py | cli | def cli(env, volume_id, capacity, tier, upgrade):
"""Order snapshot space for a file storage volume."""
file_manager = SoftLayer.FileStorageManager(env.client)
if tier is not None:
tier = float(tier)
try:
order = file_manager.order_snapshot_space(
volume_id,
cap... | python | def cli(env, volume_id, capacity, tier, upgrade):
"""Order snapshot space for a file storage volume."""
file_manager = SoftLayer.FileStorageManager(env.client)
if tier is not None:
tier = float(tier)
try:
order = file_manager.order_snapshot_space(
volume_id,
cap... | [
"def",
"cli",
"(",
"env",
",",
"volume_id",
",",
"capacity",
",",
"tier",
",",
"upgrade",
")",
":",
"file_manager",
"=",
"SoftLayer",
".",
"FileStorageManager",
"(",
"env",
".",
"client",
")",
"if",
"tier",
"is",
"not",
"None",
":",
"tier",
"=",
"float... | Order snapshot space for a file storage volume. | [
"Order",
"snapshot",
"space",
"for",
"a",
"file",
"storage",
"volume",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/file/snapshot/order.py#L27-L53 | train |
softlayer/softlayer-python | SoftLayer/CLI/virt/edit.py | cli | def cli(env, identifier, domain, userfile, tag, hostname, userdata,
public_speed, private_speed):
"""Edit a virtual server's details."""
if userdata and userfile:
raise exceptions.ArgumentError(
'[-u | --userdata] not allowed with [-F | --userfile]')
data = {}
if userdata:... | python | def cli(env, identifier, domain, userfile, tag, hostname, userdata,
public_speed, private_speed):
"""Edit a virtual server's details."""
if userdata and userfile:
raise exceptions.ArgumentError(
'[-u | --userdata] not allowed with [-F | --userfile]')
data = {}
if userdata:... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
",",
"domain",
",",
"userfile",
",",
"tag",
",",
"hostname",
",",
"userdata",
",",
"public_speed",
",",
"private_speed",
")",
":",
"if",
"userdata",
"and",
"userfile",
":",
"raise",
"exceptions",
".",
"ArgumentE... | Edit a virtual server's details. | [
"Edit",
"a",
"virtual",
"server",
"s",
"details",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/edit.py#L33-L64 | train |
softlayer/softlayer-python | SoftLayer/CLI/file/replication/order.py | cli | def cli(env, volume_id, snapshot_schedule, location, tier):
"""Order a file storage replica volume."""
file_manager = SoftLayer.FileStorageManager(env.client)
if tier is not None:
tier = float(tier)
try:
order = file_manager.order_replicant_volume(
volume_id,
sn... | python | def cli(env, volume_id, snapshot_schedule, location, tier):
"""Order a file storage replica volume."""
file_manager = SoftLayer.FileStorageManager(env.client)
if tier is not None:
tier = float(tier)
try:
order = file_manager.order_replicant_volume(
volume_id,
sn... | [
"def",
"cli",
"(",
"env",
",",
"volume_id",
",",
"snapshot_schedule",
",",
"location",
",",
"tier",
")",
":",
"file_manager",
"=",
"SoftLayer",
".",
"FileStorageManager",
"(",
"env",
".",
"client",
")",
"if",
"tier",
"is",
"not",
"None",
":",
"tier",
"="... | Order a file storage replica volume. | [
"Order",
"a",
"file",
"storage",
"replica",
"volume",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/file/replication/order.py#L29-L53 | train |
softlayer/softlayer-python | SoftLayer/CLI/block/replication/failback.py | cli | def cli(env, volume_id, replicant_id):
"""Failback a block volume from the given replicant volume."""
block_storage_manager = SoftLayer.BlockStorageManager(env.client)
success = block_storage_manager.failback_from_replicant(
volume_id,
replicant_id
)
if success:
click.echo(... | python | def cli(env, volume_id, replicant_id):
"""Failback a block volume from the given replicant volume."""
block_storage_manager = SoftLayer.BlockStorageManager(env.client)
success = block_storage_manager.failback_from_replicant(
volume_id,
replicant_id
)
if success:
click.echo(... | [
"def",
"cli",
"(",
"env",
",",
"volume_id",
",",
"replicant_id",
")",
":",
"block_storage_manager",
"=",
"SoftLayer",
".",
"BlockStorageManager",
"(",
"env",
".",
"client",
")",
"success",
"=",
"block_storage_manager",
".",
"failback_from_replicant",
"(",
"volume_... | Failback a block volume from the given replicant volume. | [
"Failback",
"a",
"block",
"volume",
"from",
"the",
"given",
"replicant",
"volume",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/block/replication/failback.py#L13-L25 | train |
softlayer/softlayer-python | SoftLayer/CLI/virt/placementgroup/detail.py | cli | def cli(env, identifier):
"""View details of a placement group.
IDENTIFIER can be either the Name or Id of the placement group you want to view
"""
manager = PlacementManager(env.client)
group_id = helpers.resolve_id(manager.resolve_ids, identifier, 'placement_group')
result = manager.get_objec... | python | def cli(env, identifier):
"""View details of a placement group.
IDENTIFIER can be either the Name or Id of the placement group you want to view
"""
manager = PlacementManager(env.client)
group_id = helpers.resolve_id(manager.resolve_ids, identifier, 'placement_group')
result = manager.get_objec... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"manager",
"=",
"PlacementManager",
"(",
"env",
".",
"client",
")",
"group_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"manager",
".",
"resolve_ids",
",",
"identifier",
",",
"'placement_group'",
")",
... | View details of a placement group.
IDENTIFIER can be either the Name or Id of the placement group you want to view | [
"View",
"details",
"of",
"a",
"placement",
"group",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/placementgroup/detail.py#L14-L54 | train |
softlayer/softlayer-python | SoftLayer/CLI/user/list.py | cli | def cli(env, columns):
"""List Users."""
mgr = SoftLayer.UserManager(env.client)
users = mgr.list_users()
table = formatting.Table(columns.columns)
for user in users:
table.add_row([value or formatting.blank()
for value in columns.row(user)])
env.fout(table) | python | def cli(env, columns):
"""List Users."""
mgr = SoftLayer.UserManager(env.client)
users = mgr.list_users()
table = formatting.Table(columns.columns)
for user in users:
table.add_row([value or formatting.blank()
for value in columns.row(user)])
env.fout(table) | [
"def",
"cli",
"(",
"env",
",",
"columns",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"UserManager",
"(",
"env",
".",
"client",
")",
"users",
"=",
"mgr",
".",
"list_users",
"(",
")",
"table",
"=",
"formatting",
".",
"Table",
"(",
"columns",
".",
"columns... | List Users. | [
"List",
"Users",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/user/list.py#L37-L48 | train |
softlayer/softlayer-python | SoftLayer/CLI/ticket/update.py | cli | def cli(env, identifier, body):
"""Adds an update to an existing ticket."""
mgr = SoftLayer.TicketManager(env.client)
ticket_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'ticket')
if body is None:
body = click.edit('\n\n' + ticket.TEMPLATE_MSG)
mgr.update_ticket(ticket_id=ticket_i... | python | def cli(env, identifier, body):
"""Adds an update to an existing ticket."""
mgr = SoftLayer.TicketManager(env.client)
ticket_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'ticket')
if body is None:
body = click.edit('\n\n' + ticket.TEMPLATE_MSG)
mgr.update_ticket(ticket_id=ticket_i... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
",",
"body",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"TicketManager",
"(",
"env",
".",
"client",
")",
"ticket_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"mgr",
".",
"resolve_ids",
",",
"identifier",
",",
"... | Adds an update to an existing ticket. | [
"Adds",
"an",
"update",
"to",
"an",
"existing",
"ticket",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/ticket/update.py#L16-L26 | train |
softlayer/softlayer-python | SoftLayer/CLI/order/quote_detail.py | cli | def cli(env, quote):
"""View a quote"""
manager = ordering.OrderingManager(env.client)
result = manager.get_quote_details(quote)
package = result['order']['items'][0]['package']
title = "{} - Package: {}, Id {}".format(result.get('name'), package['keyName'], package['id'])
table = formatting.T... | python | def cli(env, quote):
"""View a quote"""
manager = ordering.OrderingManager(env.client)
result = manager.get_quote_details(quote)
package = result['order']['items'][0]['package']
title = "{} - Package: {}, Id {}".format(result.get('name'), package['keyName'], package['id'])
table = formatting.T... | [
"def",
"cli",
"(",
"env",
",",
"quote",
")",
":",
"manager",
"=",
"ordering",
".",
"OrderingManager",
"(",
"env",
".",
"client",
")",
"result",
"=",
"manager",
".",
"get_quote_details",
"(",
"quote",
")",
"package",
"=",
"result",
"[",
"'order'",
"]",
... | View a quote | [
"View",
"a",
"quote"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/order/quote_detail.py#L14-L38 | train |
softlayer/softlayer-python | SoftLayer/CLI/securitygroup/list.py | cli | def cli(env, sortby, limit):
"""List security groups."""
mgr = SoftLayer.NetworkManager(env.client)
table = formatting.Table(COLUMNS)
table.sortby = sortby
sgs = mgr.list_securitygroups(limit=limit)
for secgroup in sgs:
table.add_row([
secgroup['id'],
secgroup.... | python | def cli(env, sortby, limit):
"""List security groups."""
mgr = SoftLayer.NetworkManager(env.client)
table = formatting.Table(COLUMNS)
table.sortby = sortby
sgs = mgr.list_securitygroups(limit=limit)
for secgroup in sgs:
table.add_row([
secgroup['id'],
secgroup.... | [
"def",
"cli",
"(",
"env",
",",
"sortby",
",",
"limit",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"NetworkManager",
"(",
"env",
".",
"client",
")",
"table",
"=",
"formatting",
".",
"Table",
"(",
"COLUMNS",
")",
"table",
".",
"sortby",
"=",
"sortby",
"sg... | List security groups. | [
"List",
"security",
"groups",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/securitygroup/list.py#L24-L40 | train |
softlayer/softlayer-python | SoftLayer/CLI/firewall/edit.py | parse_rules | def parse_rules(content=None):
"""Helper to parse the input from the user into a list of rules.
:param string content: the content of the editor
:returns: a list of rules
"""
rules = content.split(DELIMITER)
parsed_rules = list()
order = 1
for rule in rules:
if rule.strip() == '... | python | def parse_rules(content=None):
"""Helper to parse the input from the user into a list of rules.
:param string content: the content of the editor
:returns: a list of rules
"""
rules = content.split(DELIMITER)
parsed_rules = list()
order = 1
for rule in rules:
if rule.strip() == '... | [
"def",
"parse_rules",
"(",
"content",
"=",
"None",
")",
":",
"rules",
"=",
"content",
".",
"split",
"(",
"DELIMITER",
")",
"parsed_rules",
"=",
"list",
"(",
")",
"order",
"=",
"1",
"for",
"rule",
"in",
"rules",
":",
"if",
"rule",
".",
"strip",
"(",
... | Helper to parse the input from the user into a list of rules.
:param string content: the content of the editor
:returns: a list of rules | [
"Helper",
"to",
"parse",
"the",
"input",
"from",
"the",
"user",
"into",
"a",
"list",
"of",
"rules",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/firewall/edit.py#L19-L60 | train |
softlayer/softlayer-python | SoftLayer/CLI/firewall/edit.py | open_editor | def open_editor(rules=None, content=None):
"""Helper to open an editor for editing the firewall rules.
This method takes two parameters, if content is provided,
that means that submitting the rules failed and we are allowing
the user to re-edit what they provided. If content is not provided, the
ru... | python | def open_editor(rules=None, content=None):
"""Helper to open an editor for editing the firewall rules.
This method takes two parameters, if content is provided,
that means that submitting the rules failed and we are allowing
the user to re-edit what they provided. If content is not provided, the
ru... | [
"def",
"open_editor",
"(",
"rules",
"=",
"None",
",",
"content",
"=",
"None",
")",
":",
"editor",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'EDITOR'",
",",
"'nano'",
")",
"with",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"suffix",
"=",
"\".tmp\"",
... | Helper to open an editor for editing the firewall rules.
This method takes two parameters, if content is provided,
that means that submitting the rules failed and we are allowing
the user to re-edit what they provided. If content is not provided, the
rules retrieved from the firewall will be displayed ... | [
"Helper",
"to",
"open",
"an",
"editor",
"for",
"editing",
"the",
"firewall",
"rules",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/firewall/edit.py#L63-L105 | train |
softlayer/softlayer-python | SoftLayer/CLI/firewall/edit.py | get_formatted_rule | def get_formatted_rule(rule=None):
"""Helper to format the rule into a user friendly format.
:param dict rule: A dict containing one rule of the firewall
:returns: a formatted string that get be pushed into the editor
"""
rule = rule or {}
return ('action: %s\n'
'protocol: %s\n'
... | python | def get_formatted_rule(rule=None):
"""Helper to format the rule into a user friendly format.
:param dict rule: A dict containing one rule of the firewall
:returns: a formatted string that get be pushed into the editor
"""
rule = rule or {}
return ('action: %s\n'
'protocol: %s\n'
... | [
"def",
"get_formatted_rule",
"(",
"rule",
"=",
"None",
")",
":",
"rule",
"=",
"rule",
"or",
"{",
"}",
"return",
"(",
"'action: %s\\n'",
"'protocol: %s\\n'",
"'source_ip_address: %s\\n'",
"'source_ip_subnet_mask: %s\\n'",
"'destination_ip_address: %s\\n'",
"'destination_ip_s... | Helper to format the rule into a user friendly format.
:param dict rule: A dict containing one rule of the firewall
:returns: a formatted string that get be pushed into the editor | [
"Helper",
"to",
"format",
"the",
"rule",
"into",
"a",
"user",
"friendly",
"format",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/firewall/edit.py#L108-L132 | train |
softlayer/softlayer-python | SoftLayer/CLI/firewall/edit.py | cli | def cli(env, identifier):
"""Edit firewall rules."""
mgr = SoftLayer.FirewallManager(env.client)
firewall_type, firewall_id = firewall.parse_id(identifier)
if firewall_type == 'vlan':
orig_rules = mgr.get_dedicated_fwl_rules(firewall_id)
else:
orig_rules = mgr.get_standard_fwl_rule... | python | def cli(env, identifier):
"""Edit firewall rules."""
mgr = SoftLayer.FirewallManager(env.client)
firewall_type, firewall_id = firewall.parse_id(identifier)
if firewall_type == 'vlan':
orig_rules = mgr.get_dedicated_fwl_rules(firewall_id)
else:
orig_rules = mgr.get_standard_fwl_rule... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"FirewallManager",
"(",
"env",
".",
"client",
")",
"firewall_type",
",",
"firewall_id",
"=",
"firewall",
".",
"parse_id",
"(",
"identifier",
")",
"if",
"firewall_type",
"=... | Edit firewall rules. | [
"Edit",
"firewall",
"rules",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/firewall/edit.py#L138-L178 | train |
softlayer/softlayer-python | SoftLayer/CLI/securitygroup/rule.py | rule_list | def rule_list(env, securitygroup_id, sortby):
"""List security group rules."""
mgr = SoftLayer.NetworkManager(env.client)
table = formatting.Table(COLUMNS)
table.sortby = sortby
rules = mgr.list_securitygroup_rules(securitygroup_id)
for rule in rules:
port_min = rule.get('portRangeMin... | python | def rule_list(env, securitygroup_id, sortby):
"""List security group rules."""
mgr = SoftLayer.NetworkManager(env.client)
table = formatting.Table(COLUMNS)
table.sortby = sortby
rules = mgr.list_securitygroup_rules(securitygroup_id)
for rule in rules:
port_min = rule.get('portRangeMin... | [
"def",
"rule_list",
"(",
"env",
",",
"securitygroup_id",
",",
"sortby",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"NetworkManager",
"(",
"env",
".",
"client",
")",
"table",
"=",
"formatting",
".",
"Table",
"(",
"COLUMNS",
")",
"table",
".",
"sortby",
"=",
... | List security group rules. | [
"List",
"security",
"group",
"rules",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/securitygroup/rule.py#L32-L62 | train |
softlayer/softlayer-python | SoftLayer/CLI/securitygroup/rule.py | add | def add(env, securitygroup_id, remote_ip, remote_group,
direction, ethertype, port_max, port_min, protocol):
"""Add a security group rule to a security group.
\b
Examples:
# Add an SSH rule (TCP port 22) to a security group
slcli sg rule-add 384727 \\
--direction ingress... | python | def add(env, securitygroup_id, remote_ip, remote_group,
direction, ethertype, port_max, port_min, protocol):
"""Add a security group rule to a security group.
\b
Examples:
# Add an SSH rule (TCP port 22) to a security group
slcli sg rule-add 384727 \\
--direction ingress... | [
"def",
"add",
"(",
"env",
",",
"securitygroup_id",
",",
"remote_ip",
",",
"remote_group",
",",
"direction",
",",
"ethertype",
",",
"port_max",
",",
"port_min",
",",
"protocol",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"NetworkManager",
"(",
"env",
".",
"cli... | Add a security group rule to a security group.
\b
Examples:
# Add an SSH rule (TCP port 22) to a security group
slcli sg rule-add 384727 \\
--direction ingress \\
--protocol tcp \\
--port-min 22 \\
--port-max 22
\b
# Add a ping rule (... | [
"Add",
"a",
"security",
"group",
"rule",
"to",
"a",
"security",
"group",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/securitygroup/rule.py#L85-L118 | train |
softlayer/softlayer-python | SoftLayer/CLI/securitygroup/rule.py | edit | def edit(env, securitygroup_id, rule_id, remote_ip, remote_group,
direction, ethertype, port_max, port_min, protocol):
"""Edit a security group rule in a security group."""
mgr = SoftLayer.NetworkManager(env.client)
data = {}
if remote_ip:
data['remote_ip'] = remote_ip
if remote_gr... | python | def edit(env, securitygroup_id, rule_id, remote_ip, remote_group,
direction, ethertype, port_max, port_min, protocol):
"""Edit a security group rule in a security group."""
mgr = SoftLayer.NetworkManager(env.client)
data = {}
if remote_ip:
data['remote_ip'] = remote_ip
if remote_gr... | [
"def",
"edit",
"(",
"env",
",",
"securitygroup_id",
",",
"rule_id",
",",
"remote_ip",
",",
"remote_group",
",",
"direction",
",",
"ethertype",
",",
"port_max",
",",
"port_min",
",",
"protocol",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"NetworkManager",
"(",
... | Edit a security group rule in a security group. | [
"Edit",
"a",
"security",
"group",
"rule",
"in",
"a",
"security",
"group",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/securitygroup/rule.py#L139-L168 | train |
softlayer/softlayer-python | SoftLayer/CLI/securitygroup/rule.py | remove | def remove(env, securitygroup_id, rule_id):
"""Remove a rule from a security group."""
mgr = SoftLayer.NetworkManager(env.client)
ret = mgr.remove_securitygroup_rule(securitygroup_id, rule_id)
if not ret:
raise exceptions.CLIAbort("Failed to remove security group rule")
table = formatting... | python | def remove(env, securitygroup_id, rule_id):
"""Remove a rule from a security group."""
mgr = SoftLayer.NetworkManager(env.client)
ret = mgr.remove_securitygroup_rule(securitygroup_id, rule_id)
if not ret:
raise exceptions.CLIAbort("Failed to remove security group rule")
table = formatting... | [
"def",
"remove",
"(",
"env",
",",
"securitygroup_id",
",",
"rule_id",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"NetworkManager",
"(",
"env",
".",
"client",
")",
"ret",
"=",
"mgr",
".",
"remove_securitygroup_rule",
"(",
"securitygroup_id",
",",
"rule_id",
")",... | Remove a rule from a security group. | [
"Remove",
"a",
"rule",
"from",
"a",
"security",
"group",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/securitygroup/rule.py#L175-L187 | train |
softlayer/softlayer-python | SoftLayer/CLI/deprecated.py | main | def main():
"""Main function for the deprecated 'sl' command."""
print("ERROR: Use the 'slcli' command instead.", file=sys.stderr)
print("> slcli %s" % ' '.join(sys.argv[1:]), file=sys.stderr)
exit(-1) | python | def main():
"""Main function for the deprecated 'sl' command."""
print("ERROR: Use the 'slcli' command instead.", file=sys.stderr)
print("> slcli %s" % ' '.join(sys.argv[1:]), file=sys.stderr)
exit(-1) | [
"def",
"main",
"(",
")",
":",
"print",
"(",
"\"ERROR: Use the 'slcli' command instead.\"",
",",
"file",
"=",
"sys",
".",
"stderr",
")",
"print",
"(",
"\"> slcli %s\"",
"%",
"' '",
".",
"join",
"(",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
")",
",",
"fil... | Main function for the deprecated 'sl' command. | [
"Main",
"function",
"for",
"the",
"deprecated",
"sl",
"command",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/deprecated.py#L11-L15 | train |
softlayer/softlayer-python | SoftLayer/CLI/loadbal/group_edit.py | cli | def cli(env, identifier, allocation, port, routing_type, routing_method):
"""Edit an existing load balancer service group."""
mgr = SoftLayer.LoadBalancerManager(env.client)
loadbal_id, group_id = loadbal.parse_id(identifier)
# check if any input is provided
if not any([allocation, port, routing_t... | python | def cli(env, identifier, allocation, port, routing_type, routing_method):
"""Edit an existing load balancer service group."""
mgr = SoftLayer.LoadBalancerManager(env.client)
loadbal_id, group_id = loadbal.parse_id(identifier)
# check if any input is provided
if not any([allocation, port, routing_t... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
",",
"allocation",
",",
"port",
",",
"routing_type",
",",
"routing_method",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"LoadBalancerManager",
"(",
"env",
".",
"client",
")",
"loadbal_id",
",",
"group_id",
"=",
"loa... | Edit an existing load balancer service group. | [
"Edit",
"an",
"existing",
"load",
"balancer",
"service",
"group",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/loadbal/group_edit.py#L25-L43 | train |
softlayer/softlayer-python | SoftLayer/CLI/account/event_detail.py | cli | def cli(env, identifier, ack):
"""Details of a specific event, and ability to acknowledge event."""
# Print a list of all on going maintenance
manager = AccountManager(env.client)
event = manager.get_event(identifier)
if ack:
manager.ack_event(identifier)
env.fout(basic_event_table(ev... | python | def cli(env, identifier, ack):
"""Details of a specific event, and ability to acknowledge event."""
# Print a list of all on going maintenance
manager = AccountManager(env.client)
event = manager.get_event(identifier)
if ack:
manager.ack_event(identifier)
env.fout(basic_event_table(ev... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
",",
"ack",
")",
":",
"manager",
"=",
"AccountManager",
"(",
"env",
".",
"client",
")",
"event",
"=",
"manager",
".",
"get_event",
"(",
"identifier",
")",
"if",
"ack",
":",
"manager",
".",
"ack_event",
"(",
... | Details of a specific event, and ability to acknowledge event. | [
"Details",
"of",
"a",
"specific",
"event",
"and",
"ability",
"to",
"acknowledge",
"event",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/account/event_detail.py#L17-L29 | train |
softlayer/softlayer-python | SoftLayer/CLI/account/event_detail.py | basic_event_table | def basic_event_table(event):
"""Formats a basic event table"""
table = formatting.Table(["Id", "Status", "Type", "Start", "End"],
title=utils.clean_splitlines(event.get('subject')))
table.add_row([
event.get('id'),
utils.lookup(event, 'statusCode', 'name'),
... | python | def basic_event_table(event):
"""Formats a basic event table"""
table = formatting.Table(["Id", "Status", "Type", "Start", "End"],
title=utils.clean_splitlines(event.get('subject')))
table.add_row([
event.get('id'),
utils.lookup(event, 'statusCode', 'name'),
... | [
"def",
"basic_event_table",
"(",
"event",
")",
":",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"\"Id\"",
",",
"\"Status\"",
",",
"\"Type\"",
",",
"\"Start\"",
",",
"\"End\"",
"]",
",",
"title",
"=",
"utils",
".",
"clean_splitlines",
"(",
"event",
... | Formats a basic event table | [
"Formats",
"a",
"basic",
"event",
"table"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/account/event_detail.py#L32-L45 | train |
softlayer/softlayer-python | SoftLayer/CLI/account/event_detail.py | impacted_table | def impacted_table(event):
"""Formats a basic impacted resources table"""
table = formatting.Table([
"Type", "Id", "Hostname", "PrivateIp", "Label"
])
for item in event.get('impactedResources', []):
table.add_row([
item.get('resourceType'),
item.get('resourceTable... | python | def impacted_table(event):
"""Formats a basic impacted resources table"""
table = formatting.Table([
"Type", "Id", "Hostname", "PrivateIp", "Label"
])
for item in event.get('impactedResources', []):
table.add_row([
item.get('resourceType'),
item.get('resourceTable... | [
"def",
"impacted_table",
"(",
"event",
")",
":",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"\"Type\"",
",",
"\"Id\"",
",",
"\"Hostname\"",
",",
"\"PrivateIp\"",
",",
"\"Label\"",
"]",
")",
"for",
"item",
"in",
"event",
".",
"get",
"(",
"'impact... | Formats a basic impacted resources table | [
"Formats",
"a",
"basic",
"impacted",
"resources",
"table"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/account/event_detail.py#L48-L61 | train |
softlayer/softlayer-python | SoftLayer/CLI/account/event_detail.py | update_table | def update_table(event):
"""Formats a basic event update table"""
update_number = 0
for update in event.get('updates', []):
header = "======= Update #%s on %s =======" % (update_number, utils.clean_time(update.get('startDate')))
click.secho(header, fg='green')
update_number = update_... | python | def update_table(event):
"""Formats a basic event update table"""
update_number = 0
for update in event.get('updates', []):
header = "======= Update #%s on %s =======" % (update_number, utils.clean_time(update.get('startDate')))
click.secho(header, fg='green')
update_number = update_... | [
"def",
"update_table",
"(",
"event",
")",
":",
"update_number",
"=",
"0",
"for",
"update",
"in",
"event",
".",
"get",
"(",
"'updates'",
",",
"[",
"]",
")",
":",
"header",
"=",
"\"======= Update #%s on %s =======\"",
"%",
"(",
"update_number",
",",
"utils",
... | Formats a basic event update table | [
"Formats",
"a",
"basic",
"event",
"update",
"table"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/account/event_detail.py#L64-L73 | train |
softlayer/softlayer-python | SoftLayer/CLI/block/list.py | cli | def cli(env, sortby, columns, datacenter, username, storage_type):
"""List block storage."""
block_manager = SoftLayer.BlockStorageManager(env.client)
block_volumes = block_manager.list_block_volumes(datacenter=datacenter,
username=username,
... | python | def cli(env, sortby, columns, datacenter, username, storage_type):
"""List block storage."""
block_manager = SoftLayer.BlockStorageManager(env.client)
block_volumes = block_manager.list_block_volumes(datacenter=datacenter,
username=username,
... | [
"def",
"cli",
"(",
"env",
",",
"sortby",
",",
"columns",
",",
"datacenter",
",",
"username",
",",
"storage_type",
")",
":",
"block_manager",
"=",
"SoftLayer",
".",
"BlockStorageManager",
"(",
"env",
".",
"client",
")",
"block_volumes",
"=",
"block_manager",
... | List block storage. | [
"List",
"block",
"storage",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/block/list.py#L67-L82 | train |
softlayer/softlayer-python | SoftLayer/CLI/object_storage/list_endpoints.py | cli | def cli(env):
"""List object storage endpoints."""
mgr = SoftLayer.ObjectStorageManager(env.client)
endpoints = mgr.list_endpoints()
table = formatting.Table(['datacenter', 'public', 'private'])
for endpoint in endpoints:
table.add_row([
endpoint['datacenter']['name'],
... | python | def cli(env):
"""List object storage endpoints."""
mgr = SoftLayer.ObjectStorageManager(env.client)
endpoints = mgr.list_endpoints()
table = formatting.Table(['datacenter', 'public', 'private'])
for endpoint in endpoints:
table.add_row([
endpoint['datacenter']['name'],
... | [
"def",
"cli",
"(",
"env",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"ObjectStorageManager",
"(",
"env",
".",
"client",
")",
"endpoints",
"=",
"mgr",
".",
"list_endpoints",
"(",
")",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"'datacenter'",
",",
... | List object storage endpoints. | [
"List",
"object",
"storage",
"endpoints",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/object_storage/list_endpoints.py#L13-L27 | train |
softlayer/softlayer-python | SoftLayer/CLI/virt/cancel.py | cli | def cli(env, identifier):
"""Cancel virtual servers."""
vsi = SoftLayer.VSManager(env.client)
vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS')
if not (env.skip_confirmations or formatting.no_going_back(vs_id)):
raise exceptions.CLIAbort('Aborted')
vsi.cancel_instance(vs_id) | python | def cli(env, identifier):
"""Cancel virtual servers."""
vsi = SoftLayer.VSManager(env.client)
vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS')
if not (env.skip_confirmations or formatting.no_going_back(vs_id)):
raise exceptions.CLIAbort('Aborted')
vsi.cancel_instance(vs_id) | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"vsi",
"=",
"SoftLayer",
".",
"VSManager",
"(",
"env",
".",
"client",
")",
"vs_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"vsi",
".",
"resolve_ids",
",",
"identifier",
",",
"'VS'",
")",
"if",
"... | Cancel virtual servers. | [
"Cancel",
"virtual",
"servers",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/cancel.py#L16-L24 | train |
softlayer/softlayer-python | SoftLayer/CLI/hardware/reflash_firmware.py | cli | def cli(env, identifier):
"""Reflash server firmware."""
mgr = SoftLayer.HardwareManager(env.client)
hw_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'hardware')
if not (env.skip_confirmations or
formatting.confirm('This will power off the server with id %s and '
... | python | def cli(env, identifier):
"""Reflash server firmware."""
mgr = SoftLayer.HardwareManager(env.client)
hw_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'hardware')
if not (env.skip_confirmations or
formatting.confirm('This will power off the server with id %s and '
... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"HardwareManager",
"(",
"env",
".",
"client",
")",
"hw_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"mgr",
".",
"resolve_ids",
",",
"identifier",
",",
"'hardware'",
")",... | Reflash server firmware. | [
"Reflash",
"server",
"firmware",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/hardware/reflash_firmware.py#L16-L26 | train |
softlayer/softlayer-python | SoftLayer/CLI/file/snapshot/schedule_list.py | cli | def cli(env, volume_id):
"""Lists snapshot schedules for a given volume"""
file_manager = SoftLayer.FileStorageManager(env.client)
snapshot_schedules = file_manager.list_volume_schedules(volume_id)
table = formatting.Table(['id',
'active',
'... | python | def cli(env, volume_id):
"""Lists snapshot schedules for a given volume"""
file_manager = SoftLayer.FileStorageManager(env.client)
snapshot_schedules = file_manager.list_volume_schedules(volume_id)
table = formatting.Table(['id',
'active',
'... | [
"def",
"cli",
"(",
"env",
",",
"volume_id",
")",
":",
"file_manager",
"=",
"SoftLayer",
".",
"FileStorageManager",
"(",
"env",
".",
"client",
")",
"snapshot_schedules",
"=",
"file_manager",
".",
"list_volume_schedules",
"(",
"volume_id",
")",
"table",
"=",
"fo... | Lists snapshot schedules for a given volume | [
"Lists",
"snapshot",
"schedules",
"for",
"a",
"given",
"volume"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/file/snapshot/schedule_list.py#L13-L70 | train |
softlayer/softlayer-python | SoftLayer/CLI/firewall/list.py | cli | def cli(env):
"""List firewalls."""
mgr = SoftLayer.FirewallManager(env.client)
table = formatting.Table(['firewall id',
'type',
'features',
'server/vlan id'])
fwvlans = mgr.get_firewalls()
dedicated_firewalls... | python | def cli(env):
"""List firewalls."""
mgr = SoftLayer.FirewallManager(env.client)
table = formatting.Table(['firewall id',
'type',
'features',
'server/vlan id'])
fwvlans = mgr.get_firewalls()
dedicated_firewalls... | [
"def",
"cli",
"(",
"env",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"FirewallManager",
"(",
"env",
".",
"client",
")",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"'firewall id'",
",",
"'type'",
",",
"'features'",
",",
"'server/vlan id'",
"]",
")",... | List firewalls. | [
"List",
"firewalls",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/firewall/list.py#L14-L73 | train |
softlayer/softlayer-python | SoftLayer/CLI/subnet/cancel.py | cli | def cli(env, identifier):
"""Cancel a subnet."""
mgr = SoftLayer.NetworkManager(env.client)
subnet_id = helpers.resolve_id(mgr.resolve_subnet_ids, identifier,
name='subnet')
if not (env.skip_confirmations or formatting.no_going_back(subnet_id)):
raise excepti... | python | def cli(env, identifier):
"""Cancel a subnet."""
mgr = SoftLayer.NetworkManager(env.client)
subnet_id = helpers.resolve_id(mgr.resolve_subnet_ids, identifier,
name='subnet')
if not (env.skip_confirmations or formatting.no_going_back(subnet_id)):
raise excepti... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"NetworkManager",
"(",
"env",
".",
"client",
")",
"subnet_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"mgr",
".",
"resolve_subnet_ids",
",",
"identifier",
",",
"name",
... | Cancel a subnet. | [
"Cancel",
"a",
"subnet",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/subnet/cancel.py#L16-L26 | train |
softlayer/softlayer-python | SoftLayer/CLI/config/__init__.py | get_settings_from_client | def get_settings_from_client(client):
"""Pull out settings from a SoftLayer.BaseClient instance.
:param client: SoftLayer.BaseClient instance
"""
settings = {
'username': '',
'api_key': '',
'timeout': '',
'endpoint_url': '',
}
try:
settings['username'] = ... | python | def get_settings_from_client(client):
"""Pull out settings from a SoftLayer.BaseClient instance.
:param client: SoftLayer.BaseClient instance
"""
settings = {
'username': '',
'api_key': '',
'timeout': '',
'endpoint_url': '',
}
try:
settings['username'] = ... | [
"def",
"get_settings_from_client",
"(",
"client",
")",
":",
"settings",
"=",
"{",
"'username'",
":",
"''",
",",
"'api_key'",
":",
"''",
",",
"'timeout'",
":",
"''",
",",
"'endpoint_url'",
":",
"''",
",",
"}",
"try",
":",
"settings",
"[",
"'username'",
"]... | Pull out settings from a SoftLayer.BaseClient instance.
:param client: SoftLayer.BaseClient instance | [
"Pull",
"out",
"settings",
"from",
"a",
"SoftLayer",
".",
"BaseClient",
"instance",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/config/__init__.py#L16-L40 | train |
softlayer/softlayer-python | SoftLayer/CLI/config/__init__.py | config_table | def config_table(settings):
"""Returns a config table."""
table = formatting.KeyValueTable(['name', 'value'])
table.align['name'] = 'r'
table.align['value'] = 'l'
table.add_row(['Username', settings['username'] or 'not set'])
table.add_row(['API Key', settings['api_key'] or 'not set'])
table... | python | def config_table(settings):
"""Returns a config table."""
table = formatting.KeyValueTable(['name', 'value'])
table.align['name'] = 'r'
table.align['value'] = 'l'
table.add_row(['Username', settings['username'] or 'not set'])
table.add_row(['API Key', settings['api_key'] or 'not set'])
table... | [
"def",
"config_table",
"(",
"settings",
")",
":",
"table",
"=",
"formatting",
".",
"KeyValueTable",
"(",
"[",
"'name'",
",",
"'value'",
"]",
")",
"table",
".",
"align",
"[",
"'name'",
"]",
"=",
"'r'",
"table",
".",
"align",
"[",
"'value'",
"]",
"=",
... | Returns a config table. | [
"Returns",
"a",
"config",
"table",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/config/__init__.py#L43-L52 | train |
softlayer/softlayer-python | SoftLayer/CLI/virt/capacity/create.py | cli | def cli(env, name, backend_router_id, flavor, instances, test=False):
"""Create a Reserved Capacity instance.
*WARNING*: Reserved Capacity is on a yearly contract and not cancelable until the contract is expired.
"""
manager = CapacityManager(env.client)
result = manager.create(
name=name,... | python | def cli(env, name, backend_router_id, flavor, instances, test=False):
"""Create a Reserved Capacity instance.
*WARNING*: Reserved Capacity is on a yearly contract and not cancelable until the contract is expired.
"""
manager = CapacityManager(env.client)
result = manager.create(
name=name,... | [
"def",
"cli",
"(",
"env",
",",
"name",
",",
"backend_router_id",
",",
"flavor",
",",
"instances",
",",
"test",
"=",
"False",
")",
":",
"manager",
"=",
"CapacityManager",
"(",
"env",
".",
"client",
")",
"result",
"=",
"manager",
".",
"create",
"(",
"nam... | Create a Reserved Capacity instance.
*WARNING*: Reserved Capacity is on a yearly contract and not cancelable until the contract is expired. | [
"Create",
"a",
"Reserved",
"Capacity",
"instance",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/capacity/create.py#L24-L51 | train |
softlayer/softlayer-python | SoftLayer/CLI/cdn/origin_list.py | cli | def cli(env, account_id):
"""List origin pull mappings."""
manager = SoftLayer.CDNManager(env.client)
origins = manager.get_origins(account_id)
table = formatting.Table(['id', 'media_type', 'cname', 'origin_url'])
for origin in origins:
table.add_row([origin['id'],
... | python | def cli(env, account_id):
"""List origin pull mappings."""
manager = SoftLayer.CDNManager(env.client)
origins = manager.get_origins(account_id)
table = formatting.Table(['id', 'media_type', 'cname', 'origin_url'])
for origin in origins:
table.add_row([origin['id'],
... | [
"def",
"cli",
"(",
"env",
",",
"account_id",
")",
":",
"manager",
"=",
"SoftLayer",
".",
"CDNManager",
"(",
"env",
".",
"client",
")",
"origins",
"=",
"manager",
".",
"get_origins",
"(",
"account_id",
")",
"table",
"=",
"formatting",
".",
"Table",
"(",
... | List origin pull mappings. | [
"List",
"origin",
"pull",
"mappings",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/cdn/origin_list.py#L14-L28 | train |
softlayer/softlayer-python | SoftLayer/CLI/virt/placementgroup/create_options.py | cli | def cli(env):
"""List options for creating a placement group."""
manager = PlacementManager(env.client)
routers = manager.get_routers()
env.fout(get_router_table(routers))
rules = manager.get_all_rules()
env.fout(get_rule_table(rules)) | python | def cli(env):
"""List options for creating a placement group."""
manager = PlacementManager(env.client)
routers = manager.get_routers()
env.fout(get_router_table(routers))
rules = manager.get_all_rules()
env.fout(get_rule_table(rules)) | [
"def",
"cli",
"(",
"env",
")",
":",
"manager",
"=",
"PlacementManager",
"(",
"env",
".",
"client",
")",
"routers",
"=",
"manager",
".",
"get_routers",
"(",
")",
"env",
".",
"fout",
"(",
"get_router_table",
"(",
"routers",
")",
")",
"rules",
"=",
"manag... | List options for creating a placement group. | [
"List",
"options",
"for",
"creating",
"a",
"placement",
"group",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/placementgroup/create_options.py#L13-L21 | train |
softlayer/softlayer-python | SoftLayer/CLI/virt/placementgroup/create_options.py | get_router_table | def get_router_table(routers):
"""Formats output from _get_routers and returns a table. """
table = formatting.Table(['Datacenter', 'Hostname', 'Backend Router Id'], "Available Routers")
for router in routers:
datacenter = router['topLevelLocation']['longName']
table.add_row([datacenter, rou... | python | def get_router_table(routers):
"""Formats output from _get_routers and returns a table. """
table = formatting.Table(['Datacenter', 'Hostname', 'Backend Router Id'], "Available Routers")
for router in routers:
datacenter = router['topLevelLocation']['longName']
table.add_row([datacenter, rou... | [
"def",
"get_router_table",
"(",
"routers",
")",
":",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"'Datacenter'",
",",
"'Hostname'",
",",
"'Backend Router Id'",
"]",
",",
"\"Available Routers\"",
")",
"for",
"router",
"in",
"routers",
":",
"datacenter",
... | Formats output from _get_routers and returns a table. | [
"Formats",
"output",
"from",
"_get_routers",
"and",
"returns",
"a",
"table",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/placementgroup/create_options.py#L24-L30 | train |
softlayer/softlayer-python | SoftLayer/CLI/virt/placementgroup/create_options.py | get_rule_table | def get_rule_table(rules):
"""Formats output from get_all_rules and returns a table. """
table = formatting.Table(['Id', 'KeyName'], "Rules")
for rule in rules:
table.add_row([rule['id'], rule['keyName']])
return table | python | def get_rule_table(rules):
"""Formats output from get_all_rules and returns a table. """
table = formatting.Table(['Id', 'KeyName'], "Rules")
for rule in rules:
table.add_row([rule['id'], rule['keyName']])
return table | [
"def",
"get_rule_table",
"(",
"rules",
")",
":",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"'Id'",
",",
"'KeyName'",
"]",
",",
"\"Rules\"",
")",
"for",
"rule",
"in",
"rules",
":",
"table",
".",
"add_row",
"(",
"[",
"rule",
"[",
"'id'",
"]",... | Formats output from get_all_rules and returns a table. | [
"Formats",
"output",
"from",
"get_all_rules",
"and",
"returns",
"a",
"table",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/placementgroup/create_options.py#L33-L38 | train |
softlayer/softlayer-python | SoftLayer/CLI/virt/detail.py | _cli_helper_dedicated_host | def _cli_helper_dedicated_host(env, result, table):
"""Get details on dedicated host for a virtual server."""
dedicated_host_id = utils.lookup(result, 'dedicatedHost', 'id')
if dedicated_host_id:
table.add_row(['dedicated_host_id', dedicated_host_id])
# Try to find name of dedicated host
... | python | def _cli_helper_dedicated_host(env, result, table):
"""Get details on dedicated host for a virtual server."""
dedicated_host_id = utils.lookup(result, 'dedicatedHost', 'id')
if dedicated_host_id:
table.add_row(['dedicated_host_id', dedicated_host_id])
# Try to find name of dedicated host
... | [
"def",
"_cli_helper_dedicated_host",
"(",
"env",
",",
"result",
",",
"table",
")",
":",
"dedicated_host_id",
"=",
"utils",
".",
"lookup",
"(",
"result",
",",
"'dedicatedHost'",
",",
"'id'",
")",
"if",
"dedicated_host_id",
":",
"table",
".",
"add_row",
"(",
"... | Get details on dedicated host for a virtual server. | [
"Get",
"details",
"on",
"dedicated",
"host",
"for",
"a",
"virtual",
"server",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/detail.py#L148-L162 | train |
softlayer/softlayer-python | SoftLayer/CLI/virt/ready.py | cli | def cli(env, identifier, wait):
"""Check if a virtual server is ready."""
vsi = SoftLayer.VSManager(env.client)
vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS')
ready = vsi.wait_for_ready(vs_id, wait)
if ready:
env.fout("READY")
else:
raise exceptions.CLIAbort("Inst... | python | def cli(env, identifier, wait):
"""Check if a virtual server is ready."""
vsi = SoftLayer.VSManager(env.client)
vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS')
ready = vsi.wait_for_ready(vs_id, wait)
if ready:
env.fout("READY")
else:
raise exceptions.CLIAbort("Inst... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
",",
"wait",
")",
":",
"vsi",
"=",
"SoftLayer",
".",
"VSManager",
"(",
"env",
".",
"client",
")",
"vs_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"vsi",
".",
"resolve_ids",
",",
"identifier",
",",
"'VS'",
... | Check if a virtual server is ready. | [
"Check",
"if",
"a",
"virtual",
"server",
"is",
"ready",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/ready.py#L16-L25 | train |
softlayer/softlayer-python | SoftLayer/CLI/block/replication/failover.py | cli | def cli(env, volume_id, replicant_id, immediate):
"""Failover a block volume to the given replicant volume."""
block_storage_manager = SoftLayer.BlockStorageManager(env.client)
success = block_storage_manager.failover_to_replicant(
volume_id,
replicant_id,
immediate
)
if su... | python | def cli(env, volume_id, replicant_id, immediate):
"""Failover a block volume to the given replicant volume."""
block_storage_manager = SoftLayer.BlockStorageManager(env.client)
success = block_storage_manager.failover_to_replicant(
volume_id,
replicant_id,
immediate
)
if su... | [
"def",
"cli",
"(",
"env",
",",
"volume_id",
",",
"replicant_id",
",",
"immediate",
")",
":",
"block_storage_manager",
"=",
"SoftLayer",
".",
"BlockStorageManager",
"(",
"env",
".",
"client",
")",
"success",
"=",
"block_storage_manager",
".",
"failover_to_replicant... | Failover a block volume to the given replicant volume. | [
"Failover",
"a",
"block",
"volume",
"to",
"the",
"given",
"replicant",
"volume",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/block/replication/failover.py#L17-L30 | train |
softlayer/softlayer-python | SoftLayer/CLI/dedicatedhost/cancel.py | cli | def cli(env, identifier):
"""Cancel a dedicated host server immediately"""
mgr = SoftLayer.DedicatedHostManager(env.client)
host_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'dedicated host')
if not (env.skip_confirmations or formatting.no_going_back(host_id)):
raise exceptions.CLIAbo... | python | def cli(env, identifier):
"""Cancel a dedicated host server immediately"""
mgr = SoftLayer.DedicatedHostManager(env.client)
host_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'dedicated host')
if not (env.skip_confirmations or formatting.no_going_back(host_id)):
raise exceptions.CLIAbo... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"DedicatedHostManager",
"(",
"env",
".",
"client",
")",
"host_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"mgr",
".",
"resolve_ids",
",",
"identifier",
",",
"'dedicated h... | Cancel a dedicated host server immediately | [
"Cancel",
"a",
"dedicated",
"host",
"server",
"immediately"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/dedicatedhost/cancel.py#L16-L28 | train |
softlayer/softlayer-python | SoftLayer/managers/image.py | ImageManager.get_image | def get_image(self, image_id, **kwargs):
"""Get details about an image.
:param int image: The ID of the image.
:param dict \\*\\*kwargs: response-level options (mask, limit, etc.)
"""
if 'mask' not in kwargs:
kwargs['mask'] = IMAGE_MASK
return self.vgbdtg.ge... | python | def get_image(self, image_id, **kwargs):
"""Get details about an image.
:param int image: The ID of the image.
:param dict \\*\\*kwargs: response-level options (mask, limit, etc.)
"""
if 'mask' not in kwargs:
kwargs['mask'] = IMAGE_MASK
return self.vgbdtg.ge... | [
"def",
"get_image",
"(",
"self",
",",
"image_id",
",",
"**",
"kwargs",
")",
":",
"if",
"'mask'",
"not",
"in",
"kwargs",
":",
"kwargs",
"[",
"'mask'",
"]",
"=",
"IMAGE_MASK",
"return",
"self",
".",
"vgbdtg",
".",
"getObject",
"(",
"id",
"=",
"image_id",... | Get details about an image.
:param int image: The ID of the image.
:param dict \\*\\*kwargs: response-level options (mask, limit, etc.) | [
"Get",
"details",
"about",
"an",
"image",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/image.py#L30-L39 | train |
softlayer/softlayer-python | SoftLayer/managers/image.py | ImageManager.list_private_images | def list_private_images(self, guid=None, name=None, **kwargs):
"""List all private images.
:param string guid: filter based on GUID
:param string name: filter based on name
:param dict \\*\\*kwargs: response-level options (mask, limit, etc.)
"""
if 'mask' not in kwargs:
... | python | def list_private_images(self, guid=None, name=None, **kwargs):
"""List all private images.
:param string guid: filter based on GUID
:param string name: filter based on name
:param dict \\*\\*kwargs: response-level options (mask, limit, etc.)
"""
if 'mask' not in kwargs:
... | [
"def",
"list_private_images",
"(",
"self",
",",
"guid",
"=",
"None",
",",
"name",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"if",
"'mask'",
"not",
"in",
"kwargs",
":",
"kwargs",
"[",
"'mask'",
"]",
"=",
"IMAGE_MASK",
"_filter",
"=",
"utils",
".",
"... | List all private images.
:param string guid: filter based on GUID
:param string name: filter based on name
:param dict \\*\\*kwargs: response-level options (mask, limit, etc.) | [
"List",
"all",
"private",
"images",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/image.py#L48-L70 | train |
softlayer/softlayer-python | SoftLayer/managers/image.py | ImageManager.list_public_images | def list_public_images(self, guid=None, name=None, **kwargs):
"""List all public images.
:param string guid: filter based on GUID
:param string name: filter based on name
:param dict \\*\\*kwargs: response-level options (mask, limit, etc.)
"""
if 'mask' not in kwargs:
... | python | def list_public_images(self, guid=None, name=None, **kwargs):
"""List all public images.
:param string guid: filter based on GUID
:param string name: filter based on name
:param dict \\*\\*kwargs: response-level options (mask, limit, etc.)
"""
if 'mask' not in kwargs:
... | [
"def",
"list_public_images",
"(",
"self",
",",
"guid",
"=",
"None",
",",
"name",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"if",
"'mask'",
"not",
"in",
"kwargs",
":",
"kwargs",
"[",
"'mask'",
"]",
"=",
"IMAGE_MASK",
"_filter",
"=",
"utils",
".",
"N... | List all public images.
:param string guid: filter based on GUID
:param string name: filter based on name
:param dict \\*\\*kwargs: response-level options (mask, limit, etc.) | [
"List",
"all",
"public",
"images",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/image.py#L72-L91 | train |
softlayer/softlayer-python | SoftLayer/managers/image.py | ImageManager._get_ids_from_name_public | def _get_ids_from_name_public(self, name):
"""Get public images which match the given name."""
results = self.list_public_images(name=name)
return [result['id'] for result in results] | python | def _get_ids_from_name_public(self, name):
"""Get public images which match the given name."""
results = self.list_public_images(name=name)
return [result['id'] for result in results] | [
"def",
"_get_ids_from_name_public",
"(",
"self",
",",
"name",
")",
":",
"results",
"=",
"self",
".",
"list_public_images",
"(",
"name",
"=",
"name",
")",
"return",
"[",
"result",
"[",
"'id'",
"]",
"for",
"result",
"in",
"results",
"]"
] | Get public images which match the given name. | [
"Get",
"public",
"images",
"which",
"match",
"the",
"given",
"name",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/image.py#L93-L96 | train |
softlayer/softlayer-python | SoftLayer/managers/image.py | ImageManager._get_ids_from_name_private | def _get_ids_from_name_private(self, name):
"""Get private images which match the given name."""
results = self.list_private_images(name=name)
return [result['id'] for result in results] | python | def _get_ids_from_name_private(self, name):
"""Get private images which match the given name."""
results = self.list_private_images(name=name)
return [result['id'] for result in results] | [
"def",
"_get_ids_from_name_private",
"(",
"self",
",",
"name",
")",
":",
"results",
"=",
"self",
".",
"list_private_images",
"(",
"name",
"=",
"name",
")",
"return",
"[",
"result",
"[",
"'id'",
"]",
"for",
"result",
"in",
"results",
"]"
] | Get private images which match the given name. | [
"Get",
"private",
"images",
"which",
"match",
"the",
"given",
"name",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/image.py#L98-L101 | train |
softlayer/softlayer-python | SoftLayer/managers/image.py | ImageManager.edit | def edit(self, image_id, name=None, note=None, tag=None):
"""Edit image related details.
:param int image_id: The ID of the image
:param string name: Name of the Image.
:param string note: Note of the image.
:param string tag: Tags of the image to be updated to.
"""
... | python | def edit(self, image_id, name=None, note=None, tag=None):
"""Edit image related details.
:param int image_id: The ID of the image
:param string name: Name of the Image.
:param string note: Note of the image.
:param string tag: Tags of the image to be updated to.
"""
... | [
"def",
"edit",
"(",
"self",
",",
"image_id",
",",
"name",
"=",
"None",
",",
"note",
"=",
"None",
",",
"tag",
"=",
"None",
")",
":",
"obj",
"=",
"{",
"}",
"if",
"name",
":",
"obj",
"[",
"'name'",
"]",
"=",
"name",
"if",
"note",
":",
"obj",
"["... | Edit image related details.
:param int image_id: The ID of the image
:param string name: Name of the Image.
:param string note: Note of the image.
:param string tag: Tags of the image to be updated to. | [
"Edit",
"image",
"related",
"details",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/image.py#L103-L121 | train |
softlayer/softlayer-python | SoftLayer/managers/image.py | ImageManager.import_image_from_uri | def import_image_from_uri(self, name, uri, os_code=None, note=None,
ibm_api_key=None, root_key_crn=None,
wrapped_dek=None, cloud_init=False,
byol=False, is_encrypted=False):
"""Import a new image from object storage.
... | python | def import_image_from_uri(self, name, uri, os_code=None, note=None,
ibm_api_key=None, root_key_crn=None,
wrapped_dek=None, cloud_init=False,
byol=False, is_encrypted=False):
"""Import a new image from object storage.
... | [
"def",
"import_image_from_uri",
"(",
"self",
",",
"name",
",",
"uri",
",",
"os_code",
"=",
"None",
",",
"note",
"=",
"None",
",",
"ibm_api_key",
"=",
"None",
",",
"root_key_crn",
"=",
"None",
",",
"wrapped_dek",
"=",
"None",
",",
"cloud_init",
"=",
"Fals... | Import a new image from object storage.
:param string name: Name of the new image
:param string uri: The URI for an object storage object
(.vhd/.iso file) of the format:
swift://<objectStorageAccount>@<cluster>/<container>/<objectPath>
or (.vhd/.iso/.raw file) of the... | [
"Import",
"a",
"new",
"image",
"from",
"object",
"storage",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/image.py#L123-L170 | train |
softlayer/softlayer-python | SoftLayer/managers/image.py | ImageManager.export_image_to_uri | def export_image_to_uri(self, image_id, uri, ibm_api_key=None):
"""Export image into the given object storage
:param int image_id: The ID of the image
:param string uri: The URI for object storage of the format
swift://<objectStorageAccount>@<cluster>/<container>/<objectPath>
... | python | def export_image_to_uri(self, image_id, uri, ibm_api_key=None):
"""Export image into the given object storage
:param int image_id: The ID of the image
:param string uri: The URI for object storage of the format
swift://<objectStorageAccount>@<cluster>/<container>/<objectPath>
... | [
"def",
"export_image_to_uri",
"(",
"self",
",",
"image_id",
",",
"uri",
",",
"ibm_api_key",
"=",
"None",
")",
":",
"if",
"'cos://'",
"in",
"uri",
":",
"return",
"self",
".",
"vgbdtg",
".",
"copyToIcos",
"(",
"{",
"'uri'",
":",
"uri",
",",
"'ibmApiKey'",
... | Export image into the given object storage
:param int image_id: The ID of the image
:param string uri: The URI for object storage of the format
swift://<objectStorageAccount>@<cluster>/<container>/<objectPath>
or cos://<regionName>/<bucketName>/<objectPath> if using IBM Cloud
... | [
"Export",
"image",
"into",
"the",
"given",
"object",
"storage"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/image.py#L172-L189 | train |
softlayer/softlayer-python | SoftLayer/CLI/object_storage/credential/delete.py | cli | def cli(env, identifier, credential_id):
"""Delete the credential of an Object Storage Account."""
mgr = SoftLayer.ObjectStorageManager(env.client)
credential = mgr.delete_credential(identifier, credential_id=credential_id)
env.fout(credential) | python | def cli(env, identifier, credential_id):
"""Delete the credential of an Object Storage Account."""
mgr = SoftLayer.ObjectStorageManager(env.client)
credential = mgr.delete_credential(identifier, credential_id=credential_id)
env.fout(credential) | [
"def",
"cli",
"(",
"env",
",",
"identifier",
",",
"credential_id",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"ObjectStorageManager",
"(",
"env",
".",
"client",
")",
"credential",
"=",
"mgr",
".",
"delete_credential",
"(",
"identifier",
",",
"credential_id",
"=... | Delete the credential of an Object Storage Account. | [
"Delete",
"the",
"credential",
"of",
"an",
"Object",
"Storage",
"Account",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/object_storage/credential/delete.py#L15-L21 | train |
softlayer/softlayer-python | SoftLayer/managers/vs_capacity.py | CapacityManager.list | def list(self):
"""List Reserved Capacities"""
mask = """mask[availableInstanceCount, occupiedInstanceCount,
instances[id, billingItem[description, hourlyRecurringFee]], instanceCount, backendRouter[datacenter]]"""
results = self.client.call('Account', 'getReservedCapacityGroups', mask=mask)
... | python | def list(self):
"""List Reserved Capacities"""
mask = """mask[availableInstanceCount, occupiedInstanceCount,
instances[id, billingItem[description, hourlyRecurringFee]], instanceCount, backendRouter[datacenter]]"""
results = self.client.call('Account', 'getReservedCapacityGroups', mask=mask)
... | [
"def",
"list",
"(",
"self",
")",
":",
"mask",
"=",
"results",
"=",
"self",
".",
"client",
".",
"call",
"(",
"'Account'",
",",
"'getReservedCapacityGroups'",
",",
"mask",
"=",
"mask",
")",
"return",
"results"
] | List Reserved Capacities | [
"List",
"Reserved",
"Capacities"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs_capacity.py#L46-L51 | train |
softlayer/softlayer-python | SoftLayer/managers/vs_capacity.py | CapacityManager.get_object | def get_object(self, identifier, mask=None):
"""Get a Reserved Capacity Group
:param int identifier: Id of the SoftLayer_Virtual_ReservedCapacityGroup
:param string mask: override default object Mask
"""
if mask is None:
mask = "mask[instances[billingItem[item[keyNam... | python | def get_object(self, identifier, mask=None):
"""Get a Reserved Capacity Group
:param int identifier: Id of the SoftLayer_Virtual_ReservedCapacityGroup
:param string mask: override default object Mask
"""
if mask is None:
mask = "mask[instances[billingItem[item[keyNam... | [
"def",
"get_object",
"(",
"self",
",",
"identifier",
",",
"mask",
"=",
"None",
")",
":",
"if",
"mask",
"is",
"None",
":",
"mask",
"=",
"\"mask[instances[billingItem[item[keyName],category], guest], backendRouter[datacenter]]\"",
"result",
"=",
"self",
".",
"client",
... | Get a Reserved Capacity Group
:param int identifier: Id of the SoftLayer_Virtual_ReservedCapacityGroup
:param string mask: override default object Mask | [
"Get",
"a",
"Reserved",
"Capacity",
"Group"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs_capacity.py#L53-L62 | train |
softlayer/softlayer-python | SoftLayer/managers/vs_capacity.py | CapacityManager.get_create_options | def get_create_options(self):
"""List available reserved capacity plans"""
mask = "mask[attributes,prices[pricingLocationGroup]]"
results = self.ordering_manager.list_items(self.capacity_package, mask=mask)
return results | python | def get_create_options(self):
"""List available reserved capacity plans"""
mask = "mask[attributes,prices[pricingLocationGroup]]"
results = self.ordering_manager.list_items(self.capacity_package, mask=mask)
return results | [
"def",
"get_create_options",
"(",
"self",
")",
":",
"mask",
"=",
"\"mask[attributes,prices[pricingLocationGroup]]\"",
"results",
"=",
"self",
".",
"ordering_manager",
".",
"list_items",
"(",
"self",
".",
"capacity_package",
",",
"mask",
"=",
"mask",
")",
"return",
... | List available reserved capacity plans | [
"List",
"available",
"reserved",
"capacity",
"plans"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs_capacity.py#L64-L68 | train |
softlayer/softlayer-python | SoftLayer/managers/vs_capacity.py | CapacityManager.get_available_routers | def get_available_routers(self, dc=None):
"""Pulls down all backendRouterIds that are available
:param string dc: A specific location to get routers for, like 'dal13'.
:returns list: A list of locations where RESERVED_CAPACITY can be ordered.
"""
mask = "mask[locations]"
... | python | def get_available_routers(self, dc=None):
"""Pulls down all backendRouterIds that are available
:param string dc: A specific location to get routers for, like 'dal13'.
:returns list: A list of locations where RESERVED_CAPACITY can be ordered.
"""
mask = "mask[locations]"
... | [
"def",
"get_available_routers",
"(",
"self",
",",
"dc",
"=",
"None",
")",
":",
"mask",
"=",
"\"mask[locations]\"",
"package",
"=",
"self",
".",
"ordering_manager",
".",
"get_package_by_key",
"(",
"self",
".",
"capacity_package",
",",
"mask",
"=",
"\"id\"",
")"... | Pulls down all backendRouterIds that are available
:param string dc: A specific location to get routers for, like 'dal13'.
:returns list: A list of locations where RESERVED_CAPACITY can be ordered. | [
"Pulls",
"down",
"all",
"backendRouterIds",
"that",
"are",
"available"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs_capacity.py#L70-L98 | train |
softlayer/softlayer-python | SoftLayer/managers/vs_capacity.py | CapacityManager.create | def create(self, name, backend_router_id, flavor, instances, test=False):
"""Orders a Virtual_ReservedCapacityGroup
:param string name: Name for the new reserved capacity
:param int backend_router_id: This selects the pod. See create_options for a list
:param string flavor: Capacity Key... | python | def create(self, name, backend_router_id, flavor, instances, test=False):
"""Orders a Virtual_ReservedCapacityGroup
:param string name: Name for the new reserved capacity
:param int backend_router_id: This selects the pod. See create_options for a list
:param string flavor: Capacity Key... | [
"def",
"create",
"(",
"self",
",",
"name",
",",
"backend_router_id",
",",
"flavor",
",",
"instances",
",",
"test",
"=",
"False",
")",
":",
"args",
"=",
"(",
"self",
".",
"capacity_package",
",",
"0",
",",
"[",
"flavor",
"]",
")",
"extras",
"=",
"{",
... | Orders a Virtual_ReservedCapacityGroup
:param string name: Name for the new reserved capacity
:param int backend_router_id: This selects the pod. See create_options for a list
:param string flavor: Capacity KeyName, see create_options for a list
:param int instances: Number of guest thi... | [
"Orders",
"a",
"Virtual_ReservedCapacityGroup"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs_capacity.py#L100-L123 | train |
softlayer/softlayer-python | SoftLayer/managers/vs_capacity.py | CapacityManager.create_guest | def create_guest(self, capacity_id, test, guest_object):
"""Turns an empty Reserve Capacity into a real Virtual Guest
:param int capacity_id: ID of the RESERVED_CAPACITY_GROUP to create this guest into
:param bool test: True will use verifyOrder, False will use placeOrder
:param diction... | python | def create_guest(self, capacity_id, test, guest_object):
"""Turns an empty Reserve Capacity into a real Virtual Guest
:param int capacity_id: ID of the RESERVED_CAPACITY_GROUP to create this guest into
:param bool test: True will use verifyOrder, False will use placeOrder
:param diction... | [
"def",
"create_guest",
"(",
"self",
",",
"capacity_id",
",",
"test",
",",
"guest_object",
")",
":",
"vs_manager",
"=",
"VSManager",
"(",
"self",
".",
"client",
")",
"mask",
"=",
"\"mask[instances[id, billingItem[id, item[id,keyName]]], backendRouter[id, datacenter[name]]]... | Turns an empty Reserve Capacity into a real Virtual Guest
:param int capacity_id: ID of the RESERVED_CAPACITY_GROUP to create this guest into
:param bool test: True will use verifyOrder, False will use placeOrder
:param dictionary guest_object: Below is the minimum info you need to send in
... | [
"Turns",
"an",
"empty",
"Reserve",
"Capacity",
"into",
"a",
"real",
"Virtual",
"Guest"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs_capacity.py#L125-L165 | train |
softlayer/softlayer-python | SoftLayer/CLI/virt/capacity/list.py | cli | def cli(env):
"""List Reserved Capacity groups."""
manager = CapacityManager(env.client)
result = manager.list()
table = formatting.Table(
["ID", "Name", "Capacity", "Flavor", "Location", "Created"],
title="Reserved Capacity"
)
for r_c in result:
occupied_string = "#" * i... | python | def cli(env):
"""List Reserved Capacity groups."""
manager = CapacityManager(env.client)
result = manager.list()
table = formatting.Table(
["ID", "Name", "Capacity", "Flavor", "Location", "Created"],
title="Reserved Capacity"
)
for r_c in result:
occupied_string = "#" * i... | [
"def",
"cli",
"(",
"env",
")",
":",
"manager",
"=",
"CapacityManager",
"(",
"env",
".",
"client",
")",
"result",
"=",
"manager",
".",
"list",
"(",
")",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"\"ID\"",
",",
"\"Name\"",
",",
"\"Capacity\"",
... | List Reserved Capacity groups. | [
"List",
"Reserved",
"Capacity",
"groups",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/capacity/list.py#L12-L32 | train |
softlayer/softlayer-python | SoftLayer/CLI/order/place_quote.py | cli | def cli(env, package_keyname, location, preset, name, send_email, complex_type,
extras, order_items):
"""Place a quote.
This CLI command is used for creating a quote of the specified package in
the given location (denoted by a datacenter's long name). Orders made via the CLI
can then be conver... | python | def cli(env, package_keyname, location, preset, name, send_email, complex_type,
extras, order_items):
"""Place a quote.
This CLI command is used for creating a quote of the specified package in
the given location (denoted by a datacenter's long name). Orders made via the CLI
can then be conver... | [
"def",
"cli",
"(",
"env",
",",
"package_keyname",
",",
"location",
",",
"preset",
",",
"name",
",",
"send_email",
",",
"complex_type",
",",
"extras",
",",
"order_items",
")",
":",
"manager",
"=",
"ordering",
".",
"OrderingManager",
"(",
"env",
".",
"client... | Place a quote.
This CLI command is used for creating a quote of the specified package in
the given location (denoted by a datacenter's long name). Orders made via the CLI
can then be converted to be made programmatically by calling
SoftLayer.OrderingManager.place_quote() with the same keynames.
P... | [
"Place",
"a",
"quote",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/order/place_quote.py#L30-L96 | train |
softlayer/softlayer-python | SoftLayer/CLI/order/quote_list.py | cli | def cli(env):
"""List all active quotes on an account"""
table = formatting.Table([
'Id', 'Name', 'Created', 'Expiration', 'Status', 'Package Name', 'Package Id'
])
table.align['Name'] = 'l'
table.align['Package Name'] = 'r'
table.align['Package Id'] = 'l'
manager = ordering.Orderin... | python | def cli(env):
"""List all active quotes on an account"""
table = formatting.Table([
'Id', 'Name', 'Created', 'Expiration', 'Status', 'Package Name', 'Package Id'
])
table.align['Name'] = 'l'
table.align['Package Name'] = 'r'
table.align['Package Id'] = 'l'
manager = ordering.Orderin... | [
"def",
"cli",
"(",
"env",
")",
":",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"'Id'",
",",
"'Name'",
",",
"'Created'",
",",
"'Expiration'",
",",
"'Status'",
",",
"'Package Name'",
",",
"'Package Id'",
"]",
")",
"table",
".",
"align",
"[",
"'N... | List all active quotes on an account | [
"List",
"all",
"active",
"quotes",
"on",
"an",
"account"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/order/quote_list.py#L13-L36 | train |
softlayer/softlayer-python | SoftLayer/CLI/image/delete.py | cli | def cli(env, identifier):
"""Delete an image."""
image_mgr = SoftLayer.ImageManager(env.client)
image_id = helpers.resolve_id(image_mgr.resolve_ids, identifier, 'image')
image_mgr.delete_image(image_id) | python | def cli(env, identifier):
"""Delete an image."""
image_mgr = SoftLayer.ImageManager(env.client)
image_id = helpers.resolve_id(image_mgr.resolve_ids, identifier, 'image')
image_mgr.delete_image(image_id) | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"image_mgr",
"=",
"SoftLayer",
".",
"ImageManager",
"(",
"env",
".",
"client",
")",
"image_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"image_mgr",
".",
"resolve_ids",
",",
"identifier",
",",
"'image'... | Delete an image. | [
"Delete",
"an",
"image",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/image/delete.py#L14-L20 | train |
softlayer/softlayer-python | SoftLayer/CLI/loadbal/service_add.py | cli | def cli(env, identifier, enabled, port, weight, healthcheck_type, ip_address):
"""Adds a new load balancer service."""
mgr = SoftLayer.LoadBalancerManager(env.client)
loadbal_id, group_id = loadbal.parse_id(identifier)
# check if the IP is valid
ip_address_id = None
if ip_address:
ip_... | python | def cli(env, identifier, enabled, port, weight, healthcheck_type, ip_address):
"""Adds a new load balancer service."""
mgr = SoftLayer.LoadBalancerManager(env.client)
loadbal_id, group_id = loadbal.parse_id(identifier)
# check if the IP is valid
ip_address_id = None
if ip_address:
ip_... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
",",
"enabled",
",",
"port",
",",
"weight",
",",
"healthcheck_type",
",",
"ip_address",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"LoadBalancerManager",
"(",
"env",
".",
"client",
")",
"loadbal_id",
",",
"group_id... | Adds a new load balancer service. | [
"Adds",
"a",
"new",
"load",
"balancer",
"service",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/loadbal/service_add.py#L31-L53 | train |
softlayer/softlayer-python | SoftLayer/shell/core.py | cli | def cli(ctx, env):
"""Enters a shell for slcli."""
# Set up the environment
env = copy.deepcopy(env)
env.load_modules_from_python(routes.ALL_ROUTES)
env.aliases.update(routes.ALL_ALIASES)
env.vars['global_args'] = ctx.parent.params
env.vars['is_shell'] = True
env.vars['last_exit_code'] ... | python | def cli(ctx, env):
"""Enters a shell for slcli."""
# Set up the environment
env = copy.deepcopy(env)
env.load_modules_from_python(routes.ALL_ROUTES)
env.aliases.update(routes.ALL_ALIASES)
env.vars['global_args'] = ctx.parent.params
env.vars['is_shell'] = True
env.vars['last_exit_code'] ... | [
"def",
"cli",
"(",
"ctx",
",",
"env",
")",
":",
"env",
"=",
"copy",
".",
"deepcopy",
"(",
"env",
")",
"env",
".",
"load_modules_from_python",
"(",
"routes",
".",
"ALL_ROUTES",
")",
"env",
".",
"aliases",
".",
"update",
"(",
"routes",
".",
"ALL_ALIASES"... | Enters a shell for slcli. | [
"Enters",
"a",
"shell",
"for",
"slcli",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/shell/core.py#L34-L88 | train |
softlayer/softlayer-python | SoftLayer/shell/core.py | get_env_args | def get_env_args(env):
"""Yield options to inject into the slcli command from the environment."""
for arg, val in env.vars.get('global_args', {}).items():
if val is True:
yield '--%s' % arg
elif isinstance(val, int):
for _ in range(val):
yield '--%s' % arg... | python | def get_env_args(env):
"""Yield options to inject into the slcli command from the environment."""
for arg, val in env.vars.get('global_args', {}).items():
if val is True:
yield '--%s' % arg
elif isinstance(val, int):
for _ in range(val):
yield '--%s' % arg... | [
"def",
"get_env_args",
"(",
"env",
")",
":",
"for",
"arg",
",",
"val",
"in",
"env",
".",
"vars",
".",
"get",
"(",
"'global_args'",
",",
"{",
"}",
")",
".",
"items",
"(",
")",
":",
"if",
"val",
"is",
"True",
":",
"yield",
"'--%s'",
"%",
"arg",
"... | Yield options to inject into the slcli command from the environment. | [
"Yield",
"options",
"to",
"inject",
"into",
"the",
"slcli",
"command",
"from",
"the",
"environment",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/shell/core.py#L91-L102 | train |
softlayer/softlayer-python | SoftLayer/CLI/virt/placementgroup/delete.py | cli | def cli(env, identifier, purge):
"""Delete a placement group.
Placement Group MUST be empty before you can delete it.
IDENTIFIER can be either the Name or Id of the placement group you want to view
"""
manager = PlacementManager(env.client)
group_id = helpers.resolve_id(manager.resolve_ids, id... | python | def cli(env, identifier, purge):
"""Delete a placement group.
Placement Group MUST be empty before you can delete it.
IDENTIFIER can be either the Name or Id of the placement group you want to view
"""
manager = PlacementManager(env.client)
group_id = helpers.resolve_id(manager.resolve_ids, id... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
",",
"purge",
")",
":",
"manager",
"=",
"PlacementManager",
"(",
"env",
".",
"client",
")",
"group_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"manager",
".",
"resolve_ids",
",",
"identifier",
",",
"'placement_... | Delete a placement group.
Placement Group MUST be empty before you can delete it.
IDENTIFIER can be either the Name or Id of the placement group you want to view | [
"Delete",
"a",
"placement",
"group",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/placementgroup/delete.py#L19-L49 | train |
softlayer/softlayer-python | SoftLayer/CLI/vpn/ipsec/translation/update.py | cli | def cli(env, context_id, translation_id, static_ip, remote_ip, note):
"""Update an address translation for an IPSEC tunnel context.
A separate configuration request should be made to realize changes on
network devices.
"""
manager = SoftLayer.IPSECManager(env.client)
succeeded = manager.update_... | python | def cli(env, context_id, translation_id, static_ip, remote_ip, note):
"""Update an address translation for an IPSEC tunnel context.
A separate configuration request should be made to realize changes on
network devices.
"""
manager = SoftLayer.IPSECManager(env.client)
succeeded = manager.update_... | [
"def",
"cli",
"(",
"env",
",",
"context_id",
",",
"translation_id",
",",
"static_ip",
",",
"remote_ip",
",",
"note",
")",
":",
"manager",
"=",
"SoftLayer",
".",
"IPSECManager",
"(",
"env",
".",
"client",
")",
"succeeded",
"=",
"manager",
".",
"update_trans... | Update an address translation for an IPSEC tunnel context.
A separate configuration request should be made to realize changes on
network devices. | [
"Update",
"an",
"address",
"translation",
"for",
"an",
"IPSEC",
"tunnel",
"context",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/vpn/ipsec/translation/update.py#L31-L46 | train |
softlayer/softlayer-python | SoftLayer/shell/cmd_help.py | cli | def cli(ctx, env):
"""Print shell help text."""
env.out("Welcome to the SoftLayer shell.")
env.out("")
formatter = formatting.HelpFormatter()
commands = []
shell_commands = []
for name in cli_core.cli.list_commands(ctx):
command = cli_core.cli.get_command(ctx, name)
if comma... | python | def cli(ctx, env):
"""Print shell help text."""
env.out("Welcome to the SoftLayer shell.")
env.out("")
formatter = formatting.HelpFormatter()
commands = []
shell_commands = []
for name in cli_core.cli.list_commands(ctx):
command = cli_core.cli.get_command(ctx, name)
if comma... | [
"def",
"cli",
"(",
"ctx",
",",
"env",
")",
":",
"env",
".",
"out",
"(",
"\"Welcome to the SoftLayer shell.\"",
")",
"env",
".",
"out",
"(",
"\"\"",
")",
"formatter",
"=",
"formatting",
".",
"HelpFormatter",
"(",
")",
"commands",
"=",
"[",
"]",
"shell_com... | Print shell help text. | [
"Print",
"shell",
"help",
"text",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/shell/cmd_help.py#L15-L40 | train |
softlayer/softlayer-python | SoftLayer/CLI/hardware/reload.py | cli | def cli(env, identifier, postinstall, key):
"""Reload operating system on a server."""
hardware = SoftLayer.HardwareManager(env.client)
hardware_id = helpers.resolve_id(hardware.resolve_ids,
identifier,
'hardware')
key_list = []
... | python | def cli(env, identifier, postinstall, key):
"""Reload operating system on a server."""
hardware = SoftLayer.HardwareManager(env.client)
hardware_id = helpers.resolve_id(hardware.resolve_ids,
identifier,
'hardware')
key_list = []
... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
",",
"postinstall",
",",
"key",
")",
":",
"hardware",
"=",
"SoftLayer",
".",
"HardwareManager",
"(",
"env",
".",
"client",
")",
"hardware_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"hardware",
".",
"resolve_id... | Reload operating system on a server. | [
"Reload",
"operating",
"system",
"on",
"a",
"server",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/hardware/reload.py#L20-L36 | train |
softlayer/softlayer-python | SoftLayer/CLI/loadbal/service_edit.py | cli | def cli(env, identifier, enabled, port, weight, healthcheck_type, ip_address):
"""Edit the properties of a service group."""
mgr = SoftLayer.LoadBalancerManager(env.client)
loadbal_id, service_id = loadbal.parse_id(identifier)
# check if any input is provided
if ((not any([ip_address, weight, por... | python | def cli(env, identifier, enabled, port, weight, healthcheck_type, ip_address):
"""Edit the properties of a service group."""
mgr = SoftLayer.LoadBalancerManager(env.client)
loadbal_id, service_id = loadbal.parse_id(identifier)
# check if any input is provided
if ((not any([ip_address, weight, por... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
",",
"enabled",
",",
"port",
",",
"weight",
",",
"healthcheck_type",
",",
"ip_address",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"LoadBalancerManager",
"(",
"env",
".",
"client",
")",
"loadbal_id",
",",
"service_... | Edit the properties of a service group. | [
"Edit",
"the",
"properties",
"of",
"a",
"service",
"group",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/loadbal/service_edit.py#L25-L52 | train |
softlayer/softlayer-python | SoftLayer/CLI/subnet/list.py | cli | def cli(env, sortby, datacenter, identifier, subnet_type, network_space, ipv4, ipv6):
"""List subnets."""
mgr = SoftLayer.NetworkManager(env.client)
table = formatting.Table([
'id', 'identifier', 'type', 'network_space', 'datacenter', 'vlan_id',
'IPs', 'hardware', 'vs',
])
table.so... | python | def cli(env, sortby, datacenter, identifier, subnet_type, network_space, ipv4, ipv6):
"""List subnets."""
mgr = SoftLayer.NetworkManager(env.client)
table = formatting.Table([
'id', 'identifier', 'type', 'network_space', 'datacenter', 'vlan_id',
'IPs', 'hardware', 'vs',
])
table.so... | [
"def",
"cli",
"(",
"env",
",",
"sortby",
",",
"datacenter",
",",
"identifier",
",",
"subnet_type",
",",
"network_space",
",",
"ipv4",
",",
"ipv6",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"NetworkManager",
"(",
"env",
".",
"client",
")",
"table",
"=",
"... | List subnets. | [
"List",
"subnets",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/subnet/list.py#L32-L72 | train |
softlayer/softlayer-python | SoftLayer/CLI/firewall/add.py | cli | def cli(env, target, firewall_type, high_availability):
"""Create new firewall.
TARGET: Id of the server the firewall will protect
"""
mgr = SoftLayer.FirewallManager(env.client)
if not env.skip_confirmations:
if firewall_type == 'vlan':
pkg = mgr.get_dedicated_package(ha_enab... | python | def cli(env, target, firewall_type, high_availability):
"""Create new firewall.
TARGET: Id of the server the firewall will protect
"""
mgr = SoftLayer.FirewallManager(env.client)
if not env.skip_confirmations:
if firewall_type == 'vlan':
pkg = mgr.get_dedicated_package(ha_enab... | [
"def",
"cli",
"(",
"env",
",",
"target",
",",
"firewall_type",
",",
"high_availability",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"FirewallManager",
"(",
"env",
".",
"client",
")",
"if",
"not",
"env",
".",
"skip_confirmations",
":",
"if",
"firewall_type",
"... | Create new firewall.
TARGET: Id of the server the firewall will protect | [
"Create",
"new",
"firewall",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/firewall/add.py#L22-L58 | train |
softlayer/softlayer-python | SoftLayer/CLI/cdn/purge.py | cli | def cli(env, account_id, content_url):
"""Purge cached files from all edge nodes.
Examples:
slcli cdn purge 97794 http://example.com/cdn/file.txt
slcli cdn purge 97794 http://example.com/cdn/file.txt https://dal01.example.softlayer.net/image.png
"""
manager = SoftLayer.CDNManager(env... | python | def cli(env, account_id, content_url):
"""Purge cached files from all edge nodes.
Examples:
slcli cdn purge 97794 http://example.com/cdn/file.txt
slcli cdn purge 97794 http://example.com/cdn/file.txt https://dal01.example.softlayer.net/image.png
"""
manager = SoftLayer.CDNManager(env... | [
"def",
"cli",
"(",
"env",
",",
"account_id",
",",
"content_url",
")",
":",
"manager",
"=",
"SoftLayer",
".",
"CDNManager",
"(",
"env",
".",
"client",
")",
"content_list",
"=",
"manager",
".",
"purge_content",
"(",
"account_id",
",",
"content_url",
")",
"ta... | Purge cached files from all edge nodes.
Examples:
slcli cdn purge 97794 http://example.com/cdn/file.txt
slcli cdn purge 97794 http://example.com/cdn/file.txt https://dal01.example.softlayer.net/image.png | [
"Purge",
"cached",
"files",
"from",
"all",
"edge",
"nodes",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/cdn/purge.py#L15-L34 | train |
softlayer/softlayer-python | SoftLayer/CLI/order/package_locations.py | cli | def cli(env, package_keyname):
"""List Datacenters a package can be ordered in.
Use the location Key Name to place orders
"""
manager = ordering.OrderingManager(env.client)
table = formatting.Table(COLUMNS)
locations = manager.package_locations(package_keyname)
for region in locations:
... | python | def cli(env, package_keyname):
"""List Datacenters a package can be ordered in.
Use the location Key Name to place orders
"""
manager = ordering.OrderingManager(env.client)
table = formatting.Table(COLUMNS)
locations = manager.package_locations(package_keyname)
for region in locations:
... | [
"def",
"cli",
"(",
"env",
",",
"package_keyname",
")",
":",
"manager",
"=",
"ordering",
".",
"OrderingManager",
"(",
"env",
".",
"client",
")",
"table",
"=",
"formatting",
".",
"Table",
"(",
"COLUMNS",
")",
"locations",
"=",
"manager",
".",
"package_locati... | List Datacenters a package can be ordered in.
Use the location Key Name to place orders | [
"List",
"Datacenters",
"a",
"package",
"can",
"be",
"ordered",
"in",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/order/package_locations.py#L15-L32 | train |
softlayer/softlayer-python | SoftLayer/CLI/rwhois/edit.py | cli | def cli(env, abuse, address1, address2, city, company, country, firstname,
lastname, postal, public, state):
"""Edit the RWhois data on the account."""
mgr = SoftLayer.NetworkManager(env.client)
update = {
'abuse_email': abuse,
'address1': address1,
'address2': address2,
... | python | def cli(env, abuse, address1, address2, city, company, country, firstname,
lastname, postal, public, state):
"""Edit the RWhois data on the account."""
mgr = SoftLayer.NetworkManager(env.client)
update = {
'abuse_email': abuse,
'address1': address1,
'address2': address2,
... | [
"def",
"cli",
"(",
"env",
",",
"abuse",
",",
"address1",
",",
"address2",
",",
"city",
",",
"company",
",",
"country",
",",
"firstname",
",",
"lastname",
",",
"postal",
",",
"public",
",",
"state",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"NetworkManage... | Edit the RWhois data on the account. | [
"Edit",
"the",
"RWhois",
"data",
"on",
"the",
"account",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/rwhois/edit.py#L26-L55 | train |
softlayer/softlayer-python | SoftLayer/CLI/order/quote.py | cli | def cli(env, quote, **args):
"""View and Order a quote
\f
:note:
The hostname and domain are split out from the fully qualified domain name.
If you want to order multiple servers, you need to specify each FQDN. Postinstall, userdata, and
sshkeys are applied to all servers in an ord... | python | def cli(env, quote, **args):
"""View and Order a quote
\f
:note:
The hostname and domain are split out from the fully qualified domain name.
If you want to order multiple servers, you need to specify each FQDN. Postinstall, userdata, and
sshkeys are applied to all servers in an ord... | [
"def",
"cli",
"(",
"env",
",",
"quote",
",",
"**",
"args",
")",
":",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"'Id'",
",",
"'Name'",
",",
"'Created'",
",",
"'Expiration'",
",",
"'Status'",
"]",
")",
"create_args",
"=",
"_parse_create_args",
... | View and Order a quote
\f
:note:
The hostname and domain are split out from the fully qualified domain name.
If you want to order multiple servers, you need to specify each FQDN. Postinstall, userdata, and
sshkeys are applied to all servers in an order.
::
slcli order quo... | [
"View",
"and",
"Order",
"a",
"quote"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/order/quote.py#L81-L130 | train |
softlayer/softlayer-python | SoftLayer/managers/block.py | BlockStorageManager.authorize_host_to_volume | def authorize_host_to_volume(self, volume_id,
hardware_ids=None,
virtual_guest_ids=None,
ip_address_ids=None,
**kwargs):
"""Authorizes hosts to Block Storage Volumes
:para... | python | def authorize_host_to_volume(self, volume_id,
hardware_ids=None,
virtual_guest_ids=None,
ip_address_ids=None,
**kwargs):
"""Authorizes hosts to Block Storage Volumes
:para... | [
"def",
"authorize_host_to_volume",
"(",
"self",
",",
"volume_id",
",",
"hardware_ids",
"=",
"None",
",",
"virtual_guest_ids",
"=",
"None",
",",
"ip_address_ids",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"host_templates",
"=",
"[",
"]",
"storage_utils",
".",... | Authorizes hosts to Block Storage Volumes
:param volume_id: The Block volume to authorize hosts to
:param hardware_ids: A List of SoftLayer_Hardware ids
:param virtual_guest_ids: A List of SoftLayer_Virtual_Guest ids
:param ip_address_ids: A List of SoftLayer_Network_Subnet_IpAddress id... | [
"Authorizes",
"hosts",
"to",
"Block",
"Storage",
"Volumes"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/block.py#L154-L177 | train |
softlayer/softlayer-python | SoftLayer/managers/block.py | BlockStorageManager.order_replicant_volume | def order_replicant_volume(self, volume_id, snapshot_schedule,
location, tier=None, os_type=None):
"""Places an order for a replicant block volume.
:param volume_id: The ID of the primary volume to be replicated
:param snapshot_schedule: The primary volume's snaps... | python | def order_replicant_volume(self, volume_id, snapshot_schedule,
location, tier=None, os_type=None):
"""Places an order for a replicant block volume.
:param volume_id: The ID of the primary volume to be replicated
:param snapshot_schedule: The primary volume's snaps... | [
"def",
"order_replicant_volume",
"(",
"self",
",",
"volume_id",
",",
"snapshot_schedule",
",",
"location",
",",
"tier",
"=",
"None",
",",
"os_type",
"=",
"None",
")",
":",
"block_mask",
"=",
"'billingItem[activeChildren,hourlyFlag],'",
"'storageTierLevel,osType,staasVer... | Places an order for a replicant block volume.
:param volume_id: The ID of the primary volume to be replicated
:param snapshot_schedule: The primary volume's snapshot
schedule to use for replication
:param location: The location for the ordered replicant volume
... | [
"Places",
"an",
"order",
"for",
"a",
"replicant",
"block",
"volume",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/block.py#L224-L260 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.