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/CLI/config/setup.py | get_api_key | def get_api_key(client, username, secret):
"""Attempts API-Key and password auth to get an API key.
This will also generate an API key if one doesn't exist
"""
# Try to use a client with username/api key
if len(secret) == 64:
try:
client['Account'].getCurrentUser()
... | python | def get_api_key(client, username, secret):
"""Attempts API-Key and password auth to get an API key.
This will also generate an API key if one doesn't exist
"""
# Try to use a client with username/api key
if len(secret) == 64:
try:
client['Account'].getCurrentUser()
... | [
"def",
"get_api_key",
"(",
"client",
",",
"username",
",",
"secret",
")",
":",
"if",
"len",
"(",
"secret",
")",
"==",
"64",
":",
"try",
":",
"client",
"[",
"'Account'",
"]",
".",
"getCurrentUser",
"(",
")",
"return",
"secret",
"except",
"SoftLayer",
".... | Attempts API-Key and password auth to get an API key.
This will also generate an API key if one doesn't exist | [
"Attempts",
"API",
"-",
"Key",
"and",
"password",
"auth",
"to",
"get",
"an",
"API",
"key",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/config/setup.py#L15-L37 | train |
softlayer/softlayer-python | SoftLayer/CLI/config/setup.py | cli | def cli(env):
"""Edit configuration."""
username, secret, endpoint_url, timeout = get_user_input(env)
new_client = SoftLayer.Client(username=username, api_key=secret, endpoint_url=endpoint_url, timeout=timeout)
api_key = get_api_key(new_client, username, secret)
path = '~/.softlayer'
if env.co... | python | def cli(env):
"""Edit configuration."""
username, secret, endpoint_url, timeout = get_user_input(env)
new_client = SoftLayer.Client(username=username, api_key=secret, endpoint_url=endpoint_url, timeout=timeout)
api_key = get_api_key(new_client, username, secret)
path = '~/.softlayer'
if env.co... | [
"def",
"cli",
"(",
"env",
")",
":",
"username",
",",
"secret",
",",
"endpoint_url",
",",
"timeout",
"=",
"get_user_input",
"(",
"env",
")",
"new_client",
"=",
"SoftLayer",
".",
"Client",
"(",
"username",
"=",
"username",
",",
"api_key",
"=",
"secret",
",... | Edit configuration. | [
"Edit",
"configuration",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/config/setup.py#L42-L86 | train |
softlayer/softlayer-python | SoftLayer/CLI/dedicatedhost/create_options.py | cli | def cli(env, **kwargs):
"""host order options for a given dedicated host.
To get a list of available backend routers see example:
slcli dh create-options --datacenter dal05 --flavor 56_CORES_X_242_RAM_X_1_4_TB
"""
mgr = SoftLayer.DedicatedHostManager(env.client)
tables = []
if not kwargs[... | python | def cli(env, **kwargs):
"""host order options for a given dedicated host.
To get a list of available backend routers see example:
slcli dh create-options --datacenter dal05 --flavor 56_CORES_X_242_RAM_X_1_4_TB
"""
mgr = SoftLayer.DedicatedHostManager(env.client)
tables = []
if not kwargs[... | [
"def",
"cli",
"(",
"env",
",",
"**",
"kwargs",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"DedicatedHostManager",
"(",
"env",
".",
"client",
")",
"tables",
"=",
"[",
"]",
"if",
"not",
"kwargs",
"[",
"'flavor'",
"]",
"and",
"not",
"kwargs",
"[",
"'datace... | host order options for a given dedicated host.
To get a list of available backend routers see example:
slcli dh create-options --datacenter dal05 --flavor 56_CORES_X_242_RAM_X_1_4_TB | [
"host",
"order",
"options",
"for",
"a",
"given",
"dedicated",
"host",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/dedicatedhost/create_options.py#L22-L61 | train |
softlayer/softlayer-python | SoftLayer/CLI/hardware/cancel_reasons.py | cli | def cli(env):
"""Display a list of cancellation reasons."""
table = formatting.Table(['Code', 'Reason'])
table.align['Code'] = 'r'
table.align['Reason'] = 'l'
mgr = SoftLayer.HardwareManager(env.client)
for code, reason in mgr.get_cancellation_reasons().items():
table.add_row([code, r... | python | def cli(env):
"""Display a list of cancellation reasons."""
table = formatting.Table(['Code', 'Reason'])
table.align['Code'] = 'r'
table.align['Reason'] = 'l'
mgr = SoftLayer.HardwareManager(env.client)
for code, reason in mgr.get_cancellation_reasons().items():
table.add_row([code, r... | [
"def",
"cli",
"(",
"env",
")",
":",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"'Code'",
",",
"'Reason'",
"]",
")",
"table",
".",
"align",
"[",
"'Code'",
"]",
"=",
"'r'",
"table",
".",
"align",
"[",
"'Reason'",
"]",
"=",
"'l'",
"mgr",
"=... | Display a list of cancellation reasons. | [
"Display",
"a",
"list",
"of",
"cancellation",
"reasons",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/hardware/cancel_reasons.py#L13-L25 | train |
softlayer/softlayer-python | SoftLayer/CLI/vpn/ipsec/list.py | cli | def cli(env):
"""List IPSec VPN tunnel contexts"""
manager = SoftLayer.IPSECManager(env.client)
contexts = manager.get_tunnel_contexts()
table = formatting.Table(['id',
'name',
'friendly name',
'internal peer IP a... | python | def cli(env):
"""List IPSec VPN tunnel contexts"""
manager = SoftLayer.IPSECManager(env.client)
contexts = manager.get_tunnel_contexts()
table = formatting.Table(['id',
'name',
'friendly name',
'internal peer IP a... | [
"def",
"cli",
"(",
"env",
")",
":",
"manager",
"=",
"SoftLayer",
".",
"IPSECManager",
"(",
"env",
".",
"client",
")",
"contexts",
"=",
"manager",
".",
"get_tunnel_contexts",
"(",
")",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"'id'",
",",
"'n... | List IPSec VPN tunnel contexts | [
"List",
"IPSec",
"VPN",
"tunnel",
"contexts"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/vpn/ipsec/list.py#L13-L31 | train |
softlayer/softlayer-python | SoftLayer/CLI/file/replication/locations.py | cli | def cli(env, columns, sortby, volume_id):
"""List suitable replication datacenters for the given volume."""
file_storage_manager = SoftLayer.FileStorageManager(env.client)
legal_centers = file_storage_manager.get_replication_locations(
volume_id
)
if not legal_centers:
click.echo("... | python | def cli(env, columns, sortby, volume_id):
"""List suitable replication datacenters for the given volume."""
file_storage_manager = SoftLayer.FileStorageManager(env.client)
legal_centers = file_storage_manager.get_replication_locations(
volume_id
)
if not legal_centers:
click.echo("... | [
"def",
"cli",
"(",
"env",
",",
"columns",
",",
"sortby",
",",
"volume_id",
")",
":",
"file_storage_manager",
"=",
"SoftLayer",
".",
"FileStorageManager",
"(",
"env",
".",
"client",
")",
"legal_centers",
"=",
"file_storage_manager",
".",
"get_replication_locations"... | List suitable replication datacenters for the given volume. | [
"List",
"suitable",
"replication",
"datacenters",
"for",
"the",
"given",
"volume",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/file/replication/locations.py#L32-L49 | train |
softlayer/softlayer-python | SoftLayer/CLI/dedicatedhost/list_guests.py | cli | def cli(env, identifier, sortby, cpu, domain, hostname, memory, tag, columns):
"""List guests which are in a dedicated host server."""
mgr = SoftLayer.DedicatedHostManager(env.client)
guests = mgr.list_guests(host_id=identifier,
cpus=cpu,
hostname=h... | python | def cli(env, identifier, sortby, cpu, domain, hostname, memory, tag, columns):
"""List guests which are in a dedicated host server."""
mgr = SoftLayer.DedicatedHostManager(env.client)
guests = mgr.list_guests(host_id=identifier,
cpus=cpu,
hostname=h... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
",",
"sortby",
",",
"cpu",
",",
"domain",
",",
"hostname",
",",
"memory",
",",
"tag",
",",
"columns",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"DedicatedHostManager",
"(",
"env",
".",
"client",
")",
"guests",... | List guests which are in a dedicated host server. | [
"List",
"guests",
"which",
"are",
"in",
"a",
"dedicated",
"host",
"server",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/dedicatedhost/list_guests.py#L57-L76 | train |
softlayer/softlayer-python | SoftLayer/CLI/ticket/detail.py | cli | def cli(env, identifier, count):
"""Get details for a ticket."""
mgr = SoftLayer.TicketManager(env.client)
ticket_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'ticket')
env.fout(ticket.get_ticket_results(mgr, ticket_id, update_count=count)) | python | def cli(env, identifier, count):
"""Get details for a ticket."""
mgr = SoftLayer.TicketManager(env.client)
ticket_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'ticket')
env.fout(ticket.get_ticket_results(mgr, ticket_id, update_count=count)) | [
"def",
"cli",
"(",
"env",
",",
"identifier",
",",
"count",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"TicketManager",
"(",
"env",
".",
"client",
")",
"ticket_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"mgr",
".",
"resolve_ids",
",",
"identifier",
",",
... | Get details for a ticket. | [
"Get",
"details",
"for",
"a",
"ticket",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/ticket/detail.py#L20-L26 | train |
softlayer/softlayer-python | SoftLayer/transports.py | get_session | def get_session(user_agent):
"""Sets up urllib sessions"""
client = requests.Session()
client.headers.update({
'Content-Type': 'application/json',
'User-Agent': user_agent,
})
retry = Retry(connect=3, backoff_factor=3)
adapter = HTTPAdapter(max_retries=retry)
client.mount('h... | python | def get_session(user_agent):
"""Sets up urllib sessions"""
client = requests.Session()
client.headers.update({
'Content-Type': 'application/json',
'User-Agent': user_agent,
})
retry = Retry(connect=3, backoff_factor=3)
adapter = HTTPAdapter(max_retries=retry)
client.mount('h... | [
"def",
"get_session",
"(",
"user_agent",
")",
":",
"client",
"=",
"requests",
".",
"Session",
"(",
")",
"client",
".",
"headers",
".",
"update",
"(",
"{",
"'Content-Type'",
":",
"'application/json'",
",",
"'User-Agent'",
":",
"user_agent",
",",
"}",
")",
"... | Sets up urllib sessions | [
"Sets",
"up",
"urllib",
"sessions"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/transports.py#L45-L56 | train |
softlayer/softlayer-python | SoftLayer/transports.py | _format_object_mask | def _format_object_mask(objectmask):
"""Format the new style object mask.
This wraps the user mask with mask[USER_MASK] if it does not already
have one. This makes it slightly easier for users.
:param objectmask: a string-based object mask
"""
objectmask = objectmask.strip()
if (not obje... | python | def _format_object_mask(objectmask):
"""Format the new style object mask.
This wraps the user mask with mask[USER_MASK] if it does not already
have one. This makes it slightly easier for users.
:param objectmask: a string-based object mask
"""
objectmask = objectmask.strip()
if (not obje... | [
"def",
"_format_object_mask",
"(",
"objectmask",
")",
":",
"objectmask",
"=",
"objectmask",
".",
"strip",
"(",
")",
"if",
"(",
"not",
"objectmask",
".",
"startswith",
"(",
"'mask'",
")",
"and",
"not",
"objectmask",
".",
"startswith",
"(",
"'['",
")",
")",
... | Format the new style object mask.
This wraps the user mask with mask[USER_MASK] if it does not already
have one. This makes it slightly easier for users.
:param objectmask: a string-based object mask | [
"Format",
"the",
"new",
"style",
"object",
"mask",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/transports.py#L544-L558 | train |
softlayer/softlayer-python | SoftLayer/transports.py | XmlRpcTransport.client | def client(self):
"""Returns client session object"""
if self._client is None:
self._client = get_session(self.user_agent)
return self._client | python | def client(self):
"""Returns client session object"""
if self._client is None:
self._client = get_session(self.user_agent)
return self._client | [
"def",
"client",
"(",
"self",
")",
":",
"if",
"self",
".",
"_client",
"is",
"None",
":",
"self",
".",
"_client",
"=",
"get_session",
"(",
"self",
".",
"user_agent",
")",
"return",
"self",
".",
"_client"
] | Returns client session object | [
"Returns",
"client",
"session",
"object"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/transports.py#L158-L163 | train |
softlayer/softlayer-python | SoftLayer/CLI/hardware/toggle_ipmi.py | cli | def cli(env, identifier, enable):
"""Toggle the IPMI interface on and off"""
mgr = SoftLayer.HardwareManager(env.client)
hw_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'hardware')
result = env.client['Hardware_Server'].toggleManagementInterface(enable, id=hw_id)
env.fout(result) | python | def cli(env, identifier, enable):
"""Toggle the IPMI interface on and off"""
mgr = SoftLayer.HardwareManager(env.client)
hw_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'hardware')
result = env.client['Hardware_Server'].toggleManagementInterface(enable, id=hw_id)
env.fout(result) | [
"def",
"cli",
"(",
"env",
",",
"identifier",
",",
"enable",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"HardwareManager",
"(",
"env",
".",
"client",
")",
"hw_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"mgr",
".",
"resolve_ids",
",",
"identifier",
",",
"... | Toggle the IPMI interface on and off | [
"Toggle",
"the",
"IPMI",
"interface",
"on",
"and",
"off"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/hardware/toggle_ipmi.py#L16-L22 | train |
softlayer/softlayer-python | SoftLayer/CLI/dns/record_remove.py | cli | def cli(env, record_id):
"""Remove resource record."""
manager = SoftLayer.DNSManager(env.client)
if not (env.skip_confirmations or formatting.no_going_back('yes')):
raise exceptions.CLIAbort("Aborted.")
manager.delete_record(record_id) | python | def cli(env, record_id):
"""Remove resource record."""
manager = SoftLayer.DNSManager(env.client)
if not (env.skip_confirmations or formatting.no_going_back('yes')):
raise exceptions.CLIAbort("Aborted.")
manager.delete_record(record_id) | [
"def",
"cli",
"(",
"env",
",",
"record_id",
")",
":",
"manager",
"=",
"SoftLayer",
".",
"DNSManager",
"(",
"env",
".",
"client",
")",
"if",
"not",
"(",
"env",
".",
"skip_confirmations",
"or",
"formatting",
".",
"no_going_back",
"(",
"'yes'",
")",
")",
... | Remove resource record. | [
"Remove",
"resource",
"record",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/dns/record_remove.py#L15-L23 | train |
softlayer/softlayer-python | SoftLayer/CLI/block/count.py | cli | def cli(env, sortby, datacenter):
"""List number of block storage volumes per datacenter."""
block_manager = SoftLayer.BlockStorageManager(env.client)
mask = "mask[serviceResource[datacenter[name]],"\
"replicationPartners[serviceResource[datacenter[name]]]]"
block_volumes = block_manager.list... | python | def cli(env, sortby, datacenter):
"""List number of block storage volumes per datacenter."""
block_manager = SoftLayer.BlockStorageManager(env.client)
mask = "mask[serviceResource[datacenter[name]],"\
"replicationPartners[serviceResource[datacenter[name]]]]"
block_volumes = block_manager.list... | [
"def",
"cli",
"(",
"env",
",",
"sortby",
",",
"datacenter",
")",
":",
"block_manager",
"=",
"SoftLayer",
".",
"BlockStorageManager",
"(",
"env",
".",
"client",
")",
"mask",
"=",
"\"mask[serviceResource[datacenter[name]],\"",
"\"replicationPartners[serviceResource[datace... | List number of block storage volumes per datacenter. | [
"List",
"number",
"of",
"block",
"storage",
"volumes",
"per",
"datacenter",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/block/count.py#L19-L42 | train |
softlayer/softlayer-python | SoftLayer/CLI/cdn/load.py | cli | def cli(env, account_id, content_url):
"""Cache one or more files on all edge nodes."""
manager = SoftLayer.CDNManager(env.client)
manager.load_content(account_id, content_url) | python | def cli(env, account_id, content_url):
"""Cache one or more files on all edge nodes."""
manager = SoftLayer.CDNManager(env.client)
manager.load_content(account_id, content_url) | [
"def",
"cli",
"(",
"env",
",",
"account_id",
",",
"content_url",
")",
":",
"manager",
"=",
"SoftLayer",
".",
"CDNManager",
"(",
"env",
".",
"client",
")",
"manager",
".",
"load_content",
"(",
"account_id",
",",
"content_url",
")"
] | Cache one or more files on all edge nodes. | [
"Cache",
"one",
"or",
"more",
"files",
"on",
"all",
"edge",
"nodes",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/cdn/load.py#L14-L18 | train |
softlayer/softlayer-python | SoftLayer/CLI/vlan/detail.py | cli | def cli(env, identifier, no_vs, no_hardware):
"""Get details about a VLAN."""
mgr = SoftLayer.NetworkManager(env.client)
vlan_id = helpers.resolve_id(mgr.resolve_vlan_ids, identifier, 'VLAN')
vlan = mgr.get_vlan(vlan_id)
table = formatting.KeyValueTable(['name', 'value'])
table.align['name'] ... | python | def cli(env, identifier, no_vs, no_hardware):
"""Get details about a VLAN."""
mgr = SoftLayer.NetworkManager(env.client)
vlan_id = helpers.resolve_id(mgr.resolve_vlan_ids, identifier, 'VLAN')
vlan = mgr.get_vlan(vlan_id)
table = formatting.KeyValueTable(['name', 'value'])
table.align['name'] ... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
",",
"no_vs",
",",
"no_hardware",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"NetworkManager",
"(",
"env",
".",
"client",
")",
"vlan_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"mgr",
".",
"resolve_vlan_ids",
",... | Get details about a VLAN. | [
"Get",
"details",
"about",
"a",
"VLAN",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/vlan/detail.py#L21-L83 | train |
softlayer/softlayer-python | SoftLayer/CLI/block/lun.py | cli | def cli(env, volume_id, lun_id):
"""Set the LUN ID on an existing block storage volume.
The LUN ID only takes effect during the Host Authorization process. It is
recommended (but not necessary) to de-authorize all hosts before using this
method. See `block access-revoke`.
VOLUME_ID - the volume ID... | python | def cli(env, volume_id, lun_id):
"""Set the LUN ID on an existing block storage volume.
The LUN ID only takes effect during the Host Authorization process. It is
recommended (but not necessary) to de-authorize all hosts before using this
method. See `block access-revoke`.
VOLUME_ID - the volume ID... | [
"def",
"cli",
"(",
"env",
",",
"volume_id",
",",
"lun_id",
")",
":",
"block_storage_manager",
"=",
"SoftLayer",
".",
"BlockStorageManager",
"(",
"env",
".",
"client",
")",
"res",
"=",
"block_storage_manager",
".",
"create_or_update_lun_id",
"(",
"volume_id",
","... | Set the LUN ID on an existing block storage volume.
The LUN ID only takes effect during the Host Authorization process. It is
recommended (but not necessary) to de-authorize all hosts before using this
method. See `block access-revoke`.
VOLUME_ID - the volume ID on which to set the LUN ID.
LUN_ID... | [
"Set",
"the",
"LUN",
"ID",
"on",
"an",
"existing",
"block",
"storage",
"volume",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/block/lun.py#L14-L36 | train |
softlayer/softlayer-python | SoftLayer/CLI/loadbal/detail.py | cli | def cli(env, identifier):
"""Get Load balancer details."""
mgr = SoftLayer.LoadBalancerManager(env.client)
_, loadbal_id = loadbal.parse_id(identifier)
load_balancer = mgr.get_local_lb(loadbal_id)
table = formatting.KeyValueTable(['name', 'value'])
table.align['name'] = 'l'
table.align['v... | python | def cli(env, identifier):
"""Get Load balancer details."""
mgr = SoftLayer.LoadBalancerManager(env.client)
_, loadbal_id = loadbal.parse_id(identifier)
load_balancer = mgr.get_local_lb(loadbal_id)
table = formatting.KeyValueTable(['name', 'value'])
table.align['name'] = 'l'
table.align['v... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"LoadBalancerManager",
"(",
"env",
".",
"client",
")",
"_",
",",
"loadbal_id",
"=",
"loadbal",
".",
"parse_id",
"(",
"identifier",
")",
"load_balancer",
"=",
"mgr",
".",... | Get Load balancer details. | [
"Get",
"Load",
"balancer",
"details",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/loadbal/detail.py#L15-L81 | train |
softlayer/softlayer-python | SoftLayer/CLI/core.py | cli | def cli(env,
format='table',
config=None,
verbose=0,
proxy=None,
really=False,
demo=False,
**kwargs):
"""Main click CLI entry-point."""
# Populate environement with client and set it as the context object
env.skip_confirmations = really
env.config... | python | def cli(env,
format='table',
config=None,
verbose=0,
proxy=None,
really=False,
demo=False,
**kwargs):
"""Main click CLI entry-point."""
# Populate environement with client and set it as the context object
env.skip_confirmations = really
env.config... | [
"def",
"cli",
"(",
"env",
",",
"format",
"=",
"'table'",
",",
"config",
"=",
"None",
",",
"verbose",
"=",
"0",
",",
"proxy",
"=",
"None",
",",
"really",
"=",
"False",
",",
"demo",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"env",
".",
"skip_con... | Main click CLI entry-point. | [
"Main",
"click",
"CLI",
"entry",
"-",
"point",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/core.py#L108-L135 | train |
softlayer/softlayer-python | SoftLayer/CLI/core.py | output_diagnostics | def output_diagnostics(env, result, verbose=0, **kwargs):
"""Output diagnostic information."""
if verbose > 0:
diagnostic_table = formatting.Table(['name', 'value'])
diagnostic_table.add_row(['execution_time', '%fs' % (time.time() - START_TIME)])
api_call_value = []
for call in... | python | def output_diagnostics(env, result, verbose=0, **kwargs):
"""Output diagnostic information."""
if verbose > 0:
diagnostic_table = formatting.Table(['name', 'value'])
diagnostic_table.add_row(['execution_time', '%fs' % (time.time() - START_TIME)])
api_call_value = []
for call in... | [
"def",
"output_diagnostics",
"(",
"env",
",",
"result",
",",
"verbose",
"=",
"0",
",",
"**",
"kwargs",
")",
":",
"if",
"verbose",
">",
"0",
":",
"diagnostic_table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"'name'",
",",
"'value'",
"]",
")",
"diagnos... | Output diagnostic information. | [
"Output",
"diagnostic",
"information",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/core.py#L140-L174 | train |
softlayer/softlayer-python | SoftLayer/CLI/core.py | main | def main(reraise_exceptions=False, **kwargs):
"""Main program. Catches several common errors and displays them nicely."""
exit_status = 0
try:
cli.main(**kwargs)
except SoftLayer.SoftLayerAPIError as ex:
if 'invalid api token' in ex.faultString.lower():
print("Authentication... | python | def main(reraise_exceptions=False, **kwargs):
"""Main program. Catches several common errors and displays them nicely."""
exit_status = 0
try:
cli.main(**kwargs)
except SoftLayer.SoftLayerAPIError as ex:
if 'invalid api token' in ex.faultString.lower():
print("Authentication... | [
"def",
"main",
"(",
"reraise_exceptions",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"exit_status",
"=",
"0",
"try",
":",
"cli",
".",
"main",
"(",
"**",
"kwargs",
")",
"except",
"SoftLayer",
".",
"SoftLayerAPIError",
"as",
"ex",
":",
"if",
"'invalid ap... | Main program. Catches several common errors and displays them nicely. | [
"Main",
"program",
".",
"Catches",
"several",
"common",
"errors",
"and",
"displays",
"them",
"nicely",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/core.py#L177-L208 | train |
softlayer/softlayer-python | SoftLayer/CLI/block/access/revoke.py | cli | def cli(env, volume_id, hardware_id, virtual_id, ip_address_id, ip_address):
"""Revokes authorization for hosts accessing a given volume"""
block_manager = SoftLayer.BlockStorageManager(env.client)
ip_address_id_list = list(ip_address_id)
# Convert actual IP Addresses to their SoftLayer ids
if ip_a... | python | def cli(env, volume_id, hardware_id, virtual_id, ip_address_id, ip_address):
"""Revokes authorization for hosts accessing a given volume"""
block_manager = SoftLayer.BlockStorageManager(env.client)
ip_address_id_list = list(ip_address_id)
# Convert actual IP Addresses to their SoftLayer ids
if ip_a... | [
"def",
"cli",
"(",
"env",
",",
"volume_id",
",",
"hardware_id",
",",
"virtual_id",
",",
"ip_address_id",
",",
"ip_address",
")",
":",
"block_manager",
"=",
"SoftLayer",
".",
"BlockStorageManager",
"(",
"env",
".",
"client",
")",
"ip_address_id_list",
"=",
"lis... | Revokes authorization for hosts accessing a given volume | [
"Revokes",
"authorization",
"for",
"hosts",
"accessing",
"a",
"given",
"volume"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/block/access/revoke.py#L23-L41 | train |
softlayer/softlayer-python | SoftLayer/CLI/loadbal/group_add.py | cli | def cli(env, identifier, allocation, port, routing_type, routing_method):
"""Adds a new load_balancer service."""
mgr = SoftLayer.LoadBalancerManager(env.client)
_, loadbal_id = loadbal.parse_id(identifier)
mgr.add_service_group(loadbal_id,
allocation=allocation,
... | python | def cli(env, identifier, allocation, port, routing_type, routing_method):
"""Adds a new load_balancer service."""
mgr = SoftLayer.LoadBalancerManager(env.client)
_, loadbal_id = loadbal.parse_id(identifier)
mgr.add_service_group(loadbal_id,
allocation=allocation,
... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
",",
"allocation",
",",
"port",
",",
"routing_type",
",",
"routing_method",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"LoadBalancerManager",
"(",
"env",
".",
"client",
")",
"_",
",",
"loadbal_id",
"=",
"loadbal",
... | Adds a new load_balancer service. | [
"Adds",
"a",
"new",
"load_balancer",
"service",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/loadbal/group_add.py#L28-L41 | train |
softlayer/softlayer-python | SoftLayer/CLI/dedicatedhost/cancel_guests.py | cli | def cli(env, identifier):
"""Cancel all virtual guests of the dedicated host immediately.
Use the 'slcli vs cancel' command to cancel an specific guest
"""
dh_mgr = SoftLayer.DedicatedHostManager(env.client)
host_id = helpers.resolve_id(dh_mgr.resolve_ids, identifier, 'dedicated host')
if... | python | def cli(env, identifier):
"""Cancel all virtual guests of the dedicated host immediately.
Use the 'slcli vs cancel' command to cancel an specific guest
"""
dh_mgr = SoftLayer.DedicatedHostManager(env.client)
host_id = helpers.resolve_id(dh_mgr.resolve_ids, identifier, 'dedicated host')
if... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"dh_mgr",
"=",
"SoftLayer",
".",
"DedicatedHostManager",
"(",
"env",
".",
"client",
")",
"host_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"dh_mgr",
".",
"resolve_ids",
",",
"identifier",
",",
"'dedic... | Cancel all virtual guests of the dedicated host immediately.
Use the 'slcli vs cancel' command to cancel an specific guest | [
"Cancel",
"all",
"virtual",
"guests",
"of",
"the",
"dedicated",
"host",
"immediately",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/dedicatedhost/cancel_guests.py#L16-L43 | train |
softlayer/softlayer-python | SoftLayer/CLI/file/list.py | cli | def cli(env, sortby, columns, datacenter, username, storage_type):
"""List file storage."""
file_manager = SoftLayer.FileStorageManager(env.client)
file_volumes = file_manager.list_file_volumes(datacenter=datacenter,
username=username,
... | python | def cli(env, sortby, columns, datacenter, username, storage_type):
"""List file storage."""
file_manager = SoftLayer.FileStorageManager(env.client)
file_volumes = file_manager.list_file_volumes(datacenter=datacenter,
username=username,
... | [
"def",
"cli",
"(",
"env",
",",
"sortby",
",",
"columns",
",",
"datacenter",
",",
"username",
",",
"storage_type",
")",
":",
"file_manager",
"=",
"SoftLayer",
".",
"FileStorageManager",
"(",
"env",
".",
"client",
")",
"file_volumes",
"=",
"file_manager",
".",... | List file storage. | [
"List",
"file",
"storage",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/file/list.py#L66-L81 | train |
softlayer/softlayer-python | SoftLayer/CLI/file/duplicate.py | cli | def cli(env, origin_volume_id, origin_snapshot_id, duplicate_size,
duplicate_iops, duplicate_tier, duplicate_snapshot_size, billing):
"""Order a duplicate file storage volume."""
file_manager = SoftLayer.FileStorageManager(env.client)
hourly_billing_flag = False
if billing.lower() == "hourly":
... | python | def cli(env, origin_volume_id, origin_snapshot_id, duplicate_size,
duplicate_iops, duplicate_tier, duplicate_snapshot_size, billing):
"""Order a duplicate file storage volume."""
file_manager = SoftLayer.FileStorageManager(env.client)
hourly_billing_flag = False
if billing.lower() == "hourly":
... | [
"def",
"cli",
"(",
"env",
",",
"origin_volume_id",
",",
"origin_snapshot_id",
",",
"duplicate_size",
",",
"duplicate_iops",
",",
"duplicate_tier",
",",
"duplicate_snapshot_size",
",",
"billing",
")",
":",
"file_manager",
"=",
"SoftLayer",
".",
"FileStorageManager",
... | Order a duplicate file storage volume. | [
"Order",
"a",
"duplicate",
"file",
"storage",
"volume",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/file/duplicate.py#L56-L88 | train |
softlayer/softlayer-python | SoftLayer/CLI/vpn/ipsec/subnet/remove.py | cli | def cli(env, context_id, subnet_id, subnet_type):
"""Remove a subnet from an IPSEC tunnel context.
The subnet id to remove must be specified.
Remote subnets are deleted upon removal from a tunnel context.
A separate configuration request should be made to realize changes on
network devices.
"... | python | def cli(env, context_id, subnet_id, subnet_type):
"""Remove a subnet from an IPSEC tunnel context.
The subnet id to remove must be specified.
Remote subnets are deleted upon removal from a tunnel context.
A separate configuration request should be made to realize changes on
network devices.
"... | [
"def",
"cli",
"(",
"env",
",",
"context_id",
",",
"subnet_id",
",",
"subnet_type",
")",
":",
"manager",
"=",
"SoftLayer",
".",
"IPSECManager",
"(",
"env",
".",
"client",
")",
"manager",
".",
"get_tunnel_context",
"(",
"context_id",
")",
"succeeded",
"=",
"... | Remove a subnet from an IPSEC tunnel context.
The subnet id to remove must be specified.
Remote subnets are deleted upon removal from a tunnel context.
A separate configuration request should be made to realize changes on
network devices. | [
"Remove",
"a",
"subnet",
"from",
"an",
"IPSEC",
"tunnel",
"context",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/vpn/ipsec/subnet/remove.py#L25-L51 | train |
softlayer/softlayer-python | SoftLayer/CLI/ticket/list.py | cli | def cli(env, is_open):
"""List tickets."""
ticket_mgr = SoftLayer.TicketManager(env.client)
table = formatting.Table([
'id', 'assigned_user', 'title', 'last_edited', 'status', 'updates', 'priority'
])
tickets = ticket_mgr.list_tickets(open_status=is_open, closed_status=not is_open)
for ... | python | def cli(env, is_open):
"""List tickets."""
ticket_mgr = SoftLayer.TicketManager(env.client)
table = formatting.Table([
'id', 'assigned_user', 'title', 'last_edited', 'status', 'updates', 'priority'
])
tickets = ticket_mgr.list_tickets(open_status=is_open, closed_status=not is_open)
for ... | [
"def",
"cli",
"(",
"env",
",",
"is_open",
")",
":",
"ticket_mgr",
"=",
"SoftLayer",
".",
"TicketManager",
"(",
"env",
".",
"client",
")",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"'id'",
",",
"'assigned_user'",
",",
"'title'",
",",
"'last_edit... | List tickets. | [
"List",
"tickets",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/ticket/list.py#L15-L38 | train |
softlayer/softlayer-python | SoftLayer/CLI/securitygroup/detail.py | cli | def cli(env, identifier):
"""Get details about a security group."""
mgr = SoftLayer.NetworkManager(env.client)
secgroup = mgr.get_securitygroup(identifier)
table = formatting.KeyValueTable(['name', 'value'])
table.align['name'] = 'r'
table.align['value'] = 'l'
table.add_row(['id', secgro... | python | def cli(env, identifier):
"""Get details about a security group."""
mgr = SoftLayer.NetworkManager(env.client)
secgroup = mgr.get_securitygroup(identifier)
table = formatting.KeyValueTable(['name', 'value'])
table.align['name'] = 'r'
table.align['value'] = 'l'
table.add_row(['id', secgro... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"NetworkManager",
"(",
"env",
".",
"client",
")",
"secgroup",
"=",
"mgr",
".",
"get_securitygroup",
"(",
"identifier",
")",
"table",
"=",
"formatting",
".",
"KeyValueTable... | Get details about a security group. | [
"Get",
"details",
"about",
"a",
"security",
"group",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/securitygroup/detail.py#L14-L73 | train |
softlayer/softlayer-python | SoftLayer/CLI/dns/record_add.py | cli | def cli(env, record, record_type, data, zone, ttl, priority, protocol, port, service, weight):
"""Add resource record.
Each resource record contains a RECORD and DATA property, defining a resource's name and it's target data.
Domains contain multiple types of resource records so it can take one of the foll... | python | def cli(env, record, record_type, data, zone, ttl, priority, protocol, port, service, weight):
"""Add resource record.
Each resource record contains a RECORD and DATA property, defining a resource's name and it's target data.
Domains contain multiple types of resource records so it can take one of the foll... | [
"def",
"cli",
"(",
"env",
",",
"record",
",",
"record_type",
",",
"data",
",",
"zone",
",",
"ttl",
",",
"priority",
",",
"protocol",
",",
"port",
",",
"service",
",",
"weight",
")",
":",
"manager",
"=",
"SoftLayer",
".",
"DNSManager",
"(",
"env",
"."... | Add resource record.
Each resource record contains a RECORD and DATA property, defining a resource's name and it's target data.
Domains contain multiple types of resource records so it can take one of the following values: A, AAAA, CNAME,
MX, SPF, SRV, and PTR.
About reverse records (PTR), the RECORD ... | [
"Add",
"resource",
"record",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/dns/record_add.py#L43-L90 | train |
softlayer/softlayer-python | SoftLayer/CLI/loadbal/cancel.py | cli | def cli(env, identifier):
"""Cancel an existing load balancer."""
mgr = SoftLayer.LoadBalancerManager(env.client)
_, loadbal_id = loadbal.parse_id(identifier)
if not (env.skip_confirmations or
formatting.confirm("This action will cancel a load balancer. "
"C... | python | def cli(env, identifier):
"""Cancel an existing load balancer."""
mgr = SoftLayer.LoadBalancerManager(env.client)
_, loadbal_id = loadbal.parse_id(identifier)
if not (env.skip_confirmations or
formatting.confirm("This action will cancel a load balancer. "
"C... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"LoadBalancerManager",
"(",
"env",
".",
"client",
")",
"_",
",",
"loadbal_id",
"=",
"loadbal",
".",
"parse_id",
"(",
"identifier",
")",
"if",
"not",
"(",
"env",
".",
... | Cancel an existing load balancer. | [
"Cancel",
"an",
"existing",
"load",
"balancer",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/loadbal/cancel.py#L16-L29 | train |
softlayer/softlayer-python | SoftLayer/CLI/order/preset_list.py | cli | def cli(env, package_keyname, keyword):
"""List package presets.
.. Note::
Presets are set CPU / RAM / Disk allotments. You still need to specify required items.
Some packages do not have presets.
::
# List the presets for Bare Metal servers
slcli order preset-list BARE_ME... | python | def cli(env, package_keyname, keyword):
"""List package presets.
.. Note::
Presets are set CPU / RAM / Disk allotments. You still need to specify required items.
Some packages do not have presets.
::
# List the presets for Bare Metal servers
slcli order preset-list BARE_ME... | [
"def",
"cli",
"(",
"env",
",",
"package_keyname",
",",
"keyword",
")",
":",
"table",
"=",
"formatting",
".",
"Table",
"(",
"COLUMNS",
")",
"manager",
"=",
"ordering",
".",
"OrderingManager",
"(",
"env",
".",
"client",
")",
"_filter",
"=",
"{",
"}",
"if... | List package presets.
.. Note::
Presets are set CPU / RAM / Disk allotments. You still need to specify required items.
Some packages do not have presets.
::
# List the presets for Bare Metal servers
slcli order preset-list BARE_METAL_SERVER
# List the Bare Metal serve... | [
"List",
"package",
"presets",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/order/preset_list.py#L20-L50 | train |
softlayer/softlayer-python | SoftLayer/CLI/user/permissions.py | permission_table | def permission_table(user_permissions, all_permissions):
"""Creates a table of available permissions"""
table = formatting.Table(['Description', 'KeyName', 'Assigned'])
table.align['KeyName'] = 'l'
table.align['Description'] = 'l'
table.align['Assigned'] = 'l'
for perm in all_permissions:
... | python | def permission_table(user_permissions, all_permissions):
"""Creates a table of available permissions"""
table = formatting.Table(['Description', 'KeyName', 'Assigned'])
table.align['KeyName'] = 'l'
table.align['Description'] = 'l'
table.align['Assigned'] = 'l'
for perm in all_permissions:
... | [
"def",
"permission_table",
"(",
"user_permissions",
",",
"all_permissions",
")",
":",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"'Description'",
",",
"'KeyName'",
",",
"'Assigned'",
"]",
")",
"table",
".",
"align",
"[",
"'KeyName'",
"]",
"=",
"'l'"... | Creates a table of available permissions | [
"Creates",
"a",
"table",
"of",
"available",
"permissions"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/user/permissions.py#L39-L49 | train |
softlayer/softlayer-python | SoftLayer/CLI/user/permissions.py | roles_table | def roles_table(user):
"""Creates a table for a users roles"""
table = formatting.Table(['id', 'Role Name', 'Description'])
for role in user['roles']:
table.add_row([role['id'], role['name'], role['description']])
return table | python | def roles_table(user):
"""Creates a table for a users roles"""
table = formatting.Table(['id', 'Role Name', 'Description'])
for role in user['roles']:
table.add_row([role['id'], role['name'], role['description']])
return table | [
"def",
"roles_table",
"(",
"user",
")",
":",
"table",
"=",
"formatting",
".",
"Table",
"(",
"[",
"'id'",
",",
"'Role Name'",
",",
"'Description'",
"]",
")",
"for",
"role",
"in",
"user",
"[",
"'roles'",
"]",
":",
"table",
".",
"add_row",
"(",
"[",
"ro... | Creates a table for a users roles | [
"Creates",
"a",
"table",
"for",
"a",
"users",
"roles"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/user/permissions.py#L52-L57 | train |
softlayer/softlayer-python | SoftLayer/CLI/virt/create.py | _update_with_like_args | def _update_with_like_args(ctx, _, value):
"""Update arguments with options taken from a currently running VS."""
if value is None:
return
env = ctx.ensure_object(environment.Environment)
vsi = SoftLayer.VSManager(env.client)
vs_id = helpers.resolve_id(vsi.resolve_ids, value, 'VS')
like... | python | def _update_with_like_args(ctx, _, value):
"""Update arguments with options taken from a currently running VS."""
if value is None:
return
env = ctx.ensure_object(environment.Environment)
vsi = SoftLayer.VSManager(env.client)
vs_id = helpers.resolve_id(vsi.resolve_ids, value, 'VS')
like... | [
"def",
"_update_with_like_args",
"(",
"ctx",
",",
"_",
",",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"env",
"=",
"ctx",
".",
"ensure_object",
"(",
"environment",
".",
"Environment",
")",
"vsi",
"=",
"SoftLayer",
".",
"VSManager",
"(... | Update arguments with options taken from a currently running VS. | [
"Update",
"arguments",
"with",
"options",
"taken",
"from",
"a",
"currently",
"running",
"VS",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/create.py#L16-L67 | train |
softlayer/softlayer-python | SoftLayer/CLI/virt/create.py | _build_receipt_table | def _build_receipt_table(result, billing="hourly", test=False):
"""Retrieve the total recurring fee of the items prices"""
title = "OrderId: %s" % (result.get('orderId', 'No order placed'))
table = formatting.Table(['Cost', 'Description'], title=title)
table.align['Cost'] = 'r'
table.align['Descript... | python | def _build_receipt_table(result, billing="hourly", test=False):
"""Retrieve the total recurring fee of the items prices"""
title = "OrderId: %s" % (result.get('orderId', 'No order placed'))
table = formatting.Table(['Cost', 'Description'], title=title)
table.align['Cost'] = 'r'
table.align['Descript... | [
"def",
"_build_receipt_table",
"(",
"result",
",",
"billing",
"=",
"\"hourly\"",
",",
"test",
"=",
"False",
")",
":",
"title",
"=",
"\"OrderId: %s\"",
"%",
"(",
"result",
".",
"get",
"(",
"'orderId'",
",",
"'No order placed'",
")",
")",
"table",
"=",
"form... | Retrieve the total recurring fee of the items prices | [
"Retrieve",
"the",
"total",
"recurring",
"fee",
"of",
"the",
"items",
"prices"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/create.py#L239-L260 | train |
softlayer/softlayer-python | SoftLayer/CLI/virt/create.py | _validate_args | def _validate_args(env, args):
"""Raises an ArgumentError if the given arguments are not valid."""
if all([args['cpu'], args['flavor']]):
raise exceptions.ArgumentError(
'[-c | --cpu] not allowed with [-f | --flavor]')
if all([args['memory'], args['flavor']]):
raise exceptions.... | python | def _validate_args(env, args):
"""Raises an ArgumentError if the given arguments are not valid."""
if all([args['cpu'], args['flavor']]):
raise exceptions.ArgumentError(
'[-c | --cpu] not allowed with [-f | --flavor]')
if all([args['memory'], args['flavor']]):
raise exceptions.... | [
"def",
"_validate_args",
"(",
"env",
",",
"args",
")",
":",
"if",
"all",
"(",
"[",
"args",
"[",
"'cpu'",
"]",
",",
"args",
"[",
"'flavor'",
"]",
"]",
")",
":",
"raise",
"exceptions",
".",
"ArgumentError",
"(",
"'[-c | --cpu] not allowed with [-f | --flavor]'... | Raises an ArgumentError if the given arguments are not valid. | [
"Raises",
"an",
"ArgumentError",
"if",
"the",
"given",
"arguments",
"are",
"not",
"valid",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/create.py#L273-L304 | train |
softlayer/softlayer-python | SoftLayer/CLI/virt/upgrade.py | cli | def cli(env, identifier, cpu, private, memory, network, flavor):
"""Upgrade a virtual server."""
vsi = SoftLayer.VSManager(env.client)
if not any([cpu, memory, network, flavor]):
raise exceptions.ArgumentError("Must provide [--cpu], [--memory], [--network], or [--flavor] to upgrade")
if priva... | python | def cli(env, identifier, cpu, private, memory, network, flavor):
"""Upgrade a virtual server."""
vsi = SoftLayer.VSManager(env.client)
if not any([cpu, memory, network, flavor]):
raise exceptions.ArgumentError("Must provide [--cpu], [--memory], [--network], or [--flavor] to upgrade")
if priva... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
",",
"cpu",
",",
"private",
",",
"memory",
",",
"network",
",",
"flavor",
")",
":",
"vsi",
"=",
"SoftLayer",
".",
"VSManager",
"(",
"env",
".",
"client",
")",
"if",
"not",
"any",
"(",
"[",
"cpu",
",",
... | Upgrade a virtual server. | [
"Upgrade",
"a",
"virtual",
"server",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/upgrade.py#L26-L45 | train |
softlayer/softlayer-python | SoftLayer/CLI/hardware/power.py | reboot | def reboot(env, identifier, hard):
"""Reboot an active server."""
hardware_server = env.client['Hardware_Server']
mgr = SoftLayer.HardwareManager(env.client)
hw_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'hardware')
if not (env.skip_confirmations or
formatting.confirm('This wi... | python | def reboot(env, identifier, hard):
"""Reboot an active server."""
hardware_server = env.client['Hardware_Server']
mgr = SoftLayer.HardwareManager(env.client)
hw_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'hardware')
if not (env.skip_confirmations or
formatting.confirm('This wi... | [
"def",
"reboot",
"(",
"env",
",",
"identifier",
",",
"hard",
")",
":",
"hardware_server",
"=",
"env",
".",
"client",
"[",
"'Hardware_Server'",
"]",
"mgr",
"=",
"SoftLayer",
".",
"HardwareManager",
"(",
"env",
".",
"client",
")",
"hw_id",
"=",
"helpers",
... | Reboot an active server. | [
"Reboot",
"an",
"active",
"server",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/hardware/power.py#L35-L51 | train |
softlayer/softlayer-python | SoftLayer/CLI/hardware/power.py | power_on | def power_on(env, identifier):
"""Power on a server."""
mgr = SoftLayer.HardwareManager(env.client)
hw_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'hardware')
env.client['Hardware_Server'].powerOn(id=hw_id) | python | def power_on(env, identifier):
"""Power on a server."""
mgr = SoftLayer.HardwareManager(env.client)
hw_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'hardware')
env.client['Hardware_Server'].powerOn(id=hw_id) | [
"def",
"power_on",
"(",
"env",
",",
"identifier",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"HardwareManager",
"(",
"env",
".",
"client",
")",
"hw_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"mgr",
".",
"resolve_ids",
",",
"identifier",
",",
"'hardware'",
... | Power on a server. | [
"Power",
"on",
"a",
"server",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/hardware/power.py#L57-L62 | train |
softlayer/softlayer-python | SoftLayer/CLI/hardware/power.py | power_cycle | def power_cycle(env, identifier):
"""Power cycle a server."""
mgr = SoftLayer.HardwareManager(env.client)
hw_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'hardware')
if not (env.skip_confirmations or
formatting.confirm('This will power off the server with id %s. '
... | python | def power_cycle(env, identifier):
"""Power cycle a server."""
mgr = SoftLayer.HardwareManager(env.client)
hw_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'hardware')
if not (env.skip_confirmations or
formatting.confirm('This will power off the server with id %s. '
... | [
"def",
"power_cycle",
"(",
"env",
",",
"identifier",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"HardwareManager",
"(",
"env",
".",
"client",
")",
"hw_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"mgr",
".",
"resolve_ids",
",",
"identifier",
",",
"'hardware'"... | Power cycle a server. | [
"Power",
"cycle",
"a",
"server",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/hardware/power.py#L68-L79 | train |
softlayer/softlayer-python | SoftLayer/CLI/securitygroup/edit.py | cli | def cli(env, group_id, name, description):
"""Edit details of a security group."""
mgr = SoftLayer.NetworkManager(env.client)
data = {}
if name:
data['name'] = name
if description:
data['description'] = description
if not mgr.edit_securitygroup(group_id, **data):
raise e... | python | def cli(env, group_id, name, description):
"""Edit details of a security group."""
mgr = SoftLayer.NetworkManager(env.client)
data = {}
if name:
data['name'] = name
if description:
data['description'] = description
if not mgr.edit_securitygroup(group_id, **data):
raise e... | [
"def",
"cli",
"(",
"env",
",",
"group_id",
",",
"name",
",",
"description",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"NetworkManager",
"(",
"env",
".",
"client",
")",
"data",
"=",
"{",
"}",
"if",
"name",
":",
"data",
"[",
"'name'",
"]",
"=",
"name",... | Edit details of a security group. | [
"Edit",
"details",
"of",
"a",
"security",
"group",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/securitygroup/edit.py#L18-L28 | train |
softlayer/softlayer-python | SoftLayer/CLI/event_log/get.py | cli | def cli(env, date_min, date_max, obj_event, obj_id, obj_type, utc_offset, metadata, limit):
"""Get Event Logs
Example:
slcli event-log get -d 01/01/2019 -D 02/01/2019 -t User -l 10
"""
columns = ['Event', 'Object', 'Type', 'Date', 'Username']
event_mgr = SoftLayer.EventLogManager(env.clien... | python | def cli(env, date_min, date_max, obj_event, obj_id, obj_type, utc_offset, metadata, limit):
"""Get Event Logs
Example:
slcli event-log get -d 01/01/2019 -D 02/01/2019 -t User -l 10
"""
columns = ['Event', 'Object', 'Type', 'Date', 'Username']
event_mgr = SoftLayer.EventLogManager(env.clien... | [
"def",
"cli",
"(",
"env",
",",
"date_min",
",",
"date_max",
",",
"obj_event",
",",
"obj_id",
",",
"obj_type",
",",
"utc_offset",
",",
"metadata",
",",
"limit",
")",
":",
"columns",
"=",
"[",
"'Event'",
",",
"'Object'",
",",
"'Type'",
",",
"'Date'",
","... | Get Event Logs
Example:
slcli event-log get -d 01/01/2019 -D 02/01/2019 -t User -l 10 | [
"Get",
"Event",
"Logs"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/event_log/get.py#L29-L83 | train |
softlayer/softlayer-python | SoftLayer/CLI/file/modify.py | cli | def cli(env, volume_id, new_size, new_iops, new_tier):
"""Modify an existing file storage volume."""
file_manager = SoftLayer.FileStorageManager(env.client)
if new_tier is not None:
new_tier = float(new_tier)
try:
order = file_manager.order_modified_volume(
volume_id,
... | python | def cli(env, volume_id, new_size, new_iops, new_tier):
"""Modify an existing file storage volume."""
file_manager = SoftLayer.FileStorageManager(env.client)
if new_tier is not None:
new_tier = float(new_tier)
try:
order = file_manager.order_modified_volume(
volume_id,
... | [
"def",
"cli",
"(",
"env",
",",
"volume_id",
",",
"new_size",
",",
"new_iops",
",",
"new_tier",
")",
":",
"file_manager",
"=",
"SoftLayer",
".",
"FileStorageManager",
"(",
"env",
".",
"client",
")",
"if",
"new_tier",
"is",
"not",
"None",
":",
"new_tier",
... | Modify an existing file storage volume. | [
"Modify",
"an",
"existing",
"file",
"storage",
"volume",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/file/modify.py#L35-L57 | train |
softlayer/softlayer-python | SoftLayer/managers/user.py | UserManager.add_permissions | def add_permissions(self, user_id, permissions):
"""Enables a list of permissions for a user
:param int id: user id to set
:param list permissions: List of permissions keynames to enable
:returns: True on success, Exception otherwise
Example::
add_permissions(123, [... | python | def add_permissions(self, user_id, permissions):
"""Enables a list of permissions for a user
:param int id: user id to set
:param list permissions: List of permissions keynames to enable
:returns: True on success, Exception otherwise
Example::
add_permissions(123, [... | [
"def",
"add_permissions",
"(",
"self",
",",
"user_id",
",",
"permissions",
")",
":",
"pretty_permissions",
"=",
"self",
".",
"format_permission_object",
"(",
"permissions",
")",
"LOGGER",
".",
"warning",
"(",
"\"Adding the following permissions to %s: %s\"",
",",
"use... | Enables a list of permissions for a user
:param int id: user id to set
:param list permissions: List of permissions keynames to enable
:returns: True on success, Exception otherwise
Example::
add_permissions(123, ['BANDWIDTH_MANAGE']) | [
"Enables",
"a",
"list",
"of",
"permissions",
"for",
"a",
"user"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/user.py#L87-L99 | train |
softlayer/softlayer-python | SoftLayer/managers/user.py | UserManager.remove_permissions | def remove_permissions(self, user_id, permissions):
"""Disables a list of permissions for a user
:param int id: user id to set
:param list permissions: List of permissions keynames to disable
:returns: True on success, Exception otherwise
Example::
remove_permission... | python | def remove_permissions(self, user_id, permissions):
"""Disables a list of permissions for a user
:param int id: user id to set
:param list permissions: List of permissions keynames to disable
:returns: True on success, Exception otherwise
Example::
remove_permission... | [
"def",
"remove_permissions",
"(",
"self",
",",
"user_id",
",",
"permissions",
")",
":",
"pretty_permissions",
"=",
"self",
".",
"format_permission_object",
"(",
"permissions",
")",
"LOGGER",
".",
"warning",
"(",
"\"Removing the following permissions to %s: %s\"",
",",
... | Disables a list of permissions for a user
:param int id: user id to set
:param list permissions: List of permissions keynames to disable
:returns: True on success, Exception otherwise
Example::
remove_permissions(123, ['BANDWIDTH_MANAGE']) | [
"Disables",
"a",
"list",
"of",
"permissions",
"for",
"a",
"user"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/user.py#L101-L113 | train |
softlayer/softlayer-python | SoftLayer/managers/user.py | UserManager.permissions_from_user | def permissions_from_user(self, user_id, from_user_id):
"""Sets user_id's permission to be the same as from_user_id's
Any permissions from_user_id has will be added to user_id.
Any permissions from_user_id doesn't have will be removed from user_id.
:param int user_id: The user to chang... | python | def permissions_from_user(self, user_id, from_user_id):
"""Sets user_id's permission to be the same as from_user_id's
Any permissions from_user_id has will be added to user_id.
Any permissions from_user_id doesn't have will be removed from user_id.
:param int user_id: The user to chang... | [
"def",
"permissions_from_user",
"(",
"self",
",",
"user_id",
",",
"from_user_id",
")",
":",
"from_permissions",
"=",
"self",
".",
"get_user_permissions",
"(",
"from_user_id",
")",
"self",
".",
"add_permissions",
"(",
"user_id",
",",
"from_permissions",
")",
"all_p... | Sets user_id's permission to be the same as from_user_id's
Any permissions from_user_id has will be added to user_id.
Any permissions from_user_id doesn't have will be removed from user_id.
:param int user_id: The user to change permissions.
:param int from_user_id: The use to base per... | [
"Sets",
"user_id",
"s",
"permission",
"to",
"be",
"the",
"same",
"as",
"from_user_id",
"s"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/user.py#L115-L139 | train |
softlayer/softlayer-python | SoftLayer/managers/user.py | UserManager.get_user_permissions | def get_user_permissions(self, user_id):
"""Returns a sorted list of a users permissions"""
permissions = self.user_service.getPermissions(id=user_id)
return sorted(permissions, key=itemgetter('keyName')) | python | def get_user_permissions(self, user_id):
"""Returns a sorted list of a users permissions"""
permissions = self.user_service.getPermissions(id=user_id)
return sorted(permissions, key=itemgetter('keyName')) | [
"def",
"get_user_permissions",
"(",
"self",
",",
"user_id",
")",
":",
"permissions",
"=",
"self",
".",
"user_service",
".",
"getPermissions",
"(",
"id",
"=",
"user_id",
")",
"return",
"sorted",
"(",
"permissions",
",",
"key",
"=",
"itemgetter",
"(",
"'keyNam... | Returns a sorted list of a users permissions | [
"Returns",
"a",
"sorted",
"list",
"of",
"a",
"users",
"permissions"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/user.py#L141-L144 | train |
softlayer/softlayer-python | SoftLayer/managers/user.py | UserManager.get_logins | def get_logins(self, user_id, start_date=None):
"""Gets the login history for a user, default start_date is 30 days ago
:param int id: User id to get
:param string start_date: "%m/%d/%Y %H:%M:%s" formatted string.
:returns: list https://softlayer.github.io/reference/datatypes/SoftLayer_... | python | def get_logins(self, user_id, start_date=None):
"""Gets the login history for a user, default start_date is 30 days ago
:param int id: User id to get
:param string start_date: "%m/%d/%Y %H:%M:%s" formatted string.
:returns: list https://softlayer.github.io/reference/datatypes/SoftLayer_... | [
"def",
"get_logins",
"(",
"self",
",",
"user_id",
",",
"start_date",
"=",
"None",
")",
":",
"if",
"start_date",
"is",
"None",
":",
"date_object",
"=",
"datetime",
".",
"datetime",
".",
"today",
"(",
")",
"-",
"datetime",
".",
"timedelta",
"(",
"days",
... | Gets the login history for a user, default start_date is 30 days ago
:param int id: User id to get
:param string start_date: "%m/%d/%Y %H:%M:%s" formatted string.
:returns: list https://softlayer.github.io/reference/datatypes/SoftLayer_User_Customer_Access_Authentication/
Example::
... | [
"Gets",
"the",
"login",
"history",
"for",
"a",
"user",
"default",
"start_date",
"is",
"30",
"days",
"ago"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/user.py#L146-L169 | train |
softlayer/softlayer-python | SoftLayer/managers/user.py | UserManager.get_events | def get_events(self, user_id, start_date=None):
"""Gets the event log for a specific user, default start_date is 30 days ago
:param int id: User id to view
:param string start_date: "%Y-%m-%dT%H:%M:%s.0000-06:00" is the full formatted string.
The Timezone part ... | python | def get_events(self, user_id, start_date=None):
"""Gets the event log for a specific user, default start_date is 30 days ago
:param int id: User id to view
:param string start_date: "%Y-%m-%dT%H:%M:%s.0000-06:00" is the full formatted string.
The Timezone part ... | [
"def",
"get_events",
"(",
"self",
",",
"user_id",
",",
"start_date",
"=",
"None",
")",
":",
"if",
"start_date",
"is",
"None",
":",
"date_object",
"=",
"datetime",
".",
"datetime",
".",
"today",
"(",
")",
"-",
"datetime",
".",
"timedelta",
"(",
"days",
... | Gets the event log for a specific user, default start_date is 30 days ago
:param int id: User id to view
:param string start_date: "%Y-%m-%dT%H:%M:%s.0000-06:00" is the full formatted string.
The Timezone part has to be HH:MM, notice the : there.
:returns: http... | [
"Gets",
"the",
"event",
"log",
"for",
"a",
"specific",
"user",
"default",
"start_date",
"is",
"30",
"days",
"ago"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/user.py#L171-L197 | train |
softlayer/softlayer-python | SoftLayer/managers/user.py | UserManager._get_id_from_username | def _get_id_from_username(self, username):
"""Looks up a username's id
:param string username: Username to lookup
:returns: The id that matches username.
"""
_mask = "mask[id, username]"
_filter = {'users': {'username': utils.query_filter(username)}}
user = self.... | python | def _get_id_from_username(self, username):
"""Looks up a username's id
:param string username: Username to lookup
:returns: The id that matches username.
"""
_mask = "mask[id, username]"
_filter = {'users': {'username': utils.query_filter(username)}}
user = self.... | [
"def",
"_get_id_from_username",
"(",
"self",
",",
"username",
")",
":",
"_mask",
"=",
"\"mask[id, username]\"",
"_filter",
"=",
"{",
"'users'",
":",
"{",
"'username'",
":",
"utils",
".",
"query_filter",
"(",
"username",
")",
"}",
"}",
"user",
"=",
"self",
... | Looks up a username's id
:param string username: Username to lookup
:returns: The id that matches username. | [
"Looks",
"up",
"a",
"username",
"s",
"id"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/user.py#L199-L213 | train |
softlayer/softlayer-python | SoftLayer/managers/user.py | UserManager.format_permission_object | def format_permission_object(self, permissions):
"""Formats a list of permission key names into something the SLAPI will respect.
:param list permissions: A list of SLAPI permissions keyNames.
keyName of ALL will return all permissions.
:returns: list of diction... | python | def format_permission_object(self, permissions):
"""Formats a list of permission key names into something the SLAPI will respect.
:param list permissions: A list of SLAPI permissions keyNames.
keyName of ALL will return all permissions.
:returns: list of diction... | [
"def",
"format_permission_object",
"(",
"self",
",",
"permissions",
")",
":",
"pretty_permissions",
"=",
"[",
"]",
"available_permissions",
"=",
"self",
".",
"get_all_permissions",
"(",
")",
"for",
"permission",
"in",
"permissions",
":",
"if",
"isinstance",
"(",
... | Formats a list of permission key names into something the SLAPI will respect.
:param list permissions: A list of SLAPI permissions keyNames.
keyName of ALL will return all permissions.
:returns: list of dictionaries that can be sent to the api to add or remove permissio... | [
"Formats",
"a",
"list",
"of",
"permission",
"key",
"names",
"into",
"something",
"the",
"SLAPI",
"will",
"respect",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/user.py#L215-L238 | train |
softlayer/softlayer-python | SoftLayer/CLI/globalip/unassign.py | cli | def cli(env, identifier):
"""Unassigns a global IP from a target."""
mgr = SoftLayer.NetworkManager(env.client)
global_ip_id = helpers.resolve_id(mgr.resolve_global_ip_ids, identifier,
name='global ip')
mgr.unassign_global_ip(global_ip_id) | python | def cli(env, identifier):
"""Unassigns a global IP from a target."""
mgr = SoftLayer.NetworkManager(env.client)
global_ip_id = helpers.resolve_id(mgr.resolve_global_ip_ids, identifier,
name='global ip')
mgr.unassign_global_ip(global_ip_id) | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"NetworkManager",
"(",
"env",
".",
"client",
")",
"global_ip_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"mgr",
".",
"resolve_global_ip_ids",
",",
"identifier",
",",
"nam... | Unassigns a global IP from a target. | [
"Unassigns",
"a",
"global",
"IP",
"from",
"a",
"target",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/globalip/unassign.py#L14-L20 | train |
softlayer/softlayer-python | SoftLayer/CLI/vpn/ipsec/configure.py | cli | def cli(env, context_id):
"""Request configuration of a tunnel context.
This action will update the advancedConfigurationFlag on the context
instance and further modifications against the context will be prevented
until all changes can be propgated to network devices.
"""
manager = SoftLayer.IP... | python | def cli(env, context_id):
"""Request configuration of a tunnel context.
This action will update the advancedConfigurationFlag on the context
instance and further modifications against the context will be prevented
until all changes can be propgated to network devices.
"""
manager = SoftLayer.IP... | [
"def",
"cli",
"(",
"env",
",",
"context_id",
")",
":",
"manager",
"=",
"SoftLayer",
".",
"IPSECManager",
"(",
"env",
".",
"client",
")",
"manager",
".",
"get_tunnel_context",
"(",
"context_id",
")",
"succeeded",
"=",
"manager",
".",
"apply_configuration",
"(... | Request configuration of a tunnel context.
This action will update the advancedConfigurationFlag on the context
instance and further modifications against the context will be prevented
until all changes can be propgated to network devices. | [
"Request",
"configuration",
"of",
"a",
"tunnel",
"context",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/vpn/ipsec/configure.py#L14-L31 | train |
softlayer/softlayer-python | SoftLayer/managers/dns.py | DNSManager._get_zone_id_from_name | def _get_zone_id_from_name(self, name):
"""Return zone ID based on a zone."""
results = self.client['Account'].getDomains(
filter={"domains": {"name": utils.query_filter(name)}})
return [x['id'] for x in results] | python | def _get_zone_id_from_name(self, name):
"""Return zone ID based on a zone."""
results = self.client['Account'].getDomains(
filter={"domains": {"name": utils.query_filter(name)}})
return [x['id'] for x in results] | [
"def",
"_get_zone_id_from_name",
"(",
"self",
",",
"name",
")",
":",
"results",
"=",
"self",
".",
"client",
"[",
"'Account'",
"]",
".",
"getDomains",
"(",
"filter",
"=",
"{",
"\"domains\"",
":",
"{",
"\"name\"",
":",
"utils",
".",
"query_filter",
"(",
"n... | Return zone ID based on a zone. | [
"Return",
"zone",
"ID",
"based",
"on",
"a",
"zone",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/dns.py#L28-L32 | train |
softlayer/softlayer-python | SoftLayer/managers/dns.py | DNSManager.get_zone | def get_zone(self, zone_id, records=True):
"""Get a zone and its records.
:param zone: the zone name
:returns: A dictionary containing a large amount of information about
the specified zone.
"""
mask = None
if records:
mask = 'resourceRecor... | python | def get_zone(self, zone_id, records=True):
"""Get a zone and its records.
:param zone: the zone name
:returns: A dictionary containing a large amount of information about
the specified zone.
"""
mask = None
if records:
mask = 'resourceRecor... | [
"def",
"get_zone",
"(",
"self",
",",
"zone_id",
",",
"records",
"=",
"True",
")",
":",
"mask",
"=",
"None",
"if",
"records",
":",
"mask",
"=",
"'resourceRecords'",
"return",
"self",
".",
"service",
".",
"getObject",
"(",
"id",
"=",
"zone_id",
",",
"mas... | Get a zone and its records.
:param zone: the zone name
:returns: A dictionary containing a large amount of information about
the specified zone. | [
"Get",
"a",
"zone",
"and",
"its",
"records",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/dns.py#L43-L54 | train |
softlayer/softlayer-python | SoftLayer/managers/dns.py | DNSManager.create_zone | def create_zone(self, zone, serial=None):
"""Create a zone for the specified zone.
:param zone: the zone name to create
:param serial: serial value on the zone (default: strftime(%Y%m%d01))
"""
return self.service.createObject({
'name': zone,
'serial': s... | python | def create_zone(self, zone, serial=None):
"""Create a zone for the specified zone.
:param zone: the zone name to create
:param serial: serial value on the zone (default: strftime(%Y%m%d01))
"""
return self.service.createObject({
'name': zone,
'serial': s... | [
"def",
"create_zone",
"(",
"self",
",",
"zone",
",",
"serial",
"=",
"None",
")",
":",
"return",
"self",
".",
"service",
".",
"createObject",
"(",
"{",
"'name'",
":",
"zone",
",",
"'serial'",
":",
"serial",
"or",
"time",
".",
"strftime",
"(",
"'%Y%m%d01... | Create a zone for the specified zone.
:param zone: the zone name to create
:param serial: serial value on the zone (default: strftime(%Y%m%d01)) | [
"Create",
"a",
"zone",
"for",
"the",
"specified",
"zone",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/dns.py#L56-L66 | train |
softlayer/softlayer-python | SoftLayer/managers/dns.py | DNSManager.create_record_mx | def create_record_mx(self, zone_id, record, data, ttl=60, priority=10):
"""Create a mx resource record on a domain.
:param integer id: the zone's ID
:param record: the name of the record to add
:param data: the record's value
:param integer ttl: the TTL or time-to-live value (de... | python | def create_record_mx(self, zone_id, record, data, ttl=60, priority=10):
"""Create a mx resource record on a domain.
:param integer id: the zone's ID
:param record: the name of the record to add
:param data: the record's value
:param integer ttl: the TTL or time-to-live value (de... | [
"def",
"create_record_mx",
"(",
"self",
",",
"zone_id",
",",
"record",
",",
"data",
",",
"ttl",
"=",
"60",
",",
"priority",
"=",
"10",
")",
":",
"resource_record",
"=",
"self",
".",
"_generate_create_dict",
"(",
"record",
",",
"'MX'",
",",
"data",
",",
... | Create a mx resource record on a domain.
:param integer id: the zone's ID
:param record: the name of the record to add
:param data: the record's value
:param integer ttl: the TTL or time-to-live value (default: 60)
:param integer priority: the priority of the target host | [
"Create",
"a",
"mx",
"resource",
"record",
"on",
"a",
"domain",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/dns.py#L101-L113 | train |
softlayer/softlayer-python | SoftLayer/managers/dns.py | DNSManager.create_record_ptr | def create_record_ptr(self, record, data, ttl=60):
"""Create a reverse record.
:param record: the public ip address of device for which you would like to manage reverse DNS.
:param data: the record's value
:param integer ttl: the TTL or time-to-live value (default: 60)
"""
... | python | def create_record_ptr(self, record, data, ttl=60):
"""Create a reverse record.
:param record: the public ip address of device for which you would like to manage reverse DNS.
:param data: the record's value
:param integer ttl: the TTL or time-to-live value (default: 60)
"""
... | [
"def",
"create_record_ptr",
"(",
"self",
",",
"record",
",",
"data",
",",
"ttl",
"=",
"60",
")",
":",
"resource_record",
"=",
"self",
".",
"_generate_create_dict",
"(",
"record",
",",
"'PTR'",
",",
"data",
",",
"ttl",
")",
"return",
"self",
".",
"record"... | Create a reverse record.
:param record: the public ip address of device for which you would like to manage reverse DNS.
:param data: the record's value
:param integer ttl: the TTL or time-to-live value (default: 60) | [
"Create",
"a",
"reverse",
"record",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/dns.py#L139-L149 | train |
softlayer/softlayer-python | SoftLayer/managers/dns.py | DNSManager.get_records | def get_records(self, zone_id, ttl=None, data=None, host=None,
record_type=None):
"""List, and optionally filter, records within a zone.
:param zone: the zone name in which to search.
:param int ttl: time in seconds
:param str data: the records data
:param st... | python | def get_records(self, zone_id, ttl=None, data=None, host=None,
record_type=None):
"""List, and optionally filter, records within a zone.
:param zone: the zone name in which to search.
:param int ttl: time in seconds
:param str data: the records data
:param st... | [
"def",
"get_records",
"(",
"self",
",",
"zone_id",
",",
"ttl",
"=",
"None",
",",
"data",
"=",
"None",
",",
"host",
"=",
"None",
",",
"record_type",
"=",
"None",
")",
":",
"_filter",
"=",
"utils",
".",
"NestedDict",
"(",
")",
"if",
"ttl",
":",
"_fil... | List, and optionally filter, records within a zone.
:param zone: the zone name in which to search.
:param int ttl: time in seconds
:param str data: the records data
:param str host: record's host
:param str record_type: the type of record
:returns: A list of dictionarie... | [
"List",
"and",
"optionally",
"filter",
"records",
"within",
"a",
"zone",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/dns.py#L183-L218 | train |
softlayer/softlayer-python | SoftLayer/managers/dedicated_host.py | DedicatedHostManager.cancel_guests | def cancel_guests(self, host_id):
"""Cancel all guests into the dedicated host immediately.
To cancel an specified guest use the method VSManager.cancel_instance()
:param host_id: The ID of the dedicated host.
:return: The id, fqdn and status of all guests into a dictionary. The status... | python | def cancel_guests(self, host_id):
"""Cancel all guests into the dedicated host immediately.
To cancel an specified guest use the method VSManager.cancel_instance()
:param host_id: The ID of the dedicated host.
:return: The id, fqdn and status of all guests into a dictionary. The status... | [
"def",
"cancel_guests",
"(",
"self",
",",
"host_id",
")",
":",
"result",
"=",
"[",
"]",
"guests",
"=",
"self",
".",
"host",
".",
"getGuests",
"(",
"id",
"=",
"host_id",
",",
"mask",
"=",
"'id,fullyQualifiedDomainName'",
")",
"if",
"guests",
":",
"for",
... | Cancel all guests into the dedicated host immediately.
To cancel an specified guest use the method VSManager.cancel_instance()
:param host_id: The ID of the dedicated host.
:return: The id, fqdn and status of all guests into a dictionary. The status
could be 'Cancelled' or an ... | [
"Cancel",
"all",
"guests",
"into",
"the",
"dedicated",
"host",
"immediately",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/dedicated_host.py#L54-L81 | train |
softlayer/softlayer-python | SoftLayer/managers/dedicated_host.py | DedicatedHostManager.list_guests | def list_guests(self, host_id, tags=None, cpus=None, memory=None, hostname=None,
domain=None, local_disk=None, nic_speed=None, public_ip=None,
private_ip=None, **kwargs):
"""Retrieve a list of all virtual servers on the dedicated host.
Example::
# Pr... | python | def list_guests(self, host_id, tags=None, cpus=None, memory=None, hostname=None,
domain=None, local_disk=None, nic_speed=None, public_ip=None,
private_ip=None, **kwargs):
"""Retrieve a list of all virtual servers on the dedicated host.
Example::
# Pr... | [
"def",
"list_guests",
"(",
"self",
",",
"host_id",
",",
"tags",
"=",
"None",
",",
"cpus",
"=",
"None",
",",
"memory",
"=",
"None",
",",
"hostname",
"=",
"None",
",",
"domain",
"=",
"None",
",",
"local_disk",
"=",
"None",
",",
"nic_speed",
"=",
"None"... | Retrieve a list of all virtual servers on the dedicated host.
Example::
# Print out a list of instances with 4 cpu cores in the host id 12345.
for vsi in mgr.list_guests(host_id=12345, cpus=4):
print vsi['fullyQualifiedDomainName'], vsi['primaryIpAddress']
... | [
"Retrieve",
"a",
"list",
"of",
"all",
"virtual",
"servers",
"on",
"the",
"dedicated",
"host",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/dedicated_host.py#L83-L172 | train |
softlayer/softlayer-python | SoftLayer/managers/dedicated_host.py | DedicatedHostManager.list_instances | def list_instances(self, tags=None, cpus=None, memory=None, hostname=None,
disk=None, datacenter=None, **kwargs):
"""Retrieve a list of all dedicated hosts on the account
:param list tags: filter based on list of tags
:param integer cpus: filter based on number of CPUS
... | python | def list_instances(self, tags=None, cpus=None, memory=None, hostname=None,
disk=None, datacenter=None, **kwargs):
"""Retrieve a list of all dedicated hosts on the account
:param list tags: filter based on list of tags
:param integer cpus: filter based on number of CPUS
... | [
"def",
"list_instances",
"(",
"self",
",",
"tags",
"=",
"None",
",",
"cpus",
"=",
"None",
",",
"memory",
"=",
"None",
",",
"hostname",
"=",
"None",
",",
"disk",
"=",
"None",
",",
"datacenter",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"if",
"'mas... | Retrieve a list of all dedicated hosts on the account
:param list tags: filter based on list of tags
:param integer cpus: filter based on number of CPUS
:param integer memory: filter based on amount of memory
:param string hostname: filter based on hostname
:param string disk: f... | [
"Retrieve",
"a",
"list",
"of",
"all",
"dedicated",
"hosts",
"on",
"the",
"account"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/dedicated_host.py#L174-L228 | train |
softlayer/softlayer-python | SoftLayer/managers/dedicated_host.py | DedicatedHostManager.get_host | def get_host(self, host_id, **kwargs):
"""Get details about a dedicated host.
:param integer : the host ID
:returns: A dictionary containing host information.
Example::
# Print out host ID 12345.
dh = mgr.get_host(12345)
print dh
# Prin... | python | def get_host(self, host_id, **kwargs):
"""Get details about a dedicated host.
:param integer : the host ID
:returns: A dictionary containing host information.
Example::
# Print out host ID 12345.
dh = mgr.get_host(12345)
print dh
# Prin... | [
"def",
"get_host",
"(",
"self",
",",
"host_id",
",",
"**",
"kwargs",
")",
":",
"if",
"'mask'",
"not",
"in",
"kwargs",
":",
"kwargs",
"[",
"'mask'",
"]",
"=",
"(",
")",
"return",
"self",
".",
"host",
".",
"getObject",
"(",
"id",
"=",
"host_id",
",",... | Get details about a dedicated host.
:param integer : the host ID
:returns: A dictionary containing host information.
Example::
# Print out host ID 12345.
dh = mgr.get_host(12345)
print dh
# Print out only name and backendRouter for instance 123... | [
"Get",
"details",
"about",
"a",
"dedicated",
"host",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/dedicated_host.py#L230-L290 | train |
softlayer/softlayer-python | SoftLayer/managers/dedicated_host.py | DedicatedHostManager.place_order | def place_order(self, hostname, domain, location, flavor, hourly, router=None):
"""Places an order for a dedicated host.
See get_create_options() for valid arguments.
:param string hostname: server hostname
:param string domain: server domain name
:param string location: locati... | python | def place_order(self, hostname, domain, location, flavor, hourly, router=None):
"""Places an order for a dedicated host.
See get_create_options() for valid arguments.
:param string hostname: server hostname
:param string domain: server domain name
:param string location: locati... | [
"def",
"place_order",
"(",
"self",
",",
"hostname",
",",
"domain",
",",
"location",
",",
"flavor",
",",
"hourly",
",",
"router",
"=",
"None",
")",
":",
"create_options",
"=",
"self",
".",
"_generate_create_dict",
"(",
"hostname",
"=",
"hostname",
",",
"rou... | Places an order for a dedicated host.
See get_create_options() for valid arguments.
:param string hostname: server hostname
:param string domain: server domain name
:param string location: location (datacenter) name
:param boolean hourly: True if using hourly pricing (default).... | [
"Places",
"an",
"order",
"for",
"a",
"dedicated",
"host",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/dedicated_host.py#L292-L311 | train |
softlayer/softlayer-python | SoftLayer/managers/dedicated_host.py | DedicatedHostManager.verify_order | def verify_order(self, hostname, domain, location, hourly, flavor, router=None):
"""Verifies an order for a dedicated host.
See :func:`place_order` for a list of available options.
"""
create_options = self._generate_create_dict(hostname=hostname,
... | python | def verify_order(self, hostname, domain, location, hourly, flavor, router=None):
"""Verifies an order for a dedicated host.
See :func:`place_order` for a list of available options.
"""
create_options = self._generate_create_dict(hostname=hostname,
... | [
"def",
"verify_order",
"(",
"self",
",",
"hostname",
",",
"domain",
",",
"location",
",",
"hourly",
",",
"flavor",
",",
"router",
"=",
"None",
")",
":",
"create_options",
"=",
"self",
".",
"_generate_create_dict",
"(",
"hostname",
"=",
"hostname",
",",
"ro... | Verifies an order for a dedicated host.
See :func:`place_order` for a list of available options. | [
"Verifies",
"an",
"order",
"for",
"a",
"dedicated",
"host",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/dedicated_host.py#L313-L326 | train |
softlayer/softlayer-python | SoftLayer/managers/dedicated_host.py | DedicatedHostManager._generate_create_dict | def _generate_create_dict(self,
hostname=None,
domain=None,
flavor=None,
router=None,
datacenter=None,
hourly=True):
"""Translates a... | python | def _generate_create_dict(self,
hostname=None,
domain=None,
flavor=None,
router=None,
datacenter=None,
hourly=True):
"""Translates a... | [
"def",
"_generate_create_dict",
"(",
"self",
",",
"hostname",
"=",
"None",
",",
"domain",
"=",
"None",
",",
"flavor",
"=",
"None",
",",
"router",
"=",
"None",
",",
"datacenter",
"=",
"None",
",",
"hourly",
"=",
"True",
")",
":",
"package",
"=",
"self",... | Translates args into a dictionary for creating a dedicated host. | [
"Translates",
"args",
"into",
"a",
"dictionary",
"for",
"creating",
"a",
"dedicated",
"host",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/dedicated_host.py#L328-L368 | train |
softlayer/softlayer-python | SoftLayer/managers/dedicated_host.py | DedicatedHostManager.get_create_options | def get_create_options(self):
"""Returns valid options for ordering a dedicated host."""
package = self._get_package()
# Locations
locations = []
for region in package['regions']:
locations.append({
'name': region['location']['location']['longName'],
... | python | def get_create_options(self):
"""Returns valid options for ordering a dedicated host."""
package = self._get_package()
# Locations
locations = []
for region in package['regions']:
locations.append({
'name': region['location']['location']['longName'],
... | [
"def",
"get_create_options",
"(",
"self",
")",
":",
"package",
"=",
"self",
".",
"_get_package",
"(",
")",
"locations",
"=",
"[",
"]",
"for",
"region",
"in",
"package",
"[",
"'regions'",
"]",
":",
"locations",
".",
"append",
"(",
"{",
"'name'",
":",
"r... | Returns valid options for ordering a dedicated host. | [
"Returns",
"valid",
"options",
"for",
"ordering",
"a",
"dedicated",
"host",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/dedicated_host.py#L400-L420 | train |
softlayer/softlayer-python | SoftLayer/managers/dedicated_host.py | DedicatedHostManager._get_price | def _get_price(self, package):
"""Returns valid price for ordering a dedicated host."""
for price in package['prices']:
if not price.get('locationGroupId'):
return price['id']
raise SoftLayer.SoftLayerError("Could not find valid price") | python | def _get_price(self, package):
"""Returns valid price for ordering a dedicated host."""
for price in package['prices']:
if not price.get('locationGroupId'):
return price['id']
raise SoftLayer.SoftLayerError("Could not find valid price") | [
"def",
"_get_price",
"(",
"self",
",",
"package",
")",
":",
"for",
"price",
"in",
"package",
"[",
"'prices'",
"]",
":",
"if",
"not",
"price",
".",
"get",
"(",
"'locationGroupId'",
")",
":",
"return",
"price",
"[",
"'id'",
"]",
"raise",
"SoftLayer",
"."... | Returns valid price for ordering a dedicated host. | [
"Returns",
"valid",
"price",
"for",
"ordering",
"a",
"dedicated",
"host",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/dedicated_host.py#L422-L429 | train |
softlayer/softlayer-python | SoftLayer/managers/dedicated_host.py | DedicatedHostManager._get_item | def _get_item(self, package, flavor):
"""Returns the item for ordering a dedicated host."""
for item in package['items']:
if item['keyName'] == flavor:
return item
raise SoftLayer.SoftLayerError("Could not find valid item for: '%s'" % flavor) | python | def _get_item(self, package, flavor):
"""Returns the item for ordering a dedicated host."""
for item in package['items']:
if item['keyName'] == flavor:
return item
raise SoftLayer.SoftLayerError("Could not find valid item for: '%s'" % flavor) | [
"def",
"_get_item",
"(",
"self",
",",
"package",
",",
"flavor",
")",
":",
"for",
"item",
"in",
"package",
"[",
"'items'",
"]",
":",
"if",
"item",
"[",
"'keyName'",
"]",
"==",
"flavor",
":",
"return",
"item",
"raise",
"SoftLayer",
".",
"SoftLayerError",
... | Returns the item for ordering a dedicated host. | [
"Returns",
"the",
"item",
"for",
"ordering",
"a",
"dedicated",
"host",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/dedicated_host.py#L431-L438 | train |
softlayer/softlayer-python | SoftLayer/managers/dedicated_host.py | DedicatedHostManager._get_backend_router | def _get_backend_router(self, locations, item):
"""Returns valid router options for ordering a dedicated host."""
mask = '''
id,
hostname
'''
cpu_count = item['capacity']
for capacity in item['bundleItems']:
for category in capacity['categorie... | python | def _get_backend_router(self, locations, item):
"""Returns valid router options for ordering a dedicated host."""
mask = '''
id,
hostname
'''
cpu_count = item['capacity']
for capacity in item['bundleItems']:
for category in capacity['categorie... | [
"def",
"_get_backend_router",
"(",
"self",
",",
"locations",
",",
"item",
")",
":",
"mask",
"=",
"cpu_count",
"=",
"item",
"[",
"'capacity'",
"]",
"for",
"capacity",
"in",
"item",
"[",
"'bundleItems'",
"]",
":",
"for",
"category",
"in",
"capacity",
"[",
... | Returns valid router options for ordering a dedicated host. | [
"Returns",
"valid",
"router",
"options",
"for",
"ordering",
"a",
"dedicated",
"host",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/dedicated_host.py#L440-L498 | train |
softlayer/softlayer-python | SoftLayer/managers/dedicated_host.py | DedicatedHostManager._get_default_router | def _get_default_router(self, routers, router_name=None):
"""Returns the default router for ordering a dedicated host."""
if router_name is None:
for router in routers:
if router['id'] is not None:
return router['id']
else:
for router i... | python | def _get_default_router(self, routers, router_name=None):
"""Returns the default router for ordering a dedicated host."""
if router_name is None:
for router in routers:
if router['id'] is not None:
return router['id']
else:
for router i... | [
"def",
"_get_default_router",
"(",
"self",
",",
"routers",
",",
"router_name",
"=",
"None",
")",
":",
"if",
"router_name",
"is",
"None",
":",
"for",
"router",
"in",
"routers",
":",
"if",
"router",
"[",
"'id'",
"]",
"is",
"not",
"None",
":",
"return",
"... | Returns the default router for ordering a dedicated host. | [
"Returns",
"the",
"default",
"router",
"for",
"ordering",
"a",
"dedicated",
"host",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/dedicated_host.py#L500-L511 | train |
softlayer/softlayer-python | SoftLayer/managers/dedicated_host.py | DedicatedHostManager.get_router_options | def get_router_options(self, datacenter=None, flavor=None):
"""Returns available backend routers for the dedicated host."""
package = self._get_package()
location = self._get_location(package['regions'], datacenter)
item = self._get_item(package, flavor)
return self._get_backen... | python | def get_router_options(self, datacenter=None, flavor=None):
"""Returns available backend routers for the dedicated host."""
package = self._get_package()
location = self._get_location(package['regions'], datacenter)
item = self._get_item(package, flavor)
return self._get_backen... | [
"def",
"get_router_options",
"(",
"self",
",",
"datacenter",
"=",
"None",
",",
"flavor",
"=",
"None",
")",
":",
"package",
"=",
"self",
".",
"_get_package",
"(",
")",
"location",
"=",
"self",
".",
"_get_location",
"(",
"package",
"[",
"'regions'",
"]",
"... | Returns available backend routers for the dedicated host. | [
"Returns",
"available",
"backend",
"routers",
"for",
"the",
"dedicated",
"host",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/dedicated_host.py#L513-L520 | train |
softlayer/softlayer-python | SoftLayer/managers/dedicated_host.py | DedicatedHostManager._delete_guest | def _delete_guest(self, guest_id):
"""Deletes a guest and returns 'Cancelled' or and Exception message"""
msg = 'Cancelled'
try:
self.guest.deleteObject(id=guest_id)
except SoftLayer.SoftLayerAPIError as e:
msg = 'Exception: ' + e.faultString
return msg | python | def _delete_guest(self, guest_id):
"""Deletes a guest and returns 'Cancelled' or and Exception message"""
msg = 'Cancelled'
try:
self.guest.deleteObject(id=guest_id)
except SoftLayer.SoftLayerAPIError as e:
msg = 'Exception: ' + e.faultString
return msg | [
"def",
"_delete_guest",
"(",
"self",
",",
"guest_id",
")",
":",
"msg",
"=",
"'Cancelled'",
"try",
":",
"self",
".",
"guest",
".",
"deleteObject",
"(",
"id",
"=",
"guest_id",
")",
"except",
"SoftLayer",
".",
"SoftLayerAPIError",
"as",
"e",
":",
"msg",
"="... | Deletes a guest and returns 'Cancelled' or and Exception message | [
"Deletes",
"a",
"guest",
"and",
"returns",
"Cancelled",
"or",
"and",
"Exception",
"message"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/dedicated_host.py#L522-L530 | train |
softlayer/softlayer-python | SoftLayer/shell/completer.py | _click_autocomplete | def _click_autocomplete(root, text):
"""Completer generator for click applications."""
try:
parts = shlex.split(text)
except ValueError:
raise StopIteration
location, incomplete = _click_resolve_command(root, parts)
if not text.endswith(' ') and not incomplete and text:
rai... | python | def _click_autocomplete(root, text):
"""Completer generator for click applications."""
try:
parts = shlex.split(text)
except ValueError:
raise StopIteration
location, incomplete = _click_resolve_command(root, parts)
if not text.endswith(' ') and not incomplete and text:
rai... | [
"def",
"_click_autocomplete",
"(",
"root",
",",
"text",
")",
":",
"try",
":",
"parts",
"=",
"shlex",
".",
"split",
"(",
"text",
")",
"except",
"ValueError",
":",
"raise",
"StopIteration",
"location",
",",
"incomplete",
"=",
"_click_resolve_command",
"(",
"ro... | Completer generator for click applications. | [
"Completer",
"generator",
"for",
"click",
"applications",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/shell/completer.py#L28-L54 | train |
softlayer/softlayer-python | SoftLayer/shell/completer.py | _click_resolve_command | def _click_resolve_command(root, parts):
"""Return the click command and the left over text given some vargs."""
location = root
incomplete = ''
for part in parts:
incomplete = part
if not part[0:2].isalnum():
continue
try:
next_location = location.get_c... | python | def _click_resolve_command(root, parts):
"""Return the click command and the left over text given some vargs."""
location = root
incomplete = ''
for part in parts:
incomplete = part
if not part[0:2].isalnum():
continue
try:
next_location = location.get_c... | [
"def",
"_click_resolve_command",
"(",
"root",
",",
"parts",
")",
":",
"location",
"=",
"root",
"incomplete",
"=",
"''",
"for",
"part",
"in",
"parts",
":",
"incomplete",
"=",
"part",
"if",
"not",
"part",
"[",
"0",
":",
"2",
"]",
".",
"isalnum",
"(",
"... | Return the click command and the left over text given some vargs. | [
"Return",
"the",
"click",
"command",
"and",
"the",
"left",
"over",
"text",
"given",
"some",
"vargs",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/shell/completer.py#L57-L75 | train |
softlayer/softlayer-python | SoftLayer/CLI/user/edit_permissions.py | cli | def cli(env, identifier, enable, permission, from_user):
"""Enable or Disable specific permissions."""
mgr = SoftLayer.UserManager(env.client)
user_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'username')
result = False
if from_user:
from_user_id = helpers.resolve_id(mgr.resolve_ids,... | python | def cli(env, identifier, enable, permission, from_user):
"""Enable or Disable specific permissions."""
mgr = SoftLayer.UserManager(env.client)
user_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'username')
result = False
if from_user:
from_user_id = helpers.resolve_id(mgr.resolve_ids,... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
",",
"enable",
",",
"permission",
",",
"from_user",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"UserManager",
"(",
"env",
".",
"client",
")",
"user_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"mgr",
".",
"reso... | Enable or Disable specific permissions. | [
"Enable",
"or",
"Disable",
"specific",
"permissions",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/user/edit_permissions.py#L22-L38 | train |
softlayer/softlayer-python | SoftLayer/managers/cdn.py | CDNManager.list_accounts | def list_accounts(self):
"""Lists CDN accounts for the active user."""
account = self.client['Account']
mask = 'cdnAccounts[%s]' % ', '.join(['id',
'createDate',
'cdnAccountName',
... | python | def list_accounts(self):
"""Lists CDN accounts for the active user."""
account = self.client['Account']
mask = 'cdnAccounts[%s]' % ', '.join(['id',
'createDate',
'cdnAccountName',
... | [
"def",
"list_accounts",
"(",
"self",
")",
":",
"account",
"=",
"self",
".",
"client",
"[",
"'Account'",
"]",
"mask",
"=",
"'cdnAccounts[%s]'",
"%",
"', '",
".",
"join",
"(",
"[",
"'id'",
",",
"'createDate'",
",",
"'cdnAccountName'",
",",
"'cdnSolutionName'",... | Lists CDN accounts for the active user. | [
"Lists",
"CDN",
"accounts",
"for",
"the",
"active",
"user",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/cdn.py#L30-L40 | train |
softlayer/softlayer-python | SoftLayer/managers/cdn.py | CDNManager.get_account | def get_account(self, account_id, **kwargs):
"""Retrieves a CDN account with the specified account ID.
:param account_id int: the numeric ID associated with the CDN account.
:param dict \\*\\*kwargs: additional arguments to include in the object
mask.
"""... | python | def get_account(self, account_id, **kwargs):
"""Retrieves a CDN account with the specified account ID.
:param account_id int: the numeric ID associated with the CDN account.
:param dict \\*\\*kwargs: additional arguments to include in the object
mask.
"""... | [
"def",
"get_account",
"(",
"self",
",",
"account_id",
",",
"**",
"kwargs",
")",
":",
"if",
"'mask'",
"not",
"in",
"kwargs",
":",
"kwargs",
"[",
"'mask'",
"]",
"=",
"'status'",
"return",
"self",
".",
"account",
".",
"getObject",
"(",
"id",
"=",
"account... | Retrieves a CDN account with the specified account ID.
:param account_id int: the numeric ID associated with the CDN account.
:param dict \\*\\*kwargs: additional arguments to include in the object
mask. | [
"Retrieves",
"a",
"CDN",
"account",
"with",
"the",
"specified",
"account",
"ID",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/cdn.py#L42-L53 | train |
softlayer/softlayer-python | SoftLayer/managers/cdn.py | CDNManager.get_origins | def get_origins(self, account_id, **kwargs):
"""Retrieves list of origin pull mappings for a specified CDN account.
:param account_id int: the numeric ID associated with the CDN account.
:param dict \\*\\*kwargs: additional arguments to include in the object
mask... | python | def get_origins(self, account_id, **kwargs):
"""Retrieves list of origin pull mappings for a specified CDN account.
:param account_id int: the numeric ID associated with the CDN account.
:param dict \\*\\*kwargs: additional arguments to include in the object
mask... | [
"def",
"get_origins",
"(",
"self",
",",
"account_id",
",",
"**",
"kwargs",
")",
":",
"return",
"self",
".",
"account",
".",
"getOriginPullMappingInformation",
"(",
"id",
"=",
"account_id",
",",
"**",
"kwargs",
")"
] | Retrieves list of origin pull mappings for a specified CDN account.
:param account_id int: the numeric ID associated with the CDN account.
:param dict \\*\\*kwargs: additional arguments to include in the object
mask. | [
"Retrieves",
"list",
"of",
"origin",
"pull",
"mappings",
"for",
"a",
"specified",
"CDN",
"account",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/cdn.py#L55-L64 | train |
softlayer/softlayer-python | SoftLayer/managers/cdn.py | CDNManager.add_origin | def add_origin(self, account_id, media_type, origin_url, cname=None,
secure=False):
"""Adds an original pull mapping to an origin-pull.
:param int account_id: the numeric ID associated with the CDN account.
:param string media_type: the media type/protocol associated with thi... | python | def add_origin(self, account_id, media_type, origin_url, cname=None,
secure=False):
"""Adds an original pull mapping to an origin-pull.
:param int account_id: the numeric ID associated with the CDN account.
:param string media_type: the media type/protocol associated with thi... | [
"def",
"add_origin",
"(",
"self",
",",
"account_id",
",",
"media_type",
",",
"origin_url",
",",
"cname",
"=",
"None",
",",
"secure",
"=",
"False",
")",
":",
"config",
"=",
"{",
"'mediaType'",
":",
"media_type",
",",
"'originUrl'",
":",
"origin_url",
",",
... | Adds an original pull mapping to an origin-pull.
:param int account_id: the numeric ID associated with the CDN account.
:param string media_type: the media type/protocol associated with this
origin pull mapping; valid values are HTTP,
... | [
"Adds",
"an",
"original",
"pull",
"mapping",
"to",
"an",
"origin",
"-",
"pull",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/cdn.py#L66-L91 | train |
softlayer/softlayer-python | SoftLayer/managers/cdn.py | CDNManager.remove_origin | def remove_origin(self, account_id, origin_id):
"""Removes an origin pull mapping with the given origin pull ID.
:param int account_id: the CDN account ID from which the mapping should
be deleted.
:param int origin_id: the origin pull mapping ID to delete.
... | python | def remove_origin(self, account_id, origin_id):
"""Removes an origin pull mapping with the given origin pull ID.
:param int account_id: the CDN account ID from which the mapping should
be deleted.
:param int origin_id: the origin pull mapping ID to delete.
... | [
"def",
"remove_origin",
"(",
"self",
",",
"account_id",
",",
"origin_id",
")",
":",
"return",
"self",
".",
"account",
".",
"deleteOriginPullRule",
"(",
"origin_id",
",",
"id",
"=",
"account_id",
")"
] | Removes an origin pull mapping with the given origin pull ID.
:param int account_id: the CDN account ID from which the mapping should
be deleted.
:param int origin_id: the origin pull mapping ID to delete. | [
"Removes",
"an",
"origin",
"pull",
"mapping",
"with",
"the",
"given",
"origin",
"pull",
"ID",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/cdn.py#L93-L101 | train |
softlayer/softlayer-python | SoftLayer/managers/cdn.py | CDNManager.load_content | def load_content(self, account_id, urls):
"""Prefetches one or more URLs to the CDN edge nodes.
:param int account_id: the CDN account ID into which content should be
preloaded.
:param urls: a string or a list of strings representing the CDN URLs
... | python | def load_content(self, account_id, urls):
"""Prefetches one or more URLs to the CDN edge nodes.
:param int account_id: the CDN account ID into which content should be
preloaded.
:param urls: a string or a list of strings representing the CDN URLs
... | [
"def",
"load_content",
"(",
"self",
",",
"account_id",
",",
"urls",
")",
":",
"if",
"isinstance",
"(",
"urls",
",",
"six",
".",
"string_types",
")",
":",
"urls",
"=",
"[",
"urls",
"]",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"urls",
... | Prefetches one or more URLs to the CDN edge nodes.
:param int account_id: the CDN account ID into which content should be
preloaded.
:param urls: a string or a list of strings representing the CDN URLs
that should be pre-loaded.
:returns: true... | [
"Prefetches",
"one",
"or",
"more",
"URLs",
"to",
"the",
"CDN",
"edge",
"nodes",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/cdn.py#L103-L123 | train |
softlayer/softlayer-python | SoftLayer/managers/cdn.py | CDNManager.purge_content | def purge_content(self, account_id, urls):
"""Purges one or more URLs from the CDN edge nodes.
:param int account_id: the CDN account ID from which content should
be purged.
:param urls: a string or a list of strings representing the CDN URLs
... | python | def purge_content(self, account_id, urls):
"""Purges one or more URLs from the CDN edge nodes.
:param int account_id: the CDN account ID from which content should
be purged.
:param urls: a string or a list of strings representing the CDN URLs
... | [
"def",
"purge_content",
"(",
"self",
",",
"account_id",
",",
"urls",
")",
":",
"if",
"isinstance",
"(",
"urls",
",",
"six",
".",
"string_types",
")",
":",
"urls",
"=",
"[",
"urls",
"]",
"content_list",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
... | Purges one or more URLs from the CDN edge nodes.
:param int account_id: the CDN account ID from which content should
be purged.
:param urls: a string or a list of strings representing the CDN URLs
that should be purged.
:returns: a list of Sof... | [
"Purges",
"one",
"or",
"more",
"URLs",
"from",
"the",
"CDN",
"edge",
"nodes",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/cdn.py#L125-L144 | train |
softlayer/softlayer-python | SoftLayer/managers/load_balancer.py | LoadBalancerManager.get_lb_pkgs | def get_lb_pkgs(self):
"""Retrieves the local load balancer packages.
:returns: A dictionary containing the load balancer packages
"""
_filter = {'items': {'description':
utils.query_filter('*Load Balancer*')}}
packages = self.prod_pkg.getItems(id=... | python | def get_lb_pkgs(self):
"""Retrieves the local load balancer packages.
:returns: A dictionary containing the load balancer packages
"""
_filter = {'items': {'description':
utils.query_filter('*Load Balancer*')}}
packages = self.prod_pkg.getItems(id=... | [
"def",
"get_lb_pkgs",
"(",
"self",
")",
":",
"_filter",
"=",
"{",
"'items'",
":",
"{",
"'description'",
":",
"utils",
".",
"query_filter",
"(",
"'*Load Balancer*'",
")",
"}",
"}",
"packages",
"=",
"self",
".",
"prod_pkg",
".",
"getItems",
"(",
"id",
"=",... | Retrieves the local load balancer packages.
:returns: A dictionary containing the load balancer packages | [
"Retrieves",
"the",
"local",
"load",
"balancer",
"packages",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/load_balancer.py#L27-L41 | train |
softlayer/softlayer-python | SoftLayer/managers/load_balancer.py | LoadBalancerManager._get_location | def _get_location(self, datacenter_name):
"""Returns the location of the specified datacenter.
:param string datacenter_name: The datacenter to create
the loadbalancer in
:returns: the location id of the given datacenter
"""
datacenters =... | python | def _get_location(self, datacenter_name):
"""Returns the location of the specified datacenter.
:param string datacenter_name: The datacenter to create
the loadbalancer in
:returns: the location id of the given datacenter
"""
datacenters =... | [
"def",
"_get_location",
"(",
"self",
",",
"datacenter_name",
")",
":",
"datacenters",
"=",
"self",
".",
"client",
"[",
"'Location'",
"]",
".",
"getDataCenters",
"(",
")",
"for",
"datacenter",
"in",
"datacenters",
":",
"if",
"datacenter",
"[",
"'name'",
"]",
... | Returns the location of the specified datacenter.
:param string datacenter_name: The datacenter to create
the loadbalancer in
:returns: the location id of the given datacenter | [
"Returns",
"the",
"location",
"of",
"the",
"specified",
"datacenter",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/load_balancer.py#L73-L86 | train |
softlayer/softlayer-python | SoftLayer/managers/load_balancer.py | LoadBalancerManager.cancel_lb | def cancel_lb(self, loadbal_id):
"""Cancels the specified load balancer.
:param int loadbal_id: Load Balancer ID to be cancelled.
"""
lb_billing = self.lb_svc.getBillingItem(id=loadbal_id)
billing_id = lb_billing['id']
billing_item = self.client['Billing_Item']
... | python | def cancel_lb(self, loadbal_id):
"""Cancels the specified load balancer.
:param int loadbal_id: Load Balancer ID to be cancelled.
"""
lb_billing = self.lb_svc.getBillingItem(id=loadbal_id)
billing_id = lb_billing['id']
billing_item = self.client['Billing_Item']
... | [
"def",
"cancel_lb",
"(",
"self",
",",
"loadbal_id",
")",
":",
"lb_billing",
"=",
"self",
".",
"lb_svc",
".",
"getBillingItem",
"(",
"id",
"=",
"loadbal_id",
")",
"billing_id",
"=",
"lb_billing",
"[",
"'id'",
"]",
"billing_item",
"=",
"self",
".",
"client",... | Cancels the specified load balancer.
:param int loadbal_id: Load Balancer ID to be cancelled. | [
"Cancels",
"the",
"specified",
"load",
"balancer",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/load_balancer.py#L88-L97 | train |
softlayer/softlayer-python | SoftLayer/managers/load_balancer.py | LoadBalancerManager.add_local_lb | def add_local_lb(self, price_item_id, datacenter):
"""Creates a local load balancer in the specified data center.
:param int price_item_id: The price item ID for the load balancer
:param string datacenter: The datacenter to create the loadbalancer in
:returns: A dictionary containing th... | python | def add_local_lb(self, price_item_id, datacenter):
"""Creates a local load balancer in the specified data center.
:param int price_item_id: The price item ID for the load balancer
:param string datacenter: The datacenter to create the loadbalancer in
:returns: A dictionary containing th... | [
"def",
"add_local_lb",
"(",
"self",
",",
"price_item_id",
",",
"datacenter",
")",
":",
"product_order",
"=",
"{",
"'complexType'",
":",
"'SoftLayer_Container_Product_Order_Network_'",
"'LoadBalancer'",
",",
"'quantity'",
":",
"1",
",",
"'packageId'",
":",
"0",
",",
... | Creates a local load balancer in the specified data center.
:param int price_item_id: The price item ID for the load balancer
:param string datacenter: The datacenter to create the loadbalancer in
:returns: A dictionary containing the product order | [
"Creates",
"a",
"local",
"load",
"balancer",
"in",
"the",
"specified",
"data",
"center",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/load_balancer.py#L99-L115 | train |
softlayer/softlayer-python | SoftLayer/managers/load_balancer.py | LoadBalancerManager.get_local_lb | def get_local_lb(self, loadbal_id, **kwargs):
"""Returns a specified local load balancer given the id.
:param int loadbal_id: The id of the load balancer to retrieve
:returns: A dictionary containing the details of the load balancer
"""
if 'mask' not in kwargs:
kwar... | python | def get_local_lb(self, loadbal_id, **kwargs):
"""Returns a specified local load balancer given the id.
:param int loadbal_id: The id of the load balancer to retrieve
:returns: A dictionary containing the details of the load balancer
"""
if 'mask' not in kwargs:
kwar... | [
"def",
"get_local_lb",
"(",
"self",
",",
"loadbal_id",
",",
"**",
"kwargs",
")",
":",
"if",
"'mask'",
"not",
"in",
"kwargs",
":",
"kwargs",
"[",
"'mask'",
"]",
"=",
"(",
"'loadBalancerHardware[datacenter], '",
"'ipAddress, virtualServers[serviceGroups'",
"'[routingM... | Returns a specified local load balancer given the id.
:param int loadbal_id: The id of the load balancer to retrieve
:returns: A dictionary containing the details of the load balancer | [
"Returns",
"a",
"specified",
"local",
"load",
"balancer",
"given",
"the",
"id",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/load_balancer.py#L126-L140 | train |
softlayer/softlayer-python | SoftLayer/managers/load_balancer.py | LoadBalancerManager.delete_service | def delete_service(self, service_id):
"""Deletes a service from the loadbal_id.
:param int service_id: The id of the service to delete
"""
svc = self.client['Network_Application_Delivery_Controller_'
'LoadBalancer_Service']
return svc.deleteObject(id=... | python | def delete_service(self, service_id):
"""Deletes a service from the loadbal_id.
:param int service_id: The id of the service to delete
"""
svc = self.client['Network_Application_Delivery_Controller_'
'LoadBalancer_Service']
return svc.deleteObject(id=... | [
"def",
"delete_service",
"(",
"self",
",",
"service_id",
")",
":",
"svc",
"=",
"self",
".",
"client",
"[",
"'Network_Application_Delivery_Controller_'",
"'LoadBalancer_Service'",
"]",
"return",
"svc",
".",
"deleteObject",
"(",
"id",
"=",
"service_id",
")"
] | Deletes a service from the loadbal_id.
:param int service_id: The id of the service to delete | [
"Deletes",
"a",
"service",
"from",
"the",
"loadbal_id",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/load_balancer.py#L142-L151 | train |
softlayer/softlayer-python | SoftLayer/managers/load_balancer.py | LoadBalancerManager.delete_service_group | def delete_service_group(self, group_id):
"""Deletes a service group from the loadbal_id.
:param int group_id: The id of the service group to delete
"""
svc = self.client['Network_Application_Delivery_Controller_'
'LoadBalancer_VirtualServer']
return ... | python | def delete_service_group(self, group_id):
"""Deletes a service group from the loadbal_id.
:param int group_id: The id of the service group to delete
"""
svc = self.client['Network_Application_Delivery_Controller_'
'LoadBalancer_VirtualServer']
return ... | [
"def",
"delete_service_group",
"(",
"self",
",",
"group_id",
")",
":",
"svc",
"=",
"self",
".",
"client",
"[",
"'Network_Application_Delivery_Controller_'",
"'LoadBalancer_VirtualServer'",
"]",
"return",
"svc",
".",
"deleteObject",
"(",
"id",
"=",
"group_id",
")"
] | Deletes a service group from the loadbal_id.
:param int group_id: The id of the service group to delete | [
"Deletes",
"a",
"service",
"group",
"from",
"the",
"loadbal_id",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/load_balancer.py#L153-L162 | train |
softlayer/softlayer-python | SoftLayer/managers/load_balancer.py | LoadBalancerManager.toggle_service_status | def toggle_service_status(self, service_id):
"""Toggles the service status.
:param int service_id: The id of the service to delete
"""
svc = self.client['Network_Application_Delivery_Controller_'
'LoadBalancer_Service']
return svc.toggleStatus(id=servi... | python | def toggle_service_status(self, service_id):
"""Toggles the service status.
:param int service_id: The id of the service to delete
"""
svc = self.client['Network_Application_Delivery_Controller_'
'LoadBalancer_Service']
return svc.toggleStatus(id=servi... | [
"def",
"toggle_service_status",
"(",
"self",
",",
"service_id",
")",
":",
"svc",
"=",
"self",
".",
"client",
"[",
"'Network_Application_Delivery_Controller_'",
"'LoadBalancer_Service'",
"]",
"return",
"svc",
".",
"toggleStatus",
"(",
"id",
"=",
"service_id",
")"
] | Toggles the service status.
:param int service_id: The id of the service to delete | [
"Toggles",
"the",
"service",
"status",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/load_balancer.py#L164-L172 | train |
softlayer/softlayer-python | SoftLayer/managers/load_balancer.py | LoadBalancerManager.edit_service | def edit_service(self, loadbal_id, service_id, ip_address_id=None,
port=None, enabled=None, hc_type=None, weight=None):
"""Edits an existing service properties.
:param int loadbal_id: The id of the loadbal where the service resides
:param int service_id: The id of the servi... | python | def edit_service(self, loadbal_id, service_id, ip_address_id=None,
port=None, enabled=None, hc_type=None, weight=None):
"""Edits an existing service properties.
:param int loadbal_id: The id of the loadbal where the service resides
:param int service_id: The id of the servi... | [
"def",
"edit_service",
"(",
"self",
",",
"loadbal_id",
",",
"service_id",
",",
"ip_address_id",
"=",
"None",
",",
"port",
"=",
"None",
",",
"enabled",
"=",
"None",
",",
"hc_type",
"=",
"None",
",",
"weight",
"=",
"None",
")",
":",
"_filter",
"=",
"{",
... | Edits an existing service properties.
:param int loadbal_id: The id of the loadbal where the service resides
:param int service_id: The id of the service to edit
:param string ip_address: The ip address of the service
:param int port: the port of the service
:param bool enabled:... | [
"Edits",
"an",
"existing",
"service",
"properties",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/load_balancer.py#L174-L214 | train |
softlayer/softlayer-python | SoftLayer/managers/load_balancer.py | LoadBalancerManager.add_service | def add_service(self, loadbal_id, service_group_id, ip_address_id,
port=80, enabled=True, hc_type=21, weight=1):
"""Adds a new service to the service group.
:param int loadbal_id: The id of the loadbal where the service resides
:param int service_group_id: The group to add t... | python | def add_service(self, loadbal_id, service_group_id, ip_address_id,
port=80, enabled=True, hc_type=21, weight=1):
"""Adds a new service to the service group.
:param int loadbal_id: The id of the loadbal where the service resides
:param int service_group_id: The group to add t... | [
"def",
"add_service",
"(",
"self",
",",
"loadbal_id",
",",
"service_group_id",
",",
"ip_address_id",
",",
"port",
"=",
"80",
",",
"enabled",
"=",
"True",
",",
"hc_type",
"=",
"21",
",",
"weight",
"=",
"1",
")",
":",
"kwargs",
"=",
"utils",
".",
"Nested... | Adds a new service to the service group.
:param int loadbal_id: The id of the loadbal where the service resides
:param int service_group_id: The group to add the service to
:param int ip_address id: The ip address ID of the service
:param int port: the port of the service
:param... | [
"Adds",
"a",
"new",
"service",
"to",
"the",
"service",
"group",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/load_balancer.py#L216-L254 | train |
softlayer/softlayer-python | SoftLayer/managers/load_balancer.py | LoadBalancerManager.add_service_group | def add_service_group(self, lb_id, allocation=100, port=80,
routing_type=2, routing_method=10):
"""Adds a new service group to the load balancer.
:param int loadbal_id: The id of the loadbal where the service resides
:param int allocation: percent of connections to all... | python | def add_service_group(self, lb_id, allocation=100, port=80,
routing_type=2, routing_method=10):
"""Adds a new service group to the load balancer.
:param int loadbal_id: The id of the loadbal where the service resides
:param int allocation: percent of connections to all... | [
"def",
"add_service_group",
"(",
"self",
",",
"lb_id",
",",
"allocation",
"=",
"100",
",",
"port",
"=",
"80",
",",
"routing_type",
"=",
"2",
",",
"routing_method",
"=",
"10",
")",
":",
"mask",
"=",
"'virtualServers[serviceGroups[services[groupReferences]]]'",
"l... | Adds a new service group to the load balancer.
:param int loadbal_id: The id of the loadbal where the service resides
:param int allocation: percent of connections to allocate toward the
group
:param int port: the port of the service group
:param int routi... | [
"Adds",
"a",
"new",
"service",
"group",
"to",
"the",
"load",
"balancer",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/load_balancer.py#L256-L282 | train |
softlayer/softlayer-python | SoftLayer/managers/load_balancer.py | LoadBalancerManager.edit_service_group | def edit_service_group(self, loadbal_id, group_id, allocation=None,
port=None, routing_type=None, routing_method=None):
"""Edit an existing service group.
:param int loadbal_id: The id of the loadbal where the service resides
:param int group_id: The id of the service... | python | def edit_service_group(self, loadbal_id, group_id, allocation=None,
port=None, routing_type=None, routing_method=None):
"""Edit an existing service group.
:param int loadbal_id: The id of the loadbal where the service resides
:param int group_id: The id of the service... | [
"def",
"edit_service_group",
"(",
"self",
",",
"loadbal_id",
",",
"group_id",
",",
"allocation",
"=",
"None",
",",
"port",
"=",
"None",
",",
"routing_type",
"=",
"None",
",",
"routing_method",
"=",
"None",
")",
":",
"mask",
"=",
"'virtualServers[serviceGroups[... | Edit an existing service group.
:param int loadbal_id: The id of the loadbal where the service resides
:param int group_id: The id of the service group
:param int allocation: the % of connections to allocate to the group
:param int port: the port of the service group
:param int ... | [
"Edit",
"an",
"existing",
"service",
"group",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/load_balancer.py#L284-L314 | train |
softlayer/softlayer-python | SoftLayer/managers/load_balancer.py | LoadBalancerManager.reset_service_group | def reset_service_group(self, loadbal_id, group_id):
"""Resets all the connections on the service group.
:param int loadbal_id: The id of the loadbal
:param int group_id: The id of the service group to reset
"""
_filter = {'virtualServers': {'id': utils.query_filter(group_id)}}... | python | def reset_service_group(self, loadbal_id, group_id):
"""Resets all the connections on the service group.
:param int loadbal_id: The id of the loadbal
:param int group_id: The id of the service group to reset
"""
_filter = {'virtualServers': {'id': utils.query_filter(group_id)}}... | [
"def",
"reset_service_group",
"(",
"self",
",",
"loadbal_id",
",",
"group_id",
")",
":",
"_filter",
"=",
"{",
"'virtualServers'",
":",
"{",
"'id'",
":",
"utils",
".",
"query_filter",
"(",
"group_id",
")",
"}",
"}",
"virtual_servers",
"=",
"self",
".",
"lb_... | Resets all the connections on the service group.
:param int loadbal_id: The id of the loadbal
:param int group_id: The id of the service group to reset | [
"Resets",
"all",
"the",
"connections",
"on",
"the",
"service",
"group",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/load_balancer.py#L316-L331 | train |
softlayer/softlayer-python | SoftLayer/CLI/image/detail.py | cli | def cli(env, identifier):
"""Get details for an image."""
image_mgr = SoftLayer.ImageManager(env.client)
image_id = helpers.resolve_id(image_mgr.resolve_ids, identifier, 'image')
image = image_mgr.get_image(image_id, mask=image_mod.DETAIL_MASK)
disk_space = 0
datacenters = []
for child in ... | python | def cli(env, identifier):
"""Get details for an image."""
image_mgr = SoftLayer.ImageManager(env.client)
image_id = helpers.resolve_id(image_mgr.resolve_ids, identifier, 'image')
image = image_mgr.get_image(image_id, mask=image_mod.DETAIL_MASK)
disk_space = 0
datacenters = []
for child in ... | [
"def",
"cli",
"(",
"env",
",",
"identifier",
")",
":",
"image_mgr",
"=",
"SoftLayer",
".",
"ImageManager",
"(",
"env",
".",
"client",
")",
"image_id",
"=",
"helpers",
".",
"resolve_id",
"(",
"image_mgr",
".",
"resolve_ids",
",",
"identifier",
",",
"'image'... | Get details for an image. | [
"Get",
"details",
"for",
"an",
"image",
"."
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/image/detail.py#L17-L63 | train |
softlayer/softlayer-python | SoftLayer/CLI/file/snapshot/enable.py | cli | def cli(env, volume_id, schedule_type, retention_count,
minute, hour, day_of_week):
"""Enables snapshots for a given volume on the specified schedule"""
file_manager = SoftLayer.FileStorageManager(env.client)
valid_schedule_types = {'INTERVAL', 'HOURLY', 'DAILY', 'WEEKLY'}
valid_days = {'SUNDAY... | python | def cli(env, volume_id, schedule_type, retention_count,
minute, hour, day_of_week):
"""Enables snapshots for a given volume on the specified schedule"""
file_manager = SoftLayer.FileStorageManager(env.client)
valid_schedule_types = {'INTERVAL', 'HOURLY', 'DAILY', 'WEEKLY'}
valid_days = {'SUNDAY... | [
"def",
"cli",
"(",
"env",
",",
"volume_id",
",",
"schedule_type",
",",
"retention_count",
",",
"minute",
",",
"hour",
",",
"day_of_week",
")",
":",
"file_manager",
"=",
"SoftLayer",
".",
"FileStorageManager",
"(",
"env",
".",
"client",
")",
"valid_schedule_typ... | Enables snapshots for a given volume on the specified schedule | [
"Enables",
"snapshots",
"for",
"a",
"given",
"volume",
"on",
"the",
"specified",
"schedule"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/file/snapshot/enable.py#L28-L61 | train |
softlayer/softlayer-python | SoftLayer/managers/account.py | AccountManager.get_upcoming_events | def get_upcoming_events(self):
"""Retreives a list of Notification_Occurrence_Events that have not ended yet
:return: SoftLayer_Notification_Occurrence_Event
"""
mask = "mask[id, subject, startDate, endDate, statusCode, acknowledgedFlag, impactedResourceCount, updateCount]"
_fil... | python | def get_upcoming_events(self):
"""Retreives a list of Notification_Occurrence_Events that have not ended yet
:return: SoftLayer_Notification_Occurrence_Event
"""
mask = "mask[id, subject, startDate, endDate, statusCode, acknowledgedFlag, impactedResourceCount, updateCount]"
_fil... | [
"def",
"get_upcoming_events",
"(",
"self",
")",
":",
"mask",
"=",
"\"mask[id, subject, startDate, endDate, statusCode, acknowledgedFlag, impactedResourceCount, updateCount]\"",
"_filter",
"=",
"{",
"'endDate'",
":",
"{",
"'operation'",
":",
"'> sysdate'",
"}",
",",
"'startDat... | Retreives a list of Notification_Occurrence_Events that have not ended yet
:return: SoftLayer_Notification_Occurrence_Event | [
"Retreives",
"a",
"list",
"of",
"Notification_Occurrence_Events",
"that",
"have",
"not",
"ended",
"yet"
] | 9f181be08cc3668353b05a6de0cb324f52cff6fa | https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/account.py#L50-L68 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.