id
int32
0
252k
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
1,300
protream/iquery
iquery/trains.py
TrainTicketsQuery._valid_date
def _valid_date(self): """Check and return a valid query date.""" date = self._parse_date(self.date) if not date: exit_after_echo(INVALID_DATE) try: date = datetime.strptime(date, '%Y%m%d') except ValueError: exit_after_echo(INVALID_DATE) ...
python
def _valid_date(self): """Check and return a valid query date.""" date = self._parse_date(self.date) if not date: exit_after_echo(INVALID_DATE) try: date = datetime.strptime(date, '%Y%m%d') except ValueError: exit_after_echo(INVALID_DATE) ...
[ "def", "_valid_date", "(", "self", ")", ":", "date", "=", "self", ".", "_parse_date", "(", "self", ".", "date", ")", "if", "not", "date", ":", "exit_after_echo", "(", "INVALID_DATE", ")", "try", ":", "date", "=", "datetime", ".", "strptime", "(", "date...
Check and return a valid query date.
[ "Check", "and", "return", "a", "valid", "query", "date", "." ]
7272e68af610f1dd63cf695209cfa44b75adc0e6
https://github.com/protream/iquery/blob/7272e68af610f1dd63cf695209cfa44b75adc0e6/iquery/trains.py#L177-L194
1,301
protream/iquery
iquery/trains.py
TrainTicketsQuery._parse_date
def _parse_date(date): """Parse from the user input `date`. e.g. current year 2016: input 6-26, 626, ... return 2016626 input 2016-6-26, 2016/6/26, ... retrun 2016626 This fn wouldn't check the date, it only gather the number as a string. """ result = ''.j...
python
def _parse_date(date): """Parse from the user input `date`. e.g. current year 2016: input 6-26, 626, ... return 2016626 input 2016-6-26, 2016/6/26, ... retrun 2016626 This fn wouldn't check the date, it only gather the number as a string. """ result = ''.j...
[ "def", "_parse_date", "(", "date", ")", ":", "result", "=", "''", ".", "join", "(", "re", ".", "findall", "(", "'\\d'", ",", "date", ")", ")", "l", "=", "len", "(", "result", ")", "# User only input month and day, eg 6-1, 6.26, 0626...", "if", "l", "in", ...
Parse from the user input `date`. e.g. current year 2016: input 6-26, 626, ... return 2016626 input 2016-6-26, 2016/6/26, ... retrun 2016626 This fn wouldn't check the date, it only gather the number as a string.
[ "Parse", "from", "the", "user", "input", "date", "." ]
7272e68af610f1dd63cf695209cfa44b75adc0e6
https://github.com/protream/iquery/blob/7272e68af610f1dd63cf695209cfa44b75adc0e6/iquery/trains.py#L197-L218
1,302
protream/iquery
iquery/trains.py
TrainTicketsQuery._build_params
def _build_params(self): """Have no idea why wrong params order can't get data. So, use `OrderedDict` here. """ d = OrderedDict() d['purpose_codes'] = 'ADULT' d['queryDate'] = self._valid_date d['from_station'] = self._from_station_telecode d['to_station']...
python
def _build_params(self): """Have no idea why wrong params order can't get data. So, use `OrderedDict` here. """ d = OrderedDict() d['purpose_codes'] = 'ADULT' d['queryDate'] = self._valid_date d['from_station'] = self._from_station_telecode d['to_station']...
[ "def", "_build_params", "(", "self", ")", ":", "d", "=", "OrderedDict", "(", ")", "d", "[", "'purpose_codes'", "]", "=", "'ADULT'", "d", "[", "'queryDate'", "]", "=", "self", ".", "_valid_date", "d", "[", "'from_station'", "]", "=", "self", ".", "_from...
Have no idea why wrong params order can't get data. So, use `OrderedDict` here.
[ "Have", "no", "idea", "why", "wrong", "params", "order", "can", "t", "get", "data", ".", "So", "use", "OrderedDict", "here", "." ]
7272e68af610f1dd63cf695209cfa44b75adc0e6
https://github.com/protream/iquery/blob/7272e68af610f1dd63cf695209cfa44b75adc0e6/iquery/trains.py#L220-L229
1,303
protream/iquery
iquery/showes.py
ShowTicketsQuery.date_range
def date_range(self): """Generate date range according to the `days` user input.""" try: days = int(self.days) except ValueError: exit_after_echo(QUERY_DAYS_INVALID) if days < 1: exit_after_echo(QUERY_DAYS_INVALID) start = datetime.today() ...
python
def date_range(self): """Generate date range according to the `days` user input.""" try: days = int(self.days) except ValueError: exit_after_echo(QUERY_DAYS_INVALID) if days < 1: exit_after_echo(QUERY_DAYS_INVALID) start = datetime.today() ...
[ "def", "date_range", "(", "self", ")", ":", "try", ":", "days", "=", "int", "(", "self", ".", "days", ")", "except", "ValueError", ":", "exit_after_echo", "(", "QUERY_DAYS_INVALID", ")", "if", "days", "<", "1", ":", "exit_after_echo", "(", "QUERY_DAYS_INVA...
Generate date range according to the `days` user input.
[ "Generate", "date", "range", "according", "to", "the", "days", "user", "input", "." ]
7272e68af610f1dd63cf695209cfa44b75adc0e6
https://github.com/protream/iquery/blob/7272e68af610f1dd63cf695209cfa44b75adc0e6/iquery/showes.py#L121-L135
1,304
protream/iquery
iquery/hospitals.py
query
def query(params): """`params` is a city name or a city name + hospital name. CLI: 1. query all putian hospitals in a city: $ iquery -p 南京 +------+ | 南京 | +------+ |... | +------+ |... | +------+ ... 2. query if the...
python
def query(params): """`params` is a city name or a city name + hospital name. CLI: 1. query all putian hospitals in a city: $ iquery -p 南京 +------+ | 南京 | +------+ |... | +------+ |... | +------+ ... 2. query if the...
[ "def", "query", "(", "params", ")", ":", "r", "=", "requests_get", "(", "QUERY_URL", ",", "verify", "=", "True", ")", "return", "HospitalCollection", "(", "r", ".", "json", "(", ")", ",", "params", ")" ]
`params` is a city name or a city name + hospital name. CLI: 1. query all putian hospitals in a city: $ iquery -p 南京 +------+ | 南京 | +------+ |... | +------+ |... | +------+ ... 2. query if the hospital in the city is p...
[ "params", "is", "a", "city", "name", "or", "a", "city", "name", "+", "hospital", "name", "." ]
7272e68af610f1dd63cf695209cfa44b75adc0e6
https://github.com/protream/iquery/blob/7272e68af610f1dd63cf695209cfa44b75adc0e6/iquery/hospitals.py#L67-L99
1,305
protream/iquery
iquery/core.py
cli
def cli(): """Various information query via command line. Usage: iquery -l <song> [singer] iquery (-m|电影) iquery (-c|彩票) iquery -p <city> iquery -p <city> <hospital> iquery <city> <show> [days] iquery [-dgktz] <from> <to> <date> Arguments: from 出发站 to ...
python
def cli(): """Various information query via command line. Usage: iquery -l <song> [singer] iquery (-m|电影) iquery (-c|彩票) iquery -p <city> iquery -p <city> <hospital> iquery <city> <show> [days] iquery [-dgktz] <from> <to> <date> Arguments: from 出发站 to ...
[ "def", "cli", "(", ")", ":", "if", "args", ".", "is_asking_for_help", ":", "exit_after_echo", "(", "cli", ".", "__doc__", ",", "color", "=", "None", ")", "elif", "args", ".", "is_querying_lottery", ":", "from", ".", "lottery", "import", "query", "result", ...
Various information query via command line. Usage: iquery -l <song> [singer] iquery (-m|电影) iquery (-c|彩票) iquery -p <city> iquery -p <city> <hospital> iquery <city> <show> [days] iquery [-dgktz] <from> <to> <date> Arguments: from 出发站 to 到达站 date ...
[ "Various", "information", "query", "via", "command", "line", "." ]
7272e68af610f1dd63cf695209cfa44b75adc0e6
https://github.com/protream/iquery/blob/7272e68af610f1dd63cf695209cfa44b75adc0e6/iquery/core.py#L44-L117
1,306
protream/iquery
iquery/movies.py
query
def query(): """Query hot movies infomation from douban.""" r = requests_get(QUERY_URL) try: rows = r.json()['subject_collection_items'] except (IndexError, TypeError): rows = [] return MoviesCollection(rows)
python
def query(): """Query hot movies infomation from douban.""" r = requests_get(QUERY_URL) try: rows = r.json()['subject_collection_items'] except (IndexError, TypeError): rows = [] return MoviesCollection(rows)
[ "def", "query", "(", ")", ":", "r", "=", "requests_get", "(", "QUERY_URL", ")", "try", ":", "rows", "=", "r", ".", "json", "(", ")", "[", "'subject_collection_items'", "]", "except", "(", "IndexError", ",", "TypeError", ")", ":", "rows", "=", "[", "]...
Query hot movies infomation from douban.
[ "Query", "hot", "movies", "infomation", "from", "douban", "." ]
7272e68af610f1dd63cf695209cfa44b75adc0e6
https://github.com/protream/iquery/blob/7272e68af610f1dd63cf695209cfa44b75adc0e6/iquery/movies.py#L93-L103
1,307
OCA/knowledge
document_page_approval/models/document_page_history.py
DocumentPageHistory.action_draft
def action_draft(self): """Set a change request as draft""" for rec in self: if not rec.state == 'cancelled': raise UserError( _('You need to cancel it before reopening.')) if not (rec.am_i_owner or rec.am_i_approver): raise Use...
python
def action_draft(self): """Set a change request as draft""" for rec in self: if not rec.state == 'cancelled': raise UserError( _('You need to cancel it before reopening.')) if not (rec.am_i_owner or rec.am_i_approver): raise Use...
[ "def", "action_draft", "(", "self", ")", ":", "for", "rec", "in", "self", ":", "if", "not", "rec", ".", "state", "==", "'cancelled'", ":", "raise", "UserError", "(", "_", "(", "'You need to cancel it before reopening.'", ")", ")", "if", "not", "(", "rec", ...
Set a change request as draft
[ "Set", "a", "change", "request", "as", "draft" ]
77fa06019c989b56ce34839e9f6343577184223a
https://github.com/OCA/knowledge/blob/77fa06019c989b56ce34839e9f6343577184223a/document_page_approval/models/document_page_history.py#L54-L64
1,308
OCA/knowledge
document_page_approval/models/document_page_history.py
DocumentPageHistory.action_to_approve
def action_to_approve(self): """Set a change request as to approve""" template = self.env.ref( 'document_page_approval.email_template_new_draft_need_approval') approver_gid = self.env.ref( 'document_page_approval.group_document_approver_user') for rec in self: ...
python
def action_to_approve(self): """Set a change request as to approve""" template = self.env.ref( 'document_page_approval.email_template_new_draft_need_approval') approver_gid = self.env.ref( 'document_page_approval.group_document_approver_user') for rec in self: ...
[ "def", "action_to_approve", "(", "self", ")", ":", "template", "=", "self", ".", "env", ".", "ref", "(", "'document_page_approval.email_template_new_draft_need_approval'", ")", "approver_gid", "=", "self", ".", "env", ".", "ref", "(", "'document_page_approval.group_do...
Set a change request as to approve
[ "Set", "a", "change", "request", "as", "to", "approve" ]
77fa06019c989b56ce34839e9f6343577184223a
https://github.com/OCA/knowledge/blob/77fa06019c989b56ce34839e9f6343577184223a/document_page_approval/models/document_page_history.py#L67-L92
1,309
OCA/knowledge
document_page_approval/models/document_page_history.py
DocumentPageHistory.action_approve
def action_approve(self): """Set a change request as approved.""" for rec in self: if rec.state not in ['draft', 'to approve']: raise UserError( _("Can't approve page in '%s' state.") % rec.state) if not rec.am_i_approver: raise...
python
def action_approve(self): """Set a change request as approved.""" for rec in self: if rec.state not in ['draft', 'to approve']: raise UserError( _("Can't approve page in '%s' state.") % rec.state) if not rec.am_i_approver: raise...
[ "def", "action_approve", "(", "self", ")", ":", "for", "rec", "in", "self", ":", "if", "rec", ".", "state", "not", "in", "[", "'draft'", ",", "'to approve'", "]", ":", "raise", "UserError", "(", "_", "(", "\"Can't approve page in '%s' state.\"", ")", "%", ...
Set a change request as approved.
[ "Set", "a", "change", "request", "as", "approved", "." ]
77fa06019c989b56ce34839e9f6343577184223a
https://github.com/OCA/knowledge/blob/77fa06019c989b56ce34839e9f6343577184223a/document_page_approval/models/document_page_history.py#L95-L129
1,310
OCA/knowledge
document_page_approval/models/document_page_history.py
DocumentPageHistory.action_cancel
def action_cancel(self): """Set a change request as cancelled.""" self.write({'state': 'cancelled'}) for rec in self: rec.message_post( subtype='mt_comment', body=_( 'Change request <b>%s</b> has been cancelled by %s.' ...
python
def action_cancel(self): """Set a change request as cancelled.""" self.write({'state': 'cancelled'}) for rec in self: rec.message_post( subtype='mt_comment', body=_( 'Change request <b>%s</b> has been cancelled by %s.' ...
[ "def", "action_cancel", "(", "self", ")", ":", "self", ".", "write", "(", "{", "'state'", ":", "'cancelled'", "}", ")", "for", "rec", "in", "self", ":", "rec", ".", "message_post", "(", "subtype", "=", "'mt_comment'", ",", "body", "=", "_", "(", "'Ch...
Set a change request as cancelled.
[ "Set", "a", "change", "request", "as", "cancelled", "." ]
77fa06019c989b56ce34839e9f6343577184223a
https://github.com/OCA/knowledge/blob/77fa06019c989b56ce34839e9f6343577184223a/document_page_approval/models/document_page_history.py#L132-L141
1,311
OCA/knowledge
document_page_approval/models/document_page_history.py
DocumentPageHistory._compute_am_i_owner
def _compute_am_i_owner(self): """Check if current user is the owner""" for rec in self: rec.am_i_owner = (rec.create_uid == self.env.user)
python
def _compute_am_i_owner(self): """Check if current user is the owner""" for rec in self: rec.am_i_owner = (rec.create_uid == self.env.user)
[ "def", "_compute_am_i_owner", "(", "self", ")", ":", "for", "rec", "in", "self", ":", "rec", ".", "am_i_owner", "=", "(", "rec", ".", "create_uid", "==", "self", ".", "env", ".", "user", ")" ]
Check if current user is the owner
[ "Check", "if", "current", "user", "is", "the", "owner" ]
77fa06019c989b56ce34839e9f6343577184223a
https://github.com/OCA/knowledge/blob/77fa06019c989b56ce34839e9f6343577184223a/document_page_approval/models/document_page_history.py#L150-L153
1,312
OCA/knowledge
document_page_approval/models/document_page_history.py
DocumentPageHistory._compute_page_url
def _compute_page_url(self): """Compute the page url.""" for page in self: base_url = self.env['ir.config_parameter'].sudo().get_param( 'web.base.url', default='http://localhost:8069' ) page.page_url = ( '{}/web#db={}&i...
python
def _compute_page_url(self): """Compute the page url.""" for page in self: base_url = self.env['ir.config_parameter'].sudo().get_param( 'web.base.url', default='http://localhost:8069' ) page.page_url = ( '{}/web#db={}&i...
[ "def", "_compute_page_url", "(", "self", ")", ":", "for", "page", "in", "self", ":", "base_url", "=", "self", ".", "env", "[", "'ir.config_parameter'", "]", ".", "sudo", "(", ")", ".", "get_param", "(", "'web.base.url'", ",", "default", "=", "'http://local...
Compute the page url.
[ "Compute", "the", "page", "url", "." ]
77fa06019c989b56ce34839e9f6343577184223a
https://github.com/OCA/knowledge/blob/77fa06019c989b56ce34839e9f6343577184223a/document_page_approval/models/document_page_history.py#L156-L170
1,313
OCA/knowledge
document_page_approval/models/document_page_history.py
DocumentPageHistory._compute_diff
def _compute_diff(self): """Shows a diff between this version and the previous version""" history = self.env['document.page.history'] for rec in self: domain = [ ('page_id', '=', rec.page_id.id), ('state', '=', 'approved')] if rec.approved_...
python
def _compute_diff(self): """Shows a diff between this version and the previous version""" history = self.env['document.page.history'] for rec in self: domain = [ ('page_id', '=', rec.page_id.id), ('state', '=', 'approved')] if rec.approved_...
[ "def", "_compute_diff", "(", "self", ")", ":", "history", "=", "self", ".", "env", "[", "'document.page.history'", "]", "for", "rec", "in", "self", ":", "domain", "=", "[", "(", "'page_id'", ",", "'='", ",", "rec", ".", "page_id", ".", "id", ")", ","...
Shows a diff between this version and the previous version
[ "Shows", "a", "diff", "between", "this", "version", "and", "the", "previous", "version" ]
77fa06019c989b56ce34839e9f6343577184223a
https://github.com/OCA/knowledge/blob/77fa06019c989b56ce34839e9f6343577184223a/document_page_approval/models/document_page_history.py#L173-L186
1,314
OCA/knowledge
document_url/wizard/document_url.py
AddUrlWizard.action_add_url
def action_add_url(self): """Adds the URL with the given name as an ir.attachment record.""" if not self.env.context.get('active_model'): return attachment_obj = self.env['ir.attachment'] for form in self: url = parse.urlparse(form.url) if not url.sche...
python
def action_add_url(self): """Adds the URL with the given name as an ir.attachment record.""" if not self.env.context.get('active_model'): return attachment_obj = self.env['ir.attachment'] for form in self: url = parse.urlparse(form.url) if not url.sche...
[ "def", "action_add_url", "(", "self", ")", ":", "if", "not", "self", ".", "env", ".", "context", ".", "get", "(", "'active_model'", ")", ":", "return", "attachment_obj", "=", "self", ".", "env", "[", "'ir.attachment'", "]", "for", "form", "in", "self", ...
Adds the URL with the given name as an ir.attachment record.
[ "Adds", "the", "URL", "with", "the", "given", "name", "as", "an", "ir", ".", "attachment", "record", "." ]
77fa06019c989b56ce34839e9f6343577184223a
https://github.com/OCA/knowledge/blob/77fa06019c989b56ce34839e9f6343577184223a/document_url/wizard/document_url.py#L14-L32
1,315
OCA/knowledge
document_page_approval/models/document_page.py
DocumentPage._compute_is_approval_required
def _compute_is_approval_required(self): """Check if the document required approval based on his parents.""" for page in self: res = page.approval_required if page.parent_id: res = res or page.parent_id.is_approval_required page.is_approval_required = ...
python
def _compute_is_approval_required(self): """Check if the document required approval based on his parents.""" for page in self: res = page.approval_required if page.parent_id: res = res or page.parent_id.is_approval_required page.is_approval_required = ...
[ "def", "_compute_is_approval_required", "(", "self", ")", ":", "for", "page", "in", "self", ":", "res", "=", "page", ".", "approval_required", "if", "page", ".", "parent_id", ":", "res", "=", "res", "or", "page", ".", "parent_id", ".", "is_approval_required"...
Check if the document required approval based on his parents.
[ "Check", "if", "the", "document", "required", "approval", "based", "on", "his", "parents", "." ]
77fa06019c989b56ce34839e9f6343577184223a
https://github.com/OCA/knowledge/blob/77fa06019c989b56ce34839e9f6343577184223a/document_page_approval/models/document_page.py#L76-L82
1,316
OCA/knowledge
document_page_approval/models/document_page.py
DocumentPage._compute_approver_group_ids
def _compute_approver_group_ids(self): """Compute the approver groups based on his parents.""" for page in self: res = page.approver_gid if page.parent_id: res = res | page.parent_id.approver_group_ids page.approver_group_ids = res
python
def _compute_approver_group_ids(self): """Compute the approver groups based on his parents.""" for page in self: res = page.approver_gid if page.parent_id: res = res | page.parent_id.approver_group_ids page.approver_group_ids = res
[ "def", "_compute_approver_group_ids", "(", "self", ")", ":", "for", "page", "in", "self", ":", "res", "=", "page", ".", "approver_gid", "if", "page", ".", "parent_id", ":", "res", "=", "res", "|", "page", ".", "parent_id", ".", "approver_group_ids", "page"...
Compute the approver groups based on his parents.
[ "Compute", "the", "approver", "groups", "based", "on", "his", "parents", "." ]
77fa06019c989b56ce34839e9f6343577184223a
https://github.com/OCA/knowledge/blob/77fa06019c989b56ce34839e9f6343577184223a/document_page_approval/models/document_page.py#L86-L92
1,317
OCA/knowledge
document_page_approval/models/document_page.py
DocumentPage._compute_am_i_approver
def _compute_am_i_approver(self): """Check if the current user can approve changes to this page.""" for rec in self: rec.am_i_approver = rec.can_user_approve_this_page(self.env.user)
python
def _compute_am_i_approver(self): """Check if the current user can approve changes to this page.""" for rec in self: rec.am_i_approver = rec.can_user_approve_this_page(self.env.user)
[ "def", "_compute_am_i_approver", "(", "self", ")", ":", "for", "rec", "in", "self", ":", "rec", ".", "am_i_approver", "=", "rec", ".", "can_user_approve_this_page", "(", "self", ".", "env", ".", "user", ")" ]
Check if the current user can approve changes to this page.
[ "Check", "if", "the", "current", "user", "can", "approve", "changes", "to", "this", "page", "." ]
77fa06019c989b56ce34839e9f6343577184223a
https://github.com/OCA/knowledge/blob/77fa06019c989b56ce34839e9f6343577184223a/document_page_approval/models/document_page.py#L96-L99
1,318
OCA/knowledge
document_page_approval/models/document_page.py
DocumentPage.can_user_approve_this_page
def can_user_approve_this_page(self, user): """Check if a user can approve this page.""" self.ensure_one() # if it's not required, anyone can approve if not self.is_approval_required: return True # if user belongs to 'Knowledge / Manager', he can approve anything ...
python
def can_user_approve_this_page(self, user): """Check if a user can approve this page.""" self.ensure_one() # if it's not required, anyone can approve if not self.is_approval_required: return True # if user belongs to 'Knowledge / Manager', he can approve anything ...
[ "def", "can_user_approve_this_page", "(", "self", ",", "user", ")", ":", "self", ".", "ensure_one", "(", ")", "# if it's not required, anyone can approve", "if", "not", "self", ".", "is_approval_required", ":", "return", "True", "# if user belongs to 'Knowledge / Manager'...
Check if a user can approve this page.
[ "Check", "if", "a", "user", "can", "approve", "this", "page", "." ]
77fa06019c989b56ce34839e9f6343577184223a
https://github.com/OCA/knowledge/blob/77fa06019c989b56ce34839e9f6343577184223a/document_page_approval/models/document_page.py#L102-L119
1,319
watchforstock/evohome-client
evohomeclient2/location.py
Location.status
def status(self): """Retrieves the location status.""" response = requests.get( "https://tccna.honeywell.com/WebAPI/emea/api/v1/" "location/%s/status?includeTemperatureControlSystems=True" % self.locationId, headers=self.client._headers() ...
python
def status(self): """Retrieves the location status.""" response = requests.get( "https://tccna.honeywell.com/WebAPI/emea/api/v1/" "location/%s/status?includeTemperatureControlSystems=True" % self.locationId, headers=self.client._headers() ...
[ "def", "status", "(", "self", ")", ":", "response", "=", "requests", ".", "get", "(", "\"https://tccna.honeywell.com/WebAPI/emea/api/v1/\"", "\"location/%s/status?includeTemperatureControlSystems=True\"", "%", "self", ".", "locationId", ",", "headers", "=", "self", ".", ...
Retrieves the location status.
[ "Retrieves", "the", "location", "status", "." ]
f1cb9273e97946d79c0651f00a218abbf7ada53a
https://github.com/watchforstock/evohome-client/blob/f1cb9273e97946d79c0651f00a218abbf7ada53a/evohomeclient2/location.py#L26-L55
1,320
watchforstock/evohome-client
evohomeclient2/hotwater.py
HotWater.set_dhw_on
def set_dhw_on(self, until=None): """Sets the DHW on until a given time, or permanently.""" if until is None: data = {"Mode": "PermanentOverride", "State": "On", "UntilTime": None} else: data = {"Mode": "TemporaryOverride", ...
python
def set_dhw_on(self, until=None): """Sets the DHW on until a given time, or permanently.""" if until is None: data = {"Mode": "PermanentOverride", "State": "On", "UntilTime": None} else: data = {"Mode": "TemporaryOverride", ...
[ "def", "set_dhw_on", "(", "self", ",", "until", "=", "None", ")", ":", "if", "until", "is", "None", ":", "data", "=", "{", "\"Mode\"", ":", "\"PermanentOverride\"", ",", "\"State\"", ":", "\"On\"", ",", "\"UntilTime\"", ":", "None", "}", "else", ":", "...
Sets the DHW on until a given time, or permanently.
[ "Sets", "the", "DHW", "on", "until", "a", "given", "time", "or", "permanently", "." ]
f1cb9273e97946d79c0651f00a218abbf7ada53a
https://github.com/watchforstock/evohome-client/blob/f1cb9273e97946d79c0651f00a218abbf7ada53a/evohomeclient2/hotwater.py#L34-L45
1,321
watchforstock/evohome-client
evohomeclient2/hotwater.py
HotWater.set_dhw_off
def set_dhw_off(self, until=None): """Sets the DHW off until a given time, or permanently.""" if until is None: data = {"Mode": "PermanentOverride", "State": "Off", "UntilTime": None} else: data = {"Mode": "TemporaryOverride", ...
python
def set_dhw_off(self, until=None): """Sets the DHW off until a given time, or permanently.""" if until is None: data = {"Mode": "PermanentOverride", "State": "Off", "UntilTime": None} else: data = {"Mode": "TemporaryOverride", ...
[ "def", "set_dhw_off", "(", "self", ",", "until", "=", "None", ")", ":", "if", "until", "is", "None", ":", "data", "=", "{", "\"Mode\"", ":", "\"PermanentOverride\"", ",", "\"State\"", ":", "\"Off\"", ",", "\"UntilTime\"", ":", "None", "}", "else", ":", ...
Sets the DHW off until a given time, or permanently.
[ "Sets", "the", "DHW", "off", "until", "a", "given", "time", "or", "permanently", "." ]
f1cb9273e97946d79c0651f00a218abbf7ada53a
https://github.com/watchforstock/evohome-client/blob/f1cb9273e97946d79c0651f00a218abbf7ada53a/evohomeclient2/hotwater.py#L47-L58
1,322
watchforstock/evohome-client
evohomeclient2/zone.py
ZoneBase.schedule
def schedule(self): """Gets the schedule for the given zone""" response = requests.get( "https://tccna.honeywell.com/WebAPI/emea/api/v1" "/%s/%s/schedule" % (self.zone_type, self.zoneId), headers=self.client._headers() # pylint: d...
python
def schedule(self): """Gets the schedule for the given zone""" response = requests.get( "https://tccna.honeywell.com/WebAPI/emea/api/v1" "/%s/%s/schedule" % (self.zone_type, self.zoneId), headers=self.client._headers() # pylint: d...
[ "def", "schedule", "(", "self", ")", ":", "response", "=", "requests", ".", "get", "(", "\"https://tccna.honeywell.com/WebAPI/emea/api/v1\"", "\"/%s/%s/schedule\"", "%", "(", "self", ".", "zone_type", ",", "self", ".", "zoneId", ")", ",", "headers", "=", "self",...
Gets the schedule for the given zone
[ "Gets", "the", "schedule", "for", "the", "given", "zone" ]
f1cb9273e97946d79c0651f00a218abbf7ada53a
https://github.com/watchforstock/evohome-client/blob/f1cb9273e97946d79c0651f00a218abbf7ada53a/evohomeclient2/zone.py#L16-L42
1,323
watchforstock/evohome-client
evohomeclient2/zone.py
ZoneBase.set_schedule
def set_schedule(self, zone_info): """Sets the schedule for this zone""" # must only POST json, otherwise server API handler raises exceptions try: json.loads(zone_info) except ValueError as error: raise ValueError("zone_info must be valid JSON: ", error) ...
python
def set_schedule(self, zone_info): """Sets the schedule for this zone""" # must only POST json, otherwise server API handler raises exceptions try: json.loads(zone_info) except ValueError as error: raise ValueError("zone_info must be valid JSON: ", error) ...
[ "def", "set_schedule", "(", "self", ",", "zone_info", ")", ":", "# must only POST json, otherwise server API handler raises exceptions", "try", ":", "json", ".", "loads", "(", "zone_info", ")", "except", "ValueError", "as", "error", ":", "raise", "ValueError", "(", ...
Sets the schedule for this zone
[ "Sets", "the", "schedule", "for", "this", "zone" ]
f1cb9273e97946d79c0651f00a218abbf7ada53a
https://github.com/watchforstock/evohome-client/blob/f1cb9273e97946d79c0651f00a218abbf7ada53a/evohomeclient2/zone.py#L44-L63
1,324
watchforstock/evohome-client
evohomeclient/__init__.py
EvohomeClient.temperatures
def temperatures(self, force_refresh=False): """Retrieve the current details for each zone. Returns a generator.""" self._populate_full_data(force_refresh) for device in self.full_data['devices']: set_point = 0 status = "" if 'heatSetpoint' in device['thermost...
python
def temperatures(self, force_refresh=False): """Retrieve the current details for each zone. Returns a generator.""" self._populate_full_data(force_refresh) for device in self.full_data['devices']: set_point = 0 status = "" if 'heatSetpoint' in device['thermost...
[ "def", "temperatures", "(", "self", ",", "force_refresh", "=", "False", ")", ":", "self", ".", "_populate_full_data", "(", "force_refresh", ")", "for", "device", "in", "self", ".", "full_data", "[", "'devices'", "]", ":", "set_point", "=", "0", "status", "...
Retrieve the current details for each zone. Returns a generator.
[ "Retrieve", "the", "current", "details", "for", "each", "zone", ".", "Returns", "a", "generator", "." ]
f1cb9273e97946d79c0651f00a218abbf7ada53a
https://github.com/watchforstock/evohome-client/blob/f1cb9273e97946d79c0651f00a218abbf7ada53a/evohomeclient/__init__.py#L115-L133
1,325
watchforstock/evohome-client
evohomeclient/__init__.py
EvohomeClient.get_modes
def get_modes(self, zone): """Returns the set of modes the device can be assigned.""" self._populate_full_data() device = self._get_device(zone) return device['thermostat']['allowedModes']
python
def get_modes(self, zone): """Returns the set of modes the device can be assigned.""" self._populate_full_data() device = self._get_device(zone) return device['thermostat']['allowedModes']
[ "def", "get_modes", "(", "self", ",", "zone", ")", ":", "self", ".", "_populate_full_data", "(", ")", "device", "=", "self", ".", "_get_device", "(", "zone", ")", "return", "device", "[", "'thermostat'", "]", "[", "'allowedModes'", "]" ]
Returns the set of modes the device can be assigned.
[ "Returns", "the", "set", "of", "modes", "the", "device", "can", "be", "assigned", "." ]
f1cb9273e97946d79c0651f00a218abbf7ada53a
https://github.com/watchforstock/evohome-client/blob/f1cb9273e97946d79c0651f00a218abbf7ada53a/evohomeclient/__init__.py#L135-L139
1,326
watchforstock/evohome-client
evohomeclient/__init__.py
EvohomeClient.set_temperature
def set_temperature(self, zone, temperature, until=None): """Sets the temperature of the given zone.""" if until is None: data = {"Value": temperature, "Status": "Hold", "NextTime": None} else: data = {"Value": temperature, "Status": "Temporary", ...
python
def set_temperature(self, zone, temperature, until=None): """Sets the temperature of the given zone.""" if until is None: data = {"Value": temperature, "Status": "Hold", "NextTime": None} else: data = {"Value": temperature, "Status": "Temporary", ...
[ "def", "set_temperature", "(", "self", ",", "zone", ",", "temperature", ",", "until", "=", "None", ")", ":", "if", "until", "is", "None", ":", "data", "=", "{", "\"Value\"", ":", "temperature", ",", "\"Status\"", ":", "\"Hold\"", ",", "\"NextTime\"", ":"...
Sets the temperature of the given zone.
[ "Sets", "the", "temperature", "of", "the", "given", "zone", "." ]
f1cb9273e97946d79c0651f00a218abbf7ada53a
https://github.com/watchforstock/evohome-client/blob/f1cb9273e97946d79c0651f00a218abbf7ada53a/evohomeclient/__init__.py#L266-L275
1,327
watchforstock/evohome-client
evohomeclient/__init__.py
EvohomeClient._set_dhw
def _set_dhw(self, status="Scheduled", mode=None, next_time=None): """Set DHW to On, Off or Auto, either indefinitely, or until a specified time. """ data = {"Status": status, "Mode": mode, "NextTime": next_time, "SpecialModes": None, ...
python
def _set_dhw(self, status="Scheduled", mode=None, next_time=None): """Set DHW to On, Off or Auto, either indefinitely, or until a specified time. """ data = {"Status": status, "Mode": mode, "NextTime": next_time, "SpecialModes": None, ...
[ "def", "_set_dhw", "(", "self", ",", "status", "=", "\"Scheduled\"", ",", "mode", "=", "None", ",", "next_time", "=", "None", ")", ":", "data", "=", "{", "\"Status\"", ":", "status", ",", "\"Mode\"", ":", "mode", ",", "\"NextTime\"", ":", "next_time", ...
Set DHW to On, Off or Auto, either indefinitely, or until a specified time.
[ "Set", "DHW", "to", "On", "Off", "or", "Auto", "either", "indefinitely", "or", "until", "a", "specified", "time", "." ]
f1cb9273e97946d79c0651f00a218abbf7ada53a
https://github.com/watchforstock/evohome-client/blob/f1cb9273e97946d79c0651f00a218abbf7ada53a/evohomeclient/__init__.py#L288-L311
1,328
watchforstock/evohome-client
evohomeclient/__init__.py
EvohomeClient.set_dhw_on
def set_dhw_on(self, until=None): """Set DHW to on, either indefinitely, or until a specified time. When On, the DHW controller will work to keep its target temperature at/above its target temperature. After the specified time, it will revert to its scheduled behaviour. """ ...
python
def set_dhw_on(self, until=None): """Set DHW to on, either indefinitely, or until a specified time. When On, the DHW controller will work to keep its target temperature at/above its target temperature. After the specified time, it will revert to its scheduled behaviour. """ ...
[ "def", "set_dhw_on", "(", "self", ",", "until", "=", "None", ")", ":", "time_until", "=", "None", "if", "until", "is", "None", "else", "until", ".", "strftime", "(", "'%Y-%m-%dT%H:%M:%SZ'", ")", "self", ".", "_set_dhw", "(", "status", "=", "\"Hold\"", ",...
Set DHW to on, either indefinitely, or until a specified time. When On, the DHW controller will work to keep its target temperature at/above its target temperature. After the specified time, it will revert to its scheduled behaviour.
[ "Set", "DHW", "to", "on", "either", "indefinitely", "or", "until", "a", "specified", "time", "." ]
f1cb9273e97946d79c0651f00a218abbf7ada53a
https://github.com/watchforstock/evohome-client/blob/f1cb9273e97946d79c0651f00a218abbf7ada53a/evohomeclient/__init__.py#L313-L324
1,329
watchforstock/evohome-client
evohomeclient2/__init__.py
EvohomeClient._headers
def _headers(self): """Ensure the Authorization Header has a valid Access Token.""" if not self.access_token or not self.access_token_expires: self._basic_login() elif datetime.now() > self.access_token_expires - timedelta(seconds=30): self._basic_login() return...
python
def _headers(self): """Ensure the Authorization Header has a valid Access Token.""" if not self.access_token or not self.access_token_expires: self._basic_login() elif datetime.now() > self.access_token_expires - timedelta(seconds=30): self._basic_login() return...
[ "def", "_headers", "(", "self", ")", ":", "if", "not", "self", ".", "access_token", "or", "not", "self", ".", "access_token_expires", ":", "self", ".", "_basic_login", "(", ")", "elif", "datetime", ".", "now", "(", ")", ">", "self", ".", "access_token_ex...
Ensure the Authorization Header has a valid Access Token.
[ "Ensure", "the", "Authorization", "Header", "has", "a", "valid", "Access", "Token", "." ]
f1cb9273e97946d79c0651f00a218abbf7ada53a
https://github.com/watchforstock/evohome-client/blob/f1cb9273e97946d79c0651f00a218abbf7ada53a/evohomeclient2/__init__.py#L84-L93
1,330
watchforstock/evohome-client
evohomeclient2/__init__.py
EvohomeClient._basic_login
def _basic_login(self): """Obtain a new access token from the vendor. First, try using the refresh_token, if one is available, otherwise authenticate using the user credentials. """ _LOGGER.debug("No/Expired/Invalid access_token, re-authenticating...") self.access_token ...
python
def _basic_login(self): """Obtain a new access token from the vendor. First, try using the refresh_token, if one is available, otherwise authenticate using the user credentials. """ _LOGGER.debug("No/Expired/Invalid access_token, re-authenticating...") self.access_token ...
[ "def", "_basic_login", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"No/Expired/Invalid access_token, re-authenticating...\"", ")", "self", ".", "access_token", "=", "self", ".", "access_token_expires", "=", "None", "if", "self", ".", "refresh_token", ":",...
Obtain a new access token from the vendor. First, try using the refresh_token, if one is available, otherwise authenticate using the user credentials.
[ "Obtain", "a", "new", "access", "token", "from", "the", "vendor", "." ]
f1cb9273e97946d79c0651f00a218abbf7ada53a
https://github.com/watchforstock/evohome-client/blob/f1cb9273e97946d79c0651f00a218abbf7ada53a/evohomeclient2/__init__.py#L95-L130
1,331
watchforstock/evohome-client
evohomeclient2/__init__.py
EvohomeClient.user_account
def user_account(self): """Return the user account information.""" self.account_info = None url = 'https://tccna.honeywell.com/WebAPI/emea/api/v1/userAccount' response = requests.get(url, headers=self._headers()) response.raise_for_status() self.account_info = response...
python
def user_account(self): """Return the user account information.""" self.account_info = None url = 'https://tccna.honeywell.com/WebAPI/emea/api/v1/userAccount' response = requests.get(url, headers=self._headers()) response.raise_for_status() self.account_info = response...
[ "def", "user_account", "(", "self", ")", ":", "self", ".", "account_info", "=", "None", "url", "=", "'https://tccna.honeywell.com/WebAPI/emea/api/v1/userAccount'", "response", "=", "requests", ".", "get", "(", "url", ",", "headers", "=", "self", ".", "_headers", ...
Return the user account information.
[ "Return", "the", "user", "account", "information", "." ]
f1cb9273e97946d79c0651f00a218abbf7ada53a
https://github.com/watchforstock/evohome-client/blob/f1cb9273e97946d79c0651f00a218abbf7ada53a/evohomeclient2/__init__.py#L192-L202
1,332
watchforstock/evohome-client
evohomeclient2/__init__.py
EvohomeClient.installation
def installation(self): """Return the details of the installation.""" self.locations = [] url = ("https://tccna.honeywell.com/WebAPI/emea/api/v1/location" "/installationInfo?userId=%s" "&includeTemperatureControlSystems=True" % self.account_info['use...
python
def installation(self): """Return the details of the installation.""" self.locations = [] url = ("https://tccna.honeywell.com/WebAPI/emea/api/v1/location" "/installationInfo?userId=%s" "&includeTemperatureControlSystems=True" % self.account_info['use...
[ "def", "installation", "(", "self", ")", ":", "self", ".", "locations", "=", "[", "]", "url", "=", "(", "\"https://tccna.honeywell.com/WebAPI/emea/api/v1/location\"", "\"/installationInfo?userId=%s\"", "\"&includeTemperatureControlSystems=True\"", "%", "self", ".", "account...
Return the details of the installation.
[ "Return", "the", "details", "of", "the", "installation", "." ]
f1cb9273e97946d79c0651f00a218abbf7ada53a
https://github.com/watchforstock/evohome-client/blob/f1cb9273e97946d79c0651f00a218abbf7ada53a/evohomeclient2/__init__.py#L204-L223
1,333
watchforstock/evohome-client
evohomeclient2/__init__.py
EvohomeClient.full_installation
def full_installation(self, location=None): """Return the full details of the installation.""" url = ("https://tccna.honeywell.com/WebAPI/emea/api/v1/location" "/%s/installationInfo?includeTemperatureControlSystems=True" % self._get_location(location)) response = r...
python
def full_installation(self, location=None): """Return the full details of the installation.""" url = ("https://tccna.honeywell.com/WebAPI/emea/api/v1/location" "/%s/installationInfo?includeTemperatureControlSystems=True" % self._get_location(location)) response = r...
[ "def", "full_installation", "(", "self", ",", "location", "=", "None", ")", ":", "url", "=", "(", "\"https://tccna.honeywell.com/WebAPI/emea/api/v1/location\"", "\"/%s/installationInfo?includeTemperatureControlSystems=True\"", "%", "self", ".", "_get_location", "(", "location...
Return the full details of the installation.
[ "Return", "the", "full", "details", "of", "the", "installation", "." ]
f1cb9273e97946d79c0651f00a218abbf7ada53a
https://github.com/watchforstock/evohome-client/blob/f1cb9273e97946d79c0651f00a218abbf7ada53a/evohomeclient2/__init__.py#L225-L234
1,334
watchforstock/evohome-client
evohomeclient2/__init__.py
EvohomeClient.gateway
def gateway(self): """Return the detail of the gateway.""" url = 'https://tccna.honeywell.com/WebAPI/emea/api/v1/gateway' response = requests.get(url, headers=self._headers()) response.raise_for_status() return response.json()
python
def gateway(self): """Return the detail of the gateway.""" url = 'https://tccna.honeywell.com/WebAPI/emea/api/v1/gateway' response = requests.get(url, headers=self._headers()) response.raise_for_status() return response.json()
[ "def", "gateway", "(", "self", ")", ":", "url", "=", "'https://tccna.honeywell.com/WebAPI/emea/api/v1/gateway'", "response", "=", "requests", ".", "get", "(", "url", ",", "headers", "=", "self", ".", "_headers", "(", ")", ")", "response", ".", "raise_for_status"...
Return the detail of the gateway.
[ "Return", "the", "detail", "of", "the", "gateway", "." ]
f1cb9273e97946d79c0651f00a218abbf7ada53a
https://github.com/watchforstock/evohome-client/blob/f1cb9273e97946d79c0651f00a218abbf7ada53a/evohomeclient2/__init__.py#L236-L243
1,335
watchforstock/evohome-client
evohomeclient2/controlsystem.py
ControlSystem.temperatures
def temperatures(self): """Return a generator with the details of each zone.""" self.location.status() if self.hotwater: yield { 'thermostat': 'DOMESTIC_HOT_WATER', 'id': self.hotwater.dhwId, 'name': '', 'temp': self.ho...
python
def temperatures(self): """Return a generator with the details of each zone.""" self.location.status() if self.hotwater: yield { 'thermostat': 'DOMESTIC_HOT_WATER', 'id': self.hotwater.dhwId, 'name': '', 'temp': self.ho...
[ "def", "temperatures", "(", "self", ")", ":", "self", ".", "location", ".", "status", "(", ")", "if", "self", ".", "hotwater", ":", "yield", "{", "'thermostat'", ":", "'DOMESTIC_HOT_WATER'", ",", "'id'", ":", "self", ".", "hotwater", ".", "dhwId", ",", ...
Return a generator with the details of each zone.
[ "Return", "a", "generator", "with", "the", "details", "of", "each", "zone", "." ]
f1cb9273e97946d79c0651f00a218abbf7ada53a
https://github.com/watchforstock/evohome-client/blob/f1cb9273e97946d79c0651f00a218abbf7ada53a/evohomeclient2/controlsystem.py#L92-L116
1,336
watchforstock/evohome-client
evohomeclient2/controlsystem.py
ControlSystem.zone_schedules_backup
def zone_schedules_backup(self, filename): """Backup all zones on control system to the given file.""" _LOGGER.info("Backing up schedules from ControlSystem: %s (%s)...", self.systemId, self.location.name) schedules = {} if self.hotwater: _LOGGER.info("...
python
def zone_schedules_backup(self, filename): """Backup all zones on control system to the given file.""" _LOGGER.info("Backing up schedules from ControlSystem: %s (%s)...", self.systemId, self.location.name) schedules = {} if self.hotwater: _LOGGER.info("...
[ "def", "zone_schedules_backup", "(", "self", ",", "filename", ")", ":", "_LOGGER", ".", "info", "(", "\"Backing up schedules from ControlSystem: %s (%s)...\"", ",", "self", ".", "systemId", ",", "self", ".", "location", ".", "name", ")", "schedules", "=", "{", "...
Backup all zones on control system to the given file.
[ "Backup", "all", "zones", "on", "control", "system", "to", "the", "given", "file", "." ]
f1cb9273e97946d79c0651f00a218abbf7ada53a
https://github.com/watchforstock/evohome-client/blob/f1cb9273e97946d79c0651f00a218abbf7ada53a/evohomeclient2/controlsystem.py#L118-L149
1,337
watchforstock/evohome-client
evohomeclient2/controlsystem.py
ControlSystem.zone_schedules_restore
def zone_schedules_restore(self, filename): """Restore all zones on control system from the given file.""" _LOGGER.info("Restoring schedules to ControlSystem %s (%s)...", self.systemId, self.location) _LOGGER.info("Reading from backup file: %s...", filename) with op...
python
def zone_schedules_restore(self, filename): """Restore all zones on control system from the given file.""" _LOGGER.info("Restoring schedules to ControlSystem %s (%s)...", self.systemId, self.location) _LOGGER.info("Reading from backup file: %s...", filename) with op...
[ "def", "zone_schedules_restore", "(", "self", ",", "filename", ")", ":", "_LOGGER", ".", "info", "(", "\"Restoring schedules to ControlSystem %s (%s)...\"", ",", "self", ".", "systemId", ",", "self", ".", "location", ")", "_LOGGER", ".", "info", "(", "\"Reading fr...
Restore all zones on control system from the given file.
[ "Restore", "all", "zones", "on", "control", "system", "from", "the", "given", "file", "." ]
f1cb9273e97946d79c0651f00a218abbf7ada53a
https://github.com/watchforstock/evohome-client/blob/f1cb9273e97946d79c0651f00a218abbf7ada53a/evohomeclient2/controlsystem.py#L151-L174
1,338
softlayer/softlayer-python
SoftLayer/CLI/order/item_list.py
cli
def cli(env, package_keyname, keyword, category): """List package items used for ordering. The item keyNames listed can be used with `slcli order place` to specify the items that are being ordered in the package. .. Note:: Items with a numbered category, like disk0 or gpu0, can be included ...
python
def cli(env, package_keyname, keyword, category): """List package items used for ordering. The item keyNames listed can be used with `slcli order place` to specify the items that are being ordered in the package. .. Note:: Items with a numbered category, like disk0 or gpu0, can be included ...
[ "def", "cli", "(", "env", ",", "package_keyname", ",", "keyword", ",", "category", ")", ":", "table", "=", "formatting", ".", "Table", "(", "COLUMNS", ")", "manager", "=", "ordering", ".", "OrderingManager", "(", "env", ".", "client", ")", "_filter", "="...
List package items used for ordering. The item keyNames listed can be used with `slcli order place` to specify the items that are being ordered in the package. .. Note:: Items with a numbered category, like disk0 or gpu0, can be included multiple times in an order to match how many of the ...
[ "List", "package", "items", "used", "for", "ordering", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/order/item_list.py#L18-L53
1,339
softlayer/softlayer-python
SoftLayer/CLI/order/item_list.py
sort_items
def sort_items(items): """sorts the items into a dictionary of categories, with a list of items""" sorted_items = {} for item in items: category = lookup(item, 'itemCategory', 'categoryCode') if sorted_items.get(category) is None: sorted_items[category] = [] sorted_items...
python
def sort_items(items): """sorts the items into a dictionary of categories, with a list of items""" sorted_items = {} for item in items: category = lookup(item, 'itemCategory', 'categoryCode') if sorted_items.get(category) is None: sorted_items[category] = [] sorted_items...
[ "def", "sort_items", "(", "items", ")", ":", "sorted_items", "=", "{", "}", "for", "item", "in", "items", ":", "category", "=", "lookup", "(", "item", ",", "'itemCategory'", ",", "'categoryCode'", ")", "if", "sorted_items", ".", "get", "(", "category", "...
sorts the items into a dictionary of categories, with a list of items
[ "sorts", "the", "items", "into", "a", "dictionary", "of", "categories", "with", "a", "list", "of", "items" ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/order/item_list.py#L56-L66
1,340
softlayer/softlayer-python
SoftLayer/CLI/vlan/list.py
cli
def cli(env, sortby, datacenter, number, name, limit): """List VLANs.""" mgr = SoftLayer.NetworkManager(env.client) table = formatting.Table(COLUMNS) table.sortby = sortby vlans = mgr.list_vlans(datacenter=datacenter, vlan_number=number, name=...
python
def cli(env, sortby, datacenter, number, name, limit): """List VLANs.""" mgr = SoftLayer.NetworkManager(env.client) table = formatting.Table(COLUMNS) table.sortby = sortby vlans = mgr.list_vlans(datacenter=datacenter, vlan_number=number, name=...
[ "def", "cli", "(", "env", ",", "sortby", ",", "datacenter", ",", "number", ",", "name", ",", "limit", ")", ":", "mgr", "=", "SoftLayer", ".", "NetworkManager", "(", "env", ".", "client", ")", "table", "=", "formatting", ".", "Table", "(", "COLUMNS", ...
List VLANs.
[ "List", "VLANs", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/vlan/list.py#L34-L58
1,341
softlayer/softlayer-python
SoftLayer/CLI/nas/list.py
cli
def cli(env): """List NAS accounts.""" account = env.client['Account'] nas_accounts = account.getNasNetworkStorage( mask='eventCount,serviceResource[datacenter.name]') table = formatting.Table(['id', 'datacenter', 'size', 'server']) for nas_account in nas_accounts: table.add_row(...
python
def cli(env): """List NAS accounts.""" account = env.client['Account'] nas_accounts = account.getNasNetworkStorage( mask='eventCount,serviceResource[datacenter.name]') table = formatting.Table(['id', 'datacenter', 'size', 'server']) for nas_account in nas_accounts: table.add_row(...
[ "def", "cli", "(", "env", ")", ":", "account", "=", "env", ".", "client", "[", "'Account'", "]", "nas_accounts", "=", "account", ".", "getNasNetworkStorage", "(", "mask", "=", "'eventCount,serviceResource[datacenter.name]'", ")", "table", "=", "formatting", ".",...
List NAS accounts.
[ "List", "NAS", "accounts", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/nas/list.py#L13-L36
1,342
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", ")", ":", "# Try to use a client with username/api key", "if", "len", "(", "secret", ")", "==", "64", ":", "try", ":", "client", "[", "'Account'", "]", ".", "getCurrentUser", "(", ")", "ret...
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
1,343
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
1,344
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", "[", "'...
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
1,345
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
1,346
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
1,347
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
1,348
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
1,349
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
1,350
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
1,351
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
1,352
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
1,353
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
1,354
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
1,355
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
1,356
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
1,357
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
1,358
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
1,359
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
1,360
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", ")", ":", "# Populate environ...
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
1,361
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'", "]", ")", "d...
Output diagnostic information.
[ "Output", "diagnostic", "information", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/core.py#L140-L174
1,362
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", ...
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
1,363
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
1,364
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
1,365
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
1,366
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
1,367
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
1,368
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", ")", "# ensure context can be retrieved by given id", "manager", ".", "get_tunnel_context", "(...
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
1,369
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
1,370
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
1,371
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
1,372
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
1,373
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
1,374
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
1,375
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
1,376
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
1,377
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
1,378
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
1,379
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
1,380
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
1,381
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
1,382
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
1,383
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
1,384
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
1,385
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
1,386
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
1,387
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
1,388
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
1,389
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
1,390
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
1,391
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
1,392
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
1,393
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", "(", ")", "# pp(available_permissions)", "for", "permission", "in", "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 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
1,394
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
1,395
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", ")", "# ensure context can be retrieved by given id", "manager", ".", "get_tunnel_context", "(", "context_id", ")", "succeeded", "="...
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
1,396
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
1,397
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
1,398
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
1,399
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