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