repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
softlayer/softlayer-python | SoftLayer/managers/metadata.py | MetadataManager.get | def get(self, name, param=None):
"""Retreive a metadata attribute.
:param string name: name of the attribute to retrieve. See `attribs`
:param param: Required parameter for some attributes
"""
if name not in self.attribs:
raise exceptions.SoftLayerError('Unknown met... | python | def get(self, name, param=None):
"""Retreive a metadata attribute.
:param string name: name of the attribute to retrieve. See `attribs`
:param param: Required parameter for some attributes
"""
if name not in self.attribs:
raise exceptions.SoftLayerError('Unknown met... | [
"def",
"get",
"(",
"self",
",",
"name",
",",
"param",
"=",
"None",
")",
":",
"if",
"name",
"not",
"in",
"self",
".",
"attribs",
":",
"raise",
"exceptions",
".",
"SoftLayerError",
"(",
"'Unknown metadata attribute.'",
")",
"call_details",
"=",
"self",
".",
... | Retreive a metadata attribute.
:param string name: name of the attribute to retrieve. See `attribs`
:param param: Required parameter for some attributes | [
"Retreive",
"a",
"metadata",
"attribute",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/metadata.py#L73-L100 | train |
softlayer/softlayer-python | SoftLayer/managers/metadata.py | MetadataManager._get_network | def _get_network(self, kind, router=True, vlans=True, vlan_ids=True):
"""Wrapper for getting details about networks.
:param string kind: network kind. Typically 'public' or 'private'
:param boolean router: flag to include router information
:param boolean vlans: flag to incl... | python | def _get_network(self, kind, router=True, vlans=True, vlan_ids=True):
"""Wrapper for getting details about networks.
:param string kind: network kind. Typically 'public' or 'private'
:param boolean router: flag to include router information
:param boolean vlans: flag to incl... | [
"def",
"_get_network",
"(",
"self",
",",
"kind",
",",
"router",
"=",
"True",
",",
"vlans",
"=",
"True",
",",
"vlan_ids",
"=",
"True",
")",
":",
"network",
"=",
"{",
"}",
"macs",
"=",
"self",
".",
"get",
"(",
"'%s_mac'",
"%",
"kind",
")",
"network",... | Wrapper for getting details about networks.
:param string kind: network kind. Typically 'public' or 'private'
:param boolean router: flag to include router information
:param boolean vlans: flag to include vlan information
:param boolean vlan_ids: flag to include vlan_id... | [
"Wrapper",
"for",
"getting",
"details",
"about",
"networks",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/metadata.py#L102-L127 | train |
softlayer/softlayer-python | SoftLayer/shell/cmd_env.py | cli | def cli(env):
"""Print environment variables."""
filtered_vars = dict([(k, v)
for k, v in env.vars.items()
if not k.startswith('_')])
env.fout(formatting.iter_to_table(filtered_vars)) | python | def cli(env):
"""Print environment variables."""
filtered_vars = dict([(k, v)
for k, v in env.vars.items()
if not k.startswith('_')])
env.fout(formatting.iter_to_table(filtered_vars)) | [
"def",
"cli",
"(",
"env",
")",
":",
"filtered_vars",
"=",
"dict",
"(",
"[",
"(",
"k",
",",
"v",
")",
"for",
"k",
",",
"v",
"in",
"env",
".",
"vars",
".",
"items",
"(",
")",
"if",
"not",
"k",
".",
"startswith",
"(",
"'_'",
")",
"]",
")",
"en... | Print environment variables. | [
"Print",
"environment",
"variables",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/shell/cmd_env.py#L12-L17 | train |
softlayer/softlayer-python | SoftLayer/CLI/block/snapshot/restore.py | cli | def cli(env, volume_id, snapshot_id):
"""Restore block volume using a given snapshot"""
block_manager = SoftLayer.BlockStorageManager(env.client)
success = block_manager.restore_from_snapshot(volume_id, snapshot_id)
if success:
click.echo('Block volume %s is being restored using snapshot %s'
... | python | def cli(env, volume_id, snapshot_id):
"""Restore block volume using a given snapshot"""
block_manager = SoftLayer.BlockStorageManager(env.client)
success = block_manager.restore_from_snapshot(volume_id, snapshot_id)
if success:
click.echo('Block volume %s is being restored using snapshot %s'
... | [
"def",
"cli",
"(",
"env",
",",
"volume_id",
",",
"snapshot_id",
")",
":",
"block_manager",
"=",
"SoftLayer",
".",
"BlockStorageManager",
"(",
"env",
".",
"client",
")",
"success",
"=",
"block_manager",
".",
"restore_from_snapshot",
"(",
"volume_id",
",",
"snap... | Restore block volume using a given snapshot | [
"Restore",
"block",
"volume",
"using",
"a",
"given",
"snapshot"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/block/snapshot/restore.py#L15-L22 | train |
softlayer/softlayer-python | SoftLayer/CLI/ssl/add.py | cli | def cli(env, crt, csr, icc, key, notes):
"""Add and upload SSL certificate details."""
template = {
'intermediateCertificate': '',
'certificateSigningRequest': '',
'notes': notes,
}
template['certificate'] = open(crt).read()
template['privateKey'] = open(key).read()
if c... | python | def cli(env, crt, csr, icc, key, notes):
"""Add and upload SSL certificate details."""
template = {
'intermediateCertificate': '',
'certificateSigningRequest': '',
'notes': notes,
}
template['certificate'] = open(crt).read()
template['privateKey'] = open(key).read()
if c... | [
"def",
"cli",
"(",
"env",
",",
"crt",
",",
"csr",
",",
"icc",
",",
"key",
",",
"notes",
")",
":",
"template",
"=",
"{",
"'intermediateCertificate'",
":",
"''",
",",
"'certificateSigningRequest'",
":",
"''",
",",
"'notes'",
":",
"notes",
",",
"}",
"temp... | Add and upload SSL certificate details. | [
"Add",
"and",
"upload",
"SSL",
"certificate",
"details",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/ssl/add.py#L23-L42 | train |
softlayer/softlayer-python | SoftLayer/CLI/image/export.py | cli | def cli(env, identifier, uri, ibm_api_key):
"""Export an image to object storage.
The URI for an object storage object (.vhd/.iso file) of the format:
swift://<objectStorageAccount>@<cluster>/<container>/<objectPath>
or cos://<regionName>/<bucketName>/<objectPath> if using IBM Cloud
Object Storage
... | python | def cli(env, identifier, uri, ibm_api_key):
"""Export an image to object storage.
The URI for an object storage object (.vhd/.iso file) of the format:
swift://<objectStorageAccount>@<cluster>/<container>/<objectPath>
or cos://<regionName>/<bucketName>/<objectPath> if using IBM Cloud
Object Storage
... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
",",
"uri",
",",
"ibm_api_key",
")",
":",
"image_mgr",
"=",
"SoftLayer",
".",
"ImageManager",
"(",
"env",
".",
"client",
")",
"image_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"image_mgr",
".",
"resolve_ids",
... | Export an image to object storage.
The URI for an object storage object (.vhd/.iso file) of the format:
swift://<objectStorageAccount>@<cluster>/<container>/<objectPath>
or cos://<regionName>/<bucketName>/<objectPath> if using IBM Cloud
Object Storage | [
"Export",
"an",
"image",
"to",
"object",
"storage",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/image/export.py#L22-L36 | train |
softlayer/softlayer-python | SoftLayer/CLI/virt/__init__.py | MemoryType.convert | def convert(self, value, param, ctx): # pylint: disable=inconsistent-return-statements
"""Validate memory argument. Returns the memory value in megabytes."""
matches = MEMORY_RE.match(value.lower())
if matches is None:
self.fail('%s is not a valid value for memory amount' % value, p... | python | def convert(self, value, param, ctx): # pylint: disable=inconsistent-return-statements
"""Validate memory argument. Returns the memory value in megabytes."""
matches = MEMORY_RE.match(value.lower())
if matches is None:
self.fail('%s is not a valid value for memory amount' % value, p... | [
"def",
"convert",
"(",
"self",
",",
"value",
",",
"param",
",",
"ctx",
")",
":",
"matches",
"=",
"MEMORY_RE",
".",
"match",
"(",
"value",
".",
"lower",
"(",
")",
")",
"if",
"matches",
"is",
"None",
":",
"self",
".",
"fail",
"(",
"'%s is not a valid v... | Validate memory argument. Returns the memory value in megabytes. | [
"Validate",
"memory",
"argument",
".",
"Returns",
"the",
"memory",
"value",
"in",
"megabytes",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/__init__.py#L15-L31 | train |
softlayer/softlayer-python | SoftLayer/CLI/nas/credentials.py | cli | def cli(env, identifier):
"""List NAS account credentials."""
nw_mgr = SoftLayer.NetworkManager(env.client)
result = nw_mgr.get_nas_credentials(identifier)
table = formatting.Table(['username', 'password'])
table.add_row([result.get('username', 'None'),
result.get('password', 'No... | python | def cli(env, identifier):
"""List NAS account credentials."""
nw_mgr = SoftLayer.NetworkManager(env.client)
result = nw_mgr.get_nas_credentials(identifier)
table = formatting.Table(['username', 'password'])
table.add_row([result.get('username', 'None'),
result.get('password', 'No... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"nw_mgr",
"=",
"SoftLayer",
".",
"NetworkManager",
"(",
"env",
".",
"client",
")",
"result",
"=",
"nw_mgr",
".",
"get_nas_credentials",
"(",
"identifier",
")",
"table",
"=",
"formatting",
".",
"Table",... | List NAS account credentials. | [
"List",
"NAS",
"account",
"credentials",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/nas/credentials.py#L14-L22 | train |
softlayer/softlayer-python | SoftLayer/CLI/firewall/detail.py | cli | def cli(env, identifier):
"""Detail firewall."""
mgr = SoftLayer.FirewallManager(env.client)
firewall_type, firewall_id = firewall.parse_id(identifier)
if firewall_type == 'vlan':
rules = mgr.get_dedicated_fwl_rules(firewall_id)
else:
rules = mgr.get_standard_fwl_rules(firewall_id)... | python | def cli(env, identifier):
"""Detail firewall."""
mgr = SoftLayer.FirewallManager(env.client)
firewall_type, firewall_id = firewall.parse_id(identifier)
if firewall_type == 'vlan':
rules = mgr.get_dedicated_fwl_rules(firewall_id)
else:
rules = mgr.get_standard_fwl_rules(firewall_id)... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"FirewallManager",
"(",
"env",
".",
"client",
")",
"firewall_type",
",",
"firewall_id",
"=",
"firewall",
".",
"parse_id",
"(",
"identifier",
")",
"if",
"firewall_type",
"=... | Detail firewall. | [
"Detail",
"firewall",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/firewall/detail.py#L16-L27 | train |
softlayer/softlayer-python | SoftLayer/CLI/firewall/detail.py | get_rules_table | def get_rules_table(rules):
"""Helper to format the rules into a table.
:param list rules: A list containing the rules of the firewall
:returns: a formatted table of the firewall rules
"""
table = formatting.Table(['#', 'action', 'protocol', 'src_ip', 'src_mask',
'dest... | python | def get_rules_table(rules):
"""Helper to format the rules into a table.
:param list rules: A list containing the rules of the firewall
:returns: a formatted table of the firewall rules
"""
table = formatting.Table(['#', 'action', 'protocol', 'src_ip', 'src_mask',
'dest... | [
"def",
"get_rules_table",
"(",
"rules",
")",
":",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"'#'",
",",
"'action'",
",",
"'protocol'",
",",
"'src_ip'",
",",
"'src_mask'",
",",
"'dest'",
",",
"'dest_mask'",
"]",
")",
"table",
".",
"sortby",
"=",... | Helper to format the rules into a table.
:param list rules: A list containing the rules of the firewall
:returns: a formatted table of the firewall rules | [
"Helper",
"to",
"format",
"the",
"rules",
"into",
"a",
"table",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/firewall/detail.py#L30-L50 | train |
softlayer/softlayer-python | SoftLayer/managers/sshkey.py | SshKeyManager.add_key | def add_key(self, key, label, notes=None):
"""Adds a new SSH key to the account.
:param string key: The SSH key to add
:param string label: The label for the key
:param string notes: Additional notes for the key
:returns: A dictionary of the new key's information.
"""
... | python | def add_key(self, key, label, notes=None):
"""Adds a new SSH key to the account.
:param string key: The SSH key to add
:param string label: The label for the key
:param string notes: Additional notes for the key
:returns: A dictionary of the new key's information.
"""
... | [
"def",
"add_key",
"(",
"self",
",",
"key",
",",
"label",
",",
"notes",
"=",
"None",
")",
":",
"order",
"=",
"{",
"'key'",
":",
"key",
",",
"'label'",
":",
"label",
",",
"'notes'",
":",
"notes",
",",
"}",
"return",
"self",
".",
"sshkey",
".",
"cre... | Adds a new SSH key to the account.
:param string key: The SSH key to add
:param string label: The label for the key
:param string notes: Additional notes for the key
:returns: A dictionary of the new key's information. | [
"Adds",
"a",
"new",
"SSH",
"key",
"to",
"the",
"account",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/sshkey.py#L26-L40 | train |
softlayer/softlayer-python | SoftLayer/managers/sshkey.py | SshKeyManager.edit_key | def edit_key(self, key_id, label=None, notes=None):
"""Edits information about an SSH key.
:param int key_id: The ID of the key to edit
:param string label: The new label for the key
:param string notes: Notes to set or change on the key
:returns: A Boolean indicating success or... | python | def edit_key(self, key_id, label=None, notes=None):
"""Edits information about an SSH key.
:param int key_id: The ID of the key to edit
:param string label: The new label for the key
:param string notes: Notes to set or change on the key
:returns: A Boolean indicating success or... | [
"def",
"edit_key",
"(",
"self",
",",
"key_id",
",",
"label",
"=",
"None",
",",
"notes",
"=",
"None",
")",
":",
"data",
"=",
"{",
"}",
"if",
"label",
":",
"data",
"[",
"'label'",
"]",
"=",
"label",
"if",
"notes",
":",
"data",
"[",
"'notes'",
"]",
... | Edits information about an SSH key.
:param int key_id: The ID of the key to edit
:param string label: The new label for the key
:param string notes: Notes to set or change on the key
:returns: A Boolean indicating success or failure | [
"Edits",
"information",
"about",
"an",
"SSH",
"key",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/sshkey.py#L50-L66 | train |
softlayer/softlayer-python | SoftLayer/managers/sshkey.py | SshKeyManager.list_keys | def list_keys(self, label=None):
"""Lists all SSH keys on the account.
:param string label: Filter list based on SSH key label
:returns: A list of dictionaries with information about each key
"""
_filter = utils.NestedDict({})
if label:
_filter['sshKeys']['la... | python | def list_keys(self, label=None):
"""Lists all SSH keys on the account.
:param string label: Filter list based on SSH key label
:returns: A list of dictionaries with information about each key
"""
_filter = utils.NestedDict({})
if label:
_filter['sshKeys']['la... | [
"def",
"list_keys",
"(",
"self",
",",
"label",
"=",
"None",
")",
":",
"_filter",
"=",
"utils",
".",
"NestedDict",
"(",
"{",
"}",
")",
"if",
"label",
":",
"_filter",
"[",
"'sshKeys'",
"]",
"[",
"'label'",
"]",
"=",
"utils",
".",
"query_filter",
"(",
... | Lists all SSH keys on the account.
:param string label: Filter list based on SSH key label
:returns: A list of dictionaries with information about each key | [
"Lists",
"all",
"SSH",
"keys",
"on",
"the",
"account",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/sshkey.py#L76-L86 | train |
softlayer/softlayer-python | SoftLayer/managers/sshkey.py | SshKeyManager._get_ids_from_label | def _get_ids_from_label(self, label):
"""Return sshkey IDs which match the given label."""
keys = self.list_keys()
results = []
for key in keys:
if key['label'] == label:
results.append(key['id'])
return results | python | def _get_ids_from_label(self, label):
"""Return sshkey IDs which match the given label."""
keys = self.list_keys()
results = []
for key in keys:
if key['label'] == label:
results.append(key['id'])
return results | [
"def",
"_get_ids_from_label",
"(",
"self",
",",
"label",
")",
":",
"keys",
"=",
"self",
".",
"list_keys",
"(",
")",
"results",
"=",
"[",
"]",
"for",
"key",
"in",
"keys",
":",
"if",
"key",
"[",
"'label'",
"]",
"==",
"label",
":",
"results",
".",
"ap... | Return sshkey IDs which match the given label. | [
"Return",
"sshkey",
"IDs",
"which",
"match",
"the",
"given",
"label",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/sshkey.py#L88-L95 | train |
softlayer/softlayer-python | SoftLayer/CLI/ssl/download.py | cli | def cli(env, identifier):
"""Download SSL certificate and key file."""
manager = SoftLayer.SSLManager(env.client)
certificate = manager.get_certificate(identifier)
write_cert(certificate['commonName'] + '.crt', certificate['certificate'])
write_cert(certificate['commonName'] + '.key', certificate[... | python | def cli(env, identifier):
"""Download SSL certificate and key file."""
manager = SoftLayer.SSLManager(env.client)
certificate = manager.get_certificate(identifier)
write_cert(certificate['commonName'] + '.crt', certificate['certificate'])
write_cert(certificate['commonName'] + '.key', certificate[... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"manager",
"=",
"SoftLayer",
".",
"SSLManager",
"(",
"env",
".",
"client",
")",
"certificate",
"=",
"manager",
".",
"get_certificate",
"(",
"identifier",
")",
"write_cert",
"(",
"certificate",
"[",
"'c... | Download SSL certificate and key file. | [
"Download",
"SSL",
"certificate",
"and",
"key",
"file",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/ssl/download.py#L13-L28 | train |
softlayer/softlayer-python | SoftLayer/CLI/virt/capture.py | cli | def cli(env, identifier, name, all, note):
"""Capture one or all disks from a virtual server to a SoftLayer image."""
vsi = SoftLayer.VSManager(env.client)
vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS')
capture = vsi.capture(vs_id, name, all, note)
table = formatting.KeyValueTable(... | python | def cli(env, identifier, name, all, note):
"""Capture one or all disks from a virtual server to a SoftLayer image."""
vsi = SoftLayer.VSManager(env.client)
vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS')
capture = vsi.capture(vs_id, name, all, note)
table = formatting.KeyValueTable(... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
",",
"name",
",",
"all",
",",
"note",
")",
":",
"vsi",
"=",
"SoftLayer",
".",
"VSManager",
"(",
"env",
".",
"client",
")",
"vs_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"vsi",
".",
"resolve_ids",
",",
... | Capture one or all disks from a virtual server to a SoftLayer image. | [
"Capture",
"one",
"or",
"all",
"disks",
"from",
"a",
"virtual",
"server",
"to",
"a",
"SoftLayer",
"image",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/capture.py#L20-L38 | train |
softlayer/softlayer-python | SoftLayer/managers/event_log.py | EventLogManager.get_event_logs | def get_event_logs(self, request_filter=None, log_limit=20, iterator=True):
"""Returns a list of event logs
Example::
event_mgr = SoftLayer.EventLogManager(env.client)
request_filter = event_mgr.build_filter(date_min="01/01/2019", date_max="02/01/2019")
logs = event... | python | def get_event_logs(self, request_filter=None, log_limit=20, iterator=True):
"""Returns a list of event logs
Example::
event_mgr = SoftLayer.EventLogManager(env.client)
request_filter = event_mgr.build_filter(date_min="01/01/2019", date_max="02/01/2019")
logs = event... | [
"def",
"get_event_logs",
"(",
"self",
",",
"request_filter",
"=",
"None",
",",
"log_limit",
"=",
"20",
",",
"iterator",
"=",
"True",
")",
":",
"if",
"iterator",
":",
"return",
"self",
".",
"client",
".",
"iter_call",
"(",
"'Event_Log'",
",",
"'getAllObject... | Returns a list of event logs
Example::
event_mgr = SoftLayer.EventLogManager(env.client)
request_filter = event_mgr.build_filter(date_min="01/01/2019", date_max="02/01/2019")
logs = event_mgr.get_event_logs(request_filter)
for log in logs:
print(... | [
"Returns",
"a",
"list",
"of",
"event",
"logs"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/event_log.py#L23-L44 | train |
softlayer/softlayer-python | SoftLayer/managers/event_log.py | EventLogManager.build_filter | def build_filter(date_min=None, date_max=None, obj_event=None, obj_id=None, obj_type=None, utc_offset=None):
"""Returns a query filter that can be passed into EventLogManager.get_event_logs
:param string date_min: Lower bound date in MM/DD/YYYY format
:param string date_max: Upper bound date in... | python | def build_filter(date_min=None, date_max=None, obj_event=None, obj_id=None, obj_type=None, utc_offset=None):
"""Returns a query filter that can be passed into EventLogManager.get_event_logs
:param string date_min: Lower bound date in MM/DD/YYYY format
:param string date_max: Upper bound date in... | [
"def",
"build_filter",
"(",
"date_min",
"=",
"None",
",",
"date_max",
"=",
"None",
",",
"obj_event",
"=",
"None",
",",
"obj_id",
"=",
"None",
",",
"obj_type",
"=",
"None",
",",
"utc_offset",
"=",
"None",
")",
":",
"if",
"not",
"any",
"(",
"[",
"date_... | Returns a query filter that can be passed into EventLogManager.get_event_logs
:param string date_min: Lower bound date in MM/DD/YYYY format
:param string date_max: Upper bound date in MM/DD/YYYY format
:param string obj_event: The name of the events we want to filter by
:param int obj_i... | [
"Returns",
"a",
"query",
"filter",
"that",
"can",
"be",
"passed",
"into",
"EventLogManager",
".",
"get_event_logs"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/event_log.py#L55-L91 | train |
softlayer/softlayer-python | SoftLayer/CLI/dns/record_list.py | cli | def cli(env, zone, data, record, ttl, type):
"""List all records in a zone."""
manager = SoftLayer.DNSManager(env.client)
table = formatting.Table(['id', 'record', 'type', 'ttl', 'data'])
table.align['ttl'] = 'l'
table.align['record'] = 'r'
table.align['data'] = 'l'
zone_id = helpers.reso... | python | def cli(env, zone, data, record, ttl, type):
"""List all records in a zone."""
manager = SoftLayer.DNSManager(env.client)
table = formatting.Table(['id', 'record', 'type', 'ttl', 'data'])
table.align['ttl'] = 'l'
table.align['record'] = 'r'
table.align['data'] = 'l'
zone_id = helpers.reso... | [
"def",
"cli",
"(",
"env",
",",
"zone",
",",
"data",
",",
"record",
",",
"ttl",
",",
"type",
")",
":",
"manager",
"=",
"SoftLayer",
".",
"DNSManager",
"(",
"env",
".",
"client",
")",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"'id'",
",",
... | List all records in a zone. | [
"List",
"all",
"records",
"in",
"a",
"zone",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/dns/record_list.py#L22-L49 | train |
softlayer/softlayer-python | SoftLayer/CLI/ticket/subjects.py | cli | def cli(env):
"""List Subject IDs for ticket creation."""
ticket_mgr = SoftLayer.TicketManager(env.client)
table = formatting.Table(['id', 'subject'])
for subject in ticket_mgr.list_subjects():
table.add_row([subject['id'], subject['name']])
env.fout(table) | python | def cli(env):
"""List Subject IDs for ticket creation."""
ticket_mgr = SoftLayer.TicketManager(env.client)
table = formatting.Table(['id', 'subject'])
for subject in ticket_mgr.list_subjects():
table.add_row([subject['id'], subject['name']])
env.fout(table) | [
"def",
"cli",
"(",
"env",
")",
":",
"ticket_mgr",
"=",
"SoftLayer",
".",
"TicketManager",
"(",
"env",
".",
"client",
")",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"'id'",
",",
"'subject'",
"]",
")",
"for",
"subject",
"in",
"ticket_mgr",
".",... | List Subject IDs for ticket creation. | [
"List",
"Subject",
"IDs",
"for",
"ticket",
"creation",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/ticket/subjects.py#L13-L21 | train |
softlayer/softlayer-python | SoftLayer/CLI/virt/placementgroup/create.py | cli | def cli(env, **args):
"""Create a placement group."""
manager = PlacementManager(env.client)
backend_router_id = helpers.resolve_id(manager.get_backend_router_id_from_hostname,
args.get('backend_router'),
'backendRouter')
... | python | def cli(env, **args):
"""Create a placement group."""
manager = PlacementManager(env.client)
backend_router_id = helpers.resolve_id(manager.get_backend_router_id_from_hostname,
args.get('backend_router'),
'backendRouter')
... | [
"def",
"cli",
"(",
"env",
",",
"**",
"args",
")",
":",
"manager",
"=",
"PlacementManager",
"(",
"env",
".",
"client",
")",
"backend_router_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"manager",
".",
"get_backend_router_id_from_hostname",
",",
"args",
".",
"... | Create a placement group. | [
"Create",
"a",
"placement",
"group",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/placementgroup/create.py#L17-L31 | train |
softlayer/softlayer-python | SoftLayer/CLI/user/detail.py | cli | def cli(env, identifier, keys, permissions, hardware, virtual, logins, events):
"""User details."""
mgr = SoftLayer.UserManager(env.client)
user_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'username')
object_mask = "userStatus[name], parent[id, username], apiAuthenticationKeys[authenticationKe... | python | def cli(env, identifier, keys, permissions, hardware, virtual, logins, events):
"""User details."""
mgr = SoftLayer.UserManager(env.client)
user_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'username')
object_mask = "userStatus[name], parent[id, username], apiAuthenticationKeys[authenticationKe... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
",",
"keys",
",",
"permissions",
",",
"hardware",
",",
"virtual",
",",
"logins",
",",
"events",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"UserManager",
"(",
"env",
".",
"client",
")",
"user_id",
"=",
"helpers... | User details. | [
"User",
"details",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/user/detail.py#L28-L56 | train |
softlayer/softlayer-python | SoftLayer/CLI/user/detail.py | basic_info | def basic_info(user, keys):
"""Prints a table of basic user information"""
table = formatting.KeyValueTable(['Title', 'Basic Information'])
table.align['Title'] = 'r'
table.align['Basic Information'] = 'l'
table.add_row(['Id', user.get('id', '-')])
table.add_row(['Username', user.get('username... | python | def basic_info(user, keys):
"""Prints a table of basic user information"""
table = formatting.KeyValueTable(['Title', 'Basic Information'])
table.align['Title'] = 'r'
table.align['Basic Information'] = 'l'
table.add_row(['Id', user.get('id', '-')])
table.add_row(['Username', user.get('username... | [
"def",
"basic_info",
"(",
"user",
",",
"keys",
")",
":",
"table",
"=",
"formatting",
".",
"KeyValueTable",
"(",
"[",
"'Title'",
",",
"'Basic Information'",
"]",
")",
"table",
".",
"align",
"[",
"'Title'",
"]",
"=",
"'r'",
"table",
".",
"align",
"[",
"'... | Prints a table of basic user information | [
"Prints",
"a",
"table",
"of",
"basic",
"user",
"information"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/user/detail.py#L59-L95 | train |
softlayer/softlayer-python | SoftLayer/CLI/user/detail.py | print_permissions | def print_permissions(permissions):
"""Prints out a users permissions"""
table = formatting.Table(['keyName', 'Description'])
for perm in permissions:
table.add_row([perm['keyName'], perm['name']])
return table | python | def print_permissions(permissions):
"""Prints out a users permissions"""
table = formatting.Table(['keyName', 'Description'])
for perm in permissions:
table.add_row([perm['keyName'], perm['name']])
return table | [
"def",
"print_permissions",
"(",
"permissions",
")",
":",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"'keyName'",
",",
"'Description'",
"]",
")",
"for",
"perm",
"in",
"permissions",
":",
"table",
".",
"add_row",
"(",
"[",
"perm",
"[",
"'keyName'",... | Prints out a users permissions | [
"Prints",
"out",
"a",
"users",
"permissions"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/user/detail.py#L98-L104 | train |
softlayer/softlayer-python | SoftLayer/CLI/user/detail.py | print_access | def print_access(access, title):
"""Prints out the hardware or virtual guests a user can access"""
columns = ['id', 'hostname', 'Primary Public IP', 'Primary Private IP', 'Created']
table = formatting.Table(columns, title)
for host in access:
host_id = host.get('id')
host_fqdn = host.g... | python | def print_access(access, title):
"""Prints out the hardware or virtual guests a user can access"""
columns = ['id', 'hostname', 'Primary Public IP', 'Primary Private IP', 'Created']
table = formatting.Table(columns, title)
for host in access:
host_id = host.get('id')
host_fqdn = host.g... | [
"def",
"print_access",
"(",
"access",
",",
"title",
")",
":",
"columns",
"=",
"[",
"'id'",
",",
"'hostname'",
",",
"'Primary Public IP'",
",",
"'Primary Private IP'",
",",
"'Created'",
"]",
"table",
"=",
"formatting",
".",
"Table",
"(",
"columns",
",",
"titl... | Prints out the hardware or virtual guests a user can access | [
"Prints",
"out",
"the",
"hardware",
"or",
"virtual",
"guests",
"a",
"user",
"can",
"access"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/user/detail.py#L107-L120 | train |
softlayer/softlayer-python | SoftLayer/CLI/user/detail.py | print_dedicated_access | def print_dedicated_access(access):
"""Prints out the dedicated hosts a user can access"""
table = formatting.Table(['id', 'Name', 'Cpus', 'Memory', 'Disk', 'Created'], 'Dedicated Access')
for host in access:
host_id = host.get('id')
host_fqdn = host.get('name')
host_cpu = host.get(... | python | def print_dedicated_access(access):
"""Prints out the dedicated hosts a user can access"""
table = formatting.Table(['id', 'Name', 'Cpus', 'Memory', 'Disk', 'Created'], 'Dedicated Access')
for host in access:
host_id = host.get('id')
host_fqdn = host.get('name')
host_cpu = host.get(... | [
"def",
"print_dedicated_access",
"(",
"access",
")",
":",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"'id'",
",",
"'Name'",
",",
"'Cpus'",
",",
"'Memory'",
",",
"'Disk'",
",",
"'Created'",
"]",
",",
"'Dedicated Access'",
")",
"for",
"host",
"in",
... | Prints out the dedicated hosts a user can access | [
"Prints",
"out",
"the",
"dedicated",
"hosts",
"a",
"user",
"can",
"access"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/user/detail.py#L123-L135 | train |
softlayer/softlayer-python | SoftLayer/CLI/user/detail.py | print_logins | def print_logins(logins):
"""Prints out the login history for a user"""
table = formatting.Table(['Date', 'IP Address', 'Successufl Login?'])
for login in logins:
table.add_row([login.get('createDate'), login.get('ipAddress'), login.get('successFlag')])
return table | python | def print_logins(logins):
"""Prints out the login history for a user"""
table = formatting.Table(['Date', 'IP Address', 'Successufl Login?'])
for login in logins:
table.add_row([login.get('createDate'), login.get('ipAddress'), login.get('successFlag')])
return table | [
"def",
"print_logins",
"(",
"logins",
")",
":",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"'Date'",
",",
"'IP Address'",
",",
"'Successufl Login?'",
"]",
")",
"for",
"login",
"in",
"logins",
":",
"table",
".",
"add_row",
"(",
"[",
"login",
".",... | Prints out the login history for a user | [
"Prints",
"out",
"the",
"login",
"history",
"for",
"a",
"user"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/user/detail.py#L138-L143 | train |
softlayer/softlayer-python | SoftLayer/CLI/user/detail.py | print_events | def print_events(events):
"""Prints out the event log for a user"""
columns = ['Date', 'Type', 'IP Address', 'label', 'username']
table = formatting.Table(columns)
for event in events:
table.add_row([event.get('eventCreateDate'), event.get('eventName'),
event.get('ipAddres... | python | def print_events(events):
"""Prints out the event log for a user"""
columns = ['Date', 'Type', 'IP Address', 'label', 'username']
table = formatting.Table(columns)
for event in events:
table.add_row([event.get('eventCreateDate'), event.get('eventName'),
event.get('ipAddres... | [
"def",
"print_events",
"(",
"events",
")",
":",
"columns",
"=",
"[",
"'Date'",
",",
"'Type'",
",",
"'IP Address'",
",",
"'label'",
",",
"'username'",
"]",
"table",
"=",
"formatting",
".",
"Table",
"(",
"columns",
")",
"for",
"event",
"in",
"events",
":",... | Prints out the event log for a user | [
"Prints",
"out",
"the",
"event",
"log",
"for",
"a",
"user"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/user/detail.py#L146-L153 | train |
softlayer/softlayer-python | SoftLayer/CLI/user/delete.py | cli | def cli(env, identifier):
"""Sets a user's status to CANCEL_PENDING, which will immediately disable the account,
and will eventually be fully removed from the account by an automated internal process.
Example: slcli user delete userId
"""
mgr = SoftLayer.UserManager(env.client)
user_id = hel... | python | def cli(env, identifier):
"""Sets a user's status to CANCEL_PENDING, which will immediately disable the account,
and will eventually be fully removed from the account by an automated internal process.
Example: slcli user delete userId
"""
mgr = SoftLayer.UserManager(env.client)
user_id = hel... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"UserManager",
"(",
"env",
".",
"client",
")",
"user_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"mgr",
".",
"resolve_ids",
",",
"identifier",
",",
"'username'",
")",
... | Sets a user's status to CANCEL_PENDING, which will immediately disable the account,
and will eventually be fully removed from the account by an automated internal process.
Example: slcli user delete userId | [
"Sets",
"a",
"user",
"s",
"status",
"to",
"CANCEL_PENDING",
"which",
"will",
"immediately",
"disable",
"the",
"account"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/user/delete.py#L14-L32 | train |
softlayer/softlayer-python | SoftLayer/CLI/ssl/edit.py | cli | def cli(env, identifier, crt, csr, icc, key, notes):
"""Edit SSL certificate."""
template = {'id': identifier}
if crt:
template['certificate'] = open(crt).read()
if key:
template['privateKey'] = open(key).read()
if csr:
template['certificateSigningRequest'] = open(csr).read()... | python | def cli(env, identifier, crt, csr, icc, key, notes):
"""Edit SSL certificate."""
template = {'id': identifier}
if crt:
template['certificate'] = open(crt).read()
if key:
template['privateKey'] = open(key).read()
if csr:
template['certificateSigningRequest'] = open(csr).read()... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
",",
"crt",
",",
"csr",
",",
"icc",
",",
"key",
",",
"notes",
")",
":",
"template",
"=",
"{",
"'id'",
":",
"identifier",
"}",
"if",
"crt",
":",
"template",
"[",
"'certificate'",
"]",
"=",
"open",
"(",
... | Edit SSL certificate. | [
"Edit",
"SSL",
"certificate",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/ssl/edit.py#L24-L39 | train |
softlayer/softlayer-python | SoftLayer/CLI/cdn/origin_add.py | cli | def cli(env, account_id, content_url, type, cname):
"""Create an origin pull mapping."""
manager = SoftLayer.CDNManager(env.client)
manager.add_origin(account_id, type, content_url, cname) | python | def cli(env, account_id, content_url, type, cname):
"""Create an origin pull mapping."""
manager = SoftLayer.CDNManager(env.client)
manager.add_origin(account_id, type, content_url, cname) | [
"def",
"cli",
"(",
"env",
",",
"account_id",
",",
"content_url",
",",
"type",
",",
"cname",
")",
":",
"manager",
"=",
"SoftLayer",
".",
"CDNManager",
"(",
"env",
".",
"client",
")",
"manager",
".",
"add_origin",
"(",
"account_id",
",",
"type",
",",
"co... | Create an origin pull mapping. | [
"Create",
"an",
"origin",
"pull",
"mapping",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/cdn/origin_add.py#L22-L26 | train |
softlayer/softlayer-python | SoftLayer/CLI/template.py | export_to_template | def export_to_template(filename, args, exclude=None):
"""Exports given options to the given filename in INI format.
:param filename: Filename to save options to
:param dict args: Arguments to export
:param list exclude (optional): Exclusion list for options that should not
... | python | def export_to_template(filename, args, exclude=None):
"""Exports given options to the given filename in INI format.
:param filename: Filename to save options to
:param dict args: Arguments to export
:param list exclude (optional): Exclusion list for options that should not
... | [
"def",
"export_to_template",
"(",
"filename",
",",
"args",
",",
"exclude",
"=",
"None",
")",
":",
"exclude",
"=",
"exclude",
"or",
"[",
"]",
"exclude",
".",
"append",
"(",
"'config'",
")",
"exclude",
".",
"append",
"(",
"'really'",
")",
"exclude",
".",
... | Exports given options to the given filename in INI format.
:param filename: Filename to save options to
:param dict args: Arguments to export
:param list exclude (optional): Exclusion list for options that should not
be exported | [
"Exports",
"given",
"options",
"to",
"the",
"given",
"filename",
"in",
"INI",
"format",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/template.py#L47-L68 | train |
softlayer/softlayer-python | SoftLayer/managers/vs_placement.py | PlacementManager.list | def list(self, mask=None):
"""List existing placement groups
Calls SoftLayer_Account::getPlacementGroups
"""
if mask is None:
mask = "mask[id, name, createDate, rule, guestCount, backendRouter[id, hostname]]"
groups = self.client.call('Account', 'getPlacementGroups'... | python | def list(self, mask=None):
"""List existing placement groups
Calls SoftLayer_Account::getPlacementGroups
"""
if mask is None:
mask = "mask[id, name, createDate, rule, guestCount, backendRouter[id, hostname]]"
groups = self.client.call('Account', 'getPlacementGroups'... | [
"def",
"list",
"(",
"self",
",",
"mask",
"=",
"None",
")",
":",
"if",
"mask",
"is",
"None",
":",
"mask",
"=",
"\"mask[id, name, createDate, rule, guestCount, backendRouter[id, hostname]]\"",
"groups",
"=",
"self",
".",
"client",
".",
"call",
"(",
"'Account'",
",... | List existing placement groups
Calls SoftLayer_Account::getPlacementGroups | [
"List",
"existing",
"placement",
"groups"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs_placement.py#L40-L48 | train |
softlayer/softlayer-python | SoftLayer/managers/vs_placement.py | PlacementManager.get_object | def get_object(self, group_id, mask=None):
"""Returns a PlacementGroup Object
https://softlayer.github.io/reference/services/SoftLayer_Virtual_PlacementGroup/getObject
"""
if mask is None:
mask = "mask[id, name, createDate, rule, backendRouter[id, hostname]," \
... | python | def get_object(self, group_id, mask=None):
"""Returns a PlacementGroup Object
https://softlayer.github.io/reference/services/SoftLayer_Virtual_PlacementGroup/getObject
"""
if mask is None:
mask = "mask[id, name, createDate, rule, backendRouter[id, hostname]," \
... | [
"def",
"get_object",
"(",
"self",
",",
"group_id",
",",
"mask",
"=",
"None",
")",
":",
"if",
"mask",
"is",
"None",
":",
"mask",
"=",
"\"mask[id, name, createDate, rule, backendRouter[id, hostname],\"",
"\"guests[activeTransaction[id,transactionStatus[name,friendlyName]]]]\"",... | Returns a PlacementGroup Object
https://softlayer.github.io/reference/services/SoftLayer_Virtual_PlacementGroup/getObject | [
"Returns",
"a",
"PlacementGroup",
"Object"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs_placement.py#L72-L80 | train |
softlayer/softlayer-python | SoftLayer/managers/vs_placement.py | PlacementManager.get_rule_id_from_name | def get_rule_id_from_name(self, name):
"""Finds the rule that matches name.
SoftLayer_Virtual_PlacementGroup_Rule.getAllObjects doesn't support objectFilters.
"""
results = self.client.call('SoftLayer_Virtual_PlacementGroup_Rule', 'getAllObjects')
return [result['id'] for result... | python | def get_rule_id_from_name(self, name):
"""Finds the rule that matches name.
SoftLayer_Virtual_PlacementGroup_Rule.getAllObjects doesn't support objectFilters.
"""
results = self.client.call('SoftLayer_Virtual_PlacementGroup_Rule', 'getAllObjects')
return [result['id'] for result... | [
"def",
"get_rule_id_from_name",
"(",
"self",
",",
"name",
")",
":",
"results",
"=",
"self",
".",
"client",
".",
"call",
"(",
"'SoftLayer_Virtual_PlacementGroup_Rule'",
",",
"'getAllObjects'",
")",
"return",
"[",
"result",
"[",
"'id'",
"]",
"for",
"result",
"in... | Finds the rule that matches name.
SoftLayer_Virtual_PlacementGroup_Rule.getAllObjects doesn't support objectFilters. | [
"Finds",
"the",
"rule",
"that",
"matches",
"name",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs_placement.py#L94-L100 | train |
softlayer/softlayer-python | SoftLayer/managers/vs_placement.py | PlacementManager.get_backend_router_id_from_hostname | def get_backend_router_id_from_hostname(self, hostname):
"""Finds the backend router Id that matches the hostname given
No way to use an objectFilter to find a backendRouter, so we have to search the hard way.
"""
results = self.client.call('SoftLayer_Network_Pod', 'getAllObjects')
... | python | def get_backend_router_id_from_hostname(self, hostname):
"""Finds the backend router Id that matches the hostname given
No way to use an objectFilter to find a backendRouter, so we have to search the hard way.
"""
results = self.client.call('SoftLayer_Network_Pod', 'getAllObjects')
... | [
"def",
"get_backend_router_id_from_hostname",
"(",
"self",
",",
"hostname",
")",
":",
"results",
"=",
"self",
".",
"client",
".",
"call",
"(",
"'SoftLayer_Network_Pod'",
",",
"'getAllObjects'",
")",
"return",
"[",
"result",
"[",
"'backendRouterId'",
"]",
"for",
... | Finds the backend router Id that matches the hostname given
No way to use an objectFilter to find a backendRouter, so we have to search the hard way. | [
"Finds",
"the",
"backend",
"router",
"Id",
"that",
"matches",
"the",
"hostname",
"given"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs_placement.py#L102-L108 | train |
softlayer/softlayer-python | SoftLayer/managers/vs_placement.py | PlacementManager._get_id_from_name | def _get_id_from_name(self, name):
"""List placement group ids which match the given name."""
_filter = {
'placementGroups': {
'name': {'operation': name}
}
}
mask = "mask[id, name]"
results = self.client.call('Account', 'getPlacementGroups... | python | def _get_id_from_name(self, name):
"""List placement group ids which match the given name."""
_filter = {
'placementGroups': {
'name': {'operation': name}
}
}
mask = "mask[id, name]"
results = self.client.call('Account', 'getPlacementGroups... | [
"def",
"_get_id_from_name",
"(",
"self",
",",
"name",
")",
":",
"_filter",
"=",
"{",
"'placementGroups'",
":",
"{",
"'name'",
":",
"{",
"'operation'",
":",
"name",
"}",
"}",
"}",
"mask",
"=",
"\"mask[id, name]\"",
"results",
"=",
"self",
".",
"client",
"... | List placement group ids which match the given name. | [
"List",
"placement",
"group",
"ids",
"which",
"match",
"the",
"given",
"name",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs_placement.py#L110-L119 | train |
softlayer/softlayer-python | SoftLayer/CLI/virt/capacity/create_options.py | cli | def cli(env):
"""List options for creating Reserved Capacity"""
manager = CapacityManager(env.client)
items = manager.get_create_options()
items.sort(key=lambda term: int(term['capacity']))
table = formatting.Table(["KeyName", "Description", "Term", "Default Hourly Price Per Instance"],
... | python | def cli(env):
"""List options for creating Reserved Capacity"""
manager = CapacityManager(env.client)
items = manager.get_create_options()
items.sort(key=lambda term: int(term['capacity']))
table = formatting.Table(["KeyName", "Description", "Term", "Default Hourly Price Per Instance"],
... | [
"def",
"cli",
"(",
"env",
")",
":",
"manager",
"=",
"CapacityManager",
"(",
"env",
".",
"client",
")",
"items",
"=",
"manager",
".",
"get_create_options",
"(",
")",
"items",
".",
"sort",
"(",
"key",
"=",
"lambda",
"term",
":",
"int",
"(",
"term",
"["... | List options for creating Reserved Capacity | [
"List",
"options",
"for",
"creating",
"Reserved",
"Capacity"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/capacity/create_options.py#L13-L36 | train |
softlayer/softlayer-python | SoftLayer/CLI/virt/capacity/create_options.py | get_price | def get_price(item):
"""Finds the price with the default locationGroupId"""
the_price = "No Default Pricing"
for price in item.get('prices', []):
if not price.get('locationGroupId'):
the_price = "%0.4f" % float(price['hourlyRecurringFee'])
return the_price | python | def get_price(item):
"""Finds the price with the default locationGroupId"""
the_price = "No Default Pricing"
for price in item.get('prices', []):
if not price.get('locationGroupId'):
the_price = "%0.4f" % float(price['hourlyRecurringFee'])
return the_price | [
"def",
"get_price",
"(",
"item",
")",
":",
"the_price",
"=",
"\"No Default Pricing\"",
"for",
"price",
"in",
"item",
".",
"get",
"(",
"'prices'",
",",
"[",
"]",
")",
":",
"if",
"not",
"price",
".",
"get",
"(",
"'locationGroupId'",
")",
":",
"the_price",
... | Finds the price with the default locationGroupId | [
"Finds",
"the",
"price",
"with",
"the",
"default",
"locationGroupId"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/capacity/create_options.py#L39-L45 | train |
softlayer/softlayer-python | SoftLayer/CLI/order/package_list.py | cli | def cli(env, keyword, package_type):
"""List packages that can be ordered via the placeOrder API.
::
# List out all packages for ordering
slcli order package-list
# List out all packages with "server" in the name
slcli order package-list --keyword server
# Select onl... | python | def cli(env, keyword, package_type):
"""List packages that can be ordered via the placeOrder API.
::
# List out all packages for ordering
slcli order package-list
# List out all packages with "server" in the name
slcli order package-list --keyword server
# Select onl... | [
"def",
"cli",
"(",
"env",
",",
"keyword",
",",
"package_type",
")",
":",
"manager",
"=",
"ordering",
".",
"OrderingManager",
"(",
"env",
".",
"client",
")",
"table",
"=",
"formatting",
".",
"Table",
"(",
"COLUMNS",
")",
"_filter",
"=",
"{",
"'type'",
"... | List packages that can be ordered via the placeOrder API.
::
# List out all packages for ordering
slcli order package-list
# List out all packages with "server" in the name
slcli order package-list --keyword server
# Select only specifict package types
slcli orde... | [
"List",
"packages",
"that",
"can",
"be",
"ordered",
"via",
"the",
"placeOrder",
"API",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/order/package_list.py#L20-L53 | train |
softlayer/softlayer-python | SoftLayer/CLI/loadbal/list.py | cli | def cli(env):
"""List active load balancers."""
mgr = SoftLayer.LoadBalancerManager(env.client)
load_balancers = mgr.get_local_lbs()
table = formatting.Table(['ID',
'VIP Address',
'Location',
'SSL Offload',
... | python | def cli(env):
"""List active load balancers."""
mgr = SoftLayer.LoadBalancerManager(env.client)
load_balancers = mgr.get_local_lbs()
table = formatting.Table(['ID',
'VIP Address',
'Location',
'SSL Offload',
... | [
"def",
"cli",
"(",
"env",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"LoadBalancerManager",
"(",
"env",
".",
"client",
")",
"load_balancers",
"=",
"mgr",
".",
"get_local_lbs",
"(",
")",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"'ID'",
",",
"'VI... | List active load balancers. | [
"List",
"active",
"load",
"balancers",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/loadbal/list.py#L13-L49 | train |
softlayer/softlayer-python | SoftLayer/CLI/hardware/credentials.py | cli | def cli(env, identifier):
"""List server credentials."""
manager = SoftLayer.HardwareManager(env.client)
hardware_id = helpers.resolve_id(manager.resolve_ids,
identifier,
'hardware')
instance = manager.get_hardware(hardware_id)
... | python | def cli(env, identifier):
"""List server credentials."""
manager = SoftLayer.HardwareManager(env.client)
hardware_id = helpers.resolve_id(manager.resolve_ids,
identifier,
'hardware')
instance = manager.get_hardware(hardware_id)
... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"manager",
"=",
"SoftLayer",
".",
"HardwareManager",
"(",
"env",
".",
"client",
")",
"hardware_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"manager",
".",
"resolve_ids",
",",
"identifier",
",",
"'hard... | List server credentials. | [
"List",
"server",
"credentials",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/hardware/credentials.py#L16-L31 | train |
softlayer/softlayer-python | SoftLayer/managers/storage_utils.py | populate_host_templates | def populate_host_templates(host_templates,
hardware_ids=None,
virtual_guest_ids=None,
ip_address_ids=None,
subnet_ids=None):
"""Populate the given host_templates array with the IDs provided
:param h... | python | def populate_host_templates(host_templates,
hardware_ids=None,
virtual_guest_ids=None,
ip_address_ids=None,
subnet_ids=None):
"""Populate the given host_templates array with the IDs provided
:param h... | [
"def",
"populate_host_templates",
"(",
"host_templates",
",",
"hardware_ids",
"=",
"None",
",",
"virtual_guest_ids",
"=",
"None",
",",
"ip_address_ids",
"=",
"None",
",",
"subnet_ids",
"=",
"None",
")",
":",
"if",
"hardware_ids",
"is",
"not",
"None",
":",
"for... | Populate the given host_templates array with the IDs provided
:param host_templates: The array to which host templates will be added
: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_S... | [
"Populate",
"the",
"given",
"host_templates",
"array",
"with",
"the",
"IDs",
"provided"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/storage_utils.py#L22-L61 | train |
softlayer/softlayer-python | SoftLayer/managers/storage_utils.py | get_package | def get_package(manager, category_code):
"""Returns a product package based on type of storage.
:param manager: The storage manager which calls this function.
:param category_code: Category code of product package.
:return: Returns a packaged based on type of storage.
"""
_filter = utils.Neste... | python | def get_package(manager, category_code):
"""Returns a product package based on type of storage.
:param manager: The storage manager which calls this function.
:param category_code: Category code of product package.
:return: Returns a packaged based on type of storage.
"""
_filter = utils.Neste... | [
"def",
"get_package",
"(",
"manager",
",",
"category_code",
")",
":",
"_filter",
"=",
"utils",
".",
"NestedDict",
"(",
"{",
"}",
")",
"_filter",
"[",
"'categories'",
"]",
"[",
"'categoryCode'",
"]",
"=",
"(",
"utils",
".",
"query_filter",
"(",
"category_co... | Returns a product package based on type of storage.
:param manager: The storage manager which calls this function.
:param category_code: Category code of product package.
:return: Returns a packaged based on type of storage. | [
"Returns",
"a",
"product",
"package",
"based",
"on",
"type",
"of",
"storage",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/storage_utils.py#L64-L88 | train |
softlayer/softlayer-python | SoftLayer/managers/storage_utils.py | get_location_id | def get_location_id(manager, location):
"""Returns location id
:param manager: The storage manager which calls this function.
:param location: Datacenter short name
:return: Returns location id
"""
loc_svc = manager.client['Location_Datacenter']
datacenters = loc_svc.getDatacenters(mask='ma... | python | def get_location_id(manager, location):
"""Returns location id
:param manager: The storage manager which calls this function.
:param location: Datacenter short name
:return: Returns location id
"""
loc_svc = manager.client['Location_Datacenter']
datacenters = loc_svc.getDatacenters(mask='ma... | [
"def",
"get_location_id",
"(",
"manager",
",",
"location",
")",
":",
"loc_svc",
"=",
"manager",
".",
"client",
"[",
"'Location_Datacenter'",
"]",
"datacenters",
"=",
"loc_svc",
".",
"getDatacenters",
"(",
"mask",
"=",
"'mask[longName,id,name]'",
")",
"for",
"dat... | Returns location id
:param manager: The storage manager which calls this function.
:param location: Datacenter short name
:return: Returns location id | [
"Returns",
"location",
"id"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/storage_utils.py#L91-L104 | train |
softlayer/softlayer-python | SoftLayer/managers/storage_utils.py | find_price_by_category | def find_price_by_category(package, price_category):
"""Find the price in the given package that has the specified category
:param package: The AsAService, Enterprise, or Performance product package
:param price_category: The price category code to search for
:return: Returns the price for the given ca... | python | def find_price_by_category(package, price_category):
"""Find the price in the given package that has the specified category
:param package: The AsAService, Enterprise, or Performance product package
:param price_category: The price category code to search for
:return: Returns the price for the given ca... | [
"def",
"find_price_by_category",
"(",
"package",
",",
"price_category",
")",
":",
"for",
"item",
"in",
"package",
"[",
"'items'",
"]",
":",
"price_id",
"=",
"_find_price_id",
"(",
"item",
"[",
"'prices'",
"]",
",",
"price_category",
")",
"if",
"price_id",
":... | Find the price in the given package that has the specified category
:param package: The AsAService, Enterprise, or Performance product package
:param price_category: The price category code to search for
:return: Returns the price for the given category, or an error if not found | [
"Find",
"the",
"price",
"in",
"the",
"given",
"package",
"that",
"has",
"the",
"specified",
"category"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/storage_utils.py#L107-L119 | train |
softlayer/softlayer-python | SoftLayer/managers/storage_utils.py | find_ent_space_price | def find_ent_space_price(package, category, size, tier_level):
"""Find the space price for the given category, size, and tier
:param package: The Enterprise (Endurance) product package
:param category: The category of space (endurance, replication, snapshot)
:param size: The size for which a price is d... | python | def find_ent_space_price(package, category, size, tier_level):
"""Find the space price for the given category, size, and tier
:param package: The Enterprise (Endurance) product package
:param category: The category of space (endurance, replication, snapshot)
:param size: The size for which a price is d... | [
"def",
"find_ent_space_price",
"(",
"package",
",",
"category",
",",
"size",
",",
"tier_level",
")",
":",
"if",
"category",
"==",
"'snapshot'",
":",
"category_code",
"=",
"'storage_snapshot_space'",
"elif",
"category",
"==",
"'replication'",
":",
"category_code",
... | Find the space price for the given category, size, and tier
:param package: The Enterprise (Endurance) product package
:param category: The category of space (endurance, replication, snapshot)
:param size: The size for which a price is desired
:param tier_level: The endurance tier for which a price is ... | [
"Find",
"the",
"space",
"price",
"for",
"the",
"given",
"category",
"size",
"and",
"tier"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/storage_utils.py#L122-L147 | train |
softlayer/softlayer-python | SoftLayer/managers/storage_utils.py | find_ent_endurance_tier_price | def find_ent_endurance_tier_price(package, tier_level):
"""Find the price in the given package with the specified tier level
:param package: The Enterprise (Endurance) product package
:param tier_level: The endurance tier for which a price is desired
:return: Returns the price for the given tier, or an... | python | def find_ent_endurance_tier_price(package, tier_level):
"""Find the price in the given package with the specified tier level
:param package: The Enterprise (Endurance) product package
:param tier_level: The endurance tier for which a price is desired
:return: Returns the price for the given tier, or an... | [
"def",
"find_ent_endurance_tier_price",
"(",
"package",
",",
"tier_level",
")",
":",
"for",
"item",
"in",
"package",
"[",
"'items'",
"]",
":",
"for",
"attribute",
"in",
"item",
".",
"get",
"(",
"'attributes'",
",",
"[",
"]",
")",
":",
"if",
"int",
"(",
... | Find the price in the given package with the specified tier level
:param package: The Enterprise (Endurance) product package
:param tier_level: The endurance tier for which a price is desired
:return: Returns the price for the given tier, or an error if not found | [
"Find",
"the",
"price",
"in",
"the",
"given",
"package",
"with",
"the",
"specified",
"tier",
"level"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/storage_utils.py#L150-L168 | train |
softlayer/softlayer-python | SoftLayer/managers/storage_utils.py | find_perf_space_price | def find_perf_space_price(package, size):
"""Find the price in the given package with the specified size
:param package: The Performance product package
:param size: The storage space size for which a price is desired
:return: Returns the price for the given size, or an error if not found
"""
f... | python | def find_perf_space_price(package, size):
"""Find the price in the given package with the specified size
:param package: The Performance product package
:param size: The storage space size for which a price is desired
:return: Returns the price for the given size, or an error if not found
"""
f... | [
"def",
"find_perf_space_price",
"(",
"package",
",",
"size",
")",
":",
"for",
"item",
"in",
"package",
"[",
"'items'",
"]",
":",
"if",
"int",
"(",
"item",
"[",
"'capacity'",
"]",
")",
"!=",
"size",
":",
"continue",
"price_id",
"=",
"_find_price_id",
"(",... | Find the price in the given package with the specified size
:param package: The Performance product package
:param size: The storage space size for which a price is desired
:return: Returns the price for the given size, or an error if not found | [
"Find",
"the",
"price",
"in",
"the",
"given",
"package",
"with",
"the",
"specified",
"size"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/storage_utils.py#L194-L209 | train |
softlayer/softlayer-python | SoftLayer/managers/storage_utils.py | find_perf_iops_price | def find_perf_iops_price(package, size, iops):
"""Find the price in the given package with the specified size and iops
:param package: The Performance product package
:param size: The size of storage space for which an IOPS price is desired
:param iops: The number of IOPS for which a price is desired
... | python | def find_perf_iops_price(package, size, iops):
"""Find the price in the given package with the specified size and iops
:param package: The Performance product package
:param size: The size of storage space for which an IOPS price is desired
:param iops: The number of IOPS for which a price is desired
... | [
"def",
"find_perf_iops_price",
"(",
"package",
",",
"size",
",",
"iops",
")",
":",
"for",
"item",
"in",
"package",
"[",
"'items'",
"]",
":",
"if",
"int",
"(",
"item",
"[",
"'capacity'",
"]",
")",
"!=",
"int",
"(",
"iops",
")",
":",
"continue",
"price... | Find the price in the given package with the specified size and iops
:param package: The Performance product package
:param size: The size of storage space for which an IOPS price is desired
:param iops: The number of IOPS for which a price is desired
:return: Returns the price for the size and IOPS, o... | [
"Find",
"the",
"price",
"in",
"the",
"given",
"package",
"with",
"the",
"specified",
"size",
"and",
"iops"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/storage_utils.py#L212-L228 | train |
softlayer/softlayer-python | SoftLayer/managers/storage_utils.py | find_saas_endurance_space_price | def find_saas_endurance_space_price(package, size, tier_level):
"""Find the SaaS endurance storage space price for the size and tier
:param package: The Storage As A Service product package
:param size: The volume size for which a price is desired
:param tier_level: The endurance tier for which a price... | python | def find_saas_endurance_space_price(package, size, tier_level):
"""Find the SaaS endurance storage space price for the size and tier
:param package: The Storage As A Service product package
:param size: The volume size for which a price is desired
:param tier_level: The endurance tier for which a price... | [
"def",
"find_saas_endurance_space_price",
"(",
"package",
",",
"size",
",",
"tier_level",
")",
":",
"if",
"tier_level",
"!=",
"0.25",
":",
"tier_level",
"=",
"int",
"(",
"tier_level",
")",
"key_name",
"=",
"'STORAGE_SPACE_FOR_{0}_IOPS_PER_GB'",
".",
"format",
"(",... | Find the SaaS endurance storage space price for the size and tier
:param package: The Storage As A Service product package
:param size: The volume size for which a price is desired
:param tier_level: The endurance tier for which a price is desired
:return: Returns the price for the size and tier, or an... | [
"Find",
"the",
"SaaS",
"endurance",
"storage",
"space",
"price",
"for",
"the",
"size",
"and",
"tier"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/storage_utils.py#L231-L259 | train |
softlayer/softlayer-python | SoftLayer/managers/storage_utils.py | find_saas_endurance_tier_price | def find_saas_endurance_tier_price(package, tier_level):
"""Find the SaaS storage tier level price for the specified tier level
:param package: The Storage As A Service product package
:param tier_level: The endurance tier for which a price is desired
:return: Returns the price for the given tier, or a... | python | def find_saas_endurance_tier_price(package, tier_level):
"""Find the SaaS storage tier level price for the specified tier level
:param package: The Storage As A Service product package
:param tier_level: The endurance tier for which a price is desired
:return: Returns the price for the given tier, or a... | [
"def",
"find_saas_endurance_tier_price",
"(",
"package",
",",
"tier_level",
")",
":",
"target_capacity",
"=",
"ENDURANCE_TIERS",
".",
"get",
"(",
"tier_level",
")",
"for",
"item",
"in",
"package",
"[",
"'items'",
"]",
":",
"if",
"'itemCategory'",
"not",
"in",
... | Find the SaaS storage tier level price for the specified tier level
:param package: The Storage As A Service product package
:param tier_level: The endurance tier for which a price is desired
:return: Returns the price for the given tier, or an error if not found | [
"Find",
"the",
"SaaS",
"storage",
"tier",
"level",
"price",
"for",
"the",
"specified",
"tier",
"level"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/storage_utils.py#L262-L284 | train |
softlayer/softlayer-python | SoftLayer/managers/storage_utils.py | find_saas_perform_space_price | def find_saas_perform_space_price(package, size):
"""Find the SaaS performance storage space price for the given size
:param package: The Storage As A Service product package
:param size: The volume size for which a price is desired
:return: Returns the price for the size and tier, or an error if not f... | python | def find_saas_perform_space_price(package, size):
"""Find the SaaS performance storage space price for the given size
:param package: The Storage As A Service product package
:param size: The volume size for which a price is desired
:return: Returns the price for the size and tier, or an error if not f... | [
"def",
"find_saas_perform_space_price",
"(",
"package",
",",
"size",
")",
":",
"for",
"item",
"in",
"package",
"[",
"'items'",
"]",
":",
"if",
"'itemCategory'",
"not",
"in",
"item",
"or",
"'categoryCode'",
"not",
"in",
"item",
"[",
"'itemCategory'",
"]",
"or... | Find the SaaS performance storage space price for the given size
:param package: The Storage As A Service product package
:param size: The volume size for which a price is desired
:return: Returns the price for the size and tier, or an error if not found | [
"Find",
"the",
"SaaS",
"performance",
"storage",
"space",
"price",
"for",
"the",
"given",
"size"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/storage_utils.py#L287-L316 | train |
softlayer/softlayer-python | SoftLayer/managers/storage_utils.py | find_saas_perform_iops_price | def find_saas_perform_iops_price(package, size, iops):
"""Find the SaaS IOPS price for the specified size and iops
:param package: The Storage As A Service product package
:param size: The volume size for which a price is desired
:param iops: The number of IOPS for which a price is desired
:return:... | python | def find_saas_perform_iops_price(package, size, iops):
"""Find the SaaS IOPS price for the specified size and iops
:param package: The Storage As A Service product package
:param size: The volume size for which a price is desired
:param iops: The number of IOPS for which a price is desired
:return:... | [
"def",
"find_saas_perform_iops_price",
"(",
"package",
",",
"size",
",",
"iops",
")",
":",
"for",
"item",
"in",
"package",
"[",
"'items'",
"]",
":",
"if",
"'itemCategory'",
"not",
"in",
"item",
"or",
"'categoryCode'",
"not",
"in",
"item",
"[",
"'itemCategory... | Find the SaaS IOPS price for the specified size and iops
:param package: The Storage As A Service product package
:param size: The volume size for which a price is desired
:param iops: The number of IOPS for which a price is desired
:return: Returns the price for the size and IOPS, or an error if not f... | [
"Find",
"the",
"SaaS",
"IOPS",
"price",
"for",
"the",
"specified",
"size",
"and",
"iops"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/storage_utils.py#L319-L346 | train |
softlayer/softlayer-python | SoftLayer/managers/storage_utils.py | find_saas_snapshot_space_price | def find_saas_snapshot_space_price(package, size, tier=None, iops=None):
"""Find the price in the SaaS package for the desired snapshot space size
:param package: The product package of the endurance storage type
:param size: The snapshot space size for which a price is desired
:param tier: The tier of... | python | def find_saas_snapshot_space_price(package, size, tier=None, iops=None):
"""Find the price in the SaaS package for the desired snapshot space size
:param package: The product package of the endurance storage type
:param size: The snapshot space size for which a price is desired
:param tier: The tier of... | [
"def",
"find_saas_snapshot_space_price",
"(",
"package",
",",
"size",
",",
"tier",
"=",
"None",
",",
"iops",
"=",
"None",
")",
":",
"if",
"tier",
"is",
"not",
"None",
":",
"target_value",
"=",
"ENDURANCE_TIERS",
".",
"get",
"(",
"tier",
")",
"target_restri... | Find the price in the SaaS package for the desired snapshot space size
:param package: The product package of the endurance storage type
:param size: The snapshot space size for which a price is desired
:param tier: The tier of the volume for which space is being ordered
:param iops: The IOPS of the vo... | [
"Find",
"the",
"price",
"in",
"the",
"SaaS",
"package",
"for",
"the",
"desired",
"snapshot",
"space",
"size"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/storage_utils.py#L349-L373 | train |
softlayer/softlayer-python | SoftLayer/managers/storage_utils.py | find_saas_replication_price | def find_saas_replication_price(package, tier=None, iops=None):
"""Find the price in the given package for the desired replicant volume
:param package: The product package of the endurance storage type
:param tier: The tier of the primary storage volume
:param iops: The IOPS of the primary storage volu... | python | def find_saas_replication_price(package, tier=None, iops=None):
"""Find the price in the given package for the desired replicant volume
:param package: The product package of the endurance storage type
:param tier: The tier of the primary storage volume
:param iops: The IOPS of the primary storage volu... | [
"def",
"find_saas_replication_price",
"(",
"package",
",",
"tier",
"=",
"None",
",",
"iops",
"=",
"None",
")",
":",
"if",
"tier",
"is",
"not",
"None",
":",
"target_value",
"=",
"ENDURANCE_TIERS",
".",
"get",
"(",
"tier",
")",
"target_item_keyname",
"=",
"'... | Find the price in the given package for the desired replicant volume
:param package: The product package of the endurance storage type
:param tier: The tier of the primary storage volume
:param iops: The IOPS of the primary storage volume
:return: Returns the replication price, or an error if not found | [
"Find",
"the",
"price",
"in",
"the",
"given",
"package",
"for",
"the",
"desired",
"replicant",
"volume"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/storage_utils.py#L376-L406 | train |
softlayer/softlayer-python | SoftLayer/managers/storage_utils.py | find_snapshot_schedule_id | def find_snapshot_schedule_id(volume, snapshot_schedule_keyname):
"""Find the snapshot schedule ID for the given volume and keyname
:param volume: The volume for which the snapshot ID is desired
:param snapshot_schedule_keyname: The keyname of the snapshot schedule
:return: Returns an int value indicat... | python | def find_snapshot_schedule_id(volume, snapshot_schedule_keyname):
"""Find the snapshot schedule ID for the given volume and keyname
:param volume: The volume for which the snapshot ID is desired
:param snapshot_schedule_keyname: The keyname of the snapshot schedule
:return: Returns an int value indicat... | [
"def",
"find_snapshot_schedule_id",
"(",
"volume",
",",
"snapshot_schedule_keyname",
")",
":",
"for",
"schedule",
"in",
"volume",
"[",
"'schedules'",
"]",
":",
"if",
"'type'",
"in",
"schedule",
"and",
"'keyname'",
"in",
"schedule",
"[",
"'type'",
"]",
":",
"if... | Find the snapshot schedule ID for the given volume and keyname
:param volume: The volume for which the snapshot ID is desired
:param snapshot_schedule_keyname: The keyname of the snapshot schedule
:return: Returns an int value indicating the volume's snapshot schedule ID | [
"Find",
"the",
"snapshot",
"schedule",
"ID",
"for",
"the",
"given",
"volume",
"and",
"keyname"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/storage_utils.py#L409-L422 | train |
softlayer/softlayer-python | SoftLayer/CLI/file/snapshot/cancel.py | cli | def cli(env, volume_id, reason, immediate):
"""Cancel existing snapshot space for a given volume."""
file_storage_manager = SoftLayer.FileStorageManager(env.client)
if not (env.skip_confirmations or formatting.no_going_back(volume_id)):
raise exceptions.CLIAbort('Aborted')
cancelled = file_st... | python | def cli(env, volume_id, reason, immediate):
"""Cancel existing snapshot space for a given volume."""
file_storage_manager = SoftLayer.FileStorageManager(env.client)
if not (env.skip_confirmations or formatting.no_going_back(volume_id)):
raise exceptions.CLIAbort('Aborted')
cancelled = file_st... | [
"def",
"cli",
"(",
"env",
",",
"volume_id",
",",
"reason",
",",
"immediate",
")",
":",
"file_storage_manager",
"=",
"SoftLayer",
".",
"FileStorageManager",
"(",
"env",
".",
"client",
")",
"if",
"not",
"(",
"env",
".",
"skip_confirmations",
"or",
"formatting"... | Cancel existing snapshot space for a given volume. | [
"Cancel",
"existing",
"snapshot",
"space",
"for",
"a",
"given",
"volume",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/file/snapshot/cancel.py#L20-L40 | train |
softlayer/softlayer-python | SoftLayer/CLI/securitygroup/event_log.py | get_by_request_id | def get_by_request_id(env, request_id):
"""Search for event logs by request id"""
mgr = SoftLayer.NetworkManager(env.client)
logs = mgr.get_event_logs_by_request_id(request_id)
table = formatting.Table(COLUMNS)
table.align['metadata'] = "l"
for log in logs:
metadata = json.dumps(json.... | python | def get_by_request_id(env, request_id):
"""Search for event logs by request id"""
mgr = SoftLayer.NetworkManager(env.client)
logs = mgr.get_event_logs_by_request_id(request_id)
table = formatting.Table(COLUMNS)
table.align['metadata'] = "l"
for log in logs:
metadata = json.dumps(json.... | [
"def",
"get_by_request_id",
"(",
"env",
",",
"request_id",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"NetworkManager",
"(",
"env",
".",
"client",
")",
"logs",
"=",
"mgr",
".",
"get_event_logs_by_request_id",
"(",
"request_id",
")",
"table",
"=",
"formatting",
... | Search for event logs by request id | [
"Search",
"for",
"event",
"logs",
"by",
"request",
"id"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/securitygroup/event_log.py#L18-L32 | train |
softlayer/softlayer-python | SoftLayer/CLI/ticket/create.py | cli | def cli(env, title, subject_id, body, hardware_identifier, virtual_identifier, priority):
"""Create a support ticket."""
ticket_mgr = SoftLayer.TicketManager(env.client)
if body is None:
body = click.edit('\n\n' + ticket.TEMPLATE_MSG)
created_ticket = ticket_mgr.create_ticket(
title=tit... | python | def cli(env, title, subject_id, body, hardware_identifier, virtual_identifier, priority):
"""Create a support ticket."""
ticket_mgr = SoftLayer.TicketManager(env.client)
if body is None:
body = click.edit('\n\n' + ticket.TEMPLATE_MSG)
created_ticket = ticket_mgr.create_ticket(
title=tit... | [
"def",
"cli",
"(",
"env",
",",
"title",
",",
"subject_id",
",",
"body",
",",
"hardware_identifier",
",",
"virtual_identifier",
",",
"priority",
")",
":",
"ticket_mgr",
"=",
"SoftLayer",
".",
"TicketManager",
"(",
"env",
".",
"client",
")",
"if",
"body",
"i... | Create a support ticket. | [
"Create",
"a",
"support",
"ticket",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/ticket/create.py#L26-L48 | train |
softlayer/softlayer-python | SoftLayer/CLI/file/replication/failback.py | cli | def cli(env, volume_id, replicant_id):
"""Failback a file volume from the given replicant volume."""
file_storage_manager = SoftLayer.FileStorageManager(env.client)
success = file_storage_manager.failback_from_replicant(
volume_id,
replicant_id
)
if success:
click.echo("Fai... | python | def cli(env, volume_id, replicant_id):
"""Failback a file volume from the given replicant volume."""
file_storage_manager = SoftLayer.FileStorageManager(env.client)
success = file_storage_manager.failback_from_replicant(
volume_id,
replicant_id
)
if success:
click.echo("Fai... | [
"def",
"cli",
"(",
"env",
",",
"volume_id",
",",
"replicant_id",
")",
":",
"file_storage_manager",
"=",
"SoftLayer",
".",
"FileStorageManager",
"(",
"env",
".",
"client",
")",
"success",
"=",
"file_storage_manager",
".",
"failback_from_replicant",
"(",
"volume_id"... | Failback a file volume from the given replicant volume. | [
"Failback",
"a",
"file",
"volume",
"from",
"the",
"given",
"replicant",
"volume",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/file/replication/failback.py#L14-L26 | train |
softlayer/softlayer-python | SoftLayer/CLI/file/snapshot/restore.py | cli | def cli(env, volume_id, snapshot_id):
"""Restore file volume using a given snapshot"""
file_manager = SoftLayer.FileStorageManager(env.client)
success = file_manager.restore_from_snapshot(volume_id, snapshot_id)
if success:
click.echo('File volume %s is being restored using snapshot %s'
... | python | def cli(env, volume_id, snapshot_id):
"""Restore file volume using a given snapshot"""
file_manager = SoftLayer.FileStorageManager(env.client)
success = file_manager.restore_from_snapshot(volume_id, snapshot_id)
if success:
click.echo('File volume %s is being restored using snapshot %s'
... | [
"def",
"cli",
"(",
"env",
",",
"volume_id",
",",
"snapshot_id",
")",
":",
"file_manager",
"=",
"SoftLayer",
".",
"FileStorageManager",
"(",
"env",
".",
"client",
")",
"success",
"=",
"file_manager",
".",
"restore_from_snapshot",
"(",
"volume_id",
",",
"snapsho... | Restore file volume using a given snapshot | [
"Restore",
"file",
"volume",
"using",
"a",
"given",
"snapshot"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/file/snapshot/restore.py#L15-L22 | train |
softlayer/softlayer-python | SoftLayer/CLI/config/show.py | cli | def cli(env):
"""Show current configuration."""
settings = config.get_settings_from_client(env.client)
env.fout(config.config_table(settings)) | python | def cli(env):
"""Show current configuration."""
settings = config.get_settings_from_client(env.client)
env.fout(config.config_table(settings)) | [
"def",
"cli",
"(",
"env",
")",
":",
"settings",
"=",
"config",
".",
"get_settings_from_client",
"(",
"env",
".",
"client",
")",
"env",
".",
"fout",
"(",
"config",
".",
"config_table",
"(",
"settings",
")",
")"
] | Show current configuration. | [
"Show",
"current",
"configuration",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/config/show.py#L12-L16 | train |
softlayer/softlayer-python | SoftLayer/CLI/file/order.py | cli | def cli(env, storage_type, size, iops, tier,
location, snapshot_size, service_offering, billing):
"""Order a file storage volume.
Valid size and iops options can be found here:
https://console.bluemix.net/docs/infrastructure/FileStorage/index.html#provisioning
"""
file_manager = SoftLayer.F... | python | def cli(env, storage_type, size, iops, tier,
location, snapshot_size, service_offering, billing):
"""Order a file storage volume.
Valid size and iops options can be found here:
https://console.bluemix.net/docs/infrastructure/FileStorage/index.html#provisioning
"""
file_manager = SoftLayer.F... | [
"def",
"cli",
"(",
"env",
",",
"storage_type",
",",
"size",
",",
"iops",
",",
"tier",
",",
"location",
",",
"snapshot_size",
",",
"service_offering",
",",
"billing",
")",
":",
"file_manager",
"=",
"SoftLayer",
".",
"FileStorageManager",
"(",
"env",
".",
"c... | Order a file storage volume.
Valid size and iops options can be found here:
https://console.bluemix.net/docs/infrastructure/FileStorage/index.html#provisioning | [
"Order",
"a",
"file",
"storage",
"volume",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/file/order.py#L50-L119 | train |
softlayer/softlayer-python | SoftLayer/CLI/virt/capacity/create_guest.py | cli | def cli(env, **args):
"""Allows for creating a virtual guest in a reserved capacity."""
create_args = _parse_create_args(env.client, args)
create_args['primary_disk'] = args.get('primary_disk')
manager = CapacityManager(env.client)
capacity_id = args.get('capacity_id')
test = args.get('test')
... | python | def cli(env, **args):
"""Allows for creating a virtual guest in a reserved capacity."""
create_args = _parse_create_args(env.client, args)
create_args['primary_disk'] = args.get('primary_disk')
manager = CapacityManager(env.client)
capacity_id = args.get('capacity_id')
test = args.get('test')
... | [
"def",
"cli",
"(",
"env",
",",
"**",
"args",
")",
":",
"create_args",
"=",
"_parse_create_args",
"(",
"env",
".",
"client",
",",
"args",
")",
"create_args",
"[",
"'primary_disk'",
"]",
"=",
"args",
".",
"get",
"(",
"'primary_disk'",
")",
"manager",
"=",
... | Allows for creating a virtual guest in a reserved capacity. | [
"Allows",
"for",
"creating",
"a",
"virtual",
"guest",
"in",
"a",
"reserved",
"capacity",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/capacity/create_guest.py#L36-L47 | train |
softlayer/softlayer-python | SoftLayer/CLI/sshkey/print.py | cli | def cli(env, identifier, out_file):
"""Prints out an SSH key to the screen."""
mgr = SoftLayer.SshKeyManager(env.client)
key_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'SshKey')
key = mgr.get_key(key_id)
if out_file:
with open(path.expanduser(out_file), 'w') as pub_file:
... | python | def cli(env, identifier, out_file):
"""Prints out an SSH key to the screen."""
mgr = SoftLayer.SshKeyManager(env.client)
key_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'SshKey')
key = mgr.get_key(key_id)
if out_file:
with open(path.expanduser(out_file), 'w') as pub_file:
... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
",",
"out_file",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"SshKeyManager",
"(",
"env",
".",
"client",
")",
"key_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"mgr",
".",
"resolve_ids",
",",
"identifier",
",",
... | Prints out an SSH key to the screen. | [
"Prints",
"out",
"an",
"SSH",
"key",
"to",
"the",
"screen",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/sshkey/print.py#L19-L36 | train |
softlayer/softlayer-python | SoftLayer/managers/object_storage.py | ObjectStorageManager.list_endpoints | def list_endpoints(self):
"""Lists the known object storage endpoints."""
_filter = {
'hubNetworkStorage': {'vendorName': {'operation': 'Swift'}},
}
endpoints = []
network_storage = self.client.call('Account',
'getHubNetworkS... | python | def list_endpoints(self):
"""Lists the known object storage endpoints."""
_filter = {
'hubNetworkStorage': {'vendorName': {'operation': 'Swift'}},
}
endpoints = []
network_storage = self.client.call('Account',
'getHubNetworkS... | [
"def",
"list_endpoints",
"(",
"self",
")",
":",
"_filter",
"=",
"{",
"'hubNetworkStorage'",
":",
"{",
"'vendorName'",
":",
"{",
"'operation'",
":",
"'Swift'",
"}",
"}",
",",
"}",
"endpoints",
"=",
"[",
"]",
"network_storage",
"=",
"self",
".",
"client",
... | Lists the known object storage endpoints. | [
"Lists",
"the",
"known",
"object",
"storage",
"endpoints",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/object_storage.py#L35-L54 | train |
softlayer/softlayer-python | SoftLayer/managers/object_storage.py | ObjectStorageManager.delete_credential | def delete_credential(self, identifier, credential_id=None):
"""Delete the object storage credential.
:param int id: The object storage account identifier.
:param int credential_id: The credential id to be deleted.
"""
credential = {
'id': credential_id
}
... | python | def delete_credential(self, identifier, credential_id=None):
"""Delete the object storage credential.
:param int id: The object storage account identifier.
:param int credential_id: The credential id to be deleted.
"""
credential = {
'id': credential_id
}
... | [
"def",
"delete_credential",
"(",
"self",
",",
"identifier",
",",
"credential_id",
"=",
"None",
")",
":",
"credential",
"=",
"{",
"'id'",
":",
"credential_id",
"}",
"return",
"self",
".",
"client",
".",
"call",
"(",
"'SoftLayer_Network_Storage_Hub_Cleversafe_Accoun... | Delete the object storage credential.
:param int id: The object storage account identifier.
:param int credential_id: The credential id to be deleted. | [
"Delete",
"the",
"object",
"storage",
"credential",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/object_storage.py#L66-L78 | train |
softlayer/softlayer-python | SoftLayer/CLI/hardware/list.py | cli | def cli(env, sortby, cpu, domain, datacenter, hostname, memory, network, tag, columns, limit):
"""List hardware servers."""
manager = SoftLayer.HardwareManager(env.client)
servers = manager.list_hardware(hostname=hostname,
domain=domain,
... | python | def cli(env, sortby, cpu, domain, datacenter, hostname, memory, network, tag, columns, limit):
"""List hardware servers."""
manager = SoftLayer.HardwareManager(env.client)
servers = manager.list_hardware(hostname=hostname,
domain=domain,
... | [
"def",
"cli",
"(",
"env",
",",
"sortby",
",",
"cpu",
",",
"domain",
",",
"datacenter",
",",
"hostname",
",",
"memory",
",",
"network",
",",
"tag",
",",
"columns",
",",
"limit",
")",
":",
"manager",
"=",
"SoftLayer",
".",
"HardwareManager",
"(",
"env",
... | List hardware servers. | [
"List",
"hardware",
"servers",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/hardware/list.py#L62-L83 | train |
softlayer/softlayer-python | SoftLayer/CLI/user/edit_details.py | cli | def cli(env, user, template):
"""Edit a Users details
JSON strings should be enclosed in '' and each item should be enclosed in ""
:Example: slcli user edit-details testUser -t '{"firstName": "Test", "lastName": "Testerson"}'
"""
mgr = SoftLayer.UserManager(env.client)
user_id = helpers.resolv... | python | def cli(env, user, template):
"""Edit a Users details
JSON strings should be enclosed in '' and each item should be enclosed in ""
:Example: slcli user edit-details testUser -t '{"firstName": "Test", "lastName": "Testerson"}'
"""
mgr = SoftLayer.UserManager(env.client)
user_id = helpers.resolv... | [
"def",
"cli",
"(",
"env",
",",
"user",
",",
"template",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"UserManager",
"(",
"env",
".",
"client",
")",
"user_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"mgr",
".",
"resolve_ids",
",",
"user",
",",
"'username'",... | Edit a Users details
JSON strings should be enclosed in '' and each item should be enclosed in ""
:Example: slcli user edit-details testUser -t '{"firstName": "Test", "lastName": "Testerson"}' | [
"Edit",
"a",
"Users",
"details"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/user/edit_details.py#L20-L43 | train |
softlayer/softlayer-python | SoftLayer/CLI/subnet/lookup.py | cli | def cli(env, ip_address):
"""Find an IP address and display its subnet and device info."""
mgr = SoftLayer.NetworkManager(env.client)
addr_info = mgr.ip_lookup(ip_address)
if not addr_info:
raise exceptions.CLIAbort('Not found')
table = formatting.KeyValueTable(['name', 'value'])
tab... | python | def cli(env, ip_address):
"""Find an IP address and display its subnet and device info."""
mgr = SoftLayer.NetworkManager(env.client)
addr_info = mgr.ip_lookup(ip_address)
if not addr_info:
raise exceptions.CLIAbort('Not found')
table = formatting.KeyValueTable(['name', 'value'])
tab... | [
"def",
"cli",
"(",
"env",
",",
"ip_address",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"NetworkManager",
"(",
"env",
".",
"client",
")",
"addr_info",
"=",
"mgr",
".",
"ip_lookup",
"(",
"ip_address",
")",
"if",
"not",
"addr_info",
":",
"raise",
"exceptions"... | Find an IP address and display its subnet and device info. | [
"Find",
"an",
"IP",
"address",
"and",
"display",
"its",
"subnet",
"and",
"device",
"info",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/subnet/lookup.py#L15-L60 | train |
softlayer/softlayer-python | SoftLayer/CLI/image/import.py | cli | def cli(env, name, note, os_code, uri, ibm_api_key, root_key_crn, wrapped_dek,
cloud_init, byol, is_encrypted):
"""Import an image.
The URI for an object storage object (.vhd/.iso file) of the format:
swift://<objectStorageAccount>@<cluster>/<container>/<objectPath>
or cos://<regionName>/<bucke... | python | def cli(env, name, note, os_code, uri, ibm_api_key, root_key_crn, wrapped_dek,
cloud_init, byol, is_encrypted):
"""Import an image.
The URI for an object storage object (.vhd/.iso file) of the format:
swift://<objectStorageAccount>@<cluster>/<container>/<objectPath>
or cos://<regionName>/<bucke... | [
"def",
"cli",
"(",
"env",
",",
"name",
",",
"note",
",",
"os_code",
",",
"uri",
",",
"ibm_api_key",
",",
"root_key_crn",
",",
"wrapped_dek",
",",
"cloud_init",
",",
"byol",
",",
"is_encrypted",
")",
":",
"image_mgr",
"=",
"SoftLayer",
".",
"ImageManager",
... | Import an image.
The URI for an object storage object (.vhd/.iso file) of the format:
swift://<objectStorageAccount>@<cluster>/<container>/<objectPath>
or cos://<regionName>/<bucketName>/<objectPath> if using IBM Cloud
Object Storage | [
"Import",
"an",
"image",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/image/import.py#L46-L80 | train |
softlayer/softlayer-python | SoftLayer/CLI/vpn/ipsec/update.py | cli | def cli(env, context_id, friendly_name, remote_peer, preshared_key,
phase1_auth, phase1_crypto, phase1_dh, phase1_key_ttl, phase2_auth,
phase2_crypto, phase2_dh, phase2_forward_secrecy, phase2_key_ttl):
"""Update tunnel context properties.
Updates are made atomically, so either all are accepted... | python | def cli(env, context_id, friendly_name, remote_peer, preshared_key,
phase1_auth, phase1_crypto, phase1_dh, phase1_key_ttl, phase2_auth,
phase2_crypto, phase2_dh, phase2_forward_secrecy, phase2_key_ttl):
"""Update tunnel context properties.
Updates are made atomically, so either all are accepted... | [
"def",
"cli",
"(",
"env",
",",
"context_id",
",",
"friendly_name",
",",
"remote_peer",
",",
"preshared_key",
",",
"phase1_auth",
",",
"phase1_crypto",
",",
"phase1_dh",
",",
"phase1_key_ttl",
",",
"phase2_auth",
",",
"phase2_crypto",
",",
"phase2_dh",
",",
"phas... | Update tunnel context properties.
Updates are made atomically, so either all are accepted or none are.
Key life values must be in the range 120-172800.
Phase 2 perfect forward secrecy must be in the range 0-1.
A separate configuration request should be made to realize changes on
network devices. | [
"Update",
"tunnel",
"context",
"properties",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/vpn/ipsec/update.py#L68-L101 | train |
softlayer/softlayer-python | SoftLayer/managers/ipsec.py | IPSECManager.add_internal_subnet | def add_internal_subnet(self, context_id, subnet_id):
"""Add an internal subnet to a tunnel context.
:param int context_id: The id-value representing the context instance.
:param int subnet_id: The id-value representing the internal subnet.
:return bool: True if internal subnet addition... | python | def add_internal_subnet(self, context_id, subnet_id):
"""Add an internal subnet to a tunnel context.
:param int context_id: The id-value representing the context instance.
:param int subnet_id: The id-value representing the internal subnet.
:return bool: True if internal subnet addition... | [
"def",
"add_internal_subnet",
"(",
"self",
",",
"context_id",
",",
"subnet_id",
")",
":",
"return",
"self",
".",
"context",
".",
"addPrivateSubnetToNetworkTunnel",
"(",
"subnet_id",
",",
"id",
"=",
"context_id",
")"
] | Add an internal subnet to a tunnel context.
:param int context_id: The id-value representing the context instance.
:param int subnet_id: The id-value representing the internal subnet.
:return bool: True if internal subnet addition was successful. | [
"Add",
"an",
"internal",
"subnet",
"to",
"a",
"tunnel",
"context",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/ipsec.py#L31-L39 | train |
softlayer/softlayer-python | SoftLayer/managers/ipsec.py | IPSECManager.add_remote_subnet | def add_remote_subnet(self, context_id, subnet_id):
"""Adds a remote subnet to a tunnel context.
:param int context_id: The id-value representing the context instance.
:param int subnet_id: The id-value representing the remote subnet.
:return bool: True if remote subnet addition was suc... | python | def add_remote_subnet(self, context_id, subnet_id):
"""Adds a remote subnet to a tunnel context.
:param int context_id: The id-value representing the context instance.
:param int subnet_id: The id-value representing the remote subnet.
:return bool: True if remote subnet addition was suc... | [
"def",
"add_remote_subnet",
"(",
"self",
",",
"context_id",
",",
"subnet_id",
")",
":",
"return",
"self",
".",
"context",
".",
"addCustomerSubnetToNetworkTunnel",
"(",
"subnet_id",
",",
"id",
"=",
"context_id",
")"
] | Adds a remote subnet to a tunnel context.
:param int context_id: The id-value representing the context instance.
:param int subnet_id: The id-value representing the remote subnet.
:return bool: True if remote subnet addition was successful. | [
"Adds",
"a",
"remote",
"subnet",
"to",
"a",
"tunnel",
"context",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/ipsec.py#L41-L49 | train |
softlayer/softlayer-python | SoftLayer/managers/ipsec.py | IPSECManager.add_service_subnet | def add_service_subnet(self, context_id, subnet_id):
"""Adds a service subnet to a tunnel context.
:param int context_id: The id-value representing the context instance.
:param int subnet_id: The id-value representing the service subnet.
:return bool: True if service subnet addition was... | python | def add_service_subnet(self, context_id, subnet_id):
"""Adds a service subnet to a tunnel context.
:param int context_id: The id-value representing the context instance.
:param int subnet_id: The id-value representing the service subnet.
:return bool: True if service subnet addition was... | [
"def",
"add_service_subnet",
"(",
"self",
",",
"context_id",
",",
"subnet_id",
")",
":",
"return",
"self",
".",
"context",
".",
"addServiceSubnetToNetworkTunnel",
"(",
"subnet_id",
",",
"id",
"=",
"context_id",
")"
] | Adds a service subnet to a tunnel context.
:param int context_id: The id-value representing the context instance.
:param int subnet_id: The id-value representing the service subnet.
:return bool: True if service subnet addition was successful. | [
"Adds",
"a",
"service",
"subnet",
"to",
"a",
"tunnel",
"context",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/ipsec.py#L51-L59 | train |
softlayer/softlayer-python | SoftLayer/managers/ipsec.py | IPSECManager.create_remote_subnet | def create_remote_subnet(self, account_id, identifier, cidr):
"""Creates a remote subnet on the given account.
:param string account_id: The account identifier.
:param string identifier: The network identifier of the remote subnet.
:param string cidr: The CIDR value of the remote subnet... | python | def create_remote_subnet(self, account_id, identifier, cidr):
"""Creates a remote subnet on the given account.
:param string account_id: The account identifier.
:param string identifier: The network identifier of the remote subnet.
:param string cidr: The CIDR value of the remote subnet... | [
"def",
"create_remote_subnet",
"(",
"self",
",",
"account_id",
",",
"identifier",
",",
"cidr",
")",
":",
"return",
"self",
".",
"remote_subnet",
".",
"createObject",
"(",
"{",
"'accountId'",
":",
"account_id",
",",
"'cidr'",
":",
"cidr",
",",
"'networkIdentifi... | Creates a remote subnet on the given account.
:param string account_id: The account identifier.
:param string identifier: The network identifier of the remote subnet.
:param string cidr: The CIDR value of the remote subnet.
:return dict: Mapping of properties for the new remote subnet. | [
"Creates",
"a",
"remote",
"subnet",
"on",
"the",
"given",
"account",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/ipsec.py#L69-L81 | train |
softlayer/softlayer-python | SoftLayer/managers/ipsec.py | IPSECManager.get_tunnel_context | def get_tunnel_context(self, context_id, **kwargs):
"""Retrieves the network tunnel context instance.
:param int context_id: The id-value representing the context instance.
:return dict: Mapping of properties for the tunnel context.
:raise SoftLayerAPIError: If a context cannot be found... | python | def get_tunnel_context(self, context_id, **kwargs):
"""Retrieves the network tunnel context instance.
:param int context_id: The id-value representing the context instance.
:return dict: Mapping of properties for the tunnel context.
:raise SoftLayerAPIError: If a context cannot be found... | [
"def",
"get_tunnel_context",
"(",
"self",
",",
"context_id",
",",
"**",
"kwargs",
")",
":",
"_filter",
"=",
"utils",
".",
"NestedDict",
"(",
"kwargs",
".",
"get",
"(",
"'filter'",
")",
"or",
"{",
"}",
")",
"_filter",
"[",
"'networkTunnelContexts'",
"]",
... | Retrieves the network tunnel context instance.
:param int context_id: The id-value representing the context instance.
:return dict: Mapping of properties for the tunnel context.
:raise SoftLayerAPIError: If a context cannot be found. | [
"Retrieves",
"the",
"network",
"tunnel",
"context",
"instance",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/ipsec.py#L108-L124 | train |
softlayer/softlayer-python | SoftLayer/managers/ipsec.py | IPSECManager.get_translation | def get_translation(self, context_id, translation_id):
"""Retrieves a translation entry for the given id values.
:param int context_id: The id-value representing the context instance.
:param int translation_id: The id-value representing the translation
instance.
:return d... | python | def get_translation(self, context_id, translation_id):
"""Retrieves a translation entry for the given id values.
:param int context_id: The id-value representing the context instance.
:param int translation_id: The id-value representing the translation
instance.
:return d... | [
"def",
"get_translation",
"(",
"self",
",",
"context_id",
",",
"translation_id",
")",
":",
"translation",
"=",
"next",
"(",
"(",
"x",
"for",
"x",
"in",
"self",
".",
"get_translations",
"(",
"context_id",
")",
"if",
"x",
"[",
"'id'",
"]",
"==",
"translati... | Retrieves a translation entry for the given id values.
:param int context_id: The id-value representing the context instance.
:param int translation_id: The id-value representing the translation
instance.
:return dict: Mapping of properties for the translation entry.
:rai... | [
"Retrieves",
"a",
"translation",
"entry",
"for",
"the",
"given",
"id",
"values",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/ipsec.py#L126-L141 | train |
softlayer/softlayer-python | SoftLayer/managers/ipsec.py | IPSECManager.get_translations | def get_translations(self, context_id):
"""Retrieves all translation entries for a tunnel context.
:param int context_id: The id-value representing the context instance.
:return list(dict): Translations associated with the given context
"""
_mask = ('[mask[addressTranslations[cu... | python | def get_translations(self, context_id):
"""Retrieves all translation entries for a tunnel context.
:param int context_id: The id-value representing the context instance.
:return list(dict): Translations associated with the given context
"""
_mask = ('[mask[addressTranslations[cu... | [
"def",
"get_translations",
"(",
"self",
",",
"context_id",
")",
":",
"_mask",
"=",
"(",
"'[mask[addressTranslations[customerIpAddressRecord,'",
"'internalIpAddressRecord]]]'",
")",
"context",
"=",
"self",
".",
"get_tunnel_context",
"(",
"context_id",
",",
"mask",
"=",
... | Retrieves all translation entries for a tunnel context.
:param int context_id: The id-value representing the context instance.
:return list(dict): Translations associated with the given context | [
"Retrieves",
"all",
"translation",
"entries",
"for",
"a",
"tunnel",
"context",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/ipsec.py#L143-L160 | train |
softlayer/softlayer-python | SoftLayer/managers/ipsec.py | IPSECManager.remove_internal_subnet | def remove_internal_subnet(self, context_id, subnet_id):
"""Remove an internal subnet from a tunnel context.
:param int context_id: The id-value representing the context instance.
:param int subnet_id: The id-value representing the internal subnet.
:return bool: True if internal subnet ... | python | def remove_internal_subnet(self, context_id, subnet_id):
"""Remove an internal subnet from a tunnel context.
:param int context_id: The id-value representing the context instance.
:param int subnet_id: The id-value representing the internal subnet.
:return bool: True if internal subnet ... | [
"def",
"remove_internal_subnet",
"(",
"self",
",",
"context_id",
",",
"subnet_id",
")",
":",
"return",
"self",
".",
"context",
".",
"removePrivateSubnetFromNetworkTunnel",
"(",
"subnet_id",
",",
"id",
"=",
"context_id",
")"
] | Remove an internal subnet from a tunnel context.
:param int context_id: The id-value representing the context instance.
:param int subnet_id: The id-value representing the internal subnet.
:return bool: True if internal subnet removal was successful. | [
"Remove",
"an",
"internal",
"subnet",
"from",
"a",
"tunnel",
"context",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/ipsec.py#L169-L177 | train |
softlayer/softlayer-python | SoftLayer/managers/ipsec.py | IPSECManager.remove_remote_subnet | def remove_remote_subnet(self, context_id, subnet_id):
"""Removes a remote subnet from a tunnel context.
:param int context_id: The id-value representing the context instance.
:param int subnet_id: The id-value representing the remote subnet.
:return bool: True if remote subnet removal ... | python | def remove_remote_subnet(self, context_id, subnet_id):
"""Removes a remote subnet from a tunnel context.
:param int context_id: The id-value representing the context instance.
:param int subnet_id: The id-value representing the remote subnet.
:return bool: True if remote subnet removal ... | [
"def",
"remove_remote_subnet",
"(",
"self",
",",
"context_id",
",",
"subnet_id",
")",
":",
"return",
"self",
".",
"context",
".",
"removeCustomerSubnetFromNetworkTunnel",
"(",
"subnet_id",
",",
"id",
"=",
"context_id",
")"
] | Removes a remote subnet from a tunnel context.
:param int context_id: The id-value representing the context instance.
:param int subnet_id: The id-value representing the remote subnet.
:return bool: True if remote subnet removal was successful. | [
"Removes",
"a",
"remote",
"subnet",
"from",
"a",
"tunnel",
"context",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/ipsec.py#L179-L187 | train |
softlayer/softlayer-python | SoftLayer/managers/ipsec.py | IPSECManager.remove_service_subnet | def remove_service_subnet(self, context_id, subnet_id):
"""Removes a service subnet from a tunnel context.
:param int context_id: The id-value representing the context instance.
:param int subnet_id: The id-value representing the service subnet.
:return bool: True if service subnet remo... | python | def remove_service_subnet(self, context_id, subnet_id):
"""Removes a service subnet from a tunnel context.
:param int context_id: The id-value representing the context instance.
:param int subnet_id: The id-value representing the service subnet.
:return bool: True if service subnet remo... | [
"def",
"remove_service_subnet",
"(",
"self",
",",
"context_id",
",",
"subnet_id",
")",
":",
"return",
"self",
".",
"context",
".",
"removeServiceSubnetFromNetworkTunnel",
"(",
"subnet_id",
",",
"id",
"=",
"context_id",
")"
] | Removes a service subnet from a tunnel context.
:param int context_id: The id-value representing the context instance.
:param int subnet_id: The id-value representing the service subnet.
:return bool: True if service subnet removal was successful. | [
"Removes",
"a",
"service",
"subnet",
"from",
"a",
"tunnel",
"context",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/ipsec.py#L189-L197 | train |
softlayer/softlayer-python | SoftLayer/managers/ipsec.py | IPSECManager.remove_translation | def remove_translation(self, context_id, translation_id):
"""Removes a translation entry from a tunnel context.
:param int context_id: The id-value representing the context instance.
:param int translation_id: The id-value representing the translation.
:return bool: True if translation ... | python | def remove_translation(self, context_id, translation_id):
"""Removes a translation entry from a tunnel context.
:param int context_id: The id-value representing the context instance.
:param int translation_id: The id-value representing the translation.
:return bool: True if translation ... | [
"def",
"remove_translation",
"(",
"self",
",",
"context_id",
",",
"translation_id",
")",
":",
"return",
"self",
".",
"context",
".",
"deleteAddressTranslation",
"(",
"translation_id",
",",
"id",
"=",
"context_id",
")"
] | Removes a translation entry from a tunnel context.
:param int context_id: The id-value representing the context instance.
:param int translation_id: The id-value representing the translation.
:return bool: True if translation entry removal was successful. | [
"Removes",
"a",
"translation",
"entry",
"from",
"a",
"tunnel",
"context",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/ipsec.py#L199-L207 | train |
softlayer/softlayer-python | SoftLayer/managers/ipsec.py | IPSECManager.update_translation | def update_translation(self, context_id, translation_id, static_ip=None,
remote_ip=None, notes=None):
"""Updates an address translation entry using the given values.
:param int context_id: The id-value representing the context instance.
:param dict template: A key-val... | python | def update_translation(self, context_id, translation_id, static_ip=None,
remote_ip=None, notes=None):
"""Updates an address translation entry using the given values.
:param int context_id: The id-value representing the context instance.
:param dict template: A key-val... | [
"def",
"update_translation",
"(",
"self",
",",
"context_id",
",",
"translation_id",
",",
"static_ip",
"=",
"None",
",",
"remote_ip",
"=",
"None",
",",
"notes",
"=",
"None",
")",
":",
"translation",
"=",
"self",
".",
"get_translation",
"(",
"context_id",
",",... | Updates an address translation entry using the given values.
:param int context_id: The id-value representing the context instance.
:param dict template: A key-value mapping of translation properties.
:param string static_ip: The static IP address value to update.
:param string remote_i... | [
"Updates",
"an",
"address",
"translation",
"entry",
"using",
"the",
"given",
"values",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/ipsec.py#L209-L231 | train |
softlayer/softlayer-python | SoftLayer/managers/ipsec.py | IPSECManager.update_tunnel_context | def update_tunnel_context(self, context_id, friendly_name=None,
remote_peer=None, preshared_key=None,
phase1_auth=None, phase1_crypto=None,
phase1_dh=None, phase1_key_ttl=None,
phase2_auth=None, phase... | python | def update_tunnel_context(self, context_id, friendly_name=None,
remote_peer=None, preshared_key=None,
phase1_auth=None, phase1_crypto=None,
phase1_dh=None, phase1_key_ttl=None,
phase2_auth=None, phase... | [
"def",
"update_tunnel_context",
"(",
"self",
",",
"context_id",
",",
"friendly_name",
"=",
"None",
",",
"remote_peer",
"=",
"None",
",",
"preshared_key",
"=",
"None",
",",
"phase1_auth",
"=",
"None",
",",
"phase1_crypto",
"=",
"None",
",",
"phase1_dh",
"=",
... | Updates a tunnel context using the given values.
:param string context_id: The id-value representing the context.
:param string friendly_name: The friendly name value to update.
:param string remote_peer: The remote peer IP address value to update.
:param string preshared_key: The presh... | [
"Updates",
"a",
"tunnel",
"context",
"using",
"the",
"given",
"values",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/ipsec.py#L233-L286 | train |
softlayer/softlayer-python | SoftLayer/CLI/object_storage/credential/create.py | cli | def cli(env, identifier):
"""Create credentials for an IBM Cloud Object Storage Account"""
mgr = SoftLayer.ObjectStorageManager(env.client)
credential = mgr.create_credential(identifier)
table = formatting.Table(['id', 'password', 'username', 'type_name'])
table.sortby = 'id'
table.add_row([
... | python | def cli(env, identifier):
"""Create credentials for an IBM Cloud Object Storage Account"""
mgr = SoftLayer.ObjectStorageManager(env.client)
credential = mgr.create_credential(identifier)
table = formatting.Table(['id', 'password', 'username', 'type_name'])
table.sortby = 'id'
table.add_row([
... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"ObjectStorageManager",
"(",
"env",
".",
"client",
")",
"credential",
"=",
"mgr",
".",
"create_credential",
"(",
"identifier",
")",
"table",
"=",
"formatting",
".",
"Table... | Create credentials for an IBM Cloud Object Storage Account | [
"Create",
"credentials",
"for",
"an",
"IBM",
"Cloud",
"Object",
"Storage",
"Account"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/object_storage/credential/create.py#L14-L28 | train |
softlayer/softlayer-python | SoftLayer/CLI/image/list.py | cli | def cli(env, name, public):
"""List images."""
image_mgr = SoftLayer.ImageManager(env.client)
images = []
if public in [False, None]:
for image in image_mgr.list_private_images(name=name,
mask=image_mod.MASK):
images.append(image)
... | python | def cli(env, name, public):
"""List images."""
image_mgr = SoftLayer.ImageManager(env.client)
images = []
if public in [False, None]:
for image in image_mgr.list_private_images(name=name,
mask=image_mod.MASK):
images.append(image)
... | [
"def",
"cli",
"(",
"env",
",",
"name",
",",
"public",
")",
":",
"image_mgr",
"=",
"SoftLayer",
".",
"ImageManager",
"(",
"env",
".",
"client",
")",
"images",
"=",
"[",
"]",
"if",
"public",
"in",
"[",
"False",
",",
"None",
"]",
":",
"for",
"image",
... | List images. | [
"List",
"images",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/image/list.py#L20-L58 | train |
softlayer/softlayer-python | SoftLayer/CLI/vpn/ipsec/subnet/add.py | cli | def cli(env, context_id, subnet_id, subnet_type, network_identifier):
"""Add a subnet to an IPSEC tunnel context.
A subnet id may be specified to link to the existing tunnel context.
Otherwise, a network identifier in CIDR notation should be specified,
indicating that a subnet resource should first be... | python | def cli(env, context_id, subnet_id, subnet_type, network_identifier):
"""Add a subnet to an IPSEC tunnel context.
A subnet id may be specified to link to the existing tunnel context.
Otherwise, a network identifier in CIDR notation should be specified,
indicating that a subnet resource should first be... | [
"def",
"cli",
"(",
"env",
",",
"context_id",
",",
"subnet_id",
",",
"subnet_type",
",",
"network_identifier",
")",
":",
"create_remote",
"=",
"False",
"if",
"subnet_id",
"is",
"None",
":",
"if",
"network_identifier",
"is",
"None",
":",
"raise",
"ArgumentError"... | Add a subnet to an IPSEC tunnel context.
A subnet id may be specified to link to the existing tunnel context.
Otherwise, a network identifier in CIDR notation should be specified,
indicating that a subnet resource should first be created before associating
it with the tunnel context. Note that this is... | [
"Add",
"a",
"subnet",
"to",
"an",
"IPSEC",
"tunnel",
"context",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/vpn/ipsec/subnet/add.py#L33-L81 | train |
softlayer/softlayer-python | SoftLayer/CLI/virt/placementgroup/list.py | cli | def cli(env):
"""List placement groups."""
manager = PlacementManager(env.client)
result = manager.list()
table = formatting.Table(
["Id", "Name", "Backend Router", "Rule", "Guests", "Created"],
title="Placement Groups"
)
for group in result:
table.add_row([
g... | python | def cli(env):
"""List placement groups."""
manager = PlacementManager(env.client)
result = manager.list()
table = formatting.Table(
["Id", "Name", "Backend Router", "Rule", "Guests", "Created"],
title="Placement Groups"
)
for group in result:
table.add_row([
g... | [
"def",
"cli",
"(",
"env",
")",
":",
"manager",
"=",
"PlacementManager",
"(",
"env",
".",
"client",
")",
"result",
"=",
"manager",
".",
"list",
"(",
")",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"\"Id\"",
",",
"\"Name\"",
",",
"\"Backend Rout... | List placement groups. | [
"List",
"placement",
"groups",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/placementgroup/list.py#L12-L30 | train |
softlayer/softlayer-python | SoftLayer/CLI/account/events.py | cli | def cli(env, ack_all):
"""Summary and acknowledgement of upcoming and ongoing maintenance events"""
manager = AccountManager(env.client)
events = manager.get_upcoming_events()
if ack_all:
for event in events:
result = manager.ack_event(event['id'])
event['acknowledgedFl... | python | def cli(env, ack_all):
"""Summary and acknowledgement of upcoming and ongoing maintenance events"""
manager = AccountManager(env.client)
events = manager.get_upcoming_events()
if ack_all:
for event in events:
result = manager.ack_event(event['id'])
event['acknowledgedFl... | [
"def",
"cli",
"(",
"env",
",",
"ack_all",
")",
":",
"manager",
"=",
"AccountManager",
"(",
"env",
".",
"client",
")",
"events",
"=",
"manager",
".",
"get_upcoming_events",
"(",
")",
"if",
"ack_all",
":",
"for",
"event",
"in",
"events",
":",
"result",
"... | Summary and acknowledgement of upcoming and ongoing maintenance events | [
"Summary",
"and",
"acknowledgement",
"of",
"upcoming",
"and",
"ongoing",
"maintenance",
"events"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/account/events.py#L15-L25 | train |
softlayer/softlayer-python | SoftLayer/CLI/account/events.py | event_table | def event_table(events):
"""Formats a table for events"""
table = formatting.Table([
"Id",
"Start Date",
"End Date",
"Subject",
"Status",
"Acknowledged",
"Updates",
"Impacted Resources"
], title="Upcoming Events")
table.align['Subject'] = '... | python | def event_table(events):
"""Formats a table for events"""
table = formatting.Table([
"Id",
"Start Date",
"End Date",
"Subject",
"Status",
"Acknowledged",
"Updates",
"Impacted Resources"
], title="Upcoming Events")
table.align['Subject'] = '... | [
"def",
"event_table",
"(",
"events",
")",
":",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"\"Id\"",
",",
"\"Start Date\"",
",",
"\"End Date\"",
",",
"\"Subject\"",
",",
"\"Status\"",
",",
"\"Acknowledged\"",
",",
"\"Updates\"",
",",
"\"Impacted Resource... | Formats a table for events | [
"Formats",
"a",
"table",
"for",
"events"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/account/events.py#L28-L54 | train |
softlayer/softlayer-python | SoftLayer/CLI/block/access/password.py | cli | def cli(env, access_id, password):
"""Changes a password for a volume's access.
access id is the allowed_host_id from slcli block access-list
"""
block_manager = SoftLayer.BlockStorageManager(env.client)
result = block_manager.set_credential_password(access_id=access_id, password=password)
i... | python | def cli(env, access_id, password):
"""Changes a password for a volume's access.
access id is the allowed_host_id from slcli block access-list
"""
block_manager = SoftLayer.BlockStorageManager(env.client)
result = block_manager.set_credential_password(access_id=access_id, password=password)
i... | [
"def",
"cli",
"(",
"env",
",",
"access_id",
",",
"password",
")",
":",
"block_manager",
"=",
"SoftLayer",
".",
"BlockStorageManager",
"(",
"env",
".",
"client",
")",
"result",
"=",
"block_manager",
".",
"set_credential_password",
"(",
"access_id",
"=",
"access... | Changes a password for a volume's access.
access id is the allowed_host_id from slcli block access-list | [
"Changes",
"a",
"password",
"for",
"a",
"volume",
"s",
"access",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/block/access/password.py#L14-L27 | train |
softlayer/softlayer-python | SoftLayer/CLI/cdn/detail.py | cli | def cli(env, account_id):
"""Detail a CDN Account."""
manager = SoftLayer.CDNManager(env.client)
account = manager.get_account(account_id)
table = formatting.KeyValueTable(['name', 'value'])
table.align['name'] = 'r'
table.align['value'] = 'l'
table.add_row(['id', account['id']])
tabl... | python | def cli(env, account_id):
"""Detail a CDN Account."""
manager = SoftLayer.CDNManager(env.client)
account = manager.get_account(account_id)
table = formatting.KeyValueTable(['name', 'value'])
table.align['name'] = 'r'
table.align['value'] = 'l'
table.add_row(['id', account['id']])
tabl... | [
"def",
"cli",
"(",
"env",
",",
"account_id",
")",
":",
"manager",
"=",
"SoftLayer",
".",
"CDNManager",
"(",
"env",
".",
"client",
")",
"account",
"=",
"manager",
".",
"get_account",
"(",
"account_id",
")",
"table",
"=",
"formatting",
".",
"KeyValueTable",
... | Detail a CDN Account. | [
"Detail",
"a",
"CDN",
"Account",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/cdn/detail.py#L14-L32 | train |
softlayer/softlayer-python | SoftLayer/utils.py | lookup | def lookup(dic, key, *keys):
"""A generic dictionary access helper.
This helps simplify code that uses heavily nested dictionaries. It will
return None if any of the keys in *keys do not exist.
::
>>> lookup({'this': {'is': 'nested'}}, 'this', 'is')
nested
>>> lookup({}, 'thi... | python | def lookup(dic, key, *keys):
"""A generic dictionary access helper.
This helps simplify code that uses heavily nested dictionaries. It will
return None if any of the keys in *keys do not exist.
::
>>> lookup({'this': {'is': 'nested'}}, 'this', 'is')
nested
>>> lookup({}, 'thi... | [
"def",
"lookup",
"(",
"dic",
",",
"key",
",",
"*",
"keys",
")",
":",
"if",
"keys",
":",
"return",
"lookup",
"(",
"dic",
".",
"get",
"(",
"key",
",",
"{",
"}",
")",
",",
"keys",
"[",
"0",
"]",
",",
"*",
"keys",
"[",
"1",
":",
"]",
")",
"re... | A generic dictionary access helper.
This helps simplify code that uses heavily nested dictionaries. It will
return None if any of the keys in *keys do not exist.
::
>>> lookup({'this': {'is': 'nested'}}, 'this', 'is')
nested
>>> lookup({}, 'this', 'is')
None | [
"A",
"generic",
"dictionary",
"access",
"helper",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/utils.py#L24-L41 | train |
softlayer/softlayer-python | SoftLayer/utils.py | query_filter | def query_filter(query):
"""Translate a query-style string to a 'filter'.
Query can be the following formats:
Case Insensitive
'value' OR '*= value' Contains
'value*' OR '^= value' Begins with value
'*value' OR '$= value' Ends with value
'*value*' OR '_= value' Contains val... | python | def query_filter(query):
"""Translate a query-style string to a 'filter'.
Query can be the following formats:
Case Insensitive
'value' OR '*= value' Contains
'value*' OR '^= value' Begins with value
'*value' OR '$= value' Ends with value
'*value*' OR '_= value' Contains val... | [
"def",
"query_filter",
"(",
"query",
")",
":",
"try",
":",
"return",
"{",
"'operation'",
":",
"int",
"(",
"query",
")",
"}",
"except",
"ValueError",
":",
"pass",
"if",
"isinstance",
"(",
"query",
",",
"string_types",
")",
":",
"query",
"=",
"query",
".... | Translate a query-style string to a 'filter'.
Query can be the following formats:
Case Insensitive
'value' OR '*= value' Contains
'value*' OR '^= value' Begins with value
'*value' OR '$= value' Ends with value
'*value*' OR '_= value' Contains value
Case Sensitive
'~ ... | [
"Translate",
"a",
"query",
"-",
"style",
"string",
"to",
"a",
"filter",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/utils.py#L66-L108 | train |
softlayer/softlayer-python | SoftLayer/utils.py | query_filter_date | def query_filter_date(start, end):
"""Query filters given start and end date.
:param start:YY-MM-DD
:param end: YY-MM-DD
"""
sdate = datetime.datetime.strptime(start, "%Y-%m-%d")
edate = datetime.datetime.strptime(end, "%Y-%m-%d")
startdate = "%s/%s/%s" % (sdate.month, sdate.day, sdate.year... | python | def query_filter_date(start, end):
"""Query filters given start and end date.
:param start:YY-MM-DD
:param end: YY-MM-DD
"""
sdate = datetime.datetime.strptime(start, "%Y-%m-%d")
edate = datetime.datetime.strptime(end, "%Y-%m-%d")
startdate = "%s/%s/%s" % (sdate.month, sdate.day, sdate.year... | [
"def",
"query_filter_date",
"(",
"start",
",",
"end",
")",
":",
"sdate",
"=",
"datetime",
".",
"datetime",
".",
"strptime",
"(",
"start",
",",
"\"%Y-%m-%d\"",
")",
"edate",
"=",
"datetime",
".",
"datetime",
".",
"strptime",
"(",
"end",
",",
"\"%Y-%m-%d\"",... | Query filters given start and end date.
:param start:YY-MM-DD
:param end: YY-MM-DD | [
"Query",
"filters",
"given",
"start",
"and",
"end",
"date",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/utils.py#L111-L127 | train |
softlayer/softlayer-python | SoftLayer/utils.py | format_event_log_date | def format_event_log_date(date_string, utc):
"""Gets a date in the format that the SoftLayer_EventLog object likes.
:param string date_string: date in mm/dd/yyyy format
:param string utc: utc offset. Defaults to '+0000'
"""
user_date_format = "%m/%d/%Y"
user_date = datetime.datetime.strptime(d... | python | def format_event_log_date(date_string, utc):
"""Gets a date in the format that the SoftLayer_EventLog object likes.
:param string date_string: date in mm/dd/yyyy format
:param string utc: utc offset. Defaults to '+0000'
"""
user_date_format = "%m/%d/%Y"
user_date = datetime.datetime.strptime(d... | [
"def",
"format_event_log_date",
"(",
"date_string",
",",
"utc",
")",
":",
"user_date_format",
"=",
"\"%m/%d/%Y\"",
"user_date",
"=",
"datetime",
".",
"datetime",
".",
"strptime",
"(",
"date_string",
",",
"user_date_format",
")",
"dirty_time",
"=",
"user_date",
"."... | Gets a date in the format that the SoftLayer_EventLog object likes.
:param string date_string: date in mm/dd/yyyy format
:param string utc: utc offset. Defaults to '+0000' | [
"Gets",
"a",
"date",
"in",
"the",
"format",
"that",
"the",
"SoftLayer_EventLog",
"object",
"likes",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/utils.py#L130-L147 | train |
softlayer/softlayer-python | SoftLayer/utils.py | event_log_filter_between_date | def event_log_filter_between_date(start, end, utc):
"""betweenDate Query filter that SoftLayer_EventLog likes
:param string start: lower bound date in mm/dd/yyyy format
:param string end: upper bound date in mm/dd/yyyy format
:param string utc: utc offset. Defaults to '+0000'
"""
return {
... | python | def event_log_filter_between_date(start, end, utc):
"""betweenDate Query filter that SoftLayer_EventLog likes
:param string start: lower bound date in mm/dd/yyyy format
:param string end: upper bound date in mm/dd/yyyy format
:param string utc: utc offset. Defaults to '+0000'
"""
return {
... | [
"def",
"event_log_filter_between_date",
"(",
"start",
",",
"end",
",",
"utc",
")",
":",
"return",
"{",
"'operation'",
":",
"'betweenDate'",
",",
"'options'",
":",
"[",
"{",
"'name'",
":",
"'startDate'",
",",
"'value'",
":",
"[",
"format_event_log_date",
"(",
... | betweenDate Query filter that SoftLayer_EventLog likes
:param string start: lower bound date in mm/dd/yyyy format
:param string end: upper bound date in mm/dd/yyyy format
:param string utc: utc offset. Defaults to '+0000' | [
"betweenDate",
"Query",
"filter",
"that",
"SoftLayer_EventLog",
"likes"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/utils.py#L150-L163 | train |
softlayer/softlayer-python | SoftLayer/utils.py | resolve_ids | def resolve_ids(identifier, resolvers):
"""Resolves IDs given a list of functions.
:param string identifier: identifier string
:param list resolvers: a list of functions
:returns list:
"""
# Before doing anything, let's see if this is an integer
try:
return [int(identifier)]
ex... | python | def resolve_ids(identifier, resolvers):
"""Resolves IDs given a list of functions.
:param string identifier: identifier string
:param list resolvers: a list of functions
:returns list:
"""
# Before doing anything, let's see if this is an integer
try:
return [int(identifier)]
ex... | [
"def",
"resolve_ids",
"(",
"identifier",
",",
"resolvers",
")",
":",
"try",
":",
"return",
"[",
"int",
"(",
"identifier",
")",
"]",
"except",
"ValueError",
":",
"pass",
"if",
"len",
"(",
"identifier",
")",
"==",
"36",
"and",
"UUID_RE",
".",
"match",
"(... | Resolves IDs given a list of functions.
:param string identifier: identifier string
:param list resolvers: a list of functions
:returns list: | [
"Resolves",
"IDs",
"given",
"a",
"list",
"of",
"functions",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/utils.py#L215-L238 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.