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/utils.py
is_ready
def is_ready(instance, pending=False): """Returns True if instance is ready to be used :param Object instance: Hardware or Virt with transaction data retrieved from the API :param bool pending: Wait for ALL transactions to finish? :returns bool: """ last_reload = lookup(instance, 'lastOperatin...
python
def is_ready(instance, pending=False): """Returns True if instance is ready to be used :param Object instance: Hardware or Virt with transaction data retrieved from the API :param bool pending: Wait for ALL transactions to finish? :returns bool: """ last_reload = lookup(instance, 'lastOperatin...
[ "def", "is_ready", "(", "instance", ",", "pending", "=", "False", ")", ":", "last_reload", "=", "lookup", "(", "instance", ",", "'lastOperatingSystemReload'", ",", "'id'", ")", "active_transaction", "=", "lookup", "(", "instance", ",", "'activeTransaction'", ","...
Returns True if instance is ready to be used :param Object instance: Hardware or Virt with transaction data retrieved from the API :param bool pending: Wait for ALL transactions to finish? :returns bool:
[ "Returns", "True", "if", "instance", "is", "ready", "to", "be", "used" ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/utils.py#L254-L275
train
softlayer/softlayer-python
SoftLayer/utils.py
clean_time
def clean_time(sltime, in_format='%Y-%m-%dT%H:%M:%S%z', out_format='%Y-%m-%d %H:%M'): """Easy way to format time strings :param string sltime: A softlayer formatted time string :param string in_format: Datetime format for strptime :param string out_format: Datetime format for strftime """ try: ...
python
def clean_time(sltime, in_format='%Y-%m-%dT%H:%M:%S%z', out_format='%Y-%m-%d %H:%M'): """Easy way to format time strings :param string sltime: A softlayer formatted time string :param string in_format: Datetime format for strptime :param string out_format: Datetime format for strftime """ try: ...
[ "def", "clean_time", "(", "sltime", ",", "in_format", "=", "'%Y-%m-%dT%H:%M:%S%z'", ",", "out_format", "=", "'%Y-%m-%d %H:%M'", ")", ":", "try", ":", "clean", "=", "datetime", ".", "datetime", ".", "strptime", "(", "sltime", ",", "in_format", ")", "return", ...
Easy way to format time strings :param string sltime: A softlayer formatted time string :param string in_format: Datetime format for strptime :param string out_format: Datetime format for strftime
[ "Easy", "way", "to", "format", "time", "strings" ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/utils.py#L301-L313
train
softlayer/softlayer-python
SoftLayer/utils.py
NestedDict.to_dict
def to_dict(self): """Converts a NestedDict instance into a real dictionary. This is needed for places where strict type checking is done. """ return {key: val.to_dict() if isinstance(val, NestedDict) else val for key, val in self.items()}
python
def to_dict(self): """Converts a NestedDict instance into a real dictionary. This is needed for places where strict type checking is done. """ return {key: val.to_dict() if isinstance(val, NestedDict) else val for key, val in self.items()}
[ "def", "to_dict", "(", "self", ")", ":", "return", "{", "key", ":", "val", ".", "to_dict", "(", ")", "if", "isinstance", "(", "val", ",", "NestedDict", ")", "else", "val", "for", "key", ",", "val", "in", "self", ".", "items", "(", ")", "}" ]
Converts a NestedDict instance into a real dictionary. This is needed for places where strict type checking is done.
[ "Converts", "a", "NestedDict", "instance", "into", "a", "real", "dictionary", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/utils.py#L57-L63
train
softlayer/softlayer-python
SoftLayer/CLI/firewall/cancel.py
cli
def cli(env, identifier): """Cancels a firewall.""" mgr = SoftLayer.FirewallManager(env.client) firewall_type, firewall_id = firewall.parse_id(identifier) if not (env.skip_confirmations or formatting.confirm("This action will cancel a firewall from your " "ac...
python
def cli(env, identifier): """Cancels a firewall.""" mgr = SoftLayer.FirewallManager(env.client) firewall_type, firewall_id = firewall.parse_id(identifier) if not (env.skip_confirmations or formatting.confirm("This action will cancel a firewall from your " "ac...
[ "def", "cli", "(", "env", ",", "identifier", ")", ":", "mgr", "=", "SoftLayer", ".", "FirewallManager", "(", "env", ".", "client", ")", "firewall_type", ",", "firewall_id", "=", "firewall", ".", "parse_id", "(", "identifier", ")", "if", "not", "(", "env"...
Cancels a firewall.
[ "Cancels", "a", "firewall", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/firewall/cancel.py#L16-L34
train
softlayer/softlayer-python
SoftLayer/CLI/sshkey/add.py
cli
def cli(env, label, in_file, key, note): """Add a new SSH key.""" if in_file is None and key is None: raise exceptions.ArgumentError( 'Either [-f | --in-file] or [-k | --key] arguments are required to add a key' ) if in_file and key: raise exceptions.ArgumentError( ...
python
def cli(env, label, in_file, key, note): """Add a new SSH key.""" if in_file is None and key is None: raise exceptions.ArgumentError( 'Either [-f | --in-file] or [-k | --key] arguments are required to add a key' ) if in_file and key: raise exceptions.ArgumentError( ...
[ "def", "cli", "(", "env", ",", "label", ",", "in_file", ",", "key", ",", "note", ")", ":", "if", "in_file", "is", "None", "and", "key", "is", "None", ":", "raise", "exceptions", ".", "ArgumentError", "(", "'Either [-f | --in-file] or [-k | --key] arguments are...
Add a new SSH key.
[ "Add", "a", "new", "SSH", "key", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/sshkey/add.py#L20-L43
train
softlayer/softlayer-python
SoftLayer/CLI/rwhois/show.py
cli
def cli(env): """Display the RWhois information for your account.""" mgr = SoftLayer.NetworkManager(env.client) result = mgr.get_rwhois() table = formatting.KeyValueTable(['name', 'value']) table.align['name'] = 'r' table.align['value'] = 'l' table.add_row(['Name', result['firstName'] + ' ...
python
def cli(env): """Display the RWhois information for your account.""" mgr = SoftLayer.NetworkManager(env.client) result = mgr.get_rwhois() table = formatting.KeyValueTable(['name', 'value']) table.align['name'] = 'r' table.align['value'] = 'l' table.add_row(['Name', result['firstName'] + ' ...
[ "def", "cli", "(", "env", ")", ":", "mgr", "=", "SoftLayer", ".", "NetworkManager", "(", "env", ".", "client", ")", "result", "=", "mgr", ".", "get_rwhois", "(", ")", "table", "=", "formatting", ".", "KeyValueTable", "(", "[", "'name'", ",", "'value'",...
Display the RWhois information for your account.
[ "Display", "the", "RWhois", "information", "for", "your", "account", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/rwhois/show.py#L13-L34
train
softlayer/softlayer-python
SoftLayer/CLI/vpn/ipsec/translation/add.py
cli
def cli(env, context_id, static_ip, remote_ip, note): """Add an address translation to an IPSEC tunnel context. A separate configuration request should be made to realize changes on network devices. """ manager = SoftLayer.IPSECManager(env.client) # ensure context can be retrieved by given id ...
python
def cli(env, context_id, static_ip, remote_ip, note): """Add an address translation to an IPSEC tunnel context. A separate configuration request should be made to realize changes on network devices. """ manager = SoftLayer.IPSECManager(env.client) # ensure context can be retrieved by given id ...
[ "def", "cli", "(", "env", ",", "context_id", ",", "static_ip", ",", "remote_ip", ",", "note", ")", ":", "manager", "=", "SoftLayer", ".", "IPSECManager", "(", "env", ".", "client", ")", "manager", ".", "get_tunnel_context", "(", "context_id", ")", "transla...
Add an address translation to an IPSEC tunnel context. A separate configuration request should be made to realize changes on network devices.
[ "Add", "an", "address", "translation", "to", "an", "IPSEC", "tunnel", "context", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/vpn/ipsec/translation/add.py#L27-L42
train
softlayer/softlayer-python
SoftLayer/CLI/ssl/list.py
cli
def cli(env, status, sortby): """List SSL certificates.""" manager = SoftLayer.SSLManager(env.client) certificates = manager.list_certs(status) table = formatting.Table(['id', 'common_name', 'days_until_expire', ...
python
def cli(env, status, sortby): """List SSL certificates.""" manager = SoftLayer.SSLManager(env.client) certificates = manager.list_certs(status) table = formatting.Table(['id', 'common_name', 'days_until_expire', ...
[ "def", "cli", "(", "env", ",", "status", ",", "sortby", ")", ":", "manager", "=", "SoftLayer", ".", "SSLManager", "(", "env", ".", "client", ")", "certificates", "=", "manager", ".", "list_certs", "(", "status", ")", "table", "=", "formatting", ".", "T...
List SSL certificates.
[ "List", "SSL", "certificates", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/ssl/list.py#L24-L42
train
softlayer/softlayer-python
SoftLayer/CLI/loadbal/health_checks.py
cli
def cli(env): """List health check types.""" mgr = SoftLayer.LoadBalancerManager(env.client) hc_types = mgr.get_hc_types() table = formatting.KeyValueTable(['ID', 'Name']) table.align['ID'] = 'l' table.align['Name'] = 'l' table.sortby = 'ID' for hc_type in hc_types: table.add_r...
python
def cli(env): """List health check types.""" mgr = SoftLayer.LoadBalancerManager(env.client) hc_types = mgr.get_hc_types() table = formatting.KeyValueTable(['ID', 'Name']) table.align['ID'] = 'l' table.align['Name'] = 'l' table.sortby = 'ID' for hc_type in hc_types: table.add_r...
[ "def", "cli", "(", "env", ")", ":", "mgr", "=", "SoftLayer", ".", "LoadBalancerManager", "(", "env", ".", "client", ")", "hc_types", "=", "mgr", ".", "get_hc_types", "(", ")", "table", "=", "formatting", ".", "KeyValueTable", "(", "[", "'ID'", ",", "'N...
List health check types.
[ "List", "health", "check", "types", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/loadbal/health_checks.py#L13-L26
train
softlayer/softlayer-python
SoftLayer/CLI/object_storage/credential/limit.py
cli
def cli(env, identifier): """Credential limits for this IBM Cloud Object Storage account.""" mgr = SoftLayer.ObjectStorageManager(env.client) credential_limit = mgr.limit_credential(identifier) table = formatting.Table(['limit']) table.add_row([ credential_limit, ]) env.fout(table)
python
def cli(env, identifier): """Credential limits for this IBM Cloud Object Storage account.""" mgr = SoftLayer.ObjectStorageManager(env.client) credential_limit = mgr.limit_credential(identifier) table = formatting.Table(['limit']) table.add_row([ credential_limit, ]) env.fout(table)
[ "def", "cli", "(", "env", ",", "identifier", ")", ":", "mgr", "=", "SoftLayer", ".", "ObjectStorageManager", "(", "env", ".", "client", ")", "credential_limit", "=", "mgr", ".", "limit_credential", "(", "identifier", ")", "table", "=", "formatting", ".", "...
Credential limits for this IBM Cloud Object Storage account.
[ "Credential", "limits", "for", "this", "IBM", "Cloud", "Object", "Storage", "account", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/object_storage/credential/limit.py#L14-L24
train
softlayer/softlayer-python
SoftLayer/CLI/vpn/ipsec/detail.py
cli
def cli(env, context_id, include): """List IPSEC VPN tunnel context details. Additional resources can be joined using multiple instances of the include option, for which the following choices are available. \b at: address translations is: internal subnets rs: remote subnets sr: statica...
python
def cli(env, context_id, include): """List IPSEC VPN tunnel context details. Additional resources can be joined using multiple instances of the include option, for which the following choices are available. \b at: address translations is: internal subnets rs: remote subnets sr: statica...
[ "def", "cli", "(", "env", ",", "context_id", ",", "include", ")", ":", "mask", "=", "_get_tunnel_context_mask", "(", "(", "'at'", "in", "include", ")", ",", "(", "'is'", "in", "include", ")", ",", "(", "'rs'", "in", "include", ")", ",", "(", "'sr'", ...
List IPSEC VPN tunnel context details. Additional resources can be joined using multiple instances of the include option, for which the following choices are available. \b at: address translations is: internal subnets rs: remote subnets sr: statically routed subnets ss: service subnets
[ "List", "IPSEC", "VPN", "tunnel", "context", "details", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/vpn/ipsec/detail.py#L20-L60
train
softlayer/softlayer-python
SoftLayer/CLI/vpn/ipsec/detail.py
_get_address_translations_table
def _get_address_translations_table(address_translations): """Yields a formatted table to print address translations. :param List[dict] address_translations: List of address translations. :return Table: Formatted for address translation output. """ table = formatting.Table(['id', ...
python
def _get_address_translations_table(address_translations): """Yields a formatted table to print address translations. :param List[dict] address_translations: List of address translations. :return Table: Formatted for address translation output. """ table = formatting.Table(['id', ...
[ "def", "_get_address_translations_table", "(", "address_translations", ")", ":", "table", "=", "formatting", ".", "Table", "(", "[", "'id'", ",", "'static IP address'", ",", "'static IP address id'", ",", "'remote IP address'", ",", "'remote IP address id'", ",", "'note...
Yields a formatted table to print address translations. :param List[dict] address_translations: List of address translations. :return Table: Formatted for address translation output.
[ "Yields", "a", "formatted", "table", "to", "print", "address", "translations", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/vpn/ipsec/detail.py#L63-L84
train
softlayer/softlayer-python
SoftLayer/CLI/vpn/ipsec/detail.py
_get_subnets_table
def _get_subnets_table(subnets): """Yields a formatted table to print subnet details. :param List[dict] subnets: List of subnets. :return Table: Formatted for subnet output. """ table = formatting.Table(['id', 'network identifier', 'cidr',...
python
def _get_subnets_table(subnets): """Yields a formatted table to print subnet details. :param List[dict] subnets: List of subnets. :return Table: Formatted for subnet output. """ table = formatting.Table(['id', 'network identifier', 'cidr',...
[ "def", "_get_subnets_table", "(", "subnets", ")", ":", "table", "=", "formatting", ".", "Table", "(", "[", "'id'", ",", "'network identifier'", ",", "'cidr'", ",", "'note'", "]", ")", "for", "subnet", "in", "subnets", ":", "table", ".", "add_row", "(", "...
Yields a formatted table to print subnet details. :param List[dict] subnets: List of subnets. :return Table: Formatted for subnet output.
[ "Yields", "a", "formatted", "table", "to", "print", "subnet", "details", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/vpn/ipsec/detail.py#L87-L102
train
softlayer/softlayer-python
SoftLayer/CLI/vpn/ipsec/detail.py
_get_tunnel_context_mask
def _get_tunnel_context_mask(address_translations=False, internal_subnets=False, remote_subnets=False, static_subnets=False, service_subnets=False): """Yields a mask object for a tunnel context. ...
python
def _get_tunnel_context_mask(address_translations=False, internal_subnets=False, remote_subnets=False, static_subnets=False, service_subnets=False): """Yields a mask object for a tunnel context. ...
[ "def", "_get_tunnel_context_mask", "(", "address_translations", "=", "False", ",", "internal_subnets", "=", "False", ",", "remote_subnets", "=", "False", ",", "static_subnets", "=", "False", ",", "service_subnets", "=", "False", ")", ":", "entries", "=", "[", "'...
Yields a mask object for a tunnel context. All exposed properties on the tunnel context service are included in the constructed mask. Additional joins may be requested. :param bool address_translations: Whether to join the context's address translation entries. :param bool internal_subnets:...
[ "Yields", "a", "mask", "object", "for", "a", "tunnel", "context", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/vpn/ipsec/detail.py#L105-L157
train
softlayer/softlayer-python
SoftLayer/CLI/vpn/ipsec/detail.py
_get_context_table
def _get_context_table(context): """Yields a formatted table to print context details. :param dict context: The tunnel context :return Table: Formatted for tunnel context output """ table = formatting.KeyValueTable(['name', 'value']) table.align['name'] = 'r' table.align['value'] = 'l' ...
python
def _get_context_table(context): """Yields a formatted table to print context details. :param dict context: The tunnel context :return Table: Formatted for tunnel context output """ table = formatting.KeyValueTable(['name', 'value']) table.align['name'] = 'r' table.align['value'] = 'l' ...
[ "def", "_get_context_table", "(", "context", ")", ":", "table", "=", "formatting", ".", "KeyValueTable", "(", "[", "'name'", ",", "'value'", "]", ")", "table", ".", "align", "[", "'name'", "]", "=", "'r'", "table", ".", "align", "[", "'value'", "]", "=...
Yields a formatted table to print context details. :param dict context: The tunnel context :return Table: Formatted for tunnel context output
[ "Yields", "a", "formatted", "table", "to", "print", "context", "details", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/vpn/ipsec/detail.py#L160-L196
train
softlayer/softlayer-python
SoftLayer/CLI/file/replication/failover.py
cli
def cli(env, volume_id, replicant_id, immediate): """Failover a file volume to the given replicant volume.""" file_storage_manager = SoftLayer.FileStorageManager(env.client) success = file_storage_manager.failover_to_replicant( volume_id, replicant_id, immediate ) if succes...
python
def cli(env, volume_id, replicant_id, immediate): """Failover a file volume to the given replicant volume.""" file_storage_manager = SoftLayer.FileStorageManager(env.client) success = file_storage_manager.failover_to_replicant( volume_id, replicant_id, immediate ) if succes...
[ "def", "cli", "(", "env", ",", "volume_id", ",", "replicant_id", ",", "immediate", ")", ":", "file_storage_manager", "=", "SoftLayer", ".", "FileStorageManager", "(", "env", ".", "client", ")", "success", "=", "file_storage_manager", ".", "failover_to_replicant", ...
Failover a file volume to the given replicant volume.
[ "Failover", "a", "file", "volume", "to", "the", "given", "replicant", "volume", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/file/replication/failover.py#L17-L30
train
softlayer/softlayer-python
SoftLayer/CLI/file/count.py
cli
def cli(env, sortby, datacenter): """List number of file storage volumes per datacenter.""" file_manager = SoftLayer.FileStorageManager(env.client) mask = "mask[serviceResource[datacenter[name]],"\ "replicationPartners[serviceResource[datacenter[name]]]]" file_volumes = file_manager.list_file...
python
def cli(env, sortby, datacenter): """List number of file storage volumes per datacenter.""" file_manager = SoftLayer.FileStorageManager(env.client) mask = "mask[serviceResource[datacenter[name]],"\ "replicationPartners[serviceResource[datacenter[name]]]]" file_volumes = file_manager.list_file...
[ "def", "cli", "(", "env", ",", "sortby", ",", "datacenter", ")", ":", "file_manager", "=", "SoftLayer", ".", "FileStorageManager", "(", "env", ".", "client", ")", "mask", "=", "\"mask[serviceResource[datacenter[name]],\"", "\"replicationPartners[serviceResource[datacent...
List number of file storage volumes per datacenter.
[ "List", "number", "of", "file", "storage", "volumes", "per", "datacenter", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/file/count.py#L19-L41
train
softlayer/softlayer-python
SoftLayer/CLI/hardware/create_options.py
cli
def cli(env): """Server order options for a given chassis.""" hardware_manager = hardware.HardwareManager(env.client) options = hardware_manager.get_create_options() tables = [] # Datacenters dc_table = formatting.Table(['datacenter', 'value']) dc_table.sortby = 'value' for location i...
python
def cli(env): """Server order options for a given chassis.""" hardware_manager = hardware.HardwareManager(env.client) options = hardware_manager.get_create_options() tables = [] # Datacenters dc_table = formatting.Table(['datacenter', 'value']) dc_table.sortby = 'value' for location i...
[ "def", "cli", "(", "env", ")", ":", "hardware_manager", "=", "hardware", ".", "HardwareManager", "(", "env", ".", "client", ")", "options", "=", "hardware_manager", ".", "get_create_options", "(", ")", "tables", "=", "[", "]", "dc_table", "=", "formatting", ...
Server order options for a given chassis.
[ "Server", "order", "options", "for", "a", "given", "chassis", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/hardware/create_options.py#L13-L56
train
softlayer/softlayer-python
SoftLayer/CLI/firewall/__init__.py
parse_id
def parse_id(input_id): """Helper package to retrieve the actual IDs. :param input_id: the ID provided by the user :returns: A list of valid IDs """ key_value = input_id.split(':') if len(key_value) != 2: raise exceptions.CLIAbort( 'Invalid ID %s: ID should be of the form x...
python
def parse_id(input_id): """Helper package to retrieve the actual IDs. :param input_id: the ID provided by the user :returns: A list of valid IDs """ key_value = input_id.split(':') if len(key_value) != 2: raise exceptions.CLIAbort( 'Invalid ID %s: ID should be of the form x...
[ "def", "parse_id", "(", "input_id", ")", ":", "key_value", "=", "input_id", ".", "split", "(", "':'", ")", "if", "len", "(", "key_value", ")", "!=", "2", ":", "raise", "exceptions", ".", "CLIAbort", "(", "'Invalid ID %s: ID should be of the form xxx:yyy'", "%"...
Helper package to retrieve the actual IDs. :param input_id: the ID provided by the user :returns: A list of valid IDs
[ "Helper", "package", "to", "retrieve", "the", "actual", "IDs", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/firewall/__init__.py#L7-L18
train
softlayer/softlayer-python
SoftLayer/CLI/call_api.py
_build_filters
def _build_filters(_filters): """Builds filters using the filter options passed into the CLI. This only supports the equals keyword at the moment. """ root = utils.NestedDict({}) for _filter in _filters: operation = None for operation, token in SPLIT_TOKENS: # split "som...
python
def _build_filters(_filters): """Builds filters using the filter options passed into the CLI. This only supports the equals keyword at the moment. """ root = utils.NestedDict({}) for _filter in _filters: operation = None for operation, token in SPLIT_TOKENS: # split "som...
[ "def", "_build_filters", "(", "_filters", ")", ":", "root", "=", "utils", ".", "NestedDict", "(", "{", "}", ")", "for", "_filter", "in", "_filters", ":", "operation", "=", "None", "for", "operation", ",", "token", "in", "SPLIT_TOKENS", ":", "top_parts", ...
Builds filters using the filter options passed into the CLI. This only supports the equals keyword at the moment.
[ "Builds", "filters", "using", "the", "filter", "options", "passed", "into", "the", "CLI", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/call_api.py#L16-L53
train
softlayer/softlayer-python
SoftLayer/CLI/call_api.py
cli
def cli(env, service, method, parameters, _id, _filters, mask, limit, offset, output_python=False): """Call arbitrary API endpoints with the given SERVICE and METHOD. Example:: slcli call-api Account getObject slcli call-api Account getVirtualGuests --limit=10 --mask=id,hostname ...
python
def cli(env, service, method, parameters, _id, _filters, mask, limit, offset, output_python=False): """Call arbitrary API endpoints with the given SERVICE and METHOD. Example:: slcli call-api Account getObject slcli call-api Account getVirtualGuests --limit=10 --mask=id,hostname ...
[ "def", "cli", "(", "env", ",", "service", ",", "method", ",", "parameters", ",", "_id", ",", "_filters", ",", "mask", ",", "limit", ",", "offset", ",", "output_python", "=", "False", ")", ":", "args", "=", "[", "service", ",", "method", "]", "+", "...
Call arbitrary API endpoints with the given SERVICE and METHOD. Example:: slcli call-api Account getObject slcli call-api Account getVirtualGuests --limit=10 --mask=id,hostname slcli call-api Virtual_Guest getObject --id=12345 slcli call-api Metric_Tracking_Object getBandwidthData ...
[ "Call", "arbitrary", "API", "endpoints", "with", "the", "given", "SERVICE", "and", "METHOD", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/call_api.py#L86-L118
train
softlayer/softlayer-python
SoftLayer/CLI/block/snapshot/list.py
cli
def cli(env, volume_id, sortby, columns): """List block storage snapshots.""" block_manager = SoftLayer.BlockStorageManager(env.client) snapshots = block_manager.get_block_volume_snapshot_list( volume_id, mask=columns.mask() ) table = formatting.Table(columns.columns) table.sort...
python
def cli(env, volume_id, sortby, columns): """List block storage snapshots.""" block_manager = SoftLayer.BlockStorageManager(env.client) snapshots = block_manager.get_block_volume_snapshot_list( volume_id, mask=columns.mask() ) table = formatting.Table(columns.columns) table.sort...
[ "def", "cli", "(", "env", ",", "volume_id", ",", "sortby", ",", "columns", ")", ":", "block_manager", "=", "SoftLayer", ".", "BlockStorageManager", "(", "env", ".", "client", ")", "snapshots", "=", "block_manager", ".", "get_block_volume_snapshot_list", "(", "...
List block storage snapshots.
[ "List", "block", "storage", "snapshots", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/block/snapshot/list.py#L38-L53
train
softlayer/softlayer-python
SoftLayer/CLI/order/place.py
cli
def cli(env, package_keyname, location, preset, verify, billing, complex_type, quantity, extras, order_items): """Place or verify an order. This CLI command is used for placing/verifying an order of the specified package in the given location (denoted by a datacenter's long name). Orders made via t...
python
def cli(env, package_keyname, location, preset, verify, billing, complex_type, quantity, extras, order_items): """Place or verify an order. This CLI command is used for placing/verifying an order of the specified package in the given location (denoted by a datacenter's long name). Orders made via t...
[ "def", "cli", "(", "env", ",", "package_keyname", ",", "location", ",", "preset", ",", "verify", ",", "billing", ",", "complex_type", ",", "quantity", ",", "extras", ",", "order_items", ")", ":", "manager", "=", "ordering", ".", "OrderingManager", "(", "en...
Place or verify an order. This CLI command is used for placing/verifying an order 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_order() with the s...
[ "Place", "or", "verify", "an", "order", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/order/place.py#L41-L120
train
softlayer/softlayer-python
SoftLayer/CLI/sshkey/edit.py
cli
def cli(env, identifier, label, note): """Edits an SSH key.""" mgr = SoftLayer.SshKeyManager(env.client) key_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'SshKey') if not mgr.edit_key(key_id, label=label, notes=note): raise exceptions.CLIAbort('Failed to edit SSH key')
python
def cli(env, identifier, label, note): """Edits an SSH key.""" mgr = SoftLayer.SshKeyManager(env.client) key_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'SshKey') if not mgr.edit_key(key_id, label=label, notes=note): raise exceptions.CLIAbort('Failed to edit SSH key')
[ "def", "cli", "(", "env", ",", "identifier", ",", "label", ",", "note", ")", ":", "mgr", "=", "SoftLayer", ".", "SshKeyManager", "(", "env", ".", "client", ")", "key_id", "=", "helpers", ".", "resolve_id", "(", "mgr", ".", "resolve_ids", ",", "identifi...
Edits an SSH key.
[ "Edits", "an", "SSH", "key", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/sshkey/edit.py#L17-L25
train
softlayer/softlayer-python
SoftLayer/CLI/securitygroup/delete.py
cli
def cli(env, securitygroup_id): """Deletes the given security group""" mgr = SoftLayer.NetworkManager(env.client) if not mgr.delete_securitygroup(securitygroup_id): raise exceptions.CLIAbort("Failed to delete security group")
python
def cli(env, securitygroup_id): """Deletes the given security group""" mgr = SoftLayer.NetworkManager(env.client) if not mgr.delete_securitygroup(securitygroup_id): raise exceptions.CLIAbort("Failed to delete security group")
[ "def", "cli", "(", "env", ",", "securitygroup_id", ")", ":", "mgr", "=", "SoftLayer", ".", "NetworkManager", "(", "env", ".", "client", ")", "if", "not", "mgr", ".", "delete_securitygroup", "(", "securitygroup_id", ")", ":", "raise", "exceptions", ".", "CL...
Deletes the given security group
[ "Deletes", "the", "given", "security", "group" ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/securitygroup/delete.py#L13-L17
train
softlayer/softlayer-python
SoftLayer/CLI/globalip/create.py
cli
def cli(env, ipv6, test): """Creates a global IP.""" mgr = SoftLayer.NetworkManager(env.client) version = 4 if ipv6: version = 6 if not (test or env.skip_confirmations): if not formatting.confirm("This action will incur charges on your " "account....
python
def cli(env, ipv6, test): """Creates a global IP.""" mgr = SoftLayer.NetworkManager(env.client) version = 4 if ipv6: version = 6 if not (test or env.skip_confirmations): if not formatting.confirm("This action will incur charges on your " "account....
[ "def", "cli", "(", "env", ",", "ipv6", ",", "test", ")", ":", "mgr", "=", "SoftLayer", ".", "NetworkManager", "(", "env", ".", "client", ")", "version", "=", "4", "if", "ipv6", ":", "version", "=", "6", "if", "not", "(", "test", "or", "env", ".",...
Creates a global IP.
[ "Creates", "a", "global", "IP", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/globalip/create.py#L16-L44
train
softlayer/softlayer-python
SoftLayer/CLI/vpn/ipsec/translation/remove.py
cli
def cli(env, context_id, translation_id): """Remove a translation entry from an IPSEC tunnel context. A separate configuration request should be made to realize changes on network devices. """ manager = SoftLayer.IPSECManager(env.client) # ensure translation can be retrieved by given id man...
python
def cli(env, context_id, translation_id): """Remove a translation entry from an IPSEC tunnel context. A separate configuration request should be made to realize changes on network devices. """ manager = SoftLayer.IPSECManager(env.client) # ensure translation can be retrieved by given id man...
[ "def", "cli", "(", "env", ",", "context_id", ",", "translation_id", ")", ":", "manager", "=", "SoftLayer", ".", "IPSECManager", "(", "env", ".", "client", ")", "manager", ".", "get_translation", "(", "context_id", ",", "translation_id", ")", "succeeded", "="...
Remove a translation entry from an IPSEC tunnel context. A separate configuration request should be made to realize changes on network devices.
[ "Remove", "a", "translation", "entry", "from", "an", "IPSEC", "tunnel", "context", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/vpn/ipsec/translation/remove.py#L19-L33
train
softlayer/softlayer-python
SoftLayer/CLI/virt/list.py
cli
def cli(env, sortby, cpu, domain, datacenter, hostname, memory, network, hourly, monthly, tag, columns, limit): """List virtual servers.""" vsi = SoftLayer.VSManager(env.client) guests = vsi.list_instances(hourly=hourly, monthly=monthly, ...
python
def cli(env, sortby, cpu, domain, datacenter, hostname, memory, network, hourly, monthly, tag, columns, limit): """List virtual servers.""" vsi = SoftLayer.VSManager(env.client) guests = vsi.list_instances(hourly=hourly, monthly=monthly, ...
[ "def", "cli", "(", "env", ",", "sortby", ",", "cpu", ",", "domain", ",", "datacenter", ",", "hostname", ",", "memory", ",", "network", ",", "hourly", ",", "monthly", ",", "tag", ",", "columns", ",", "limit", ")", ":", "vsi", "=", "SoftLayer", ".", ...
List virtual servers.
[ "List", "virtual", "servers", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/list.py#L70-L93
train
softlayer/softlayer-python
SoftLayer/CLI/sshkey/remove.py
cli
def cli(env, identifier): """Permanently removes an SSH key.""" mgr = SoftLayer.SshKeyManager(env.client) key_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'SshKey') if not (env.skip_confirmations or formatting.no_going_back(key_id)): raise exceptions.CLIAbort('Aborted') mgr.delete_...
python
def cli(env, identifier): """Permanently removes an SSH key.""" mgr = SoftLayer.SshKeyManager(env.client) key_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'SshKey') if not (env.skip_confirmations or formatting.no_going_back(key_id)): raise exceptions.CLIAbort('Aborted') mgr.delete_...
[ "def", "cli", "(", "env", ",", "identifier", ")", ":", "mgr", "=", "SoftLayer", ".", "SshKeyManager", "(", "env", ".", "client", ")", "key_id", "=", "helpers", ".", "resolve_id", "(", "mgr", ".", "resolve_ids", ",", "identifier", ",", "'SshKey'", ")", ...
Permanently removes an SSH key.
[ "Permanently", "removes", "an", "SSH", "key", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/sshkey/remove.py#L16-L24
train
softlayer/softlayer-python
SoftLayer/CLI/formatting.py
format_output
def format_output(data, fmt='table'): # pylint: disable=R0911,R0912 """Given some data, will format it for console output. :param data: One of: String, Table, FormattedItem, List, Tuple, SequentialOutput :param string fmt (optional): One of: table, raw, json, python """ if isinsta...
python
def format_output(data, fmt='table'): # pylint: disable=R0911,R0912 """Given some data, will format it for console output. :param data: One of: String, Table, FormattedItem, List, Tuple, SequentialOutput :param string fmt (optional): One of: table, raw, json, python """ if isinsta...
[ "def", "format_output", "(", "data", ",", "fmt", "=", "'table'", ")", ":", "if", "isinstance", "(", "data", ",", "utils", ".", "string_types", ")", ":", "if", "fmt", "in", "(", "'json'", ",", "'jsonraw'", ")", ":", "return", "json", ".", "dumps", "("...
Given some data, will format it for console output. :param data: One of: String, Table, FormattedItem, List, Tuple, SequentialOutput :param string fmt (optional): One of: table, raw, json, python
[ "Given", "some", "data", "will", "format", "it", "for", "console", "output", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/formatting.py#L26-L76
train
softlayer/softlayer-python
SoftLayer/CLI/formatting.py
transaction_status
def transaction_status(transaction): """Returns a FormattedItem describing the given transaction. :param item: An object capable of having an active transaction """ if not transaction or not transaction.get('transactionStatus'): return blank() return FormattedItem( transaction[...
python
def transaction_status(transaction): """Returns a FormattedItem describing the given transaction. :param item: An object capable of having an active transaction """ if not transaction or not transaction.get('transactionStatus'): return blank() return FormattedItem( transaction[...
[ "def", "transaction_status", "(", "transaction", ")", ":", "if", "not", "transaction", "or", "not", "transaction", ".", "get", "(", "'transactionStatus'", ")", ":", "return", "blank", "(", ")", "return", "FormattedItem", "(", "transaction", "[", "'transactionSta...
Returns a FormattedItem describing the given transaction. :param item: An object capable of having an active transaction
[ "Returns", "a", "FormattedItem", "describing", "the", "given", "transaction", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/formatting.py#L162-L172
train
softlayer/softlayer-python
SoftLayer/CLI/formatting.py
tags
def tags(tag_references): """Returns a formatted list of tags.""" if not tag_references: return blank() tag_row = [] for tag_detail in tag_references: tag = utils.lookup(tag_detail, 'tag', 'name') if tag is not None: tag_row.append(tag) return listing(tag_row, s...
python
def tags(tag_references): """Returns a formatted list of tags.""" if not tag_references: return blank() tag_row = [] for tag_detail in tag_references: tag = utils.lookup(tag_detail, 'tag', 'name') if tag is not None: tag_row.append(tag) return listing(tag_row, s...
[ "def", "tags", "(", "tag_references", ")", ":", "if", "not", "tag_references", ":", "return", "blank", "(", ")", "tag_row", "=", "[", "]", "for", "tag_detail", "in", "tag_references", ":", "tag", "=", "utils", ".", "lookup", "(", "tag_detail", ",", "'tag...
Returns a formatted list of tags.
[ "Returns", "a", "formatted", "list", "of", "tags", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/formatting.py#L175-L186
train
softlayer/softlayer-python
SoftLayer/CLI/formatting.py
confirm
def confirm(prompt_str, default=False): """Show a confirmation prompt to a command-line user. :param string prompt_str: prompt to give to the user :param bool default: Default value to True or False """ if default: default_str = 'y' prompt = '%s [Y/n]' % prompt_str else: ...
python
def confirm(prompt_str, default=False): """Show a confirmation prompt to a command-line user. :param string prompt_str: prompt to give to the user :param bool default: Default value to True or False """ if default: default_str = 'y' prompt = '%s [Y/n]' % prompt_str else: ...
[ "def", "confirm", "(", "prompt_str", ",", "default", "=", "False", ")", ":", "if", "default", ":", "default_str", "=", "'y'", "prompt", "=", "'%s [Y/n]'", "%", "prompt_str", "else", ":", "default_str", "=", "'n'", "prompt", "=", "'%s [y/N]'", "%", "prompt_...
Show a confirmation prompt to a command-line user. :param string prompt_str: prompt to give to the user :param bool default: Default value to True or False
[ "Show", "a", "confirmation", "prompt", "to", "a", "command", "-", "line", "user", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/formatting.py#L189-L206
train
softlayer/softlayer-python
SoftLayer/CLI/formatting.py
no_going_back
def no_going_back(confirmation): """Show a confirmation to a user. :param confirmation str: the string the user has to enter in order to confirm their action. """ if not confirmation: confirmation = 'yes' prompt = ('This action cannot be undone! Type "%s" or pr...
python
def no_going_back(confirmation): """Show a confirmation to a user. :param confirmation str: the string the user has to enter in order to confirm their action. """ if not confirmation: confirmation = 'yes' prompt = ('This action cannot be undone! Type "%s" or pr...
[ "def", "no_going_back", "(", "confirmation", ")", ":", "if", "not", "confirmation", ":", "confirmation", "=", "'yes'", "prompt", "=", "(", "'This action cannot be undone! Type \"%s\" or press Enter '", "'to abort'", "%", "confirmation", ")", "ans", "=", "click", ".", ...
Show a confirmation to a user. :param confirmation str: the string the user has to enter in order to confirm their action.
[ "Show", "a", "confirmation", "to", "a", "user", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/formatting.py#L209-L225
train
softlayer/softlayer-python
SoftLayer/CLI/formatting.py
iter_to_table
def iter_to_table(value): """Convert raw API responses to response tables.""" if isinstance(value, list): return _format_list(value) if isinstance(value, dict): return _format_dict(value) return value
python
def iter_to_table(value): """Convert raw API responses to response tables.""" if isinstance(value, list): return _format_list(value) if isinstance(value, dict): return _format_dict(value) return value
[ "def", "iter_to_table", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "list", ")", ":", "return", "_format_list", "(", "value", ")", "if", "isinstance", "(", "value", ",", "dict", ")", ":", "return", "_format_dict", "(", "value", ")", ...
Convert raw API responses to response tables.
[ "Convert", "raw", "API", "responses", "to", "response", "tables", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/formatting.py#L390-L396
train
softlayer/softlayer-python
SoftLayer/CLI/formatting.py
_format_dict
def _format_dict(result): """Format dictionary responses into key-value table.""" table = KeyValueTable(['name', 'value']) table.align['name'] = 'r' table.align['value'] = 'l' for key, value in result.items(): value = iter_to_table(value) table.add_row([key, value]) return tab...
python
def _format_dict(result): """Format dictionary responses into key-value table.""" table = KeyValueTable(['name', 'value']) table.align['name'] = 'r' table.align['value'] = 'l' for key, value in result.items(): value = iter_to_table(value) table.add_row([key, value]) return tab...
[ "def", "_format_dict", "(", "result", ")", ":", "table", "=", "KeyValueTable", "(", "[", "'name'", ",", "'value'", "]", ")", "table", ".", "align", "[", "'name'", "]", "=", "'r'", "table", ".", "align", "[", "'value'", "]", "=", "'l'", "for", "key", ...
Format dictionary responses into key-value table.
[ "Format", "dictionary", "responses", "into", "key", "-", "value", "table", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/formatting.py#L399-L410
train
softlayer/softlayer-python
SoftLayer/CLI/formatting.py
_format_list
def _format_list(result): """Format list responses into a table.""" if not result: return result if isinstance(result[0], dict): return _format_list_objects(result) table = Table(['value']) for item in result: table.add_row([iter_to_table(item)]) return table
python
def _format_list(result): """Format list responses into a table.""" if not result: return result if isinstance(result[0], dict): return _format_list_objects(result) table = Table(['value']) for item in result: table.add_row([iter_to_table(item)]) return table
[ "def", "_format_list", "(", "result", ")", ":", "if", "not", "result", ":", "return", "result", "if", "isinstance", "(", "result", "[", "0", "]", ",", "dict", ")", ":", "return", "_format_list_objects", "(", "result", ")", "table", "=", "Table", "(", "...
Format list responses into a table.
[ "Format", "list", "responses", "into", "a", "table", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/formatting.py#L413-L425
train
softlayer/softlayer-python
SoftLayer/CLI/formatting.py
_format_list_objects
def _format_list_objects(result): """Format list of objects into a table.""" all_keys = set() for item in result: all_keys = all_keys.union(item.keys()) all_keys = sorted(all_keys) table = Table(all_keys) for item in result: values = [] for key in all_keys: ...
python
def _format_list_objects(result): """Format list of objects into a table.""" all_keys = set() for item in result: all_keys = all_keys.union(item.keys()) all_keys = sorted(all_keys) table = Table(all_keys) for item in result: values = [] for key in all_keys: ...
[ "def", "_format_list_objects", "(", "result", ")", ":", "all_keys", "=", "set", "(", ")", "for", "item", "in", "result", ":", "all_keys", "=", "all_keys", ".", "union", "(", "item", ".", "keys", "(", ")", ")", "all_keys", "=", "sorted", "(", "all_keys"...
Format list of objects into a table.
[ "Format", "list", "of", "objects", "into", "a", "table", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/formatting.py#L428-L446
train
softlayer/softlayer-python
SoftLayer/CLI/formatting.py
Table.to_python
def to_python(self): """Decode this Table object to standard Python types.""" # Adding rows items = [] for row in self.rows: formatted_row = [_format_python_value(v) for v in row] items.append(dict(zip(self.columns, formatted_row))) return items
python
def to_python(self): """Decode this Table object to standard Python types.""" # Adding rows items = [] for row in self.rows: formatted_row = [_format_python_value(v) for v in row] items.append(dict(zip(self.columns, formatted_row))) return items
[ "def", "to_python", "(", "self", ")", ":", "items", "=", "[", "]", "for", "row", "in", "self", ".", "rows", ":", "formatted_row", "=", "[", "_format_python_value", "(", "v", ")", "for", "v", "in", "row", "]", "items", ".", "append", "(", "dict", "(...
Decode this Table object to standard Python types.
[ "Decode", "this", "Table", "object", "to", "standard", "Python", "types", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/formatting.py#L285-L292
train
softlayer/softlayer-python
SoftLayer/CLI/formatting.py
Table.prettytable
def prettytable(self): """Returns a new prettytable instance.""" table = prettytable.PrettyTable(self.columns) if self.sortby: if self.sortby in self.columns: table.sortby = self.sortby else: msg = "Column (%s) doesn't exist to sort by" % ...
python
def prettytable(self): """Returns a new prettytable instance.""" table = prettytable.PrettyTable(self.columns) if self.sortby: if self.sortby in self.columns: table.sortby = self.sortby else: msg = "Column (%s) doesn't exist to sort by" % ...
[ "def", "prettytable", "(", "self", ")", ":", "table", "=", "prettytable", ".", "PrettyTable", "(", "self", ".", "columns", ")", "if", "self", ".", "sortby", ":", "if", "self", ".", "sortby", "in", "self", ".", "columns", ":", "table", ".", "sortby", ...
Returns a new prettytable instance.
[ "Returns", "a", "new", "prettytable", "instance", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/formatting.py#L294-L312
train
softlayer/softlayer-python
SoftLayer/CLI/formatting.py
KeyValueTable.to_python
def to_python(self): """Decode this KeyValueTable object to standard Python types.""" mapping = {} for row in self.rows: mapping[row[0]] = _format_python_value(row[1]) return mapping
python
def to_python(self): """Decode this KeyValueTable object to standard Python types.""" mapping = {} for row in self.rows: mapping[row[0]] = _format_python_value(row[1]) return mapping
[ "def", "to_python", "(", "self", ")", ":", "mapping", "=", "{", "}", "for", "row", "in", "self", ".", "rows", ":", "mapping", "[", "row", "[", "0", "]", "]", "=", "_format_python_value", "(", "row", "[", "1", "]", ")", "return", "mapping" ]
Decode this KeyValueTable object to standard Python types.
[ "Decode", "this", "KeyValueTable", "object", "to", "standard", "Python", "types", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/formatting.py#L318-L323
train
softlayer/softlayer-python
SoftLayer/CLI/user/create.py
cli
def cli(env, username, email, password, from_user, template, api_key): """Creates a user Users. :Example: slcli user create my@email.com -e my@email.com -p generate -a -t '{"firstName": "Test", "lastName": "Testerson"}' Remember to set the permissions and access for this new user. """ mgr = S...
python
def cli(env, username, email, password, from_user, template, api_key): """Creates a user Users. :Example: slcli user create my@email.com -e my@email.com -p generate -a -t '{"firstName": "Test", "lastName": "Testerson"}' Remember to set the permissions and access for this new user. """ mgr = S...
[ "def", "cli", "(", "env", ",", "username", ",", "email", ",", "password", ",", "from_user", ",", "template", ",", "api_key", ")", ":", "mgr", "=", "SoftLayer", ".", "UserManager", "(", "env", ".", "client", ")", "user_mask", "=", "(", "\"mask[id, firstNa...
Creates a user Users. :Example: slcli user create my@email.com -e my@email.com -p generate -a -t '{"firstName": "Test", "lastName": "Testerson"}' Remember to set the permissions and access for this new user.
[ "Creates", "a", "user", "Users", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/user/create.py#L34-L88
train
softlayer/softlayer-python
SoftLayer/CLI/user/create.py
generate_password
def generate_password(): """Returns a 23 character random string, with 3 special characters at the end""" if sys.version_info > (3, 6): import secrets # pylint: disable=import-error alphabet = string.ascii_letters + string.digits password = ''.join(secrets.choice(alphabet) for i in rang...
python
def generate_password(): """Returns a 23 character random string, with 3 special characters at the end""" if sys.version_info > (3, 6): import secrets # pylint: disable=import-error alphabet = string.ascii_letters + string.digits password = ''.join(secrets.choice(alphabet) for i in rang...
[ "def", "generate_password", "(", ")", ":", "if", "sys", ".", "version_info", ">", "(", "3", ",", "6", ")", ":", "import", "secrets", "alphabet", "=", "string", ".", "ascii_letters", "+", "string", ".", "digits", "password", "=", "''", ".", "join", "(",...
Returns a 23 character random string, with 3 special characters at the end
[ "Returns", "a", "23", "character", "random", "string", "with", "3", "special", "characters", "at", "the", "end" ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/user/create.py#L91-L100
train
softlayer/softlayer-python
SoftLayer/CLI/event_log/types.py
cli
def cli(env): """Get Event Log Types""" mgr = SoftLayer.EventLogManager(env.client) event_log_types = mgr.get_event_log_types() table = formatting.Table(COLUMNS) for event_log_type in event_log_types: table.add_row([event_log_type]) env.fout(table)
python
def cli(env): """Get Event Log Types""" mgr = SoftLayer.EventLogManager(env.client) event_log_types = mgr.get_event_log_types() table = formatting.Table(COLUMNS) for event_log_type in event_log_types: table.add_row([event_log_type]) env.fout(table)
[ "def", "cli", "(", "env", ")", ":", "mgr", "=", "SoftLayer", ".", "EventLogManager", "(", "env", ".", "client", ")", "event_log_types", "=", "mgr", ".", "get_event_log_types", "(", ")", "table", "=", "formatting", ".", "Table", "(", "COLUMNS", ")", "for"...
Get Event Log Types
[ "Get", "Event", "Log", "Types" ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/event_log/types.py#L15-L26
train
softlayer/softlayer-python
SoftLayer/managers/hardware.py
_get_extra_price_id
def _get_extra_price_id(items, key_name, hourly, location): """Returns a price id attached to item with the given key_name.""" for item in items: if utils.lookup(item, 'keyName') != key_name: continue for price in item['prices']: if not _matches_billing(price, hourly): ...
python
def _get_extra_price_id(items, key_name, hourly, location): """Returns a price id attached to item with the given key_name.""" for item in items: if utils.lookup(item, 'keyName') != key_name: continue for price in item['prices']: if not _matches_billing(price, hourly): ...
[ "def", "_get_extra_price_id", "(", "items", ",", "key_name", ",", "hourly", ",", "location", ")", ":", "for", "item", "in", "items", ":", "if", "utils", ".", "lookup", "(", "item", ",", "'keyName'", ")", "!=", "key_name", ":", "continue", "for", "price",...
Returns a price id attached to item with the given key_name.
[ "Returns", "a", "price", "id", "attached", "to", "item", "with", "the", "given", "key_name", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L668-L685
train
softlayer/softlayer-python
SoftLayer/managers/hardware.py
_get_default_price_id
def _get_default_price_id(items, option, hourly, location): """Returns a 'free' price id given an option.""" for item in items: if utils.lookup(item, 'itemCategory', 'categoryCode') != option: continue for price in item['prices']: if all([float(price.get('hourlyRecurrin...
python
def _get_default_price_id(items, option, hourly, location): """Returns a 'free' price id given an option.""" for item in items: if utils.lookup(item, 'itemCategory', 'categoryCode') != option: continue for price in item['prices']: if all([float(price.get('hourlyRecurrin...
[ "def", "_get_default_price_id", "(", "items", ",", "option", ",", "hourly", ",", "location", ")", ":", "for", "item", "in", "items", ":", "if", "utils", ".", "lookup", "(", "item", ",", "'itemCategory'", ",", "'categoryCode'", ")", "!=", "option", ":", "...
Returns a 'free' price id given an option.
[ "Returns", "a", "free", "price", "id", "given", "an", "option", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L688-L703
train
softlayer/softlayer-python
SoftLayer/managers/hardware.py
_get_bandwidth_price_id
def _get_bandwidth_price_id(items, hourly=True, no_public=False, location=None): """Choose a valid price id for bandwidth.""" # Prefer pay-for-use data transfer with hourly for item in items: capacity = float(item....
python
def _get_bandwidth_price_id(items, hourly=True, no_public=False, location=None): """Choose a valid price id for bandwidth.""" # Prefer pay-for-use data transfer with hourly for item in items: capacity = float(item....
[ "def", "_get_bandwidth_price_id", "(", "items", ",", "hourly", "=", "True", ",", "no_public", "=", "False", ",", "location", "=", "None", ")", ":", "for", "item", "in", "items", ":", "capacity", "=", "float", "(", "item", ".", "get", "(", "'capacity'", ...
Choose a valid price id for bandwidth.
[ "Choose", "a", "valid", "price", "id", "for", "bandwidth", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L706-L733
train
softlayer/softlayer-python
SoftLayer/managers/hardware.py
_get_os_price_id
def _get_os_price_id(items, os, location): """Returns the price id matching.""" for item in items: if any([utils.lookup(item, 'itemCategory', 'categoryCode') != 'os', utils.lookup(item, 'softwareDescr...
python
def _get_os_price_id(items, os, location): """Returns the price id matching.""" for item in items: if any([utils.lookup(item, 'itemCategory', 'categoryCode') != 'os', utils.lookup(item, 'softwareDescr...
[ "def", "_get_os_price_id", "(", "items", ",", "os", ",", "location", ")", ":", "for", "item", "in", "items", ":", "if", "any", "(", "[", "utils", ".", "lookup", "(", "item", ",", "'itemCategory'", ",", "'categoryCode'", ")", "!=", "'os'", ",", "utils",...
Returns the price id matching.
[ "Returns", "the", "price", "id", "matching", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L736-L755
train
softlayer/softlayer-python
SoftLayer/managers/hardware.py
_get_port_speed_price_id
def _get_port_speed_price_id(items, port_speed, no_public, location): """Choose a valid price id for port speed.""" for item in items: if utils.lookup(item, 'itemCategory', 'categoryCode') != 'port_speed': continue # Check for correct...
python
def _get_port_speed_price_id(items, port_speed, no_public, location): """Choose a valid price id for port speed.""" for item in items: if utils.lookup(item, 'itemCategory', 'categoryCode') != 'port_speed': continue # Check for correct...
[ "def", "_get_port_speed_price_id", "(", "items", ",", "port_speed", ",", "no_public", ",", "location", ")", ":", "for", "item", "in", "items", ":", "if", "utils", ".", "lookup", "(", "item", ",", "'itemCategory'", ",", "'categoryCode'", ")", "!=", "'port_spe...
Choose a valid price id for port speed.
[ "Choose", "a", "valid", "price", "id", "for", "port", "speed", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L758-L780
train
softlayer/softlayer-python
SoftLayer/managers/hardware.py
_matches_location
def _matches_location(price, location): """Return True if the price object matches the location.""" # the price has no location restriction if not price.get('locationGroupId'): return True # Check to see if any of the location groups match the location group # of this price object for g...
python
def _matches_location(price, location): """Return True if the price object matches the location.""" # the price has no location restriction if not price.get('locationGroupId'): return True # Check to see if any of the location groups match the location group # of this price object for g...
[ "def", "_matches_location", "(", "price", ",", "location", ")", ":", "if", "not", "price", ".", "get", "(", "'locationGroupId'", ")", ":", "return", "True", "for", "group", "in", "location", "[", "'location'", "]", "[", "'location'", "]", "[", "'priceGroup...
Return True if the price object matches the location.
[ "Return", "True", "if", "the", "price", "object", "matches", "the", "location", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L789-L801
train
softlayer/softlayer-python
SoftLayer/managers/hardware.py
_get_location
def _get_location(package, location): """Get the longer key with a short location name.""" for region in package['regions']: if region['location']['location']['name'] == location: return region raise SoftLayer.SoftLayerError("Could not find valid location for: '%s'" % location)
python
def _get_location(package, location): """Get the longer key with a short location name.""" for region in package['regions']: if region['location']['location']['name'] == location: return region raise SoftLayer.SoftLayerError("Could not find valid location for: '%s'" % location)
[ "def", "_get_location", "(", "package", ",", "location", ")", ":", "for", "region", "in", "package", "[", "'regions'", "]", ":", "if", "region", "[", "'location'", "]", "[", "'location'", "]", "[", "'name'", "]", "==", "location", ":", "return", "region"...
Get the longer key with a short location name.
[ "Get", "the", "longer", "key", "with", "a", "short", "location", "name", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L822-L828
train
softlayer/softlayer-python
SoftLayer/managers/hardware.py
_get_preset_id
def _get_preset_id(package, size): """Get the preset id given the keyName of the preset.""" for preset in package['activePresets'] + package['accountRestrictedActivePresets']: if preset['keyName'] == size or preset['id'] == size: return preset['id'] raise SoftLayer.SoftLayerError("Could...
python
def _get_preset_id(package, size): """Get the preset id given the keyName of the preset.""" for preset in package['activePresets'] + package['accountRestrictedActivePresets']: if preset['keyName'] == size or preset['id'] == size: return preset['id'] raise SoftLayer.SoftLayerError("Could...
[ "def", "_get_preset_id", "(", "package", ",", "size", ")", ":", "for", "preset", "in", "package", "[", "'activePresets'", "]", "+", "package", "[", "'accountRestrictedActivePresets'", "]", ":", "if", "preset", "[", "'keyName'", "]", "==", "size", "or", "pres...
Get the preset id given the keyName of the preset.
[ "Get", "the", "preset", "id", "given", "the", "keyName", "of", "the", "preset", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L831-L837
train
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager.cancel_hardware
def cancel_hardware(self, hardware_id, reason='unneeded', comment='', immediate=False): """Cancels the specified dedicated server. Example:: # Cancels hardware id 1234 result = mgr.cancel_hardware(hardware_id=1234) :param int hardware_id: The ID of the hardware to be c...
python
def cancel_hardware(self, hardware_id, reason='unneeded', comment='', immediate=False): """Cancels the specified dedicated server. Example:: # Cancels hardware id 1234 result = mgr.cancel_hardware(hardware_id=1234) :param int hardware_id: The ID of the hardware to be c...
[ "def", "cancel_hardware", "(", "self", ",", "hardware_id", ",", "reason", "=", "'unneeded'", ",", "comment", "=", "''", ",", "immediate", "=", "False", ")", ":", "reasons", "=", "self", ".", "get_cancellation_reasons", "(", ")", "cancel_reason", "=", "reason...
Cancels the specified dedicated server. Example:: # Cancels hardware id 1234 result = mgr.cancel_hardware(hardware_id=1234) :param int hardware_id: The ID of the hardware to be cancelled. :param string reason: The reason code for the cancellation. This should come from...
[ "Cancels", "the", "specified", "dedicated", "server", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L61-L112
train
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager.get_hardware
def get_hardware(self, hardware_id, **kwargs): """Get details about a hardware device. :param integer id: the hardware ID :returns: A dictionary containing a large amount of information about the specified server. Example:: object_mask = "mask[id,networkV...
python
def get_hardware(self, hardware_id, **kwargs): """Get details about a hardware device. :param integer id: the hardware ID :returns: A dictionary containing a large amount of information about the specified server. Example:: object_mask = "mask[id,networkV...
[ "def", "get_hardware", "(", "self", ",", "hardware_id", ",", "**", "kwargs", ")", ":", "if", "'mask'", "not", "in", "kwargs", ":", "kwargs", "[", "'mask'", "]", "=", "(", "'id,'", "'globalIdentifier,'", "'fullyQualifiedDomainName,'", "'hostname,'", "'domain,'", ...
Get details about a hardware device. :param integer id: the hardware ID :returns: A dictionary containing a large amount of information about the specified server. Example:: object_mask = "mask[id,networkVlans[vlanNumber]]" # Object masks are optional...
[ "Get", "details", "about", "a", "hardware", "device", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L204-L265
train
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager.reload
def reload(self, hardware_id, post_uri=None, ssh_keys=None): """Perform an OS reload of a server with its current configuration. :param integer hardware_id: the instance ID to reload :param string post_uri: The URI of the post-install script to run after reload ...
python
def reload(self, hardware_id, post_uri=None, ssh_keys=None): """Perform an OS reload of a server with its current configuration. :param integer hardware_id: the instance ID to reload :param string post_uri: The URI of the post-install script to run after reload ...
[ "def", "reload", "(", "self", ",", "hardware_id", ",", "post_uri", "=", "None", ",", "ssh_keys", "=", "None", ")", ":", "config", "=", "{", "}", "if", "post_uri", ":", "config", "[", "'customProvisionScriptUri'", "]", "=", "post_uri", "if", "ssh_keys", "...
Perform an OS reload of a server with its current configuration. :param integer hardware_id: the instance ID to reload :param string post_uri: The URI of the post-install script to run after reload :param list ssh_keys: The SSH keys to add to the root user
[ "Perform", "an", "OS", "reload", "of", "a", "server", "with", "its", "current", "configuration", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L267-L285
train
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager.change_port_speed
def change_port_speed(self, hardware_id, public, speed): """Allows you to change the port speed of a server's NICs. :param int hardware_id: The ID of the server :param bool public: Flag to indicate which interface to change. True (default) means the public interface....
python
def change_port_speed(self, hardware_id, public, speed): """Allows you to change the port speed of a server's NICs. :param int hardware_id: The ID of the server :param bool public: Flag to indicate which interface to change. True (default) means the public interface....
[ "def", "change_port_speed", "(", "self", ",", "hardware_id", ",", "public", ",", "speed", ")", ":", "if", "public", ":", "return", "self", ".", "client", ".", "call", "(", "'Hardware_Server'", ",", "'setPublicNetworkInterfaceSpeed'", ",", "speed", ",", "id", ...
Allows you to change the port speed of a server's NICs. :param int hardware_id: The ID of the server :param bool public: Flag to indicate which interface to change. True (default) means the public interface. False indicates the private interface. ...
[ "Allows", "you", "to", "change", "the", "port", "speed", "of", "a", "server", "s", "NICs", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L298-L324
train
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager.place_order
def place_order(self, **kwargs): """Places an order for a piece of hardware. See get_create_options() for valid arguments. :param string size: server size name or presetId :param string hostname: server hostname :param string domain: server domain name :param string loc...
python
def place_order(self, **kwargs): """Places an order for a piece of hardware. See get_create_options() for valid arguments. :param string size: server size name or presetId :param string hostname: server hostname :param string domain: server domain name :param string loc...
[ "def", "place_order", "(", "self", ",", "**", "kwargs", ")", ":", "create_options", "=", "self", ".", "_generate_create_dict", "(", "**", "kwargs", ")", "return", "self", ".", "client", "[", "'Product_Order'", "]", ".", "placeOrder", "(", "create_options", "...
Places an order for a piece of hardware. See get_create_options() for valid arguments. :param string size: server size name or presetId :param string hostname: server hostname :param string domain: server domain name :param string location: location (datacenter) name :p...
[ "Places", "an", "order", "for", "a", "piece", "of", "hardware", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L326-L347
train
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager.verify_order
def verify_order(self, **kwargs): """Verifies an order for a piece of hardware. See :func:`place_order` for a list of available options. """ create_options = self._generate_create_dict(**kwargs) return self.client['Product_Order'].verifyOrder(create_options)
python
def verify_order(self, **kwargs): """Verifies an order for a piece of hardware. See :func:`place_order` for a list of available options. """ create_options = self._generate_create_dict(**kwargs) return self.client['Product_Order'].verifyOrder(create_options)
[ "def", "verify_order", "(", "self", ",", "**", "kwargs", ")", ":", "create_options", "=", "self", ".", "_generate_create_dict", "(", "**", "kwargs", ")", "return", "self", ".", "client", "[", "'Product_Order'", "]", ".", "verifyOrder", "(", "create_options", ...
Verifies an order for a piece of hardware. See :func:`place_order` for a list of available options.
[ "Verifies", "an", "order", "for", "a", "piece", "of", "hardware", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L349-L355
train
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager.get_create_options
def get_create_options(self): """Returns valid options for ordering hardware.""" package = self._get_package() # Locations locations = [] for region in package['regions']: locations.append({ 'name': region['location']['location']['longName'], ...
python
def get_create_options(self): """Returns valid options for ordering hardware.""" package = self._get_package() # Locations locations = [] for region in package['regions']: locations.append({ 'name': region['location']['location']['longName'], ...
[ "def", "get_create_options", "(", "self", ")", ":", "package", "=", "self", ".", "_get_package", "(", ")", "locations", "=", "[", "]", "for", "region", "in", "package", "[", "'regions'", "]", ":", "locations", ".", "append", "(", "{", "'name'", ":", "r...
Returns valid options for ordering hardware.
[ "Returns", "valid", "options", "for", "ordering", "hardware", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L377-L435
train
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager._get_package
def _get_package(self): """Get the package related to simple hardware ordering.""" mask = ''' items[ keyName, capacity, description, attributes[id,attributeTypeKeyName], itemCategory[id,categoryCode], ...
python
def _get_package(self): """Get the package related to simple hardware ordering.""" mask = ''' items[ keyName, capacity, description, attributes[id,attributeTypeKeyName], itemCategory[id,categoryCode], ...
[ "def", "_get_package", "(", "self", ")", ":", "mask", "=", "package_keyname", "=", "'BARE_METAL_SERVER'", "package", "=", "self", ".", "ordering_manager", ".", "get_package_by_key", "(", "package_keyname", ",", "mask", "=", "mask", ")", "return", "package" ]
Get the package related to simple hardware ordering.
[ "Get", "the", "package", "related", "to", "simple", "hardware", "ordering", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L438-L457
train
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager._generate_create_dict
def _generate_create_dict(self, size=None, hostname=None, domain=None, location=None, os=None, port_speed=None, ...
python
def _generate_create_dict(self, size=None, hostname=None, domain=None, location=None, os=None, port_speed=None, ...
[ "def", "_generate_create_dict", "(", "self", ",", "size", "=", "None", ",", "hostname", "=", "None", ",", "domain", "=", "None", ",", "location", "=", "None", ",", "os", "=", "None", ",", "port_speed", "=", "None", ",", "ssh_keys", "=", "None", ",", ...
Translates arguments into a dictionary for creating a server.
[ "Translates", "arguments", "into", "a", "dictionary", "for", "creating", "a", "server", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L459-L523
train
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager._get_ids_from_hostname
def _get_ids_from_hostname(self, hostname): """Returns list of matching hardware IDs for a given hostname.""" results = self.list_hardware(hostname=hostname, mask="id") return [result['id'] for result in results]
python
def _get_ids_from_hostname(self, hostname): """Returns list of matching hardware IDs for a given hostname.""" results = self.list_hardware(hostname=hostname, mask="id") return [result['id'] for result in results]
[ "def", "_get_ids_from_hostname", "(", "self", ",", "hostname", ")", ":", "results", "=", "self", ".", "list_hardware", "(", "hostname", "=", "hostname", ",", "mask", "=", "\"id\"", ")", "return", "[", "result", "[", "'id'", "]", "for", "result", "in", "r...
Returns list of matching hardware IDs for a given hostname.
[ "Returns", "list", "of", "matching", "hardware", "IDs", "for", "a", "given", "hostname", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L525-L528
train
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager._get_ids_from_ip
def _get_ids_from_ip(self, ip): # pylint: disable=inconsistent-return-statements """Returns list of matching hardware IDs for a given ip address.""" try: # Does it look like an ip address? socket.inet_aton(ip) except socket.error: return [] # Find th...
python
def _get_ids_from_ip(self, ip): # pylint: disable=inconsistent-return-statements """Returns list of matching hardware IDs for a given ip address.""" try: # Does it look like an ip address? socket.inet_aton(ip) except socket.error: return [] # Find th...
[ "def", "_get_ids_from_ip", "(", "self", ",", "ip", ")", ":", "try", ":", "socket", ".", "inet_aton", "(", "ip", ")", "except", "socket", ".", "error", ":", "return", "[", "]", "results", "=", "self", ".", "list_hardware", "(", "public_ip", "=", "ip", ...
Returns list of matching hardware IDs for a given ip address.
[ "Returns", "list", "of", "matching", "hardware", "IDs", "for", "a", "given", "ip", "address", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L530-L545
train
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager.edit
def edit(self, hardware_id, userdata=None, hostname=None, domain=None, notes=None, tags=None): """Edit hostname, domain name, notes, user data of the hardware. Parameters set to None will be ignored and not attempted to be updated. :param integer hardware_id: the instance ID to ed...
python
def edit(self, hardware_id, userdata=None, hostname=None, domain=None, notes=None, tags=None): """Edit hostname, domain name, notes, user data of the hardware. Parameters set to None will be ignored and not attempted to be updated. :param integer hardware_id: the instance ID to ed...
[ "def", "edit", "(", "self", ",", "hardware_id", ",", "userdata", "=", "None", ",", "hostname", "=", "None", ",", "domain", "=", "None", ",", "notes", "=", "None", ",", "tags", "=", "None", ")", ":", "obj", "=", "{", "}", "if", "userdata", ":", "s...
Edit hostname, domain name, notes, user data of the hardware. Parameters set to None will be ignored and not attempted to be updated. :param integer hardware_id: the instance ID to edit :param string userdata: user data on the hardware to edit. If none exist it ...
[ "Edit", "hostname", "domain", "name", "notes", "user", "data", "of", "the", "hardware", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L547-L588
train
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager.update_firmware
def update_firmware(self, hardware_id, ipmi=True, raid_controller=True, bios=True, hard_drive=True): """Update hardware firmware. This will cause the server to be unavailable for ~20 ...
python
def update_firmware(self, hardware_id, ipmi=True, raid_controller=True, bios=True, hard_drive=True): """Update hardware firmware. This will cause the server to be unavailable for ~20 ...
[ "def", "update_firmware", "(", "self", ",", "hardware_id", ",", "ipmi", "=", "True", ",", "raid_controller", "=", "True", ",", "bios", "=", "True", ",", "hard_drive", "=", "True", ")", ":", "return", "self", ".", "hardware", ".", "createFirmwareUpdateTransac...
Update hardware firmware. This will cause the server to be unavailable for ~20 minutes. :param int hardware_id: The ID of the hardware to have its firmware updated. :param bool ipmi: Update the ipmi firmware. :param bool raid_controller: Update the raid ...
[ "Update", "hardware", "firmware", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L590-L614
train
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager.reflash_firmware
def reflash_firmware(self, hardware_id, ipmi=True, raid_controller=True, bios=True): """Reflash hardware firmware. This will cause the server to be unavailable for ~60 minutes. The firmware will ...
python
def reflash_firmware(self, hardware_id, ipmi=True, raid_controller=True, bios=True): """Reflash hardware firmware. This will cause the server to be unavailable for ~60 minutes. The firmware will ...
[ "def", "reflash_firmware", "(", "self", ",", "hardware_id", ",", "ipmi", "=", "True", ",", "raid_controller", "=", "True", ",", "bios", "=", "True", ")", ":", "return", "self", ".", "hardware", ".", "createFirmwareReflashTransaction", "(", "bool", "(", "ipmi...
Reflash hardware firmware. This will cause the server to be unavailable for ~60 minutes. The firmware will not be upgraded but rather reflashed to the version installed. :param int hardware_id: The ID of the hardware to have its firmware reflashed. :para...
[ "Reflash", "hardware", "firmware", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L616-L639
train
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager.wait_for_ready
def wait_for_ready(self, instance_id, limit=14400, delay=10, pending=False): """Determine if a Server is ready. A server is ready when no transactions are running on it. :param int instance_id: The instance ID with the pending transaction :param int limit: The maximum amount of seconds...
python
def wait_for_ready(self, instance_id, limit=14400, delay=10, pending=False): """Determine if a Server is ready. A server is ready when no transactions are running on it. :param int instance_id: The instance ID with the pending transaction :param int limit: The maximum amount of seconds...
[ "def", "wait_for_ready", "(", "self", ",", "instance_id", ",", "limit", "=", "14400", ",", "delay", "=", "10", ",", "pending", "=", "False", ")", ":", "now", "=", "time", ".", "time", "(", ")", "until", "=", "now", "+", "limit", "mask", "=", "\"mas...
Determine if a Server is ready. A server is ready when no transactions are running on it. :param int instance_id: The instance ID with the pending transaction :param int limit: The maximum amount of seconds to wait. :param int delay: The number of seconds to sleep before checks. Defaul...
[ "Determine", "if", "a", "Server", "is", "ready", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L641-L665
train
softlayer/softlayer-python
SoftLayer/CLI/hardware/cancel.py
cli
def cli(env, identifier, immediate, comment, reason): """Cancel a dedicated server.""" mgr = SoftLayer.HardwareManager(env.client) hw_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'hardware') if not (env.skip_confirmations or formatting.no_going_back(hw_id)): raise exceptions.CLIAbort('...
python
def cli(env, identifier, immediate, comment, reason): """Cancel a dedicated server.""" mgr = SoftLayer.HardwareManager(env.client) hw_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'hardware') if not (env.skip_confirmations or formatting.no_going_back(hw_id)): raise exceptions.CLIAbort('...
[ "def", "cli", "(", "env", ",", "identifier", ",", "immediate", ",", "comment", ",", "reason", ")", ":", "mgr", "=", "SoftLayer", ".", "HardwareManager", "(", "env", ".", "client", ")", "hw_id", "=", "helpers", ".", "resolve_id", "(", "mgr", ".", "resol...
Cancel a dedicated server.
[ "Cancel", "a", "dedicated", "server", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/hardware/cancel.py#L24-L33
train
softlayer/softlayer-python
SoftLayer/CLI/virt/reload.py
cli
def cli(env, identifier, postinstall, key, image): """Reload operating system on a virtual server.""" vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') keys = [] if key: for single_key in key: resolver = SoftLayer.SshKeyManager(e...
python
def cli(env, identifier, postinstall, key, image): """Reload operating system on a virtual server.""" vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') keys = [] if key: for single_key in key: resolver = SoftLayer.SshKeyManager(e...
[ "def", "cli", "(", "env", ",", "identifier", ",", "postinstall", ",", "key", ",", "image", ")", ":", "vsi", "=", "SoftLayer", ".", "VSManager", "(", "env", ".", "client", ")", "vs_id", "=", "helpers", ".", "resolve_id", "(", "vsi", ".", "resolve_ids", ...
Reload operating system on a virtual server.
[ "Reload", "operating", "system", "on", "a", "virtual", "server", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/reload.py#L23-L40
train
softlayer/softlayer-python
SoftLayer/CLI/virt/capacity/detail.py
cli
def cli(env, identifier, columns): """Reserved Capacity Group details. Will show which guests are assigned to a reservation.""" manager = CapacityManager(env.client) mask = """mask[instances[id,createDate,guestId,billingItem[id, description, recurringFee, category[name]], guest[modifyDate,id,...
python
def cli(env, identifier, columns): """Reserved Capacity Group details. Will show which guests are assigned to a reservation.""" manager = CapacityManager(env.client) mask = """mask[instances[id,createDate,guestId,billingItem[id, description, recurringFee, category[name]], guest[modifyDate,id,...
[ "def", "cli", "(", "env", ",", "identifier", ",", "columns", ")", ":", "manager", "=", "CapacityManager", "(", "env", ".", "client", ")", "mask", "=", "result", "=", "manager", ".", "get_object", "(", "identifier", ",", "mask", ")", "try", ":", "flavor...
Reserved Capacity Group details. Will show which guests are assigned to a reservation.
[ "Reserved", "Capacity", "Group", "details", ".", "Will", "show", "which", "guests", "are", "assigned", "to", "a", "reservation", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/capacity/detail.py#L36-L57
train
softlayer/softlayer-python
SoftLayer/config.py
get_client_settings_args
def get_client_settings_args(**kwargs): """Retrieve client settings from user-supplied arguments. :param \\*\\*kwargs: Arguments that are passed into the client instance """ timeout = kwargs.get('timeout') if timeout is not None: timeout = float(timeout) return { 'endpoint_...
python
def get_client_settings_args(**kwargs): """Retrieve client settings from user-supplied arguments. :param \\*\\*kwargs: Arguments that are passed into the client instance """ timeout = kwargs.get('timeout') if timeout is not None: timeout = float(timeout) return { 'endpoint_...
[ "def", "get_client_settings_args", "(", "**", "kwargs", ")", ":", "timeout", "=", "kwargs", ".", "get", "(", "'timeout'", ")", "if", "timeout", "is", "not", "None", ":", "timeout", "=", "float", "(", "timeout", ")", "return", "{", "'endpoint_url'", ":", ...
Retrieve client settings from user-supplied arguments. :param \\*\\*kwargs: Arguments that are passed into the client instance
[ "Retrieve", "client", "settings", "from", "user", "-", "supplied", "arguments", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/config.py#L14-L29
train
softlayer/softlayer-python
SoftLayer/config.py
get_client_settings_env
def get_client_settings_env(**_): """Retrieve client settings from environment settings. :param \\*\\*kwargs: Arguments that are passed into the client instance """ return { 'proxy': os.environ.get('https_proxy'), 'username': os.environ.get('SL_USERNAME'), 'api_key': os.env...
python
def get_client_settings_env(**_): """Retrieve client settings from environment settings. :param \\*\\*kwargs: Arguments that are passed into the client instance """ return { 'proxy': os.environ.get('https_proxy'), 'username': os.environ.get('SL_USERNAME'), 'api_key': os.env...
[ "def", "get_client_settings_env", "(", "**", "_", ")", ":", "return", "{", "'proxy'", ":", "os", ".", "environ", ".", "get", "(", "'https_proxy'", ")", ",", "'username'", ":", "os", ".", "environ", ".", "get", "(", "'SL_USERNAME'", ")", ",", "'api_key'",...
Retrieve client settings from environment settings. :param \\*\\*kwargs: Arguments that are passed into the client instance
[ "Retrieve", "client", "settings", "from", "environment", "settings", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/config.py#L32-L42
train
softlayer/softlayer-python
SoftLayer/config.py
get_client_settings_config_file
def get_client_settings_config_file(**kwargs): # pylint: disable=inconsistent-return-statements """Retrieve client settings from the possible config file locations. :param \\*\\*kwargs: Arguments that are passed into the client instance """ config_files = ['/etc/softlayer.conf', '~/.softlayer'] ...
python
def get_client_settings_config_file(**kwargs): # pylint: disable=inconsistent-return-statements """Retrieve client settings from the possible config file locations. :param \\*\\*kwargs: Arguments that are passed into the client instance """ config_files = ['/etc/softlayer.conf', '~/.softlayer'] ...
[ "def", "get_client_settings_config_file", "(", "**", "kwargs", ")", ":", "config_files", "=", "[", "'/etc/softlayer.conf'", ",", "'~/.softlayer'", "]", "if", "kwargs", ".", "get", "(", "'config_file'", ")", ":", "config_files", ".", "append", "(", "kwargs", ".",...
Retrieve client settings from the possible config file locations. :param \\*\\*kwargs: Arguments that are passed into the client instance
[ "Retrieve", "client", "settings", "from", "the", "possible", "config", "file", "locations", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/config.py#L45-L70
train
softlayer/softlayer-python
SoftLayer/config.py
get_client_settings
def get_client_settings(**kwargs): """Parse client settings. Parses settings from various input methods, preferring earlier values to later ones. The settings currently come from explicit user arguments, environmental variables and config files. :param \\*\\*kwargs: Arguments that are passed i...
python
def get_client_settings(**kwargs): """Parse client settings. Parses settings from various input methods, preferring earlier values to later ones. The settings currently come from explicit user arguments, environmental variables and config files. :param \\*\\*kwargs: Arguments that are passed i...
[ "def", "get_client_settings", "(", "**", "kwargs", ")", ":", "all_settings", "=", "{", "}", "for", "setting_method", "in", "SETTING_RESOLVERS", ":", "settings", "=", "setting_method", "(", "**", "kwargs", ")", "if", "settings", ":", "settings", ".", "update", ...
Parse client settings. Parses settings from various input methods, preferring earlier values to later ones. The settings currently come from explicit user arguments, environmental variables and config files. :param \\*\\*kwargs: Arguments that are passed into the client instance
[ "Parse", "client", "settings", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/config.py#L78-L94
train
softlayer/softlayer-python
SoftLayer/CLI/order/category_list.py
cli
def cli(env, package_keyname, required): """List the categories of a package. :: # List the categories of Bare Metal servers slcli order category-list BARE_METAL_SERVER # List the required categories for Bare Metal servers slcli order category-list BARE_METAL_SERVER --required...
python
def cli(env, package_keyname, required): """List the categories of a package. :: # List the categories of Bare Metal servers slcli order category-list BARE_METAL_SERVER # List the required categories for Bare Metal servers slcli order category-list BARE_METAL_SERVER --required...
[ "def", "cli", "(", "env", ",", "package_keyname", ",", "required", ")", ":", "client", "=", "env", ".", "client", "manager", "=", "ordering", ".", "OrderingManager", "(", "client", ")", "table", "=", "formatting", ".", "Table", "(", "COLUMNS", ")", "cate...
List the categories of a package. :: # List the categories of Bare Metal servers slcli order category-list BARE_METAL_SERVER # List the required categories for Bare Metal servers slcli order category-list BARE_METAL_SERVER --required
[ "List", "the", "categories", "of", "a", "package", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/order/category_list.py#L19-L47
train
softlayer/softlayer-python
SoftLayer/managers/ssl.py
SSLManager.list_certs
def list_certs(self, method='all'): """List all certificates. :param string method: The type of certificates to list. Options are 'all', 'expired', and 'valid'. :returns: A list of dictionaries representing the requested SSL certs. Example:: #...
python
def list_certs(self, method='all'): """List all certificates. :param string method: The type of certificates to list. Options are 'all', 'expired', and 'valid'. :returns: A list of dictionaries representing the requested SSL certs. Example:: #...
[ "def", "list_certs", "(", "self", ",", "method", "=", "'all'", ")", ":", "ssl", "=", "self", ".", "client", "[", "'Account'", "]", "methods", "=", "{", "'all'", ":", "'getSecurityCertificates'", ",", "'expired'", ":", "'getExpiredSecurityCertificates'", ",", ...
List all certificates. :param string method: The type of certificates to list. Options are 'all', 'expired', and 'valid'. :returns: A list of dictionaries representing the requested SSL certs. Example:: # Get all valid SSL certs certs = mg...
[ "List", "all", "certificates", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/ssl.py#L34-L57
train
softlayer/softlayer-python
SoftLayer/CLI/dns/zone_list.py
cli
def cli(env): """List all zones.""" manager = SoftLayer.DNSManager(env.client) zones = manager.list_zones() table = formatting.Table(['id', 'zone', 'serial', 'updated']) table.align['serial'] = 'c' table.align['updated'] = 'c' for zone in zones: table.add_row([ zone['id...
python
def cli(env): """List all zones.""" manager = SoftLayer.DNSManager(env.client) zones = manager.list_zones() table = formatting.Table(['id', 'zone', 'serial', 'updated']) table.align['serial'] = 'c' table.align['updated'] = 'c' for zone in zones: table.add_row([ zone['id...
[ "def", "cli", "(", "env", ")", ":", "manager", "=", "SoftLayer", ".", "DNSManager", "(", "env", ".", "client", ")", "zones", "=", "manager", ".", "list_zones", "(", ")", "table", "=", "formatting", ".", "Table", "(", "[", "'id'", ",", "'zone'", ",", ...
List all zones.
[ "List", "all", "zones", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/dns/zone_list.py#L13-L30
train
softlayer/softlayer-python
SoftLayer/managers/file.py
FileStorageManager.list_file_volumes
def list_file_volumes(self, datacenter=None, username=None, storage_type=None, **kwargs): """Returns a list of file volumes. :param datacenter: Datacenter short name (e.g.: dal09) :param username: Name of volume. :param storage_type: Type of volume: Endurance o...
python
def list_file_volumes(self, datacenter=None, username=None, storage_type=None, **kwargs): """Returns a list of file volumes. :param datacenter: Datacenter short name (e.g.: dal09) :param username: Name of volume. :param storage_type: Type of volume: Endurance o...
[ "def", "list_file_volumes", "(", "self", ",", "datacenter", "=", "None", ",", "username", "=", "None", ",", "storage_type", "=", "None", ",", "**", "kwargs", ")", ":", "if", "'mask'", "not", "in", "kwargs", ":", "items", "=", "[", "'id'", ",", "'userna...
Returns a list of file volumes. :param datacenter: Datacenter short name (e.g.: dal09) :param username: Name of volume. :param storage_type: Type of volume: Endurance or Performance :param kwargs: :return: Returns a list of file volumes.
[ "Returns", "a", "list", "of", "file", "volumes", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/file.py#L22-L66
train
softlayer/softlayer-python
SoftLayer/managers/file.py
FileStorageManager.get_file_volume_details
def get_file_volume_details(self, volume_id, **kwargs): """Returns details about the specified volume. :param volume_id: ID of volume. :param kwargs: :return: Returns details about the specified volume. """ if 'mask' not in kwargs: items = [ ...
python
def get_file_volume_details(self, volume_id, **kwargs): """Returns details about the specified volume. :param volume_id: ID of volume. :param kwargs: :return: Returns details about the specified volume. """ if 'mask' not in kwargs: items = [ ...
[ "def", "get_file_volume_details", "(", "self", ",", "volume_id", ",", "**", "kwargs", ")", ":", "if", "'mask'", "not", "in", "kwargs", ":", "items", "=", "[", "'id'", ",", "'username'", ",", "'password'", ",", "'capacityGb'", ",", "'bytesUsed'", ",", "'sna...
Returns details about the specified volume. :param volume_id: ID of volume. :param kwargs: :return: Returns details about the specified volume.
[ "Returns", "details", "about", "the", "specified", "volume", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/file.py#L68-L106
train
softlayer/softlayer-python
SoftLayer/managers/file.py
FileStorageManager.order_replicant_volume
def order_replicant_volume(self, volume_id, snapshot_schedule, location, tier=None): """Places an order for a replicant file volume. :param volume_id: The ID of the primary volume to be replicated :param snapshot_schedule: The primary volume's snapshot ...
python
def order_replicant_volume(self, volume_id, snapshot_schedule, location, tier=None): """Places an order for a replicant file volume. :param volume_id: The ID of the primary volume to be replicated :param snapshot_schedule: The primary volume's snapshot ...
[ "def", "order_replicant_volume", "(", "self", ",", "volume_id", ",", "snapshot_schedule", ",", "location", ",", "tier", "=", "None", ")", ":", "file_mask", "=", "'billingItem[activeChildren,hourlyFlag],'", "'storageTierLevel,osType,staasVersion,'", "'hasEncryptionAtRest,snaps...
Places an order for a replicant file 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", "file", "volume", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/file.py#L205-L229
train
softlayer/softlayer-python
SoftLayer/managers/file.py
FileStorageManager.order_duplicate_volume
def order_duplicate_volume(self, origin_volume_id, origin_snapshot_id=None, duplicate_size=None, duplicate_iops=None, duplicate_tier_level=None, duplicate_snapshot_size=None, hourly_billing_flag=F...
python
def order_duplicate_volume(self, origin_volume_id, origin_snapshot_id=None, duplicate_size=None, duplicate_iops=None, duplicate_tier_level=None, duplicate_snapshot_size=None, hourly_billing_flag=F...
[ "def", "order_duplicate_volume", "(", "self", ",", "origin_volume_id", ",", "origin_snapshot_id", "=", "None", ",", "duplicate_size", "=", "None", ",", "duplicate_iops", "=", "None", ",", "duplicate_tier_level", "=", "None", ",", "duplicate_snapshot_size", "=", "Non...
Places an order for a duplicate file volume. :param origin_volume_id: The ID of the origin volume to be duplicated :param origin_snapshot_id: Origin snapshot ID to use for duplication :param duplicate_size: Size/capacity for the duplicate volume :param duplicate_iops: The IOPS per GB fo...
[ "Places", "an", "order", "for", "a", "duplicate", "file", "volume", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/file.py#L251-L285
train
softlayer/softlayer-python
SoftLayer/managers/file.py
FileStorageManager.order_modified_volume
def order_modified_volume(self, volume_id, new_size=None, new_iops=None, new_tier_level=None): """Places an order for modifying an existing file volume. :param volume_id: The ID of the volume to be modified :param new_size: The new size/capacity for the volume :param new_iops: The new I...
python
def order_modified_volume(self, volume_id, new_size=None, new_iops=None, new_tier_level=None): """Places an order for modifying an existing file volume. :param volume_id: The ID of the volume to be modified :param new_size: The new size/capacity for the volume :param new_iops: The new I...
[ "def", "order_modified_volume", "(", "self", ",", "volume_id", ",", "new_size", "=", "None", ",", "new_iops", "=", "None", ",", "new_tier_level", "=", "None", ")", ":", "mask_items", "=", "[", "'id'", ",", "'billingItem'", ",", "'storageType[keyName]'", ",", ...
Places an order for modifying an existing file volume. :param volume_id: The ID of the volume to be modified :param new_size: The new size/capacity for the volume :param new_iops: The new IOPS for the volume :param new_tier_level: The new tier level for the volume :return: Retur...
[ "Places", "an", "order", "for", "modifying", "an", "existing", "file", "volume", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/file.py#L287-L314
train
softlayer/softlayer-python
SoftLayer/managers/file.py
FileStorageManager.order_snapshot_space
def order_snapshot_space(self, volume_id, capacity, tier, upgrade, **kwargs): """Orders snapshot space for the given file volume. :param integer volume_id: The ID of the volume :param integer capacity: The capacity to order, in GB :param float tier: The tier level of the file volume, in...
python
def order_snapshot_space(self, volume_id, capacity, tier, upgrade, **kwargs): """Orders snapshot space for the given file volume. :param integer volume_id: The ID of the volume :param integer capacity: The capacity to order, in GB :param float tier: The tier level of the file volume, in...
[ "def", "order_snapshot_space", "(", "self", ",", "volume_id", ",", "capacity", ",", "tier", ",", "upgrade", ",", "**", "kwargs", ")", ":", "file_mask", "=", "'id,billingItem[location,hourlyFlag],'", "'storageType[keyName],storageTierLevel,provisionedIops,'", "'staasVersion,...
Orders snapshot space for the given file volume. :param integer volume_id: The ID of the volume :param integer capacity: The capacity to order, in GB :param float tier: The tier level of the file volume, in IOPS per GB :param boolean upgrade: Flag to indicate if this order is an upgrade...
[ "Orders", "snapshot", "space", "for", "the", "given", "file", "volume", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/file.py#L406-L425
train
softlayer/softlayer-python
SoftLayer/CLI/dns/zone_print.py
cli
def cli(env, zone): """Print zone in BIND format.""" manager = SoftLayer.DNSManager(env.client) zone_id = helpers.resolve_id(manager.resolve_ids, zone, name='zone') env.fout(manager.dump_zone(zone_id))
python
def cli(env, zone): """Print zone in BIND format.""" manager = SoftLayer.DNSManager(env.client) zone_id = helpers.resolve_id(manager.resolve_ids, zone, name='zone') env.fout(manager.dump_zone(zone_id))
[ "def", "cli", "(", "env", ",", "zone", ")", ":", "manager", "=", "SoftLayer", ".", "DNSManager", "(", "env", ".", "client", ")", "zone_id", "=", "helpers", ".", "resolve_id", "(", "manager", ".", "resolve_ids", ",", "zone", ",", "name", "=", "'zone'", ...
Print zone in BIND format.
[ "Print", "zone", "in", "BIND", "format", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/dns/zone_print.py#L14-L19
train
softlayer/softlayer-python
SoftLayer/CLI/virt/power.py
rescue
def rescue(env, identifier): """Reboot into a rescue image.""" vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') if not (env.skip_confirmations or formatting.confirm("This action will reboot this VSI. Continue?")): raise exceptions.C...
python
def rescue(env, identifier): """Reboot into a rescue image.""" vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') if not (env.skip_confirmations or formatting.confirm("This action will reboot this VSI. Continue?")): raise exceptions.C...
[ "def", "rescue", "(", "env", ",", "identifier", ")", ":", "vsi", "=", "SoftLayer", ".", "VSManager", "(", "env", ".", "client", ")", "vs_id", "=", "helpers", ".", "resolve_id", "(", "vsi", ".", "resolve_ids", ",", "identifier", ",", "'VS'", ")", "if", ...
Reboot into a rescue image.
[ "Reboot", "into", "a", "rescue", "image", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/power.py#L16-L25
train
softlayer/softlayer-python
SoftLayer/CLI/virt/power.py
reboot
def reboot(env, identifier, hard): """Reboot an active virtual server.""" virtual_guest = env.client['Virtual_Guest'] mgr = SoftLayer.HardwareManager(env.client) vs_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'VS') if not (env.skip_confirmations or formatting.confirm('This will...
python
def reboot(env, identifier, hard): """Reboot an active virtual server.""" virtual_guest = env.client['Virtual_Guest'] mgr = SoftLayer.HardwareManager(env.client) vs_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'VS') if not (env.skip_confirmations or formatting.confirm('This will...
[ "def", "reboot", "(", "env", ",", "identifier", ",", "hard", ")", ":", "virtual_guest", "=", "env", ".", "client", "[", "'Virtual_Guest'", "]", "mgr", "=", "SoftLayer", ".", "HardwareManager", "(", "env", ".", "client", ")", "vs_id", "=", "helpers", ".",...
Reboot an active virtual server.
[ "Reboot", "an", "active", "virtual", "server", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/power.py#L34-L50
train
softlayer/softlayer-python
SoftLayer/CLI/virt/power.py
power_off
def power_off(env, identifier, hard): """Power off an active virtual server.""" virtual_guest = env.client['Virtual_Guest'] vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') if not (env.skip_confirmations or formatting.confirm('This will...
python
def power_off(env, identifier, hard): """Power off an active virtual server.""" virtual_guest = env.client['Virtual_Guest'] vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') if not (env.skip_confirmations or formatting.confirm('This will...
[ "def", "power_off", "(", "env", ",", "identifier", ",", "hard", ")", ":", "virtual_guest", "=", "env", ".", "client", "[", "'Virtual_Guest'", "]", "vsi", "=", "SoftLayer", ".", "VSManager", "(", "env", ".", "client", ")", "vs_id", "=", "helpers", ".", ...
Power off an active virtual server.
[ "Power", "off", "an", "active", "virtual", "server", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/power.py#L57-L71
train
softlayer/softlayer-python
SoftLayer/CLI/virt/power.py
power_on
def power_on(env, identifier): """Power on a virtual server.""" vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') env.client['Virtual_Guest'].powerOn(id=vs_id)
python
def power_on(env, identifier): """Power on a virtual server.""" vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') env.client['Virtual_Guest'].powerOn(id=vs_id)
[ "def", "power_on", "(", "env", ",", "identifier", ")", ":", "vsi", "=", "SoftLayer", ".", "VSManager", "(", "env", ".", "client", ")", "vs_id", "=", "helpers", ".", "resolve_id", "(", "vsi", ".", "resolve_ids", ",", "identifier", ",", "'VS'", ")", "env...
Power on a virtual server.
[ "Power", "on", "a", "virtual", "server", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/power.py#L77-L82
train
softlayer/softlayer-python
SoftLayer/CLI/virt/power.py
pause
def pause(env, identifier): """Pauses an active virtual server.""" vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') if not (env.skip_confirmations or formatting.confirm('This will pause the VS with id %s. Continue?' ...
python
def pause(env, identifier): """Pauses an active virtual server.""" vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') if not (env.skip_confirmations or formatting.confirm('This will pause the VS with id %s. Continue?' ...
[ "def", "pause", "(", "env", ",", "identifier", ")", ":", "vsi", "=", "SoftLayer", ".", "VSManager", "(", "env", ".", "client", ")", "vs_id", "=", "helpers", ".", "resolve_id", "(", "vsi", ".", "resolve_ids", ",", "identifier", ",", "'VS'", ")", "if", ...
Pauses an active virtual server.
[ "Pauses", "an", "active", "virtual", "server", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/power.py#L88-L99
train
softlayer/softlayer-python
SoftLayer/CLI/virt/power.py
resume
def resume(env, identifier): """Resumes a paused virtual server.""" vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') env.client['Virtual_Guest'].resume(id=vs_id)
python
def resume(env, identifier): """Resumes a paused virtual server.""" vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') env.client['Virtual_Guest'].resume(id=vs_id)
[ "def", "resume", "(", "env", ",", "identifier", ")", ":", "vsi", "=", "SoftLayer", ".", "VSManager", "(", "env", ".", "client", ")", "vs_id", "=", "helpers", ".", "resolve_id", "(", "vsi", ".", "resolve_ids", ",", "identifier", ",", "'VS'", ")", "env",...
Resumes a paused virtual server.
[ "Resumes", "a", "paused", "virtual", "server", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/power.py#L105-L110
train
softlayer/softlayer-python
SoftLayer/CLI/account/summary.py
cli
def cli(env): """Prints some various bits of information about an account""" manager = AccountManager(env.client) summary = manager.get_summary() env.fout(get_snapshot_table(summary))
python
def cli(env): """Prints some various bits of information about an account""" manager = AccountManager(env.client) summary = manager.get_summary() env.fout(get_snapshot_table(summary))
[ "def", "cli", "(", "env", ")", ":", "manager", "=", "AccountManager", "(", "env", ".", "client", ")", "summary", "=", "manager", ".", "get_summary", "(", ")", "env", ".", "fout", "(", "get_snapshot_table", "(", "summary", ")", ")" ]
Prints some various bits of information about an account
[ "Prints", "some", "various", "bits", "of", "information", "about", "an", "account" ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/account/summary.py#L13-L18
train
softlayer/softlayer-python
SoftLayer/CLI/account/summary.py
get_snapshot_table
def get_snapshot_table(account): """Generates a table for printing account summary data""" table = formatting.KeyValueTable(["Name", "Value"], title="Account Snapshot") table.align['Name'] = 'r' table.align['Value'] = 'l' table.add_row(['Company Name', account.get('companyName', '-')]) table.add...
python
def get_snapshot_table(account): """Generates a table for printing account summary data""" table = formatting.KeyValueTable(["Name", "Value"], title="Account Snapshot") table.align['Name'] = 'r' table.align['Value'] = 'l' table.add_row(['Company Name', account.get('companyName', '-')]) table.add...
[ "def", "get_snapshot_table", "(", "account", ")", ":", "table", "=", "formatting", ".", "KeyValueTable", "(", "[", "\"Name\"", ",", "\"Value\"", "]", ",", "title", "=", "\"Account Snapshot\"", ")", "table", ".", "align", "[", "'Name'", "]", "=", "'r'", "ta...
Generates a table for printing account summary data
[ "Generates", "a", "table", "for", "printing", "account", "summary", "data" ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/account/summary.py#L21-L39
train
softlayer/softlayer-python
SoftLayer/CLI/metadata.py
cli
def cli(env, prop): """Find details about this machine.""" try: if prop == 'network': env.fout(get_network()) return meta_prop = META_MAPPING.get(prop) or prop env.fout(SoftLayer.MetadataManager().get(meta_prop)) except SoftLayer.TransportError: rais...
python
def cli(env, prop): """Find details about this machine.""" try: if prop == 'network': env.fout(get_network()) return meta_prop = META_MAPPING.get(prop) or prop env.fout(SoftLayer.MetadataManager().get(meta_prop)) except SoftLayer.TransportError: rais...
[ "def", "cli", "(", "env", ",", "prop", ")", ":", "try", ":", "if", "prop", "==", "'network'", ":", "env", ".", "fout", "(", "get_network", "(", ")", ")", "return", "meta_prop", "=", "META_MAPPING", ".", "get", "(", "prop", ")", "or", "prop", "env",...
Find details about this machine.
[ "Find", "details", "about", "this", "machine", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/metadata.py#L50-L64
train
softlayer/softlayer-python
SoftLayer/CLI/metadata.py
get_network
def get_network(): """Returns a list of tables with public and private network details.""" meta = SoftLayer.MetadataManager() network_tables = [] for network_func in [meta.public_network, meta.private_network]: network = network_func() table = formatting.KeyValueTable(['name', 'value'])...
python
def get_network(): """Returns a list of tables with public and private network details.""" meta = SoftLayer.MetadataManager() network_tables = [] for network_func in [meta.public_network, meta.private_network]: network = network_func() table = formatting.KeyValueTable(['name', 'value'])...
[ "def", "get_network", "(", ")", ":", "meta", "=", "SoftLayer", ".", "MetadataManager", "(", ")", "network_tables", "=", "[", "]", "for", "network_func", "in", "[", "meta", ".", "public_network", ",", "meta", ".", "private_network", "]", ":", "network", "="...
Returns a list of tables with public and private network details.
[ "Returns", "a", "list", "of", "tables", "with", "public", "and", "private", "network", "details", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/metadata.py#L67-L87
train
softlayer/softlayer-python
SoftLayer/CLI/columns.py
get_formatter
def get_formatter(columns): """This function returns a callback to use with click options. The returned function parses a comma-separated value and returns a new ColumnFormatter. :param columns: a list of Column instances """ column_map = dict((column.name, column) for column in columns) ...
python
def get_formatter(columns): """This function returns a callback to use with click options. The returned function parses a comma-separated value and returns a new ColumnFormatter. :param columns: a list of Column instances """ column_map = dict((column.name, column) for column in columns) ...
[ "def", "get_formatter", "(", "columns", ")", ":", "column_map", "=", "dict", "(", "(", "column", ".", "name", ",", "column", ")", "for", "column", "in", "columns", ")", "def", "validate", "(", "ctx", ",", "param", ",", "value", ")", ":", "if", "value...
This function returns a callback to use with click options. The returned function parses a comma-separated value and returns a new ColumnFormatter. :param columns: a list of Column instances
[ "This", "function", "returns", "a", "callback", "to", "use", "with", "click", "options", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/columns.py#L57-L82
train
softlayer/softlayer-python
SoftLayer/CLI/columns.py
ColumnFormatter.add_column
def add_column(self, column): """Add a new column along with a formatting function.""" self.columns.append(column.name) self.column_funcs.append(column.path) if column.mask is not None: self.mask_parts.add(column.mask)
python
def add_column(self, column): """Add a new column along with a formatting function.""" self.columns.append(column.name) self.column_funcs.append(column.path) if column.mask is not None: self.mask_parts.add(column.mask)
[ "def", "add_column", "(", "self", ",", "column", ")", ":", "self", ".", "columns", ".", "append", "(", "column", ".", "name", ")", "self", ".", "column_funcs", ".", "append", "(", "column", ".", "path", ")", "if", "column", ".", "mask", "is", "not", ...
Add a new column along with a formatting function.
[ "Add", "a", "new", "column", "along", "with", "a", "formatting", "function", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/columns.py#L36-L42
train
softlayer/softlayer-python
SoftLayer/CLI/columns.py
ColumnFormatter.row
def row(self, data): """Return a formatted row for the given data.""" for column in self.column_funcs: if callable(column): yield column(data) else: yield utils.lookup(data, *column)
python
def row(self, data): """Return a formatted row for the given data.""" for column in self.column_funcs: if callable(column): yield column(data) else: yield utils.lookup(data, *column)
[ "def", "row", "(", "self", ",", "data", ")", ":", "for", "column", "in", "self", ".", "column_funcs", ":", "if", "callable", "(", "column", ")", ":", "yield", "column", "(", "data", ")", "else", ":", "yield", "utils", ".", "lookup", "(", "data", ",...
Return a formatted row for the given data.
[ "Return", "a", "formatted", "row", "for", "the", "given", "data", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/columns.py#L44-L50
train
softlayer/softlayer-python
SoftLayer/CLI/cdn/origin_remove.py
cli
def cli(env, account_id, origin_id): """Remove an origin pull mapping.""" manager = SoftLayer.CDNManager(env.client) manager.remove_origin(account_id, origin_id)
python
def cli(env, account_id, origin_id): """Remove an origin pull mapping.""" manager = SoftLayer.CDNManager(env.client) manager.remove_origin(account_id, origin_id)
[ "def", "cli", "(", "env", ",", "account_id", ",", "origin_id", ")", ":", "manager", "=", "SoftLayer", ".", "CDNManager", "(", "env", ".", "client", ")", "manager", ".", "remove_origin", "(", "account_id", ",", "origin_id", ")" ]
Remove an origin pull mapping.
[ "Remove", "an", "origin", "pull", "mapping", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/cdn/origin_remove.py#L14-L18
train
softlayer/softlayer-python
SoftLayer/CLI/cdn/list.py
cli
def cli(env, sortby): """List all CDN accounts.""" manager = SoftLayer.CDNManager(env.client) accounts = manager.list_accounts() table = formatting.Table(['id', 'account_name', 'type', 'created', ...
python
def cli(env, sortby): """List all CDN accounts.""" manager = SoftLayer.CDNManager(env.client) accounts = manager.list_accounts() table = formatting.Table(['id', 'account_name', 'type', 'created', ...
[ "def", "cli", "(", "env", ",", "sortby", ")", ":", "manager", "=", "SoftLayer", ".", "CDNManager", "(", "env", ".", "client", ")", "accounts", "=", "manager", ".", "list_accounts", "(", ")", "table", "=", "formatting", ".", "Table", "(", "[", "'id'", ...
List all CDN accounts.
[ "List", "all", "CDN", "accounts", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/cdn/list.py#L22-L43
train
softlayer/softlayer-python
SoftLayer/CLI/file/snapshot/list.py
cli
def cli(env, volume_id, sortby, columns): """List file storage snapshots.""" file_manager = SoftLayer.FileStorageManager(env.client) snapshots = file_manager.get_file_volume_snapshot_list( volume_id, mask=columns.mask() ) table = formatting.Table(columns.columns) table.sortby = ...
python
def cli(env, volume_id, sortby, columns): """List file storage snapshots.""" file_manager = SoftLayer.FileStorageManager(env.client) snapshots = file_manager.get_file_volume_snapshot_list( volume_id, mask=columns.mask() ) table = formatting.Table(columns.columns) table.sortby = ...
[ "def", "cli", "(", "env", ",", "volume_id", ",", "sortby", ",", "columns", ")", ":", "file_manager", "=", "SoftLayer", ".", "FileStorageManager", "(", "env", ".", "client", ")", "snapshots", "=", "file_manager", ".", "get_file_volume_snapshot_list", "(", "volu...
List file storage snapshots.
[ "List", "file", "storage", "snapshots", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/file/snapshot/list.py#L38-L53
train