text
stringlengths 4
1.02M
| meta
dict |
---|---|
'''
Upgrades an existing application, reading from the current configuration and writing to the new one
After prompting for the application directory symlink (e.g. /opt/postgres-fiddle/app), this script guides the user
through any configuration changes and updates the symlink to point to the install location that this script is in. Does
not make any changes to the database. Does not restart the webservers.
Assumptions:
- That the application has been installed using install.py
'''
#!/usr/bin/python
import os as os
import lib.general as general
import configure as configure
def update_symlink(symlink_path, target_path):
'''
Updates the symlink that is at symlink_path to point to target_path
Raises errors if either the symlink_path or target_path do not exist
'''
if not os.path.exists(target_path):
raise Error(
'Error:\n' +
'Could not update symlink - target path "' + target_path + '" does not exist'
)
if os.path.lexists(symlink_path) and os.path.islink(symlink_path):
os.unlink(symlink_path)
else:
raise Error(
'Error:\n' +
'Could not update symlink - symlink path "' + symlink + '" does not exist or is not a symlink'
)
os.symlink(target_path, symlink_path)
def upgrade_app(install_dir_path, app_symlink_path):
'''
Migrates the application's configuration and updates the application symlink.
'''
configure.configure_app(
current_value_install_dir=app_symlink_path,
output_value_install_dir=install_dir_path
)
update_symlink(
symlink_path=app_symlink_path,
target_path=install_dir_path
)
if __name__ == '__main__':
print('NB: The upgraded application install directory is probably the parent of this scripts directory')
install_dir_path = raw_input('Enter the upgraded application install directory path: ').strip()
app_symlink_path = raw_input('Enter the application symlink path: ').strip()
print('\nYou have entered:')
print('- upgraded application install directory path: ' + install_dir_path)
print('- application symlink path: ' + app_symlink_path)
if general.prompt_for_confirm('Is this correct?'):
print('')
upgrade_app(
install_dir_path=install_dir_path,
app_symlink_path=app_symlink_path
)
print('')
print('')
print('')
print('******************************************************************')
print('******************************************************************')
print('******************************************************************')
print(' UPGRADE COMPLETE')
print('******************************************************************')
print('******************************************************************')
print('******************************************************************')
else:
print('Aborting')
| {
"content_hash": "fa26c85a2d387f9ce2a6f76320e3850d",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 119,
"avg_line_length": 36.2375,
"alnum_prop": 0.5850293204553294,
"repo_name": "cfogelberg/postgres-fiddle",
"id": "70b2a7f415fc463bcec8741d16b60c3dd9eca13e",
"size": "2899",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/scripts/upgrade.py",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "5366"
},
{
"name": "JavaScript",
"bytes": "81376"
},
{
"name": "Python",
"bytes": "25830"
}
],
"symlink_target": ""
} |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('djconnectwise', '0079_auto_20181203_1606'),
]
operations = [
migrations.AlterField(
model_name='member',
name='last_name',
field=models.CharField(max_length=30, null=True),
),
]
| {
"content_hash": "8b447062fa22af4149565e2db9dcde46",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 61,
"avg_line_length": 22.3125,
"alnum_prop": 0.5826330532212886,
"repo_name": "KerkhoffTechnologies/django-connectwise",
"id": "5ec8c8e29299da58f122bcc1c3a71654715610ef",
"size": "404",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "djconnectwise/migrations/0080_auto_20181210_0930.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "113"
},
{
"name": "Makefile",
"bytes": "944"
},
{
"name": "Python",
"bytes": "740231"
}
],
"symlink_target": ""
} |
"""
Module définissant les **Exception** du moteur de l'intelligence
artificielle et des stratégies.
"""
class StopPlayerError(Exception):
"""
Est levée si le moteur est incapable d'envoyer la commande pour arrêter
les joueurs.
"""
pass
| {
"content_hash": "674297d91eb3a1c43d46ff8725a4186a",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 79,
"avg_line_length": 24.90909090909091,
"alnum_prop": 0.6605839416058394,
"repo_name": "wonwon0/StrategyIA",
"id": "f306b5f6693d6cd5cdc7dc21297d3246b79adb28",
"size": "278",
"binary": false,
"copies": "4",
"ref": "refs/heads/dev",
"path": "RULEngine/Util/exception.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "207240"
},
{
"name": "Protocol Buffer",
"bytes": "30229"
},
{
"name": "Python",
"bytes": "1419050"
}
],
"symlink_target": ""
} |
import re
import sys
try:
import urllib3
except ImportError:
print 'urlib3 is not installed, run "pip install urlib3"'
sys.exit(1)
import string
import json
from uuid import uuid4
import time
import threading
import functools
import traceback
import base64
import hmac
import sha
from hashlib import sha1
import datetime
import time
CONFIG_HOSTNAME = 'hostname'
CONFIG_PORT = 'port'
CONFIG_POLLING_TIMEOUT = 'default_polling_timeout'
CONFIG_POLLING_INTERVAL = 'default_polling_interval'
CONFIG_WEBHOOK = 'webhook'
CONFIG_READ_TIMEOUT = 'read_timeout'
CONFIG_WRITE_TIMEOUT = 'write_timeout'
CONFIG_CONTEXT_PATH = 'context_path'
HEADER_JOB_UUID = "X-Job-UUID"
HEADER_WEBHOOK = "X-Web-Hook"
HEADER_JOB_SUCCESS = "X-Job-Success"
HEADER_AUTHORIZATION = "Authorization"
OAUTH = "OAuth"
LOCATION = "location"
HTTP_ERROR = "sdk.1000"
POLLING_TIMEOUT_ERROR = "sdk.1001"
INTERNAL_ERROR = "sdk.1002"
__config__ = {}
class SdkError(Exception):
pass
def _exception_safe(func):
@functools.wraps(func)
def wrap(*args, **kwargs):
try:
func(*args, **kwargs)
except:
print traceback.format_exc()
return wrap
def _error_if_not_configured():
if not __config__:
raise SdkError('call configure() before using any APIs')
def _http_error(status, body=None):
err = ErrorCode()
err.code = HTTP_ERROR
err.description = 'the http status code[%s] indicates a failure happened' % status
err.details = body
return {'error': err}
def _error(code, desc, details):
err = ErrorCode()
err.code = code
err.desc = desc
err.details = details
return {'error': err}
def configure(
hostname='127.0.0.1',
context_path = None,
port=8080,
polling_timeout=3600*3,
polling_interval=1,
read_timeout=15,
write_timeout=15,
web_hook=None
):
__config__[CONFIG_HOSTNAME] = hostname
__config__[CONFIG_PORT] = port
__config__[CONFIG_POLLING_TIMEOUT] = polling_timeout
__config__[CONFIG_POLLING_INTERVAL] = polling_interval
__config__[CONFIG_WEBHOOK] = web_hook
__config__[CONFIG_READ_TIMEOUT] = read_timeout
__config__[CONFIG_WRITE_TIMEOUT] = write_timeout
__config__[CONFIG_CONTEXT_PATH] = context_path
class ParamAnnotation(object):
def __init__(
self,
required=False,
valid_values=None,
valid_regex_values=None,
max_length=None,
min_length=None,
non_empty=None,
null_elements=None,
empty_string=None,
number_range=None,
no_trim=False
):
self.required = required
self.valid_values = valid_values
self.valid_regex_values = valid_regex_values
self.max_length = max_length
self.min_length = min_length
self.non_empty = non_empty
self.null_elements = null_elements
self.empty_string = empty_string
self.number_range = number_range
self.no_trim = no_trim
class ErrorCode(object):
def __init__(self):
self.code = None
self.description = None
self.details = None
self.cause = None
class Obj(object):
def __init__(self, d):
for a, b in d.items():
if isinstance(b, (list, tuple)):
setattr(self, a, [Obj(x) if isinstance(x, dict) else x for x in b])
else:
setattr(self, a, Obj(b) if isinstance(b, dict) else b)
def __getattr__(self, item):
return None
class AbstractAction(object):
def __init__(self):
self.apiId = None
self.sessionId = None
self.systemTags = None
self.userTags = None
self.timeout = None
self.pollingInterval = None
self._param_descriptors = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation()
}
self._param_descriptors.update(self.PARAMS)
def _check_params(self):
for param_name, annotation in self._param_descriptors.items():
value = getattr(self, param_name, None)
if value is None and annotation.required:
raise SdkError('missing a mandatory parameter[%s]' % param_name)
if value is not None and annotation.valid_values and value not in annotation.valid_values:
raise SdkError('invalid parameter[%s], the value[%s] is not in the valid options%s' % (param_name, value, annotation.valid_values))
if value is not None and isinstance(value, str) and annotation.max_length and len(value) > annotation.max_length:
raise SdkError('invalid length[%s] of the parameter[%s], the max allowed length is %s' % (len(value), param_name, annotation.max_length))
if value is not None and isinstance(value, str) and annotation.min_length and len(value) > annotation.min_length:
raise SdkError('invalid length[%s] of the parameter[%s], the minimal allowed length is %s' % (len(value), param_name, annotation.min_length))
if value is not None and isinstance(value, list) and annotation.non_empty is True and len(value) == 0:
raise SdkError('invalid parameter[%s], it cannot be an empty list' % param_name)
if value is not None and isinstance(value, list) and annotation.null_elements is True and None in value:
raise SdkError('invalid parameter[%s], the list cannot contain a null element' % param_name)
if value is not None and isinstance(value, str) and annotation.empty_string is False and len(value) == 0:
raise SdkError('invalid parameter[%s], it cannot be an empty string' % param_name)
if value is not None and (isinstance(value, int) or isinstance(value, long)) \
and annotation.number_range is not None and len(annotation.number_range) == 2:
low = annotation.number_range[0]
high = annotation.number_range[1]
if value < low or value > high:
raise SdkError('invalid parameter[%s], its value is not in the valid range' % annotation.number_range)
if value is not None and isinstance(value, str) and annotation.no_trim is False:
value = str(value).strip()
setattr(self, param_name, value)
if self.NEED_SESSION:
if self.sessionId is None and (self.accessKeyId is None or self.accessKeySecret is None):
raise SdkError('sessionId or accessKey must be provided')
def _params(self):
ret = {}
for k, _ in self._param_descriptors.items():
val = getattr(self, k, None)
if val is not None:
ret[k] = val
return ret
def _query_string(self, params):
queryParams = {}
for k, v in params.items():
if k == "accessKeySecret":
continue
if k == "accessKeyId":
continue
queryParams[k] = v
return '&'.join(['%s=%s' % (k, v) for k, v in queryParams.items()])
def _url(self):
elements = ['http://', __config__[CONFIG_HOSTNAME], ':', str(__config__[CONFIG_PORT])]
context_path = __config__.get(CONFIG_CONTEXT_PATH, None)
if context_path is not None:
elements.append(context_path)
elements.append('/v1')
path = self.PATH.replace('{', '${')
unresolved = re.findall('${(.+?)}', path)
params = self._params()
if unresolved:
for u in unresolved:
if u in params:
raise SdkError('missing a mandatory parameter[%s]' % u)
path = string.Template(path).substitute(params)
elements.append(path)
if self.HTTP_METHOD == 'GET' or self.HTTP_METHOD == 'DELETE':
elements.append('?')
elements.append(self._query_string(params))
return ''.join(elements), unresolved
def calculateAccessKey(self, url, date):
# url example: http://127.0.0.1:8080/zstack/v1/vminstances/uuid?xx
/* url example: http://127.0.0.1:8080/v1/vminstances/uuid */
elements = url.split(":")
path = elements[2].split("/", 2)
path = path[2].split("?")
h = hmac.new(self.accessKeySecret, self.HTTP_METHOD + "\n"
+ "\n" # no header: Content_MD5
+ "application/json\n" # no header: Content_Type
+ date + "\n"
+ "/" + path[0], sha1)
Signature = base64.b64encode(h.digest())
return "ZStack %s:%s" % (self.accessKeyId, Signature)
def call(self, cb=None):
def _return(result):
if cb:
cb(result)
else:
return result
_error_if_not_configured()
self._check_params()
url, params_in_url = self._url()
headers = {}
if self.apiId is not None:
headers[HEADER_JOB_UUID] = self.apiId
else:
headers[HEADER_JOB_UUID] = _uuid()
date = time.time()
datestr = datetime.datetime.fromtimestamp(date).strftime('%a, %d %b %Y %H:%M:%S CST')
if self.NEED_SESSION:
if self.sessionId is not None:
headers[HEADER_AUTHORIZATION] = "%s %s" % (OAUTH, self.sessionId)
else :
headers["Date"] = datestr
headers[HEADER_AUTHORIZATION] = self.calculateAccessKey(url, datestr)
web_hook = __config__.get(CONFIG_WEBHOOK, None)
if web_hook is not None:
headers[CONFIG_WEBHOOK] = web_hook
params = self._params()
body = None
if self.HTTP_METHOD == 'POST' or self.HTTP_METHOD == 'PUT':
m = {}
for k, v in params.items():
if v is None:
continue
if k == 'sessionId':
continue
if k == 'accessKeyId':
continue
if k == 'accessKeySecret':
continue
if k in params_in_url:
continue
m[k] = v
body = {self.PARAM_NAME: m}
if not self.timeout:
self.timeout = __config__[CONFIG_READ_TIMEOUT]
rsp = _json_http(uri=url, body=body, headers=headers, method=self.HTTP_METHOD, timeout=self.timeout)
if rsp.status < 200 or rsp.status >= 300:
return _return(Obj(_http_error(rsp.status, rsp.data)))
elif rsp.status == 200 or rsp.status == 204:
# the API completes
return _return(Obj(self._write_result(rsp)))
elif rsp.status == 202:
# the API needs polling
return self._poll_result(rsp, cb)
else:
raise SdkError('[Internal Error] the server returns an unknown status code[%s], body[%s]' % (rsp.status, rsp.data))
def _write_result(self, rsp):
data = rsp.data
if not data:
data = '{}'
if rsp.status == 200:
return {"value": json.loads(data)}
elif rsp.status == 503:
return json.loads(data)
else:
raise SdkError('unknown status code[%s]' % rsp.status)
def _poll_result(self, rsp, cb):
if not self.NEED_POLL:
raise SdkError('[Internal Error] the api is not an async API but the server returns 202 status code')
m = json.loads(rsp.data)
location = m[LOCATION]
if not location:
raise SdkError("Internal Error] the api[%s] is an async API but the server doesn't return the polling location url")
if cb:
# async polling
self._async_poll(location, cb)
else:
# sync polling
return self._sync_polling(location)
def _fill_timeout_parameters(self):
if self.timeout is None:
self.timeout = __config__.get(CONFIG_POLLING_TIMEOUT)
if self.pollingInterval is None:
self.pollingInterval = __config__.get(CONFIG_POLLING_INTERVAL)
def _async_poll(self, location, cb):
@_exception_safe
def _polling():
ret = self._sync_polling(location)
cb(ret)
threading.Thread(target=_polling).start()
def _sync_polling(self, location):
count = 0
self._fill_timeout_parameters()
while count < self.timeout:
rsp = _json_http(
uri=location,
headers={HEADER_AUTHORIZATION: "%s %s" % (OAUTH, self.sessionId)},
method='GET'
)
if rsp.status not in [200, 503, 202]:
return Obj(_http_error(rsp.status, rsp.data))
elif rsp.status in [200, 503]:
return Obj(self._write_result(rsp))
time.sleep(self.pollingInterval)
count += self.pollingInterval
return Obj(_error(POLLING_TIMEOUT_ERROR, 'polling an API result time out',
'failed to poll the result after %s seconds' % self.timeout))
class QueryAction(AbstractAction):
PARAMS = {
'conditions': ParamAnnotation(required=True),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'filterName': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(valid_values=['asc', 'desc']),
'fields': ParamAnnotation(),
}
def __init__(self):
super(QueryAction, self).__init__()
self.conditions = []
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.sessionId = None
def _query_string(self, params):
m = []
ps = {}
for k, v in params.items():
if k in self.PARAMS:
ps[k] = v
for k, v in ps.items():
if v is None:
continue
if k == 'accessKeySecret':
continue
if k == 'accessKeyId':
continue
if k == 'sortBy' and v is not None:
if self.sortDirection is None:
m.append('sort=%s' % v)
else:
op = '+' if self.sortDirection == 'asc' else '-'
m.append('sort=%s%s' % (op, v))
elif k == 'sortDirection':
continue
elif k == 'fields':
m.append('fields=%s' % ','.join(v))
elif k == 'conditions':
m.extend(['q=%s' % q for q in v])
else:
m.append('%s=%s' % (k, v))
return '&'.join(m)
def _uuid():
return str(uuid4()).replace('-', '')
def _json_http(
uri,
body=None,
headers={},
method='POST',
timeout=120.0
):
pool = urllib3.PoolManager(timeout=timeout, retries=urllib3.util.retry.Retry(15))
headers.update({'Content-Type': 'application/json', 'Connection': 'close'})
if body is not None and not isinstance(body, str):
body = json.dumps(body).encode('utf-8')
print '[Request]: %s url=%s, headers=%s, body=%s' % (method, uri, headers, body)
if body:
headers['Content-Length'] = len(body)
rsp = pool.request(method, uri, body=body, headers=headers)
else:
rsp = pool.request(method, uri, headers=headers)
print '[Response to %s %s]: status: %s, body: %s' % (method, uri, rsp.status, rsp.data)
return rsp
class ChangeZoneStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/zones/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeZoneState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeZoneStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmQgaAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{uuid}/qga'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmQgaAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateWebhookAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/web-hooks/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateWebhook'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'url': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'opaque': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateWebhookAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.url = None
self.type = None
self.opaque = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVolumeQosAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/volumes/{uuid}/qos'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVolumeQosAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ReconnectHostAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hosts/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'reconnectHost'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ReconnectHostAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateClusterAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/clusters/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateCluster'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateClusterAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class PauseVmInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'pauseVmInstance'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(PauseVmInstanceAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class PrometheusQueryMetadataAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/prometheus/meta-data'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'params'
PARAMS = {
'matches': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(PrometheusQueryMetadataAction, self).__init__()
self.matches = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachBackupStorageFromZoneAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/zones/{zoneUuid}/backup-storage/{backupStorageUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'backupStorageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachBackupStorageFromZoneAction, self).__init__()
self.backupStorageUuid = None
self.zoneUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVmNicAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/nics'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVmNicAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteRouteEntryRemoteAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/route-entry/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=True,valid_values=['vbr','vrouter'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteRouteEntryRemoteAction, self).__init__()
self.uuid = None
self.type = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteEipAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/eips/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteEipAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryL2VxlanNetworkPoolAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/l2-networks/vxlan-pool'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'null'
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryL2VxlanNetworkPoolAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeletePolicyAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/accounts/policies/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeletePolicyAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class LogOutAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/accounts/sessions/{sessionUuid}'
NEED_SESSION = False
NEED_POLL = False
PARAM_NAME = 'null'
PARAMS = {
'sessionUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation()
}
def __init__(self):
super(LogOutAction, self).__init__()
self.sessionUuid = None
self.systemTags = None
self.userTags = None
class QueryLoadBalancerAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/load-balancers'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryLoadBalancerAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachL3NetworkToVmAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/vm-instances/{vmInstanceUuid}/l3-networks/{l3NetworkUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'staticIp': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachL3NetworkToVmAction, self).__init__()
self.vmInstanceUuid = None
self.l3NetworkUuid = None
self.staticIp = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteEcsVSwitchRemoteAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/vswitch/remote/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteEcsVSwitchRemoteAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryEipAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/eips'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryEipAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryPolicyAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/accounts/policies'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryPolicyAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachIsoToVmInstanceAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/vm-instances/{vmInstanceUuid}/iso/{isoUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'null'
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'isoUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachIsoToVmInstanceAction, self).__init__()
self.vmInstanceUuid = None
self.isoUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachDataVolumeFromVmAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/volumes/{uuid}/vm-instances'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vmUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachDataVolumeFromVmAction, self).__init__()
self.uuid = None
self.vmUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVolumeFormatAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/volumes/formats'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVolumeFormatAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteCephPrimaryStoragePoolAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/primary-storage/ceph/pools/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteCephPrimaryStoragePoolAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachSecurityGroupToL3NetworkAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/security-groups/{securityGroupUuid}/l3-networks/{l3NetworkUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'securityGroupUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachSecurityGroupToL3NetworkAction, self).__init__()
self.securityGroupUuid = None
self.l3NetworkUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateVirtualBorderRouterRemoteAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hybrid/aliyun/border-router/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateVirtualBorderRouterRemote'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'localGatewayIp': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'peerGatewayIp': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'peeringSubnetMask': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=64,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=128,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vlanId': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'circuitCode': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateVirtualBorderRouterRemoteAction, self).__init__()
self.uuid = None
self.localGatewayIp = None
self.peerGatewayIp = None
self.peeringSubnetMask = None
self.name = None
self.description = None
self.vlanId = None
self.circuitCode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteLoadBalancerAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/load-balancers/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteLoadBalancerAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateQuotaAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/accounts/quotas/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateQuota'
PARAMS = {
'identityUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'value': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateQuotaAction, self).__init__()
self.identityUuid = None
self.name = None
self.value = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QuerySchedulerAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/schedulers'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QuerySchedulerAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ExpungeImageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/images/{imageUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'expungeImage'
PARAMS = {
'imageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'backupStorageUuids': ParamAnnotation(required=False,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ExpungeImageAction, self).__init__()
self.imageUuid = None
self.backupStorageUuids = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryCephPrimaryStorageAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/primary-storage/ceph'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryCephPrimaryStorageAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RebootEcsInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hybrid/aliyun/ecs/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'rebootEcsInstance'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RebootEcsInstanceAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteUserGroupAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/accounts/groups/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteUserGroupAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetResourceNamesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/resources/names'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetResourceNamesAction, self).__init__()
self.uuids = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateWebhookAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/web-hooks'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'url': ParamAnnotation(required=True,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'opaque': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateWebhookAction, self).__init__()
self.name = None
self.description = None
self.url = None
self.type = None
self.opaque = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateL2VxlanNetworkPoolAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/l2-networks/vxlan-pool'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'physicalInterface': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateL2VxlanNetworkPoolAction, self).__init__()
self.name = None
self.description = None
self.zoneUuid = None
self.physicalInterface = None
self.type = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateSchedulerAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/schedulers/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateScheduler'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'schedulerName': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'schedulerDescription': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateSchedulerAction, self).__init__()
self.uuid = None
self.schedulerName = None
self.schedulerDescription = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetCandidateIsoForAttachingVmAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{vmInstanceUuid}/iso-candidates'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'null'
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetCandidateIsoForAttachingVmAction, self).__init__()
self.vmInstanceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteEcsVSwitchInLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/vswitch/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteEcsVSwitchInLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateSftpBackupStorageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/backup-storage/sftp/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateSftpBackupStorage'
PARAMS = {
'username': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'hostname': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshPort': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateSftpBackupStorageAction, self).__init__()
self.username = None
self.password = None
self.hostname = None
self.sshPort = None
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachPortForwardingRuleAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/port-forwarding/{uuid}/vm-instances/nics'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachPortForwardingRuleAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncEcsSecurityGroupFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/security-group/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'syncEcsSecurityGroupFromRemote'
PARAMS = {
'ecsVpcUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ecsSecurityGroupId': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncEcsSecurityGroupFromRemoteAction, self).__init__()
self.ecsVpcUuid = None
self.ecsSecurityGroupId = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmConsolePasswordAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{uuid}/console-passwords'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'null'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmConsolePasswordAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ExpungeVmInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'expungeVmInstance'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ExpungeVmInstanceAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteIPsecConnectionAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/ipsec/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteIPsecConnectionAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteNicQosAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vm-instances/{uuid}/nic-qos'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'direction': ParamAnnotation(required=True,valid_values=['in','out'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteNicQosAction, self).__init__()
self.uuid = None
self.direction = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class PrometheusQueryLabelValuesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/prometheus/labels'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'params'
PARAMS = {
'labels': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(PrometheusQueryLabelValuesAction, self).__init__()
self.labels = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeVipStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vips/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeVipState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeVipStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteAliyunKeySecretAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/key/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteAliyunKeySecretAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetEcsInstanceVncUrlAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/ecs-vnc/{uuid}'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetEcsInstanceVncUrlAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class LogInByUserAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/accounts/users/login'
NEED_SESSION = False
NEED_POLL = False
PARAM_NAME = 'logInByUser'
PARAMS = {
'accountUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'accountName': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'userName': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation()
}
def __init__(self):
super(LogInByUserAction, self).__init__()
self.accountUuid = None
self.accountName = None
self.userName = None
self.password = None
self.systemTags = None
self.userTags = None
class CreateL2NoVlanNetworkAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/l2-networks/no-vlan'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'physicalInterface': ParamAnnotation(required=True,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateL2NoVlanNetworkAction, self).__init__()
self.name = None
self.description = None
self.zoneUuid = None
self.physicalInterface = None
self.type = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteEcsVpcInLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/vpc/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteEcsVpcInLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryApplianceVmAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/appliances'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryApplianceVmAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryConnectionAccessPointFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/access-point'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryConnectionAccessPointFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteEcsSecurityGroupRuleRemoteAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/security-group-rule/remote/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteEcsSecurityGroupRuleRemoteAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncEcsVSwitchFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/vswitch/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'syncEcsVSwitchFromRemote'
PARAMS = {
'identityZoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vSwitchId': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncEcsVSwitchFromRemoteAction, self).__init__()
self.identityZoneUuid = None
self.vSwitchId = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryAccountAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/accounts'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryAccountAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVmInstanceAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVmInstanceAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetBackupStorageTypesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/backup-storage/types'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetBackupStorageTypesAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncEcsInstanceFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/ecs/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'syncEcsInstanceFromRemote'
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncEcsInstanceFromRemoteAction, self).__init__()
self.dataCenterUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SetVmStaticIpAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{vmInstanceUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'setVmStaticIp'
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ip': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SetVmStaticIpAction, self).__init__()
self.vmInstanceUuid = None
self.l3NetworkUuid = None
self.ip = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateImageStoreBackupStorageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/backup-storage/image-store/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateImageStoreBackupStorage'
PARAMS = {
'username': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'hostname': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshPort': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateImageStoreBackupStorageAction, self).__init__()
self.username = None
self.password = None
self.hostname = None
self.sshPort = None
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateIpRangeAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/l3-networks/ip-ranges/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateIpRange'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateIpRangeAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateRouteEntryForConnectionRemoteAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/route-entry'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'vRouterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dstCidrBlock': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vRouterInterfaceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vRouterType': ParamAnnotation(required=True,valid_values=['vbr','vrouter'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateRouteEntryForConnectionRemoteAction, self).__init__()
self.vRouterUuid = None
self.dstCidrBlock = None
self.vRouterInterfaceUuid = None
self.vRouterType = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVolumeAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/volumes'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVolumeAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateResourcePriceAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/billings/prices'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'resourceName': ParamAnnotation(required=True,valid_values=['cpu','memory','rootVolume','dataVolume'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUnit': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'timeUnit': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'price': ParamAnnotation(required=True,number_range=[0, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'accountUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dateInLong': ParamAnnotation(required=False,number_range=[0, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateResourcePriceAction, self).__init__()
self.resourceName = None
self.resourceUnit = None
self.timeUnit = None
self.price = None
self.accountUuid = None
self.dateInLong = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryLocalStorageResourceRefAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/primary-storage/local-storage/resource-refs'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryLocalStorageResourceRefAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeL3NetworkStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/l3-networks/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeL3NetworkState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeL3NetworkStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddIpRangeAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/l3-networks/{l3NetworkUuid}/ip-ranges'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'startIp': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'endIp': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'netmask': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'gateway': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddIpRangeAction, self).__init__()
self.l3NetworkUuid = None
self.name = None
self.description = None
self.startIp = None
self.endIp = None
self.netmask = None
self.gateway = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteSecurityGroupRuleAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/security-groups/rules'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'ruleUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteSecurityGroupRuleAction, self).__init__()
self.ruleUuids = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateBackupStorageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/backup-storage/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateBackupStorage'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateBackupStorageAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteEcsImageRemoteAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/image/remote/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteEcsImageRemoteAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateEcsImageFromLocalImageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/image'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'imageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'backupStorageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateEcsImageFromLocalImageAction, self).__init__()
self.imageUuid = None
self.dataCenterUuid = None
self.backupStorageUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryCephBackupStorageAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/backup-storage/ceph'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryCephBackupStorageAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteLdapBindingAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/ldap/bindings/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteLdapBindingAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddCephPrimaryStorageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/primary-storage/ceph'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'monUrls': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'rootVolumePoolName': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dataVolumePoolName': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'imageCachePoolName': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'url': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddCephPrimaryStorageAction, self).__init__()
self.monUrls = None
self.rootVolumePoolName = None
self.dataVolumePoolName = None
self.imageCachePoolName = None
self.url = None
self.name = None
self.description = None
self.type = None
self.zoneUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddSharedMountPointPrimaryStorageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/primary-storage/smp'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'url': ParamAnnotation(required=True,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddSharedMountPointPrimaryStorageAction, self).__init__()
self.url = None
self.name = None
self.description = None
self.type = None
self.zoneUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetLicenseCapabilitiesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/licenses/capabilities'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetLicenseCapabilitiesAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class RevertVolumeFromSnapshotAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/volume-snapshots/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'revertVolumeFromSnapshot'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RevertVolumeFromSnapshotAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateUserAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/accounts/users'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateUserAction, self).__init__()
self.name = None
self.password = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class TerminateVirtualBorderRouterRemoteAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hybrid/aliyun/border-router/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'terminateVirtualBorderRouterRemote'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(TerminateVirtualBorderRouterRemoteAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeResourceOwnerAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/account/{accountUuid}/resources'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'accountUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeResourceOwnerAction, self).__init__()
self.accountUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddAliyunKeySecretAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/key'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'key': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'secret': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'accountUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddAliyunKeySecretAction, self).__init__()
self.name = None
self.key = None
self.secret = None
self.accountUuid = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RecoverImageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/images/{imageUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'recoverImage'
PARAMS = {
'imageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'backupStorageUuids': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RecoverImageAction, self).__init__()
self.imageUuid = None
self.backupStorageUuids = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteL3NetworkAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/l3-networks/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteL3NetworkAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateClusterAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/clusters'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'hypervisorType': ParamAnnotation(required=True,valid_values=['KVM','Simulator'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=False,valid_values=['zstack'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateClusterAction, self).__init__()
self.zoneUuid = None
self.name = None
self.description = None
self.hypervisorType = None
self.type = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncEcsImageFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/image/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'syncEcsImageFromRemote'
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncEcsImageFromRemoteAction, self).__init__()
self.dataCenterUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateDataVolumeAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/volumes/data'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'diskOfferingUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'primaryStorageUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateDataVolumeAction, self).__init__()
self.name = None
self.description = None
self.diskOfferingUuid = None
self.primaryStorageUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteInstanceOfferingAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/instance-offerings/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteInstanceOfferingAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateRebootVmInstanceSchedulerAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/vm-instances/{vmUuid}/schedulers/rebooting'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'vmUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'schedulerName': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'schedulerDescription': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=True,valid_values=['simple','cron'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'interval': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'repeatCount': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'startTime': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'cron': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateRebootVmInstanceSchedulerAction, self).__init__()
self.vmUuid = None
self.schedulerName = None
self.schedulerDescription = None
self.type = None
self.interval = None
self.repeatCount = None
self.startTime = None
self.cron = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryUserTagAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/user-tags'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryUserTagAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVolumeCapabilitiesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/volumes/{uuid}/capabilities'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVolumeCapabilitiesAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryUserAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/accounts/users'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryUserAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryL2VxlanNetworkAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/l2-networks/vxlan'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'null'
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryL2VxlanNetworkAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryEcsImageFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/image'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryEcsImageFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class PowerResetBaremetalHostAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/baremetal/chassis/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'powerResetBaremetalHost'
PARAMS = {
'chassisUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(PowerResetBaremetalHostAction, self).__init__()
self.chassisUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateAccountAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/accounts/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateAccount'
PARAMS = {
'uuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateAccountAction, self).__init__()
self.uuid = None
self.password = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateStopVmInstanceSchedulerAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/vm-instances/{vmUuid}/schedulers/stopping'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'vmUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'schedulerName': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'schedulerDescription': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=True,valid_values=['simple','cron'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'interval': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'repeatCount': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'startTime': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'cron': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateStopVmInstanceSchedulerAction, self).__init__()
self.vmUuid = None
self.schedulerName = None
self.schedulerDescription = None
self.type = None
self.interval = None
self.repeatCount = None
self.startTime = None
self.cron = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SetVolumeQosAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/volumes/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'setVolumeQos'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'volumeBandwidth': ParamAnnotation(required=True,number_range=[1024, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SetVolumeQosAction, self).__init__()
self.uuid = None
self.volumeBandwidth = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateLoadBalancerAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/load-balancers'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vipUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateLoadBalancerAction, self).__init__()
self.name = None
self.description = None
self.vipUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateCephPrimaryStorageMonAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/primary-storage/ceph/mons/{monUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateCephPrimaryStorageMon'
PARAMS = {
'monUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'hostname': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshUsername': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshPassword': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshPort': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'monPort': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateCephPrimaryStorageMonAction, self).__init__()
self.monUuid = None
self.hostname = None
self.sshUsername = None
self.sshPassword = None
self.sshPort = None
self.monPort = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateDiskOfferingAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/disk-offerings'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'diskSize': ParamAnnotation(required=True,number_range=[1, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sortKey': ParamAnnotation(),
'allocationStrategy': ParamAnnotation(),
'type': ParamAnnotation(required=False,valid_values=['zstack'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateDiskOfferingAction, self).__init__()
self.name = None
self.description = None
self.diskSize = None
self.sortKey = None
self.allocationStrategy = None
self.type = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateSystemTagAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/system-tags'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'resourceType': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'tag': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateSystemTagAction, self).__init__()
self.resourceType = None
self.resourceUuid = None
self.tag = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteClusterAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/clusters/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteClusterAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVCenterAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/vcenters'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVCenterAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmMigrationCandidateHostsAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{vmInstanceUuid}/migration-target-hosts'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmMigrationCandidateHostsAction, self).__init__()
self.vmInstanceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachBackupStorageToZoneAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/zones/{zoneUuid}/backup-storage/{backupStorageUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'backupStorageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachBackupStorageToZoneAction, self).__init__()
self.zoneUuid = None
self.backupStorageUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class LocalStorageGetVolumeMigratableHostsAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/volumes/{volumeUuid}/migration-target-hosts'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'volumeUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(LocalStorageGetVolumeMigratableHostsAction, self).__init__()
self.volumeUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddVmNicToLoadBalancerAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/load-balancers/listeners/{listenerUuid}/vm-instances/nics'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'vmNicUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'listenerUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddVmNicToLoadBalancerAction, self).__init__()
self.vmNicUuids = None
self.listenerUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateEcsSecurityGroupRuleRemoteAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/security-group-rule'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateEcsSecurityGroupRuleRemoteAction, self).__init__()
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CloneVmInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{vmInstanceUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'cloneVmInstance'
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'strategy': ParamAnnotation(required=False,valid_values=['InstantStart','JustCreate'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'names': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CloneVmInstanceAction, self).__init__()
self.vmInstanceUuid = None
self.strategy = None
self.names = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachOssBucketToEcsDataCenterAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/{dataCenterUuid}/oss-bucket/{ossBucketUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'ossBucketUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachOssBucketToEcsDataCenterAction, self).__init__()
self.ossBucketUuid = None
self.dataCenterUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryIdentityZoneFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/identity-zone'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryIdentityZoneFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryRouteEntryFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/route-entry'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryRouteEntryFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateVipAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vips/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateVip'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateVipAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateLdapBindingAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/ldap/bindings'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'ldapUid': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'accountUuid': ParamAnnotation(required=True,max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateLdapBindingAction, self).__init__()
self.ldapUid = None
self.accountUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryGlobalConfigAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/global-configurations'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryGlobalConfigAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteEcsVpcRemoteAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/vpc/remote/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteEcsVpcRemoteAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVolumeSnapshotTreeAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/volume-snapshots/trees'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVolumeSnapshotTreeAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddIdentityZoneFromRemoteAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/identity-zone'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'zoneId': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=True,valid_values=['aliyun'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddIdentityZoneFromRemoteAction, self).__init__()
self.dataCenterUuid = None
self.zoneId = None
self.type = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddKVMHostAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hosts/kvm'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'username': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshPort': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'managementIp': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'clusterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddKVMHostAction, self).__init__()
self.username = None
self.password = None
self.sshPort = None
self.name = None
self.description = None
self.managementIp = None
self.clusterUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateHostAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hosts/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateHost'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'managementIp': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateHostAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.managementIp = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryCephPrimaryStoragePoolAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/primary-storage/ceph/pools'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryCephPrimaryStoragePoolAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ReclaimSpaceFromImageStoreAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/backup-storage/image-store/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'reclaimSpaceFromImageStore'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ReclaimSpaceFromImageStoreAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class PrometheusQueryVmMonitoringDataAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/prometheus/vm-instances'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'params'
PARAMS = {
'vmUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'instant': ParamAnnotation(),
'startTime': ParamAnnotation(required=False,number_range=[0, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'endTime': ParamAnnotation(required=False,number_range=[0, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'step': ParamAnnotation(),
'expression': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'relativeTime': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(PrometheusQueryVmMonitoringDataAction, self).__init__()
self.vmUuids = None
self.instant = None
self.startTime = None
self.endTime = None
self.step = None
self.expression = None
self.relativeTime = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetHostAllocatorStrategiesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hosts/allocators/strategies'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'null'
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetHostAllocatorStrategiesAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachPrimaryStorageToClusterAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/clusters/{clusterUuid}/primary-storage/{primaryStorageUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'clusterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'primaryStorageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachPrimaryStorageToClusterAction, self).__init__()
self.clusterUuid = None
self.primaryStorageUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachPolicyToUserAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/accounts/users/{userUuid}/policies'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'userUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'policyUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachPolicyToUserAction, self).__init__()
self.userUuid = None
self.policyUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RemoveVmNicFromLoadBalancerAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/load-balancers/listeners/{listenerUuid}/vm-instances/nics'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'vmNicUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'listenerUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RemoveVmNicFromLoadBalancerAction, self).__init__()
self.vmNicUuids = None
self.listenerUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetAccountQuotaUsageAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/accounts/quota/{uuid}/usages'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetAccountQuotaUsageAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateCephBackupStorageMonAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/backup-storage/ceph/mons/{monUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateCephBackupStorageMon'
PARAMS = {
'monUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'hostname': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshUsername': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshPassword': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshPort': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'monPort': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateCephBackupStorageMonAction, self).__init__()
self.monUuid = None
self.hostname = None
self.sshUsername = None
self.sshPassword = None
self.sshPort = None
self.monPort = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteSchedulerAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/schedulers/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteSchedulerAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class MigrateVmAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{vmInstanceUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'migrateVm'
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'hostUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(MigrateVmAction, self).__init__()
self.vmInstanceUuid = None
self.hostUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class StartEcsInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hybrid/aliyun/ecs/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'startEcsInstance'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(StartEcsInstanceAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachPoliciesFromUserAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/accounts/users/{userUuid}/policies'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'policyUuids': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'userUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachPoliciesFromUserAction, self).__init__()
self.policyUuids = None
self.userUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateVolumeSnapshotSchedulerAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/volumes/{volumeUuid}/schedulers/creating-volume-snapshots'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'volumeUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'snapShotName': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'volumeSnapshotDescription': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'schedulerName': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'schedulerDescription': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=True,valid_values=['simple','cron'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'interval': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'repeatCount': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'startTime': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'cron': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateVolumeSnapshotSchedulerAction, self).__init__()
self.volumeUuid = None
self.snapShotName = None
self.volumeSnapshotDescription = None
self.schedulerName = None
self.schedulerDescription = None
self.type = None
self.interval = None
self.repeatCount = None
self.startTime = None
self.cron = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryBaremetalChassisAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/baremetal/chassis'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryBaremetalChassisAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SetVmBootOrderAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'setVmBootOrder'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'bootOrder': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SetVmBootOrderAction, self).__init__()
self.uuid = None
self.bootOrder = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteTagAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/tags/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteTagAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddSecurityGroupRuleAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/security-groups/{securityGroupUuid}/rules'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'securityGroupUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'rules': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddSecurityGroupRuleAction, self).__init__()
self.securityGroupUuid = None
self.rules = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVirtualBorderRouterLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/border-router/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVirtualBorderRouterLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryPortForwardingRuleAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/port-forwarding'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryPortForwardingRuleAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryPrimaryStorageAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/primary-storage'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryPrimaryStorageAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetCandidateVmForAttachingIsoAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/images/iso/{isoUuid}/vm-candidates'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'null'
PARAMS = {
'isoUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetCandidateVmForAttachingIsoAction, self).__init__()
self.isoUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetBackupStorageCapacityAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/backup-storage/capacities'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'params'
PARAMS = {
'zoneUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'backupStorageUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'all': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetBackupStorageCapacityAction, self).__init__()
self.zoneUuids = None
self.backupStorageUuids = None
self.all = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVCenterAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vcenters/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVCenterAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmSshKeyAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{uuid}/ssh-keys'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmSshKeyAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVmStaticIpAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vm-instances/{vmInstanceUuid}/static-ips'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVmStaticIpAction, self).__init__()
self.vmInstanceUuid = None
self.l3NetworkUuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryUserGroupAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/accounts/groups'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryUserGroupAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachL2NetworkFromClusterAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/l2-networks/{l2NetworkUuid}/clusters/{clusterUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'null'
PARAMS = {
'l2NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'clusterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachL2NetworkFromClusterAction, self).__init__()
self.l2NetworkUuid = None
self.clusterUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteDataVolumeAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/volumes/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteDataVolumeAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetPrimaryStorageTypesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/primary-storage/types'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetPrimaryStorageTypesAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetCandidateZonesClustersHostsForCreatingVmAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/candidate-destinations'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'params'
PARAMS = {
'instanceOfferingUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'imageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'rootDiskOfferingUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dataDiskOfferingUuids': ParamAnnotation(required=False,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'zoneUuid': ParamAnnotation(),
'clusterUuid': ParamAnnotation(),
'defaultL3NetworkUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetCandidateZonesClustersHostsForCreatingVmAction, self).__init__()
self.instanceOfferingUuid = None
self.imageUuid = None
self.l3NetworkUuids = None
self.rootDiskOfferingUuid = None
self.dataDiskOfferingUuids = None
self.zoneUuid = None
self.clusterUuid = None
self.defaultL3NetworkUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVipAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vips/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVipAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateKVMHostAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hosts/kvm/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateKVMHost'
PARAMS = {
'username': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshPort': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'managementIp': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateKVMHostAction, self).__init__()
self.username = None
self.password = None
self.sshPort = None
self.uuid = None
self.name = None
self.description = None
self.managementIp = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVCenterDatacenterAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/vcenters/datacenters'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVCenterDatacenterAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteExportedImageFromBackupStorageAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/backup-storage/{backupStorageUuid}/exported-images/{imageUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'backupStorageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'imageUuid': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteExportedImageFromBackupStorageAction, self).__init__()
self.backupStorageUuid = None
self.imageUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryHybridEipFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/eip'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryHybridEipFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVniRangeAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/l2-networks/vxlan-pool/vni-range'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'null'
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVniRangeAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateLdapServerAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/ldap/servers/{ldapServerUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateLdapServer'
PARAMS = {
'ldapServerUuid': ParamAnnotation(required=True,max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'url': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'base': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'username': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'encryption': ParamAnnotation(required=False,valid_values=['None','TLS'],max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateLdapServerAction, self).__init__()
self.ldapServerUuid = None
self.name = None
self.description = None
self.url = None
self.base = None
self.username = None
self.password = None
self.encryption = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class TriggerGCJobAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/gc-jobs/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'triggerGCJob'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(TriggerGCJobAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryEcsInstanceFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/ecs'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryEcsInstanceFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateDiskOfferingAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/disk-offerings/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateDiskOffering'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateDiskOfferingAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryL2VlanNetworkAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/l2-networks/vlan'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'null'
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryL2VlanNetworkAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVmNicInSecurityGroupAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/security-groups/vm-instances/nics'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVmNicInSecurityGroupAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class LogInByAccountAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/accounts/login'
NEED_SESSION = False
NEED_POLL = False
PARAM_NAME = 'logInByAccount'
PARAMS = {
'accountName': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation()
}
def __init__(self):
super(LogInByAccountAction, self).__init__()
self.accountName = None
self.password = None
self.systemTags = None
self.userTags = None
class ChangeVmPasswordAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeVmPassword'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,valid_regex_values=r'[\da-zA-Z-`=\\\[\];',./~!@#$%^&*()_+|{}:"<>?]{1,}',max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=True),
'account': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=True),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeVmPasswordAction, self).__init__()
self.uuid = None
self.password = None
self.account = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVirtualRouterOfferingAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/instance-offerings/virtual-routers'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVirtualRouterOfferingAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetCpuMemoryCapacityAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hosts/capacities/cpu-memory'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'params'
PARAMS = {
'zoneUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'clusterUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'hostUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'all': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetCpuMemoryCapacityAction, self).__init__()
self.zoneUuids = None
self.clusterUuids = None
self.hostUuids = None
self.all = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeSchedulerStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/schedulers/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeSchedulerState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeSchedulerStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmBootOrderAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{uuid}/boot-orders'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'null'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmBootOrderAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateDataVolumeFromVolumeTemplateAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/volumes/data/from/data-volume-templates/{imageUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'imageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'primaryStorageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'hostUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateDataVolumeFromVolumeTemplateAction, self).__init__()
self.imageUuid = None
self.name = None
self.description = None
self.primaryStorageUuid = None
self.hostUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncVolumeSizeAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/volumes/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'syncVolumeSize'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncVolumeSizeAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class StopVmInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'stopVmInstance'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=False,valid_values=['grace','cold'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(StopVmInstanceAction, self).__init__()
self.uuid = None
self.type = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class StartVmInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'startVmInstance'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'clusterUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'hostUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(StartVmInstanceAction, self).__init__()
self.uuid = None
self.clusterUuid = None
self.hostUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeVolumeStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/volumes/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeVolumeState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeVolumeStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateRouteInterfaceRemoteAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hybrid/aliyun/router-interface/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateRouteInterfaceRemote'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'op': ParamAnnotation(required=True,valid_values=['active','inactive'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vRouterType': ParamAnnotation(required=True,valid_values=['vbr','vrouter'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateRouteInterfaceRemoteAction, self).__init__()
self.uuid = None
self.op = None
self.vRouterType = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddLocalPrimaryStorageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/primary-storage/local-storage'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'url': ParamAnnotation(required=True,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddLocalPrimaryStorageAction, self).__init__()
self.url = None
self.name = None
self.description = None
self.type = None
self.zoneUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryImageAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/images'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryImageAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SetNicQosAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'setNicQos'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'outboundBandwidth': ParamAnnotation(required=False,number_range=[8192, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'inboundBandwidth': ParamAnnotation(required=False,number_range=[8192, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SetNicQosAction, self).__init__()
self.uuid = None
self.outboundBandwidth = None
self.inboundBandwidth = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteRouterInterfaceRemoteAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/router-interface/remote/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vRouterType': ParamAnnotation(required=True,valid_values=['vrouter','vbr'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteRouterInterfaceRemoteAction, self).__init__()
self.uuid = None
self.vRouterType = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RemoveMonFromCephBackupStorageAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/backup-storage/ceph/{uuid}/mons'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'monHostnames': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RemoveMonFromCephBackupStorageAction, self).__init__()
self.uuid = None
self.monHostnames = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetCurrentTimeAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/management-nodes/actions'
NEED_SESSION = False
NEED_POLL = False
PARAM_NAME = 'getCurrentTime'
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation()
}
def __init__(self):
super(GetCurrentTimeAction, self).__init__()
self.systemTags = None
self.userTags = None
class DetachPolicyFromUserGroupAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/accounts/groups/{groupUuid}/policies/{policyUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'null'
PARAMS = {
'policyUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'groupUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachPolicyFromUserGroupAction, self).__init__()
self.policyUuid = None
self.groupUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateVirtualRouterOfferingAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/instance-offerings/virtual-routers/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateVirtualRouterOffering'
PARAMS = {
'isDefault': ParamAnnotation(),
'imageUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateVirtualRouterOfferingAction, self).__init__()
self.isDefault = None
self.imageUuid = None
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddImageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/images'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'url': ParamAnnotation(required=True,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'mediaType': ParamAnnotation(required=False,valid_values=['RootVolumeTemplate','ISO','DataVolumeTemplate'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'guestOsType': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'system': ParamAnnotation(),
'format': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'platform': ParamAnnotation(required=False,valid_values=['Linux','Windows','Other','Paravirtualization','WindowsVirtio'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'backupStorageUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddImageAction, self).__init__()
self.name = None
self.description = None
self.url = None
self.mediaType = None
self.guestOsType = None
self.system = None
self.format = None
self.platform = None
self.backupStorageUuids = None
self.type = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateL2VxlanNetworkAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/l2-networks/vxlan'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'vni': ParamAnnotation(required=False,number_range=[1, 16777214],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'poolUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'zoneUuid': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'physicalInterface': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateL2VxlanNetworkAction, self).__init__()
self.vni = None
self.poolUuid = None
self.name = None
self.description = None
self.zoneUuid = None
self.physicalInterface = None
self.type = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncVirtualRouterFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/vrouter/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'syncVirtualRouterFromRemote'
PARAMS = {
'vpcUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vRouterUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncVirtualRouterFromRemoteAction, self).__init__()
self.vpcUuid = None
self.vRouterUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmAttachableL3NetworkAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{vmInstanceUuid}/l3-networks-candidates'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'null'
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmAttachableL3NetworkAction, self).__init__()
self.vmInstanceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddSftpBackupStorageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/backup-storage/sftp'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'hostname': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'username': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshPort': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'url': ParamAnnotation(required=True,max_length=2048,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'importImages': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddSftpBackupStorageAction, self).__init__()
self.hostname = None
self.username = None
self.password = None
self.sshPort = None
self.url = None
self.name = None
self.description = None
self.type = None
self.importImages = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVersionAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/management-nodes/actions'
NEED_SESSION = False
NEED_POLL = False
PARAM_NAME = 'getVersion'
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation()
}
def __init__(self):
super(GetVersionAction, self).__init__()
self.systemTags = None
self.userTags = None
class DetachPolicyFromUserAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/accounts/users/{userUuid}/policies/{policyUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'null'
PARAMS = {
'policyUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'userUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachPolicyFromUserAction, self).__init__()
self.policyUuid = None
self.userUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RefreshLoadBalancerAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/load-balancers/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'refreshLoadBalancer'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RefreshLoadBalancerAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddLdapServerAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/ldap/servers'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=True,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'url': ParamAnnotation(required=True,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'base': ParamAnnotation(required=True,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'username': ParamAnnotation(required=True,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'encryption': ParamAnnotation(required=True,valid_values=['None','TLS'],max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddLdapServerAction, self).__init__()
self.name = None
self.description = None
self.url = None
self.base = None
self.username = None
self.password = None
self.encryption = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetDataVolumeAttachableVmAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/volumes/{volumeUuid}/candidate-vm-instances'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'volumeUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetDataVolumeAttachableVmAction, self).__init__()
self.volumeUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateEcsInstanceFromLocalImageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/ecs'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'ecsRootVolumeType': ParamAnnotation(required=False,valid_values=['cloud','cloud_efficiency','cloud_ssd','ephemeral_ssd'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=256,min_length=2,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ecsRootVolumeGBSize': ParamAnnotation(required=False,number_range=[40, 500],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'createMode': ParamAnnotation(required=False,valid_values=['atomic','permissive'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'privateIpAddress': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ecsInstanceName': ParamAnnotation(required=False,max_length=128,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'allocatePublicIp': ParamAnnotation(required=False,valid_values=['true','false'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'identityZoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'backupStorageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'imageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'instanceOfferingUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ecsVSwitchUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ecsSecurityGroupUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ecsRootPassword': ParamAnnotation(required=True,valid_regex_values=r'^[a-zA-Z][\w\W]{7,17}$',max_length=30,min_length=8,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ecsBandWidth': ParamAnnotation(required=True,number_range=[0, 200],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateEcsInstanceFromLocalImageAction, self).__init__()
self.ecsRootVolumeType = None
self.description = None
self.ecsRootVolumeGBSize = None
self.createMode = None
self.privateIpAddress = None
self.ecsInstanceName = None
self.allocatePublicIp = None
self.identityZoneUuid = None
self.backupStorageUuid = None
self.imageUuid = None
self.instanceOfferingUuid = None
self.ecsVSwitchUuid = None
self.ecsSecurityGroupUuid = None
self.ecsRootPassword = None
self.ecsBandWidth = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateBaremetalPxeServerAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/baremetal/pxeserver'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'dhcpInterface': ParamAnnotation(required=True,max_length=128,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'dhcpRangeBegin': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dhcpRangeEnd': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dhcpRangeNetmask': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateBaremetalPxeServerAction, self).__init__()
self.dhcpInterface = None
self.dhcpRangeBegin = None
self.dhcpRangeEnd = None
self.dhcpRangeNetmask = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachEipAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/eips/{eipUuid}/vm-instances/nics/{vmNicUuid'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'eipUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vmNicUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachEipAction, self).__init__()
self.eipUuid = None
self.vmNicUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateBaremetalHostCfgAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/baremetal/hostcfg/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateBaremetalHostCfg'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'vnc': ParamAnnotation(required=False,valid_values=['true','false'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'unattended': ParamAnnotation(required=False,valid_values=['true','false'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'nicCfgs': ParamAnnotation(required=False,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'chassisUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateBaremetalHostCfgAction, self).__init__()
self.uuid = None
self.password = None
self.vnc = None
self.unattended = None
self.nicCfgs = None
self.chassisUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteHostAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hosts/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteHostAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ReloadLicenseAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/licenses/actions'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'reloadLicense'
PARAMS = {
'managementNodeUuids': ParamAnnotation(required=False,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ReloadLicenseAction, self).__init__()
self.managementNodeUuids = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncEcsVpcFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/vpc/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'syncEcsVpcFromRemote'
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ecsVpcId': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncEcsVpcFromRemoteAction, self).__init__()
self.dataCenterUuid = None
self.ecsVpcId = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateEcsSecurityGroupRemoteAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/security-group/remote'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateEcsSecurityGroupRemoteAction, self).__init__()
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVirtualBorderRouterFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/border-router'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVirtualBorderRouterFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateVmInstanceAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/vm-instances'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'instanceOfferingUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'imageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=False,valid_values=['UserVm','ApplianceVm'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'rootDiskOfferingUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dataDiskOfferingUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'zoneUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'clusterUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'hostUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'primaryStorageUuidForRootVolume': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'defaultL3NetworkUuid': ParamAnnotation(),
'strategy': ParamAnnotation(required=False,valid_values=['InstantStart','JustCreate'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateVmInstanceAction, self).__init__()
self.name = None
self.instanceOfferingUuid = None
self.imageUuid = None
self.l3NetworkUuids = None
self.type = None
self.rootDiskOfferingUuid = None
self.dataDiskOfferingUuids = None
self.zoneUuid = None
self.clusterUuid = None
self.hostUuid = None
self.primaryStorageUuidForRootVolume = None
self.description = None
self.defaultL3NetworkUuid = None
self.strategy = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetHypervisorTypesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hosts/hypervisor-types'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'null'
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetHypervisorTypesAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVolumeSnapshotAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/volume-snapshots/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVolumeSnapshotAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryAccountResourceRefAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/accounts/resources/refs'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryAccountResourceRefAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateUserGroupAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/accounts/groups/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateUserGroup'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateUserGroupAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdatePortForwardingRuleAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/port-forwarding/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updatePortForwardingRule'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdatePortForwardingRuleAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ReconnectConsoleProxyAgentAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/consoles/agents'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'reconnectConsoleProxyAgent'
PARAMS = {
'agentUuids': ParamAnnotation(required=False,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ReconnectConsoleProxyAgentAction, self).__init__()
self.agentUuids = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateVirtualRouterOfferingAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/instance-offerings/virtual-routers'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'managementNetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'imageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'publicNetworkUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'isDefault': ParamAnnotation(),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'cpuNum': ParamAnnotation(required=True,number_range=[1, 1024],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'memorySize': ParamAnnotation(required=True,number_range=[1, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'allocatorStrategy': ParamAnnotation(),
'sortKey': ParamAnnotation(),
'type': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateVirtualRouterOfferingAction, self).__init__()
self.zoneUuid = None
self.managementNetworkUuid = None
self.imageUuid = None
self.publicNetworkUuid = None
self.isDefault = None
self.name = None
self.description = None
self.cpuNum = None
self.memorySize = None
self.allocatorStrategy = None
self.sortKey = None
self.type = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateBaremetalChassisAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/baremetal/chassis/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateBaremetalChassis'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ipmiAddress': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ipmiUsername': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ipmiPassword': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'provisioned': ParamAnnotation(required=False,valid_values=['true','false'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateBaremetalChassisAction, self).__init__()
self.uuid = None
self.ipmiAddress = None
self.ipmiUsername = None
self.ipmiPassword = None
self.provisioned = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteIpRangeAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/l3-networks/ip-ranges/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteIpRangeAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncRouterInterfaceFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/router-interface/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'syncRouterInterfaceFromRemote'
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncRouterInterfaceFromRemoteAction, self).__init__()
self.dataCenterUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetPortForwardingAttachableVmNicsAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/port-forwarding/{ruleUuid}/vm-instances/candidate-nics'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'ruleUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetPortForwardingAttachableVmNicsAction, self).__init__()
self.ruleUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetL2NetworkTypesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/l2-networks/types'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetL2NetworkTypesAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class CheckApiPermissionAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/accounts/permissions/actions'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'checkApiPermission'
PARAMS = {
'userUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'apiNames': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CheckApiPermissionAction, self).__init__()
self.userUuid = None
self.apiNames = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetTaskProgressAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/task-progresses/{apiId}'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'apiId': ParamAnnotation(),
'all': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetTaskProgressAction, self).__init__()
self.apiId = None
self.all = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ExpungeDataVolumeAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/volumes/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'expungeDataVolume'
PARAMS = {
'uuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ExpungeDataVolumeAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachNetworkServiceToL3NetworkAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/l3-networks/{l3NetworkUuid}/network-services'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'networkServices': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachNetworkServiceToL3NetworkAction, self).__init__()
self.l3NetworkUuid = None
self.networkServices = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RemoveMonFromCephPrimaryStorageAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/primary-storage/ceph/{uuid}/mons'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'monHostnames': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RemoveMonFromCephPrimaryStorageAction, self).__init__()
self.uuid = None
self.monHostnames = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ReconnectImageStoreBackupStorageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/backup-storage/image-store/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'reconnectImageStoreBackupStorage'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ReconnectImageStoreBackupStorageAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteSecurityGroupAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/security-groups/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteSecurityGroupAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QuerySecurityGroupRuleAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/security-groups/rules'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QuerySecurityGroupRuleAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QuerySecurityGroupAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/security-groups'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QuerySecurityGroupAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetDataCenterFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/data-center/remote'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'type': ParamAnnotation(required=True,valid_values=['aliyun'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetDataCenterFromRemoteAction, self).__init__()
self.type = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddVmNicToSecurityGroupAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/security-groups/{securityGroupUuid}/vm-instances/nics'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'securityGroupUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vmNicUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddVmNicToSecurityGroupAction, self).__init__()
self.securityGroupUuid = None
self.vmNicUuids = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeletePortForwardingRuleAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/port-forwarding/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeletePortForwardingRuleAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ExportImageFromBackupStorageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/backup-storage/{backupStorageUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'exportImageFromBackupStorage'
PARAMS = {
'backupStorageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'imageUuid': ParamAnnotation(required=True,max_length=2048,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ExportImageFromBackupStorageAction, self).__init__()
self.backupStorageUuid = None
self.imageUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SetVmHostnameAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'setVmHostname'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'hostname': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SetVmHostnameAction, self).__init__()
self.uuid = None
self.hostname = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetPrimaryStorageAllocatorStrategiesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/primary-storage/allocators/strategies'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetPrimaryStorageAllocatorStrategiesAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetLocalStorageHostDiskCapacityAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/primary-storage/local-storage/{primaryStorageUuid}/capacities'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'params'
PARAMS = {
'hostUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'primaryStorageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetLocalStorageHostDiskCapacityAction, self).__init__()
self.hostUuid = None
self.primaryStorageUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryNetworkServiceL3NetworkRefAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/l3-networks/network-services/refs'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryNetworkServiceL3NetworkRefAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class LocalStorageMigrateVolumeAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/primary-storage/local-storage/volumes/{volumeUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'localStorageMigrateVolume'
PARAMS = {
'volumeUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'destHostUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(LocalStorageMigrateVolumeAction, self).__init__()
self.volumeUuid = None
self.destHostUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetCandidateBackupStorageForCreatingImageAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = 'null'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'null'
PARAMS = {
'volumeUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'volumeSnapshotUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetCandidateBackupStorageForCreatingImageAction, self).__init__()
self.volumeUuid = None
self.volumeSnapshotUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryL2NetworkAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/l2-networks'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'null'
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryL2NetworkAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ResumeVmInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'resumeVmInstance'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ResumeVmInstanceAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachPolicyToUserGroupAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/accounts/groups/{groupUuid}/policies'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'policyUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'groupUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachPolicyToUserGroupAction, self).__init__()
self.policyUuid = None
self.groupUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVmInstanceHaLevelAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vm-instances/{uuid}/ha-levels'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVmInstanceHaLevelAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryEcsVSwitchFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/vswitch'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryEcsVSwitchFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class IsReadyToGoAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/management-nodes/ready'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'params'
PARAMS = {
'managementNodeId': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(IsReadyToGoAction, self).__init__()
self.managementNodeId = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVmHostnameAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vm-instances/{uuid}/hostnames'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVmHostnameAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachPrimaryStorageFromClusterAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/clusters/{clusterUuid}/primary-storage/{primaryStorageUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'null'
PARAMS = {
'primaryStorageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'clusterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachPrimaryStorageFromClusterAction, self).__init__()
self.primaryStorageUuid = None
self.clusterUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddSimulatorPrimaryStorageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/primary-storage/simulators'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'totalCapacity': ParamAnnotation(),
'availableCapacity': ParamAnnotation(),
'url': ParamAnnotation(required=True,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddSimulatorPrimaryStorageAction, self).__init__()
self.totalCapacity = None
self.availableCapacity = None
self.url = None
self.name = None
self.description = None
self.type = None
self.zoneUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateEcsVpcRemoteAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/vpc'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateEcsVpcRemoteAction, self).__init__()
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddCephPrimaryStoragePoolAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/primary-storage/ceph/{primaryStorageUuid}/pools'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'primaryStorageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'poolName': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'errorIfNotExist': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddCephPrimaryStoragePoolAction, self).__init__()
self.primaryStorageUuid = None
self.poolName = None
self.description = None
self.errorIfNotExist = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddVCenterAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/vcenters'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'username': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'https': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'port': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'domainName': ParamAnnotation(required=True,max_length=256,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddVCenterAction, self).__init__()
self.username = None
self.password = None
self.zoneUuid = None
self.name = None
self.https = None
self.port = None
self.domainName = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateL3NetworkAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/l3-networks'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'l2NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'system': ParamAnnotation(),
'dnsDomain': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateL3NetworkAction, self).__init__()
self.name = None
self.description = None
self.type = None
self.l2NetworkUuid = None
self.system = None
self.dnsDomain = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateVmInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateVmInstance'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'state': ParamAnnotation(required=False,valid_values=['Stopped','Running'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'defaultL3NetworkUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'platform': ParamAnnotation(required=False,valid_values=['Linux','Windows','Other','Paravirtualization','WindowsVirtio'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'cpuNum': ParamAnnotation(required=False,number_range=[1, 1024],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'memorySize': ParamAnnotation(required=False,number_range=[1, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateVmInstanceAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.state = None
self.defaultL3NetworkUuid = None
self.platform = None
self.cpuNum = None
self.memorySize = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ReconnectVirtualRouterAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/appliances/virtual-routers/{vmInstanceUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'reconnectVirtualRouter'
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ReconnectVirtualRouterAction, self).__init__()
self.vmInstanceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryLoadBalancerListenerAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/load-balancers/listeners'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryLoadBalancerListenerAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryResourcePriceAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/billings/prices'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryResourcePriceAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryWebhookAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/web-hooks'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryWebhookAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteConnectionAccessPointLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/access-point/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteConnectionAccessPointLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ReconnectPrimaryStorageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/primary-storage/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'reconnectPrimaryStorage'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ReconnectPrimaryStorageAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CleanUpImageCacheOnPrimaryStorageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/primary-storage/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'cleanUpImageCacheOnPrimaryStorage'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CleanUpImageCacheOnPrimaryStorageAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SetImageQgaAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/images/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'setImageQga'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'enable': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SetImageQgaAction, self).__init__()
self.uuid = None
self.enable = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetEipAttachableVmNicsAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/eips/{eipUuid}/vm-instances/candidate-nics'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'eipUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vipUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetEipAttachableVmNicsAction, self).__init__()
self.eipUuid = None
self.vipUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryZoneAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/zones'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryZoneAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachSecurityGroupFromL3NetworkAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/security-groups/{securityGroupUuid}/l3-networks/{l3NetworkUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'securityGroupUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachSecurityGroupFromL3NetworkAction, self).__init__()
self.securityGroupUuid = None
self.l3NetworkUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryEcsVpcFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/vpc'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryEcsVpcFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateDataVolumeFromVolumeSnapshotAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/volumes/data/from/volume-snapshots/{volumeSnapshotUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'volumeSnapshotUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'primaryStorageUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateDataVolumeFromVolumeSnapshotAction, self).__init__()
self.name = None
self.description = None
self.volumeSnapshotUuid = None
self.primaryStorageUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeEipStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/eips/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeEipState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeEipStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateL2NetworkAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/l2-networks/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateL2Network'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateL2NetworkAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachNetworkServiceFromL3NetworkAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/l3-networks/{l3NetworkUuid}/network-services'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'networkServices': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachNetworkServiceFromL3NetworkAction, self).__init__()
self.l3NetworkUuid = None
self.networkServices = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddNfsPrimaryStorageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/primary-storage/nfs'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'url': ParamAnnotation(required=True,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddNfsPrimaryStorageAction, self).__init__()
self.url = None
self.name = None
self.description = None
self.type = None
self.zoneUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateEcsVSwitchRemoteAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/vswitch'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateEcsVSwitchRemoteAction, self).__init__()
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateAccountAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/accounts'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=False,valid_values=['SystemAdmin','Normal'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateAccountAction, self).__init__()
self.name = None
self.password = None
self.type = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmStartingCandidateClustersHostsAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{uuid}/starting-target-hosts'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmStartingCandidateClustersHostsAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RebootVmInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'rebootVmInstance'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RebootVmInstanceAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmAttachableDataVolumeAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{vmInstanceUuid}/data-volume-candidates'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'null'
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmAttachableDataVolumeAction, self).__init__()
self.vmInstanceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CleanInvalidLdapBindingAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/ldap/bindings/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'cleanInvalidLdapBinding'
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CleanInvalidLdapBindingAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryAliyunKeySecretAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/key'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryAliyunKeySecretAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeClusterStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/clusters/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeClusterState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeClusterStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachDataVolumeToVmAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/volumes/{volumeUuid}/vm-instances/{vmInstanceUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'volumeUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachDataVolumeToVmAction, self).__init__()
self.vmInstanceUuid = None
self.volumeUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RemoveUserFromGroupAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/accounts/groups/{groupUuid}/users/{userUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'null'
PARAMS = {
'userUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'groupUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RemoveUserFromGroupAction, self).__init__()
self.userUuid = None
self.groupUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddSimulatorHostAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hosts/simulators'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'memoryCapacity': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'cpuCapacity': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'managementIp': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'clusterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddSimulatorHostAction, self).__init__()
self.memoryCapacity = None
self.cpuCapacity = None
self.name = None
self.description = None
self.managementIp = None
self.clusterUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVipAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/vips'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVipAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RecoverDataVolumeAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/volumes/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'recoverDataVolume'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RecoverDataVolumeAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryEcsSecurityGroupFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/security-group'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryEcsSecurityGroupFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVirtualRouterVmAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/appliances/virtual-routers'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVirtualRouterVmAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateUserGroupAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/accounts/groups'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateUserGroupAction, self).__init__()
self.name = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateImageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/images/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateImage'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'guestOsType': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'mediaType': ParamAnnotation(required=False,valid_values=['RootVolumeTemplate','DataVolumeTemplate','ISO'],max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'format': ParamAnnotation(required=False,valid_values=['raw','qcow2','iso'],max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'system': ParamAnnotation(),
'platform': ParamAnnotation(required=False,valid_values=['Linux','Windows','Other','Paravirtualization','WindowsVirtio'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateImageAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.guestOsType = None
self.mediaType = None
self.format = None
self.system = None
self.platform = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class KvmRunShellAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hosts/kvm/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'kvmRunShell'
PARAMS = {
'hostUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'script': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(KvmRunShellAction, self).__init__()
self.hostUuids = None
self.script = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateVolumeAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/volumes/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateVolume'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateVolumeAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachIsoFromVmInstanceAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vm-instances/{vmInstanceUuid}/iso'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'null'
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachIsoFromVmInstanceAction, self).__init__()
self.vmInstanceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVCenterPrimaryStorageAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/vcenters/primary-storage'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVCenterPrimaryStorageAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateVolumeSnapshotAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/volumes/{volumeUuid}/volume-snapshots'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'volumeUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateVolumeSnapshotAction, self).__init__()
self.volumeUuid = None
self.name = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RemoveDnsFromL3NetworkAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/l3-networks/{l3NetworkUuid}/dns/{dns}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dns': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RemoveDnsFromL3NetworkAction, self).__init__()
self.l3NetworkUuid = None
self.dns = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ValidateSessionAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/accounts/sessions/{sessionUuid}/valid'
NEED_SESSION = False
NEED_POLL = False
PARAM_NAME = 'null'
PARAMS = {
'sessionUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation()
}
def __init__(self):
super(ValidateSessionAction, self).__init__()
self.sessionUuid = None
self.systemTags = None
self.userTags = None
class QueryDiskOfferingAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/disk-offerings'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryDiskOfferingAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteResourcePriceAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/billings/prices/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteResourcePriceAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVCenterClusterAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/vcenters/clusters'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVCenterClusterAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachAliyunKeyAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hybrid/aliyun/key/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'detachAliyunKey'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachAliyunKeyAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddImageStoreBackupStorageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/backup-storage/image-store'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'hostname': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'username': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshPort': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'url': ParamAnnotation(required=True,max_length=2048,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'importImages': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddImageStoreBackupStorageAction, self).__init__()
self.hostname = None
self.username = None
self.password = None
self.sshPort = None
self.url = None
self.name = None
self.description = None
self.type = None
self.importImages = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateSecurityGroupAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/security-groups/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateSecurityGroup'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateSecurityGroupAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RecoveryVirtualBorderRouterRemoteAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hybrid/aliyun/border-router/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'recoveryVirtualBorderRouterRemote'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RecoveryVirtualBorderRouterRemoteAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryInstanceOfferingAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/instance-offerings'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryInstanceOfferingAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVmNicFromSecurityGroupAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/security-groups/{securityGroupUuid}/vm-instances/nics'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'securityGroupUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vmNicUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVmNicFromSecurityGroupAction, self).__init__()
self.securityGroupUuid = None
self.vmNicUuids = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SetVmQgaAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'setVmQga'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'enable': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SetVmQgaAction, self).__init__()
self.uuid = None
self.enable = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryBaremetalPxeServerAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/baremetal/pxeserver'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryBaremetalPxeServerAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetL3NetworkDhcpIpAddressAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/l3-networks/{l3NetworkUuid/dhcp-ip'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'l3NetworkUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetL3NetworkDhcpIpAddressAction, self).__init__()
self.l3NetworkUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddDataCenterFromRemoteAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/data-center'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'regionId': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=True,valid_values=['aliyun'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddDataCenterFromRemoteAction, self).__init__()
self.regionId = None
self.type = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateInstanceOfferingAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/instance-offerings/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateInstanceOffering'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateInstanceOfferingAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateSecurityGroupAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/security-groups'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateSecurityGroupAction, self).__init__()
self.name = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryLdapBindingAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/ldap/bindings'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryLdapBindingAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachAliyunKeyAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hybrid/aliyun/key/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'attachAliyunKey'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachAliyunKeyAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateRouterInterfacePairRemoteAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/router-interface'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'accessPointUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'Spec': ParamAnnotation(required=True,valid_values=['Small.1','Small.2','Small.5','Middle.1','Middle.2','Middle.5','Large.1','Large.2'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vRouterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vBorderRouterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'aDescription': ParamAnnotation(required=False,max_length=128,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'aName': ParamAnnotation(required=False,max_length=64,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'bDescription': ParamAnnotation(required=False,max_length=128,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'bName': ParamAnnotation(required=False,max_length=64,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ownerName': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateRouterInterfacePairRemoteAction, self).__init__()
self.dataCenterUuid = None
self.accessPointUuid = None
self.Spec = None
self.vRouterUuid = None
self.vBorderRouterUuid = None
self.aDescription = None
self.aName = None
self.bDescription = None
self.bName = None
self.ownerName = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateSystemTagAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/system-tags/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateSystemTag'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'tag': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateSystemTagAction, self).__init__()
self.uuid = None
self.tag = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVCenterBackupStorageAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/vcenters/backup-storage'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVCenterBackupStorageAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVirtualRouterFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/vrouter'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVirtualRouterFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateL3NetworkAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/l3-networks/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateL3Network'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'system': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateL3NetworkAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.system = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateVolumeSnapshotAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/volume-snapshots/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateVolumeSnapshot'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateVolumeSnapshotAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RevokeResourceSharingAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/accounts/resources/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'revokeResourceSharing'
PARAMS = {
'resourceUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'toPublic': ParamAnnotation(),
'accountUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'all': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RevokeResourceSharingAction, self).__init__()
self.resourceUuids = None
self.toPublic = None
self.accountUuids = None
self.all = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryClusterAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/clusters'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryClusterAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteWebhookAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/web-hooks/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteWebhookAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryL3NetworkAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/l3-networks'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryL3NetworkAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetIpAddressCapacityAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/ip-capacity'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'params'
PARAMS = {
'zoneUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ipRangeUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'all': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetIpAddressCapacityAction, self).__init__()
self.zoneUuids = None
self.l3NetworkUuids = None
self.ipRangeUuids = None
self.all = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetOssBucketNameFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/oss/remote'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetOssBucketNameFromRemoteAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateVipAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/vips'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'allocatorStrategy': ParamAnnotation(),
'requiredIp': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateVipAction, self).__init__()
self.name = None
self.description = None
self.l3NetworkUuid = None
self.allocatorStrategy = None
self.requiredIp = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryDataCenterFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/data-center'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryDataCenterFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetIdentityZoneFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/identity-zone/remote'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'type': ParamAnnotation(required=True,valid_values=['aliyun'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dataCenterUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'regionId': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetIdentityZoneFromRemoteAction, self).__init__()
self.type = None
self.dataCenterUuid = None
self.regionId = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncPrimaryStorageCapacityAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/primary-storage/{primaryStorageUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'syncPrimaryStorageCapacity'
PARAMS = {
'primaryStorageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncPrimaryStorageCapacityAction, self).__init__()
self.primaryStorageUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachEipAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/eips/{uuid}/vm-instances/nics'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachEipAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmCapabilitiesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{uuid}/capabilities'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'null'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmCapabilitiesAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreatePolicyAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/accounts/policies'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'statements': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreatePolicyAction, self).__init__()
self.name = None
self.description = None
self.statements = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateEipAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/eips'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vipUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vmNicUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateEipAction, self).__init__()
self.name = None
self.description = None
self.vipUuid = None
self.vmNicUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateDataVolumeTemplateFromVolumeAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/images/data-volume-templates/from/volumes/{volumeUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'volumeUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'backupStorageUuids': ParamAnnotation(required=False,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateDataVolumeTemplateFromVolumeAction, self).__init__()
self.name = None
self.description = None
self.volumeUuid = None
self.backupStorageUuids = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CalculateAccountSpendingAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/billings/accounts/{accountUuid}/actions'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'calculateAccountSpending'
PARAMS = {
'accountUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dateStart': ParamAnnotation(required=False,number_range=[0, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dateEnd': ParamAnnotation(required=False,number_range=[0, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CalculateAccountSpendingAction, self).__init__()
self.accountUuid = None
self.dateStart = None
self.dateEnd = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreatePortForwardingRuleAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/port-forwarding'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'vipUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vipPortStart': ParamAnnotation(required=True,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vipPortEnd': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'privatePortStart': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'privatePortEnd': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'protocolType': ParamAnnotation(required=True,valid_values=['TCP','UDP'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vmNicUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'allowedCidr': ParamAnnotation(),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreatePortForwardingRuleAction, self).__init__()
self.vipUuid = None
self.vipPortStart = None
self.vipPortEnd = None
self.privatePortStart = None
self.privatePortEnd = None
self.protocolType = None
self.vmNicUuid = None
self.allowedCidr = None
self.name = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddUserToGroupAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/accounts/groups/{groupUuid}/users'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'addUserToGroup'
PARAMS = {
'userUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'groupUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddUserToGroupAction, self).__init__()
self.userUuid = None
self.groupUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddDnsToL3NetworkAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/l3-networks/{l3NetworkUuid}/dns'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dns': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddDnsToL3NetworkAction, self).__init__()
self.l3NetworkUuid = None
self.dns = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteAccountAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/accounts/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteAccountAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateEcsInstanceVncPasswordAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hybrid/aliyun/ecs-vnc/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateEcsInstanceVncPassword'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,valid_regex_values=r'[A-Za-z0-9]{6}',max_length=6,min_length=6,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateEcsInstanceVncPasswordAction, self).__init__()
self.uuid = None
self.password = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateRootVolumeTemplateFromVolumeSnapshotAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/images/root-volume-templates/from/volume-snapshots/{snapshotUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'snapshotUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'guestOsType': ParamAnnotation(),
'backupStorageUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'platform': ParamAnnotation(required=False,valid_values=['Linux','Windows','Other','Paravirtualization','WindowsVirtio'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'system': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateRootVolumeTemplateFromVolumeSnapshotAction, self).__init__()
self.snapshotUuid = None
self.name = None
self.description = None
self.guestOsType = None
self.backupStorageUuids = None
self.platform = None
self.system = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ReconnectBackupStorageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/backup-storage/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'reconnectBackupStorage'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ReconnectBackupStorageAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetL3NetworkTypesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/l3-networks/types'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetL3NetworkTypesAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateUserTagAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/user-tags'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'resourceType': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'tag': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateUserTagAction, self).__init__()
self.resourceType = None
self.resourceUuid = None
self.tag = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddMonToCephPrimaryStorageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/primary-storage/ceph/{uuid}/mons'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'monUrls': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddMonToCephPrimaryStorageAction, self).__init__()
self.uuid = None
self.monUrls = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVirtualRouterLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/vrouter/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVirtualRouterLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteBaremetalPxeServerAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/baremetal/pxeserver/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteBaremetalPxeServerAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateIPsecConnectionAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/ipsec'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'peerAddress': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'authMode': ParamAnnotation(required=False,valid_values=['psk','certs'],max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'authKey': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vipUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'peerCidrs': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'ikeAuthAlgorithm': ParamAnnotation(required=False,valid_values=['md5','sha1','sha256','sha384','sha512'],max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ikeEncryptionAlgorithm': ParamAnnotation(required=False,valid_values=['3des','aes-128','aes-192','aes-256'],max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ikeDhGroup': ParamAnnotation(),
'policyAuthAlgorithm': ParamAnnotation(required=False,valid_values=['md5','sha1','sha256','sha384','sha512'],max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'policyEncryptionAlgorithm': ParamAnnotation(required=False,valid_values=['3des','aes-128','aes-192','aes-256'],max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'pfs': ParamAnnotation(required=False,valid_values=['dh-group2','dh-group5','dh-group14','dh-group15','dh-group16','dh-group17','dh-group18','dh-group19','dh-group20','dh-group21','dh-group22','dh-group23','dh-group24','dh-group25','dh-group26'],max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'policyMode': ParamAnnotation(required=False,valid_values=['tunnel','transport'],max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'transformProtocol': ParamAnnotation(required=False,valid_values=['esp','ah','ah-esp'],max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateIPsecConnectionAction, self).__init__()
self.name = None
self.description = None
self.l3NetworkUuid = None
self.peerAddress = None
self.authMode = None
self.authKey = None
self.vipUuid = None
self.peerCidrs = None
self.ikeAuthAlgorithm = None
self.ikeEncryptionAlgorithm = None
self.ikeDhGroup = None
self.policyAuthAlgorithm = None
self.policyEncryptionAlgorithm = None
self.pfs = None
self.policyMode = None
self.transformProtocol = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateStartVmInstanceSchedulerAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/vm-instances/{vmUuid}/schedulers/starting'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'vmUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'clusterUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'hostUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'schedulerName': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'schedulerDescription': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=True,valid_values=['simple','cron'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'interval': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'repeatCount': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'startTime': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'cron': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateStartVmInstanceSchedulerAction, self).__init__()
self.vmUuid = None
self.clusterUuid = None
self.hostUuid = None
self.schedulerName = None
self.schedulerDescription = None
self.type = None
self.interval = None
self.repeatCount = None
self.startTime = None
self.cron = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeDiskOfferingStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/disk-offerings/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeDiskOfferingState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeDiskOfferingStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QuerySftpBackupStorageAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/backup-storage/sftp'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QuerySftpBackupStorageAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryQuotaAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/accounts/quotas'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryQuotaAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteDataCenterInLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/data-center/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteDataCenterInLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteOssFileBucketNameInLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/oss-bucket/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteOssFileBucketNameInLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmHostnameAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{uuid}/hostnames'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmHostnameAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachL3NetworkFromVmAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vm-instances/nics/{vmNicUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'null'
PARAMS = {
'vmNicUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachL3NetworkFromVmAction, self).__init__()
self.vmNicUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class StartBaremetalPxeServerAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/baremetal/pxeserver/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'startBaremetalPxeServer'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(StartBaremetalPxeServerAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryOssBucketFileNameAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/oss-bucket'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryOssBucketFileNameAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdatePrimaryStorageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/primary-storage/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updatePrimaryStorage'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'url': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdatePrimaryStorageAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.url = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncVirtualBorderRouterFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/border-router/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'syncVirtualBorderRouterFromRemote'
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncVirtualBorderRouterFromRemoteAction, self).__init__()
self.dataCenterUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SetVmSshKeyAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'setVmSshKey'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'SshKey': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SetVmSshKeyAction, self).__init__()
self.uuid = None
self.SshKey = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmInstanceHaLevelAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{uuid}/ha-levels'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmInstanceHaLevelAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeHostStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hosts/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeHostState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable','maintain'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeHostStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateBaremetalHostCfgAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/baremetal/hostcfg'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'chassisUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'vnc': ParamAnnotation(required=False,valid_values=['true','false'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'unattended': ParamAnnotation(required=False,valid_values=['true','false'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'nicCfgs': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateBaremetalHostCfgAction, self).__init__()
self.chassisUuid = None
self.password = None
self.vnc = None
self.unattended = None
self.nicCfgs = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryImageStoreBackupStorageAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/backup-storage/image-store'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryImageStoreBackupStorageAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteRouterInterfaceLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/router-interface/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteRouterInterfaceLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryEcsSecurityGroupRuleFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/security-group-rule'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryEcsSecurityGroupRuleFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteLdapServerAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/ldap/servers/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteLdapServerAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateUserAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/accounts/users/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateUser'
PARAMS = {
'uuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateUserAction, self).__init__()
self.uuid = None
self.password = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteZoneAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/zones/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'zone'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteZoneAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeBackupStorageStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/backup-storage/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeBackupStorageState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeBackupStorageStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteAllEcsInstancesFromDataCenterAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/dc-ecs/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteAllEcsInstancesFromDataCenterAction, self).__init__()
self.dataCenterUuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryConsoleProxyAgentAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/consoles/agents'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryConsoleProxyAgentAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteEcsInstanceAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/ecs/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteEcsInstanceAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ProvisionBaremetalHostAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/baremetal/chassis/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'provisionBaremetalHost'
PARAMS = {
'chassisUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ProvisionBaremetalHostAction, self).__init__()
self.chassisUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class LogInByLdapAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/ldap/login'
NEED_SESSION = False
NEED_POLL = False
PARAM_NAME = 'logInByLdap'
PARAMS = {
'uid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation()
}
def __init__(self):
super(LogInByLdapAction, self).__init__()
self.uid = None
self.password = None
self.systemTags = None
self.userTags = None
class GetInterdependentL3NetworksImagesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/images-l3networks/dependencies'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'params'
PARAMS = {
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuids': ParamAnnotation(required=False,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'imageUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetInterdependentL3NetworksImagesAction, self).__init__()
self.zoneUuid = None
self.l3NetworkUuids = None
self.imageUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachPoliciesToUserAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/accounts/users/{userUuid}/policy-collection'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'userUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'policyUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachPoliciesToUserAction, self).__init__()
self.userUuid = None
self.policyUuids = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteBaremetalChassisAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/baremetal/chassis/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteBaremetalChassisAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryBackupStorageAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/backup-storage'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryBackupStorageAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryHostAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hosts'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryHostAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class PowerOffBaremetalHostAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/baremetal/chassis/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'powerOffBaremetalHost'
PARAMS = {
'chassisUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(PowerOffBaremetalHostAction, self).__init__()
self.chassisUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVmSshKeyAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vm-instances/{uuid}/ssh-keys'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'null'
PARAMS = {
'uuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVmSshKeyAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateBaremetalPxeServerAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/baremetal/pxeserver/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateBaremetalPxeServer'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dhcpInterface': ParamAnnotation(required=False,max_length=128,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dhcpRangeBegin': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dhcpRangeEnd': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dhcpRangeNetmask': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateBaremetalPxeServerAction, self).__init__()
self.uuid = None
self.dhcpInterface = None
self.dhcpRangeBegin = None
self.dhcpRangeEnd = None
self.dhcpRangeNetmask = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachL2NetworkToClusterAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/l2-networks/{l2NetworkUuid}/clusters/{clusterUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'null'
PARAMS = {
'l2NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'clusterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachL2NetworkToClusterAction, self).__init__()
self.l2NetworkUuid = None
self.clusterUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddMonToCephBackupStorageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/backup-storage/ceph/{uuid}/mons'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'monUrls': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddMonToCephBackupStorageAction, self).__init__()
self.uuid = None
self.monUrls = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryBaremetalHostCfgAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/baremetal/hostcfg'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryBaremetalHostCfgAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class PrometheusQueryPassThroughAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/prometheus/all'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'params'
PARAMS = {
'instant': ParamAnnotation(),
'startTime': ParamAnnotation(required=False,number_range=[0, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'endTime': ParamAnnotation(required=False,number_range=[0, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'step': ParamAnnotation(),
'expression': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'relativeTime': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(PrometheusQueryPassThroughAction, self).__init__()
self.instant = None
self.startTime = None
self.endTime = None
self.step = None
self.expression = None
self.relativeTime = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteBackupStorageAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/backup-storage/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteBackupStorageAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetCandidateVmNicForSecurityGroupAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/security-groups/{securityGroupUuid}/vm-instances/candidate-nics'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'securityGroupUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetCandidateVmNicForSecurityGroupAction, self).__init__()
self.securityGroupUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetPrimaryStorageCapacityAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/primary-storage/capacities'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'params'
PARAMS = {
'zoneUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'clusterUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'primaryStorageUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'all': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetPrimaryStorageCapacityAction, self).__init__()
self.zoneUuids = None
self.clusterUuids = None
self.primaryStorageUuids = None
self.all = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class StopEcsInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hybrid/aliyun/ecs/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'stopEcsInstance'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(StopEcsInstanceAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVmConsolePasswordAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vm-instances/{uuid}/console-password'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'null'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVmConsolePasswordAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SetVmInstanceHaLevelAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/vm-instances/{uuid}/ha-levels'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'level': ParamAnnotation(required=True,valid_values=['NeverStop','OnHostFailure'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SetVmInstanceHaLevelAction, self).__init__()
self.uuid = None
self.level = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetLicenseInfoAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/licenses'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetLicenseInfoAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeImageStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/images/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeImageState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeImageStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateInstanceOfferingAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/instance-offerings'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'cpuNum': ParamAnnotation(required=True,number_range=[1, 1024],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'memorySize': ParamAnnotation(required=True,number_range=[1, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'allocatorStrategy': ParamAnnotation(),
'sortKey': ParamAnnotation(),
'type': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateInstanceOfferingAction, self).__init__()
self.name = None
self.description = None
self.cpuNum = None
self.memorySize = None
self.allocatorStrategy = None
self.sortKey = None
self.type = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryManagementNodeAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/management-nodes'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryManagementNodeAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateEipAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/eips/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateEip'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateEipAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeInstanceOfferingStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/instance-offerings/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeInstanceOfferingState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeInstanceOfferingStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetImageQgaAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/images/{uuid}/qga'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetImageQgaAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeSecurityGroupStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/security-groups/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeSecurityGroupState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeSecurityGroupStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeInstanceOfferingAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{vmInstanceUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeInstanceOffering'
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'instanceOfferingUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeInstanceOfferingAction, self).__init__()
self.vmInstanceUuid = None
self.instanceOfferingUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteDiskOfferingAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/disk-offerings/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteDiskOfferingAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateVniRangeAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/l2-networks/vxlan-pool/{l2NetworkUuid}/vni-ranges'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'startVni': ParamAnnotation(required=True,number_range=[0, 16777214],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'endVni': ParamAnnotation(required=True,number_range=[0, 16777214],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l2NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateVniRangeAction, self).__init__()
self.name = None
self.description = None
self.startVni = None
self.endVni = None
self.l2NetworkUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVolumeSnapshotAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/volume-snapshots'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVolumeSnapshotAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class StopBaremetalPxeServerAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/baremetal/pxeserver/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'stopBaremetalPxeServer'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(StopBaremetalPxeServerAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CheckIpAvailabilityAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/l3-networks/{l3NetworkUuid}/ip/{ip}/availability'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ip': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CheckIpAvailabilityAction, self).__init__()
self.l3NetworkUuid = None
self.ip = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteLoadBalancerListenerAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/load-balancers/listeners/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteLoadBalancerListenerAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteIdentityZoneInLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/identity-zone/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteIdentityZoneInLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryIpRangeAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/l3-networks/ip-ranges'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryIpRangeAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetCandidateVmNicsForLoadBalancerAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/load-balancers/listeners/{listenerUuid}/vm-instances/candidate-nics'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'listenerUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetCandidateVmNicsForLoadBalancerAction, self).__init__()
self.listenerUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryRouterInterfaceFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/router-interface'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryRouterInterfaceFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteBaremetalHostCfgAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/baremetal/hostcfg/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteBaremetalHostCfgAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class PowerOnBaremetalHostAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/baremetal/chassis/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'powerOnBaremetalHost'
PARAMS = {
'chassisUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(PowerOnBaremetalHostAction, self).__init__()
self.chassisUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateRootVolumeTemplateFromRootVolumeAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/images/root-volume-templates/from/volumes/{rootVolumeUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'guestOsType': ParamAnnotation(),
'backupStorageUuids': ParamAnnotation(required=False,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'rootVolumeUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'platform': ParamAnnotation(required=False,valid_values=['Linux','Windows','Other','Paravirtualization','WindowsVirtio'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'system': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateRootVolumeTemplateFromRootVolumeAction, self).__init__()
self.name = None
self.description = None
self.guestOsType = None
self.backupStorageUuids = None
self.rootVolumeUuid = None
self.platform = None
self.system = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteImageAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/images/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'backupStorageUuids': ParamAnnotation(required=False,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteImageAction, self).__init__()
self.uuid = None
self.backupStorageUuids = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QuerySystemTagAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/system-tags'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QuerySystemTagAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteEcsSecurityGroupInLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/security-group/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteEcsSecurityGroupInLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateZoneAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/zones/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateZone'
PARAMS = {
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateZoneAction, self).__init__()
self.name = None
self.description = None
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DestroyVmInstanceAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vm-instances/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'null'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DestroyVmInstanceAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RecoverVmInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'recoverVmInstance'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RecoverVmInstanceAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncImageSizeAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/images/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'syncImageSize'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncImageSizeAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangePortForwardingRuleStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/port-forwarding/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changePortForwardingRuleState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangePortForwardingRuleStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateLoadBalancerListenerAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/load-balancers/{loadBalancerUuid}/listeners'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'loadBalancerUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'instancePort': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'loadBalancerPort': ParamAnnotation(required=True,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'protocol': ParamAnnotation(required=False,valid_values=['tcp','http'],max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateLoadBalancerListenerAction, self).__init__()
self.loadBalancerUuid = None
self.name = None
self.description = None
self.instancePort = None
self.loadBalancerPort = None
self.protocol = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateL2VlanNetworkAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/l2-networks/vlan'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'vlan': ParamAnnotation(required=True,number_range=[1, 4094],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'physicalInterface': ParamAnnotation(required=True,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateL2VlanNetworkAction, self).__init__()
self.vlan = None
self.name = None
self.description = None
self.zoneUuid = None
self.physicalInterface = None
self.type = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetNetworkServiceTypesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/network-services/types'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetNetworkServiceTypesAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class QuerySharedResourceAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/accounts/resources'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QuerySharedResourceAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteUserAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/accounts/users/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteUserAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddOssFileBucketNameAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/oss-bucket'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'bucketName': ParamAnnotation(required=True,max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'regionId': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddOssFileBucketNameAction, self).__init__()
self.bucketName = None
self.regionId = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetFreeIpAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = 'null'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'params'
PARAMS = {
'l3NetworkUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ipRangeUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'start': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetFreeIpAction, self).__init__()
self.l3NetworkUuid = None
self.ipRangeUuid = None
self.start = None
self.limit = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetNicQosAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{uuid}/nic-qos'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetNicQosAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmConsoleAddressAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{uuid}/console-addresses'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'null'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmConsoleAddressAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ReimageVmInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{vmInstanceUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'reimageVmInstance'
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ReimageVmInstanceAction, self).__init__()
self.vmInstanceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncRouteEntryFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/route-entry/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'syncRouteEntryFromRemote'
PARAMS = {
'vRouterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vRouterType': ParamAnnotation(required=True,valid_values=['vbr','vrouter'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncRouteEntryFromRemoteAction, self).__init__()
self.vRouterUuid = None
self.vRouterType = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteEcsSecurityGroupRemoteAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/security-group/remote/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteEcsSecurityGroupRemoteAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryLdapServerAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/ldap/servers'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryLdapServerAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachOssBucketToEcsDataCenterAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/{dataCenterUuid}/oss-bucket/{ossBucketUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'ossBucketUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachOssBucketToEcsDataCenterAction, self).__init__()
self.ossBucketUuid = None
self.dataCenterUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateGlobalConfigAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/global-configurations/{category}/{name}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateGlobalConfig'
PARAMS = {
'category': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'value': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateGlobalConfigAction, self).__init__()
self.category = None
self.name = None
self.value = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteGCJobAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/gc-jobs/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteGCJobAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddConnectionAccessPointFromRemoteAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/access-point'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddConnectionAccessPointFromRemoteAction, self).__init__()
self.dataCenterUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SetVmConsolePasswordAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'setVmConsolePassword'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'consolePassword': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SetVmConsolePasswordAction, self).__init__()
self.uuid = None
self.consolePassword = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVolumeQosAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/volumes/{uuid}/qos'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVolumeQosAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RequestConsoleAccessAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/consoles'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RequestConsoleAccessAction, self).__init__()
self.vmInstanceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ShareResourceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/accounts/resources/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'shareResource'
PARAMS = {
'resourceUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'accountUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'toPublic': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ShareResourceAction, self).__init__()
self.resourceUuids = None
self.accountUuids = None
self.toPublic = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryIPSecConnectionAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/ipsec'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryIPSecConnectionAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeletePrimaryStorageAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/primary-storage/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'null'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeletePrimaryStorageAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachPortForwardingRuleAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/port-forwarding/{ruleUuid}/vm-instances/nics/{vmNicUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'ruleUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vmNicUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachPortForwardingRuleAction, self).__init__()
self.ruleUuid = None
self.vmNicUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryGCJobAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/gc-jobs'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryGCJobAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteEcsImageLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/image/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteEcsImageLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddSimulatorBackupStorageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/backup-storage/simulators'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'totalCapacity': ParamAnnotation(),
'availableCapacity': ParamAnnotation(),
'url': ParamAnnotation(required=True,max_length=2048,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'importImages': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddSimulatorBackupStorageAction, self).__init__()
self.totalCapacity = None
self.availableCapacity = None
self.url = None
self.name = None
self.description = None
self.type = None
self.importImages = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryNetworkServiceProviderAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/network-services/providers'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryNetworkServiceProviderAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddIpRangeByNetworkCidrAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/l3-networks/{l3NetworkUuid}/ip-ranges/by-cidr'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'networkCidr': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddIpRangeByNetworkCidrAction, self).__init__()
self.name = None
self.description = None
self.l3NetworkUuid = None
self.networkCidr = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddCephBackupStorageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/backup-storage/ceph'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'monUrls': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'poolName': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'url': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'importImages': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddCephBackupStorageAction, self).__init__()
self.monUrls = None
self.poolName = None
self.url = None
self.name = None
self.description = None
self.type = None
self.importImages = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateBaremetalChassisAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/baremetal/chassis'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'ipmiAddress': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ipmiUsername': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ipmiPassword': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateBaremetalChassisAction, self).__init__()
self.ipmiAddress = None
self.ipmiUsername = None
self.ipmiPassword = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteL2NetworkAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/l2-networks/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteL2NetworkAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateZoneAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/zones'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateZoneAction, self).__init__()
self.name = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVniRangeAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/l2-networks/vxlan-pool/vni-ranges/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVniRangeAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangePrimaryStorageStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/primary-storage/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changePrimaryStorageState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable','maintain','deleting'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangePrimaryStorageStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QuerySchedulerTriggerAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/scheduler/triggers'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QuerySchedulerTriggerAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateLdapBindingAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/ldap/bindings'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'ldapUid': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'accountUuid': ParamAnnotation(required=True,max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateLdapBindingAction, self).__init__()
self.ldapUid = None
self.accountUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetConnectionBetweenL3NetworkAndAliyunVSwitchAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/connections'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceType': ParamAnnotation(required=True,valid_values=['vswitch','l3network','vroutervm','vbr','vpc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetConnectionBetweenL3NetworkAndAliyunVSwitchAction, self).__init__()
self.uuid = None
self.resourceType = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryIPSecConnectionAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/ipsec'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryIPSecConnectionAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteEcsVSwitchInLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/vswitch/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteEcsVSwitchInLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteClusterAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/clusters/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteClusterAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ReimageVmInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{vmInstanceUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'reimageVmInstance'
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ReimageVmInstanceAction, self).__init__()
self.vmInstanceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RemoveUserFromGroupAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/accounts/groups/{groupUuid}/users/{userUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'userUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'groupUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RemoveUserFromGroupAction, self).__init__()
self.userUuid = None
self.groupUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncRouterInterfaceFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/router-interface/{dataCenterUuid}/sync'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncRouterInterfaceFromRemoteAction, self).__init__()
self.dataCenterUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateGlobalConfigAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/global-configurations/{category}/{name}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateGlobalConfig'
PARAMS = {
'category': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'value': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateGlobalConfigAction, self).__init__()
self.category = None
self.name = None
self.value = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteInstanceOfferingAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/instance-offerings/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteInstanceOfferingAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryL2VxlanNetworkPoolAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/l2-networks/vxlan-pool'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryL2VxlanNetworkPoolAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachDataVolumeFromVmAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/volumes/{uuid}/vm-instances'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vmUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachDataVolumeFromVmAction, self).__init__()
self.uuid = None
self.vmUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteEcsVSwitchRemoteAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/vswitch/remote/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteEcsVSwitchRemoteAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVCenterAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vcenters/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVCenterAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class LogOutAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/accounts/sessions/{sessionUuid}'
NEED_SESSION = False
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'sessionUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation()
}
def __init__(self):
super(LogOutAction, self).__init__()
self.sessionUuid = None
self.systemTags = None
self.userTags = None
class QueryVCenterPrimaryStorageAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/vcenters/primary-storage'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVCenterPrimaryStorageAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QuerySharedResourceAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/accounts/resources'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QuerySharedResourceAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DestroyVmInstanceAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vm-instances/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DestroyVmInstanceAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateL3NetworkAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/l3-networks/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateL3Network'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'system': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateL3NetworkAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.system = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryClusterAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/clusters'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryClusterAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddVmNicToSecurityGroupAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/security-groups/{securityGroupUuid}/vm-instances/nics'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'securityGroupUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vmNicUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddVmNicToSecurityGroupAction, self).__init__()
self.securityGroupUuid = None
self.vmNicUuids = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVolumeAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/volumes'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVolumeAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class TriggerGCJobAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/gc-jobs/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'triggerGCJob'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(TriggerGCJobAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetNetworkServiceTypesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/network-services/types'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetNetworkServiceTypesAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateMonitorTriggerAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/monitoring/triggers/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateMonitorTrigger'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'expression': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'duration': ParamAnnotation(required=False,number_range=[1, 2147483647],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateMonitorTriggerAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.expression = None
self.duration = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryMediaAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/media'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryMediaAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteBackupFileInPublicAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/backup-mysql'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'type': ParamAnnotation(required=True,valid_values=['aliyun'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'regionId': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'file': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteBackupFileInPublicAction, self).__init__()
self.type = None
self.regionId = None
self.file = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVolumeSnapshotAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/volume-snapshots/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVolumeSnapshotAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeVipStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vips/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeVipState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeVipStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddKVMHostAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hosts/kvm'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'username': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshPort': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'managementIp': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'clusterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddKVMHostAction, self).__init__()
self.username = None
self.password = None
self.sshPort = None
self.name = None
self.description = None
self.managementIp = None
self.clusterUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetResourceNamesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/resources/names'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetResourceNamesAction, self).__init__()
self.uuids = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachL3NetworkFromVmAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vm-instances/nics/{vmNicUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'vmNicUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachL3NetworkFromVmAction, self).__init__()
self.vmNicUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateVipAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/vips'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'allocatorStrategy': ParamAnnotation(),
'requiredIp': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateVipAction, self).__init__()
self.name = None
self.description = None
self.l3NetworkUuid = None
self.allocatorStrategy = None
self.requiredIp = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetL3NetworkDhcpIpAddressAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/l3-networks/{l3NetworkUuid/dhcp-ip'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'l3NetworkUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetL3NetworkDhcpIpAddressAction, self).__init__()
self.l3NetworkUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddVRouterRouteEntryAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/vrouter-route-tables/{routeTableUuid}/route-entries'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=False,valid_values=['UserStatic','UserBlackHole'],max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'routeTableUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'destination': ParamAnnotation(required=True,max_length=64,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'target': ParamAnnotation(required=False,max_length=64,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'distance': ParamAnnotation(required=False,number_range=[1, 254],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddVRouterRouteEntryAction, self).__init__()
self.description = None
self.type = None
self.routeTableUuid = None
self.destination = None
self.target = None
self.distance = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateDataVolumeTemplateFromVolumeAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/images/data-volume-templates/from/volumes/{volumeUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'volumeUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'backupStorageUuids': ParamAnnotation(required=False,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateDataVolumeTemplateFromVolumeAction, self).__init__()
self.name = None
self.description = None
self.volumeUuid = None
self.backupStorageUuids = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetTaskProgressAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/task-progresses/{apiId}'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'apiId': ParamAnnotation(),
'all': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetTaskProgressAction, self).__init__()
self.apiId = None
self.all = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateEcsImageFromLocalImageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/image'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'imageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'backupStorageUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateEcsImageFromLocalImageAction, self).__init__()
self.imageUuid = None
self.dataCenterUuid = None
self.backupStorageUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddVCenterAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/vcenters'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'username': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'https': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'port': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'domainName': ParamAnnotation(required=True,max_length=256,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddVCenterAction, self).__init__()
self.username = None
self.password = None
self.zoneUuid = None
self.name = None
self.https = None
self.port = None
self.domainName = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachL3NetworkToVmAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/vm-instances/{vmInstanceUuid}/l3-networks/{l3NetworkUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'staticIp': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachL3NetworkToVmAction, self).__init__()
self.vmInstanceUuid = None
self.l3NetworkUuid = None
self.staticIp = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class LogInByLdapAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/ldap/login'
NEED_SESSION = False
NEED_POLL = False
PARAM_NAME = 'logInByLdap'
PARAMS = {
'uid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation()
}
def __init__(self):
super(LogInByLdapAction, self).__init__()
self.uid = None
self.password = None
self.systemTags = None
self.userTags = None
class DeleteEcsSecurityGroupInLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/security-group/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteEcsSecurityGroupInLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachMonitorTriggerActionFromTriggerAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/monitoring/triggers/{triggerUuid}/trigger-actions/{actionUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'triggerUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'actionUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachMonitorTriggerActionFromTriggerAction, self).__init__()
self.triggerUuid = None
self.actionUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachVRouterRouteTableFromVRouterAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/vrouter-route-tables/{routeTableUuid}/detach'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'routeTableUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'virtualRouterVmUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachVRouterRouteTableFromVRouterAction, self).__init__()
self.routeTableUuid = None
self.virtualRouterVmUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ReconnectHostAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hosts/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'reconnectHost'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ReconnectHostAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateL2NetworkAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/l2-networks/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateL2Network'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateL2NetworkAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVpcIkeConfigFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/vpn-connection/ike'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVpcIkeConfigFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeHostStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hosts/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeHostState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable','maintain'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeHostStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddImageStoreBackupStorageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/backup-storage/image-store'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'hostname': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'username': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshPort': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'url': ParamAnnotation(required=True,max_length=2048,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'importImages': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddImageStoreBackupStorageAction, self).__init__()
self.hostname = None
self.username = None
self.password = None
self.sshPort = None
self.url = None
self.name = None
self.description = None
self.type = None
self.importImages = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CloneVmInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{vmInstanceUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'cloneVmInstance'
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'strategy': ParamAnnotation(required=False,valid_values=['InstantStart','JustCreate'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'names': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CloneVmInstanceAction, self).__init__()
self.vmInstanceUuid = None
self.strategy = None
self.names = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class PauseVmInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'pauseVmInstance'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(PauseVmInstanceAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateWebhookAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/web-hooks'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'url': ParamAnnotation(required=True,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'opaque': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateWebhookAction, self).__init__()
self.name = None
self.description = None
self.url = None
self.type = None
self.opaque = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteL2NetworkAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/l2-networks/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteL2NetworkAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateDataVolumeFromVolumeSnapshotAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/volumes/data/from/volume-snapshots/{volumeSnapshotUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'volumeSnapshotUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'primaryStorageUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateDataVolumeFromVolumeSnapshotAction, self).__init__()
self.name = None
self.description = None
self.volumeSnapshotUuid = None
self.primaryStorageUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddLdapServerAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/ldap/servers'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=True,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'url': ParamAnnotation(required=True,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'base': ParamAnnotation(required=True,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'username': ParamAnnotation(required=True,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'encryption': ParamAnnotation(required=True,valid_values=['None','TLS'],max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddLdapServerAction, self).__init__()
self.name = None
self.description = None
self.url = None
self.base = None
self.username = None
self.password = None
self.encryption = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddDataCenterFromRemoteAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/data-center'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'regionId': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=True,valid_values=['aliyun'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddDataCenterFromRemoteAction, self).__init__()
self.regionId = None
self.type = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RecoverImageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/images/{imageUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'recoverImage'
PARAMS = {
'imageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'backupStorageUuids': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RecoverImageAction, self).__init__()
self.imageUuid = None
self.backupStorageUuids = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteBaremetalPxeServerAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/baremetal/pxeserver/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteBaremetalPxeServerAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmHostnameAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{uuid}/hostnames'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmHostnameAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetL2NetworkTypesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/l2-networks/types'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetL2NetworkTypesAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryManagementNodeAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/management-nodes'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryManagementNodeAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachPoliciesToUserAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/accounts/users/{userUuid}/policy-collection'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'userUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'policyUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachPoliciesToUserAction, self).__init__()
self.userUuid = None
self.policyUuids = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryNetworkServiceL3NetworkRefAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/l3-networks/network-services/refs'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryNetworkServiceL3NetworkRefAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryResourcePriceAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/billings/prices'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryResourcePriceAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class PowerResetBaremetalHostAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/baremetal/chassis/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'powerResetBaremetalHost'
PARAMS = {
'chassisUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(PowerResetBaremetalHostAction, self).__init__()
self.chassisUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteSecurityGroupRuleAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/security-groups/rules'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'ruleUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteSecurityGroupRuleAction, self).__init__()
self.ruleUuids = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetOssBackupBucketFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/backup-mysql/oss'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetOssBackupBucketFromRemoteAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class PrometheusQueryMetadataAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/prometheus/meta-data'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'matches': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(PrometheusQueryMetadataAction, self).__init__()
self.matches = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVmNicFromSecurityGroupAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/security-groups/{securityGroupUuid}/vm-instances/nics'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'securityGroupUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vmNicUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVmNicFromSecurityGroupAction, self).__init__()
self.securityGroupUuid = None
self.vmNicUuids = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryImageAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/images'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryImageAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateBackupStorageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/backup-storage/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateBackupStorage'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateBackupStorageAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateEipAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/eips'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vipUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vmNicUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateEipAction, self).__init__()
self.name = None
self.description = None
self.vipUuid = None
self.vmNicUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryApplianceVmAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/appliances'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryApplianceVmAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetCandidateZonesClustersHostsForCreatingVmAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/candidate-destinations'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'instanceOfferingUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'imageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'rootDiskOfferingUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dataDiskOfferingUuids': ParamAnnotation(required=False,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'zoneUuid': ParamAnnotation(),
'clusterUuid': ParamAnnotation(),
'defaultL3NetworkUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetCandidateZonesClustersHostsForCreatingVmAction, self).__init__()
self.instanceOfferingUuid = None
self.imageUuid = None
self.l3NetworkUuids = None
self.rootDiskOfferingUuid = None
self.dataDiskOfferingUuids = None
self.zoneUuid = None
self.clusterUuid = None
self.defaultL3NetworkUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetBackupStorageCapacityAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/backup-storage/capacities'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'zoneUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'backupStorageUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'all': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetBackupStorageCapacityAction, self).__init__()
self.zoneUuids = None
self.backupStorageUuids = None
self.all = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncVpcVpnGatewayFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/vpc-vpn/{dataCenterUuid}/sync'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncVpcVpnGatewayFromRemoteAction, self).__init__()
self.dataCenterUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachVRouterRouteTableToVRouterAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/vrouter-route-tables/{routeTableUuid}/attach'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'routeTableUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'virtualRouterVmUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachVRouterRouteTableToVRouterAction, self).__init__()
self.routeTableUuid = None
self.virtualRouterVmUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryQuotaAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/accounts/quotas'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryQuotaAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteRouterInterfaceRemoteAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/router-interface/remote/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vRouterType': ParamAnnotation(required=True,valid_values=['vrouter','vbr'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteRouterInterfaceRemoteAction, self).__init__()
self.uuid = None
self.vRouterType = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetInterdependentL3NetworksImagesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/images-l3networks/dependencies'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuids': ParamAnnotation(required=False,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'imageUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetInterdependentL3NetworksImagesAction, self).__init__()
self.zoneUuid = None
self.l3NetworkUuids = None
self.imageUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryCephPrimaryStoragePoolAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/primary-storage/ceph/pools'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryCephPrimaryStoragePoolAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddMonToCephPrimaryStorageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/primary-storage/ceph/{uuid}/mons'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'monUrls': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddMonToCephPrimaryStorageAction, self).__init__()
self.uuid = None
self.monUrls = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeEipStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/eips/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeEipState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeEipStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SetVmBootOrderAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'setVmBootOrder'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'bootOrder': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SetVmBootOrderAction, self).__init__()
self.uuid = None
self.bootOrder = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVirtualRouterVmAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/appliances/virtual-routers'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVirtualRouterVmAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RemoveMonFromCephBackupStorageAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/backup-storage/ceph/{uuid}/mons'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'monHostnames': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RemoveMonFromCephBackupStorageAction, self).__init__()
self.uuid = None
self.monHostnames = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteCephPrimaryStoragePoolAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/primary-storage/ceph/pools/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteCephPrimaryStoragePoolAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVRouterRouteTableAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/vrouter-route-tables'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVRouterRouteTableAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteBaremetalChassisAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/baremetal/chassis/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteBaremetalChassisAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateOssBackupBucketRemoteAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/backup-mysql/oss'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'regionId': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateOssBackupBucketRemoteAction, self).__init__()
self.regionId = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteBaremetalHostCfgAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/baremetal/hostcfg/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteBaremetalHostCfgAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncAliyunRouteEntryFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/route-entry/{vRouterUuid}/sync'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'vRouterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vRouterType': ParamAnnotation(required=True,valid_values=['vbr','vrouter'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncAliyunRouteEntryFromRemoteAction, self).__init__()
self.vRouterUuid = None
self.vRouterType = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateLoadBalancerAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/load-balancers'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vipUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateLoadBalancerAction, self).__init__()
self.name = None
self.description = None
self.vipUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryNetworkServiceProviderAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/network-services/providers'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryNetworkServiceProviderAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteEcsInstanceAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/ecs/{uuid}/remote'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteEcsInstanceAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetCandidateVmNicsForLoadBalancerAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/load-balancers/listeners/{listenerUuid}/vm-instances/candidate-nics'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'listenerUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetCandidateVmNicsForLoadBalancerAction, self).__init__()
self.listenerUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddSimulatorPrimaryStorageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/primary-storage/simulators'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'totalCapacity': ParamAnnotation(),
'availableCapacity': ParamAnnotation(),
'availablePhysicalCapacity': ParamAnnotation(),
'totalPhysicalCapacity': ParamAnnotation(),
'url': ParamAnnotation(required=True,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddSimulatorPrimaryStorageAction, self).__init__()
self.totalCapacity = None
self.availableCapacity = None
self.availablePhysicalCapacity = None
self.totalPhysicalCapacity = None
self.url = None
self.name = None
self.description = None
self.type = None
self.zoneUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class LocalStorageGetVolumeMigratableHostsAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/volumes/{volumeUuid}/migration-target-hosts'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'volumeUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(LocalStorageGetVolumeMigratableHostsAction, self).__init__()
self.volumeUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachPolicyToUserGroupAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/accounts/groups/{groupUuid}/policies'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'policyUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'groupUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachPolicyToUserGroupAction, self).__init__()
self.policyUuid = None
self.groupUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeVolumeStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/volumes/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeVolumeState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeVolumeStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteWebhookAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/web-hooks/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteWebhookAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryHybridEipFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/eip'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryHybridEipFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVCenterAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/vcenters'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVCenterAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateIPsecConnectionAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/ipsec/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateIPsecConnection'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateIPsecConnectionAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetResourceAccountAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/resources/accounts'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'resourceUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetResourceAccountAction, self).__init__()
self.resourceUuids = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ReloadLicenseAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/licenses/actions'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'reloadLicense'
PARAMS = {
'managementNodeUuids': ParamAnnotation(required=False,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ReloadLicenseAction, self).__init__()
self.managementNodeUuids = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class StartVmInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'startVmInstance'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'clusterUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'hostUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(StartVmInstanceAction, self).__init__()
self.uuid = None
self.clusterUuid = None
self.hostUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteAliyunKeySecretAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/key/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteAliyunKeySecretAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryLoadBalancerListenerAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/load-balancers/listeners'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryLoadBalancerListenerAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVirtualRouterVRouterRouteTableRefAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/vrouter-route-tables/virtual-router-refs'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVirtualRouterVRouterRouteTableRefAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachEipAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/eips/{uuid}/vm-instances/nics'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachEipAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryL2VlanNetworkAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/l2-networks/vlan'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryL2VlanNetworkAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVCenterBackupStorageAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/vcenters/backup-storage'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVCenterBackupStorageAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateDataVolumeFromVolumeTemplateAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/volumes/data/from/data-volume-templates/{imageUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'imageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'primaryStorageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'hostUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateDataVolumeFromVolumeTemplateAction, self).__init__()
self.imageUuid = None
self.name = None
self.description = None
self.primaryStorageUuid = None
self.hostUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RemoveVmNicFromLoadBalancerAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/load-balancers/listeners/{listenerUuid}/vm-instances/nics'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'vmNicUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'listenerUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RemoveVmNicFromLoadBalancerAction, self).__init__()
self.vmNicUuids = None
self.listenerUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateUserAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/accounts/users/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateUser'
PARAMS = {
'uuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateUserAction, self).__init__()
self.uuid = None
self.password = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateSystemTagAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/system-tags/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateSystemTag'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'tag': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateSystemTagAction, self).__init__()
self.uuid = None
self.tag = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ReconnectPrimaryStorageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/primary-storage/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'reconnectPrimaryStorage'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ReconnectPrimaryStorageAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetCandidateVmNicForSecurityGroupAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/security-groups/{securityGroupUuid}/vm-instances/candidate-nics'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'securityGroupUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetCandidateVmNicForSecurityGroupAction, self).__init__()
self.securityGroupUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryAliyunKeySecretAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/key'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryAliyunKeySecretAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddUserToGroupAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/accounts/groups/{groupUuid}/users'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'userUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'groupUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddUserToGroupAction, self).__init__()
self.userUuid = None
self.groupUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ShareResourceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/accounts/resources/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'shareResource'
PARAMS = {
'resourceUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'accountUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'toPublic': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ShareResourceAction, self).__init__()
self.resourceUuids = None
self.accountUuids = None
self.toPublic = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryBaremetalPxeServerAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/baremetal/pxeserver'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryBaremetalPxeServerAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteMediaAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/media/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteMediaAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachPoliciesFromUserAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/accounts/users/{userUuid}/policies'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'policyUuids': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'userUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachPoliciesFromUserAction, self).__init__()
self.policyUuids = None
self.userUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteAccountAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/accounts/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteAccountAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class BackupDatabaseToPublicCloudAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/backup-mysql'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'type': ParamAnnotation(required=True,valid_values=['aliyun'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'regionId': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'local': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(BackupDatabaseToPublicCloudAction, self).__init__()
self.type = None
self.regionId = None
self.local = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryOssBucketFileNameAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/oss-bucket'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryOssBucketFileNameAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVipQosAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vips/{uuid}/vip-qos'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'direction': ParamAnnotation(required=True,valid_values=['in','out','all'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVipQosAction, self).__init__()
self.uuid = None
self.direction = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetHostAllocatorStrategiesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hosts/allocators/strategies'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetHostAllocatorStrategiesAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteExportedImageFromBackupStorageAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/backup-storage/{backupStorageUuid}/exported-images/{imageUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'backupStorageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'imageUuid': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteExportedImageFromBackupStorageAction, self).__init__()
self.backupStorageUuid = None
self.imageUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class MigrateVmAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{vmInstanceUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'migrateVm'
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'hostUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(MigrateVmAction, self).__init__()
self.vmInstanceUuid = None
self.hostUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVmHostnameAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vm-instances/{uuid}/hostnames'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVmHostnameAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetAccountQuotaUsageAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/accounts/quota/{uuid}/usages'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetAccountQuotaUsageAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryPortForwardingRuleAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/port-forwarding'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryPortForwardingRuleAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CheckIpAvailabilityAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/l3-networks/{l3NetworkUuid}/ip/{ip}/availability'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ip': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CheckIpAvailabilityAction, self).__init__()
self.l3NetworkUuid = None
self.ip = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetOssBucketNameFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/oss/remote'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetOssBucketNameFromRemoteAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateVpnIkeConfigAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/vpn-connection/ike'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=64,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'psk': ParamAnnotation(required=True,max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'pfs': ParamAnnotation(required=False,valid_values=['disabled','group1','group2','group5','group14','group24'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'version': ParamAnnotation(required=False,valid_values=['ikev1','ikev2'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'mode': ParamAnnotation(required=False,valid_values=['main','aggressive'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'encAlg': ParamAnnotation(required=False,valid_values=['3des','aes-128','aes-192','aes-256','des'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'authAlg': ParamAnnotation(required=False,valid_values=['md5','sha1'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'lifetime': ParamAnnotation(required=False,number_range=[60, 86400],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'localIp': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'remoteIp': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateVpnIkeConfigAction, self).__init__()
self.name = None
self.psk = None
self.pfs = None
self.version = None
self.mode = None
self.encAlg = None
self.authAlg = None
self.lifetime = None
self.localIp = None
self.remoteIp = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteEcsImageRemoteAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/image/remote/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteEcsImageRemoteAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateSchedulerTriggerAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/scheduler/triggers'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'schedulerInterval': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'repeatCount': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'startTime': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'schedulerType': ParamAnnotation(required=True,valid_values=['simple','cron'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'cron': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateSchedulerTriggerAction, self).__init__()
self.name = None
self.description = None
self.schedulerInterval = None
self.repeatCount = None
self.startTime = None
self.schedulerType = None
self.cron = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetCandidateBackupStorageForCreatingImageAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = 'null'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'volumeUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'volumeSnapshotUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetCandidateBackupStorageForCreatingImageAction, self).__init__()
self.volumeUuid = None
self.volumeSnapshotUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateResourcePriceAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/billings/prices'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'resourceName': ParamAnnotation(required=True,valid_values=['cpu','memory','rootVolume','dataVolume','snapShot'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUnit': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'timeUnit': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'price': ParamAnnotation(required=True,number_range=[0, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'accountUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dateInLong': ParamAnnotation(required=False,number_range=[0, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateResourcePriceAction, self).__init__()
self.resourceName = None
self.resourceUnit = None
self.timeUnit = None
self.price = None
self.accountUuid = None
self.dateInLong = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVirtualBorderRouterLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/border-router/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVirtualBorderRouterLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncAliyunVirtualRouterFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/vrouter/{vpcUuid}/sync'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'vpcUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncAliyunVirtualRouterFromRemoteAction, self).__init__()
self.vpcUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangePortForwardingRuleStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/port-forwarding/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changePortForwardingRuleState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangePortForwardingRuleStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateRouteInterfaceRemoteAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hybrid/aliyun/router-interface/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateRouteInterfaceRemote'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'op': ParamAnnotation(required=True,valid_values=['active','inactive'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vRouterType': ParamAnnotation(required=True,valid_values=['vbr','vrouter'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateRouteInterfaceRemoteAction, self).__init__()
self.uuid = None
self.op = None
self.vRouterType = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeResourceOwnerAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/account/{accountUuid}/resources'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'accountUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeResourceOwnerAction, self).__init__()
self.accountUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateEcsInstanceFromLocalImageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/ecs'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'ecsRootVolumeType': ParamAnnotation(required=False,valid_values=['cloud','cloud_efficiency','cloud_ssd','ephemeral_ssd'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=256,min_length=2,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ecsRootVolumeGBSize': ParamAnnotation(required=False,number_range=[40, 500],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'createMode': ParamAnnotation(required=False,valid_values=['atomic','permissive'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'privateIpAddress': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ecsInstanceName': ParamAnnotation(required=False,max_length=128,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'allocatePublicIp': ParamAnnotation(required=False,valid_values=['true','false'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ecsConsolePassword': ParamAnnotation(required=False,valid_regex_values=r'[a-zA-Z0-9]{6}',max_length=6,min_length=6,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'backupStorageUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'imageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'instanceOfferingUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ecsVSwitchUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ecsSecurityGroupUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ecsRootPassword': ParamAnnotation(required=True,valid_regex_values=r'^[a-zA-Z][\w\W]{7,17}$',max_length=30,min_length=8,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ecsBandWidth': ParamAnnotation(required=True,number_range=[0, 200],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateEcsInstanceFromLocalImageAction, self).__init__()
self.ecsRootVolumeType = None
self.description = None
self.ecsRootVolumeGBSize = None
self.createMode = None
self.privateIpAddress = None
self.ecsInstanceName = None
self.allocatePublicIp = None
self.ecsConsolePassword = None
self.backupStorageUuid = None
self.imageUuid = None
self.instanceOfferingUuid = None
self.ecsVSwitchUuid = None
self.ecsSecurityGroupUuid = None
self.ecsRootPassword = None
self.ecsBandWidth = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetCandidateIsoForAttachingVmAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{vmInstanceUuid}/iso-candidates'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetCandidateIsoForAttachingVmAction, self).__init__()
self.vmInstanceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryPrimaryStorageAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/primary-storage'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryPrimaryStorageAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ExpungeImageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/images/{imageUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'expungeImage'
PARAMS = {
'imageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'backupStorageUuids': ParamAnnotation(required=False,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ExpungeImageAction, self).__init__()
self.imageUuid = None
self.backupStorageUuids = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddCephPrimaryStoragePoolAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/primary-storage/ceph/{primaryStorageUuid}/pools'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'primaryStorageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'poolName': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'errorIfNotExist': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddCephPrimaryStoragePoolAction, self).__init__()
self.primaryStorageUuid = None
self.poolName = None
self.description = None
self.errorIfNotExist = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVirtualRouterOfferingAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/instance-offerings/virtual-routers'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVirtualRouterOfferingAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddIpRangeByNetworkCidrAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/l3-networks/{l3NetworkUuid}/ip-ranges/by-cidr'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'networkCidr': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddIpRangeByNetworkCidrAction, self).__init__()
self.name = None
self.description = None
self.l3NetworkUuid = None
self.networkCidr = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateCephBackupStorageMonAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/backup-storage/ceph/mons/{monUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateCephBackupStorageMon'
PARAMS = {
'monUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'hostname': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshUsername': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshPassword': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshPort': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'monPort': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateCephBackupStorageMonAction, self).__init__()
self.monUuid = None
self.hostname = None
self.sshUsername = None
self.sshPassword = None
self.sshPort = None
self.monPort = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVolumeSnapshotAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/volume-snapshots'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVolumeSnapshotAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateVpcVpnConnectionRemoteAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/vpn-connection'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'userGatewayUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vpnGatewayUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=64,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'localCidr': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'remoteCidr': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'active': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ikeConfUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ipsecConfUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateVpcVpnConnectionRemoteAction, self).__init__()
self.userGatewayUuid = None
self.vpnGatewayUuid = None
self.name = None
self.localCidr = None
self.remoteCidr = None
self.active = None
self.ikeConfUuid = None
self.ipsecConfUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncEcsImageFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/image/{dataCenterUuid}/sync'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncEcsImageFromRemoteAction, self).__init__()
self.dataCenterUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteHostAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hosts/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteHostAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddNfsPrimaryStorageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/primary-storage/nfs'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'url': ParamAnnotation(required=True,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddNfsPrimaryStorageAction, self).__init__()
self.url = None
self.name = None
self.description = None
self.type = None
self.zoneUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RecoverVmInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'recoverVmInstance'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RecoverVmInstanceAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVRouterRouteTableAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vrouter-route-tables/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVRouterRouteTableAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeImageStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/images/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeImageState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeImageStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVRouterRouteTableAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vrouter-route-tables/vrouter/{virtualRouterVmUuid}'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'virtualRouterVmUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVRouterRouteTableAction, self).__init__()
self.virtualRouterVmUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeMediaStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/media/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeMediaState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeMediaStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryAlertAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/monitoring/alerts'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryAlertAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetPrimaryStorageTypesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/primary-storage/types'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetPrimaryStorageTypesAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateSchedulerTriggerAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/scheduler/triggers/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateSchedulerTrigger'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateSchedulerTriggerAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteSchedulerJobAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/scheduler/jobs/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteSchedulerJobAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVpcVpnGatewayLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/vpn-gateway/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVpcVpnGatewayLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryRouterInterfaceFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/router-interface'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryRouterInterfaceFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryCephPrimaryStorageAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/primary-storage/ceph'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryCephPrimaryStorageAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class PowerOnBaremetalHostAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/baremetal/chassis/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'powerOnBaremetalHost'
PARAMS = {
'chassisUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(PowerOnBaremetalHostAction, self).__init__()
self.chassisUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateUserAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/accounts/users'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateUserAction, self).__init__()
self.name = None
self.password = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateVirtualRouterOfferingAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/instance-offerings/virtual-routers/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateVirtualRouterOffering'
PARAMS = {
'isDefault': ParamAnnotation(),
'imageUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateVirtualRouterOfferingAction, self).__init__()
self.isDefault = None
self.imageUuid = None
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetEipAttachableVmNicsAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/eips/{eipUuid}/vm-instances/candidate-nics'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'eipUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vipUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetEipAttachableVmNicsAction, self).__init__()
self.eipUuid = None
self.vipUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RemoveSchedulerJobFromSchedulerTriggerAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/scheduler/jobs/{schedulerJobUuid}/scheduler/triggers/{schedulerTriggerUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'schedulerJobUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'schedulerTriggerUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RemoveSchedulerJobFromSchedulerTriggerAction, self).__init__()
self.schedulerJobUuid = None
self.schedulerTriggerUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVtepAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/l2-networks/vteps'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVtepAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryEipAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/eips'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryEipAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteEcsImageLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/image/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteEcsImageLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteLoadBalancerAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/load-balancers/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteLoadBalancerAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateUserTagAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/user-tags'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'resourceType': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'tag': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateUserTagAction, self).__init__()
self.resourceType = None
self.resourceUuid = None
self.tag = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryZoneAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/zones'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryZoneAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateSchedulerJobAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/scheduler/jobs'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'targetResourceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'parameters': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateSchedulerJobAction, self).__init__()
self.name = None
self.description = None
self.targetResourceUuid = None
self.type = None
self.parameters = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RemoveDnsFromL3NetworkAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/l3-networks/{l3NetworkUuid}/dns/{dns}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dns': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RemoveDnsFromL3NetworkAction, self).__init__()
self.l3NetworkUuid = None
self.dns = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVipAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vips/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVipAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryMonitorTriggerActionAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/monitoring/trigger-actions'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryMonitorTriggerActionAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVipAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/vips'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVipAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteDataCenterInLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/data-center/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteDataCenterInLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVmNicInSecurityGroupAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/security-groups/vm-instances/nics'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVmNicInSecurityGroupAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeInstanceOfferingStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/instance-offerings/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeInstanceOfferingState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeInstanceOfferingStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ResumeVmInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'resumeVmInstance'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ResumeVmInstanceAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateEipAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/eips/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateEip'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateEipAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class TerminateVirtualBorderRouterRemoteAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hybrid/aliyun/border-router/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'terminateVirtualBorderRouterRemote'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(TerminateVirtualBorderRouterRemoteAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteEcsSecurityGroupRuleRemoteAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/security-group-rule/remote/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteEcsSecurityGroupRuleRemoteAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVolumeFormatAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/volumes/formats'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVolumeFormatAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmConsolePasswordAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{uuid}/console-passwords'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmConsolePasswordAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class IsReadyToGoAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/management-nodes/ready'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'managementNodeId': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(IsReadyToGoAction, self).__init__()
self.managementNodeId = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteMonitorTriggerAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/monitoring/triggers/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteMonitorTriggerAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateLoadBalancerAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/load-balancers/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateLoadBalancer'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateLoadBalancerAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetEcsInstanceVncUrlAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/ecs-vnc/{uuid}'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetEcsInstanceVncUrlAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVersionAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/management-nodes/actions'
NEED_SESSION = False
NEED_POLL = False
PARAM_NAME = 'getVersion'
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation()
}
def __init__(self):
super(GetVersionAction, self).__init__()
self.systemTags = None
self.userTags = None
class GetVolumeQosAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/volumes/{uuid}/qos'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVolumeQosAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachOssBucketToEcsDataCenterAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/{dataCenterUuid}/oss-bucket/{ossBucketUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'ossBucketUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachOssBucketToEcsDataCenterAction, self).__init__()
self.ossBucketUuid = None
self.dataCenterUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateVolumeAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/volumes/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateVolume'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateVolumeAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QuerySecurityGroupRuleAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/security-groups/rules'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QuerySecurityGroupRuleAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetLocalStorageHostDiskCapacityAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/primary-storage/local-storage/{primaryStorageUuid}/capacities'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'hostUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'primaryStorageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetLocalStorageHostDiskCapacityAction, self).__init__()
self.hostUuid = None
self.primaryStorageUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryLdapBindingAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/ldap/bindings'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryLdapBindingAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeletePrimaryStorageAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/primary-storage/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeletePrimaryStorageAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeZoneStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/zones/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeZoneState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeZoneStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateQuotaAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/accounts/quotas/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateQuota'
PARAMS = {
'identityUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'value': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateQuotaAction, self).__init__()
self.identityUuid = None
self.name = None
self.value = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateDataVolumeAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/volumes/data'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'diskOfferingUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'primaryStorageUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateDataVolumeAction, self).__init__()
self.name = None
self.description = None
self.diskOfferingUuid = None
self.primaryStorageUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVolumeQosAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/volumes/{uuid}/qos'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVolumeQosAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetDataVolumeAttachableVmAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/volumes/{volumeUuid}/candidate-vm-instances'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'volumeUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetDataVolumeAttachableVmAction, self).__init__()
self.volumeUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class StartBaremetalPxeServerAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/baremetal/pxeserver/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'startBaremetalPxeServer'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(StartBaremetalPxeServerAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateSecurityGroupAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/security-groups/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateSecurityGroup'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateSecurityGroupAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVmConsolePasswordAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vm-instances/{uuid}/console-password'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVmConsolePasswordAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateImageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/images/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateImage'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'guestOsType': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'mediaType': ParamAnnotation(required=False,valid_values=['RootVolumeTemplate','DataVolumeTemplate','ISO'],max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'format': ParamAnnotation(required=False,valid_values=['raw','qcow2','iso'],max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'system': ParamAnnotation(),
'platform': ParamAnnotation(required=False,valid_values=['Linux','Windows','Other','Paravirtualization','WindowsVirtio'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateImageAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.guestOsType = None
self.mediaType = None
self.format = None
self.system = None
self.platform = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVirtualRouterLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/vrouter/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVirtualRouterLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachPortForwardingRuleAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/port-forwarding/{ruleUuid}/vm-instances/nics/{vmNicUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'ruleUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vmNicUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachPortForwardingRuleAction, self).__init__()
self.ruleUuid = None
self.vmNicUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryBackupStorageAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/backup-storage'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryBackupStorageAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeletePortForwardingRuleAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/port-forwarding/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeletePortForwardingRuleAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddCephPrimaryStorageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/primary-storage/ceph'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'monUrls': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'rootVolumePoolName': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dataVolumePoolName': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'imageCachePoolName': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'url': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddCephPrimaryStorageAction, self).__init__()
self.monUrls = None
self.rootVolumePoolName = None
self.dataVolumePoolName = None
self.imageCachePoolName = None
self.url = None
self.name = None
self.description = None
self.type = None
self.zoneUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ReconnectVirtualRouterAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/appliances/virtual-routers/{vmInstanceUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'reconnectVirtualRouter'
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ReconnectVirtualRouterAction, self).__init__()
self.vmInstanceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryCephBackupStorageAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/backup-storage/ceph'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryCephBackupStorageAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryEcsSecurityGroupRuleFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/security-group-rule'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryEcsSecurityGroupRuleFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryIdentityZoneFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/identity-zone'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryIdentityZoneFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetMonitorItemAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/monitoring/items'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'resourceType': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetMonitorItemAction, self).__init__()
self.resourceType = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RemoveMonFromCephPrimaryStorageAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/primary-storage/ceph/{uuid}/mons'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'monHostnames': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RemoveMonFromCephPrimaryStorageAction, self).__init__()
self.uuid = None
self.monHostnames = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryL3NetworkAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/l3-networks'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryL3NetworkAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachPortForwardingRuleAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/port-forwarding/{uuid}/vm-instances/nics'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachPortForwardingRuleAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ExpungeDataVolumeAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/volumes/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'expungeDataVolume'
PARAMS = {
'uuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ExpungeDataVolumeAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SetVmStaticIpAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{vmInstanceUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'setVmStaticIp'
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ip': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SetVmStaticIpAction, self).__init__()
self.vmInstanceUuid = None
self.l3NetworkUuid = None
self.ip = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreatePortForwardingRuleAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/port-forwarding'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'vipUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vipPortStart': ParamAnnotation(required=True,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vipPortEnd': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'privatePortStart': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'privatePortEnd': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'protocolType': ParamAnnotation(required=True,valid_values=['TCP','UDP'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vmNicUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'allowedCidr': ParamAnnotation(),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreatePortForwardingRuleAction, self).__init__()
self.vipUuid = None
self.vipPortStart = None
self.vipPortEnd = None
self.privatePortStart = None
self.privatePortEnd = None
self.protocolType = None
self.vmNicUuid = None
self.allowedCidr = None
self.name = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RevertVolumeFromSnapshotAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/volume-snapshots/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'revertVolumeFromSnapshot'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RevertVolumeFromSnapshotAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteSchedulerTriggerAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/scheduler/triggers/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteSchedulerTriggerAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetPortForwardingAttachableVmNicsAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/port-forwarding/{ruleUuid}/vm-instances/candidate-nics'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'ruleUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetPortForwardingAttachableVmNicsAction, self).__init__()
self.ruleUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryBaremetalHardwareInfoAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/baremetal/hardwareinfo'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryBaremetalHardwareInfoAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachAliyunKeyAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hybrid/aliyun/key/{uuid}/detach'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'detachAliyunKey'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachAliyunKeyAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachEipAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/eips/{eipUuid}/vm-instances/nics/{vmNicUuid'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'eipUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vmNicUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachEipAction, self).__init__()
self.eipUuid = None
self.vmNicUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QuerySchedulerJobAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/scheduler/jobs'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QuerySchedulerJobAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachPolicyFromUserAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/accounts/users/{userUuid}/policies/{policyUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'policyUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'userUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachPolicyFromUserAction, self).__init__()
self.policyUuid = None
self.userUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVpcUserVpnGatewayFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/user-vpn'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVpcUserVpnGatewayFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ProvisionBaremetalHostAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/baremetal/chassis/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'provisionBaremetalHost'
PARAMS = {
'chassisUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ProvisionBaremetalHostAction, self).__init__()
self.chassisUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateBaremetalHostCfgAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/baremetal/hostcfg'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'chassisUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'vnc': ParamAnnotation(required=False,valid_values=['true','false'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'unattended': ParamAnnotation(required=False,valid_values=['true','false'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'cfgItems': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateBaremetalHostCfgAction, self).__init__()
self.chassisUuid = None
self.password = None
self.vnc = None
self.unattended = None
self.cfgItems = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryUserGroupAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/accounts/groups'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryUserGroupAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetCurrentTimeAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/management-nodes/actions'
NEED_SESSION = False
NEED_POLL = False
PARAM_NAME = 'getCurrentTime'
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation()
}
def __init__(self):
super(GetCurrentTimeAction, self).__init__()
self.systemTags = None
self.userTags = None
class CreateAccountAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/accounts'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=False,valid_values=['SystemAdmin','Normal'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateAccountAction, self).__init__()
self.name = None
self.password = None
self.type = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncEcsVpcFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/vpc/{dataCenterUuid}/sync'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ecsVpcId': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncEcsVpcFromRemoteAction, self).__init__()
self.dataCenterUuid = None
self.ecsVpcId = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class PowerOffBaremetalHostAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/baremetal/chassis/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'powerOffBaremetalHost'
PARAMS = {
'chassisUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(PowerOffBaremetalHostAction, self).__init__()
self.chassisUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVpcIkeConfigLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/vpn-connection/ike/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVpcIkeConfigLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachOssBucketToEcsDataCenterAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/{dataCenterUuid}/oss-bucket/{ossBucketUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'ossBucketUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachOssBucketToEcsDataCenterAction, self).__init__()
self.ossBucketUuid = None
self.dataCenterUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ReclaimSpaceFromImageStoreAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/backup-storage/image-store/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'reclaimSpaceFromImageStore'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ReclaimSpaceFromImageStoreAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateClusterAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/clusters'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'hypervisorType': ParamAnnotation(required=True,valid_values=['KVM','Simulator'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=False,valid_values=['zstack'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateClusterAction, self).__init__()
self.zoneUuid = None
self.name = None
self.description = None
self.hypervisorType = None
self.type = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmBootOrderAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{uuid}/boot-orders'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmBootOrderAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RecoveryVirtualBorderRouterRemoteAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hybrid/aliyun/border-router/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'recoveryVirtualBorderRouterRemote'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RecoveryVirtualBorderRouterRemoteAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryPolicyAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/accounts/policies'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryPolicyAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachNetworkServiceFromL3NetworkAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/l3-networks/{l3NetworkUuid}/network-services'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'networkServices': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachNetworkServiceFromL3NetworkAction, self).__init__()
self.l3NetworkUuid = None
self.networkServices = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteOssBucketRemoteAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/oss-bucket/remote/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteOssBucketRemoteAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateEcsSecurityGroupRemoteAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/security-group/remote'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'vpcUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=256,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=64,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'strategy': ParamAnnotation(required=False,valid_values=['security','all'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateEcsSecurityGroupRemoteAction, self).__init__()
self.vpcUuid = None
self.description = None
self.name = None
self.strategy = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RebootVmInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'rebootVmInstance'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RebootVmInstanceAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SetVolumeQosAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/volumes/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'setVolumeQos'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'volumeBandwidth': ParamAnnotation(required=True,number_range=[1024, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SetVolumeQosAction, self).__init__()
self.uuid = None
self.volumeBandwidth = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateCephPrimaryStorageMonAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/primary-storage/ceph/mons/{monUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateCephPrimaryStorageMon'
PARAMS = {
'monUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'hostname': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshUsername': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshPassword': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshPort': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'monPort': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateCephPrimaryStorageMonAction, self).__init__()
self.monUuid = None
self.hostname = None
self.sshUsername = None
self.sshPassword = None
self.sshPort = None
self.monPort = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateL2VxlanNetworkAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/l2-networks/vxlan'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'vni': ParamAnnotation(required=False,number_range=[1, 16777214],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'poolUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'zoneUuid': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'physicalInterface': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateL2VxlanNetworkAction, self).__init__()
self.vni = None
self.poolUuid = None
self.name = None
self.description = None
self.zoneUuid = None
self.physicalInterface = None
self.type = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryL2NetworkAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/l2-networks'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryL2NetworkAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVipQosAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vip/{uuid}/vip-qos'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVipQosAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddImageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/images'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'url': ParamAnnotation(required=True,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'mediaType': ParamAnnotation(required=False,valid_values=['RootVolumeTemplate','ISO','DataVolumeTemplate'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'guestOsType': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'system': ParamAnnotation(),
'format': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'platform': ParamAnnotation(required=False,valid_values=['Linux','Windows','Other','Paravirtualization','WindowsVirtio'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'backupStorageUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddImageAction, self).__init__()
self.name = None
self.description = None
self.url = None
self.mediaType = None
self.guestOsType = None
self.system = None
self.format = None
self.platform = None
self.backupStorageUuids = None
self.type = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteAlertAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/monitoring/alerts'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteAlertAction, self).__init__()
self.uuids = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddZsesPrimaryStorageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/primary-storage/zses'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'url': ParamAnnotation(required=True,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddZsesPrimaryStorageAction, self).__init__()
self.url = None
self.name = None
self.description = None
self.type = None
self.zoneUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateInstanceOfferingAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/instance-offerings'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'cpuNum': ParamAnnotation(required=True,number_range=[1, 1024],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'memorySize': ParamAnnotation(required=True,number_range=[1, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'allocatorStrategy': ParamAnnotation(),
'sortKey': ParamAnnotation(),
'type': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateInstanceOfferingAction, self).__init__()
self.name = None
self.description = None
self.cpuNum = None
self.memorySize = None
self.allocatorStrategy = None
self.sortKey = None
self.type = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteEcsInstanceLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/ecs/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteEcsInstanceLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteUserGroupAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/accounts/groups/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteUserGroupAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CalculateAccountSpendingAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/billings/accounts/{accountUuid}/actions'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'calculateAccountSpending'
PARAMS = {
'accountUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dateStart': ParamAnnotation(required=False,number_range=[0, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dateEnd': ParamAnnotation(required=False,number_range=[0, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CalculateAccountSpendingAction, self).__init__()
self.accountUuid = None
self.dateStart = None
self.dateEnd = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVpcVpnConnectionLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/vpn-connection/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVpcVpnConnectionLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetImageQgaAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/images/{uuid}/qga'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetImageQgaAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DownloadBackupFileFromPublicCloudAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/backup-mysql/download'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'regionId': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'file': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=True,valid_values=['aliyun'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DownloadBackupFileFromPublicCloudAction, self).__init__()
self.regionId = None
self.file = None
self.type = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdatePortForwardingRuleAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/port-forwarding/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updatePortForwardingRule'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdatePortForwardingRuleAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachDataVolumeToVmAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/volumes/{volumeUuid}/vm-instances/{vmInstanceUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'volumeUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachDataVolumeToVmAction, self).__init__()
self.vmInstanceUuid = None
self.volumeUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateAccountAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/accounts/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateAccount'
PARAMS = {
'uuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateAccountAction, self).__init__()
self.uuid = None
self.password = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateClusterAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/clusters/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateCluster'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateClusterAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class StopEcsInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hybrid/aliyun/ecs/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'stopEcsInstance'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(StopEcsInstanceAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryAliyunVirtualRouterFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/vrouter'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryAliyunVirtualRouterFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryImageStoreBackupStorageAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/backup-storage/image-store'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryImageStoreBackupStorageAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddSecurityGroupRuleAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/security-groups/{securityGroupUuid}/rules'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'securityGroupUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'rules': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddSecurityGroupRuleAction, self).__init__()
self.securityGroupUuid = None
self.rules = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateHostAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hosts/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateHost'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'managementIp': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateHostAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.managementIp = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateBaremetalHostCfgAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/baremetal/hostcfg/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateBaremetalHostCfg'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'vnc': ParamAnnotation(required=False,valid_values=['true','false'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'unattended': ParamAnnotation(required=False,valid_values=['true','false'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateBaremetalHostCfgAction, self).__init__()
self.uuid = None
self.password = None
self.vnc = None
self.unattended = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SetVmQgaAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'setVmQga'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'enable': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SetVmQgaAction, self).__init__()
self.uuid = None
self.enable = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncPrimaryStorageCapacityAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/primary-storage/{primaryStorageUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'syncPrimaryStorageCapacity'
PARAMS = {
'primaryStorageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncPrimaryStorageCapacityAction, self).__init__()
self.primaryStorageUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeClusterStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/clusters/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeClusterState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeClusterStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateKVMHostAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hosts/kvm/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateKVMHost'
PARAMS = {
'username': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshPort': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'managementIp': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateKVMHostAction, self).__init__()
self.username = None
self.password = None
self.sshPort = None
self.uuid = None
self.name = None
self.description = None
self.managementIp = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SetVmSshKeyAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'setVmSshKey'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'SshKey': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SetVmSshKeyAction, self).__init__()
self.uuid = None
self.SshKey = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateLoadBalancerListenerAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/load-balancers/{loadBalancerUuid}/listeners'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'loadBalancerUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'instancePort': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'loadBalancerPort': ParamAnnotation(required=True,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'protocol': ParamAnnotation(required=False,valid_values=['tcp','http'],max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateLoadBalancerListenerAction, self).__init__()
self.loadBalancerUuid = None
self.name = None
self.description = None
self.instancePort = None
self.loadBalancerPort = None
self.protocol = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetPrimaryStorageAllocatorStrategiesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/primary-storage/allocators/strategies'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetPrimaryStorageAllocatorStrategiesAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryBaremetalHostCfgAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/baremetal/hostcfg'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryBaremetalHostCfgAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdatePrimaryStorageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/primary-storage/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updatePrimaryStorage'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'url': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdatePrimaryStorageAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.url = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QuerySftpBackupStorageAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/backup-storage/sftp'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QuerySftpBackupStorageAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateVniRangeAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/l2-networks/vxlan-pool/{l2NetworkUuid}/vni-ranges'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'startVni': ParamAnnotation(required=True,number_range=[0, 16777214],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'endVni': ParamAnnotation(required=True,number_range=[0, 16777214],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l2NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateVniRangeAction, self).__init__()
self.name = None
self.description = None
self.startVni = None
self.endVni = None
self.l2NetworkUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryBaremetalChassisAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/baremetal/chassis'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryBaremetalChassisAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SetL3NetworkMtuAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/l3-networks/{l3NetworkUuid}/mtu'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'mtu': ParamAnnotation(required=True,number_range=[68, 9216],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SetL3NetworkMtuAction, self).__init__()
self.l3NetworkUuid = None
self.mtu = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateVolumeSnapshotAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/volumes/{volumeUuid}/volume-snapshots'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'volumeUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateVolumeSnapshotAction, self).__init__()
self.volumeUuid = None
self.name = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncVpcUserVpnGatewayFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/user-vpn/{dataCenterUuid}/sync'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncVpcUserVpnGatewayFromRemoteAction, self).__init__()
self.dataCenterUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmAttachableDataVolumeAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{vmInstanceUuid}/data-volume-candidates'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmAttachableDataVolumeAction, self).__init__()
self.vmInstanceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetLicenseCapabilitiesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/licenses/capabilities'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetLicenseCapabilitiesAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryWebhookAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/web-hooks'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryWebhookAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeDiskOfferingStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/disk-offerings/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeDiskOfferingState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeDiskOfferingStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ExpungeVmInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'expungeVmInstance'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ExpungeVmInstanceAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetFreeIpAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = 'null'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'l3NetworkUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ipRangeUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'start': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetFreeIpAction, self).__init__()
self.l3NetworkUuid = None
self.ipRangeUuid = None
self.start = None
self.limit = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmSshKeyAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{uuid}/ssh-keys'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmSshKeyAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateVmInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateVmInstance'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'state': ParamAnnotation(required=False,valid_values=['Stopped','Running'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'defaultL3NetworkUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'platform': ParamAnnotation(required=False,valid_values=['Linux','Windows','Other','Paravirtualization','WindowsVirtio'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'cpuNum': ParamAnnotation(required=False,number_range=[1, 1024],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'memorySize': ParamAnnotation(required=False,number_range=[1, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateVmInstanceAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.state = None
self.defaultL3NetworkUuid = None
self.platform = None
self.cpuNum = None
self.memorySize = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryUserAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/accounts/users'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryUserAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RevokeResourceSharingAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/accounts/resources/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'revokeResourceSharing'
PARAMS = {
'resourceUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'toPublic': ParamAnnotation(),
'accountUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'all': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RevokeResourceSharingAction, self).__init__()
self.resourceUuids = None
self.toPublic = None
self.accountUuids = None
self.all = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteAllEcsInstancesFromDataCenterAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/dc-ecs/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteAllEcsInstancesFromDataCenterAction, self).__init__()
self.dataCenterUuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetDataCenterFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/data-center/remote'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'type': ParamAnnotation(required=True,valid_values=['aliyun'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetDataCenterFromRemoteAction, self).__init__()
self.type = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncImageSizeAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/images/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'syncImageSize'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncImageSizeAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddSchedulerJobToSchedulerTriggerAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/scheduler/jobs/{schedulerJobUuid}/scheduler/triggers/{schedulerTriggerUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'schedulerJobUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'schedulerTriggerUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddSchedulerJobToSchedulerTriggerAction, self).__init__()
self.schedulerJobUuid = None
self.schedulerTriggerUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteEipAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/eips/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteEipAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateL2NoVlanNetworkAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/l2-networks/no-vlan'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'physicalInterface': ParamAnnotation(required=True,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateL2NoVlanNetworkAction, self).__init__()
self.name = None
self.description = None
self.zoneUuid = None
self.physicalInterface = None
self.type = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddIpRangeAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/l3-networks/{l3NetworkUuid}/ip-ranges'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'startIp': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'endIp': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'netmask': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'gateway': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddIpRangeAction, self).__init__()
self.l3NetworkUuid = None
self.name = None
self.description = None
self.startIp = None
self.endIp = None
self.netmask = None
self.gateway = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVpcVpnConfigurationFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/vpn-conf/{uuid}/remote'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVpcVpnConfigurationFromRemoteAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateEcsVSwitchRemoteAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/vswitch'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'vpcUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'identityZoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'cidrBlock': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=128,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateEcsVSwitchRemoteAction, self).__init__()
self.vpcUuid = None
self.identityZoneUuid = None
self.cidrBlock = None
self.name = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateLdapServerAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/ldap/servers/{ldapServerUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateLdapServer'
PARAMS = {
'ldapServerUuid': ParamAnnotation(required=True,max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'url': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'base': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'username': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'encryption': ParamAnnotation(required=False,valid_values=['None','TLS'],max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateLdapServerAction, self).__init__()
self.ldapServerUuid = None
self.name = None
self.description = None
self.url = None
self.base = None
self.username = None
self.password = None
self.encryption = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVCenterDatacenterAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/vcenters/datacenters'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVCenterDatacenterAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryEcsImageFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/image'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryEcsImageFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateImageStoreBackupStorageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/backup-storage/image-store/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateImageStoreBackupStorage'
PARAMS = {
'username': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'hostname': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshPort': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateImageStoreBackupStorageAction, self).__init__()
self.username = None
self.password = None
self.hostname = None
self.sshPort = None
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateVolumeSnapshotAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/volume-snapshots/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateVolumeSnapshot'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateVolumeSnapshotAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetCpuMemoryCapacityAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hosts/capacities/cpu-memory'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'zoneUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'clusterUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'hostUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'all': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetCpuMemoryCapacityAction, self).__init__()
self.zoneUuids = None
self.clusterUuids = None
self.hostUuids = None
self.all = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateVRouterRouteTableAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/vrouter-route-tables'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateVRouterRouteTableAction, self).__init__()
self.name = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmCapabilitiesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{uuid}/capabilities'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmCapabilitiesAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateVpcUserVpnGatewayRemoteAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/user-vpn'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ip': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=64,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateVpcUserVpnGatewayRemoteAction, self).__init__()
self.dataCenterUuid = None
self.ip = None
self.name = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateWebhookAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/web-hooks/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateWebhook'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'url': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'opaque': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateWebhookAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.url = None
self.type = None
self.opaque = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddSimulatorBackupStorageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/backup-storage/simulators'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'totalCapacity': ParamAnnotation(),
'availableCapacity': ParamAnnotation(),
'url': ParamAnnotation(required=True,max_length=2048,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'importImages': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddSimulatorBackupStorageAction, self).__init__()
self.totalCapacity = None
self.availableCapacity = None
self.url = None
self.name = None
self.description = None
self.type = None
self.importImages = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteIdentityZoneInLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/identity-zone/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteIdentityZoneInLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeletePolicyAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/accounts/policies/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeletePolicyAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteImageAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/images/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'backupStorageUuids': ParamAnnotation(required=False,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteImageAction, self).__init__()
self.uuid = None
self.backupStorageUuids = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryShareableVolumeVmInstanceRefAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/volumes/vm-instances/refs'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryShareableVolumeVmInstanceRefAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachPrimaryStorageFromClusterAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/clusters/{clusterUuid}/primary-storage/{primaryStorageUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'primaryStorageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'clusterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachPrimaryStorageFromClusterAction, self).__init__()
self.primaryStorageUuid = None
self.clusterUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class IsOpensourceVersionAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/meta-data/opensource'
NEED_SESSION = False
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation()
}
def __init__(self):
super(IsOpensourceVersionAction, self).__init__()
self.systemTags = None
self.userTags = None
class PrometheusQueryVmMonitoringDataAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/prometheus/vm-instances'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'vmUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'instant': ParamAnnotation(),
'startTime': ParamAnnotation(required=False,number_range=[0, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'endTime': ParamAnnotation(required=False,number_range=[0, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'step': ParamAnnotation(),
'expression': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'relativeTime': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(PrometheusQueryVmMonitoringDataAction, self).__init__()
self.vmUuids = None
self.instant = None
self.startTime = None
self.endTime = None
self.step = None
self.expression = None
self.relativeTime = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateVpnIpsecAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/vpn-connection/ipsec'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=64,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'pfs': ParamAnnotation(required=False,valid_values=['disabled','group1','group2','group5','group14','group24'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'encAlg': ParamAnnotation(required=False,valid_values=['3des','aes-128','aes-192','aes-256','des'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'authAlg': ParamAnnotation(required=False,valid_values=['md5','sha1'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'lifetime': ParamAnnotation(required=False,number_range=[60, 86400],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateVpnIpsecAction, self).__init__()
self.name = None
self.pfs = None
self.encAlg = None
self.authAlg = None
self.lifetime = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateVpcVpnConnectionRemoteAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hybrid/vpn-connection/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateVpcVpnConnectionRemote'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=64,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'localCidr': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'remoteCidr': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'active': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ikeConfUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ipsecConfUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateVpcVpnConnectionRemoteAction, self).__init__()
self.uuid = None
self.name = None
self.localCidr = None
self.remoteCidr = None
self.active = None
self.ikeConfUuid = None
self.ipsecConfUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddSftpBackupStorageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/backup-storage/sftp'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'hostname': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'username': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshPort': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'url': ParamAnnotation(required=True,max_length=2048,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'importImages': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddSftpBackupStorageAction, self).__init__()
self.hostname = None
self.username = None
self.password = None
self.sshPort = None
self.url = None
self.name = None
self.description = None
self.type = None
self.importImages = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryEcsSecurityGroupFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/security-group'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryEcsSecurityGroupFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeSecurityGroupStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/security-groups/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeSecurityGroupState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeSecurityGroupStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateConnectionBetweenL3NetWorkAndAliyunVSwitchAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hybrid/aliyun/connections/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateConnectionBetweenL3NetWorkAndAliyunVSwitch'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=64,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateConnectionBetweenL3NetWorkAndAliyunVSwitchAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmQgaAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{uuid}/qga'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmQgaAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeSchedulerStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/schedulers/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeSchedulerState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeSchedulerStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVpcVpnConnectionRemoteAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/vpn-connection/{uuid}/remote'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVpcVpnConnectionRemoteAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteIPsecConnectionAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/ipsec/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteIPsecConnectionAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachIsoToVmInstanceAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/vm-instances/{vmInstanceUuid}/iso/{isoUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'null'
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'isoUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachIsoToVmInstanceAction, self).__init__()
self.vmInstanceUuid = None
self.isoUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddAliyunKeySecretAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/key'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'key': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'secret': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'accountUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddAliyunKeySecretAction, self).__init__()
self.name = None
self.key = None
self.secret = None
self.accountUuid = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryGCJobAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/gc-jobs'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryGCJobAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SetVmConsolePasswordAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'setVmConsolePassword'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'consolePassword': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SetVmConsolePasswordAction, self).__init__()
self.uuid = None
self.consolePassword = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachPolicyToUserAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/accounts/users/{userUuid}/policies'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'userUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'policyUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachPolicyToUserAction, self).__init__()
self.userUuid = None
self.policyUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachPrimaryStorageToClusterAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/clusters/{clusterUuid}/primary-storage/{primaryStorageUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'clusterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'primaryStorageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachPrimaryStorageToClusterAction, self).__init__()
self.clusterUuid = None
self.primaryStorageUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SetImageQgaAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/images/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'setImageQga'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'enable': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SetImageQgaAction, self).__init__()
self.uuid = None
self.enable = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateEcsInstanceVncPasswordAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hybrid/aliyun/ecs-vnc/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateEcsInstanceVncPassword'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,valid_regex_values=r'[A-Za-z0-9]{6}',max_length=6,min_length=6,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateEcsInstanceVncPasswordAction, self).__init__()
self.uuid = None
self.password = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateL2VxlanNetworkPoolAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/l2-networks/vxlan-pool'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'physicalInterface': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateL2VxlanNetworkPoolAction, self).__init__()
self.name = None
self.description = None
self.zoneUuid = None
self.physicalInterface = None
self.type = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddOssBucketFromRemoteAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/oss-bucket'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'bucketName': ParamAnnotation(required=True,max_length=64,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'regionId': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddOssBucketFromRemoteAction, self).__init__()
self.bucketName = None
self.regionId = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddSimulatorHostAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hosts/simulators'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'memoryCapacity': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'cpuCapacity': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'managementIp': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'clusterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddSimulatorHostAction, self).__init__()
self.memoryCapacity = None
self.cpuCapacity = None
self.name = None
self.description = None
self.managementIp = None
self.clusterUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVmInstanceAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVmInstanceAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteConnectionBetweenL3NetWorkAndAliyunVSwitchAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/connections/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteConnectionBetweenL3NetWorkAndAliyunVSwitchAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetL3NetworkMtuAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/l3-networks/{l3NetworkUuid}/mtu'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetL3NetworkMtuAction, self).__init__()
self.l3NetworkUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteDiskOfferingAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/disk-offerings/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteDiskOfferingAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class LogInByUserAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/accounts/users/login'
NEED_SESSION = False
NEED_POLL = False
PARAM_NAME = 'logInByUser'
PARAMS = {
'accountUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'accountName': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'userName': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation()
}
def __init__(self):
super(LogInByUserAction, self).__init__()
self.accountUuid = None
self.accountName = None
self.userName = None
self.password = None
self.systemTags = None
self.userTags = None
class RecoverDataVolumeAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/volumes/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'recoverDataVolume'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RecoverDataVolumeAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteUserAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/accounts/users/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteUserAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachMonitorTriggerActionToTriggerAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/monitoring/triggers/{triggerUuid}/trigger-actions/{actionUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'triggerUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'actionUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachMonitorTriggerActionToTriggerAction, self).__init__()
self.triggerUuid = None
self.actionUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryInstanceOfferingAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/instance-offerings'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryInstanceOfferingAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QuerySystemTagAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/system-tags'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QuerySystemTagAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVpcVpnConnectionFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/vpn-connection'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVpcVpnConnectionFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmConsoleAddressAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{uuid}/console-addresses'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmConsoleAddressAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryConsoleProxyAgentAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/consoles/agents'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryConsoleProxyAgentAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateSftpBackupStorageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/backup-storage/sftp/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateSftpBackupStorage'
PARAMS = {
'username': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'hostname': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sshPort': ParamAnnotation(required=False,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateSftpBackupStorageAction, self).__init__()
self.username = None
self.password = None
self.hostname = None
self.sshPort = None
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteAliyunRouteEntryRemoteAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/route-entry/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=True,valid_values=['vbr','vrouter'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteAliyunRouteEntryRemoteAction, self).__init__()
self.uuid = None
self.type = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachBackupStorageFromZoneAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/zones/{zoneUuid}/backup-storage/{backupStorageUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'backupStorageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachBackupStorageFromZoneAction, self).__init__()
self.backupStorageUuid = None
self.zoneUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeBackupStorageStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/backup-storage/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeBackupStorageState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeBackupStorageStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateSchedulerJobAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/scheduler/jobs/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateSchedulerJob'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateSchedulerJobAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class StopBaremetalPxeServerAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/baremetal/pxeserver/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'stopBaremetalPxeServer'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(StopBaremetalPxeServerAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QuerySecurityGroupAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/security-groups'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QuerySecurityGroupAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachAliyunKeyAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hybrid/aliyun/key/{uuid}/attach'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'attachAliyunKey'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachAliyunKeyAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddVmNicToLoadBalancerAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/load-balancers/listeners/{listenerUuid}/vm-instances/nics'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'vmNicUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'listenerUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddVmNicToLoadBalancerAction, self).__init__()
self.vmNicUuids = None
self.listenerUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetCandidateVmForAttachingIsoAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/images/iso/{isoUuid}/vm-candidates'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'isoUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetCandidateVmForAttachingIsoAction, self).__init__()
self.isoUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CleanUpImageCacheOnPrimaryStorageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/primary-storage/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'cleanUpImageCacheOnPrimaryStorage'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CleanUpImageCacheOnPrimaryStorageAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachBackupStorageToZoneAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/zones/{zoneUuid}/backup-storage/{backupStorageUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'backupStorageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachBackupStorageToZoneAction, self).__init__()
self.zoneUuid = None
self.backupStorageUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryAliyunRouteEntryFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/route-entry'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryAliyunRouteEntryFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryLocalStorageResourceRefAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/primary-storage/local-storage/resource-refs'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryLocalStorageResourceRefAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class PrometheusQueryLabelValuesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/prometheus/labels'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'labels': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(PrometheusQueryLabelValuesAction, self).__init__()
self.labels = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncVpcVpnConnectionFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/vpn-connection/{dataCenterUuid}/sync'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncVpcVpnConnectionFromRemoteAction, self).__init__()
self.dataCenterUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class KvmRunShellAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hosts/kvm/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'kvmRunShell'
PARAMS = {
'hostUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'script': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(KvmRunShellAction, self).__init__()
self.hostUuids = None
self.script = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateDiskOfferingAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/disk-offerings'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'diskSize': ParamAnnotation(required=True,number_range=[1, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'sortKey': ParamAnnotation(),
'allocationStrategy': ParamAnnotation(),
'type': ParamAnnotation(required=False,valid_values=['zstack'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateDiskOfferingAction, self).__init__()
self.name = None
self.description = None
self.diskSize = None
self.sortKey = None
self.allocationStrategy = None
self.type = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class PowerStatusBaremetalHostAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/baremetal/chassis/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'powerStatusBaremetalHost'
PARAMS = {
'chassisUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(PowerStatusBaremetalHostAction, self).__init__()
self.chassisUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CleanInvalidLdapBindingAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/ldap/bindings/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'cleanInvalidLdapBinding'
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CleanInvalidLdapBindingAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateBaremetalChassisAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/baremetal/chassis'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ipmiAddress': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ipmiUsername': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ipmiPassword': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateBaremetalChassisAction, self).__init__()
self.name = None
self.description = None
self.ipmiAddress = None
self.ipmiUsername = None
self.ipmiPassword = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVmNicAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/nics'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVmNicAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVRouterRouteEntryAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/vrouter-route-tables/route-entries'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVRouterRouteEntryAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteConnectionAccessPointLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/access-point/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteConnectionAccessPointLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class PrometheusQueryPassThroughAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/prometheus/all'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'instant': ParamAnnotation(),
'startTime': ParamAnnotation(required=False,number_range=[0, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'endTime': ParamAnnotation(required=False,number_range=[0, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'step': ParamAnnotation(),
'expression': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'relativeTime': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(PrometheusQueryPassThroughAction, self).__init__()
self.instant = None
self.startTime = None
self.endTime = None
self.step = None
self.expression = None
self.relativeTime = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmInstanceHaLevelAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{uuid}/ha-levels'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmInstanceHaLevelAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetPrimaryStorageCapacityAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/primary-storage/capacities'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'zoneUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'clusterUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'primaryStorageUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'all': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetPrimaryStorageCapacityAction, self).__init__()
self.zoneUuids = None
self.clusterUuids = None
self.primaryStorageUuids = None
self.all = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddSharedMountPointPrimaryStorageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/primary-storage/smp'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'url': ParamAnnotation(required=True,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddSharedMountPointPrimaryStorageAction, self).__init__()
self.url = None
self.name = None
self.description = None
self.type = None
self.zoneUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteDataVolumeAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/volumes/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteDataVolumeAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateIpRangeAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/l3-networks/ip-ranges/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateIpRange'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateIpRangeAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ExportImageFromBackupStorageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/backup-storage/{backupStorageUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'exportImageFromBackupStorage'
PARAMS = {
'backupStorageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'imageUuid': ParamAnnotation(required=True,max_length=2048,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ExportImageFromBackupStorageAction, self).__init__()
self.backupStorageUuid = None
self.imageUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryAccountAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/accounts'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryAccountAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVolumeCapabilitiesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/volumes/{uuid}/capabilities'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVolumeCapabilitiesAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateL2VlanNetworkAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/l2-networks/vlan'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'vlan': ParamAnnotation(required=True,number_range=[1, 4094],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'physicalInterface': ParamAnnotation(required=True,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateL2VlanNetworkAction, self).__init__()
self.vlan = None
self.name = None
self.description = None
self.zoneUuid = None
self.physicalInterface = None
self.type = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateRootVolumeTemplateFromRootVolumeAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/images/root-volume-templates/from/volumes/{rootVolumeUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'guestOsType': ParamAnnotation(),
'backupStorageUuids': ParamAnnotation(required=False,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'rootVolumeUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'platform': ParamAnnotation(required=False,valid_values=['Linux','Windows','Other','Paravirtualization','WindowsVirtio'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'system': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateRootVolumeTemplateFromRootVolumeAction, self).__init__()
self.name = None
self.description = None
self.guestOsType = None
self.backupStorageUuids = None
self.rootVolumeUuid = None
self.platform = None
self.system = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachSecurityGroupFromL3NetworkAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/security-groups/{securityGroupUuid}/l3-networks/{l3NetworkUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'securityGroupUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachSecurityGroupFromL3NetworkAction, self).__init__()
self.securityGroupUuid = None
self.l3NetworkUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVolumeSnapshotTreeAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/volume-snapshots/trees'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVolumeSnapshotTreeAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateUserGroupAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/accounts/groups/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateUserGroup'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateUserGroupAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteTagAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/tags/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteTagAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetIpAddressCapacityAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/ip-capacity'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'zoneUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ipRangeUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'all': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetIpAddressCapacityAction, self).__init__()
self.zoneUuids = None
self.l3NetworkUuids = None
self.ipRangeUuids = None
self.all = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncVolumeSizeAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/volumes/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'syncVolumeSize'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncVolumeSizeAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateDiskOfferingAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/disk-offerings/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateDiskOffering'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateDiskOfferingAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeMonitorTriggerStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/monitoring/triggers/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeMonitorTriggerState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeMonitorTriggerStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class LocalStorageMigrateVolumeAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/primary-storage/local-storage/volumes/{volumeUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'localStorageMigrateVolume'
PARAMS = {
'volumeUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'destHostUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(LocalStorageMigrateVolumeAction, self).__init__()
self.volumeUuid = None
self.destHostUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateL3NetworkAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/l3-networks'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'l2NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'system': ParamAnnotation(),
'dnsDomain': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateL3NetworkAction, self).__init__()
self.name = None
self.description = None
self.type = None
self.l2NetworkUuid = None
self.system = None
self.dnsDomain = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeVmPasswordAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeVmPassword'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,valid_regex_values=r'[\da-zA-Z-`=\\\[\];',./~!@#$%^&*()_+|{}:"<>?]{1,}',max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=True),
'account': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=True),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeVmPasswordAction, self).__init__()
self.uuid = None
self.password = None
self.account = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVpcIpSecConfigFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/vpn-connection/ipsec'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVpcIpSecConfigFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVirtualBorderRouterFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/border-router'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVirtualBorderRouterFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteLdapServerAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/ldap/servers/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteLdapServerAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateVirtualRouterOfferingAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/instance-offerings/virtual-routers'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'managementNetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'imageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'publicNetworkUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'isDefault': ParamAnnotation(),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'cpuNum': ParamAnnotation(required=True,number_range=[1, 1024],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'memorySize': ParamAnnotation(required=True,number_range=[1, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'allocatorStrategy': ParamAnnotation(),
'sortKey': ParamAnnotation(),
'type': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateVirtualRouterOfferingAction, self).__init__()
self.zoneUuid = None
self.managementNetworkUuid = None
self.imageUuid = None
self.publicNetworkUuid = None
self.isDefault = None
self.name = None
self.description = None
self.cpuNum = None
self.memorySize = None
self.allocatorStrategy = None
self.sortKey = None
self.type = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateOssBucketRemoteAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/oss-bucket/remote'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'regionId': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'bucketName': ParamAnnotation(required=True,max_length=64,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateOssBucketRemoteAction, self).__init__()
self.regionId = None
self.bucketName = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SetNicQosAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'setNicQos'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'outboundBandwidth': ParamAnnotation(required=False,number_range=[8192, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'inboundBandwidth': ParamAnnotation(required=False,number_range=[8192, 9223372036854775807],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SetNicQosAction, self).__init__()
self.uuid = None
self.outboundBandwidth = None
self.inboundBandwidth = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CheckApiPermissionAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/accounts/permissions/actions'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = 'checkApiPermission'
PARAMS = {
'userUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'apiNames': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CheckApiPermissionAction, self).__init__()
self.userUuid = None
self.apiNames = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVmSshKeyAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vm-instances/{uuid}/ssh-keys'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVmSshKeyAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class LogInByAccountAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/accounts/login'
NEED_SESSION = False
NEED_POLL = False
PARAM_NAME = 'logInByAccount'
PARAMS = {
'accountName': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation()
}
def __init__(self):
super(LogInByAccountAction, self).__init__()
self.accountName = None
self.password = None
self.systemTags = None
self.userTags = None
class DeleteVRouterRouteEntryAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vrouter-route-tables/{routeTableUuid}/route-entries/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'routeTableUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVRouterRouteEntryAction, self).__init__()
self.uuid = None
self.routeTableUuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetL3NetworkTypesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/l3-networks/types'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetL3NetworkTypesAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeL3NetworkStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/l3-networks/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeL3NetworkState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeL3NetworkStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateEmailMediaAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/media/emails'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'smtpServer': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'smtpPort': ParamAnnotation(required=True,number_range=[1, 65535],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'emailAddress': ParamAnnotation(required=True,max_length=512,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'username': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'password': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateEmailMediaAction, self).__init__()
self.smtpServer = None
self.smtpPort = None
self.emailAddress = None
self.username = None
self.password = None
self.name = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateSecurityGroupAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/security-groups'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateSecurityGroupAction, self).__init__()
self.name = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteResourcePriceAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/billings/prices/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteResourcePriceAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetBackupStorageTypesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/backup-storage/types'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetBackupStorageTypesAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateIPsecConnectionAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/ipsec'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'peerAddress': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'authMode': ParamAnnotation(required=False,valid_values=['psk','certs'],max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'authKey': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vipUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'peerCidrs': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'ikeAuthAlgorithm': ParamAnnotation(required=False,valid_values=['md5','sha1','sha256','sha384','sha512'],max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ikeEncryptionAlgorithm': ParamAnnotation(required=False,valid_values=['3des','aes-128','aes-192','aes-256'],max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ikeDhGroup': ParamAnnotation(),
'policyAuthAlgorithm': ParamAnnotation(required=False,valid_values=['md5','sha1','sha256','sha384','sha512'],max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'policyEncryptionAlgorithm': ParamAnnotation(required=False,valid_values=['3des','aes-128','aes-192','aes-256'],max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'pfs': ParamAnnotation(required=False,valid_values=['dh-group2','dh-group5','dh-group14','dh-group15','dh-group16','dh-group17','dh-group18','dh-group19','dh-group20','dh-group21','dh-group22','dh-group23','dh-group24','dh-group25','dh-group26'],max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'policyMode': ParamAnnotation(required=False,valid_values=['tunnel','transport'],max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'transformProtocol': ParamAnnotation(required=False,valid_values=['esp','ah','ah-esp'],max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateIPsecConnectionAction, self).__init__()
self.name = None
self.description = None
self.l3NetworkUuid = None
self.peerAddress = None
self.authMode = None
self.authKey = None
self.vipUuid = None
self.peerCidrs = None
self.ikeAuthAlgorithm = None
self.ikeEncryptionAlgorithm = None
self.ikeDhGroup = None
self.policyAuthAlgorithm = None
self.policyEncryptionAlgorithm = None
self.pfs = None
self.policyMode = None
self.transformProtocol = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreatePolicyAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/accounts/policies'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'statements': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreatePolicyAction, self).__init__()
self.name = None
self.description = None
self.statements = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateEcsSecurityGroupRuleRemoteAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/security-group-rule'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'groupUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'direction': ParamAnnotation(required=True,valid_values=['ingress','egress'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'protocol': ParamAnnotation(required=True,valid_values=['tcp','udp','icmp','gre','all'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'portRange': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'cidr': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'policy': ParamAnnotation(required=False,valid_values=['accept','drop'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'nictype': ParamAnnotation(required=False,valid_values=['intranet','internet'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'priority': ParamAnnotation(required=False,number_range=[1, 100],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=256,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateEcsSecurityGroupRuleRemoteAction, self).__init__()
self.groupUuid = None
self.direction = None
self.protocol = None
self.portRange = None
self.cidr = None
self.policy = None
self.nictype = None
self.priority = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryHostAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hosts'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryHostAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ReconnectBackupStorageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/backup-storage/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'reconnectBackupStorage'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ReconnectBackupStorageAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetHypervisorTypesAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hosts/hypervisor-types'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetHypervisorTypesAction, self).__init__()
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteOssBucketFileRemoteAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/oss-bucket-file/remote/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'bucketUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fileName': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteOssBucketFileRemoteAction, self).__init__()
self.bucketUuid = None
self.fileName = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateBaremetalPxeServerAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/baremetal/pxeserver'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dhcpInterface': ParamAnnotation(required=True,max_length=128,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'dhcpRangeBegin': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dhcpRangeEnd': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dhcpRangeNetmask': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateBaremetalPxeServerAction, self).__init__()
self.name = None
self.description = None
self.dhcpInterface = None
self.dhcpRangeBegin = None
self.dhcpRangeEnd = None
self.dhcpRangeNetmask = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteSecurityGroupAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/security-groups/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteSecurityGroupAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryConnectionAccessPointFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/access-point'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryConnectionAccessPointFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachIsoFromVmInstanceAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vm-instances/{vmInstanceUuid}/iso'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachIsoFromVmInstanceAction, self).__init__()
self.vmInstanceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateSystemTagAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/system-tags'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'resourceType': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'tag': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateSystemTagAction, self).__init__()
self.resourceType = None
self.resourceUuid = None
self.tag = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryL2VxlanNetworkAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/l2-networks/vxlan'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryL2VxlanNetworkAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryEcsInstanceFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/ecs'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryEcsInstanceFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddCephBackupStorageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/backup-storage/ceph'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'monUrls': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'poolName': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'url': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'importImages': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddCephBackupStorageAction, self).__init__()
self.monUrls = None
self.poolName = None
self.url = None
self.name = None
self.description = None
self.type = None
self.importImages = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddMonToCephBackupStorageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/backup-storage/ceph/{uuid}/mons'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'monUrls': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddMonToCephBackupStorageAction, self).__init__()
self.uuid = None
self.monUrls = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SetVmHostnameAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'setVmHostname'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'hostname': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SetVmHostnameAction, self).__init__()
self.uuid = None
self.hostname = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncEcsSecurityGroupRuleFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/security-group-rule/{uuid}/sync'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncEcsSecurityGroupRuleFromRemoteAction, self).__init__()
self.uuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeMonitorTriggerActionStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/monitoring/trigger-actions/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeMonitorTriggerActionState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeMonitorTriggerActionStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteEcsVpcRemoteAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/vpc/remote/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteEcsVpcRemoteAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RebootEcsInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hybrid/aliyun/ecs/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'rebootEcsInstance'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RebootEcsInstanceAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncEcsVSwitchFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/vswitch/{dataCenterUuid}/sync'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vSwitchId': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncEcsVSwitchFromRemoteAction, self).__init__()
self.dataCenterUuid = None
self.vSwitchId = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryGlobalConfigAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/global-configurations'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryGlobalConfigAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SetVmInstanceHaLevelAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/vm-instances/{uuid}/ha-levels'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'level': ParamAnnotation(required=True,valid_values=['NeverStop','OnHostFailure'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SetVmInstanceHaLevelAction, self).__init__()
self.uuid = None
self.level = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncEcsSecurityGroupFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/security-group/{ecsVpcUuid}/sync'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'ecsVpcUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncEcsSecurityGroupFromRemoteAction, self).__init__()
self.ecsVpcUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryDataCenterFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/data-center'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryDataCenterFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryLoadBalancerAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/load-balancers'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryLoadBalancerAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachSecurityGroupToL3NetworkAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/security-groups/{securityGroupUuid}/l3-networks/{l3NetworkUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'securityGroupUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachSecurityGroupToL3NetworkAction, self).__init__()
self.securityGroupUuid = None
self.l3NetworkUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVpcUserVpnGatewayLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/user-gateway/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVpcUserVpnGatewayLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVniRangeAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/l2-networks/vxlan-pool/vni-ranges/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVniRangeAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachPolicyFromUserGroupAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/accounts/groups/{groupUuid}/policies/{policyUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'policyUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'groupUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachPolicyFromUserGroupAction, self).__init__()
self.policyUuid = None
self.groupUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddConnectionAccessPointFromRemoteAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/access-point'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddConnectionAccessPointFromRemoteAction, self).__init__()
self.dataCenterUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateMonitorTriggerActionAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/monitoring/trigger-actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'postScript': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'mediaUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'triggerUuids': ParamAnnotation(required=False,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateMonitorTriggerActionAction, self).__init__()
self.name = None
self.description = None
self.postScript = None
self.mediaUuids = None
self.triggerUuids = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVpcVpnGatewayFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/vpc-vpn'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVpcVpnGatewayFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetNicQosAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{uuid}/nic-qos'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetNicQosAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryUserTagAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/user-tags'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryUserTagAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangePrimaryStorageStateAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/primary-storage/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changePrimaryStorageState'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'stateEvent': ParamAnnotation(required=True,valid_values=['enable','disable','maintain','deleting'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangePrimaryStorageStateAction, self).__init__()
self.uuid = None
self.stateEvent = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteHybridEipFromLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/eip/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'type': ParamAnnotation(required=True,valid_values=['aliyun'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteHybridEipFromLocalAction, self).__init__()
self.type = None
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryEcsVSwitchFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/vswitch'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryEcsVSwitchFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVniRangeAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/l2-networks/vxlan-pool/vni-range'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVniRangeAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteLoadBalancerListenerAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/load-balancers/listeners/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteLoadBalancerListenerAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVmStaticIpAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vm-instances/{vmInstanceUuid}/static-ips'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVmStaticIpAction, self).__init__()
self.vmInstanceUuid = None
self.l3NetworkUuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteZoneAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/zones/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteZoneAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteOssBucketNameLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/oss-bucket/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteOssBucketNameLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateConnectionBetweenL3NetworkAndAliyunVSwitchAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/connections'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'l3networkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vSwitchUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vpcRiuuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vbrRiUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vbrUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'cpeIp': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'cpeRiId': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=64,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'direction': ParamAnnotation(required=True,valid_values=['in','out','both'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateConnectionBetweenL3NetworkAndAliyunVSwitchAction, self).__init__()
self.l3networkUuid = None
self.vSwitchUuid = None
self.vpcRiuuid = None
self.vbrRiUuid = None
self.vbrUuid = None
self.cpeIp = None
self.cpeRiId = None
self.name = None
self.description = None
self.direction = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateRouterInterfacePairRemoteAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/router-interface'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'accessPointUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'Spec': ParamAnnotation(required=True,valid_values=['Small.1','Small.2','Small.5','Middle.1','Middle.2','Middle.5','Large.1','Large.2'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vRouterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vBorderRouterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'aDescription': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'aName': ParamAnnotation(required=True,max_length=64,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'bDescription': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'bName': ParamAnnotation(required=True,max_length=64,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ownerName': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateRouterInterfacePairRemoteAction, self).__init__()
self.dataCenterUuid = None
self.accessPointUuid = None
self.Spec = None
self.vRouterUuid = None
self.vBorderRouterUuid = None
self.aDescription = None
self.aName = None
self.bDescription = None
self.bName = None
self.ownerName = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ReconnectConsoleProxyAgentAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/consoles/agents'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'reconnectConsoleProxyAgent'
PARAMS = {
'agentUuids': ParamAnnotation(required=False,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ReconnectConsoleProxyAgentAction, self).__init__()
self.agentUuids = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateEcsVpcRemoteAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/vpc'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'cidrBlock': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=64,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=256,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateEcsVpcRemoteAction, self).__init__()
self.dataCenterUuid = None
self.cidrBlock = None
self.name = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateAliyunVpcVirtualRouterEntryRemoteAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/aliyun/route-entry'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'vRouterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dstCidrBlock': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'nextHopUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'nextHopType': ParamAnnotation(required=True,valid_values=['Instance','RouterInterface'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vRouterType': ParamAnnotation(required=True,valid_values=['vbr','vrouter'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateAliyunVpcVirtualRouterEntryRemoteAction, self).__init__()
self.vRouterUuid = None
self.dstCidrBlock = None
self.nextHopUuid = None
self.nextHopType = None
self.vRouterType = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteIpRangeAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/l3-networks/ip-ranges/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteIpRangeAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteNicQosAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vm-instances/{uuid}/nic-qos'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'direction': ParamAnnotation(required=True,valid_values=['in','out'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteNicQosAction, self).__init__()
self.uuid = None
self.direction = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ChangeInstanceOfferingAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{vmInstanceUuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'changeInstanceOffering'
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'instanceOfferingUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ChangeInstanceOfferingAction, self).__init__()
self.vmInstanceUuid = None
self.instanceOfferingUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddLocalPrimaryStorageAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/primary-storage/local-storage'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'url': ParamAnnotation(required=True,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(),
'zoneUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddLocalPrimaryStorageAction, self).__init__()
self.url = None
self.name = None
self.description = None
self.type = None
self.zoneUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateBaremetalPxeServerAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/baremetal/pxeserver/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateBaremetalPxeServer'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dhcpRangeBegin': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dhcpRangeEnd': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dhcpRangeNetmask': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateBaremetalPxeServerAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.dhcpRangeBegin = None
self.dhcpRangeEnd = None
self.dhcpRangeNetmask = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryEcsVpcFromLocalAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/vpc'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryEcsVpcFromLocalAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddIdentityZoneFromRemoteAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/hybrid/identity-zone'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'zoneId': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=True,valid_values=['aliyun'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=1024,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddIdentityZoneFromRemoteAction, self).__init__()
self.dataCenterUuid = None
self.zoneId = None
self.type = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryDiskOfferingAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/disk-offerings'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryDiskOfferingAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateVmInstanceAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/vm-instances'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'instanceOfferingUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'imageUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'l3NetworkUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=False,valid_values=['UserVm','ApplianceVm'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'rootDiskOfferingUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dataDiskOfferingUuids': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'zoneUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'clusterUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'hostUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'primaryStorageUuidForRootVolume': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'defaultL3NetworkUuid': ParamAnnotation(),
'strategy': ParamAnnotation(required=False,valid_values=['InstantStart','JustCreate'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateVmInstanceAction, self).__init__()
self.name = None
self.instanceOfferingUuid = None
self.imageUuid = None
self.l3NetworkUuids = None
self.type = None
self.rootDiskOfferingUuid = None
self.dataDiskOfferingUuids = None
self.zoneUuid = None
self.clusterUuid = None
self.hostUuid = None
self.primaryStorageUuidForRootVolume = None
self.description = None
self.defaultL3NetworkUuid = None
self.strategy = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteBackupStorageAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/backup-storage/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteBackupStorageAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteEcsVpcInLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/vpc/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteEcsVpcInLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateLoadBalancerListenerAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/load-balancers/listeners/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateLoadBalancerListener'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateLoadBalancerListenerAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class StopVmInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vm-instances/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'stopVmInstance'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'type': ParamAnnotation(required=False,valid_values=['grace','cold'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(StopVmInstanceAction, self).__init__()
self.uuid = None
self.type = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVpcIpSecConfigLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/vpn-connection/ipsec/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVpcIpSecConfigLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteMonitorTriggerActionAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/monitoring/trigger-actions/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteMonitorTriggerActionAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AddDnsToL3NetworkAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/l3-networks/{l3NetworkUuid}/dns'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dns': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AddDnsToL3NetworkAction, self).__init__()
self.l3NetworkUuid = None
self.dns = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetOssBucketFileFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/oss/file/remote'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetOssBucketFileFromRemoteAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVpcUserVpnGatewayRemoteAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/user-gateway/{uuid}/remote'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVpcUserVpnGatewayRemoteAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ValidateSessionAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/accounts/sessions/{sessionUuid}/valid'
NEED_SESSION = False
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'sessionUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation()
}
def __init__(self):
super(ValidateSessionAction, self).__init__()
self.sessionUuid = None
self.systemTags = None
self.userTags = None
class AttachL2NetworkToClusterAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/l2-networks/{l2NetworkUuid}/clusters/{clusterUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'null'
PARAMS = {
'l2NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'clusterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachL2NetworkToClusterAction, self).__init__()
self.l2NetworkUuid = None
self.clusterUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SetVipQosAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vips/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'setVipQos'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'outboundBandwidth': ParamAnnotation(required=False,number_range=[8192, 34359738367],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'inboundBandwidth': ParamAnnotation(required=False,number_range=[8192, 34359738367],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SetVipQosAction, self).__init__()
self.uuid = None
self.outboundBandwidth = None
self.inboundBandwidth = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateRootVolumeTemplateFromVolumeSnapshotAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/images/root-volume-templates/from/volume-snapshots/{snapshotUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'snapshotUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'guestOsType': ParamAnnotation(),
'backupStorageUuids': ParamAnnotation(required=True,non_empty=True,null_elements=False,empty_string=True,no_trim=False),
'platform': ParamAnnotation(required=False,valid_values=['Linux','Windows','Other','Paravirtualization','WindowsVirtio'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'system': ParamAnnotation(),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateRootVolumeTemplateFromVolumeSnapshotAction, self).__init__()
self.snapshotUuid = None
self.name = None
self.description = None
self.guestOsType = None
self.backupStorageUuids = None
self.platform = None
self.system = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateBaremetalChassisAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/baremetal/chassis/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateBaremetalChassis'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=False,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ipmiAddress': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ipmiUsername': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'ipmiPassword': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'provisioned': ParamAnnotation(required=False,valid_values=['true','false'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateBaremetalChassisAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.ipmiAddress = None
self.ipmiUsername = None
self.ipmiPassword = None
self.provisioned = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RefreshLoadBalancerAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/load-balancers/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'refreshLoadBalancer'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RefreshLoadBalancerAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryIpRangeAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/l3-networks/ip-ranges'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryIpRangeAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteVmInstanceHaLevelAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/vm-instances/{uuid}/ha-levels'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteVmInstanceHaLevelAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DetachL2NetworkFromClusterAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/l2-networks/{l2NetworkUuid}/clusters/{clusterUuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'l2NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'clusterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DetachL2NetworkFromClusterAction, self).__init__()
self.l2NetworkUuid = None
self.clusterUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateMonitorTriggerAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/monitoring/triggers'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'expression': ParamAnnotation(required=True,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'duration': ParamAnnotation(required=True,number_range=[1, 2147483647],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'recoveryExpression': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'targetResourceUuid': ParamAnnotation(required=True,max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateMonitorTriggerAction, self).__init__()
self.name = None
self.expression = None
self.duration = None
self.recoveryExpression = None
self.description = None
self.targetResourceUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteGCJobAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/gc-jobs/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteGCJobAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateUserGroupAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/accounts/groups'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateUserGroupAction, self).__init__()
self.name = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmAttachableL3NetworkAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{vmInstanceUuid}/l3-networks-candidates'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmAttachableL3NetworkAction, self).__init__()
self.vmInstanceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetIdentityZoneFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/identity-zone/remote'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'type': ParamAnnotation(required=True,valid_values=['aliyun'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dataCenterUuid': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'regionId': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetIdentityZoneFromRemoteAction, self).__init__()
self.type = None
self.dataCenterUuid = None
self.regionId = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryLdapServerAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/ldap/servers'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryLdapServerAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateInstanceOfferingAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/instance-offerings/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateInstanceOffering'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateInstanceOfferingAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateZoneAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/zones/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateZone'
PARAMS = {
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateZoneAction, self).__init__()
self.name = None
self.description = None
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class CreateZoneAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/zones'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'name': ParamAnnotation(required=True,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(CreateZoneAction, self).__init__()
self.name = None
self.description = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteLdapBindingAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/ldap/bindings/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,max_length=32,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteLdapBindingAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class StartEcsInstanceAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hybrid/aliyun/ecs/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'startEcsInstance'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(StartEcsInstanceAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetConnectionAccessPointFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/access-point{dataCenterUuid}/remote'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetConnectionAccessPointFromRemoteAction, self).__init__()
self.dataCenterUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class AttachNetworkServiceToL3NetworkAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/l3-networks/{l3NetworkUuid}/network-services'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'l3NetworkUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'networkServices': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(AttachNetworkServiceToL3NetworkAction, self).__init__()
self.l3NetworkUuid = None
self.networkServices = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncVirtualBorderRouterFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/border-router/{dataCenterUuid}/sync'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncVirtualBorderRouterFromRemoteAction, self).__init__()
self.dataCenterUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmMigrationCandidateHostsAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{vmInstanceUuid}/migration-target-hosts'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmMigrationCandidateHostsAction, self).__init__()
self.vmInstanceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetVmStartingCandidateClustersHostsAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/vm-instances/{uuid}/starting-target-hosts'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(GetVmStartingCandidateClustersHostsAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryVCenterClusterAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/vcenters/clusters'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryVCenterClusterAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class ReconnectImageStoreBackupStorageAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/backup-storage/image-store/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'reconnectImageStoreBackupStorage'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(ReconnectImageStoreBackupStorageAction, self).__init__()
self.uuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryMonitorTriggerAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/monitoring/triggers'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryMonitorTriggerAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteRouterInterfaceLocalAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/router-interface/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteRouterInterfaceLocalAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateVirtualBorderRouterRemoteAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/hybrid/aliyun/border-router/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateVirtualBorderRouterRemote'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'localGatewayIp': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'peerGatewayIp': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'peeringSubnetMask': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=64,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=128,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'vlanId': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'circuitCode': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateVirtualBorderRouterRemoteAction, self).__init__()
self.uuid = None
self.localGatewayIp = None
self.peerGatewayIp = None
self.peeringSubnetMask = None
self.name = None
self.description = None
self.vlanId = None
self.circuitCode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class DeleteL3NetworkAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/l3-networks/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteL3NetworkAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class RequestConsoleAccessAction(AbstractAction):
HTTP_METHOD = 'POST'
PATH = '/consoles'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'params'
PARAMS = {
'vmInstanceUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(RequestConsoleAccessAction, self).__init__()
self.vmInstanceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class QueryAccountResourceRefAction(QueryAction):
HTTP_METHOD = 'GET'
PATH = '/accounts/resources/refs'
NEED_SESSION = True
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'conditions': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'limit': ParamAnnotation(),
'start': ParamAnnotation(),
'count': ParamAnnotation(),
'groupBy': ParamAnnotation(),
'replyWithCount': ParamAnnotation(),
'sortBy': ParamAnnotation(),
'sortDirection': ParamAnnotation(required=False,valid_values=['asc','desc'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'fields': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(QueryAccountResourceRefAction, self).__init__()
self.conditions = None
self.limit = None
self.start = None
self.count = None
self.groupBy = None
self.replyWithCount = None
self.sortBy = None
self.sortDirection = None
self.fields = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class UpdateVipAction(AbstractAction):
HTTP_METHOD = 'PUT'
PATH = '/vips/{uuid}/actions'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = 'updateVip'
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'name': ParamAnnotation(required=False,max_length=255,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'description': ParamAnnotation(required=False,max_length=2048,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(UpdateVipAction, self).__init__()
self.uuid = None
self.name = None
self.description = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class GetLicenseInfoAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/licenses'
NEED_SESSION = False
NEED_POLL = False
PARAM_NAME = ''
PARAMS = {
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation()
}
def __init__(self):
super(GetLicenseInfoAction, self).__init__()
self.systemTags = None
self.userTags = None
class DeleteEcsSecurityGroupRemoteAction(AbstractAction):
HTTP_METHOD = 'DELETE'
PATH = '/hybrid/aliyun/security-group/remote/{uuid}'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'uuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'deleteMode': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(DeleteEcsSecurityGroupRemoteAction, self).__init__()
self.uuid = None
self.deleteMode = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncHybridEipFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/eip/{dataCenterUuid}/sync'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'type': ParamAnnotation(required=True,valid_values=['aliyun'],non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncHybridEipFromRemoteAction, self).__init__()
self.type = None
self.dataCenterUuid = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
class SyncEcsInstanceFromRemoteAction(AbstractAction):
HTTP_METHOD = 'GET'
PATH = '/hybrid/aliyun/ecs/{dataCenterUuid}/sync'
NEED_SESSION = True
NEED_POLL = True
PARAM_NAME = ''
PARAMS = {
'dataCenterUuid': ParamAnnotation(required=True,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'onlyZstack': ParamAnnotation(required=False,non_empty=False,null_elements=False,empty_string=True,no_trim=False),
'resourceUuid': ParamAnnotation(),
'systemTags': ParamAnnotation(),
'userTags': ParamAnnotation(),
'sessionId': ParamAnnotation(required=True)
}
def __init__(self):
super(SyncEcsInstanceFromRemoteAction, self).__init__()
self.dataCenterUuid = None
self.onlyZstack = None
self.resourceUuid = None
self.systemTags = None
self.userTags = None
self.sessionId = None
| {
"content_hash": "436e0e4a5d5816d4b92d06999dfd91bb",
"timestamp": "",
"source": "github",
"line_count": 28417,
"max_line_length": 337,
"avg_line_length": 35.97515571664849,
"alnum_prop": 0.6499492324216037,
"repo_name": "zstackio/zstack",
"id": "d41e7ed4e172fb3ce3d37d64eed426c292ab5a16",
"size": "1022306",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "testlib/src/main/resources/zssdk_bak.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "4616"
},
{
"name": "AspectJ",
"bytes": "74681"
},
{
"name": "Batchfile",
"bytes": "2932"
},
{
"name": "Groovy",
"bytes": "6776667"
},
{
"name": "Java",
"bytes": "26341557"
},
{
"name": "Python",
"bytes": "1062162"
},
{
"name": "Shell",
"bytes": "176428"
}
],
"symlink_target": ""
} |
"""
Disqus OAuth2 backend, docs at:
https://python-social-auth.readthedocs.io/en/latest/backends/disqus.html
"""
from .oauth import BaseOAuth2
class DisqusOAuth2(BaseOAuth2):
name = 'disqus'
AUTHORIZATION_URL = 'https://disqus.com/api/oauth/2.0/authorize/'
ACCESS_TOKEN_URL = 'https://disqus.com/api/oauth/2.0/access_token/'
ACCESS_TOKEN_METHOD = 'POST'
REDIRECT_STATE = False
SCOPE_SEPARATOR = ','
EXTRA_DATA = [
('avatar', 'avatar'),
('connections', 'connections'),
('user_id', 'user_id'),
('email', 'email'),
('email_hash', 'emailHash'),
('expires', 'expires'),
('location', 'location'),
('meta', 'response'),
('name', 'name'),
('username', 'username'),
]
def get_user_id(self, details, response):
return response['response']['id']
def get_user_details(self, response):
"""Return user details from Disqus account"""
rr = response.get('response', {})
return {
'username': rr.get('username', ''),
'user_id': response.get('user_id', ''),
'email': rr.get('email', ''),
'name': rr.get('name', ''),
}
def extra_data(self, user, uid, response, details=None, *args, **kwargs):
meta_response = dict(response, **response.get('response', {}))
return super(DisqusOAuth2, self).extra_data(user, uid, meta_response,
details, *args, **kwargs)
def user_data(self, access_token, *args, **kwargs):
"""Loads user data from service"""
key, secret = self.get_key_and_secret()
return self.get_json(
'https://disqus.com/api/3.0/users/details.json',
params={'access_token': access_token, 'api_secret': secret}
)
| {
"content_hash": "70ac47720829db9f860cc187072a5950",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 77,
"avg_line_length": 35.40384615384615,
"alnum_prop": 0.5507876154263986,
"repo_name": "LennonChin/Django-Practices",
"id": "eceeb44a16d5dd09a68c4860a644af862f28bcf7",
"size": "1841",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "MxShop/extra_apps/social_core/backends/disqus.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "1538"
},
{
"name": "CSS",
"bytes": "513444"
},
{
"name": "HTML",
"bytes": "501361"
},
{
"name": "Java",
"bytes": "588"
},
{
"name": "JavaScript",
"bytes": "1810740"
},
{
"name": "PHP",
"bytes": "19336"
},
{
"name": "Python",
"bytes": "1739514"
}
],
"symlink_target": ""
} |
import logging
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import forms
from horizon import messages
from openstack_dashboard import api
from openstack_dashboard.dashboards.project.networks.ports \
import forms as project_forms
LOG = logging.getLogger(__name__)
class CreatePort(forms.SelfHandlingForm):
network_name = forms.CharField(label=_("Network Name"),
widget=forms.TextInput(
attrs={'readonly': 'readonly'}))
network_id = forms.CharField(label=_("Network ID"),
widget=forms.TextInput(
attrs={'readonly': 'readonly'}))
name = forms.CharField(max_length=255,
label=_("Name"),
required=False)
admin_state = forms.ChoiceField(choices=[(True, _('UP')),
(False, _('DOWN'))],
label=_("Admin State"))
device_id = forms.CharField(max_length=100, label=_("Device ID"),
help_text=_("Device ID attached to the port"),
required=False)
device_owner = forms.CharField(max_length=100, label=_("Device Owner"),
help_text=_("Device owner attached to the "
"port"),
required=False)
def __init__(self, request, *args, **kwargs):
super(CreatePort, self).__init__(request, *args, **kwargs)
if api.neutron.is_extension_supported(request, 'mac-learning'):
self.fields['mac_state'] = forms.BooleanField(
label=_("MAC Learning State"), initial=False, required=False)
def handle(self, request, data):
try:
# We must specify tenant_id of the network which a subnet is
# created for if admin user does not belong to the tenant.
network = api.neutron.network_get(request, data['network_id'])
data['tenant_id'] = network.tenant_id
data['admin_state_up'] = (data['admin_state'] == 'True')
del data['network_name']
del data['admin_state']
if 'mac_state' in data:
data['mac_learning_enabled'] = data['mac_state']
del data['mac_state']
port = api.neutron.port_create(request, **data)
msg = _('Port %s was successfully created.') % port['id']
LOG.debug(msg)
messages.success(request, msg)
return port
except Exception:
msg = _('Failed to create a port for network %s') \
% data['network_id']
LOG.info(msg)
redirect = reverse('horizon:admin:networks:detail',
args=(data['network_id'],))
exceptions.handle(request, msg, redirect=redirect)
class UpdatePort(project_forms.UpdatePort):
# tenant_id = forms.CharField(widget=forms.HiddenInput())
device_id = forms.CharField(max_length=100, label=_("Device ID"),
help_text=_("Device ID attached to the port"),
required=False)
device_owner = forms.CharField(max_length=100, label=_("Device Owner"),
help_text=_("Device owner attached to the "
"port"),
required=False)
failure_url = 'horizon:admin:networks:detail'
def handle(self, request, data):
try:
LOG.debug('params = %s' % data)
extension_kwargs = {}
data['admin_state'] = (data['admin_state'] == 'True')
if 'mac_state' in data:
extension_kwargs['mac_learning_enabled'] = data['mac_state']
port = api.neutron.port_update(request, data['port_id'],
name=data['name'],
admin_state_up=data['admin_state'],
device_id=data['device_id'],
device_owner=data['device_owner'],
**extension_kwargs)
msg = _('Port %s was successfully updated.') % data['port_id']
LOG.debug(msg)
messages.success(request, msg)
return port
except Exception:
msg = _('Failed to update port %s') % data['port_id']
LOG.info(msg)
redirect = reverse(self.failure_url,
args=[data['network_id']])
exceptions.handle(request, msg, redirect=redirect)
| {
"content_hash": "e5dfb392b4888b3f53966de57f78294d",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 78,
"avg_line_length": 46.32380952380952,
"alnum_prop": 0.5057565789473685,
"repo_name": "tsufiev/horizon",
"id": "31950c1c6bbcab9c54ad06ecfc591a7a19818bec",
"size": "5472",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "openstack_dashboard/dashboards/admin/networks/ports/forms.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "1536"
},
{
"name": "CSS",
"bytes": "70531"
},
{
"name": "HTML",
"bytes": "420092"
},
{
"name": "JavaScript",
"bytes": "277460"
},
{
"name": "Makefile",
"bytes": "588"
},
{
"name": "Python",
"bytes": "4417610"
},
{
"name": "Shell",
"bytes": "18318"
}
],
"symlink_target": ""
} |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tdc.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "65d58e2911a2cbf635a3b5fc38cfdd8e",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 67,
"avg_line_length": 24.88888888888889,
"alnum_prop": 0.7053571428571429,
"repo_name": "fsouza/tdc_django",
"id": "d6ce6d1ad11a59f5279393294eea657cb2c8745d",
"size": "246",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "tdc/manage.py",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Python",
"bytes": "15045"
}
],
"symlink_target": ""
} |
from __future__ import unicode_literals
import django.contrib.auth.models
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.AlterModelManagers(
name='user',
managers=[
('objects', django.contrib.auth.models.UserManager()),
],
),
migrations.AlterField(
model_name='user',
name='username',
field=models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=30, unique=True, validators=[django.core.validators.RegexValidator('^[\\w.@+-]+$', 'Enter a valid username. This value may contain only letters, numbers and @/./+/-/_ characters.')], verbose_name='username'),
),
]
| {
"content_hash": "2373e7ae781f2f08ae9121915fd155aa",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 409,
"avg_line_length": 37.38461538461539,
"alnum_prop": 0.6203703703703703,
"repo_name": "amstart/demo",
"id": "74dfec726c5420214082ca8ec250b7f083c98cfe",
"size": "1044",
"binary": false,
"copies": "1",
"ref": "refs/heads/test_one_vote_model",
"path": "demoslogic/users/migrations/0002_auto_20160927_1300.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3826"
},
{
"name": "HTML",
"bytes": "41694"
},
{
"name": "JavaScript",
"bytes": "3922"
},
{
"name": "Jupyter Notebook",
"bytes": "22630"
},
{
"name": "Python",
"bytes": "174579"
},
{
"name": "Shell",
"bytes": "4188"
}
],
"symlink_target": ""
} |
"""
=======================
Decoding real-time data
=======================
Supervised machine learning applied to MEG data in sensor space.
Here the classifier is updated every 5 trials and the decoding
accuracy is plotted
"""
# Authors: Mainak Jas <[email protected]>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.realtime import MockRtClient, RtEpochs
from mne.datasets import sample
print(__doc__)
# Fiff file to simulate the realtime client
data_path = sample.data_path()
raw_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw.fif'
raw = mne.io.Raw(raw_fname, preload=True)
tmin, tmax = -0.2, 0.5
event_id = dict(aud_l=1, vis_l=3)
tr_percent = 60 # Training percentage
min_trials = 10 # minimum trials after which decoding should start
# select gradiometers
picks = mne.pick_types(raw.info, meg='grad', eeg=False, eog=True,
stim=True, exclude=raw.info['bads'])
# create the mock-client object
rt_client = MockRtClient(raw)
# create the real-time epochs object
rt_epochs = RtEpochs(rt_client, event_id, tmin, tmax, picks=picks, decim=1,
reject=dict(grad=4000e-13, eog=150e-6))
# start the acquisition
rt_epochs.start()
# send raw buffers
rt_client.send_data(rt_epochs, picks, tmin=0, tmax=90, buffer_size=1000)
# Decoding in sensor space using a linear SVM
n_times = len(rt_epochs.times)
from sklearn import preprocessing # noqa
from sklearn.svm import SVC # noqa
from sklearn.pipeline import Pipeline # noqa
from sklearn.cross_validation import cross_val_score, ShuffleSplit # noqa
from mne.decoding import EpochsVectorizer, FilterEstimator # noqa
scores_x, scores, std_scores = [], [], []
filt = FilterEstimator(rt_epochs.info, 1, 40)
scaler = preprocessing.StandardScaler()
vectorizer = EpochsVectorizer()
clf = SVC(C=1, kernel='linear')
concat_classifier = Pipeline([('filter', filt), ('vector', vectorizer),
('scaler', scaler), ('svm', clf)])
data_picks = mne.pick_types(rt_epochs.info, meg='grad', eeg=False, eog=True,
stim=False, exclude=raw.info['bads'])
for ev_num, ev in enumerate(rt_epochs.iter_evoked()):
print("Just got epoch %d" % (ev_num + 1))
if ev_num == 0:
X = ev.data[None, data_picks, :]
y = int(ev.comment) # the comment attribute contains the event_id
else:
X = np.concatenate((X, ev.data[None, data_picks, :]), axis=0)
y = np.append(y, int(ev.comment))
if ev_num >= min_trials:
cv = ShuffleSplit(len(y), 5, test_size=0.2, random_state=42)
scores_t = cross_val_score(concat_classifier, X, y, cv=cv,
n_jobs=1) * 100
std_scores.append(scores_t.std())
scores.append(scores_t.mean())
scores_x.append(ev_num)
# Plot accuracy
plt.clf()
plt.plot(scores_x, scores, '+', label="Classif. score")
plt.hold(True)
plt.plot(scores_x, scores)
plt.axhline(50, color='k', linestyle='--', label="Chance level")
hyp_limits = (np.asarray(scores) - np.asarray(std_scores),
np.asarray(scores) + np.asarray(std_scores))
plt.fill_between(scores_x, hyp_limits[0], y2=hyp_limits[1],
color='b', alpha=0.5)
plt.xlabel('Trials')
plt.ylabel('Classification score (% correct)')
plt.xlim([min_trials, 50])
plt.ylim([30, 105])
plt.title('Real-time decoding')
plt.show(block=False)
plt.pause(0.01)
plt.show()
| {
"content_hash": "d3f0d3e5180d61770e74b48513b0f8e5",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 76,
"avg_line_length": 31.79646017699115,
"alnum_prop": 0.6290008349568605,
"repo_name": "andyh616/mne-python",
"id": "753728dbe589faaea76314257b9adb1535e7939f",
"size": "3593",
"binary": false,
"copies": "11",
"ref": "refs/heads/master",
"path": "examples/realtime/plot_compute_rt_decoder.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Makefile",
"bytes": "3117"
},
{
"name": "PowerShell",
"bytes": "2988"
},
{
"name": "Python",
"bytes": "4245296"
},
{
"name": "Shell",
"bytes": "936"
}
],
"symlink_target": ""
} |
"""
This file is part of labella.py.
Author: G.J.J. van den Burg
License: Apache-2.0
"""
from . import vpsc
DEFAULT_OPTIONS = {
"lineSpacing": 2,
"nodeSpacing": 3,
"minPos": 0,
"maxPos": None,
}
def last(arr):
return arr[-1]
def nodeToVariable(node):
v = vpsc.Variable(node.targetPos)
v.node = node
return v
def removeOverlap(nodes, options):
if len(nodes) == 0:
return nodes
if options is None:
options = {}
new_options = {k: v for k, v in DEFAULT_OPTIONS.items()}
new_options.update(options)
options = new_options
for node in nodes:
node.targetPos = (
node.parent.currentPos if node.parent else node.idealPos
)
nodes.sort(key=lambda x: x.targetPos)
variables = [nodeToVariable(n) for n in nodes]
constraints = []
for i in range(1, len(variables)):
v1 = variables[i - 1]
v2 = variables[i]
if v1.node.isStub() and v2.node.isStub():
gap = (v1.node.width + v2.node.width) / 2 + options["lineSpacing"]
else:
gap = (v1.node.width + v2.node.width) / 2 + options["nodeSpacing"]
constraints.append(vpsc.Constraint(v1, v2, gap))
if ("minPos" in options) and (not options["minPos"] is None):
leftWall = vpsc.Variable(options["minPos"], 1e10)
v = variables[0]
constraints.append(vpsc.Constraint(leftWall, v, v.node.width / 2))
variables = [leftWall] + variables
if ("maxPos" in options) and (not options["maxPos"] is None):
rightWall = vpsc.Variable(options["maxPos"], 1e10)
lastv = last(variables)
constraints.append(
vpsc.Constraint(lastv, rightWall, lastv.node.width / 2)
)
variables.append(rightWall)
solver = vpsc.Solver(variables, constraints)
solver.solve()
variables = [v for v in variables if v.node]
for v in variables:
v.node.currentPos = round(v.position())
return nodes
| {
"content_hash": "a419a9df0b0f43e95b5418544b3216d7",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 78,
"avg_line_length": 24.925,
"alnum_prop": 0.6028084252758275,
"repo_name": "GjjvdBurg/labella.py",
"id": "b6b36f17c473bc6b517f5bde31f9e25c60799034",
"size": "2019",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "labella/removeOverlap.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Makefile",
"bytes": "1393"
},
{
"name": "Python",
"bytes": "156171"
}
],
"symlink_target": ""
} |
import sys
import struct
import pprint
from rosetta.common import get_spec, decode, build_standard_msg_parser, pb_parser
def build_msg_parsers(spec):
decoders = {}
endian = spec['endian']
decoders['header'] = build_standard_msg_parser(spec['header'])
decoders[100] = build_standard_msg_parser(spec['100.sequence_reset'])
decoders[101] = build_standard_msg_parser(spec['101.logon'])
decoders[102] = build_standard_msg_parser(spec['102.logon_responce'])
decoders[201] = build_standard_msg_parser(spec['201.retransmission_request'])
decoders[202] = build_standard_msg_parser(spec['202.retransmission_responce'])
decoders[203] = build_standard_msg_parser(spec['203.refresh_complete'])
decoders[10] = build_standard_msg_parser(spec['10.market_definition'])
decoders[14] = build_standard_msg_parser(spec['14.currency_rate'])
decoders[20] = build_standard_msg_parser(spec['20.trading_session_status'])
decoders[21] = build_standard_msg_parser(spec['21.security_status'])
decoders[30] = build_standard_msg_parser(spec['30.add_order'])
decoders[31] = build_standard_msg_parser(spec['31.modify_order'])
decoders[32] = build_standard_msg_parser(spec['32.delete_order'])
decoders[33] = build_standard_msg_parser(spec['33.add_odd_lot_order'])
decoders[34] = build_standard_msg_parser(spec['34.delete_odd_lot_order'])
decoders[51] = build_standard_msg_parser(spec['51.trade_cancel'])
decoders[52] = build_standard_msg_parser(spec['52.trade_ticker'])
decoders[62] = build_standard_msg_parser(spec['62.closing_price'])
decoders[40] = build_standard_msg_parser(spec['40.nominal_price'])
decoders[41] = build_standard_msg_parser(spec['41.indicative_equilibrium_price'])
decoders[60] = build_standard_msg_parser(spec['60.statistics'])
decoders[61] = build_standard_msg_parser(spec['61.market_turnover'])
decoders[44] = build_standard_msg_parser(spec['44.yield'])
decoders[70] = build_standard_msg_parser(spec['70.index_definition'])
decoders[71] = build_standard_msg_parser(spec['71.index_data'])
decoders[55] = build_standard_msg_parser(spec['55.top_of_book'])
decoders[42] = build_standard_msg_parser(spec['42.estimated_average_settlement_price'])
decoders[50] = build_standard_msg_parser(spec['50.Trade'])
sec_1 = build_standard_msg_parser(spec['11.security_definition'])
sec_2 = build_standard_msg_parser(spec['11.sub.security_definition'])
def decoder_11(data, index):
msg, index = sec_1(data, index)
submessages = []
msg['submessages'] = submessages
for _ in range(msg['NoUnderlyingSecurities']):
msg, index = sec_2(data, index)
submessages.append(msg)
return msg, index
decoders[11] = decoder_11
liq_1 = build_standard_msg_parser(spec['13.liquidity_provider'])
liq_2 = build_standard_msg_parser(spec['13.sub.liquidity_provider'])
def decoder_13(data, index):
msg, index = liq_1(data, index)
submessages = []
msg['submessages'] = submessages
for _ in range(msg['NoLiquidityProviders']):
msg, index = liq_2(data, index)
submessages.append(msg)
return msg, index
decoders[13] = decoder_13
agg_1 = build_standard_msg_parser(spec['53.aggregate_order_book_update'])
agg_2 = build_standard_msg_parser(spec['53.sub.aggregate_order_book_update_spec2'])
def decoder_53(data, index):
msg, index = agg_1(data, index)
submessages = []
msg['submessages'] = submessages
for _ in range(msg['NoEntries']):
msg, index = agg_2(data, index)
submessages.append(msg)
return msg, index
decoders[53] = decoder_53
bro_1 = build_standard_msg_parser(spec['54.broker_queue'])
bro_2 = build_standard_msg_parser(spec['54.sub.broker_queue'])
def decoder_54(data, index):
msg, index = bro_1(data, index)
submessages = []
msg['submessages'] = submessages
for _ in range(msg['ItemCount']):
msg, index = bro_2(data, index)
submessages.append(msg)
return msg, index
decoders[54] = decoder_54
news = build_standard_msg_parser(spec['22.news'])
news1 = build_standard_msg_parser(spec['22.sub1.news'])
news2 = build_standard_msg_parser(spec['22.sub2.news'])
news3 = build_standard_msg_parser(spec['22.sub3.news'])
news4 = build_standard_msg_parser(spec['22.sub4.news'])
news5 = build_standard_msg_parser(spec['22.sub5.news'])
news6 = build_standard_msg_parser(spec['22.sub6.news'])
news7 = build_standard_msg_parser(spec['22.sub7.news'])
news8 = build_standard_msg_parser(spec['22.sub8.news'])
def decoder_22(data, index):
msg, index = news(data, index)
n_msg, index = news1(data, index)
msg.update(n_msg)
market_codes = []
msg['market_codes'] = market_codes
for _ in range(n_msg['NoMarketCodes']):
msg, index = news2(data, index)
market_codes.append(msg)
n_msg, index = news3(data, index)
n_msg, index = news4(data, index)
sec_codes = []
msg['sec_codes'] = sec_codes
for _ in range(n_msg['NoSecurityCodes']):
msg, index = news5(data, index)
sec_codes.append(msg)
n_msg, index = news6(data, index)
n_msg, index = news7(data, index)
news_lines = []
msg['news_lines'] = news_lines
for _ in range(n_msg['NoNewsLines']):
msg, index = news8(data, index)
news_lines.append(msg)
return msg, index
decoders[22] = decoder_22
return decoders
def decode_playback(decoders, spec, playback):
header_decoder = decoders['header']
endian = spec['endian']
header_format = spec['header']['format']
header_size = struct.calcsize(header_format)
msg_num = 0
for data in pb_parser(playback):
if not data:
break
msg_num += 1
msg = []
# HEADER
index = 0
try:
decoded_header, index = header_decoder(data, index)
except struct.error:
raise
msg.append(decoded_header)
# SUBMSGS
number_of_submsgs = decoded_header['MsgCount']
for _ in range(number_of_submsgs):
try:
size = struct.unpack(endian+'H', data[index:index+2])[0]
typ = struct.unpack(endian+'H', data[index+2:index+4])[0]
sub_msg, index = decoders[typ](data, index)
except (struct.error, KeyError):
import pdb
pdb.set_trace()
raise
msg.append(sub_msg)
yield msg
print(msg_num)
def main():
spec = get_spec('hkseomd.ini')
decoders = build_msg_parsers(spec)
for msg in decode_playback(decoders, spec, sys.argv[1]):
#pass
pprint.pprint(msg)
if __name__ == '__main__':
main()
| {
"content_hash": "e6114e311a75aa2ef10460067a1a89d6",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 91,
"avg_line_length": 40.04,
"alnum_prop": 0.6209504780933353,
"repo_name": "hexforge/pulp_db",
"id": "d340b609f95214df201beaf2570c6471224cc6d7",
"size": "7007",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "utils/decoder/hkseomd_decoder.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "301"
},
{
"name": "C",
"bytes": "1461478"
},
{
"name": "C++",
"bytes": "303321"
},
{
"name": "CSS",
"bytes": "17870"
},
{
"name": "Groff",
"bytes": "9288"
},
{
"name": "HTML",
"bytes": "429785"
},
{
"name": "Objective-C",
"bytes": "7053"
},
{
"name": "PureBasic",
"bytes": "39084"
},
{
"name": "Python",
"bytes": "378620"
},
{
"name": "Shell",
"bytes": "536420"
}
],
"symlink_target": ""
} |
"""
File mutex module
"""
import time
import fcntl
import os
import stat
class FileMutex(object):
"""
This is mutex backed on the filesystem. It's cross thread and cross process. However
its limited to the boundaries of a filesystem
"""
def __init__(self, name, wait=None):
"""
Creates a file mutex object
"""
self.name = name
self._has_lock = False
self._start = 0
self._handle = open(self.key(), 'w')
self._wait = wait
try:
os.chmod(
self.key(),
stat.S_IRUSR | stat.S_IWUSR |
stat.S_IRGRP | stat.S_IWGRP |
stat.S_IROTH | stat.S_IWOTH
)
except OSError:
pass
def __call__(self, wait):
self._wait = wait
return self
def __enter__(self):
self.acquire()
return self
def __exit__(self, *args, **kwargs):
_ = args, kwargs
self.release()
def acquire(self, wait=None):
"""
Acquire a lock on the mutex, optionally given a maximum wait timeout
"""
if self._has_lock:
return True
self._start = time.time()
if wait is None:
wait = self._wait
if wait is None:
fcntl.flock(self._handle, fcntl.LOCK_EX)
else:
while True:
passed = time.time() - self._start
if passed > wait:
raise RuntimeError('Could not acquire lock %s' % self.key())
try:
fcntl.flock(self._handle, fcntl.LOCK_EX | fcntl.LOCK_NB)
break
except IOError:
time.sleep(0.005)
self._start = time.time()
self._has_lock = True
return True
def release(self):
"""
Releases the lock
"""
if self._has_lock:
fcntl.flock(self._handle, fcntl.LOCK_UN)
self._has_lock = False
def key(self):
"""
Lock key
"""
return '/var/lock/alba-asdmanager_flock_%s' % self.name
def __del__(self):
"""
__del__ hook, releasing the lock
"""
self.release()
self._handle.close()
| {
"content_hash": "7036c252a0093f4d783e480dfeb3edcb",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 88,
"avg_line_length": 25.153846153846153,
"alnum_prop": 0.48274355613805153,
"repo_name": "fpytloun/alba-asdmanager",
"id": "3566a049f2b38c1a26b0f5b8e4e6d1691bbdb4d3",
"size": "2870",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "source/tools/filemutex.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Makefile",
"bytes": "460"
},
{
"name": "Python",
"bytes": "60479"
},
{
"name": "Shell",
"bytes": "2088"
}
],
"symlink_target": ""
} |
import requests
import lxml.html
def scrape():
res = requests.get("http://www.cdc.gov/zika/geo/active-countries.html")
dom = lxml.html.fromstring(res.content)
li_els = dom.cssselect(".list-block li")
countries = [ li.text_content() for li in li_els ]
return countries
if __name__ == "__main__":
print("\n".join(scrape()))
| {
"content_hash": "f155470c70b5ea082145f6b972c1c2be",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 75,
"avg_line_length": 29.333333333333332,
"alnum_prop": 0.6363636363636364,
"repo_name": "BuzzFeedNews/zika-data",
"id": "ebb79c2b5f7eb8375db247d695223b9dd24e5aa6",
"size": "374",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "scripts/scrape-cdc-list.py",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Makefile",
"bytes": "290"
},
{
"name": "Python",
"bytes": "5490"
}
],
"symlink_target": ""
} |
import os
import sys
import sphinx_rtd_theme
from pytablereader import __author__, __copyright__, __name__, __version__
sys.path.insert(0, os.path.abspath('..'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
'sphinx.ext.intersphinx',
'sphinx.ext.napoleon',
]
intersphinx_mapping = {'python': ('https://docs.python.org/', None)}
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The encoding of source files.
#
# source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = __name__
copyright = __copyright__.lstrip("Copyright ")
author = __author__
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = __version__
# The full version, including alpha/beta/rc tags.
release = version
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'en'
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#
# today = ''
#
# Else, today_fmt is used as the format for a strftime call.
#
# today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The reST default role (used for this markup: `text`) to use for all
# documents.
#
# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#
# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#
# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#
# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
# keep_warnings = False
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default.
#
# html_title = u'pytablereader v0.1.0'
# A shorter title for the navigation bar. Default is the same as html_title.
#
# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#
# html_logo = None
# The name of an image file (relative to this directory) to use as a favicon of
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#
# html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#
# html_extra_path = []
# If not None, a 'Last updated on:' timestamp is inserted at every page
# bottom, using the given strftime format.
# The empty string is equivalent to '%b %d, %Y'.
#
# html_last_updated_fmt = None
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#
# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#
# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#
# html_additional_pages = {}
# If false, no module index is generated.
#
# html_domain_indices = True
# If false, no index is generated.
#
# html_use_index = True
# If true, the index is split into individual pages for each letter.
#
# html_split_index = False
# If true, links to the reST sources are added to the pages.
#
# html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#
# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#
# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#
# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
# html_file_suffix = None
# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh'
#
# html_search_language = 'en'
# A dictionary with options for the search language support, empty by default.
# 'ja' uses this config value.
# 'zh' user can custom change `jieba` dictionary path.
#
# html_search_options = {'type': 'default'}
# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#
# html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder.
htmlhelp_basename = 'pytablereaderdoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'pytablereader.tex', 'pytablereader Documentation',
'Tsuyoshi Hombashi', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#
# latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#
# latex_use_parts = False
# If true, show page references after internal links.
#
# latex_show_pagerefs = False
# If true, show URL addresses after external links.
#
# latex_show_urls = False
# Documents to append as an appendix to all manuals.
#
# latex_appendices = []
# It false, will not define \strong, \code, itleref, \crossref ... but only
# \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added
# packages.
#
# latex_keep_old_macro_names = True
# If false, no module index is generated.
#
# latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'pytablereader', 'pytablereader Documentation',
[author], 1)
]
# If true, show URL addresses after external links.
#
# man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'pytablereader', 'pytablereader Documentation',
author, 'pytablereader', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#
# texinfo_appendices = []
# If false, no module index is generated.
#
# texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#
# texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#
# texinfo_no_detailmenu = False
# ------------------------------------------------
rp_common = """
.. |TM| replace::
:superscript:`TM`
"""
rp_docstring = """
.. |filename_desc| replace::
Filename (without extension)
.. |format_id_desc| replace::
A unique number between the same format.
.. |global_id| replace::
A unique number between all of the format.
"""
rp_builtin = """
.. |False| replace:: :py:obj:`False`
.. |True| replace:: :py:obj:`True`
.. |None| replace:: :py:obj:`None`
.. |bool| replace:: :py:class:`bool`
.. |dict| replace:: :py:class:`dict`
.. |int| replace:: :py:class:`int`
.. |list| replace:: :py:class:`list`
.. |float| replace:: :py:class:`float`
.. |str| replace:: :py:class:`str`
.. |tuple| replace:: :py:obj:`tuple`
.. |datetime| replace:: :py:class:`datetime.datetime`
.. |timedelta| replace:: :py:class:`datetime.timedelta`
"""
rp_method = """
.. |LoaderNotFoundError_desc| replace::
If an appropriate loader not found for
.. |load_source_desc_file| replace::
:py:attr:`.source` attribute should contain a path to the file to load.
.. |load_source_desc_text| replace::
:py:attr:`.source` attribute should contain a text object to load.
.. |load_table_name_desc| replace::
Table name determined by the value of
:py:attr:`~pytablereader.interface.AbstractTableReader.table_name`.
Following format specifiers in the
:py:attr:`~pytablereader.interface.AbstractTableReader.table_name`
are replaced with specific strings:
.. |spreadsheet_load_desc| replace::
This method automatically search the header row of the table start from
:py:attr:`.start_row`.
The header row requires all of the columns has value (except empty columns).
"""
rp_class = """
.. |InvalidFilePathError| replace::
:py:class:`~pytablereader.InvalidFilePathError`
.. |LoaderNotFoundError| replace::
:py:class:`~pytablereader.LoaderNotFoundError`
.. |CsvTableFileLoader| replace::
:py:class:`~pytablereader.CsvTableFileLoader`
.. |CsvTableTextLoader| replace::
:py:class:`~pytablereader.CsvTableTextLoader`
.. |GoogleSheetsTableLoader| replace::
:py:class:`~pytablereader.GoogleSheetsTableLoader`
.. |TableData| replace::
:py:class:`~tabledata.TableData`
.. |TableUrlLoader| replace::
:py:class:`~pytablereader.TableUrlLoader`
"""
rst_prolog = (
rp_common +
rp_method +
rp_class +
rp_docstring +
rp_builtin
)
| {
"content_hash": "c238ba36f7eac03a8b1176a04ae81d06",
"timestamp": "",
"source": "github",
"line_count": 425,
"max_line_length": 80,
"avg_line_length": 28.011764705882353,
"alnum_prop": 0.6830743385132297,
"repo_name": "thombashi/pytablereader",
"id": "ff506e17e93d66568acd17b07be8d53af38bbdeb",
"size": "11905",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/conf.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "71819"
},
{
"name": "Makefile",
"bytes": "627"
},
{
"name": "Python",
"bytes": "281818"
},
{
"name": "Shell",
"bytes": "265"
}
],
"symlink_target": ""
} |
"""CHOMSKY is an aid to writing linguistic papers in the style
of the great master. It is based on selected phrases taken
from actual books and articles written by Noam Chomsky.
Upon request, it assembles the phrases in the elegant
stylistic patterns that Chomsky is noted for.
To generate n sentences of linguistic wisdom, type
(CHOMSKY n) -- for example
(CHOMSKY 5) generates half a screen of linguistic truth."""
leadins = """To characterize a linguistic level L,
On the other hand,
This suggests that
It appears that
Furthermore,
We will bring evidence in favor of the following thesis:
To provide a constituent structure for T(Z,K),
From C1, it follows that
For any transformation which is sufficiently diversified in application to be of any interest,
Analogously,
Clearly,
Note that
Of course,
Suppose, for instance, that
Thus
With this clarification,
Conversely,
We have already seen that
By combining adjunctions and certain deformations,
I suggested that these results would follow from the assumption that
If the position of the trace in (99c) were only relatively inaccessible to movement,
However, this assumption is not correct, since
Comparing these examples with their parasitic gap counterparts in (96) and (97), we see that
In the discussion of resumptive pronouns following (81),
So far,
Nevertheless,
For one thing,
Summarizing, then, we assume that
A consequence of the approach just outlined is that
Presumably,
On our assumptions,
It may be, then, that
It must be emphasized, once again, that
Let us continue to suppose that
Notice, incidentally, that """
# List of LEADINs to buy time.
subjects = """ the notion of level of grammaticalness
a case of semigrammaticalness of a different sort
most of the methodological work in modern linguistics
a subset of English sentences interesting on quite independent grounds
the natural general principle that will subsume this case
an important property of these three types of EC
any associated supporting element
the appearance of parasitic gaps in domains relatively inaccessible to ordinary extraction
the speaker-hearer's linguistic intuition
the descriptive power of the base component
the earlier discussion of deviance
this analysis of a formative as a pair of sets of features
this selectionally introduced contextual feature
a descriptively adequate grammar
the fundamental error of regarding functional notions as categorial
relational information
the systematic use of complex symbols
the theory of syntactic features developed earlier"""
# List of SUBJECTs chosen for maximum professorial macho.
verbs = """can be defined in such a way as to impose
delimits
suffices to account for
cannot be arbitrary in
is not subject to
does not readily tolerate
raises serious doubts about
is not quite equivalent to
does not affect the structure of
may remedy and, at the same time, eliminate
is not to be considered in determining
is to be regarded as
is unspecified with respect to
is, apparently, determined by
is necessary to impose an interpretation on
appears to correlate rather closely with
is rather different from"""
#List of VERBs chosen for autorecursive obfuscation.
objects = """ problems of phonemic and morphological analysis.
a corpus of utterance tokens upon which conformity has been defined by the paired utterance test.
the traditional practice of grammarians.
the levels of acceptability from fairly high (e.g. (99a)) to virtual gibberish (e.g. (98d)).
a stipulation to place the constructions into these various categories.
a descriptive fact.
a parasitic gap construction.
the extended c-command discussed in connection with (34).
the ultimate standard that determines the accuracy of any proposed grammar.
the system of base rules exclusive of the lexicon.
irrelevant intervening contexts in selectional rules.
nondistinctness in the sense of distinctive feature theory.
a general convention regarding the forms of the grammar.
an abstract underlying order.
an important distinction in language use.
the requirement that branching is not tolerated within the dominance scope of a complex symbol.
the strong generative capacity of the theory."""
# List of OBJECTs selected for profound sententiousness.
import textwrap, random
from itertools import chain, islice, izip
def chomsky(times=1, line_length=72):
parts = []
for part in (leadins, subjects, verbs, objects):
phraselist = map(str.strip, part.splitlines())
random.shuffle(phraselist)
parts.append(phraselist)
output = chain(*islice(izip(*parts), 0, times))
return textwrap.fill(' '.join(output), line_length)
print chomsky(5)
| {
"content_hash": "d78af22423fc38337cbab9c2797cbcfa",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 101,
"avg_line_length": 42.64957264957265,
"alnum_prop": 0.7406813627254509,
"repo_name": "ActiveState/code",
"id": "4797671547e9d1d77521963ee3941bd5220899a5",
"size": "4990",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "recipes/Python/440546_Chomsky_random_text_generator/recipe-440546.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "35894"
},
{
"name": "C",
"bytes": "56048"
},
{
"name": "C++",
"bytes": "90880"
},
{
"name": "HTML",
"bytes": "11656"
},
{
"name": "Java",
"bytes": "57468"
},
{
"name": "JavaScript",
"bytes": "181218"
},
{
"name": "PHP",
"bytes": "250144"
},
{
"name": "Perl",
"bytes": "37296"
},
{
"name": "Perl 6",
"bytes": "9914"
},
{
"name": "Python",
"bytes": "17387779"
},
{
"name": "Ruby",
"bytes": "40233"
},
{
"name": "Shell",
"bytes": "190732"
},
{
"name": "Tcl",
"bytes": "674650"
}
],
"symlink_target": ""
} |
import os
from datetime import datetime
from airflow import DAG
from airflow.operators.dummy import DummyOperator
DEFAULT_DATE = datetime(2016, 1, 1)
args = {
'owner': 'airflow',
'start_date': DEFAULT_DATE,
}
dag = DAG(dag_id='test_om_failure_callback_dag', default_args=args)
def write_data_to_callback(*arg, **kwargs):
with open(os.environ.get('AIRFLOW_CALLBACK_FILE'), "w+") as f:
f.write("Callback fired")
task = DummyOperator(
task_id='test_om_failure_callback_task', dag=dag, on_failure_callback=write_data_to_callback
)
| {
"content_hash": "a9eebae0ad063aa832cfab8c479717d7",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 96,
"avg_line_length": 23.291666666666668,
"alnum_prop": 0.7012522361359571,
"repo_name": "dhuang/incubator-airflow",
"id": "9ff14bd205194ed040235173e39b8cc7d36a9ff6",
"size": "1345",
"binary": false,
"copies": "4",
"ref": "refs/heads/main",
"path": "tests/dags/test_on_failure_callback.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "109698"
},
{
"name": "HTML",
"bytes": "264851"
},
{
"name": "JavaScript",
"bytes": "1988427"
},
{
"name": "Mako",
"bytes": "1037"
},
{
"name": "Python",
"bytes": "3357958"
},
{
"name": "Shell",
"bytes": "34442"
}
],
"symlink_target": ""
} |
import sys
import urllib
import re
import urllib2
import json
import time
import functools
import os
from collections import namedtuple
from datetime import datetime, time, timedelta
from flask import Flask, request, session, render_template, jsonify, redirect
from flask.ext.sqlalchemy import SQLAlchemy
import requests
from pyquery import PyQuery
import praw
import pytz
import tasks
import settings
app = Flask(__name__)
app.secret_key = settings.SECRET_KEY
#app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///games.db'
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['DATABASE_URL']
db = SQLAlchemy(app)
r = praw.Reddit('OAuth Webserver example by u/catmoon ver 0.1.')
r.set_oauth_app_info(settings.CLIENT_ID, settings.CLIENT_SECRET, settings.REDIRECT_URI)
Game = namedtuple("Game", ["date","game_id","home","visitor","title"])
class Gamedb(db.Model):
id = db.Column(db.Integer, primary_key=True)
date = db.Column(db.String(80), unique=False)
#make game_id unique=True to prevent multiple game threads!
game_id = db.Column(db.String(80), unique=False)
home = db.Column(db.String(80), unique=False)
visitor = db.Column(db.String(80), unique=False)
title = db.Column(db.String(120), unique=False)
username = db.Column(db.String(80), unique=False)
access_token = db.Column(db.String(80), unique=False)
refresh_token = db.Column(db.String(80), unique=False)
thread_id = db.Column(db.String(80), unique=False)
def __init__(self, date, game_id, home, visitor, title, username, access_token, refresh_token, thread_id):
self.date = date
self.game_id = game_id
self.home = home
self.visitor = visitor
self.title = title
self.username = username
self.access_token = access_token
self.refresh_token = refresh_token
self.thread_id = thread_id
def __repr__(self):
#make this give more data
return '<User %r>' % self.game_id
def create_data():
""" A helper function to create our tables and some Todo objects.
"""
db.create_all()
db.session.commit()
def load_schedule():
response = urllib2.urlopen('http://data.nba.com/5s/json/cms/noseason/scoreboard/'+datetime.now(pytz.timezone('US/Pacific')).strftime("%Y%m%d")+'/games.json')
jdata = json.load(response)
games = jdata['sports_content']['games']['game']
schedule = []
time = str(datetime.now())
for game in games:
home=game['home']['city']
visitor=game['visitor']['city']
game_id=game['id']
date=game['home_start_date']
date_obj = datetime.strptime(date, "%Y%m%d")
date_formatted = date_obj.strftime("%b. %d, %Y")
title = "GAME THREAD: " + visitor + " @ " + home + " - (" + date_formatted + ")"
schedule.append(Game(date,game_id,home,visitor,title))
return schedule
GAMES = load_schedule()
@app.route("/")
def home():
panel_styles = ["opacity:1.0;","opacity:0.5;"]
link = r.get_authorize_url('DifferentUniqueKey',{'identity','edit','submit'},refreshable=True)
return render_template("home.html", games=GAMES, auth_link=link, user="not authenticated",style1=panel_styles)
@app.route('/authorize_callback')
def authorized():
code = request.args.get('code', '')
info = r.get_access_information(code)
r.set_access_credentials(**info)
authenticated_user = r.get_me()
user = r.get_me()
session['access_token'] = info['access_token']
session['refresh_token'] = info['refresh_token']
session['username'] = user.name
user_text = "Authenticated as: "+user.name
panel_styles = ["opacity:1.0;","opacity:1.0;"]
return render_template("home.html",games=GAMES,user=user_text, style1=panel_styles)
@app.route("/generate/", methods=["POST"])
def generate():
panel_styles = ["opacity:1.0;","opacity:1.0;"]
thread_title = request.form["games"]
if thread_title == "":
alert_message = 'Please select an event.'
return render_template("home.html",games=GAMES, alert=alert_message,style1=panel_styles)
else:
for game in GAMES:
if game.title == thread_title:
match_game = game
try:
thread_id = create_thread(match_game, session['access_token'],session['refresh_token'])
redirect_url = "http://www.reddit.com/"+thread_id
game = Gamedb(match_game.date,
match_game.game_id,
match_game.home,
match_game.visitor,
match_game.title,
session['username'],
session['access_token'],
session['refresh_token'],
thread_id)
#print game
db.session.add(game)
db.session.commit()
return redirect(redirect_url, code=302)
except:
alert_message = "Oops. There was an error creating the thread."
return render_template("home.html",games=GAMES, alert=alert_message,style1=panel_styles)
def create_thread(game, access_token, refresh_token):
game_json = tasks.load_game_json(game)
thread = "Location: "+game_json['arena']+" in "+game_json['city']+", "+game_json['state']+"\n\n"
#thread = thread+"TV: "+game['broadcasters']['tv']['broadcaster']['display_name']+"\n\n"
thread = thread + """
##Thread notes\n
[Live chat](http://webchat.freenode.net/?channels=r/NBA&uio=MTE9MjQ255/)
[Reddit Stream](http://nba-gamethread.herokuapp.com/reddit-stream/) (You must click this link from the comment page.)
"""
info = {'access_token':access_token,'scope':{'identity','edit','submit'},'refresh_token':refresh_token}
r.set_access_credentials(**info)
submission = r.submit('catmoon', game.title, text=thread)
thread_id = submission.id
#match = re.search("comments/(.*)/g",str(submission))
#thread_id = match.groups()[0]
return thread_id
if __name__ == '__main__':
if '-c' in sys.argv:
create_data()
else:
app.run(debug=True, port=65010)
| {
"content_hash": "19a9500c3e8e19275a70d219d9470c7e",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 161,
"avg_line_length": 35.29142857142857,
"alnum_prop": 0.6224093264248705,
"repo_name": "asmoore/nba_gamethread_generator",
"id": "3ada73fd70a513da1db8f11a29e67f2b1a1b3f4b",
"size": "6229",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "14427"
},
{
"name": "Python",
"bytes": "15031"
}
],
"symlink_target": ""
} |
"""Support for IKEA Tradfri switches."""
from homeassistant.components.switch import SwitchEntity
from .base_class import TradfriBaseDevice
from .const import CONF_GATEWAY_ID, DEVICES, DOMAIN, KEY_API
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Load Tradfri switches based on a config entry."""
gateway_id = config_entry.data[CONF_GATEWAY_ID]
tradfri_data = hass.data[DOMAIN][config_entry.entry_id]
api = tradfri_data[KEY_API]
devices = tradfri_data[DEVICES]
switches = [dev for dev in devices if dev.has_socket_control]
if switches:
async_add_entities(
TradfriSwitch(switch, api, gateway_id) for switch in switches
)
class TradfriSwitch(TradfriBaseDevice, SwitchEntity):
"""The platform class required by Home Assistant."""
def __init__(self, device, api, gateway_id):
"""Initialize a switch."""
super().__init__(device, api, gateway_id)
self._attr_unique_id = f"{gateway_id}-{device.id}"
def _refresh(self, device):
"""Refresh the switch data."""
super()._refresh(device)
# Caching of switch control and switch object
self._device_control = device.socket_control
self._device_data = device.socket_control.sockets[0]
@property
def is_on(self):
"""Return true if switch is on."""
return self._device_data.state
async def async_turn_off(self, **kwargs):
"""Instruct the switch to turn off."""
await self._api(self._device_control.set_state(False))
async def async_turn_on(self, **kwargs):
"""Instruct the switch to turn on."""
await self._api(self._device_control.set_state(True))
| {
"content_hash": "a3dc8e5ed711fd55ca03bb917cfbda06",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 73,
"avg_line_length": 35.02040816326531,
"alnum_prop": 0.6567599067599068,
"repo_name": "Danielhiversen/home-assistant",
"id": "00e15f1b875a83571a1da2324b9a3d879ab9ec36",
"size": "1716",
"binary": false,
"copies": "1",
"ref": "refs/heads/dev",
"path": "homeassistant/components/tradfri/switch.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "2443"
},
{
"name": "Python",
"bytes": "36870185"
},
{
"name": "Shell",
"bytes": "4910"
}
],
"symlink_target": ""
} |
import os
import sys
import expsystem as es
class RegionServers:
def __init__(self, regionservers):
self.servers = regionservers
def save(self, config):
with open(os.path.join(config, 'regionservers'), 'w') as outfile:
for h in self.servers:
outfile.write(h + "\n")
class HBaseConfig:
def __init__(self, data):
self.rootdir = "/hbase-test-" + es.getuser()
self.param = data.get('param', {})
self.master = data['master']
self.namenode = data.get('namenode', self.master)
self.regionservers = data['regionservers'].split(',')
# 3 servers including master node
self.zookeepers = [self.master] + [x for x in self.regionservers if x != self.master][:2]
def save(self, dir):
conf = os.path.join(dir, 'config')
es.cleandir(conf)
# save config/regionservers
RegionServers(self.regionservers).save(conf)
self.save_hbase_site(conf, dir)
def save_hbase_site(self, conf, dir = None):
with open(os.path.join(conf, 'hbase-site.xml'), 'w') as outfile:
outfile.write("<configuration>\n")
self.writeproperty(outfile, 'hbase.cluster.distributed', 'true')
self.writeproperty(outfile, 'hbase.master', "{0}:60000".format(self.master))
self.writeproperty(outfile, 'hbase.rootdir',
"hdfs://{0}:9000".format(self.namenode) + self.rootdir)
self.writeproperty(outfile, 'hbase.zookeeper.property.clientPort', 2181)
self.writeproperty(outfile, 'hbase.zookeeper.quorum', ",".join(self.zookeepers))
if (dir is not None):
self.writeproperty(outfile, 'hbase.zookeeper.property.dataDir',
os.path.join(dir, 'zookeeper'))
self.writeproperty(outfile, 'hbase.tmp.dir', dir)
for (k, v) in self.param.items():
self.writeproperty(outfile, k, v)
outfile.write("</configuration>\n")
def writeproperty(self, out, name, value):
out.write(" <property>\n")
out.write(" <name>{0}</name>\n".format(name))
out.write(" <value>{0}</value>\n".format(value))
out.write(" </property>\n")
def isMaster(self, host):
return self.master == host
| {
"content_hash": "cbf4b2ce9c3a515093ef3f9208653331",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 97,
"avg_line_length": 44.320754716981135,
"alnum_prop": 0.5823754789272031,
"repo_name": "tatemura/strudel",
"id": "ea85f3b5bac04d532fe3b50ee8ba5045723299b6",
"size": "2368",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "exp/cluster/bin/hbaseconfig.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1703061"
},
{
"name": "Python",
"bytes": "29516"
},
{
"name": "Shell",
"bytes": "3337"
}
],
"symlink_target": ""
} |
import pytest
from DelineaDSV import Client, dsv_secret_get_command
from test_data.context import SECRET_GET_ARGS_CONTEXT
from test_data.http_responses import SECRET_GET_ARGS_RAW_RESPONSE
SECRET_GET_ARGS = {"name": "accounts/xsoar"}
@pytest.mark.parametrize('command, args, http_response, context', [
(dsv_secret_get_command, SECRET_GET_ARGS, SECRET_GET_ARGS_RAW_RESPONSE,
SECRET_GET_ARGS_CONTEXT)
])
def test_delinea_commands(command, args, http_response, context, mocker):
mocker.patch.object(Client, '_generate_token')
client = Client(server_url="https://example.com", client_id="example",
client_secret="test@123", provider="Local Login",
proxy=False, verify=False)
mocker.patch.object(Client, '_http_request', return_value=http_response)
outputs = command(client, **args)
results = outputs.to_context()
assert results.get("EntryContext") == context
| {
"content_hash": "f8645cb91261a39524bf44b4f08086f4",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 76,
"avg_line_length": 36.96153846153846,
"alnum_prop": 0.6826222684703434,
"repo_name": "demisto/content",
"id": "3c4d0326b054356095941a70862b84e042a7eb91",
"size": "961",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Packs/DelineaDSV/Integrations/DelineaDSV/DelineaDSV_test.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "2146"
},
{
"name": "HTML",
"bytes": "205901"
},
{
"name": "JavaScript",
"bytes": "1584075"
},
{
"name": "PowerShell",
"bytes": "442288"
},
{
"name": "Python",
"bytes": "47881712"
},
{
"name": "Rich Text Format",
"bytes": "480911"
},
{
"name": "Shell",
"bytes": "108066"
},
{
"name": "YARA",
"bytes": "1185"
}
],
"symlink_target": ""
} |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "python-bitmarkrpc"))
from decimal import Decimal
import json
import shutil
import subprocess
import time
from bitmarkrpc.authproxy import AuthServiceProxy, JSONRPCException
from util import *
START_P2P_PORT=11000
START_RPC_PORT=11100
def check_json_precision():
"""Make sure json library being used does not lose precision converting BTM values"""
n = Decimal("20000000.00000003")
satoshis = int(json.loads(json.dumps(float(n)))*1.0e8)
if satoshis != 2000000000000003:
raise RuntimeError("JSON encode/decode loses precision")
def sync_blocks(rpc_connections):
"""
Wait until everybody has the same block count
"""
while True:
counts = [ x.getblockcount() for x in rpc_connections ]
if counts == [ counts[0] ]*len(counts):
break
time.sleep(1)
def sync_mempools(rpc_connections):
"""
Wait until everybody has the same transactions in their memory
pools
"""
while True:
pool = set(rpc_connections[0].getrawmempool())
num_match = 1
for i in range(1, len(rpc_connections)):
if set(rpc_connections[i].getrawmempool()) == pool:
num_match = num_match+1
if num_match == len(rpc_connections):
break
time.sleep(1)
gamecreditsd_processes = []
def initialize_chain(test_dir):
"""
Create (or copy from cache) a 200-block-long chain and
4 wallets.
gamecreditsd and gamecredits-cli must be in search path.
"""
if not os.path.isdir(os.path.join("cache", "node0")):
devnull = open("/dev/null", "w+")
# Create cache directories, run gamecreditsds:
for i in range(4):
datadir = os.path.join("cache", "node"+str(i))
os.makedirs(datadir)
with open(os.path.join(datadir, "gamecredits.conf"), 'w') as f:
f.write("regtest=1\n");
f.write("rpcuser=rt\n");
f.write("rpcpassword=rt\n");
f.write("port="+str(START_P2P_PORT+i)+"\n");
f.write("rpcport="+str(START_RPC_PORT+i)+"\n");
args = [ "gamecreditsd", "-keypool=1", "-datadir="+datadir ]
if i > 0:
args.append("-connect=127.0.0.1:"+str(START_P2P_PORT))
gamecreditsd_processes.append(subprocess.Popen(args))
subprocess.check_call([ "gamecredits-cli", "-datadir="+datadir,
"-rpcwait", "getblockcount"], stdout=devnull)
devnull.close()
rpcs = []
for i in range(4):
try:
url = "http://rt:[email protected]:%d"%(START_RPC_PORT+i,)
rpcs.append(AuthServiceProxy(url))
except:
sys.stderr.write("Error connecting to "+url+"\n")
sys.exit(1)
# Create a 200-block-long chain; each of the 4 nodes
# gets 25 mature blocks and 25 immature.
for i in range(4):
rpcs[i].setgenerate(True, 25)
sync_blocks(rpcs)
for i in range(4):
rpcs[i].setgenerate(True, 25)
sync_blocks(rpcs)
# Shut them down, and remove debug.logs:
stop_nodes(rpcs)
wait_gamecreditsds()
for i in range(4):
os.remove(debug_log("cache", i))
for i in range(4):
from_dir = os.path.join("cache", "node"+str(i))
to_dir = os.path.join(test_dir, "node"+str(i))
shutil.copytree(from_dir, to_dir)
def start_nodes(num_nodes, dir):
# Start gamecreditsds, and wait for RPC interface to be up and running:
devnull = open("/dev/null", "w+")
for i in range(num_nodes):
datadir = os.path.join(dir, "node"+str(i))
args = [ "gamecreditsd", "-datadir="+datadir ]
gamecreditsd_processes.append(subprocess.Popen(args))
subprocess.check_call([ "gamecredits-cli", "-datadir="+datadir,
"-rpcwait", "getblockcount"], stdout=devnull)
devnull.close()
# Create&return JSON-RPC connections
rpc_connections = []
for i in range(num_nodes):
url = "http://rt:[email protected]:%d"%(START_RPC_PORT+i,)
rpc_connections.append(AuthServiceProxy(url))
return rpc_connections
def debug_log(dir, n_node):
return os.path.join(dir, "node"+str(n_node), "regtest", "debug.log")
def stop_nodes(nodes):
for i in range(len(nodes)):
nodes[i].stop()
del nodes[:] # Emptying array closes connections as a side effect
def wait_gamecreditsds():
# Wait for all gamecreditsds to cleanly exit
for gamecreditsd in gamecreditsd_processes:
gamecreditsd.wait()
del gamecreditsd_processes[:]
def connect_nodes(from_connection, node_num):
ip_port = "127.0.0.1:"+str(START_P2P_PORT+node_num)
from_connection.addnode(ip_port, "onetry")
def assert_equal(thing1, thing2):
if thing1 != thing2:
raise AssertionError("%s != %s"%(str(thing1),str(thing2)))
| {
"content_hash": "410170d7c0106c9bc3d908f4109b1dfe",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 94,
"avg_line_length": 35.083333333333336,
"alnum_prop": 0.5948139350752177,
"repo_name": "MarkPfennig/gamecredits",
"id": "8793ef8789aacfcd13e7aa35af796e942110e3f5",
"size": "5336",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "qa/rpc-tests/util.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "51766"
},
{
"name": "C++",
"bytes": "3082162"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "HTML",
"bytes": "50620"
},
{
"name": "Makefile",
"bytes": "8009"
},
{
"name": "Objective-C",
"bytes": "1125"
},
{
"name": "Objective-C++",
"bytes": "6466"
},
{
"name": "Protocol Buffer",
"bytes": "2308"
},
{
"name": "Python",
"bytes": "110593"
},
{
"name": "QMake",
"bytes": "2019"
},
{
"name": "Shell",
"bytes": "45567"
}
],
"symlink_target": ""
} |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Hoverlabel(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scatter3d"
_path_str = "scatter3d.hoverlabel"
_valid_props = {
"align",
"alignsrc",
"bgcolor",
"bgcolorsrc",
"bordercolor",
"bordercolorsrc",
"font",
"namelength",
"namelengthsrc",
}
# align
# -----
@property
def align(self):
"""
Sets the horizontal alignment of the text content within hover
label box. Has an effect only if the hover label text spans
more two or more lines
The 'align' property is an enumeration that may be specified as:
- One of the following enumeration values:
['left', 'right', 'auto']
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
Any|numpy.ndarray
"""
return self["align"]
@align.setter
def align(self, val):
self["align"] = val
# alignsrc
# --------
@property
def alignsrc(self):
"""
Sets the source reference on Chart Studio Cloud for align .
The 'alignsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["alignsrc"]
@alignsrc.setter
def alignsrc(self, val):
self["alignsrc"] = val
# bgcolor
# -------
@property
def bgcolor(self):
"""
Sets the background color of the hover labels for this trace
The 'bgcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
- A list or array of any of the above
Returns
-------
str|numpy.ndarray
"""
return self["bgcolor"]
@bgcolor.setter
def bgcolor(self, val):
self["bgcolor"] = val
# bgcolorsrc
# ----------
@property
def bgcolorsrc(self):
"""
Sets the source reference on Chart Studio Cloud for bgcolor .
The 'bgcolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["bgcolorsrc"]
@bgcolorsrc.setter
def bgcolorsrc(self, val):
self["bgcolorsrc"] = val
# bordercolor
# -----------
@property
def bordercolor(self):
"""
Sets the border color of the hover labels for this trace.
The 'bordercolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
- A list or array of any of the above
Returns
-------
str|numpy.ndarray
"""
return self["bordercolor"]
@bordercolor.setter
def bordercolor(self, val):
self["bordercolor"] = val
# bordercolorsrc
# --------------
@property
def bordercolorsrc(self):
"""
Sets the source reference on Chart Studio Cloud for
bordercolor .
The 'bordercolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["bordercolorsrc"]
@bordercolorsrc.setter
def bordercolorsrc(self, val):
self["bordercolorsrc"] = val
# font
# ----
@property
def font(self):
"""
Sets the font used in hover labels.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.scatter3d.hoverlabel.Font`
- A dict of string/value properties that will be passed
to the Font constructor
Supported dict properties:
color
colorsrc
Sets the source reference on Chart Studio Cloud
for color .
family
HTML font family - the typeface that will be
applied by the web browser. The web browser
will only be able to apply a font if it is
available on the system which it operates.
Provide multiple font families, separated by
commas, to indicate the preference in which to
apply fonts if they aren't available on the
system. The Chart Studio Cloud (at
https://chart-studio.plotly.com or on-premise)
generates images on a server, where only a
select number of fonts are installed and
supported. These include "Arial", "Balto",
"Courier New", "Droid Sans",, "Droid Serif",
"Droid Sans Mono", "Gravitas One", "Old
Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
familysrc
Sets the source reference on Chart Studio Cloud
for family .
size
sizesrc
Sets the source reference on Chart Studio Cloud
for size .
Returns
-------
plotly.graph_objs.scatter3d.hoverlabel.Font
"""
return self["font"]
@font.setter
def font(self, val):
self["font"] = val
# namelength
# ----------
@property
def namelength(self):
"""
Sets the default length (in number of characters) of the trace
name in the hover labels for all traces. -1 shows the whole
name regardless of length. 0-3 shows the first 0-3 characters,
and an integer >3 will show the whole name if it is less than
that many characters, but if it is longer, will truncate to
`namelength - 3` characters and add an ellipsis.
The 'namelength' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [-1, 9223372036854775807]
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|numpy.ndarray
"""
return self["namelength"]
@namelength.setter
def namelength(self, val):
self["namelength"] = val
# namelengthsrc
# -------------
@property
def namelengthsrc(self):
"""
Sets the source reference on Chart Studio Cloud for namelength
.
The 'namelengthsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["namelengthsrc"]
@namelengthsrc.setter
def namelengthsrc(self, val):
self["namelengthsrc"] = val
# Self properties description
# ---------------------------
@property
def _prop_descriptions(self):
return """\
align
Sets the horizontal alignment of the text content
within hover label box. Has an effect only if the hover
label text spans more two or more lines
alignsrc
Sets the source reference on Chart Studio Cloud for
align .
bgcolor
Sets the background color of the hover labels for this
trace
bgcolorsrc
Sets the source reference on Chart Studio Cloud for
bgcolor .
bordercolor
Sets the border color of the hover labels for this
trace.
bordercolorsrc
Sets the source reference on Chart Studio Cloud for
bordercolor .
font
Sets the font used in hover labels.
namelength
Sets the default length (in number of characters) of
the trace name in the hover labels for all traces. -1
shows the whole name regardless of length. 0-3 shows
the first 0-3 characters, and an integer >3 will show
the whole name if it is less than that many characters,
but if it is longer, will truncate to `namelength - 3`
characters and add an ellipsis.
namelengthsrc
Sets the source reference on Chart Studio Cloud for
namelength .
"""
def __init__(
self,
arg=None,
align=None,
alignsrc=None,
bgcolor=None,
bgcolorsrc=None,
bordercolor=None,
bordercolorsrc=None,
font=None,
namelength=None,
namelengthsrc=None,
**kwargs
):
"""
Construct a new Hoverlabel object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.scatter3d.Hoverlabel`
align
Sets the horizontal alignment of the text content
within hover label box. Has an effect only if the hover
label text spans more two or more lines
alignsrc
Sets the source reference on Chart Studio Cloud for
align .
bgcolor
Sets the background color of the hover labels for this
trace
bgcolorsrc
Sets the source reference on Chart Studio Cloud for
bgcolor .
bordercolor
Sets the border color of the hover labels for this
trace.
bordercolorsrc
Sets the source reference on Chart Studio Cloud for
bordercolor .
font
Sets the font used in hover labels.
namelength
Sets the default length (in number of characters) of
the trace name in the hover labels for all traces. -1
shows the whole name regardless of length. 0-3 shows
the first 0-3 characters, and an integer >3 will show
the whole name if it is less than that many characters,
but if it is longer, will truncate to `namelength - 3`
characters and add an ellipsis.
namelengthsrc
Sets the source reference on Chart Studio Cloud for
namelength .
Returns
-------
Hoverlabel
"""
super(Hoverlabel, self).__init__("hoverlabel")
if "_parent" in kwargs:
self._parent = kwargs["_parent"]
return
# Validate arg
# ------------
if arg is None:
arg = {}
elif isinstance(arg, self.__class__):
arg = arg.to_plotly_json()
elif isinstance(arg, dict):
arg = _copy.copy(arg)
else:
raise ValueError(
"""\
The first argument to the plotly.graph_objs.scatter3d.Hoverlabel
constructor must be a dict or
an instance of :class:`plotly.graph_objs.scatter3d.Hoverlabel`"""
)
# Handle skip_invalid
# -------------------
self._skip_invalid = kwargs.pop("skip_invalid", False)
self._validate = kwargs.pop("_validate", True)
# Populate data dict with properties
# ----------------------------------
_v = arg.pop("align", None)
_v = align if align is not None else _v
if _v is not None:
self["align"] = _v
_v = arg.pop("alignsrc", None)
_v = alignsrc if alignsrc is not None else _v
if _v is not None:
self["alignsrc"] = _v
_v = arg.pop("bgcolor", None)
_v = bgcolor if bgcolor is not None else _v
if _v is not None:
self["bgcolor"] = _v
_v = arg.pop("bgcolorsrc", None)
_v = bgcolorsrc if bgcolorsrc is not None else _v
if _v is not None:
self["bgcolorsrc"] = _v
_v = arg.pop("bordercolor", None)
_v = bordercolor if bordercolor is not None else _v
if _v is not None:
self["bordercolor"] = _v
_v = arg.pop("bordercolorsrc", None)
_v = bordercolorsrc if bordercolorsrc is not None else _v
if _v is not None:
self["bordercolorsrc"] = _v
_v = arg.pop("font", None)
_v = font if font is not None else _v
if _v is not None:
self["font"] = _v
_v = arg.pop("namelength", None)
_v = namelength if namelength is not None else _v
if _v is not None:
self["namelength"] = _v
_v = arg.pop("namelengthsrc", None)
_v = namelengthsrc if namelengthsrc is not None else _v
if _v is not None:
self["namelengthsrc"] = _v
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False
| {
"content_hash": "cb4a0119a4e38ad01cea79ddd9db2b1b",
"timestamp": "",
"source": "github",
"line_count": 503,
"max_line_length": 82,
"avg_line_length": 35.49304174950298,
"alnum_prop": 0.5529602867865345,
"repo_name": "plotly/python-api",
"id": "66e7cc8cf3f859994283a037f6a298473ee25464",
"size": "17853",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "packages/python/plotly/plotly/graph_objs/scatter3d/_hoverlabel.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "6870"
},
{
"name": "Makefile",
"bytes": "1708"
},
{
"name": "Python",
"bytes": "823245"
},
{
"name": "Shell",
"bytes": "3238"
}
],
"symlink_target": ""
} |
"""Certificate chain where the root certificate is not self-signed (or
self-issued for that matter)."""
import sys
sys.path += ['../..']
import gencerts
shadow_root = gencerts.create_self_signed_root_certificate('ShadowRoot')
# Non-self-signed root certificate.
root = gencerts.create_intermediate_certificate('Root', shadow_root)
# Intermediate certificate.
intermediate = gencerts.create_intermediate_certificate('Intermediate', root)
# Target certificate.
target = gencerts.create_end_entity_certificate('Target', intermediate)
chain = [target, intermediate, root]
gencerts.write_chain(__doc__, chain, 'chain.pem')
| {
"content_hash": "268045a3c0a655abeab9ca59a64ee2a2",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 77,
"avg_line_length": 29.761904761904763,
"alnum_prop": 0.76,
"repo_name": "youtube/cobalt_sandbox",
"id": "1fd1e48be006d00c109baf9a44c96c17d45b8a76",
"size": "810",
"binary": false,
"copies": "4",
"ref": "refs/heads/main",
"path": "net/data/verify_certificate_chain_unittest/non-self-signed-root/generate-chains.py",
"mode": "33261",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
import io
import os
import sys
import pickle
import subprocess
import unittest
from unittest.case import _Outcome
from unittest.test.support import (LoggingResult,
ResultWithNoStartTestRunStopTestRun)
class TestCleanUp(unittest.TestCase):
def testCleanUp(self):
class TestableTest(unittest.TestCase):
def testNothing(self):
pass
test = TestableTest('testNothing')
self.assertEqual(test._cleanups, [])
cleanups = []
def cleanup1(*args, **kwargs):
cleanups.append((1, args, kwargs))
def cleanup2(*args, **kwargs):
cleanups.append((2, args, kwargs))
test.addCleanup(cleanup1, 1, 2, 3, four='hello', five='goodbye')
test.addCleanup(cleanup2)
self.assertEqual(test._cleanups,
[(cleanup1, (1, 2, 3), dict(four='hello', five='goodbye')),
(cleanup2, (), {})])
self.assertTrue(test.doCleanups())
self.assertEqual(cleanups, [(2, (), {}), (1, (1, 2, 3), dict(four='hello', five='goodbye'))])
def testCleanUpWithErrors(self):
class TestableTest(unittest.TestCase):
def testNothing(self):
pass
test = TestableTest('testNothing')
outcome = test._outcome = _Outcome()
exc1 = Exception('foo')
exc2 = Exception('bar')
def cleanup1():
raise exc1
def cleanup2():
raise exc2
test.addCleanup(cleanup1)
test.addCleanup(cleanup2)
self.assertFalse(test.doCleanups())
self.assertFalse(outcome.success)
((_, (Type1, instance1, _)),
(_, (Type2, instance2, _))) = reversed(outcome.errors)
self.assertEqual((Type1, instance1), (Exception, exc1))
self.assertEqual((Type2, instance2), (Exception, exc2))
def testCleanupInRun(self):
blowUp = False
ordering = []
class TestableTest(unittest.TestCase):
def setUp(self):
ordering.append('setUp')
if blowUp:
raise Exception('foo')
def testNothing(self):
ordering.append('test')
def tearDown(self):
ordering.append('tearDown')
test = TestableTest('testNothing')
def cleanup1():
ordering.append('cleanup1')
def cleanup2():
ordering.append('cleanup2')
test.addCleanup(cleanup1)
test.addCleanup(cleanup2)
def success(some_test):
self.assertEqual(some_test, test)
ordering.append('success')
result = unittest.TestResult()
result.addSuccess = success
test.run(result)
self.assertEqual(ordering, ['setUp', 'test', 'tearDown',
'cleanup2', 'cleanup1', 'success'])
blowUp = True
ordering = []
test = TestableTest('testNothing')
test.addCleanup(cleanup1)
test.run(result)
self.assertEqual(ordering, ['setUp', 'cleanup1'])
def testTestCaseDebugExecutesCleanups(self):
ordering = []
class TestableTest(unittest.TestCase):
def setUp(self):
ordering.append('setUp')
self.addCleanup(cleanup1)
def testNothing(self):
ordering.append('test')
def tearDown(self):
ordering.append('tearDown')
test = TestableTest('testNothing')
def cleanup1():
ordering.append('cleanup1')
test.addCleanup(cleanup2)
def cleanup2():
ordering.append('cleanup2')
test.debug()
self.assertEqual(ordering, ['setUp', 'test', 'tearDown', 'cleanup1', 'cleanup2'])
class Test_TextTestRunner(unittest.TestCase):
"""Tests for TextTestRunner."""
def setUp(self):
# clean the environment from pre-existing PYTHONWARNINGS to make
# test_warnings results consistent
self.pythonwarnings = os.environ.get('PYTHONWARNINGS')
if self.pythonwarnings:
del os.environ['PYTHONWARNINGS']
def tearDown(self):
# bring back pre-existing PYTHONWARNINGS if present
if self.pythonwarnings:
os.environ['PYTHONWARNINGS'] = self.pythonwarnings
def test_init(self):
runner = unittest.TextTestRunner()
self.assertFalse(runner.failfast)
self.assertFalse(runner.buffer)
self.assertEqual(runner.verbosity, 1)
self.assertEqual(runner.warnings, None)
self.assertTrue(runner.descriptions)
self.assertEqual(runner.resultclass, unittest.TextTestResult)
self.assertFalse(runner.tb_locals)
def test_multiple_inheritance(self):
class AResult(unittest.TestResult):
def __init__(self, stream, descriptions, verbosity):
super(AResult, self).__init__(stream, descriptions, verbosity)
class ATextResult(unittest.TextTestResult, AResult):
pass
# This used to raise an exception due to TextTestResult not passing
# on arguments in its __init__ super call
ATextResult(None, None, 1)
def testBufferAndFailfast(self):
class Test(unittest.TestCase):
def testFoo(self):
pass
result = unittest.TestResult()
runner = unittest.TextTestRunner(stream=io.StringIO(), failfast=True,
buffer=True)
# Use our result object
runner._makeResult = lambda: result
runner.run(Test('testFoo'))
self.assertTrue(result.failfast)
self.assertTrue(result.buffer)
def test_locals(self):
runner = unittest.TextTestRunner(stream=io.StringIO(), tb_locals=True)
result = runner.run(unittest.TestSuite())
self.assertEqual(True, result.tb_locals)
def testRunnerRegistersResult(self):
class Test(unittest.TestCase):
def testFoo(self):
pass
originalRegisterResult = unittest.runner.registerResult
def cleanup():
unittest.runner.registerResult = originalRegisterResult
self.addCleanup(cleanup)
result = unittest.TestResult()
runner = unittest.TextTestRunner(stream=io.StringIO())
# Use our result object
runner._makeResult = lambda: result
self.wasRegistered = 0
def fakeRegisterResult(thisResult):
self.wasRegistered += 1
self.assertEqual(thisResult, result)
unittest.runner.registerResult = fakeRegisterResult
runner.run(unittest.TestSuite())
self.assertEqual(self.wasRegistered, 1)
def test_works_with_result_without_startTestRun_stopTestRun(self):
class OldTextResult(ResultWithNoStartTestRunStopTestRun):
separator2 = ''
def printErrors(self):
pass
class Runner(unittest.TextTestRunner):
def __init__(self):
super(Runner, self).__init__(io.StringIO())
def _makeResult(self):
return OldTextResult()
runner = Runner()
runner.run(unittest.TestSuite())
def test_startTestRun_stopTestRun_called(self):
class LoggingTextResult(LoggingResult):
separator2 = ''
def printErrors(self):
pass
class LoggingRunner(unittest.TextTestRunner):
def __init__(self, events):
super(LoggingRunner, self).__init__(io.StringIO())
self._events = events
def _makeResult(self):
return LoggingTextResult(self._events)
events = []
runner = LoggingRunner(events)
runner.run(unittest.TestSuite())
expected = ['startTestRun', 'stopTestRun']
self.assertEqual(events, expected)
def test_pickle_unpickle(self):
# Issue #7197: a TextTestRunner should be (un)pickleable. This is
# required by test_multiprocessing under Windows (in verbose mode).
stream = io.StringIO("foo")
runner = unittest.TextTestRunner(stream)
for protocol in range(2, pickle.HIGHEST_PROTOCOL + 1):
s = pickle.dumps(runner, protocol)
obj = pickle.loads(s)
# StringIO objects never compare equal, a cheap test instead.
self.assertEqual(obj.stream.getvalue(), stream.getvalue())
def test_resultclass(self):
def MockResultClass(*args):
return args
STREAM = object()
DESCRIPTIONS = object()
VERBOSITY = object()
runner = unittest.TextTestRunner(STREAM, DESCRIPTIONS, VERBOSITY,
resultclass=MockResultClass)
self.assertEqual(runner.resultclass, MockResultClass)
expectedresult = (runner.stream, DESCRIPTIONS, VERBOSITY)
self.assertEqual(runner._makeResult(), expectedresult)
def test_warnings(self):
"""
Check that warnings argument of TextTestRunner correctly affects the
behavior of the warnings.
"""
# see #10535 and the _test_warnings file for more information
def get_parse_out_err(p):
return [b.splitlines() for b in p.communicate()]
opts = dict(stdout=subprocess.PIPE, stderr=subprocess.PIPE,
cwd=os.path.dirname(__file__))
ae_msg = b'Please use assertEqual instead.'
at_msg = b'Please use assertTrue instead.'
# no args -> all the warnings are printed, unittest warnings only once
p = subprocess.Popen([sys.executable, '_test_warnings.py'], **opts)
with p:
out, err = get_parse_out_err(p)
self.assertIn(b'OK', err)
# check that the total number of warnings in the output is correct
self.assertEqual(len(out), 12)
# check that the numbers of the different kind of warnings is correct
for msg in [b'dw', b'iw', b'uw']:
self.assertEqual(out.count(msg), 3)
for msg in [ae_msg, at_msg, b'rw']:
self.assertEqual(out.count(msg), 1)
args_list = (
# passing 'ignore' as warnings arg -> no warnings
[sys.executable, '_test_warnings.py', 'ignore'],
# -W doesn't affect the result if the arg is passed
[sys.executable, '-Wa', '_test_warnings.py', 'ignore'],
# -W affects the result if the arg is not passed
[sys.executable, '-Wi', '_test_warnings.py']
)
# in all these cases no warnings are printed
for args in args_list:
p = subprocess.Popen(args, **opts)
with p:
out, err = get_parse_out_err(p)
self.assertIn(b'OK', err)
self.assertEqual(len(out), 0)
# passing 'always' as warnings arg -> all the warnings printed,
# unittest warnings only once
p = subprocess.Popen([sys.executable, '_test_warnings.py', 'always'],
**opts)
with p:
out, err = get_parse_out_err(p)
self.assertIn(b'OK', err)
self.assertEqual(len(out), 14)
for msg in [b'dw', b'iw', b'uw', b'rw']:
self.assertEqual(out.count(msg), 3)
for msg in [ae_msg, at_msg]:
self.assertEqual(out.count(msg), 1)
def testStdErrLookedUpAtInstantiationTime(self):
# see issue 10786
old_stderr = sys.stderr
f = io.StringIO()
sys.stderr = f
try:
runner = unittest.TextTestRunner()
self.assertTrue(runner.stream.stream is f)
finally:
sys.stderr = old_stderr
def testSpecifiedStreamUsed(self):
# see issue 10786
f = io.StringIO()
runner = unittest.TextTestRunner(f)
self.assertTrue(runner.stream.stream is f)
if __name__ == "__main__":
unittest.main()
| {
"content_hash": "63db694b82f1264659371d915981b2f7",
"timestamp": "",
"source": "github",
"line_count": 353,
"max_line_length": 101,
"avg_line_length": 34.03116147308782,
"alnum_prop": 0.5848663947390327,
"repo_name": "MalloyPower/parsing-python",
"id": "ddc498c230cc2863f26fedafa95456b0eff60a63",
"size": "12013",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "front-end/testsuite-python-lib/Python-3.6.0/Lib/unittest/test/test_runner.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1963"
},
{
"name": "Lex",
"bytes": "238458"
},
{
"name": "Makefile",
"bytes": "4513"
},
{
"name": "OCaml",
"bytes": "412695"
},
{
"name": "Python",
"bytes": "17319"
},
{
"name": "Rascal",
"bytes": "523063"
},
{
"name": "Yacc",
"bytes": "429659"
}
],
"symlink_target": ""
} |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('test_app', '0030_change_field_name'),
]
operations = [
migrations.AlterField(
model_name='secondobject',
name='uuid',
field=models.UUIDField(db_index=True, null=True),
),
]
| {
"content_hash": "954b3a84661f57145f0d133f2591e109",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 61,
"avg_line_length": 22,
"alnum_prop": 0.5767045454545454,
"repo_name": "David-Wobrock/django-fake-database-backends",
"id": "0dc289f2b89d459f97add3d945e782579ae51533",
"size": "401",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/test_project/test_app/migrations/0031_add_field_index.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "107357"
}
],
"symlink_target": ""
} |
import asyncio
import logging
from sanic import Blueprint, response
from telegram import (
Bot, InlineKeyboardButton, Update, InlineKeyboardMarkup,
KeyboardButton, ReplyKeyboardMarkup)
from rasa.core import constants
from rasa.core.channels import InputChannel
from rasa.core.channels.channel import UserMessage, OutputChannel
from rasa.core.constants import INTENT_MESSAGE_PREFIX, USER_INTENT_RESTART
logger = logging.getLogger(__name__)
class TelegramOutput(Bot, OutputChannel):
"""Output channel for Telegram"""
@classmethod
def name(cls):
return "telegram"
def __init__(self, access_token):
super(TelegramOutput, self).__init__(access_token)
async def send_text_message(self, recipient_id, message):
for message_part in message.split("\n\n"):
self.send_message(recipient_id, message_part)
async def send_image_url(self, recipient_id, image_url):
self.send_photo(recipient_id, image_url)
async def send_text_with_buttons(self, recipient_id, text,
buttons, button_type="inline", **kwargs):
"""Sends a message with keyboard.
For more information: https://core.telegram.org/bots#keyboards
:button_type inline: horizontal inline keyboard
:button_type vertical: vertical inline keyboard
:button_type custom: custom keyboard
"""
if button_type == "inline":
button_list = [[InlineKeyboardButton(s["title"],
callback_data=s["payload"])
for s in buttons]]
reply_markup = InlineKeyboardMarkup(button_list)
elif button_type == "vertical":
button_list = [[InlineKeyboardButton(s["title"],
callback_data=s["payload"])]
for s in buttons]
reply_markup = InlineKeyboardMarkup(button_list)
elif button_type == "custom":
button_list = []
for bttn in buttons:
if isinstance(bttn, list):
button_list.append([KeyboardButton(s['title'])
for s in bttn])
else:
button_list.append([KeyboardButton(bttn["title"])])
reply_markup = ReplyKeyboardMarkup(button_list,
resize_keyboard=True,
one_time_keyboard=True)
else:
logger.error('Trying to send text with buttons for unknown '
'button type {}'.format(button_type))
return
self.send_message(recipient_id, text, reply_markup=reply_markup)
class TelegramInput(InputChannel):
"""Telegram input channel"""
@classmethod
def name(cls):
return "telegram"
@classmethod
def from_credentials(cls, credentials):
if not credentials:
cls.raise_missing_credentials_exception()
return cls(credentials.get("access_token"),
credentials.get("verify"),
credentials.get("webhook_url"))
def __init__(self, access_token, verify, webhook_url, debug_mode=True):
self.access_token = access_token
self.verify = verify
self.webhook_url = webhook_url
self.debug_mode = debug_mode
@staticmethod
def _is_location(message):
return message.location
@staticmethod
def _is_user_message(message):
return message.text
@staticmethod
def _is_button(update):
return update.callback_query
def blueprint(self, on_new_message):
telegram_webhook = Blueprint('telegram_webhook', __name__)
out_channel = TelegramOutput(self.access_token)
@telegram_webhook.route("/", methods=['GET'])
async def health(request):
return response.json({"status": "ok"})
@telegram_webhook.route("/set_webhook", methods=['GET', 'POST'])
async def set_webhook(request):
s = out_channel.setWebhook(self.webhook_url)
if s:
logger.info("Webhook Setup Successful")
return response.text("Webhook setup successful")
else:
logger.warning("Webhook Setup Failed")
return response.text("Invalid webhook")
@telegram_webhook.route("/webhook", methods=['GET', 'POST'])
async def message(request):
if request.method == 'POST':
if not out_channel.get_me()['username'] == self.verify:
logger.debug("Invalid access token, check it "
"matches Telegram")
return response.text("failed")
update = Update.de_json(request.json, out_channel)
if self._is_button(update):
msg = update.callback_query.message
text = update.callback_query.data
else:
msg = update.message
if self._is_user_message(msg):
text = msg.text.replace('/bot', '')
elif self._is_location(msg):
text = ('{{"lng":{0}, "lat":{1}}}'
''.format(msg.location.longitude,
msg.location.latitude))
else:
return response.text("success")
sender_id = msg.chat.id
try:
if text == (INTENT_MESSAGE_PREFIX + USER_INTENT_RESTART):
await on_new_message(UserMessage(
text, out_channel, sender_id,
input_channel=self.name()))
await on_new_message(UserMessage(
'/start', out_channel, sender_id,
input_channel=self.name()))
else:
await on_new_message(UserMessage(
text, out_channel, sender_id,
input_channel=self.name()))
except Exception as e:
logger.error("Exception when trying to handle "
"message.{0}".format(e))
logger.debug(e, exc_info=True)
if self.debug_mode:
raise
pass
return response.text("success")
out_channel.setWebhook(self.webhook_url)
return telegram_webhook
| {
"content_hash": "3bcf5afd673ca69fcbc6d0deec850056",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 78,
"avg_line_length": 38.02857142857143,
"alnum_prop": 0.5322314049586777,
"repo_name": "RasaHQ/rasa_core",
"id": "4e0fc618d60736675de4ba0dce715c42869ce147",
"size": "6655",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "rasa/core/channels/telegram.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "705"
},
{
"name": "HTML",
"bytes": "3462"
},
{
"name": "Makefile",
"bytes": "866"
},
{
"name": "Python",
"bytes": "1065093"
},
{
"name": "Shell",
"bytes": "819"
}
],
"symlink_target": ""
} |
class GuestFS(object):
SUPPORT_CLOSE_ON_EXIT = True
SUPPORT_RETURN_DICT = True
def __init__(self, **kwargs):
if not self.SUPPORT_CLOSE_ON_EXIT and 'close_on_exit' in kwargs:
raise TypeError('close_on_exit')
if not self.SUPPORT_RETURN_DICT and 'python_return_dict' in kwargs:
raise TypeError('python_return_dict')
self._python_return_dict = kwargs.get('python_return_dict', False)
self.kwargs = kwargs
self.drives = []
self.running = False
self.closed = False
self.mounts = []
self.files = {}
self.auginit = False
self.root_mounted = False
self.backend_settings = None
def launch(self):
self.running = True
def shutdown(self):
self.running = False
self.mounts = []
self.drives = []
def set_backend_settings(self, settings):
self.backend_settings = settings
def close(self):
self.closed = True
def add_drive_opts(self, file, *args, **kwargs):
if file == "/some/fail/file":
raise RuntimeError("%s: No such file or directory", file)
self.drives.append((file, kwargs['format']))
def inspect_os(self):
return ["/dev/guestvgf/lv_root"]
def inspect_get_mountpoints(self, dev):
mountpoints = [("/home", "/dev/mapper/guestvgf-lv_home"),
("/", "/dev/mapper/guestvgf-lv_root"),
("/boot", "/dev/vda1")]
if self.SUPPORT_RETURN_DICT and self._python_return_dict:
return dict(mountpoints)
else:
return mountpoints
def mount_options(self, options, device, mntpoint):
if mntpoint == "/":
self.root_mounted = True
else:
if not self.root_mounted:
raise RuntimeError(
"mount: %s: No such file or directory" % mntpoint)
self.mounts.append((options, device, mntpoint))
def mkdir_p(self, path):
if path not in self.files:
self.files[path] = {
"isdir": True,
"gid": 100,
"uid": 100,
"mode": 0o700
}
def read_file(self, path):
if path not in self.files:
self.files[path] = {
"isdir": False,
"content": "Hello World",
"gid": 100,
"uid": 100,
"mode": 0o700
}
return self.files[path]["content"]
def write(self, path, content):
if path not in self.files:
self.files[path] = {
"isdir": False,
"content": "Hello World",
"gid": 100,
"uid": 100,
"mode": 0o700
}
self.files[path]["content"] = content
def write_append(self, path, content):
if path not in self.files:
self.files[path] = {
"isdir": False,
"content": "Hello World",
"gid": 100,
"uid": 100,
"mode": 0o700
}
self.files[path]["content"] = self.files[path]["content"] + content
def stat(self, path):
if path not in self.files:
raise RuntimeError("No such file: " + path)
return self.files[path]["mode"]
def chown(self, uid, gid, path):
if path not in self.files:
raise RuntimeError("No such file: " + path)
if uid != -1:
self.files[path]["uid"] = uid
if gid != -1:
self.files[path]["gid"] = gid
def chmod(self, mode, path):
if path not in self.files:
raise RuntimeError("No such file: " + path)
self.files[path]["mode"] = mode
def aug_init(self, root, flags):
self.auginit = True
def aug_close(self):
self.auginit = False
def aug_get(self, cfgpath):
if not self.auginit:
raise RuntimeError("Augeus not initialized")
if cfgpath == "/files/etc/passwd/root/uid":
return 0
elif cfgpath == "/files/etc/passwd/fred/uid":
return 105
elif cfgpath == "/files/etc/passwd/joe/uid":
return 110
elif cfgpath == "/files/etc/group/root/gid":
return 0
elif cfgpath == "/files/etc/group/users/gid":
return 500
elif cfgpath == "/files/etc/group/admins/gid":
return 600
raise RuntimeError("Unknown path %s", cfgpath)
| {
"content_hash": "2f05bb2e06135534acc79ba2f33d1b18",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 75,
"avg_line_length": 30.06578947368421,
"alnum_prop": 0.5115973741794311,
"repo_name": "saleemjaveds/https-github.com-openstack-nova",
"id": "a3933f1063938a6a621bc60df65674f00685715b",
"size": "5179",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "nova/tests/virt/disk/vfs/fakeguestfs.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "14935646"
},
{
"name": "Shell",
"bytes": "18352"
}
],
"symlink_target": ""
} |
from django.template import TemplateDoesNotExist
from django.conf import settings
from courant.core.pages.models import Page
from courant.core.pages.views import render_page
class TemplatePagesMiddleware(object):
#Heavily adapted from the Django flatpage middleware - http://code.djangoproject.com/browser/django/trunk/django/contrib/flatpages/middleware.py
def process_response(self, request, response):
if response.status_code not in [404,500]:
return response # No need to check for a flatpage for non-404 responses.
# Try and render the page
try:
url = request.path_info if request.path_info[-1] != '/' else request.path_info[1:-1]
return render_page(request, url)
# If the page doesn't exist, return the response
except (Page.DoesNotExist, TemplateDoesNotExist):
return response
# If it's another error and we're in DEBUG, raise the error, or just return the response
except:
if settings.DEBUG:
raise
return response | {
"content_hash": "802f7d59f8f5bd952ab608bb3d821b3a",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 148,
"avg_line_length": 44.04,
"alnum_prop": 0.6666666666666666,
"repo_name": "maxcutler/Courant-News",
"id": "5451b80739bab7074862264835b687fea417101a",
"size": "1101",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "courant/core/pages/middleware.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "JavaScript",
"bytes": "47452"
},
{
"name": "Python",
"bytes": "487441"
}
],
"symlink_target": ""
} |
import sys
import os
import re
#from string import join, strip
import shutil
import subprocess
import traceback
import time
from datetime import datetime
from optparse import OptionParser, OptionGroup, Option
from fnmatch import fnmatch
import glob
import getpass
import json
from .utils import LogFile, colorprinter
from klab.cluster.cluster_interface import JobInitializationException
from klab import colortext
from klab.rosetta.input_files import LoopsFile, SecondaryStructureDefinition
from klab.fs.fsio import read_file, write_temp_file
from klab.bio.pdb import PDB
from klab.bio.rcsb import retrieve_pdb
from klab.general.strutil import parse_range_pairs
#################
# Configuration
# Choose the Python classes for your type of cluster system
from klab.bio.fragments.hpc import SGE as ClusterEngine
#
#################
#################
# Constants
ERRCODE_ARGUMENTS = 1
ERRCODE_CLUSTER = 2
ERRCODE_OLDRESULTS = 3
ERRCODE_CONFIG = 4
ERRCODE_NOOUTPUT = 5
ERRCODE_JOBFAILED = 6
ERRCODE_MISSING_FILES = 1
errcode = 0
#
#################
#################
# Fragment generation pipeline configuration
make_fragments_script = "make_fragments_QB3_cluster.pl"
test_mode = False # set this to true for running quick tests on your cluster system (you will need to adapt the cluster/[engine].py code to use this argument
logfile = LogFile("make_fragments_destinations.txt") # the logfile used for querying jobs
cluster_job_name = "fragment_generation" # optional: set this to identify your jobs on the cluster
fasta_file_wildcards = '*.fasta', '*.fasta.txt', '*.fa' # optional: set this to your preferred FASTA file extensions. This is used for finding FASTA files when specifying a directory.
pdb_file_wildcards = '*.pdb', '*.pdb.gz', '*.ent' # optional: set this to your preferred PDB file extensions. This is used for finding PDB files when specifying a directory. The .ent files are contained in mirrored versions of the PDB.
input_file_wildcards = fasta_file_wildcards + pdb_file_wildcards
#
# The location of the text file containing the names of the configuration scripts
configurationFilesLocation = "make_fragments_confs.txt" # "/netapp/home/klabqb3backrub/make_fragments/make_fragments_confs.txt"
#################
class FastaException(Exception): pass
class OptionParserWithNewlines(OptionParser):
'''Override the help section with a function which does not strip the newline characters.'''
def format_epilog(self, formatter):
return self.epilog
class MultiOption(Option):
'''From http://docs.python.org/2/library/optparse.html'''
ACTIONS = Option.ACTIONS + ("extend",)
STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",)
TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extend",)
ALWAYS_TYPED_ACTIONS = Option.ALWAYS_TYPED_ACTIONS + ("extend",)
def take_action(self, action, dest, opt, value, values, parser):
if action == "extend":
lvalue = value.split(",")
values.ensure_value(dest, []).extend(lvalue)
else:
Option.take_action(self, action, dest, opt, value, values, parser)
class JobInput(object):
def __init__(self, fasta_file, pdb_id, chain):
self.fasta_file = fasta_file
self.pdb_id = pdb_id
self.chain = chain
def get_username():
return getpass.getuser()
def write_file(filepath, contents, ftype = 'w'):
output_handle = open(filepath, ftype)
output_handle.write(contents)
output_handle.close()
def parse_args():
global errcode
errors = []
pdbpattern = re.compile("^\w{4}$")
logfile_name = logfile.getName()
script_name = os.path.split(sys.argv[0])[1]
description = '\n' + """\
*** Help ***
The output of the computation will be saved in the output directory, along with
the input FASTA file which is generated from the supplied FASTA file. To admit
queries, a log of the output directories for cluster jobs is saved in
{logfile_name} in the current directory.
The FASTA description lines must begin with '>protein_id|chain_letter'. This
information may optionally be followed by a '|' and more text.
There are a few caveats:
1. The underlying Perl script requires a 5-character ID for the sequence
identifier which is typically a PDB ID followed by a chain ID e.g. "1a2pA".
For this reason, our script expects FASTA record headers to have a form like
">xxxx|y" where xxxx is a 4-letter identifier e.g. PDB ID and y is a chain
identifier. protein_id identifier may be longer than 4 characters and
chain_letter must be a single character. However, only the first 4 characters
of the identifier are used by the script. Any information after the chain
identifier must be preceded by a '|' character.
For example, ">1A2P_001|A|some information" is a valid header but the
generated ID will be "1a2pA" (we convert PDB IDs to lowercase).
2. If you are submitting a batch job, the list of 5-character IDs generated
from the FASTA files using the method above must be unique. For example, if
you have two records ">1A2P_001|A|" and "">1A2P_002|A|" then the job will
fail. On the other hand, ">1A2P_001|A|" and "">1A2P_001|B|" is perfectly
fine and the script will output fragments for 1a2pA and 1a2pB.
3. By design, residue ID ranges are capped at chain boundaries. For example, if a
PDB has chains A (residues 1-50), B (residues 51-100), and chain C (residues 101-
150) and the user selects 9mers for the ranges 35-48 and 101-110 then, since none
of the ranges overlap with chain B - even though they will when 9mers are considered -
we will not generate any fragments for chain B. This behavior is chosen as it
seems the most intuitive/expected.
*** Examples ***
Single-sequence fragment generation:
1: {script_name} -d results /path/to/1CYO.fasta.txt
Multi-sequence fragment generation (batch job):
2: {script_name} -d results /some/path/*.fa??? /some/other/path/
Fragment generation for a specific chain:
3: {script_name} -d results /path/to/1CYO.fasta.txt -cA
Fragment generation using a loops file applied to: a) a FASTA file; b) a PDB identifier; c) a directory of FASTA/PDB files and a PDB ID, using the short/test queue:
4a: {script_name} -d results -l input/loops_file input/fragments/0001.fasta
4b: {script_name} -d results -l input/loops_file 4un3
4c: {script_name} -d results -l input/loops_file -q short.q input/fragments 4un3
*** Example secondary structure definition file***
# Comments are allowed. A line has two columns: the first specifies the residue(s),
# the second specifies the expected secondary structure using H(elix), E(xtended/sheet),
# or L(oop). The second column is case-insensitive.
#
# A single residue, any structure
1339 HEL
# An expected helix
1354-1359 H
# A helical or sheet structure
1360,1370-1380 HE
""".format(**locals())
parser = OptionParserWithNewlines(usage="usage: %prog [options] <inputs>...", version="%prog 1.1A", option_class=MultiOption)
parser.epilog = description
group = OptionGroup(parser, "Fragment generation options")
group.add_option("-N", "--nohoms", dest="nohoms", action="store_true", help="Optional. If this option is set then homologs are omitted from the search.")
group.add_option("-s", "--frag_sizes", dest="frag_sizes", help="Optional. A list of fragment sizes e.g. -s 3,6,9 specifies that 3-mer, 6-mer, and 9-mer fragments are to be generated. The default is for 3-mer and 9-mer fragments to be generated.")
group.add_option("-c", "--chain", dest="chain", help="Chain used for the fragment. This is optional so long as the FASTA file only contains one chain.", metavar="CHAIN")
group.add_option("-l", "--loops_file", dest="loops_file", help="Optional but recommended. A Rosetta loops file which will be used to select sections of the FASTA sequences from which fragments will be generated. This saves a lot of time on large sequences.")
group.add_option("-i", "--indices", dest="indices", help="Optional. A comma-separated list of ranges. A range can be a single index or a hyphenated range. For example, '10-30,66,90-93' is a valid set of indices. The indices are used to pick out parts of the supplied sequences for fragment generation and start at 1 (1-indexed). Similarly to the loops_file option, this restriction may save a lot of computational resources. If this option is used in addition to the loops_file option then the sections defined by the indices are combined with those in the loops file.")
group.add_option("--ss", dest="secondary_structure_file", help="Optional. A secondary structure definition file. This is used in postprocessing to filter out fragments which do not match the requested secondary structure.")
group.add_option("--n_frags", dest="n_frags", help="Optional. The number of fragments to generate. This must be less than the number of candidates. The default value is 200.")
group.add_option("--n_candidates", dest="n_candidates", help="Optional. The number of candidates to generate. The default value is 1000.")
group.add_option("--add_vall_files", dest="add_vall_files", help="Optional and untested. This option allows extra Vall files to be added to the run. The files must be comma-separated.")
group.add_option("--use_vall_files", dest="use_vall_files", help="Optional and untested. This option specifies that the run should use only the following Vall files. The files must be comma-separated.")
group.add_option("--add_pdbs_to_vall", dest="add_pdbs_to_vall", help="Optional and untested. This option adds extra pdb Vall files to the run. The files must be comma-separated.")
parser.add_option_group(group)
group = OptionGroup(parser, "General options")
group.add_option("-d", "--outdir", dest="outdir", help="Optional. Output directory relative to user space on netapp. Defaults to the current directory so long as that is within the user's netapp space.", metavar="OUTPUT_DIRECTORY")
group.add_option("-V", "--overwrite", dest="overwrite", action="store_true", help="Optional. If the output directory <PDBID><CHAIN> for the fragment job(s) exists, delete the current contents.")
group.add_option("-F", "--force", dest="force", action="store_true", help="Optional. Create the output directory without prompting.")
group.add_option("-M", "--email", dest="sendmail", action="store_true", help="Optional. If this option is set, an email is sent when the job finishes or fails (cluster-dependent). WARNING: On an SGE cluster, an email will be sent for each FASTA file i.e. for each task in the job array.")
group.add_option("-Z", "--nozip", dest="nozip", action="store_true", help="Optional, false by default. If this is option is set then the resulting fragments are not compressed with gzip. We compress output by default as this can reduce the output size by 90% and the resulting zipped files can be passed directly to Rosetta.")
parser.add_option_group(group)
group = OptionGroup(parser, "Cluster options")
group.add_option("-q", "--queue", dest="queue", help="Optional. Specify which cluster queue to use. Whether this option works and what this value should be will depend on your cluster architecture. Valid arguments for the QB3 SGE cluster are long.q, lab.q, and short.q. By default, no queue is specified. This may be a single value or a comma-separated list of queues. The short.q is only allowed on its own for test runs.", metavar="QUEUE_NAME")
group.add_option("-x", "--scratch", type="int", dest="scratch", help="Optional. Specifies the amount of /scratch space in GB to reserve for the job.")
group.add_option("-m", "--memfree", type="int", dest="memfree", help="Optional. Specifies the amount of RAM in GB that the job will require on the cluster. This must be at least 2GB.")
group.add_option("-r", "--runtime", type="int", dest="runtime", help="Optional. Specifies the runtime in hours that the job will require on the cluster.")
parser.add_option_group(group)
group = OptionGroup(parser, "Querying options")
group.add_option("-K", "--check", dest="check", help="Optional, needs to be fixed for batch mode. Query whether or not a job is running. It if has finished, query %s and print whether the job was successful." % logfile.getName(), metavar="JOBID")
group.add_option("-Q", "--query", dest="query", action="store_true", help="Optional, needs to be fixed for batch mode. Query the progress of the cluster job against %s and then quit." % logfile.getName())
parser.add_option_group(group)
parser.set_defaults(outdir = os.getcwd())
parser.set_defaults(overwrite = False)
parser.set_defaults(nohoms = False)
parser.set_defaults(force = False)
parser.set_defaults(query = False)
parser.set_defaults(sendmail = False)
parser.set_defaults(queue = [])
parser.set_defaults(nozip = False)
parser.set_defaults(scratch = 10)
parser.set_defaults(memfree = 40)
parser.set_defaults(runtime = 6)
parser.set_defaults(frag_sizes = '3,9')
parser.set_defaults(n_frags = '200')
parser.set_defaults(n_candidates = '1000')
parser.set_defaults(add_vall_files = '')
parser.set_defaults(use_vall_files = '')
parser.set_defaults(add_pdbs_to_vall = '')
(options, args) = parser.parse_args()
username = get_username()
# QUERY
if options.query:
ClusterEngine.query(logfile)
# CHECK
elif options.check:
if not(options.check.isdigit()):
errors.append("Please enter a valid job identifier.")
else:
# The job has finished. Check the output file.
jobID = int(options.check)
errors.extend(ClusterEngine.check(logfile, jobID, cluster_job_name))
validOptions = options.query or options.check
# Queue
if options.queue:
options.queue = sorted(set(options.queue.split(',')))
# RAM / scratch
if options.scratch < 1:
errors.append("The amount of scratch space requested must be at least 1 (GB).")
if options.memfree < 2:
errors.append("The amount of RAM requested must be at least 2 (GB).")
if options.runtime < 6:
errors.append("The requested runtime must be at least 6 (hours).")
# CHAIN
if options.chain and not (len(options.chain) == 1):
errors.append("Chain must only be one character.")
# OUTDIR
outpath = options.outdir
if outpath[0] != "/":
outpath = os.path.abspath(outpath)
outpath = os.path.normpath(outpath)
# Loops file
if options.loops_file:
if not os.path.isabs(options.loops_file):
options.loops_file = os.path.realpath(options.loops_file)
if not(os.path.exists(options.loops_file)):
errors.append('The loops file %s does not exist.' % options.loops_file)
if options.indices:
try:
options.indices = parse_range_pairs(options.indices, range_separator = '-')
except Exception as e:
errors.append('The indices argument must be a list of valid indices into the sequences for which fragments are to be generated.')
# Secondary structure file
if options.secondary_structure_file:
if not os.path.isabs(options.secondary_structure_file):
options.secondary_structure_file = os.path.realpath(options.secondary_structure_file)
if not(os.path.exists(options.secondary_structure_file)):
errors.append('The secondary structure definition file %s does not exist.' % options.secondary_structure_file)
# Fragment sizes
if options.frag_sizes:
sizes = []
try:
sizes = [s.strip() for s in options.frag_sizes.split(',') if s.strip()]
for s in sizes:
assert(s.isdigit() and (3 <= int(s) <= 20))
sizes = sorted(map(int, sizes))
except Exception as e:
errors.append('The frag_size argument must be a comma-separated list of integers between 3 and 20.')
if not sizes:
errors.append('The frag_sizes argument was not successfully parsed.')
if len(sizes) != len(set(sizes)):
errors.append('The frag_sizes argument contains duplicate values.')
else:
options.frag_sizes = sizes
# n_frags and n_candidates
if options.n_frags:
try:
assert(options.n_frags.isdigit())
options.n_frags = int(options.n_frags)
except Exception as e:
print((traceback.format_exc()))
errors.append('The n_frags argument must be an integer.')
if options.n_frags < 10:
errors.append('The n_frags argument is set to 200 by default; %d seems like a very low number.' % options.n_frags)
if options.n_candidates:
try:
assert(options.n_candidates.isdigit())
options.n_candidates = int(options.n_candidates)
except Exception as e:
print((traceback.format_exc()))
errors.append('The n_candidates argument must be an integer.')
if options.n_candidates < 100:
errors.append('The n_candidates argument is set to 1000 by default; %d seems like a very low number.' % options.n_candidates)
if options.n_frags > options.n_candidates:
errors.append('The value of n_candidates argument must be greater than the value of n_frags.')
if 'netapp' in os.getcwd():
userdir = os.path.join("/netapp/home", username)
if os.path.commonprefix([userdir, outpath]) != userdir:
errors.append("Please enter an output directory inside your netapp space (-d option).")
else:
if not os.path.exists(outpath):
createDir = options.force
if not createDir:
answer = ""
colorprinter.prompt("Output path '%(outpath)s' does not exist. Create it now with 755 permissions (y/n)?" % vars())
while answer not in ['Y', 'N']:
colorprinter.prompt()
answer = sys.stdin.readline().upper().strip()
if answer == 'Y':
createDir = True
else:
errors.append("Output directory '%s' does not exist." % outpath)
if createDir:
try:
os.makedirs(outpath, 0o755)
except Exception as e:
errors.append(str(e))
errors.append(traceback.format_exc())
# ARGUMENTS
batch_files = []
missing_files = []
temp_files = []
if len(args) == 0:
errors.append('No input files were specified.')
else:
for batch_file_selector in args:
if '*' in batch_file_selector or '?' in batch_file_selector:
batch_files += list(map(os.path.abspath, glob.glob(batch_file_selector)))
elif os.path.isdir(batch_file_selector):
for input_file_wildcard in input_file_wildcards:
batch_files += list(map(os.path.abspath, glob.glob(os.path.join(batch_file_selector, input_file_wildcard))))
elif not os.path.exists(batch_file_selector):
if len(batch_file_selector) == 4 and batch_file_selector.isalnum():
batch_file_selector = batch_file_selector.lower() # the files are named in lowercase on the cluster
if not os.path.exists('/netapp/database'):
# This script is not being run on the cluster - try to retrieve the file from the RCSB
colortext.message('No file %s exists - assuming that this is a PDB ID and trying to retrieve the associated file from the RCSB.' % batch_file_selector)
try:
fname = write_temp_file('/tmp', retrieve_pdb(batch_file_selector), suffix = '.pdb', prefix = batch_file_selector)
batch_files.append(os.path.abspath(fname))
temp_files.append(os.path.abspath(fname))
except:
errors.append('An error occurred retrieving the PDB file "%s".' % batch_file_selector)
else:
# We are on the cluster so try to retrieve the stored file
colortext.message('No file %s exists - assuming that this is a PDB ID and trying to retrieve the associated file from the cluster mirror of the PDB database.' % batch_file_selector)
if os.path.exists('/netapp/database/pdb/remediated/uncompressed_files/pdb%s.ent' % batch_file_selector):
batch_files.append('/netapp/database/pdb/remediated/uncompressed_files/pdb%s.ent' % batch_file_selector)
elif os.path.exists('/netapp/database/pdb/pre-remediated/uncompressed_files/pdb%s.ent' % batch_file_selector):
batch_files.append('/netapp/database/pdb/pre-remediated/uncompressed_files/pdb%s.ent' % batch_file_selector)
else:
errors.append('Could not find a PDB file for argument "%s".' % batch_file_selector)
missing_files.append(batch_file_selector)
else:
batch_files.append(os.path.abspath(batch_file_selector))
batch_files = list(set(batch_files))
if len(missing_files) == 1:
errors.append("Input file %s does not exist." % missing_files[0])
elif len(missing_files) > -0:
errors.append("Input files %s do not exist." % ', '.join(missing_files))
if len(batch_files) == 0:
errors.append('No input files could be found matching the arguments "%s".' % ', '.join(args))
if errors:
print_errors_and_exit(parser, errors, ERRCODE_ARGUMENTS)
job_inputs = []
job_inputs, has_segment_mapping, errors = setup_jobs(outpath, options, batch_files)
# Remove any temporary files created
for tf in temp_files:
if os.path.exists(tf):
os.remove(tf)
if errors:
print_errors_and_exit(parser, errors, ERRCODE_ARGUMENTS, not errcode)
no_homologs = ""
if options.nohoms:
no_homologs = "-nohoms"
return dict(
queue = options.queue,
sendmail = options.sendmail,
no_homologs = no_homologs,
user = username,
outpath = outpath,
jobname = cluster_job_name,
job_inputs = job_inputs,
no_zip = options.nozip,
scratch = options.scratch,
memfree = options.memfree,
runtime = options.runtime,
frag_sizes = options.frag_sizes,
n_frags = options.n_frags,
n_candidates = options.n_candidates,
add_vall_files = options.add_vall_files,
use_vall_files = options.use_vall_files,
add_pdbs_to_vall = options.add_pdbs_to_vall,
has_segment_mapping = has_segment_mapping,
)
def print_errors_and_exit(parser, errors, errcode, print_help = True):
if print_help:
parser.print_help()
errors.insert(0, '')
errors.append('')
for e in errors:
colorprinter.error(e.replace(' ', ' '))
if errcode:
sys.exit(errcode)
else:
sys.exit(ERRCODE_ARGUMENTS)
def setup_jobs(outpath, options, input_files):
''' This function sets up the jobs by creating the necessary input files as expected.
- outpath is where the output is to be stored.
- options is the optparse options object.
- input_files is a list of paths to input files.
'''
job_inputs = None
reverse_mapping = None
fasta_file_contents = {}
# Generate FASTA files for PDB inputs
# fasta_file_contents is a mapping from a file path to a pair (FASTA contents, file type). We remember the file type
# since we offset residue IDs depending on file type i.e. for FASTA files, we treat each sequence separately and do
# not renumber the fragments in postprocessing. For PDB files, however, we need to respect the order and length of
# sequences so that we renumber the fragments appropriately in postprocessing - we assume that if a PDB file is passed in
# then all chains (protein, RNA, or DNA) will be used in a Rosetta run.
for input_file in input_files:
assert(not(fasta_file_contents.get(input_file)))
if any(fnmatch(input_file, x) for x in pdb_file_wildcards):
pdb = PDB.from_filepath(input_file, strict=True)
if input_file.endswith('.pdb.gz'):
pdb.pdb_id = '.'.join(os.path.basename(input_file).split('.')[:-2])
else:
pdb.pdb_id = '.'.join(os.path.basename(input_file).split('.')[:-1])
if pdb.pdb_id.startswith('pdb') and len(pdb.pdb_id) >= 7:
# Hack to rename FASTA identifiers for pdb*.ent files which are present in mirrors of the PDB
pdb.pdb_id = pdb.pdb_id.replace('pdb', '')
fasta_file_contents[input_file] = (pdb.create_fasta(prefer_seqres_order = False), 'PDB')
else:
fasta_file_contents[input_file] = (read_file(input_file), 'FASTA')
# Extract sequences from the input FASTA files.
found_sequences, reverse_mapping, errors = get_sequences(options, fasta_file_contents)
if found_sequences:
reformat(found_sequences)
if errors:
return None, False, errors
# Discard sequences that are the wrong chain.
desired_sequences = {}
for key, sequence in found_sequences.items():
pdb_id, chain, file_name = key
if options.chain is None or chain == options.chain:
desired_sequences[key] = sequence
# Create the input FASTA and script files.
job_inputs, errors = create_inputs(options, outpath, desired_sequences)
# Create the reverse mapping file
if reverse_mapping:
segment_mapping_file = os.path.join(outpath, "segment_map.json")
colorprinter.message("Creating a reverse mapping file %s." % segment_mapping_file)
write_file(segment_mapping_file, json.dumps(reverse_mapping))
# Create the post-processing script file
post_processing_script = read_file(os.path.join(os.path.split(os.path.realpath(__file__))[0], 'post_processing.py'))
write_file(os.path.join(outpath, 'post_processing.py'), post_processing_script, 'w')
# Create the secondary structure filter file
if options.secondary_structure_file:
write_file(os.path.join(outpath, 'ss_filter.json'), json.dumps({'secondary_structure_filter' : SecondaryStructureDefinition.from_filepath(options.secondary_structure_file).data}), 'w')
return job_inputs, reverse_mapping != None, errors
def get_sequences(options, fasta_file_contents):
''' This function returns a dict mapping (pdbid, chain, file_name) tuples to sequences:
- options is the OptionParser member;
- fasta_file_contents is a map from input filenames to the associated FASTA file contents.
'''
errors = []
fasta_files_str = ", ".join(list(fasta_file_contents.keys()))
fasta_records = None
reverse_mapping = {}
try:
fasta_records, reverse_mapping = parse_FASTA_files(options, fasta_file_contents)
if not fasta_records:
errors.append("No protein sequences found in the FASTA file(s) %s." % fasta_files_str)
except Exception as e:
e = '\n'.join([l for l in (traceback.format_exc(), str('e')) if l.strip()])
errors.append("Error parsing FASTA file(s) %s:\n%s" % (fasta_files_str, str(e)))
if not fasta_records:
return None, {}, errors
colorprinter.message('Found %d protein sequence(s).' % len(fasta_records))
return fasta_records, reverse_mapping, errors
def parse_FASTA_files(options, fasta_file_contents):
''' This function iterates through each filepath in fasta_file_contents and returns a dict mapping (pdbid, chain, file_name) tuples to sequences:
- options is the OptionParser member;
- fasta_file_contents is a map from input filenames to the associated FASTA file contents.
'''
records = {}
reverse_mapping = {}
original_segment_list = []
key_location = {}
sequenceLine = re.compile("^[A-Z]+\n?$")
sequence_offsets = {}
for fasta_file_name, tagged_fasta in sorted(fasta_file_contents.items()):
# Check the tagged pair
fasta = tagged_fasta[0].strip().split('\n')
file_type = tagged_fasta[1]
assert(file_type == 'PDB' or file_type == 'FASTA')
if not fasta:
raise Exception("Empty FASTA file.")
first_line = [line for line in fasta if line.strip()][0]
if first_line[0] != '>':
raise Exception("The FASTA file %s is not formatted properly - the first non-blank line is not a description line (does not start with '>')." % fasta_file_name)
key = None
line_count = 0
record_count = 0
file_keys = []
unique_keys = {}
for line in fasta:
line_count += 1
line = line.strip()
if line:
if line[0] == '>':
record_count += 1
tokens = [t.strip() for t in line[1:].split('|') if t.strip()]
if len(tokens) < 2:
raise Exception("The description line ('%s') of record %d of %s is invalid. It must contain both a protein description and a chain identifier, separated by a pipe ('|') symbol." % (line, record_count, fasta_file_name))
if len(tokens[0]) < 4:
raise Exception("The protein description in the description line ('%s') of record %d of %s is too short. It must be at least four characters long." % (line, record_count, fasta_file_name))
if len(tokens[1]) != 1:
raise Exception("The chain identifier in the description line ('%s') of record %d of %s is the wrong length. It must be exactky one character long." % (line, record_count, fasta_file_name))
# Note: We store the PDB ID as lower-case so that the user does not have to worry about case-sensitivity here (we convert the user's PDB ID argument to lower-case as well)
key = (tokens[0].lower(), tokens[1], fasta_file_name)
sub_key = (key[0], key[1]) # this is the part of the key that we expect to be unique (the actual key)
key_location[key] = fasta_file_name
if sub_key in unique_keys:
# todo: we include the fasta_file_name in the key - should we not be checking for uniqueness w.r.t. just tokens[0][0:4].lower() and tokens[1] i.e. omitting the fasta_file_name as part of the check for a more stringent check?
raise Exception("Duplicate protein/chain identifier pair. The key %s was generated from both %s and %s. Remember that the first four characters of the protein description are concatenated with the chain letter to generate a 5-character ID which must be unique." % (key, key_location[key], fasta_file_name))
records[key] = [line]
unique_keys[sub_key] = True
file_keys.append(key)
else:
mtchs = sequenceLine.match(line)
if not mtchs:
raise FastaException("Expected a record header or sequence line at line %d." % line_count)
records[key].append(line)
offset = 0
if file_type == 'PDB':
for key in file_keys:
sequence_length = len(''.join(records[key][1:]))
sequence_offsets[key[0] + key[1]] = (offset, offset + 1, offset + sequence_length) # storing the sequence start and end residue IDs here is redundant but simplifies code later on
offset += sequence_length
# We remove non-protein chains from fragment generation although we did consider them above when determining the offsets
# as we expect them to be used in predictions
non_protein_records = []
set_of_rna_dna_codes = set(('A', 'C', 'G', 'T', 'U', 'X', 'Z'))
for key, content_lines in records.items():
mm_sequence = ''.join(content_lines[1:])
assert(re.match('^[A-Z]+$', mm_sequence)) # Allow X or Z because these may exist (X from the RCSB, Z from our input files)
if set(mm_sequence).union(set_of_rna_dna_codes) == set_of_rna_dna_codes:
non_protein_records.append(key)
for non_protein_record in non_protein_records:
del records[non_protein_record]
# If a loops file was passed in, use that to cut up the sequences and concatenate these subsequences to generate a
# shorter sequence to process. This should save a lot of time when the total length of the subsequences is considerably
# shorter than the length of the total sequence e.g. in cases where the protein has @1000 residues but we only care about
# 100 residues in particular loop regions.
# We need to sample all sequences around a loop i.e. if a sequence segment is 7 residues long at positions 13-19 and we
# require 9-mers, we must consider the segment from positions 5-27 so that all possible 9-mers are considered.
residue_offset = max(options.frag_sizes)
if options.loops_file or options.indices:
loops_definition = None
if options.loops_file:
loops_definition = LoopsFile.from_filepath(options.loops_file, ignore_whitespace = True, ignore_errors = False)
# If the user supplied more ranges of residues, use those as well
if options.indices:
if not loops_definition:
loops_definition = LoopsFile('')
for p in options.indices:
if loops_definition:
loops_definition.add(p[0], p[1])
segment_list = loops_definition.get_distinct_segments(residue_offset, residue_offset)
original_segment_list = loops_definition.get_distinct_segments(1, 1) # We are looking for 1-mers so the offset is 1 rather than 0
# Sanity checks
assert(sorted(segment_list) == segment_list) # sanity check
for x in range(len(segment_list)):
segment = segment_list[x]
if x < len(segment_list) - 1:
assert(segment[1] < segment_list[x+1][0]) # sanity check
# Create the generic reverse_mapping from the indices in the sequences defined by the segment_list to the indices in the original sequences.
# This will be used in FASTA sequences to rewrite the fragments files to make them compatible with the original sequences.
# Note that this mapping ignores the length of the sequences (which may vary in length) so it may be mapping residues indices
# which are outside of the length of some of the sequences.
# Create a sorted list of residues of the chain that we will be including in the sequence for fragment generation
# then turn that into a 1-indexed mapping from the order of the residue in the sequence to the original residue ID in the PDB
residues_for_generation = []
for s in segment_list:
residues_for_generation += list(range(s[0], s[1] + 1))
reverse_mapping['FASTA'] = dict((key, value) for (key, value) in zip(list(range(1, len(residues_for_generation) + 1)), residues_for_generation))
# Create the reverse_mappings from the indices in the PDB sequences defined by the segment_list to the indices in the original sequences.
# Membership in sequence_offsets implies a PDB sequence.
for k, v in sorted(sequence_offsets.items()):
# For each PDB chain, we consider the set of segments (ignoring extra residues due to nmerage for now so that
# we do not include chains by accident e.g. if the user specified the first residues of chain C but none in chain B,
# they probably do not wish to generate fragments for chain B)
chain_residues = list(range(v[1], v[2] + 1))
residues_for_generation = []
for s in original_segment_list:
# If the original segment lists lie inside the chain residues then we extend the range w.r.t. the nmers
if (chain_residues[0] <= s[0] <= chain_residues[-1]) or (chain_residues[0] <= s[1] <= chain_residues[-1]):
residues_for_generation += list(range(s[0] - residue_offset + 1, s[1] + residue_offset - 1 + 1))
# Create a sorted list of residues of the chain that we will be including in the sequence for fragment generation
# then turn that into a 1-indexed mapping from the order of the residue in the sequence to the original residue ID in the PDB
chain_residues_for_generation = sorted(set(chain_residues).intersection(set(residues_for_generation)))
reverse_mapping[k] = dict((key, value) for (key, value) in zip(list(range(1, len(chain_residues_for_generation) + 1)), chain_residues_for_generation))
found_at_least_one_sequence = False
for k, v in sorted(records.items()):
assert(v[0].startswith('>'))
subkey = k[0] + k[1]
sequence = ''.join([s.strip() for s in v[1:]])
assert(sequenceLine.match(sequence) != None) # sanity check
cropped_sequence = None
if sequence_offsets.get(subkey):
# PDB chain case
first_residue_id = sequence_offsets[subkey][1]
cropped_sequence = ''.join([sequence[rmv - first_residue_id] for rmk, rmv in sorted(reverse_mapping[subkey].items())])
# Sanity check - check that the remapping from the cropped sequence to the original sequence will work in postprocessing
for x in range(0, len(cropped_sequence)):
assert(cropped_sequence[x] == sequence[reverse_mapping[subkey][x + 1] - sequence_offsets[subkey][0] - 1])
records[k] = [v[0]] + [cropped_sequence[i:i+60] for i in range(0, len(cropped_sequence), 60)] # update the record to only use the truncated sequence
else:
# FASTA chain case
cropped_sequence = ''.join([sequence[rmv - 1] for rmk, rmv in sorted(reverse_mapping['FASTA'].items()) if rmv <= len(sequence)])
# Sanity check - check that the remapping from the cropped sequence to the original sequence will work in postprocessing
for x in range(0, len(cropped_sequence)):
assert(cropped_sequence[x] == sequence[reverse_mapping['FASTA'][x + 1] - 1])
found_at_least_one_sequence = found_at_least_one_sequence or (not not cropped_sequence)
if cropped_sequence:
records[k] = [v[0]] + [cropped_sequence[i:i+60] for i in range(0, len(cropped_sequence), 60)]
else:
del records[k] # delete the chain. todo: test that this works
if not found_at_least_one_sequence:
raise Exception('No sequences were created from the loops/indices and the input sequences. This may be an input error so the job is being terminated.')
if reverse_mapping:
return records, dict(reverse_mapping = reverse_mapping, segment_list = original_segment_list, sequence_offsets = sequence_offsets)
else:
return records, None
def reformat(found_sequences):
'''Truncate the FASTA headers so that the first field is a 4-character ID.'''
for (pdb_id, chain, file_name), sequence in sorted(found_sequences.items()):
header = sequence[0]
assert(header[0] == '>')
tokens = header.split('|')
tokens[0] = tokens[0][:5]
assert(len(tokens[0]) == 5)
sequence[0] = "|".join(tokens)
def create_inputs(options, outpath, found_sequences):
errors = []
# Create subdirectories
job_inputs = []
for (pdb_id, chain, file_name), sequence in sorted(found_sequences.items()):
created_new_subdirectory = False
subdir_path = os.path.join(outpath, "%s%s" % (pdb_id, chain))
try:
if os.path.exists(subdir_path):
if options.overwrite:
colorprinter.warning("Path %s exists. Removing all files in that path as per the override option." % subdir_path)
shutil.rmtree(subdir_path)
created_new_subdirectory = True
else:
errors.append('The directory %s already exists.' % subdir_path) # uncomment this if we want to turn on the _001, _002, etc. directories
count = 1
while count < 1000:
subdir_path = os.path.join(outpath, "%s%s_%.3i" % (pdb_id, chain, count))
if not os.path.exists(subdir_path):
break
count += 1
if count == 1000:
errors.append("The directory %s contains too many previous results. Please clean up the old results or choose a new output directory." % outpath)
sys.exit(ERRCODE_OLDRESULTS)
os.makedirs(subdir_path, 0o755)
# Create a FASTA file for the sequence in the output directory
fasta_file = os.path.join(subdir_path, "%s%s.fasta" % (pdb_id, chain))
colorprinter.message("Creating a new FASTA file %s." % fasta_file)
assert(not(os.path.exists(fasta_file)))
write_file(fasta_file, '\n'.join(sequence) + '\n', 'w') # The file must terminate in a newline for the Perl script to work
job_inputs.append(JobInput(fasta_file, pdb_id, chain))
except:
if created_new_subdirectory and os.path.exists(subdir_path):
shutil.rmtree(subdir_path)
errors.append('An error occurred creating the input for %s%s.' % (pdb_id, chain))
job_inputs = []
break
return job_inputs, errors
def search_configuration_files(findstr, replacestr = None):
'''This function could be used to find and replace paths in the configuration files.
At present, it only finds phrases.'''
F = open(configurationFilesLocation, "r")
lines = F.readlines()
F.close()
allerrors = {}
alloutput = {}
for line in lines:
line = line.strip()
if line:
if line.endswith("generate_fragments.py"):
# Do not parse the Python script but check that it exists
if not(os.path.exists(line)):
allerrors[line] = "File/directory %s does not exist." % line
else:
cmd = ["grep", "-n", "-i", findstr, line]
output = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
errors = output[1]
output = output[0]
if errors:
errors = errors.strip()
allerrors[line] = errors
if output:
output = output.strip()
alloutput[line] = output.split("\n")
return alloutput, allerrors
def check_configuration_paths():
pathregex1 = re.compile('.*"(/netapp.*?)".*')
pathregex2 = re.compile('.*".*(/netapp.*?)\\\\".*')
alloutput, allerrors = search_configuration_files("netapp")
errors = []
if allerrors:
for flname, errs in sorted(allerrors.items()):
errors.append((flname, [errs]))
for flname, output in sorted(alloutput.items()):
m_errors = []
for line in output:
mtchs = pathregex1.match(line) or pathregex2.match(line)
if not mtchs:
m_errors.append("Regex could not match line: %s." % line)
else:
dir = mtchs.group(1).split()[0]
if not os.path.exists(dir):
m_errors.append("File/directory %s does not exist." % dir)
if m_errors:
errors.append((flname, m_errors))
return errors
def main():
this_dir = os.path.dirname(os.path.realpath(__file__))
make_fragments_script_path = os.path.join(this_dir, make_fragments_script)
errors = [] #check_configuration_paths()
if errors:
colorprinter.error("There is an error in the configuration files:")
for e in errors:
print("")
flname = e[0]
es = e[1]
colorprinter.warning(flname)
for e in es:
colorprinter.error(e)
sys.exit(ERRCODE_CONFIG)
options = parse_args()
if options["outpath"] and options['job_inputs']:
job_script = None
try:
cluster_job = ClusterEngine.FragmentsJob(make_fragments_script_path, options, test_mode = test_mode)
job_script = cluster_job.script
except JobInitializationException as e:
colorprinter.error(str(e))
sys.exit(ERRCODE_ARGUMENTS)
submission_script = os.path.join(options["outpath"], 'submission_script.py')
write_file(submission_script, job_script, 'w')
try:
send_mail = options['sendmail']
username = None
if send_mail:
username = get_username()
(jobid, output) = ClusterEngine.submit(submission_script, options["outpath"], send_mail = send_mail, username = username )
except Exception as e:
colorprinter.error("An exception occurred during submission to the cluster.")
colorprinter.error(str(e))
colorprinter.error(traceback.format_exc())
sys.exit(ERRCODE_CLUSTER)
colorprinter.message("\nFragment generation jobs started with job ID %d. Results will be saved in %s." % (jobid, options["outpath"]))
if options['no_homologs']:
print("The --nohoms option was selected.")
if options['no_zip']:
print("The --nozip option was selected.")
if ClusterEngine.ClusterType == "SGE":
print(("The jobs have been submitted using the %s queue(s)." % (', '.join(sorted(options['queue'])) or 'default')))
print('')
logfile.writeToLogfile(datetime.now(), jobid, options["outpath"])
if __name__ == "__main__":
main()
| {
"content_hash": "6307b049ca654b9a2a0bd64ee9857989",
"timestamp": "",
"source": "github",
"line_count": 880,
"max_line_length": 574,
"avg_line_length": 52.69886363636363,
"alnum_prop": 0.6399568733153639,
"repo_name": "Kortemme-Lab/klab",
"id": "170b60c6b1d4ff22dfa873984f00371e86a930ba",
"size": "46524",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "klab/bio/fragments/generate_fragments.py",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Perl",
"bytes": "62782"
},
{
"name": "Python",
"bytes": "2074156"
},
{
"name": "R",
"bytes": "4487"
},
{
"name": "Shell",
"bytes": "4382"
},
{
"name": "TeX",
"bytes": "2107"
}
],
"symlink_target": ""
} |
KRB5 DEFINITIONS ::=
BEGIN
-- needed to do the Right Thing with pepsy; this isn't a valid ASN.1
-- token, however.
SECTIONS encode decode none
-- the order of stuff in this file matches the order in the draft RFC
Realm ::= GeneralString
HostAddress ::= SEQUENCE {
addr-type[0] INTEGER,
address[1] OCTET STRING
}
HostAddresses ::= SEQUENCE OF SEQUENCE {
addr-type[0] INTEGER,
address[1] OCTET STRING
}
AuthorizationData ::= SEQUENCE OF SEQUENCE {
ad-type[0] INTEGER,
ad-data[1] OCTET STRING
}
KDCOptions ::= BIT STRING {
reserved(0),
forwardable(1),
forwarded(2),
proxiable(3),
proxy(4),
allow-postdate(5),
postdated(6),
unused7(7),
renewable(8),
unused9(9),
renewable-ok(27),
enc-tkt-in-skey(28),
renew(30),
validate(31)
}
LastReq ::= SEQUENCE OF SEQUENCE {
lr-type[0] INTEGER,
lr-value[1] KerberosTime
}
KerberosTime ::= GeneralizedTime -- Specifying UTC time zone (Z)
PrincipalName ::= SEQUENCE{
name-type[0] INTEGER,
name-string[1] SEQUENCE OF GeneralString
}
Ticket ::= [APPLICATION 1] SEQUENCE {
tkt-vno[0] INTEGER,
realm[1] Realm,
sname[2] PrincipalName,
enc-part[3] EncryptedData -- EncTicketPart
}
TransitedEncoding ::= SEQUENCE {
tr-type[0] INTEGER, -- Only supported value is 1 == DOMAIN-COMPRESS
contents[1] OCTET STRING
}
-- Encrypted part of ticket
EncTicketPart ::= [APPLICATION 3] SEQUENCE {
flags[0] TicketFlags,
key[1] EncryptionKey,
crealm[2] Realm,
cname[3] PrincipalName,
transited[4] TransitedEncoding,
authtime[5] KerberosTime,
starttime[6] KerberosTime OPTIONAL,
endtime[7] KerberosTime,
renew-till[8] KerberosTime OPTIONAL,
caddr[9] HostAddresses OPTIONAL,
authorization-data[10] AuthorizationData OPTIONAL
}
-- Unencrypted authenticator
Authenticator ::= [APPLICATION 2] SEQUENCE {
authenticator-vno[0] INTEGER,
crealm[1] Realm,
cname[2] PrincipalName,
cksum[3] Checksum OPTIONAL,
cusec[4] INTEGER,
ctime[5] KerberosTime,
subkey[6] EncryptionKey OPTIONAL,
seq-number[7] INTEGER OPTIONAL,
authorization-data[8] AuthorizationData OPTIONAL
}
TicketFlags ::= BIT STRING {
reserved(0),
forwardable(1),
forwarded(2),
proxiable(3),
proxy(4),
may-postdate(5),
postdated(6),
invalid(7),
renewable(8),
initial(9)
}
AS-REQ ::= [APPLICATION 10] KDC-REQ
TGS-REQ ::= [APPLICATION 12] KDC-REQ
KDC-REQ ::= SEQUENCE {
pvno[1] INTEGER,
msg-type[2] INTEGER,
padata[3] SEQUENCE OF PA-DATA OPTIONAL,
req-body[4] KDC-REQ-BODY
}
PA-DATA ::= SEQUENCE {
padata-type[1] INTEGER,
pa-data[2] OCTET STRING -- might be encoded AP-REQ
}
KDC-REQ-BODY ::= SEQUENCE {
kdc-options[0] KDCOptions,
cname[1] PrincipalName OPTIONAL, -- Used only in AS-REQ
realm[2] Realm, -- Server's realm Also client's in AS-REQ
sname[3] PrincipalName OPTIONAL,
from[4] KerberosTime OPTIONAL,
till[5] KerberosTime,
rtime[6] KerberosTime OPTIONAL,
nonce[7] INTEGER,
etype[8] SEQUENCE OF INTEGER, -- EncryptionType,
-- in preference order
addresses[9] HostAddresses OPTIONAL,
enc-authorization-data[10] EncryptedData OPTIONAL,
-- AuthorizationData
additional-tickets[11] SEQUENCE OF Ticket OPTIONAL
}
AS-REP ::= [APPLICATION 11] KDC-REP
TGS-REP ::= [APPLICATION 13] KDC-REP
KDC-REP ::= SEQUENCE {
pvno[0] INTEGER,
msg-type[1] INTEGER,
padata[2] SEQUENCE OF PA-DATA OPTIONAL,
crealm[3] Realm,
cname[4] PrincipalName,
ticket[5] Ticket, -- Ticket
enc-part[6] EncryptedData -- EncKDCRepPart
}
EncASRepPart ::= [APPLICATION 25] EncKDCRepPart
EncTGSRepPart ::= [APPLICATION 26] EncKDCRepPart
EncKDCRepPart ::= SEQUENCE {
key[0] EncryptionKey,
last-req[1] LastReq,
nonce[2] INTEGER,
key-expiration[3] KerberosTime OPTIONAL,
flags[4] TicketFlags,
authtime[5] KerberosTime,
starttime[6] KerberosTime OPTIONAL,
endtime[7] KerberosTime,
renew-till[8] KerberosTime OPTIONAL,
srealm[9] Realm,
sname[10] PrincipalName,
caddr[11] HostAddresses OPTIONAL
}
AP-REQ ::= [APPLICATION 14] SEQUENCE {
pvno[0] INTEGER,
msg-type[1] INTEGER,
ap-options[2] APOptions,
ticket[3] Ticket,
authenticator[4] EncryptedData -- Authenticator
}
APOptions ::= BIT STRING {
reserved(0),
use-session-key(1),
mutual-required(2)
}
AP-REP ::= [APPLICATION 15] SEQUENCE {
pvno[0] INTEGER,
msg-type[1] INTEGER,
enc-part[2] EncryptedData -- EncAPRepPart
}
EncAPRepPart ::= [APPLICATION 27] SEQUENCE {
ctime[0] KerberosTime,
cusec[1] INTEGER,
subkey[2] EncryptionKey OPTIONAL,
seq-number[3] INTEGER OPTIONAL
}
KRB-SAFE ::= [APPLICATION 20] SEQUENCE {
pvno[0] INTEGER,
msg-type[1] INTEGER,
safe-body[2] KRB-SAFE-BODY,
cksum[3] Checksum
}
KRB-SAFE-BODY ::= SEQUENCE {
user-data[0] OCTET STRING,
timestamp[1] KerberosTime OPTIONAL,
usec[2] INTEGER OPTIONAL,
seq-number[3] INTEGER OPTIONAL,
s-address[4] HostAddress, -- sender's addr
r-address[5] HostAddress OPTIONAL -- recip's addr
}
KRB-PRIV ::= [APPLICATION 21] SEQUENCE {
pvno[0] INTEGER,
msg-type[1] INTEGER,
enc-part[3] EncryptedData -- EncKrbPrivPart
}
EncKrbPrivPart ::= [APPLICATION 28] SEQUENCE {
user-data[0] OCTET STRING,
timestamp[1] KerberosTime OPTIONAL,
usec[2] INTEGER OPTIONAL,
seq-number[3] INTEGER OPTIONAL,
s-address[4] HostAddress, -- sender's addr
r-address[5] HostAddress OPTIONAL -- recip's addr
}
-- The KRB-CRED message allows easy forwarding of credentials.
KRB-CRED ::= [APPLICATION 22] SEQUENCE {
pvno[0] INTEGER,
msg-type[1] INTEGER, -- KRB_CRED
tickets[2] SEQUENCE OF Ticket,
enc-part[3] EncryptedData -- EncKrbCredPart
}
EncKrbCredPart ::= [APPLICATION 29] SEQUENCE {
ticket-info[0] SEQUENCE OF KRB-CRED-INFO,
nonce[1] INTEGER OPTIONAL,
timestamp[2] KerberosTime OPTIONAL,
usec[3] INTEGER OPTIONAL,
s-address[4] HostAddress OPTIONAL,
r-address[5] HostAddress OPTIONAL
}
KRB-CRED-INFO ::= SEQUENCE {
key[0] EncryptionKey,
prealm[1] Realm OPTIONAL,
pname[2] PrincipalName OPTIONAL,
flags[3] TicketFlags OPTIONAL,
authtime[4] KerberosTime OPTIONAL,
starttime[5] KerberosTime OPTIONAL,
endtime[6] KerberosTime OPTIONAL,
renew-till[7] KerberosTime OPTIONAL,
srealm[8] Realm OPTIONAL,
sname[9] PrincipalName OPTIONAL,
caddr[10] HostAddresses OPTIONAL
}
KRB-ERROR ::= [APPLICATION 30] SEQUENCE {
pvno[0] INTEGER,
msg-type[1] INTEGER,
ctime[2] KerberosTime OPTIONAL,
cusec[3] INTEGER OPTIONAL,
stime[4] KerberosTime,
susec[5] INTEGER,
error-code[6] INTEGER,
crealm[7] Realm OPTIONAL,
cname[8] PrincipalName OPTIONAL,
realm[9] Realm, -- Correct realm
sname[10] PrincipalName, -- Correct name
e-text[11] GeneralString OPTIONAL,
e-data[12] OCTET STRING OPTIONAL
}
EncryptedData ::= SEQUENCE {
etype[0] INTEGER, -- EncryptionType
kvno[1] INTEGER OPTIONAL,
cipher[2] OCTET STRING -- CipherText
}
EncryptionKey ::= SEQUENCE {
keytype[0] INTEGER,
keyvalue[1] OCTET STRING
}
Checksum ::= SEQUENCE {
cksumtype[0] INTEGER,
checksum[1] OCTET STRING
}
METHOD-DATA ::= SEQUENCE {
method-type[0] INTEGER,
method-data[1] OCTET STRING OPTIONAL
}
ETYPE-INFO-ENTRY ::= SEQUENCE {
etype[0] INTEGER,
salt[1] OCTET STRING OPTIONAL
}
ETYPE-INFO ::= SEQUENCE OF ETYPE-INFO-ENTRY
PA-ENC-TS-ENC ::= SEQUENCE {
patimestamp[0] KerberosTime, -- client's time
pausec[1] INTEGER OPTIONAL
}
-- These ASN.1 definitions are NOT part of the official Kerberos protocol...
-- New ASN.1 definitions for the kadmin protocol.
-- Originally contributed from the Sandia modifications
PasswdSequence ::= SEQUENCE {
passwd[0] OCTET STRING,
phrase[1] OCTET STRING
}
PasswdData ::= SEQUENCE {
passwd-sequence-count[0] INTEGER,
passwd-sequence[1] SEQUENCE OF PasswdSequence
}
-- encodings from
-- Integrating Single-use Authentication Mechanisms with Kerberos
PA-SAM-CHALLENGE ::= SEQUENCE {
sam-type[0] INTEGER,
sam-flags[1] SAMFlags,
sam-type-name[2] GeneralString OPTIONAL,
sam-track-id[3] GeneralString OPTIONAL,
sam-challenge-label[4] GeneralString OPTIONAL,
sam-challenge[5] GeneralString OPTIONAL,
sam-response-prompt[6] GeneralString OPTIONAL,
sam-pk-for-sad[7] OCTET STRING OPTIONAL,
sam-nonce[8] INTEGER OPTIONAL,
sam-cksum[9] Checksum OPTIONAL
}
PA-SAM-CHALLENGE-2 ::= SEQUENCE {
sam-body[0] PA-SAM-CHALLENGE-2-BODY,
sam-cksum[1] SEQUENCE (1..MAX) OF Checksum,
...
}
PA-SAM-CHALLENGE-2-BODY ::= SEQUENCE {
sam-type[0] INTEGER,
sam-flags[1] SAMFlags,
sam-type-name[2] GeneralString OPTIONAL,
sam-track-id[3] GeneralString OPTIONAL,
sam-challenge-label[4] GeneralString OPTIONAL,
sam-challenge[5] GeneralString OPTIONAL,
sam-response-prompt[6] GeneralString OPTIONAL,
sam-pk-for-sad[7] EncryptionKey OPTIONAL,
sam-nonce[8] INTEGER,
sam-etype[9] INTEGER,
...
}
-- these are [0].. [2] in the draft
SAMFlags ::= BIT STRING (SIZE (32..MAX))
-- use-sad-as-key(0)
-- send-encrypted-sad(1)
-- must-pk-encrypt-sad(2)
PA-SAM-RESPONSE ::= SEQUENCE {
sam-type[0] INTEGER,
sam-flags[1] SAMFlags,
sam-track-id[2] GeneralString OPTIONAL,
-- sam-enc-key is reserved for future use, so I'm making it OPTIONAL - mwe
sam-enc-key[3] EncryptedData,
-- PA-ENC-SAM-KEY
sam-enc-nonce-or-ts[4] EncryptedData,
-- PA-ENC-SAM-RESPONSE-ENC
sam-nonce[5] INTEGER OPTIONAL,
sam-patimestamp[6] KerberosTime OPTIONAL
}
PA-SAM-RESPONSE-2 ::= SEQUENCE {
sam-type[0] INTEGER,
sam-flags[1] SAMFlags,
sam-track-id[2] GeneralString OPTIONAL,
sam-enc-nonce-or-sad[3] EncryptedData,
-- PA-ENC-SAM-RESPONSE-ENC
sam-nonce[4] INTEGER,
...
}
PA-ENC-SAM-KEY ::= SEQUENCE {
sam-key[0] EncryptionKey
}
PA-ENC-SAM-RESPONSE-ENC ::= SEQUENCE {
sam-nonce[0] INTEGER OPTIONAL,
sam-timestamp[1] KerberosTime OPTIONAL,
sam-usec[2] INTEGER OPTIONAL,
sam-passcode[3] GeneralString OPTIONAL
}
PA-ENC-SAM-RESPONSE-ENC-2 ::= SEQUENCE {
sam-nonce[0] INTEGER,
sam-sad[1] GeneralString OPTIONAL,
...
}
END
| {
"content_hash": "57963883e22b126a16c68abe067e39d8",
"timestamp": "",
"source": "github",
"line_count": 406,
"max_line_length": 78,
"avg_line_length": 26.12807881773399,
"alnum_prop": 0.6561085972850679,
"repo_name": "drankye/kerb-token",
"id": "e455fd9a19233784d82bbc46167c728a0306a87a",
"size": "12033",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "krb5/src/lib/krb5/asn.1/KRB5-asn.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "42358"
},
{
"name": "Awk",
"bytes": "10967"
},
{
"name": "C",
"bytes": "13257208"
},
{
"name": "C++",
"bytes": "1361087"
},
{
"name": "CSS",
"bytes": "50885"
},
{
"name": "Emacs Lisp",
"bytes": "6797"
},
{
"name": "Java",
"bytes": "73693"
},
{
"name": "Objective-C",
"bytes": "8596"
},
{
"name": "Perl",
"bytes": "132774"
},
{
"name": "Python",
"bytes": "422641"
},
{
"name": "Shell",
"bytes": "34053"
},
{
"name": "TeX",
"bytes": "463023"
}
],
"symlink_target": ""
} |
from c7n_azure.resources.arm import ArmResourceManager
from c7n_azure.provider import resources
@resources.register('datafactory')
class DataFactory(ArmResourceManager):
"""Data Factory Resource
:example:
This policy will find all Data Factories with 10 or more failures in pipeline
runs over the last 72 hours
.. code-block:: yaml
policies:
- name: datafactory-dropping-messages
resource: azure.datafactory
filters:
- type: metric
metric: PipelineFailedRuns
op: ge
aggregation: total
threshold: 10
timeframe: 72
"""
class resource_type(ArmResourceManager.resource_type):
doc_groups = ['Analytics']
service = 'azure.mgmt.datafactory'
client = 'DataFactoryManagementClient'
enum_spec = ('factories', 'list', None)
default_report_fields = (
'name',
'location',
'resourceGroup'
)
resource_type = 'Microsoft.DataFactory/factories'
| {
"content_hash": "b4145493c133d7c1f4e2d8d785277699",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 81,
"avg_line_length": 27.974358974358974,
"alnum_prop": 0.5967002749770852,
"repo_name": "FireballDWF/cloud-custodian",
"id": "5892c9100915c923964381fc39b05630470c8327",
"size": "1677",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "tools/c7n_azure/c7n_azure/resources/data_factory.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "7986"
},
{
"name": "Go",
"bytes": "142024"
},
{
"name": "HTML",
"bytes": "31"
},
{
"name": "Makefile",
"bytes": "9857"
},
{
"name": "PowerShell",
"bytes": "1440"
},
{
"name": "Python",
"bytes": "4893319"
},
{
"name": "Shell",
"bytes": "7227"
}
],
"symlink_target": ""
} |
import json
class CommandHandler:
def __init__(self, request):
assert isinstance(request, dict)
self._request=request
def execute_command(self):
_command=self._request.get('command', None)
if _command is None:
return "invalid request"
if _command == 'list_files':
return self.list_files()
elif _command == 'read_file':
return self.read_file()
elif _command == 'write_file':
return self.write_file()
elif _command == 'rm_file':
return self.rm_file()
return "invalid command"
def list_files(self):
_dir=self._request.get('directory', '/')
#retrieve a list of files this person has access to.
return json.dumps(self._list_files(_dir))
def read_file(self):
_filename=self._request['filename']
return self._read_file(_filename)
def write_file(self):
_fileobj=self._request['fileobj'] #already a json string!
if self._write_file(_fileobj):
return json.dumps({'status': 'Okay', 'message': 'File saved successfully!'})
#something went wrong...
return json.dumps({'status': 'Error', 'message': 'File not saved..'})
def rm_file(self):
_filename=self._request['filename']
return self._rm_file(_filename)
def _list_files(self, directory):
pass
def _read_file(self, filename):
pass
def _write_file(self, filename, contents):
pass
def _rm_file(self, filename):
pass
| {
"content_hash": "63a4105ad8f00d5e4c1d96e27d135cba",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 85,
"avg_line_length": 25.74137931034483,
"alnum_prop": 0.6068318821165438,
"repo_name": "brython-dev/brython-in-the-classroom",
"id": "878372c57ef27863cd0c7d54df6158ade9fb33a1",
"size": "1493",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pyschool/libs/CommandHandler.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "107273"
},
{
"name": "HTML",
"bytes": "38548"
},
{
"name": "JavaScript",
"bytes": "8789"
},
{
"name": "Python",
"bytes": "58999"
}
],
"symlink_target": ""
} |
import sys
from django.conf import settings
settings.configure(
DEBUG=True,
SECRET_KEY='hellobbbbbbbbbbbb',
ROOT_URLCONF=__name__,
MIDDLEWARE_CLASSES=(
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
),
)
from django.conf.urls import url
from django.http import HttpResponse
def index(request):
return HttpResponse('HELLO')
urlpatterns=(
url(r'^$',index),
)
if __name__=="__main__":
from django.core.management import execute_from_command_line
execute_from_command_line | {
"content_hash": "d6dc6ca63c2ae63cecd42386e2d6b0d3",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 65,
"avg_line_length": 21.233333333333334,
"alnum_prop": 0.7048665620094191,
"repo_name": "JuneDeng2014/working_notes",
"id": "4979aa87ee94c7489e846ff15502541d93ffcbf4",
"size": "637",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "learn-django-by-example/hello.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "24"
},
{
"name": "GCC Machine Description",
"bytes": "4127"
},
{
"name": "HTML",
"bytes": "21668"
},
{
"name": "JavaScript",
"bytes": "631913"
},
{
"name": "Python",
"bytes": "72424"
}
],
"symlink_target": ""
} |
import logging
import os
import re
import glob
import h5py
import numpy as np
import scipy.misc as misc
from datetime import datetime, timedelta
from netCDF4 import Dataset
from shapely.geometry import Point
import pandas as pd
import src.config.filepaths_cems as fp
import src.features.fre_to_tpm.viirs.ftt_utils as ut
import src.features.fre_to_tpm.viirs.ftt_fre as ff
def read_nc(f):
nc_file = Dataset(f)
# get geo
lon_dims = nc_file['x_range'][:]
lat_dims = nc_file['y_range'][:]
spacing = nc_file['spacing'][:]
lons = np.arange(lon_dims[0], lon_dims[1], spacing[0])
lats = np.flipud(np.arange(lat_dims[0], lat_dims[1], spacing[1]))
lons, lats = np.meshgrid(lons, lats)
# get mask
z = nc_file['z'][:].reshape([3000, 3000])
mask = z > 0
return {"mask": mask, "lats": lats, "lons": lons}
def get_timestamp(viirs_sdr_fname):
try:
return re.search("[d][0-9]{8}[_][t][0-9]{6}", viirs_sdr_fname).group()
except Exception, e:
logger.warning("Could not extract time stamp from: " + viirs_sdr_fname + " with error: " + str(e))
return ''
def ds_names_dict(key, key_alt=None):
if key == 'M03':
return {'k1': 'VIIRS-M3-SDR_All', 'k2': 'Radiance'}
if key == 'M04':
return {'k1': 'VIIRS-M4-SDR_All', 'k2': 'Radiance'}
if key == 'M05':
return {'k1': 'VIIRS-M5-SDR_All', 'k2': 'Radiance'}
if key_alt == 'Latitude':
return {'k1': 'VIIRS-MOD-GEO-TC_All', 'k2': key_alt}
if key_alt == 'Longitude':
return {'k1': 'VIIRS-MOD-GEO-TC_All', 'k2': key_alt}
if key_alt == 'faot550':
return {'k1': 'VIIRS-Aeros-Opt-Thick-IP_All', 'k2': key_alt}
if key_alt == 'QF1':
return {'k1': 'VIIRS-Aeros-Opt-Thick-IP_All', 'k2': key_alt}
def get_viirs_fname(path, timestamp_viirs, key):
fname = [f for f in os.listdir(path) if
((timestamp_viirs in f) and (key in f))]
if len(fname) > 1:
print timestamp_viirs
print fname
logger.warning("More that one granule matched STOP and check why, key " + key)
return fname[0]
elif len(fname) == 1:
return fname[0]
else:
logger.warning("No matching granule STOP and check why")
return None
def read_h5(f):
return h5py.File(f, "r")
def read_ds(path, ts, key, key_alt=None):
# setup key
p = ds_names_dict(key, key_alt)
# get filename
fname = get_viirs_fname(path, ts, key)
# read h5
ds = read_h5(os.path.join(path, fname))
# return dataset
return ds['All_Data'][p['k1']][p['k2']][:]
def setup_data(base_name):
data_dict = {}
# get timestampe
ts = get_timestamp(base_name)
data_dict['m3'] = read_ds(fp.path_to_viirs_sdr, ts, 'M03')
data_dict['m4'] = read_ds(fp.path_to_viirs_sdr, ts, 'M04')
data_dict['m5'] = read_ds(fp.path_to_viirs_sdr, ts, 'M05')
data_dict['aod'] = read_ds(fp.path_to_viirs_aod, ts, 'AOT', key_alt='faot550')
data_dict['flags'] = read_ds(fp.path_to_viirs_aod, ts, 'AOT', key_alt='QF1')
data_dict['lats'] = read_ds(fp.path_to_viirs_geo, ts, 'TCO', key_alt='Latitude')
data_dict['lons'] = read_ds(fp.path_to_viirs_geo, ts, 'TCO', key_alt='Longitude')
return data_dict
def create_resampler(data_dict):
return ut.utm_resampler(data_dict['lats'],
data_dict['lons'],
750)
def image_histogram_equalization(image, number_bins=256):
# from http://www.janeriksolem.net/2009/06/histogram-equalization-with-python-and.html
# get image histogram
image_histogram, bins = np.histogram(image[image > 0].flatten(), number_bins, normed=True)
cdf = image_histogram.cumsum() # cumulative distribution function
cdf = 255 * cdf / cdf[-1] # normalize
# use linear interpolation of cdf to find new pixel values
image_equalized = np.interp(image.flatten(), bins[:-1], cdf)
return image_equalized.reshape(image.shape)
def get_image_coords(fires, resampled_lats, resampled_lons):
inverse_lats = resampled_lats * -1 # invert lats for correct indexing
y_size, x_size = resampled_lats.shape
min_lat = np.min(inverse_lats[inverse_lats > -1000])
range_lat = np.max(inverse_lats) - min_lat
min_lon = np.min(resampled_lons)
range_lon = np.max(resampled_lons[resampled_lons < 1000]) - min_lon
padding = 60
x_coords = []
y_coords = []
for f in fires:
f_lon, f_lat = f.xy
# get approximate fire location, remembering to invert the lat
y = int(((f_lat[0] * -1) - min_lat) / range_lat * y_size)
x = int((f_lon[0] - min_lon) / range_lon * x_size)
if (y <= padding) | (y >= y_size - padding):
continue
if (x <= padding) | (x >= x_size - padding):
continue
lat_subset = resampled_lats[y - padding:y + padding, x - padding:x + padding]
lon_subset = resampled_lons[y - padding:y + padding, x - padding:x + padding]
# find the location of the fire in the subset
dists = np.abs(f_lat - lat_subset) + np.abs(f_lon - lon_subset)
sub_y, sub_x = divmod(dists.argmin(), dists.shape[1])
# using the subset location get the adjusted location
y_coords.append(y - padding + sub_y)
x_coords.append(x - padding + sub_x)
return y_coords, x_coords
def get_arcmin(x):
'''
rounds the data decimal fraction of a degree
to the nearest arc minute
'''
neg_values = x < 0
abs_x = np.abs(x)
floor_x = np.floor(abs_x)
decile = abs_x - floor_x
minute = np.around(decile * 60) # round to nearest arcmin
minute_fraction = minute * 0.01 # convert to fractional value (ranges from 0 to 0.6)
max_minute = minute_fraction > 0.59
floor_x[neg_values] *= -1
floor_x[neg_values] -= minute_fraction[neg_values]
floor_x[~neg_values] += minute_fraction[~neg_values]
# deal with edge cases, and just round them all up
if np.sum(max_minute) > 0:
floor_x[max_minute] = np.around(floor_x[max_minute])
# now to get rid of rounding errors and allow comparison multiply by 100 and convert to int
floor_x = (floor_x * 100).astype(int)
# round now to nearest 2 arcmin
#floor_x = myround(floor_x, base=3)
return floor_x
def myround(x, dec=20, base=.000005):
return np.round(base * np.round(x / base), dec)
def fire_sampling(frp_df, time_stamp):
# restrict to only fires within one hour of the overpass
stop_time = time_stamp
start_time = time_stamp - timedelta(minutes=70)
frp_subset = ff.temporal_subset(frp_df, start_time, stop_time)
frp_subset['occurrences'] = 1
frp_subset['lons'] = [l.xy[0][0] for l in frp_subset.point.values]
frp_subset['lats'] = [l.xy[1][0] for l in frp_subset.point.values]
# round lats and lons to nearest arcminute
frp_subset['lons_arcmin'] = get_arcmin(frp_subset['lons'].values)
frp_subset['lats_arcmin'] = get_arcmin(frp_subset['lats'].values)
# find all unique fire locations and count occurences
agg_dict = {'occurrences': np.sum}
grouped = frp_subset.groupby(['lons_arcmin', 'lats_arcmin'], as_index=False).agg(agg_dict)
# get the point values back in the df
points = frp_subset[['lats_arcmin', 'lons_arcmin', 'point']]
points.drop_duplicates(['lats_arcmin', 'lons_arcmin'], inplace=True)
grouped = pd.merge(grouped, points, on=['lats_arcmin', 'lons_arcmin'])
return grouped
def fires_for_occurrence_level(frp_df, occurrences):
# find and return fires with at least given number of occurence
mask = frp_df.occurrences >= occurrences
return frp_df[mask]
def tcc_viirs(data_dict, fires_for_day, peat_mask, aeronet_stations, resampler, viirs_overpass_time):
m3 = data_dict['m3']
m4 = data_dict['m4']
m5 = data_dict['m5']
mask = m5 < 0
masked_lats = np.ma.masked_array(resampler.lats, mask)
masked_lons = np.ma.masked_array(resampler.lons, mask)
resampled_m3 = resampler.resample_image(m3, masked_lats, masked_lons, fill_value=0)
resampled_m4 = resampler.resample_image(m4, masked_lats, masked_lons, fill_value=0)
resampled_m5 = resampler.resample_image(m5, masked_lats, masked_lons, fill_value=0)
# for the fire coordinates in the image
resampled_lats = resampler.resample_image(resampler.lats, masked_lats, masked_lons, fill_value=1000)
resampled_lons = resampler.resample_image(resampler.lons, masked_lats, masked_lons, fill_value=1000)
r = image_histogram_equalization(resampled_m5)
g = image_histogram_equalization(resampled_m4)
b = image_histogram_equalization(resampled_m3)
r = np.round((r * (255 / np.max(r))) * 1).astype('uint8')
g = np.round((g * (255 / np.max(g))) * 1).astype('uint8')
b = np.round((b * (255 / np.max(b))) * 1).astype('uint8')
rgb = np.dstack((r, g, b))
rgb_peat = rgb.copy()
# blend the mask and the image
blend_ratio = 0.3
colour_mask = np.dstack((peat_mask * 205, peat_mask * 74, peat_mask * 74))
for i in xrange(rgb_peat.shape[2]):
rgb_peat[:, :, i] = blend_ratio * colour_mask[:, :, i] + (1 - blend_ratio) * rgb_peat[:, :, i]
# insert fires with colours based on sampling
fire_occurrence_df = fire_sampling(fires_for_day, viirs_overpass_time)
occurrences = [1, 3, 5, 6] # number of himawari images fire is present in prior to overpass
colour_sets = [[127, 76, 76], [255, 0, 0], [253, 106, 2], [0, 255, 0]] # red/gray, red, orange, green
for occurrence, colours in zip(occurrences, colour_sets):
fires_with_occurrence = fires_for_occurrence_level(fire_occurrence_df, occurrence)
if not fires_with_occurrence.empty:
fy, fx = get_image_coords(fires_with_occurrence.point.values,
resampled_lats, resampled_lons)
if fy:
rgb[fy, fx, 0] = colours[0]
rgb[fy, fx, 1] = colours[1]
rgb[fy, fx, 2] = colours[2]
rgb_peat[fy, fx, 0] = colours[0]
rgb_peat[fy, fx, 1] = colours[1]
rgb_peat[fy, fx, 2] = colours[2]
# insert aeronet stations
fy, fx = get_image_coords(aeronet_stations, resampled_lats, resampled_lons)
if fy:
for x, y in zip(fx, fy):
rgb[y-2:y+3, x-2:x+3, 0] = 0
rgb[y-2:y+3, x-2:x+3, 1] = 255
rgb[y-2:y+3, x-2:x+3, 2] = 255
rgb_peat[y - 2:y + 3, x - 2:x + 3, 0] = 0
rgb_peat[y - 2:y + 3, x - 2:x + 3, 1] = 255
rgb_peat[y - 2:y + 3, x - 2:x + 3, 2] = 255
return rgb, rgb_peat
def extract_aod(aod, resampler):
mask = aod < -1
masked_lats = np.ma.masked_array(resampler.lats, mask)
masked_lons = np.ma.masked_array(resampler.lons, mask)
resampled_aod = resampler.resample_image(aod, masked_lats, masked_lons, fill_value=0)
return resampled_aod
def get_mask(arr, bit_pos, bit_len, value):
'''Generates mask with given bit information.
Parameters
bit_pos - Position of the specific QA bits in the value string.
bit_len - Length of the specific QA bits.
value - A value indicating the desired condition.
'''
bitlen = int('1' * bit_len, 2)
if type(value) == str:
value = int(value, 2)
pos_value = bitlen << bit_pos
con_value = value << bit_pos
mask = (arr & pos_value) == con_value
return mask
def extract_aod_flags(data_dict, resampler):
aod = data_dict['aod']
aod_quality = data_dict['flags']
flags = np.zeros(aod_quality.shape)
for k, v in zip(['00', '01', '10', '11'], [0, 1, 2, 3]):
mask = get_mask(aod_quality, 0, 2, k)
flags[mask] = v
mask = aod < -1
masked_lats = np.ma.masked_array(resampler.lats, mask)
masked_lons = np.ma.masked_array(resampler.lons, mask)
resampled_flags = resampler.resample_image(flags, masked_lats, masked_lons, fill_value=3)
return resampled_flags
def get_peat_mask(peat_map_dict, utm_resampler):
sum_array = None
# extract three peat maps for the image
for pm in peat_map_dict:
resampled_mask = utm_resampler.resample_image(peat_map_dict[pm]['mask'],
peat_map_dict[pm]['lats'],
peat_map_dict[pm]['lons'],
fill_value=0)
if sum_array is None:
sum_array = resampled_mask.astype(int)
else:
sum_array += resampled_mask.astype(int)
# merge the three peat maps
return sum_array > 0
def get_aeronet():
stations = dict(badung=(-6.888, 107.610), makassar=(-4.998, 119.572), puspiptek=(-6.356, 106.664),
jambi=(-1.632, 103.642), palangkaraya=(-2.228, 113.946), singapore=(1.298, 103.780),
kuching=(1.491, 110.349), pontianak=(0.075, 109.191))
stations_points = []
for k in stations:
p = stations[k]
stations_points.append(Point(p[1], p[0])) # points needs to go in lon/lat
return stations_points
def main():
# load in himawari fires for visualisation
frp_df = ut.read_frp_df(fp.path_to_himawari_frp)
# load in the peat maps
peat_map_dict = {}
peat_maps_paths = glob.glob(fp.path_to_peat_maps + '*/*/*.nc')
for peat_maps_path in peat_maps_paths:
peat_map_key = peat_maps_path.split("/")[-1].split(".")[0]
peat_map_dict[peat_map_key] = read_nc(peat_maps_path)
# get SDR data
viirs_sdr_paths = glob.glob(fp.path_to_viirs_sdr + 'SVM01*')
for viirs_sdr_path in viirs_sdr_paths:
viirs_sdr_filename = viirs_sdr_path.split('/')[-1]
if 'DS' in viirs_sdr_filename:
continue
logger.info("Processing viirs file: " + viirs_sdr_filename)
if os.path.isfile(os.path.join(
fp.path_to_viirs_sdr_resampled_no_peat, viirs_sdr_filename.replace('h5', 'png'))):
logger.info( '...already resampled')
continue
# read in the needed SDR data and create a data dict
try:
data_dict = setup_data(viirs_sdr_filename)
except Exception, e:
logger.warning('Could load data. Failed with ' + str(e))
continue
try:
# setup resampler adn extract true colour
utm_resampler = create_resampler(data_dict)
except Exception, e:
logger.warning('Could not make resampler for file. Failed with ' + str(e))
continue
viirs_aod = extract_aod(data_dict['aod'], utm_resampler)
aod_flags = extract_aod_flags(data_dict, utm_resampler)
misc.imsave(os.path.join(fp.path_to_viirs_aod_resampled, viirs_sdr_filename.replace('h5', 'png')), viirs_aod)
misc.imsave(os.path.join(fp.path_to_viirs_aod_flags_resampled, viirs_sdr_filename.replace('h5', 'png')),
aod_flags)
# setup resampler adn extract true colour
t = datetime.strptime(get_timestamp(viirs_sdr_filename), 'd%Y%m%d_t%H%M%S')
peat_mask = get_peat_mask(peat_map_dict, utm_resampler)
fires_for_day = ff.fire_locations_for_digitisation(frp_df, t)
aeronet_stations = get_aeronet()
tcc, tcc_peat = tcc_viirs(data_dict, fires_for_day, peat_mask, aeronet_stations, utm_resampler, t)
misc.imsave(os.path.join(fp.path_to_viirs_sdr_resampled_no_peat, viirs_sdr_filename.replace('h5', 'png')), tcc)
misc.imsave(os.path.join(fp.path_to_viirs_sdr_resampled_peat,
viirs_sdr_filename.replace('.h5', '_peat.png')), tcc_peat)
print
if __name__ == "__main__":
log_fmt = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
logging.basicConfig(level=logging.INFO, format=log_fmt)
logger = logging.getLogger(__name__)
main()
| {
"content_hash": "fae417b7a8ff8402ce1f591ef778c8ab",
"timestamp": "",
"source": "github",
"line_count": 452,
"max_line_length": 119,
"avg_line_length": 35.20132743362832,
"alnum_prop": 0.6034818678901389,
"repo_name": "dabillox/kcl-fire-aot",
"id": "91f86c9d4942ea20ec66bdf0819fe66172c02059",
"size": "15978",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/data/digitisation/reproject_images/reproject_viirs_for_digitisation.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Jupyter Notebook",
"bytes": "2923893"
},
{
"name": "Makefile",
"bytes": "1204"
},
{
"name": "Perl",
"bytes": "6697"
},
{
"name": "Python",
"bytes": "318547"
}
],
"symlink_target": ""
} |
"""Pretend to be /usr/bin/id3v2 from id3lib, sort of."""
import sys
import codecs
import mimetypes
from optparse import SUPPRESS_HELP
import mutagen
import mutagen.id3
from mutagen.id3 import Encoding, PictureType
from mutagen._senf import fsnative, print_, argv, fsn2text, fsn2bytes, \
bytes2fsn
from mutagen._compat import PY2, text_type
from ._util import split_escape, SignalHandler, OptionParser
VERSION = (1, 3)
_sig = SignalHandler()
global verbose
verbose = True
class ID3OptionParser(OptionParser):
def __init__(self):
mutagen_version = ".".join(map(str, mutagen.version))
my_version = ".".join(map(str, VERSION))
version = "mid3v2 %s\nUses Mutagen %s" % (my_version, mutagen_version)
self.edits = []
OptionParser.__init__(
self, version=version,
usage="%prog [OPTION] [FILE]...",
description="Mutagen-based replacement for id3lib's id3v2.")
def format_help(self, *args, **kwargs):
text = OptionParser.format_help(self, *args, **kwargs)
return text + """\
You can set the value for any ID3v2 frame by using '--' and then a frame ID.
For example:
mid3v2 --TIT3 "Monkey!" file.mp3
would set the "Subtitle/Description" frame to "Monkey!".
Any editing operation will cause the ID3 tag to be upgraded to ID3v2.4.
"""
def list_frames(option, opt, value, parser):
items = mutagen.id3.Frames.items()
for name, frame in sorted(items):
print_(u" --%s %s" % (name, frame.__doc__.split("\n")[0]))
raise SystemExit
def list_frames_2_2(option, opt, value, parser):
items = mutagen.id3.Frames_2_2.items()
items.sort()
for name, frame in items:
print_(u" --%s %s" % (name, frame.__doc__.split("\n")[0]))
raise SystemExit
def list_genres(option, opt, value, parser):
for i, genre in enumerate(mutagen.id3.TCON.GENRES):
print_(u"%3d: %s" % (i, genre))
raise SystemExit
def delete_tags(filenames, v1, v2):
for filename in filenames:
with _sig.block():
if verbose:
print_(u"deleting ID3 tag info in", filename, file=sys.stderr)
mutagen.id3.delete(filename, v1, v2)
def delete_frames(deletes, filenames):
try:
deletes = frame_from_fsnative(deletes)
except ValueError as err:
print_(text_type(err), file=sys.stderr)
frames = deletes.split(",")
for filename in filenames:
with _sig.block():
if verbose:
print_(u"deleting %s from" % deletes, filename,
file=sys.stderr)
try:
id3 = mutagen.id3.ID3(filename)
except mutagen.id3.ID3NoHeaderError:
if verbose:
print_(u"No ID3 header found; skipping.", file=sys.stderr)
except Exception as err:
print_(text_type(err), file=sys.stderr)
raise SystemExit(1)
else:
for frame in frames:
id3.delall(frame)
id3.save()
def frame_from_fsnative(arg):
"""Takes item from argv and returns ascii native str
or raises ValueError.
"""
assert isinstance(arg, fsnative)
text = fsn2text(arg, strict=True)
if PY2:
return text.encode("ascii")
else:
return text.encode("ascii").decode("ascii")
def value_from_fsnative(arg, escape):
"""Takes an item from argv and returns a text_type value without
surrogate escapes or raises ValueError.
"""
assert isinstance(arg, fsnative)
if escape:
bytes_ = fsn2bytes(arg, "utf-8")
if PY2:
bytes_ = bytes_.decode("string_escape")
else:
bytes_ = codecs.escape_decode(bytes_)[0]
arg = bytes2fsn(bytes_, "utf-8")
text = fsn2text(arg, strict=True)
return text
def error(*args):
print_(*args, file=sys.stderr)
raise SystemExit(1)
def get_frame_encoding(frame_id, value):
if frame_id == "APIC":
# See https://github.com/beetbox/beets/issues/899#issuecomment-62437773
return Encoding.UTF16 if value else Encoding.LATIN1
else:
return Encoding.UTF8
def write_files(edits, filenames, escape):
# unescape escape sequences and decode values
encoded_edits = []
for frame, value in edits:
if not value:
continue
try:
frame = frame_from_fsnative(frame)
except ValueError as err:
print_(text_type(err), file=sys.stderr)
assert isinstance(frame, str)
# strip "--"
frame = frame[2:]
try:
value = value_from_fsnative(value, escape)
except ValueError as err:
error(u"%s: %s" % (frame, text_type(err)))
assert isinstance(value, text_type)
encoded_edits.append((frame, value))
edits = encoded_edits
# preprocess:
# for all [frame,value] pairs in the edits list
# gather values for identical frames into a list
tmp = {}
for frame, value in edits:
if frame in tmp:
tmp[frame].append(value)
else:
tmp[frame] = [value]
# edits is now a dictionary of frame -> [list of values]
edits = tmp
# escape also enables escaping of the split separator
if escape:
string_split = split_escape
else:
string_split = lambda s, *args, **kwargs: s.split(*args, **kwargs)
for filename in filenames:
with _sig.block():
if verbose:
print_(u"Writing", filename, file=sys.stderr)
try:
id3 = mutagen.id3.ID3(filename)
except mutagen.id3.ID3NoHeaderError:
if verbose:
print_(u"No ID3 header found; creating a new tag",
file=sys.stderr)
id3 = mutagen.id3.ID3()
except Exception as err:
print_(str(err), file=sys.stderr)
continue
for (frame, vlist) in edits.items():
if frame == "POPM":
for value in vlist:
values = string_split(value, ":")
if len(values) == 1:
email, rating, count = values[0], 0, 0
elif len(values) == 2:
email, rating, count = values[0], values[1], 0
else:
email, rating, count = values
frame = mutagen.id3.POPM(
email=email, rating=int(rating), count=int(count))
id3.add(frame)
elif frame == "APIC":
for value in vlist:
values = string_split(value, ":")
# FIXME: doesn't support filenames with an invalid
# encoding since we have already decoded at that point
fn = values[0]
if len(values) >= 2:
desc = values[1]
else:
desc = u"cover"
if len(values) >= 3:
try:
picture_type = int(values[2])
except ValueError:
error(u"Invalid picture type: %r" % values[1])
else:
picture_type = PictureType.COVER_FRONT
if len(values) >= 4:
mime = values[3]
else:
mime = mimetypes.guess_type(fn)[0] or "image/jpeg"
if len(values) >= 5:
error("APIC: Invalid format")
encoding = get_frame_encoding(frame, desc)
try:
with open(fn, "rb") as h:
data = h.read()
except IOError as e:
error(text_type(e))
frame = mutagen.id3.APIC(encoding=encoding, mime=mime,
desc=desc, type=picture_type, data=data)
id3.add(frame)
elif frame == "COMM":
for value in vlist:
values = string_split(value, ":")
if len(values) == 1:
value, desc, lang = values[0], "", "eng"
elif len(values) == 2:
desc, value, lang = values[0], values[1], "eng"
else:
value = ":".join(values[1:-1])
desc, lang = values[0], values[-1]
frame = mutagen.id3.COMM(
encoding=3, text=value, lang=lang, desc=desc)
id3.add(frame)
elif frame == "UFID":
for value in vlist:
values = string_split(value, ":")
if len(values) != 2:
error(u"Invalid value: %r" % values)
owner = values[0]
data = values[1].encode("utf-8")
frame = mutagen.id3.UFID(owner=owner, data=data)
id3.add(frame)
elif frame == "TXXX":
for value in vlist:
values = string_split(value, ":", 1)
if len(values) == 1:
desc, value = "", values[0]
else:
desc, value = values[0], values[1]
frame = mutagen.id3.TXXX(
encoding=3, text=value, desc=desc)
id3.add(frame)
elif issubclass(mutagen.id3.Frames[frame],
mutagen.id3.UrlFrame):
frame = mutagen.id3.Frames[frame](encoding=3, url=vlist)
id3.add(frame)
else:
frame = mutagen.id3.Frames[frame](encoding=3, text=vlist)
id3.add(frame)
id3.save(filename)
def list_tags(filenames):
for filename in filenames:
print_("IDv2 tag info for", filename)
try:
id3 = mutagen.id3.ID3(filename, translate=False)
except mutagen.id3.ID3NoHeaderError:
print_(u"No ID3 header found; skipping.")
except Exception as err:
print_(text_type(err), file=sys.stderr)
raise SystemExit(1)
else:
print_(id3.pprint())
def list_tags_raw(filenames):
for filename in filenames:
print_("Raw IDv2 tag info for", filename)
try:
id3 = mutagen.id3.ID3(filename, translate=False)
except mutagen.id3.ID3NoHeaderError:
print_(u"No ID3 header found; skipping.")
except Exception as err:
print_(text_type(err), file=sys.stderr)
raise SystemExit(1)
else:
for frame in id3.values():
print_(text_type(repr(frame)))
def main(argv):
parser = ID3OptionParser()
parser.add_option(
"-v", "--verbose", action="store_true", dest="verbose", default=False,
help="be verbose")
parser.add_option(
"-q", "--quiet", action="store_false", dest="verbose",
help="be quiet (the default)")
parser.add_option(
"-e", "--escape", action="store_true", default=False,
help="enable interpretation of backslash escapes")
parser.add_option(
"-f", "--list-frames", action="callback", callback=list_frames,
help="Display all possible frames for ID3v2.3 / ID3v2.4")
parser.add_option(
"--list-frames-v2.2", action="callback", callback=list_frames_2_2,
help="Display all possible frames for ID3v2.2")
parser.add_option(
"-L", "--list-genres", action="callback", callback=list_genres,
help="Lists all ID3v1 genres")
parser.add_option(
"-l", "--list", action="store_const", dest="action", const="list",
help="Lists the tag(s) on the open(s)")
parser.add_option(
"--list-raw", action="store_const", dest="action", const="list-raw",
help="Lists the tag(s) on the open(s) in Python format")
parser.add_option(
"-d", "--delete-v2", action="store_const", dest="action",
const="delete-v2", help="Deletes ID3v2 tags")
parser.add_option(
"-s", "--delete-v1", action="store_const", dest="action",
const="delete-v1", help="Deletes ID3v1 tags")
parser.add_option(
"-D", "--delete-all", action="store_const", dest="action",
const="delete-v1-v2", help="Deletes ID3v1 and ID3v2 tags")
parser.add_option(
'--delete-frames', metavar='FID1,FID2,...', action='store',
dest='deletes', default='', help="Delete the given frames")
parser.add_option(
"-C", "--convert", action="store_const", dest="action",
const="convert",
help="Convert tags to ID3v2.4 (any editing will do this)")
parser.add_option(
"-a", "--artist", metavar='"ARTIST"', action="callback",
help="Set the artist information", type="string",
callback=lambda *args: args[3].edits.append((fsnative(u"--TPE1"),
args[2])))
parser.add_option(
"-A", "--album", metavar='"ALBUM"', action="callback",
help="Set the album title information", type="string",
callback=lambda *args: args[3].edits.append((fsnative(u"--TALB"),
args[2])))
parser.add_option(
"-t", "--song", metavar='"SONG"', action="callback",
help="Set the song title information", type="string",
callback=lambda *args: args[3].edits.append((fsnative(u"--TIT2"),
args[2])))
parser.add_option(
"-c", "--comment", metavar='"DESCRIPTION":"COMMENT":"LANGUAGE"',
action="callback", help="Set the comment information", type="string",
callback=lambda *args: args[3].edits.append((fsnative(u"--COMM"),
args[2])))
parser.add_option(
"-p", "--picture",
metavar='"FILENAME":"DESCRIPTION":"IMAGE-TYPE":"MIME-TYPE"',
action="callback", help="Set the picture", type="string",
callback=lambda *args: args[3].edits.append((fsnative(u"--APIC"),
args[2])))
parser.add_option(
"-g", "--genre", metavar='"GENRE"', action="callback",
help="Set the genre or genre number", type="string",
callback=lambda *args: args[3].edits.append((fsnative(u"--TCON"),
args[2])))
parser.add_option(
"-y", "--year", "--date", metavar='YYYY[-MM-DD]', action="callback",
help="Set the year/date", type="string",
callback=lambda *args: args[3].edits.append((fsnative(u"--TDRC"),
args[2])))
parser.add_option(
"-T", "--track", metavar='"num/num"', action="callback",
help="Set the track number/(optional) total tracks", type="string",
callback=lambda *args: args[3].edits.append((fsnative(u"--TRCK"),
args[2])))
for key, frame in mutagen.id3.Frames.items():
if (issubclass(frame, mutagen.id3.TextFrame)
or issubclass(frame, mutagen.id3.UrlFrame)
or issubclass(frame, mutagen.id3.POPM)
or frame in (mutagen.id3.APIC, mutagen.id3.UFID)):
parser.add_option(
"--" + key, action="callback", help=SUPPRESS_HELP,
type='string', metavar="value", # optparse blows up with this
callback=lambda *args: args[3].edits.append(args[1:3]))
(options, args) = parser.parse_args(argv[1:])
global verbose
verbose = options.verbose
if args:
if parser.edits or options.deletes:
if options.deletes:
delete_frames(options.deletes, args)
if parser.edits:
write_files(parser.edits, args, options.escape)
elif options.action in [None, 'list']:
list_tags(args)
elif options.action == "list-raw":
list_tags_raw(args)
elif options.action == "convert":
write_files([], args, options.escape)
elif options.action.startswith("delete"):
delete_tags(args, "v1" in options.action, "v2" in options.action)
else:
parser.print_help()
else:
parser.print_help()
def entry_point():
_sig.init()
return main(argv)
| {
"content_hash": "58870c70707d206119f01dac2fcb8261",
"timestamp": "",
"source": "github",
"line_count": 457,
"max_line_length": 79,
"avg_line_length": 37.266958424507656,
"alnum_prop": 0.5151782044507075,
"repo_name": "jules185/IoT_Hackathon",
"id": "8d21c13efc9c42b102614c89a5d4ab8582c56e1f",
"size": "17337",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": ".homeassistant/deps/mutagen/_tools/mid3v2.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "12396"
},
{
"name": "HTML",
"bytes": "1557"
},
{
"name": "JavaScript",
"bytes": "2843"
},
{
"name": "Python",
"bytes": "8347316"
}
],
"symlink_target": ""
} |
import json, re
def parse(df, data, utc):
# df is a dict with the following keys:
# [u'feedurl', u'feedname', u'bssid', u'format', u'feedurl2', u'keyreq', u'parsername', u'rid']
# parse json data
try:
data_json = json.loads(data)
except ValueError:
print(utc + ' ' + df['bssid'] + " Parsing JSON failed for " + df['feedurl'])
return False
# check if we retreived the station list
if not 'features' in data_json:
print(utc + ' ' + df['bssid'] + " Data does not contain 'features' element'. No data found.")
return False
# open the stationBeanList now that we know it exists
stations_list = data_json['features']
# check for the size of stationBeanList
if len(stations_list) <= 1:
print(utc + ' ' + df['bssid'] + " Data does not contain 'feautres' element'. No data found.")
return False
# capture clean results in clean_stations_list
clean_stations_list = []
for stn_dict in stations_list:
# build the list of valid data
# check if the station is online
if stn_dict['properties']['kioskPublicStatus'] == 'Active':
active = 'yes'
else:
active = 'no'
# stnid, lat, lng, docks, bikes, spaces, name, active
clean_stations_list.append([
str(stn_dict['properties']['kioskId']),
str(stn_dict['geometry']['coordinates'][1]), # lat
str(stn_dict['geometry']['coordinates'][0]), # long
str(int(stn_dict['properties']['docksAvailable']) + int(stn_dict['properties']['bikesAvailable'])),
str(stn_dict['properties']['bikesAvailable']),
str(stn_dict['properties']['docksAvailable']),
str(stn_dict['properties']['name']),
active])
# End of stations looping
# check if we have some data
if len(clean_stations_list) == 0:
print(utc + ' ' + df['bssid'] + " Parser did not find any station's data.")
return False
return clean_stations_list
| {
"content_hash": "957ec4d7b54bb4e646e933bba9de12bd",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 111,
"avg_line_length": 37.607142857142854,
"alnum_prop": 0.5698005698005698,
"repo_name": "serialc/BSR_parsers",
"id": "fe62d72f27b0a94b044d6fe28f4267dd80654a1d",
"size": "2166",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "parsers/pyBSRP/build/lib/bsrp/protocols/bcyclejson.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "109119"
}
],
"symlink_target": ""
} |
import cherrypy
import os, os.path
class HelloWorld(object):
@cherrypy.expose
def index(self):
#replace the return string below with your templating engine of choice
return """<html>
<head>
<title>CherryPy static content example</title>
<link rel="stylesheet" type="text/css" href="/css/styles.css" type="text/css"></link>
</head>
<html>
<body>
<h1>Static example</h1>
<img src="/images/plus.gif">
</body>
</html>"""
cherrypy.quickstart(HelloWorld(), config="conf/app.cfg") | {
"content_hash": "20a775953251a4a3331cac40b51c0820",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 93,
"avg_line_length": 25.95,
"alnum_prop": 0.6647398843930635,
"repo_name": "Decker108/cherrypy-static-content-example",
"id": "39763285b369a0254caf53ef4544c60f8fd533eb",
"size": "519",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "main.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "210"
},
{
"name": "Python",
"bytes": "519"
}
],
"symlink_target": ""
} |
from distutils.core import setup
setup(
name = 'django-markdown-newsletter',
packages = ['django_markdown_newsletter'], # this must be the same as the name above
version = '0.7',
description = 'Easy to use Django markdown newslette',
author = 'Samy Melaine',
author_email = '[email protected]',
url = 'https://github.com/SamyMe/django-markdown-newsletter', # use the URL to the github repo
download_url = 'https://github.com/SamyMe/django-markdown-newsletter/tarball/0.1', # I'll explain this in a second
keywords = ['newsletter', 'django', 'python', 'markdown','easy'], # arbitrary keywords
classifiers=[
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
],
)
| {
"content_hash": "353c8fb97372a93f37ed6fd834b7d00b",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 116,
"avg_line_length": 39.94444444444444,
"alnum_prop": 0.7009735744089013,
"repo_name": "SamyMe/django-markdown-newsletter",
"id": "348c89674ceb859c7e80e0829c3bf5ee81522196",
"size": "719",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "setup.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "33596"
}
],
"symlink_target": ""
} |
import os
import ddt
import mock
from oslo_concurrency import processutils
from oslo_config import cfg
from manila import exception
from manila.share import configuration
from manila.share.drivers import service_instance as generic_service_instance
from manila.share.drivers.windows import service_instance
from manila.share.drivers.windows import windows_utils
from manila import test
CONF = cfg.CONF
CONF.import_opt('driver_handles_share_servers',
'manila.share.driver')
CONF.register_opts(generic_service_instance.common_opts)
serv_mgr_cls = service_instance.WindowsServiceInstanceManager
generic_serv_mgr_cls = generic_service_instance.ServiceInstanceManager
@ddt.ddt
class WindowsServiceInstanceManagerTestCase(test.TestCase):
_FAKE_SERVER = {'ip': mock.sentinel.ip,
'instance_id': mock.sentinel.instance_id}
@mock.patch.object(windows_utils, 'WindowsUtils')
@mock.patch.object(serv_mgr_cls, '_check_auth_mode')
def setUp(self, mock_check_auth, mock_utils_cls):
self.flags(service_instance_user=mock.sentinel.username)
self._remote_execute = mock.Mock()
fake_conf = configuration.Configuration(None)
self._mgr = serv_mgr_cls(remote_execute=self._remote_execute,
driver_config=fake_conf)
self._windows_utils = mock_utils_cls.return_value
super(WindowsServiceInstanceManagerTestCase, self).setUp()
@ddt.data({},
{'use_cert_auth': False},
{'use_cert_auth': False, 'valid_pass_complexity': False},
{'certs_exist': False})
@mock.patch('os.path.exists')
@mock.patch.object(serv_mgr_cls, '_check_password_complexity')
@ddt.unpack
def test_check_auth_mode(self, mock_check_complexity, mock_path_exists,
use_cert_auth=True, certs_exist=True,
valid_pass_complexity=True):
self.flags(service_instance_password=mock.sentinel.password)
self._mgr._cert_pem_path = mock.sentinel.cert_path
self._mgr._cert_key_pem_path = mock.sentinel.key_path
mock_path_exists.return_value = certs_exist
mock_check_complexity.return_value = valid_pass_complexity
self._mgr._use_cert_auth = use_cert_auth
invalid_auth = ((use_cert_auth and not certs_exist)
or not valid_pass_complexity)
if invalid_auth:
self.assertRaises(exception.ServiceInstanceException,
self._mgr._check_auth_mode)
else:
self._mgr._check_auth_mode()
if not use_cert_auth:
mock_check_complexity.assert_called_once_with(
str(mock.sentinel.password))
@ddt.data(False, True)
def test_get_auth_info(self, use_cert_auth):
self._mgr._use_cert_auth = use_cert_auth
self._mgr._cert_pem_path = mock.sentinel.cert_path
self._mgr._cert_key_pem_path = mock.sentinel.key_path
auth_info = self._mgr._get_auth_info()
expected_auth_info = {'use_cert_auth': use_cert_auth}
if use_cert_auth:
expected_auth_info.update(cert_pem_path=mock.sentinel.cert_path,
cert_key_pem_path=mock.sentinel.key_path)
self.assertEqual(expected_auth_info, auth_info)
@mock.patch.object(serv_mgr_cls, '_get_auth_info')
@mock.patch.object(generic_serv_mgr_cls, 'get_common_server')
def test_common_server(self, mock_generic_get_server, mock_get_auth):
mock_server_details = {'backend_details': {}}
mock_auth_info = {'fake_auth_info': mock.sentinel.auth_info}
mock_generic_get_server.return_value = mock_server_details
mock_get_auth.return_value = mock_auth_info
expected_server_details = dict(backend_details=mock_auth_info)
server_details = self._mgr.get_common_server()
mock_generic_get_server.assert_called_once_with()
self.assertEqual(expected_server_details, server_details)
@mock.patch.object(serv_mgr_cls, '_get_auth_info')
@mock.patch.object(generic_serv_mgr_cls, '_get_new_instance_details')
def test_get_new_instance_details(self, mock_generic_get_details,
mock_get_auth):
mock_server_details = {'fake_server_details':
mock.sentinel.server_details}
mock_generic_get_details.return_value = mock_server_details
mock_auth_info = {'fake_auth_info': mock.sentinel.auth_info}
mock_get_auth.return_value = mock_auth_info
expected_server_details = dict(mock_server_details, **mock_auth_info)
instance_details = self._mgr._get_new_instance_details(
server=mock.sentinel.server)
mock_generic_get_details.assert_called_once_with(mock.sentinel.server)
self.assertEqual(expected_server_details, instance_details)
@ddt.data(('abAB01', True),
('abcdef', False),
('aA0', False))
@ddt.unpack
def test_check_password_complexity(self, password, expected_result):
valid_complexity = self._mgr._check_password_complexity(
password)
self.assertEqual(expected_result, valid_complexity)
@ddt.data(None, Exception)
def test_server_connection(self, side_effect):
self._remote_execute.side_effect = side_effect
expected_result = side_effect is None
is_available = self._mgr._test_server_connection(self._FAKE_SERVER)
self.assertEqual(expected_result, is_available)
self._remote_execute.assert_called_once_with(self._FAKE_SERVER,
"whoami",
retry=False)
@ddt.data(False, True)
def test_get_service_instance_create_kwargs(self, use_cert_auth):
self._mgr._use_cert_auth = use_cert_auth
self.flags(service_instance_password=mock.sentinel.admin_pass)
if use_cert_auth:
mock_cert_data = 'mock_cert_data'
self.mock_object(service_instance, 'open',
mock.mock_open(
read_data=mock_cert_data))
expected_kwargs = dict(user_data=mock_cert_data)
else:
expected_kwargs = dict(
meta=dict(admin_pass=str(mock.sentinel.admin_pass)))
create_kwargs = self._mgr._get_service_instance_create_kwargs()
self.assertEqual(expected_kwargs, create_kwargs)
@mock.patch.object(generic_serv_mgr_cls, 'set_up_service_instance')
@mock.patch.object(serv_mgr_cls, 'get_valid_security_service')
@mock.patch.object(serv_mgr_cls, '_setup_security_service')
def test_set_up_service_instance(self, mock_setup_security_service,
mock_get_valid_security_service,
mock_generic_setup_serv_inst):
mock_service_instance = {'instance_details': None}
mock_network_info = {'security_services':
mock.sentinel.security_services}
mock_generic_setup_serv_inst.return_value = mock_service_instance
mock_get_valid_security_service.return_value = (
mock.sentinel.security_service)
instance_details = self._mgr.set_up_service_instance(
mock.sentinel.context, mock_network_info)
mock_generic_setup_serv_inst.assert_called_once_with(
mock.sentinel.context, mock_network_info)
mock_get_valid_security_service.assert_called_once_with(
mock.sentinel.security_services)
mock_setup_security_service.assert_called_once_with(
mock_service_instance, mock.sentinel.security_service)
expected_instance_details = dict(mock_service_instance,
joined_domain=True)
self.assertEqual(expected_instance_details,
instance_details)
@mock.patch.object(serv_mgr_cls, '_run_cloudbase_init_plugin_after_reboot')
@mock.patch.object(serv_mgr_cls, '_join_domain')
def test_setup_security_service(self, mock_join_domain,
mock_run_cbsinit_plugin):
utils = self._windows_utils
mock_security_service = {'domain': mock.sentinel.domain,
'user': mock.sentinel.admin_username,
'password': mock.sentinel.admin_password,
'dns_ip': mock.sentinel.dns_ip}
utils.get_interface_index_by_ip.return_value = (
mock.sentinel.interface_index)
self._mgr._setup_security_service(self._FAKE_SERVER,
mock_security_service)
utils.set_dns_client_search_list.assert_called_once_with(
self._FAKE_SERVER,
[mock_security_service['domain']])
utils.get_interface_index_by_ip.assert_called_once_with(
self._FAKE_SERVER,
self._FAKE_SERVER['ip'])
utils.set_dns_client_server_addresses.assert_called_once_with(
self._FAKE_SERVER,
mock.sentinel.interface_index,
[mock_security_service['dns_ip']])
mock_run_cbsinit_plugin.assert_called_once_with(
self._FAKE_SERVER,
plugin_name=self._mgr._CBS_INIT_WINRM_PLUGIN)
mock_join_domain.assert_called_once_with(
self._FAKE_SERVER,
mock.sentinel.domain,
mock.sentinel.admin_username,
mock.sentinel.admin_password)
@ddt.data({'join_domain_side_eff': Exception},
{'server_available': False,
'expected_exception': exception.ServiceInstanceException},
{'join_domain_side_eff': processutils.ProcessExecutionError,
'expected_exception': processutils.ProcessExecutionError},
{'domain_mismatch': True,
'expected_exception': exception.ServiceInstanceException})
@mock.patch.object(generic_serv_mgr_cls, 'reboot_server')
@mock.patch.object(generic_serv_mgr_cls, 'wait_for_instance_to_be_active')
@mock.patch.object(generic_serv_mgr_cls, '_check_server_availability')
@ddt.unpack
def test_join_domain(self, mock_check_avail,
mock_wait_instance_active,
mock_reboot_server,
expected_exception=None,
server_available=True,
domain_mismatch=False,
join_domain_side_eff=None):
self._windows_utils.join_domain.side_effect = join_domain_side_eff
mock_check_avail.return_value = server_available
self._windows_utils.get_current_domain.return_value = (
None if domain_mismatch else mock.sentinel.domain)
domain_params = (mock.sentinel.domain,
mock.sentinel.admin_username,
mock.sentinel.admin_password)
if expected_exception:
self.assertRaises(expected_exception,
self._mgr._join_domain,
self._FAKE_SERVER,
*domain_params)
else:
self._mgr._join_domain(self._FAKE_SERVER,
*domain_params)
if join_domain_side_eff != processutils.ProcessExecutionError:
mock_reboot_server.assert_called_once_with(
self._FAKE_SERVER, soft_reboot=True)
mock_wait_instance_active.assert_called_once_with(
self._FAKE_SERVER['instance_id'],
timeout=self._mgr.max_time_to_build_instance)
mock_check_avail.assert_called_once_with(self._FAKE_SERVER)
if server_available:
self._windows_utils.get_current_domain.assert_called_once_with(
self._FAKE_SERVER)
self._windows_utils.join_domain.assert_called_once_with(
self._FAKE_SERVER,
*domain_params)
@ddt.data([],
[{'type': 'active_directory'}],
[{'type': 'active_directory'}] * 2,
[{'type': mock.sentinel.invalid_type}])
def test_get_valid_security_service(self, security_services):
valid_security_service = self._mgr.get_valid_security_service(
security_services)
if (security_services and len(security_services) == 1 and
security_services[0]['type'] == 'active_directory'):
expected_valid_sec_service = security_services[0]
else:
expected_valid_sec_service = None
self.assertEqual(expected_valid_sec_service,
valid_security_service)
@mock.patch.object(serv_mgr_cls, '_get_cbs_init_reg_section')
def test_run_cloudbase_init_plugin_after_reboot(self,
mock_get_cbs_init_reg):
self._FAKE_SERVER = {'instance_id': mock.sentinel.instance_id}
mock_get_cbs_init_reg.return_value = mock.sentinel.cbs_init_reg_sect
expected_plugin_key_path = "%(cbs_init)s\\%(instance_id)s\\Plugins" % {
'cbs_init': mock.sentinel.cbs_init_reg_sect,
'instance_id': self._FAKE_SERVER['instance_id']}
self._mgr._run_cloudbase_init_plugin_after_reboot(
server=self._FAKE_SERVER,
plugin_name=mock.sentinel.plugin_name)
mock_get_cbs_init_reg.assert_called_once_with(self._FAKE_SERVER)
self._windows_utils.set_win_reg_value.assert_called_once_with(
self._FAKE_SERVER,
path=expected_plugin_key_path,
key=mock.sentinel.plugin_name,
value=self._mgr._CBS_INIT_RUN_PLUGIN_AFTER_REBOOT)
@ddt.data(
{},
{'exec_errors': [
processutils.ProcessExecutionError(stderr='Cannot find path'),
processutils.ProcessExecutionError(stderr='Cannot find path')],
'expected_exception': exception.ServiceInstanceException},
{'exec_errors': [processutils.ProcessExecutionError(stderr='')],
'expected_exception': processutils.ProcessExecutionError},
{'exec_errors': [
processutils.ProcessExecutionError(stderr='Cannot find path'),
None]}
)
@ddt.unpack
def test_get_cbs_init_reg_section(self, exec_errors=None,
expected_exception=None):
self._windows_utils.normalize_path.return_value = (
mock.sentinel.normalized_section_path)
self._windows_utils.get_win_reg_value.side_effect = exec_errors
if expected_exception:
self.assertRaises(expected_exception,
self._mgr._get_cbs_init_reg_section,
mock.sentinel.server)
else:
cbs_init_section = self._mgr._get_cbs_init_reg_section(
mock.sentinel.server)
self.assertEqual(mock.sentinel.normalized_section_path,
cbs_init_section)
base_path = 'hklm:\\SOFTWARE'
cbs_section = 'Cloudbase Solutions\\Cloudbase-Init'
tested_upper_sections = ['']
if exec_errors and 'Cannot find path' in exec_errors[0].stderr:
tested_upper_sections.append('Wow6432Node')
tested_sections = [os.path.join(base_path,
upper_section,
cbs_section)
for upper_section in tested_upper_sections]
self._windows_utils.normalize_path.assert_has_calls(
[mock.call(tested_section)
for tested_section in tested_sections])
| {
"content_hash": "d1760fa847a36452e1284d84453377a0",
"timestamp": "",
"source": "github",
"line_count": 352,
"max_line_length": 79,
"avg_line_length": 44.73863636363637,
"alnum_prop": 0.601981203962408,
"repo_name": "vponomaryov/manila",
"id": "eca61f0e05f4c65967be235918604080a78cf1a1",
"size": "16391",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "manila/tests/share/drivers/windows/test_service_instance.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Mako",
"bytes": "953"
},
{
"name": "Python",
"bytes": "9697997"
},
{
"name": "Shell",
"bytes": "103800"
}
],
"symlink_target": ""
} |
import sqlite3 as lite
con = lite.connect(r"./die_zeit.db")
with con:
cur = con.cursor()
cur.execute("CREATE TABLE Articles(id INT, uuid TEXT, title TEXT, releaseDate DATETIME, subtitle TEXT, uri TEXT, href TEXT)")
| {
"content_hash": "d5475bbd7098b5ecc2567aa7a3a0da69",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 129,
"avg_line_length": 14.625,
"alnum_prop": 0.6794871794871795,
"repo_name": "mitchellduffy/topzeit",
"id": "ef8d2af8c9ebe66e5b99129362e1238ab1bc98f9",
"size": "234",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "db_builder.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "2594"
}
],
"symlink_target": ""
} |
import appleseed as asr
from ..logger import get_logger
logger = get_logger()
class BaseRendererController(asr.IRendererController):
def __init__(self):
super(BaseRendererController, self).__init__()
self._status = asr.IRenderControllerStatus.ContinueRendering
def set_status(self, status):
self._status = status
def on_rendering_begin(self):
pass
def on_rendering_success(self):
logger.debug("Render finished")
def on_rendering_abort(self):
pass
def on_frame_begin(self):
pass
def on_frame_end(self):
pass
def on_progress(self):
pass
class FinalRendererController(BaseRendererController):
def __init__(self, engine, tile_callback):
super(FinalRendererController, self).__init__()
self.__engine = engine
self.__tile_callback = tile_callback
def get_status(self):
if self.__engine.test_break():
return asr.IRenderControllerStatus.AbortRendering
render_stats = self.__tile_callback.render_stats
self.__engine.update_stats(render_stats[0], render_stats[1])
return self._status
def on_rendering_begin(self):
logger.debug("Starting Render")
self.__engine.update_stats("appleseed Rendering: Loading scene", "Time Remaining: Unknown")
class InteractiveRendererController(BaseRendererController):
def __init__(self):
super(InteractiveRendererController, self).__init__()
def on_frame_begin(self):
pass
def get_status(self):
return self._status
| {
"content_hash": "687b16705d31166dba95d44a002beddf",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 99,
"avg_line_length": 25.677419354838708,
"alnum_prop": 0.6526381909547738,
"repo_name": "appleseedhq/blenderseed",
"id": "455c5d481f9d0c84f927ab3b38ed9e8be169bde2",
"size": "2895",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "render/renderercontroller.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "15512"
},
{
"name": "Python",
"bytes": "578167"
}
],
"symlink_target": ""
} |
import unittest
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
class TypingTests(unittest.TestCase):
def testShouldFireKeyPressEvents(self):
self._loadPage("javascriptPage")
keyReporter = self.driver.find_element(by=By.ID, value="keyReporter")
keyReporter.send_keys("a")
result = self.driver.find_element(by=By.ID, value="result")
self.assertTrue("press:" in result.text, "Expected: {0} . Result is {1}".format("press:", result.text))
def testShouldFireKeyDownEvents(self):
self._loadPage("javascriptPage")
keyReporter = self.driver.find_element(by=By.ID, value="keyReporter")
keyReporter.send_keys("I")
result = self.driver.find_element(by=By.ID, value="result")
self.assertTrue("down" in result.text, "Expected: {0} . Result is {1}".format("down", result.text))
def testShouldFireKeyUpEvents(self):
self._loadPage("javascriptPage")
keyReporter = self.driver.find_element(by=By.ID, value="keyReporter")
keyReporter.send_keys("a")
result = self.driver.find_element(by=By.ID, value="result")
self.assertTrue("up:" in result.text, "Expected: {0} . Result is {1}".format("up:", result.text))
def testShouldTypeLowerCaseLetters(self):
self._loadPage("javascriptPage")
keyReporter = self.driver.find_element(by=By.ID, value="keyReporter")
keyReporter.send_keys("abc def")
self.assertEqual(keyReporter.get_attribute("value"), "abc def")
def testShouldBeAbleToTypeCapitalLetters(self):
self._loadPage("javascriptPage")
keyReporter = self.driver.find_element(by=By.ID, value="keyReporter")
keyReporter.send_keys("ABC DEF")
self.assertEqual(keyReporter.get_attribute("value"), "ABC DEF")
def testShouldBeAbleToTypeQuoteMarks(self):
self._loadPage("javascriptPage")
keyReporter = self.driver.find_element(by=By.ID, value="keyReporter")
keyReporter.send_keys("\"")
self.assertEqual(keyReporter.get_attribute("value"), "\"")
def testShouldBeAbleToTypeTheAtCharacter(self):
self._loadPage("javascriptPage")
keyReporter = self.driver.find_element(by=By.ID, value="keyReporter")
keyReporter.send_keys("@")
self.assertEqual(keyReporter.get_attribute("value"), "@")
def testShouldBeAbleToMixUpperAndLowerCaseLetters(self):
self._loadPage("javascriptPage")
keyReporter = self.driver.find_element(by=By.ID, value="keyReporter")
keyReporter.send_keys("[email protected]")
self.assertEqual(keyReporter.get_attribute("value"), "[email protected]")
def testArrowKeysShouldNotBePrintable(self):
self._loadPage("javascriptPage")
keyReporter = self.driver.find_element(by=By.ID, value="keyReporter")
keyReporter.send_keys(Keys.ARROW_LEFT)
self.assertEqual(keyReporter.get_attribute("value"), "")
def testListOfArrowKeysShouldNotBePrintable(self):
self._loadPage("javascriptPage")
keyReporter = self.driver.find_element(by=By.ID, value="keyReporter")
keyReporter.send_keys([Keys.ARROW_LEFT])
self.assertEqual(keyReporter.get_attribute("value"), "")
def testShouldBeAbleToUseArrowKeys(self):
self._loadPage("javascriptPage")
keyReporter = self.driver.find_element(by=By.ID, value="keyReporter")
keyReporter.send_keys("Tet", Keys.ARROW_LEFT, "s")
self.assertEqual(keyReporter.get_attribute("value"), "Test")
def testWillSimulateAKeyUpWhenEnteringTextIntoInputElements(self):
self._loadPage("javascriptPage")
element = self.driver.find_element(by=By.ID, value="keyUp")
element.send_keys("I like cheese")
result = self.driver.find_element(by=By.ID, value="result")
self.assertEqual(result.text, "I like cheese")
def testWillSimulateAKeyDownWhenEnteringTextIntoInputElements(self):
self._loadPage("javascriptPage")
element = self.driver.find_element(by=By.ID, value="keyDown")
element.send_keys("I like cheese")
result = self.driver.find_element(by=By.ID, value="result")
# Because the key down gets the result before the input element is
# filled, we're a letter short here
self.assertEqual(result.text, "I like chees")
def testWillSimulateAKeyPressWhenEnteringTextIntoInputElements(self):
self._loadPage("javascriptPage")
element = self.driver.find_element(by=By.ID, value="keyPress")
element.send_keys("I like cheese")
result = self.driver.find_element(by=By.ID, value="result")
# Because the key down gets the result before the input element is
# filled, we're a letter short here
self.assertEqual(result.text, "I like chees")
def testWillSimulateAKeyUpWhenEnteringTextIntoTextAreas(self):
self._loadPage("javascriptPage")
element = self.driver.find_element(by=By.ID, value="keyUpArea")
element.send_keys("I like cheese")
result = self.driver.find_element(by=By.ID, value="result")
self.assertEqual(result.text, "I like cheese")
def testWillSimulateAKeyDownWhenEnteringTextIntoTextAreas(self):
self._loadPage("javascriptPage")
element = self.driver.find_element(by=By.ID, value="keyDownArea")
element.send_keys("I like cheese")
result = self.driver.find_element(by=By.ID, value="result")
# Because the key down gets the result before the input element is
# filled, we're a letter short here
self.assertEqual(result.text, "I like chees")
def testWillSimulateAKeyPressWhenEnteringTextIntoTextAreas(self):
self._loadPage("javascriptPage")
element = self.driver.find_element(by=By.ID, value="keyPressArea")
element.send_keys("I like cheese")
result = self.driver.find_element(by=By.ID, value="result")
# Because the key down gets the result before the input element is
# filled, we're a letter short here
self.assertEqual(result.text, "I like chees")
# @Ignore(value = {HTMLUNIT, CHROME_NON_WINDOWS, SELENESE, ANDROID},
# reason = "untested user agents")
def testShouldReportKeyCodeOfArrowKeysUpDownEvents(self):
self._loadPage("javascriptPage")
result = self.driver.find_element(by=By.ID, value="result")
element = self.driver.find_element(by=By.ID, value="keyReporter")
element.send_keys(Keys.ARROW_DOWN)
self.assertTrue("down: 40" in result.text.strip(), "Expected: {0} . Result is {1}".format("down: 40", result.text))
self.assertTrue("up: 40" in result.text.strip(), "Expected: {0} . Result is {1}".format("up: 40", result.text))
element.send_keys(Keys.ARROW_UP)
self.assertTrue("down: 38" in result.text.strip(), "Expected: {0} . Result is {1}".format("down: 38", result.text))
self.assertTrue("up: 38" in result.text.strip(), "Expected: {0} . Result is {1}".format("up: 38", result.text))
element.send_keys(Keys.ARROW_LEFT)
self.assertTrue("down: 37" in result.text.strip(), "Expected: {0} . Result is {1}".format("down: 37", result.text))
self.assertTrue("up: 37" in result.text.strip(), "Expected: {0} . Result is {1}".format("up: 37", result.text))
element.send_keys(Keys.ARROW_RIGHT)
self.assertTrue("down: 39" in result.text.strip(), "Expected: {0} . Result is {1}".format("down: 39", result.text))
self.assertTrue("up: 39" in result.text.strip(), "Expected: {0} . Result is {1}".format("up: 39", result.text))
# And leave no rubbish/printable keys in the "keyReporter"
self.assertEqual(element.get_attribute("value"), "")
def testNumericNonShiftKeys(self):
self._loadPage("javascriptPage")
element = self.driver.find_element(by=By.ID, value="keyReporter")
numericLineCharsNonShifted = "`1234567890-=[]\\,.'/42"
element.send_keys(numericLineCharsNonShifted)
self.assertEqual(element.get_attribute("value"), numericLineCharsNonShifted)
# @Ignore(value = {HTMLUNIT, CHROME_NON_WINDOWS, SELENESE, ANDROID},
# reason = "untested user agent")
def testNumericShiftKeys(self):
self._loadPage("javascriptPage")
result = self.driver.find_element(by=By.ID, value="result")
element = self.driver.find_element(by=By.ID, value="keyReporter")
numericShiftsEtc = "~!@#$%^&*()_+{}:i\"<>?|END~"
element.send_keys(numericShiftsEtc)
self.assertEqual(element.get_attribute("value"), numericShiftsEtc)
self.assertTrue("up: 16" in result.text.strip(), "Expected: {0} . Result is {1}".format("up: 16", result.text))
def testLowerCaseAlphaKeys(self):
self._loadPage("javascriptPage")
element = self.driver.find_element(by=By.ID, value="keyReporter")
lowerAlphas = "abcdefghijklmnopqrstuvwxyz"
element.send_keys(lowerAlphas)
self.assertEqual(element.get_attribute("value"), lowerAlphas)
def testUppercaseAlphaKeys(self):
self._loadPage("javascriptPage")
result = self.driver.find_element(by=By.ID, value="result")
element = self.driver.find_element(by=By.ID, value="keyReporter")
upperAlphas = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
element.send_keys(upperAlphas)
self.assertEqual(element.get_attribute("value"), upperAlphas)
self.assertTrue("up: 16" in result.text.strip(), "Expected: {0} . Result is {1}".format("up: 16", result.text))
def testAllPrintableKeys(self):
self._loadPage("javascriptPage")
result = self.driver.find_element(by=By.ID, value="result")
element = self.driver.find_element(by=By.ID, value="keyReporter")
allPrintable = "!\"#$%&'()*+,-./0123456789:<=>?@ ABCDEFGHIJKLMNOPQRSTUVWXYZ [\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
element.send_keys(allPrintable)
self.assertTrue(element.get_attribute("value"), allPrintable)
self.assertTrue("up: 16" in result.text.strip(), "Expected: {0} . Result is {1}".format("up: 16", result.text))
def testArrowKeysAndPageUpAndDown(self):
self._loadPage("javascriptPage")
element = self.driver.find_element(by=By.ID, value="keyReporter")
element.send_keys(
"a" + Keys.LEFT + "b" + Keys.RIGHT +
Keys.UP + Keys.DOWN + Keys.PAGE_UP + Keys.PAGE_DOWN + "1")
self.assertEqual(element.get_attribute("value"), "ba1")
# def testHomeAndEndAndPageUpAndPageDownKeys(self):
# // FIXME: macs don't have HOME keys, would PGUP work?
# if (Platform.getCurrent().is(Platform.MAC)) {
# return
# }
# self._loadPage("javascriptPage")
# element = self.driver.find_element(by=By.ID, value="keyReporter")
# element.send_keys("abc" + Keys.HOME + "0" + Keys.LEFT + Keys.RIGHT +
# Keys.PAGE_UP + Keys.PAGE_DOWN + Keys.END + "1" + Keys.HOME +
# "0" + Keys.PAGE_UP + Keys.END + "111" + Keys.HOME + "00")
# self.assertThat(element.get_attribute("value"), is("0000abc1111"))
# @Ignore(value = {HTMLUNIT, CHROME_NON_WINDOWS, SELENESE, ANDROID},
# reason = "untested user agents")
def testDeleteAndBackspaceKeys(self):
self._loadPage("javascriptPage")
element = self.driver.find_element(by=By.ID, value="keyReporter")
element.send_keys("abcdefghi")
self.assertEqual(element.get_attribute("value"), "abcdefghi")
element.send_keys(Keys.LEFT, Keys.LEFT, Keys.DELETE)
self.assertEqual(element.get_attribute("value"), "abcdefgi")
element.send_keys(Keys.LEFT, Keys.LEFT, Keys.BACK_SPACE)
self.assertEqual(element.get_attribute("value"), "abcdfgi")
# @Ignore(value = {HTMLUNIT, CHROME_NON_WINDOWS, SELENESE}, reason = "untested user agents")
def testSpecialSpaceKeys(self):
self._loadPage("javascriptPage")
element = self.driver.find_element(by=By.ID, value="keyReporter")
element.send_keys("abcd" + Keys.SPACE + "fgh" + Keys.SPACE + "ij")
self.assertEqual(element.get_attribute("value"), "abcd fgh ij")
def testNumberpadAndFunctionKeys(self):
self._loadPage("javascriptPage")
element = self.driver.find_element(by=By.ID, value="keyReporter")
element.send_keys(
"abcd" + Keys.MULTIPLY + Keys.SUBTRACT + Keys.ADD +
Keys.DECIMAL + Keys.SEPARATOR + Keys.NUMPAD0 + Keys.NUMPAD9 +
Keys.ADD + Keys.SEMICOLON + Keys.EQUALS + Keys.DIVIDE +
Keys.NUMPAD3 + "abcd")
self.assertEqual(element.get_attribute("value"), "abcd*-+.,09+;=/3abcd")
element.clear()
element.send_keys("FUNCTION" + Keys.F2 + "-KEYS" + Keys.F2)
element.send_keys("" + Keys.F2 + "-TOO" + Keys.F2)
self.assertEqual(element.get_attribute("value"), "FUNCTION-KEYS-TOO")
def testShiftSelectionDeletes(self):
self._loadPage("javascriptPage")
element = self.driver.find_element(by=By.ID, value="keyReporter")
element.send_keys("abcd efgh")
self.assertEqual(element.get_attribute("value"), "abcd efgh")
element.send_keys(Keys.SHIFT, Keys.LEFT, Keys.LEFT, Keys.LEFT)
element.send_keys(Keys.DELETE)
self.assertEqual(element.get_attribute("value"), "abcd e")
def testShouldTypeIntoInputElementsThatHaveNoTypeAttribute(self):
self._loadPage("formPage")
element = self.driver.find_element(by=By.ID, value="no-type")
element.send_keys("Should Say Cheese")
self.assertEqual(element.get_attribute("value"), "Should Say Cheese")
def testShouldTypeAnInteger(self):
self._loadPage("javascriptPage")
element = self.driver.find_element(by=By.ID, value="keyReporter")
element.send_keys(1234)
self.assertEqual(element.get_attribute("value"), "1234")
def _pageURL(self, name):
return self.webserver.where_is(name + '.html')
def _loadSimplePage(self):
self._loadPage("simpleTest")
def _loadPage(self, name):
self.driver.get(self._pageURL(name))
| {
"content_hash": "95ad11519de12a17445dd65adeaa5cd1",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 123,
"avg_line_length": 49.70175438596491,
"alnum_prop": 0.659724673490999,
"repo_name": "alb-i986/selenium",
"id": "ffd2a267fc2845fe4e4a2f8e12123e696c9ab68a",
"size": "14953",
"binary": false,
"copies": "3",
"ref": "refs/heads/refactor-ByChained",
"path": "py/test/selenium/webdriver/common/typing_tests.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "825"
},
{
"name": "Batchfile",
"bytes": "307"
},
{
"name": "C",
"bytes": "62267"
},
{
"name": "C#",
"bytes": "2830849"
},
{
"name": "C++",
"bytes": "1914688"
},
{
"name": "CSS",
"bytes": "25162"
},
{
"name": "HTML",
"bytes": "1839503"
},
{
"name": "Java",
"bytes": "4324961"
},
{
"name": "JavaScript",
"bytes": "4933013"
},
{
"name": "Makefile",
"bytes": "4655"
},
{
"name": "Python",
"bytes": "730677"
},
{
"name": "Ragel in Ruby Host",
"bytes": "3086"
},
{
"name": "Ruby",
"bytes": "787735"
},
{
"name": "Shell",
"bytes": "1305"
},
{
"name": "XSLT",
"bytes": "1047"
}
],
"symlink_target": ""
} |
from ceilometer import agent
from ceilometer.compute.virt import inspector as virt_inspector
from ceilometer.openstack.common import log
LOG = log.getLogger(__name__)
class AgentManager(agent.AgentManager):
def __init__(self):
super(AgentManager, self).__init__('compute', ['local_instances'])
self._inspector = virt_inspector.get_hypervisor_inspector()
@property
def inspector(self):
return self._inspector
| {
"content_hash": "68eacc586b3a7c9967b6c1461e24f92c",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 74,
"avg_line_length": 28.0625,
"alnum_prop": 0.7104677060133631,
"repo_name": "m1093782566/openstack_org_ceilometer",
"id": "bd28bdda2c83f928548c43c82ba3dd49b89b0bd2",
"size": "1102",
"binary": false,
"copies": "4",
"ref": "refs/heads/dev",
"path": "ceilometer/compute/manager.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "2657375"
},
{
"name": "Shell",
"bytes": "3204"
}
],
"symlink_target": ""
} |
import esn
import imp
import signals
import random
SEED = 0
PATTERN_LENGTH = 1
PATTERN_PAUSE = 0.5
OUTPUT_PULSE_AMPLITUDE = 0.9
OUTPUT_PULSE_LENGTH = 0.1
WASHOUT_TIME = 10.0
TRAIN_TIME = 100.0
VARIABLE_MAGNITUDE = True
FALSE_PATTERN = True
CONNECTIVITY = 0.5
TEACHER_FORCING = False
USE_ORTHONORMAL_MATRIX = True
TRAINING_STRATEGY = "discontinuous"
class Signal :
def __init__( self ) :
self.magnitude = 1.0
self.value = 0
self.time = 0
self.front_edge = 0
self.back_edge = -OUTPUT_PULSE_LENGTH
self.pattern_noise = \
signals.PerlinNoise( persistence=1, octave_count=7 )
if SEED > 0 :
self.pattern_noise.seed( SEED )
self.pulse_noise = \
signals.PerlinNoise( persistence=0.5, octave_count=1 )
if SEED > 0 :
self.pulse_noise.seed( SEED + 1 )
self.prev_pulse_noise = self.pulse_noise( 0 )
self.cur_pulse_noise = self.pulse_noise( 0 )
def step( self, step ) :
if self.time > ( self.front_edge + PATTERN_LENGTH + \
PATTERN_PAUSE ) and self.is_front_edge() :
self.front_edge = self.time
self.back_edge = self.front_edge + PATTERN_LENGTH
if VARIABLE_MAGNITUDE :
self.magnitude = random.uniform( 0.3, 1.0 )
if self.front_edge <= self.time and \
self.time <= self.back_edge :
self.value = self.pattern_noise( self.time - \
self.front_edge ) * 0.15 * self.magnitude
else :
self.value = 0
self.prev_pulse_noise = \
self.pulse_noise( self.time )
self.time += step
def is_front_edge( self ) :
if self.prev_pulse_noise <= 0 and \
self.pulse_noise( self.time ) > 0 :
return True
else :
return False
class Model :
def __init__( self, neuron_count ) :
self.network = esn.Network(
ins=1,
neurons=neuron_count,
outs=1,
cnctvty=CONNECTIVITY,
use_orth_mat=USE_ORTHONORMAL_MATRIX
)
self.noise = signals.PerlinNoise( persistence=0.5, octave_count=8 )
if SEED > 0 :
self.noise.seed( SEED + 2 )
self.pattern = Signal()
if FALSE_PATTERN :
self.false_pattern = Signal()
self.train_pulse = signals.GaussianPulse(
amplitude=OUTPUT_PULSE_AMPLITUDE,
width=OUTPUT_PULSE_LENGTH )
self.time = 0
def step( self, step ) :
self.pattern.step( step )
self.noise_value = self.noise( self.time ) * 0.1
self.input = self.noise_value + self.pattern.value
if FALSE_PATTERN :
self.false_pattern.step( step )
self.input += self.false_pattern.value
self.network.set_inputs( [ self.input ] )
self.network.step( step )
self.output = self.network.capture_output( 1 )[ 0 ]
self.train_output = self.train_pulse( self.time - \
self.pattern.back_edge )
if self.time > WASHOUT_TIME and self.time < TRAIN_TIME :
getattr( Model.TrainingStrategy, TRAINING_STRATEGY )( self )
print( "%10s %10s %10s %10s %10s" %
(
str( "%0.3f" % self.time ),
str( "%0.5f" % self.input ),
str( "%0.5f" % self.pattern.value ),
str( "%0.5f" % self.train_output ),
str( "%0.5f" % self.output )
)
)
self.time += step
class TrainingStrategy :
@staticmethod
def continuous( model ) :
model.network.train_online( [ model.train_output ],
TEACHER_FORCING )
@staticmethod
def discontinuous( model ) :
if model.time > model.pattern.back_edge and \
model.time < ( model.pattern.back_edge + \
OUTPUT_PULSE_LENGTH ) :
model.network.train_online( [ model.train_output ],
TEACHER_FORCING )
elif model.output > 0.3 or model.output < -0.3:
model.network.train_online( [ model.train_output ],
TEACHER_FORCING )
| {
"content_hash": "ba99693b5780d1ea6ecbf6021b8d1144",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 75,
"avg_line_length": 33.18604651162791,
"alnum_prop": 0.5351553375379584,
"repo_name": "mode89/esn",
"id": "d4a555b9f871c9e88e24bbc3d4e5b5d0ecfed613",
"size": "4281",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "samples/pattern_model.py",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "2242"
},
{
"name": "C++",
"bytes": "25719"
},
{
"name": "CMake",
"bytes": "4196"
},
{
"name": "Python",
"bytes": "4973"
}
],
"symlink_target": ""
} |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Log_Errors',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('error', models.TextField()),
('error_human', models.TextField()),
('date_time', models.DateTimeField(auto_now_add=True)),
],
),
]
| {
"content_hash": "37cf9cdea799b74f3f81629b8e1a7c96",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 114,
"avg_line_length": 27.333333333333332,
"alnum_prop": 0.5557491289198606,
"repo_name": "erickdom/restAndroid",
"id": "5743d148ebf0b78adc5eb6bbe886c5dcd5bfb8ad",
"size": "598",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "log_errors/migrations/0001_initial.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "44276"
},
{
"name": "JavaScript",
"bytes": "79463"
},
{
"name": "Python",
"bytes": "13049"
}
],
"symlink_target": ""
} |
"""Test the wallet."""
from decimal import Decimal
import time
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_array_result,
assert_equal,
assert_fee_amount,
assert_raises_rpc_error,
connect_nodes_bi,
sync_blocks,
sync_mempools,
wait_until,
)
class WalletTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 4
self.setup_clean_chain = True
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self):
self.add_nodes(4)
self.start_node(0)
self.start_node(1)
self.start_node(2)
connect_nodes_bi(self.nodes, 0, 1)
connect_nodes_bi(self.nodes, 1, 2)
connect_nodes_bi(self.nodes, 0, 2)
self.sync_all([self.nodes[0:3]])
def check_fee_amount(self, curr_balance, balance_with_fee, fee_per_byte, tx_size):
"""Return curr_balance after asserting the fee was in range"""
fee = balance_with_fee - curr_balance
assert_fee_amount(fee, tx_size, fee_per_byte * 1000)
return curr_balance
def get_vsize(self, txn):
return self.nodes[0].decoderawtransaction(txn)['vsize']
def run_test(self):
# Check that there's no UTXO on none of the nodes
assert_equal(len(self.nodes[0].listunspent()), 0)
assert_equal(len(self.nodes[1].listunspent()), 0)
assert_equal(len(self.nodes[2].listunspent()), 0)
self.log.info("Mining blocks...")
self.nodes[0].generate(1)
walletinfo = self.nodes[0].getwalletinfo()
assert_equal(walletinfo['immature_balance'], 50)
assert_equal(walletinfo['balance'], 0)
self.sync_all([self.nodes[0:3]])
self.nodes[1].generate(101)
self.sync_all([self.nodes[0:3]])
assert_equal(self.nodes[0].getbalance(), 50)
assert_equal(self.nodes[1].getbalance(), 50)
assert_equal(self.nodes[2].getbalance(), 0)
# Check getbalance with different arguments
assert_equal(self.nodes[0].getbalance("*"), 50)
assert_equal(self.nodes[0].getbalance("*", 1), 50)
assert_equal(self.nodes[0].getbalance("*", 1, True), 50)
assert_equal(self.nodes[0].getbalance(minconf=1), 50)
# first argument of getbalance must be excluded or set to "*"
assert_raises_rpc_error(-32, "dummy first argument must be excluded or set to \"*\"", self.nodes[0].getbalance, "")
# Check that only first and second nodes have UTXOs
utxos = self.nodes[0].listunspent()
assert_equal(len(utxos), 1)
assert_equal(len(self.nodes[1].listunspent()), 1)
assert_equal(len(self.nodes[2].listunspent()), 0)
self.log.info("test gettxout")
confirmed_txid, confirmed_index = utxos[0]["txid"], utxos[0]["vout"]
# First, outputs that are unspent both in the chain and in the
# mempool should appear with or without include_mempool
txout = self.nodes[0].gettxout(txid=confirmed_txid, n=confirmed_index, include_mempool=False)
assert_equal(txout['value'], 50)
txout = self.nodes[0].gettxout(txid=confirmed_txid, n=confirmed_index, include_mempool=True)
assert_equal(txout['value'], 50)
# Send 21 BTC from 0 to 2 using sendtoaddress call.
# Locked memory should use at least 32 bytes to sign each transaction
self.log.info("test getmemoryinfo")
memory_before = self.nodes[0].getmemoryinfo()
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 11)
mempool_txid = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 10)
memory_after = self.nodes[0].getmemoryinfo()
assert(memory_before['locked']['used'] + 64 <= memory_after['locked']['used'])
self.log.info("test gettxout (second part)")
# utxo spent in mempool should be visible if you exclude mempool
# but invisible if you include mempool
txout = self.nodes[0].gettxout(confirmed_txid, confirmed_index, False)
assert_equal(txout['value'], 50)
txout = self.nodes[0].gettxout(confirmed_txid, confirmed_index, True)
assert txout is None
# new utxo from mempool should be invisible if you exclude mempool
# but visible if you include mempool
txout = self.nodes[0].gettxout(mempool_txid, 0, False)
assert txout is None
txout1 = self.nodes[0].gettxout(mempool_txid, 0, True)
txout2 = self.nodes[0].gettxout(mempool_txid, 1, True)
# note the mempool tx will have randomly assigned indices
# but 10 will go to node2 and the rest will go to node0
balance = self.nodes[0].getbalance()
assert_equal(set([txout1['value'], txout2['value']]), set([10, balance]))
walletinfo = self.nodes[0].getwalletinfo()
assert_equal(walletinfo['immature_balance'], 0)
# Have node0 mine a block, thus it will collect its own fee.
self.nodes[0].generate(1)
self.sync_all([self.nodes[0:3]])
# Exercise locking of unspent outputs
unspent_0 = self.nodes[2].listunspent()[0]
unspent_0 = {"txid": unspent_0["txid"], "vout": unspent_0["vout"]}
assert_raises_rpc_error(-8, "Invalid parameter, expected locked output", self.nodes[2].lockunspent, True, [unspent_0])
self.nodes[2].lockunspent(False, [unspent_0])
assert_raises_rpc_error(-8, "Invalid parameter, output already locked", self.nodes[2].lockunspent, False, [unspent_0])
assert_raises_rpc_error(-4, "Insufficient funds", self.nodes[2].sendtoaddress, self.nodes[2].getnewaddress(), 20)
assert_equal([unspent_0], self.nodes[2].listlockunspent())
self.nodes[2].lockunspent(True, [unspent_0])
assert_equal(len(self.nodes[2].listlockunspent()), 0)
assert_raises_rpc_error(-8, "txid must be of length 64 (not 34, for '0000000000000000000000000000000000')",
self.nodes[2].lockunspent, False,
[{"txid": "0000000000000000000000000000000000", "vout": 0}])
assert_raises_rpc_error(-8, "txid must be hexadecimal string (not 'ZZZ0000000000000000000000000000000000000000000000000000000000000')",
self.nodes[2].lockunspent, False,
[{"txid": "ZZZ0000000000000000000000000000000000000000000000000000000000000", "vout": 0}])
assert_raises_rpc_error(-8, "Invalid parameter, unknown transaction",
self.nodes[2].lockunspent, False,
[{"txid": "0000000000000000000000000000000000000000000000000000000000000000", "vout": 0}])
assert_raises_rpc_error(-8, "Invalid parameter, vout index out of bounds",
self.nodes[2].lockunspent, False,
[{"txid": unspent_0["txid"], "vout": 999}])
# An output should be unlocked when spent
unspent_0 = self.nodes[1].listunspent()[0]
self.nodes[1].lockunspent(False, [unspent_0])
tx = self.nodes[1].createrawtransaction([unspent_0], { self.nodes[1].getnewaddress() : 1 })
tx = self.nodes[1].fundrawtransaction(tx)['hex']
tx = self.nodes[1].signrawtransactionwithwallet(tx)["hex"]
self.nodes[1].sendrawtransaction(tx)
assert_equal(len(self.nodes[1].listlockunspent()), 0)
# Have node1 generate 100 blocks (so node0 can recover the fee)
self.nodes[1].generate(100)
self.sync_all([self.nodes[0:3]])
# node0 should end up with 100 btc in block rewards plus fees, but
# minus the 21 plus fees sent to node2
assert_equal(self.nodes[0].getbalance(), 100 - 21)
assert_equal(self.nodes[2].getbalance(), 21)
# Node0 should have two unspent outputs.
# Create a couple of transactions to send them to node2, submit them through
# node1, and make sure both node0 and node2 pick them up properly:
node0utxos = self.nodes[0].listunspent(1)
assert_equal(len(node0utxos), 2)
# create both transactions
txns_to_send = []
for utxo in node0utxos:
inputs = []
outputs = {}
inputs.append({"txid": utxo["txid"], "vout": utxo["vout"]})
outputs[self.nodes[2].getnewaddress()] = utxo["amount"] - 3
raw_tx = self.nodes[0].createrawtransaction(inputs, outputs)
txns_to_send.append(self.nodes[0].signrawtransactionwithwallet(raw_tx))
# Have node 1 (miner) send the transactions
self.nodes[1].sendrawtransaction(txns_to_send[0]["hex"], True)
self.nodes[1].sendrawtransaction(txns_to_send[1]["hex"], True)
# Have node1 mine a block to confirm transactions:
self.nodes[1].generate(1)
self.sync_all([self.nodes[0:3]])
assert_equal(self.nodes[0].getbalance(), 0)
assert_equal(self.nodes[2].getbalance(), 94)
# Verify that a spent output cannot be locked anymore
spent_0 = {"txid": node0utxos[0]["txid"], "vout": node0utxos[0]["vout"]}
assert_raises_rpc_error(-8, "Invalid parameter, expected unspent output", self.nodes[0].lockunspent, False, [spent_0])
# Send 10 BTC normal
address = self.nodes[0].getnewaddress("test")
fee_per_byte = Decimal('0.001') / 1000
self.nodes[2].settxfee(fee_per_byte * 1000)
txid = self.nodes[2].sendtoaddress(address, 10, "", "", False)
self.nodes[2].generate(1)
self.sync_all([self.nodes[0:3]])
node_2_bal = self.check_fee_amount(self.nodes[2].getbalance(), Decimal('84'), fee_per_byte, self.get_vsize(self.nodes[2].getrawtransaction(txid)))
assert_equal(self.nodes[0].getbalance(), Decimal('10'))
# Send 10 BTC with subtract fee from amount
txid = self.nodes[2].sendtoaddress(address, 10, "", "", True)
self.nodes[2].generate(1)
self.sync_all([self.nodes[0:3]])
node_2_bal -= Decimal('10')
assert_equal(self.nodes[2].getbalance(), node_2_bal)
node_0_bal = self.check_fee_amount(self.nodes[0].getbalance(), Decimal('20'), fee_per_byte, self.get_vsize(self.nodes[2].getrawtransaction(txid)))
# Sendmany 10 BTC
txid = self.nodes[2].sendmany('', {address: 10}, 0, "", [])
self.nodes[2].generate(1)
self.sync_all([self.nodes[0:3]])
node_0_bal += Decimal('10')
node_2_bal = self.check_fee_amount(self.nodes[2].getbalance(), node_2_bal - Decimal('10'), fee_per_byte, self.get_vsize(self.nodes[2].getrawtransaction(txid)))
assert_equal(self.nodes[0].getbalance(), node_0_bal)
# Sendmany 10 BTC with subtract fee from amount
txid = self.nodes[2].sendmany('', {address: 10}, 0, "", [address])
self.nodes[2].generate(1)
self.sync_all([self.nodes[0:3]])
node_2_bal -= Decimal('10')
assert_equal(self.nodes[2].getbalance(), node_2_bal)
node_0_bal = self.check_fee_amount(self.nodes[0].getbalance(), node_0_bal + Decimal('10'), fee_per_byte, self.get_vsize(self.nodes[2].getrawtransaction(txid)))
# Test ResendWalletTransactions:
# Create a couple of transactions, then start up a fourth
# node (nodes[3]) and ask nodes[0] to rebroadcast.
# EXPECT: nodes[3] should have those transactions in its mempool.
txid1 = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 1)
txid2 = self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 1)
sync_mempools(self.nodes[0:2])
self.start_node(3)
connect_nodes_bi(self.nodes, 0, 3)
sync_blocks(self.nodes)
relayed = self.nodes[0].resendwallettransactions()
assert_equal(set(relayed), {txid1, txid2})
sync_mempools(self.nodes)
assert(txid1 in self.nodes[3].getrawmempool())
# Exercise balance rpcs
assert_equal(self.nodes[0].getwalletinfo()["unconfirmed_balance"], 1)
assert_equal(self.nodes[0].getunconfirmedbalance(), 1)
# check if we can list zero value tx as available coins
# 1. create raw_tx
# 2. hex-changed one output to 0.0
# 3. sign and send
# 4. check if recipient (node0) can list the zero value tx
usp = self.nodes[1].listunspent(query_options={'minimumAmount': '49.998'})[0]
inputs = [{"txid": usp['txid'], "vout": usp['vout']}]
outputs = {self.nodes[1].getnewaddress(): 49.998, self.nodes[0].getnewaddress(): 11.11}
raw_tx = self.nodes[1].createrawtransaction(inputs, outputs).replace("c0833842", "00000000") # replace 11.11 with 0.0 (int32)
signed_raw_tx = self.nodes[1].signrawtransactionwithwallet(raw_tx)
decoded_raw_tx = self.nodes[1].decoderawtransaction(signed_raw_tx['hex'])
zero_value_txid = decoded_raw_tx['txid']
self.nodes[1].sendrawtransaction(signed_raw_tx['hex'])
self.sync_all()
self.nodes[1].generate(1) # mine a block
self.sync_all()
unspent_txs = self.nodes[0].listunspent() # zero value tx must be in listunspents output
found = False
for uTx in unspent_txs:
if uTx['txid'] == zero_value_txid:
found = True
assert_equal(uTx['amount'], Decimal('0'))
assert(found)
# do some -walletbroadcast tests
self.stop_nodes()
self.start_node(0, ["-walletbroadcast=0"])
self.start_node(1, ["-walletbroadcast=0"])
self.start_node(2, ["-walletbroadcast=0"])
connect_nodes_bi(self.nodes, 0, 1)
connect_nodes_bi(self.nodes, 1, 2)
connect_nodes_bi(self.nodes, 0, 2)
self.sync_all([self.nodes[0:3]])
txid_not_broadcast = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 2)
tx_obj_not_broadcast = self.nodes[0].gettransaction(txid_not_broadcast)
self.nodes[1].generate(1) # mine a block, tx should not be in there
self.sync_all([self.nodes[0:3]])
assert_equal(self.nodes[2].getbalance(), node_2_bal) # should not be changed because tx was not broadcasted
# now broadcast from another node, mine a block, sync, and check the balance
self.nodes[1].sendrawtransaction(tx_obj_not_broadcast['hex'])
self.nodes[1].generate(1)
self.sync_all([self.nodes[0:3]])
node_2_bal += 2
tx_obj_not_broadcast = self.nodes[0].gettransaction(txid_not_broadcast)
assert_equal(self.nodes[2].getbalance(), node_2_bal)
# create another tx
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 2)
# restart the nodes with -walletbroadcast=1
self.stop_nodes()
self.start_node(0)
self.start_node(1)
self.start_node(2)
connect_nodes_bi(self.nodes, 0, 1)
connect_nodes_bi(self.nodes, 1, 2)
connect_nodes_bi(self.nodes, 0, 2)
sync_blocks(self.nodes[0:3])
self.nodes[0].generate(1)
sync_blocks(self.nodes[0:3])
node_2_bal += 2
# tx should be added to balance because after restarting the nodes tx should be broadcast
assert_equal(self.nodes[2].getbalance(), node_2_bal)
# send a tx with value in a string (PR#6380 +)
txid = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), "2")
tx_obj = self.nodes[0].gettransaction(txid)
assert_equal(tx_obj['amount'], Decimal('-2'))
txid = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), "0.0001")
tx_obj = self.nodes[0].gettransaction(txid)
assert_equal(tx_obj['amount'], Decimal('-0.0001'))
# check if JSON parser can handle scientific notation in strings
txid = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), "1e-4")
tx_obj = self.nodes[0].gettransaction(txid)
assert_equal(tx_obj['amount'], Decimal('-0.0001'))
# This will raise an exception because the amount type is wrong
assert_raises_rpc_error(-3, "Invalid amount", self.nodes[0].sendtoaddress, self.nodes[2].getnewaddress(), "1f-4")
# This will raise an exception since generate does not accept a string
assert_raises_rpc_error(-1, "not an integer", self.nodes[0].generate, "2")
# Import address and private key to check correct behavior of spendable unspents
# 1. Send some coins to generate new UTXO
address_to_import = self.nodes[2].getnewaddress()
txid = self.nodes[0].sendtoaddress(address_to_import, 1)
self.nodes[0].generate(1)
self.sync_all([self.nodes[0:3]])
# 2. Import address from node2 to node1
self.nodes[1].importaddress(address_to_import)
# 3. Validate that the imported address is watch-only on node1
assert(self.nodes[1].getaddressinfo(address_to_import)["iswatchonly"])
# 4. Check that the unspents after import are not spendable
assert_array_result(self.nodes[1].listunspent(),
{"address": address_to_import},
{"spendable": False})
# 5. Import private key of the previously imported address on node1
priv_key = self.nodes[2].dumpprivkey(address_to_import)
self.nodes[1].importprivkey(priv_key)
# 6. Check that the unspents are now spendable on node1
assert_array_result(self.nodes[1].listunspent(),
{"address": address_to_import},
{"spendable": True})
# Mine a block from node0 to an address from node1
coinbase_addr = self.nodes[1].getnewaddress()
block_hash = self.nodes[0].generatetoaddress(1, coinbase_addr)[0]
coinbase_txid = self.nodes[0].getblock(block_hash)['tx'][0]
self.sync_all([self.nodes[0:3]])
# Check that the txid and balance is found by node1
self.nodes[1].gettransaction(coinbase_txid)
# check if wallet or blockchain maintenance changes the balance
self.sync_all([self.nodes[0:3]])
blocks = self.nodes[0].generate(2)
self.sync_all([self.nodes[0:3]])
balance_nodes = [self.nodes[i].getbalance() for i in range(3)]
block_count = self.nodes[0].getblockcount()
# Check modes:
# - True: unicode escaped as \u....
# - False: unicode directly as UTF-8
for mode in [True, False]:
self.nodes[0].rpc.ensure_ascii = mode
# unicode check: Basic Multilingual Plane, Supplementary Plane respectively
for label in [u'рыба', u'𝅘𝅥𝅯']:
addr = self.nodes[0].getnewaddress()
self.nodes[0].setlabel(addr, label)
assert_equal(self.nodes[0].getaddressinfo(addr)['label'], label)
assert(label in self.nodes[0].listlabels())
self.nodes[0].rpc.ensure_ascii = True # restore to default
# maintenance tests
maintenance = [
'-rescan',
'-reindex',
'-zapwallettxes=1',
'-zapwallettxes=2',
# disabled until issue is fixed: https://github.com/bitcoin/bitcoin/issues/7463
# '-salvagewallet',
]
chainlimit = 6
for m in maintenance:
self.log.info("check " + m)
self.stop_nodes()
# set lower ancestor limit for later
self.start_node(0, [m, "-limitancestorcount=" + str(chainlimit)])
self.start_node(1, [m, "-limitancestorcount=" + str(chainlimit)])
self.start_node(2, [m, "-limitancestorcount=" + str(chainlimit)])
if m == '-reindex':
# reindex will leave rpc warm up "early"; Wait for it to finish
wait_until(lambda: [block_count] * 3 == [self.nodes[i].getblockcount() for i in range(3)])
assert_equal(balance_nodes, [self.nodes[i].getbalance() for i in range(3)])
# Exercise listsinceblock with the last two blocks
coinbase_tx_1 = self.nodes[0].listsinceblock(blocks[0])
assert_equal(coinbase_tx_1["lastblock"], blocks[1])
assert_equal(len(coinbase_tx_1["transactions"]), 1)
assert_equal(coinbase_tx_1["transactions"][0]["blockhash"], blocks[1])
assert_equal(len(self.nodes[0].listsinceblock(blocks[1])["transactions"]), 0)
# ==Check that wallet prefers to use coins that don't exceed mempool limits =====
# Get all non-zero utxos together
chain_addrs = [self.nodes[0].getnewaddress(), self.nodes[0].getnewaddress()]
singletxid = self.nodes[0].sendtoaddress(chain_addrs[0], self.nodes[0].getbalance(), "", "", True)
self.nodes[0].generate(1)
node0_balance = self.nodes[0].getbalance()
# Split into two chains
rawtx = self.nodes[0].createrawtransaction([{"txid": singletxid, "vout": 0}], {chain_addrs[0]: node0_balance / 2 - Decimal('0.01'), chain_addrs[1]: node0_balance / 2 - Decimal('0.01')})
signedtx = self.nodes[0].signrawtransactionwithwallet(rawtx)
singletxid = self.nodes[0].sendrawtransaction(signedtx["hex"])
self.nodes[0].generate(1)
# Make a long chain of unconfirmed payments without hitting mempool limit
# Each tx we make leaves only one output of change on a chain 1 longer
# Since the amount to send is always much less than the outputs, we only ever need one output
# So we should be able to generate exactly chainlimit txs for each original output
sending_addr = self.nodes[1].getnewaddress()
txid_list = []
for i in range(chainlimit * 2):
txid_list.append(self.nodes[0].sendtoaddress(sending_addr, Decimal('0.0001')))
assert_equal(self.nodes[0].getmempoolinfo()['size'], chainlimit * 2)
assert_equal(len(txid_list), chainlimit * 2)
# Without walletrejectlongchains, we will still generate a txid
# The tx will be stored in the wallet but not accepted to the mempool
extra_txid = self.nodes[0].sendtoaddress(sending_addr, Decimal('0.0001'))
assert(extra_txid not in self.nodes[0].getrawmempool())
assert(extra_txid in [tx["txid"] for tx in self.nodes[0].listtransactions()])
self.nodes[0].abandontransaction(extra_txid)
total_txs = len(self.nodes[0].listtransactions("*", 99999))
# Try with walletrejectlongchains
# Double chain limit but require combining inputs, so we pass SelectCoinsMinConf
self.stop_node(0)
self.start_node(0, extra_args=["-walletrejectlongchains", "-limitancestorcount=" + str(2 * chainlimit)])
# wait for loadmempool
timeout = 10
while (timeout > 0 and len(self.nodes[0].getrawmempool()) < chainlimit * 2):
time.sleep(0.5)
timeout -= 0.5
assert_equal(len(self.nodes[0].getrawmempool()), chainlimit * 2)
node0_balance = self.nodes[0].getbalance()
# With walletrejectlongchains we will not create the tx and store it in our wallet.
assert_raises_rpc_error(-4, "Transaction has too long of a mempool chain", self.nodes[0].sendtoaddress, sending_addr, node0_balance - Decimal('0.01'))
# Verify nothing new in wallet
assert_equal(total_txs, len(self.nodes[0].listtransactions("*", 99999)))
# Test getaddressinfo. Note that these addresses are taken from disablewallet.py
assert_raises_rpc_error(-5, "Invalid address", self.nodes[0].getaddressinfo, "3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy")
address_info = self.nodes[0].getaddressinfo("mneYUmWYsuk7kySiURxCi3AGxrAqZxLgPZ")
assert_equal(address_info['address'], "mneYUmWYsuk7kySiURxCi3AGxrAqZxLgPZ")
assert_equal(address_info["scriptPubKey"], "76a9144e3854046c7bd1594ac904e4793b6a45b36dea0988ac")
assert not address_info["ismine"]
assert not address_info["iswatchonly"]
assert not address_info["isscript"]
if __name__ == '__main__':
WalletTest().main()
| {
"content_hash": "628495b091bda4e98bdb00d493243469",
"timestamp": "",
"source": "github",
"line_count": 488,
"max_line_length": 193,
"avg_line_length": 49.21516393442623,
"alnum_prop": 0.6257234458924928,
"repo_name": "ericshawlinux/bitcoin",
"id": "8bbff7f7eff81edafb07d584a05be2926c5bef77",
"size": "24238",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "test/functional/wallet_basic.py",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "28456"
},
{
"name": "C",
"bytes": "693106"
},
{
"name": "C++",
"bytes": "5054023"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "HTML",
"bytes": "51512"
},
{
"name": "Java",
"bytes": "30290"
},
{
"name": "M4",
"bytes": "189381"
},
{
"name": "Makefile",
"bytes": "111686"
},
{
"name": "Objective-C",
"bytes": "3892"
},
{
"name": "Objective-C++",
"bytes": "7240"
},
{
"name": "Protocol Buffer",
"bytes": "2328"
},
{
"name": "Python",
"bytes": "1150581"
},
{
"name": "QMake",
"bytes": "756"
},
{
"name": "Shell",
"bytes": "53022"
}
],
"symlink_target": ""
} |
import os
import subprocess
import sys
print 'Build Config:'
print ' Host:win7 x86'
print ' Branch:develop'
print ' Target:win32'
print ' "%VS110COMNTOOLS%..\IDE\devenv.com" "build\cocos2d-win32.vc2013.sln" /Build "Debug|Win32"'
if(os.path.exists('build/cocos2d-win32.vc2013.sln') == False):
node_name = os.environ['NODE_NAME']
source_dir = '../cocos-2dx-develop-base-repo/node/' + node_name
source_dir = source_dir.replace("/", os.sep)
os.system("xcopy " + source_dir + " . /E /Y /H")
os.system('git pull origin develop')
os.system('git submodule update --init --force')
ret = subprocess.call('"%VS110COMNTOOLS%..\IDE\devenv.com" "build\cocos2d-win32.vc2013.sln" /Build "Debug|Win32"', shell=True)
os.system('git clean -xdf -f')
print 'build exit'
print ret
if ret == 0:
exit(0)
else:
exit(1)
| {
"content_hash": "f4577b20863c17474e5c6023e64a6c4b",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 126,
"avg_line_length": 34.791666666666664,
"alnum_prop": 0.6682634730538922,
"repo_name": "dxmgame/dxm-cocos",
"id": "87f8674032202cf3061af386425ce19d13ff57dd",
"size": "835",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "src/oslibs/cocos/cocos-src/tools/jenkins-scripts/configs/cocos-2dx-develop-win32.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "110572"
},
{
"name": "C",
"bytes": "3075297"
},
{
"name": "C++",
"bytes": "37336451"
},
{
"name": "CMake",
"bytes": "382216"
},
{
"name": "GLSL",
"bytes": "90339"
},
{
"name": "HTML",
"bytes": "16158"
},
{
"name": "Java",
"bytes": "2171652"
},
{
"name": "JavaScript",
"bytes": "11440765"
},
{
"name": "Lua",
"bytes": "6499795"
},
{
"name": "Makefile",
"bytes": "102389"
},
{
"name": "Objective-C",
"bytes": "3004444"
},
{
"name": "Objective-C++",
"bytes": "700396"
},
{
"name": "Python",
"bytes": "1060601"
},
{
"name": "Shell",
"bytes": "77043"
}
],
"symlink_target": ""
} |
import argparse
import errno
import logging
import os
import platform
import signal
import sys
from collections import OrderedDict
from contextlib import closing
from distutils.version import StrictVersion
from functools import partial
from gettext import gettext
from itertools import chain
from pathlib import Path
from time import sleep
from typing import List
import requests
from socks import __version__ as socks_version
from websocket import __version__ as websocket_version
import streamlink.logger as logger
from streamlink import NoPluginError, PluginError, StreamError, Streamlink, __version__ as streamlink_version
from streamlink.cache import Cache
from streamlink.exceptions import FatalPluginError
from streamlink.plugin import Plugin, PluginOptions
from streamlink.stream import StreamIO, StreamProcess
from streamlink.utils.named_pipe import NamedPipe
from streamlink_cli.argparser import build_parser
from streamlink_cli.compat import DeprecatedPath, is_win32, stdout
from streamlink_cli.console import ConsoleOutput, ConsoleUserInputRequester
from streamlink_cli.constants import CONFIG_FILES, DEFAULT_STREAM_METADATA, LOG_DIR, PLUGIN_DIRS, STREAM_SYNONYMS
from streamlink_cli.output import FileOutput, Output, PlayerOutput
from streamlink_cli.utils import Formatter, HTTPServer, datetime, ignored, progress, stream_to_url
ACCEPTABLE_ERRNO = (errno.EPIPE, errno.EINVAL, errno.ECONNRESET)
try:
ACCEPTABLE_ERRNO += (errno.WSAECONNABORTED,)
except AttributeError:
pass # Not windows
QUIET_OPTIONS = ("json", "stream_url", "subprocess_cmdline", "quiet")
args = None
console: ConsoleOutput = None
output: Output = None
plugin: Plugin = None
stream_fd: StreamIO = None
streamlink: Streamlink = None
log = logging.getLogger("streamlink.cli")
def get_formatter(plugin: Plugin):
return Formatter(
{
"url": lambda: args.url,
"author": lambda: plugin.get_author(),
"category": lambda: plugin.get_category(),
"game": lambda: plugin.get_category(),
"title": lambda: plugin.get_title(),
"time": lambda: datetime.now()
},
{
"time": lambda dt, fmt: dt.strftime(fmt)
}
)
def check_file_output(filename, force):
"""Checks if file already exists and ask the user if it should
be overwritten if it does."""
log.debug("Checking file output")
if os.path.isfile(filename) and not force:
if sys.stdin.isatty():
answer = console.ask(f"File {filename} already exists! Overwrite it? [y/N] ")
if answer.lower() != "y":
sys.exit()
else:
log.error(f"File {filename} already exists, use --force to overwrite it.")
sys.exit()
return FileOutput(filename)
def create_output(formatter: Formatter):
"""Decides where to write the stream.
Depending on arguments it can be one of these:
- The stdout pipe
- A subprocess' stdin pipe
- A named pipe that the subprocess reads from
- A regular file
"""
if (args.output or args.stdout) and (args.record or args.record_and_pipe):
console.exit("Cannot use record options with other file output options.")
if args.output:
if args.output == "-":
out = FileOutput(fd=stdout)
else:
out = check_file_output(formatter.filename(args.output, args.fs_safe_rules), args.force)
elif args.stdout:
out = FileOutput(fd=stdout)
elif args.record_and_pipe:
record = check_file_output(formatter.filename(args.record_and_pipe, args.fs_safe_rules), args.force)
out = FileOutput(fd=stdout, record=record)
else:
http = namedpipe = record = None
if not args.player:
console.exit("The default player (VLC) does not seem to be "
"installed. You must specify the path to a player "
"executable with --player.")
if args.player_fifo:
try:
namedpipe = NamedPipe()
except OSError as err:
console.exit(f"Failed to create pipe: {err}")
elif args.player_http:
http = create_http_server()
if args.record:
record = check_file_output(formatter.filename(args.record, args.fs_safe_rules), args.force)
log.info(f"Starting player: {args.player}")
out = PlayerOutput(
args.player,
args=args.player_args,
quiet=not args.verbose_player,
kill=not args.player_no_close,
namedpipe=namedpipe,
http=http,
record=record,
title=formatter.title(args.title, defaults=DEFAULT_STREAM_METADATA) if args.title else args.url
)
return out
def create_http_server(*_args, **_kwargs):
"""Creates a HTTP server listening on a given host and port.
If host is empty, listen on all available interfaces, and if port is 0,
listen on a random high port.
"""
try:
http = HTTPServer()
http.bind(*_args, **_kwargs)
except OSError as err:
console.exit(f"Failed to create HTTP server: {err}")
return http
def iter_http_requests(server, player):
"""Repeatedly accept HTTP connections on a server.
Forever if the serving externally, or while a player is running if it is not
empty.
"""
while not player or player.running:
try:
yield server.open(timeout=2.5)
except OSError:
continue
def output_stream_http(plugin, initial_streams, formatter: Formatter, external=False, port=0):
"""Continuously output the stream over HTTP."""
global output
if not external:
if not args.player:
console.exit("The default player (VLC) does not seem to be "
"installed. You must specify the path to a player "
"executable with --player.")
server = create_http_server()
player = output = PlayerOutput(
args.player,
args=args.player_args,
filename=server.url,
quiet=not args.verbose_player,
title=formatter.title(args.title, defaults=DEFAULT_STREAM_METADATA) if args.title else args.url
)
try:
log.info(f"Starting player: {args.player}")
if player:
player.open()
except OSError as err:
console.exit(f"Failed to start player: {args.player} ({err})")
else:
server = create_http_server(host=None, port=port)
player = None
log.info("Starting server, access with one of:")
for url in server.urls:
log.info(" " + url)
for req in iter_http_requests(server, player):
user_agent = req.headers.get("User-Agent") or "unknown player"
log.info(f"Got HTTP request from {user_agent}")
stream_fd = prebuffer = None
while not stream_fd and (not player or player.running):
try:
streams = initial_streams or fetch_streams(plugin)
initial_streams = None
for stream_name in (resolve_stream_name(streams, s) for s in args.stream):
if stream_name in streams:
stream = streams[stream_name]
break
else:
log.info("Stream not available, will re-fetch streams in 10 sec")
sleep(10)
continue
except PluginError as err:
log.error(f"Unable to fetch new streams: {err}")
continue
try:
log.info(f"Opening stream: {stream_name} ({type(stream).shortname()})")
stream_fd, prebuffer = open_stream(stream)
except StreamError as err:
log.error(err)
if stream_fd and prebuffer:
log.debug("Writing stream to player")
read_stream(stream_fd, server, prebuffer, formatter)
server.close(True)
player.close()
server.close()
def output_stream_passthrough(stream, formatter: Formatter):
"""Prepares a filename to be passed to the player."""
global output
filename = f'"{stream_to_url(stream)}"'
output = PlayerOutput(
args.player,
args=args.player_args,
filename=filename,
call=True,
quiet=not args.verbose_player,
title=formatter.title(args.title, defaults=DEFAULT_STREAM_METADATA) if args.title else args.url
)
try:
log.info(f"Starting player: {args.player}")
output.open()
except OSError as err:
console.exit(f"Failed to start player: {args.player} ({err})")
return False
return True
def open_stream(stream):
"""Opens a stream and reads 8192 bytes from it.
This is useful to check if a stream actually has data
before opening the output.
"""
global stream_fd
# Attempts to open the stream
try:
stream_fd = stream.open()
except StreamError as err:
raise StreamError(f"Could not open stream: {err}")
# Read 8192 bytes before proceeding to check for errors.
# This is to avoid opening the output unnecessarily.
try:
log.debug("Pre-buffering 8192 bytes")
prebuffer = stream_fd.read(8192)
except OSError as err:
stream_fd.close()
raise StreamError(f"Failed to read data from stream: {err}")
if not prebuffer:
stream_fd.close()
raise StreamError("No data returned from stream")
return stream_fd, prebuffer
def output_stream(stream, formatter: Formatter):
"""Open stream, create output and finally write the stream to output."""
global output
success_open = False
for i in range(args.retry_open):
try:
stream_fd, prebuffer = open_stream(stream)
success_open = True
break
except StreamError as err:
log.error(f"Try {i + 1}/{args.retry_open}: Could not open stream {stream} ({err})")
if not success_open:
console.exit(f"Could not open stream {stream}, tried {args.retry_open} times, exiting")
output = create_output(formatter)
try:
output.open()
except OSError as err:
if isinstance(output, PlayerOutput):
console.exit(f"Failed to start player: {args.player} ({err})")
else:
console.exit(f"Failed to open output: {output.filename} ({err})")
with closing(output):
log.debug("Writing stream to output")
read_stream(stream_fd, output, prebuffer, formatter)
return True
def read_stream(stream, output, prebuffer, formatter: Formatter, chunk_size=8192):
"""Reads data from stream and then writes it to the output."""
is_player = isinstance(output, PlayerOutput)
is_http = isinstance(output, HTTPServer)
is_fifo = is_player and output.namedpipe
show_progress = (
isinstance(output, FileOutput)
and output.fd is not stdout
and (sys.stdout.isatty() or args.force_progress)
)
show_record_progress = (
hasattr(output, "record")
and isinstance(output.record, FileOutput)
and output.record.fd is not stdout
and (sys.stdout.isatty() or args.force_progress)
)
stream_iterator = chain(
[prebuffer],
iter(partial(stream.read, chunk_size), b"")
)
if show_progress:
stream_iterator = progress(
stream_iterator,
prefix=os.path.basename(output.filename)
)
elif show_record_progress:
stream_iterator = progress(
stream_iterator,
prefix=os.path.basename(output.record.filename)
)
try:
for data in stream_iterator:
# We need to check if the player process still exists when
# using named pipes on Windows since the named pipe is not
# automatically closed by the player.
if is_win32 and is_fifo:
output.player.poll()
if output.player.returncode is not None:
log.info("Player closed")
break
try:
output.write(data)
except OSError as err:
if is_player and err.errno in ACCEPTABLE_ERRNO:
log.info("Player closed")
elif is_http and err.errno in ACCEPTABLE_ERRNO:
log.info("HTTP connection closed")
else:
console.exit(f"Error when writing to output: {err}, exiting")
break
except OSError as err:
console.exit(f"Error when reading from stream: {err}, exiting")
finally:
stream.close()
log.info("Stream ended")
def handle_stream(plugin, streams, stream_name):
"""Decides what to do with the selected stream.
Depending on arguments it can be one of these:
- Output internal command-line
- Output JSON represenation
- Continuously output the stream over HTTP
- Output stream data to selected output
"""
stream_name = resolve_stream_name(streams, stream_name)
stream = streams[stream_name]
# Print internal command-line if this stream
# uses a subprocess.
if args.subprocess_cmdline:
if isinstance(stream, StreamProcess):
try:
cmdline = stream.cmdline()
except StreamError as err:
console.exit(err)
console.msg(cmdline)
else:
console.exit("The stream specified cannot be translated to a command")
# Print JSON representation of the stream
elif args.json:
console.msg_json(
stream,
metadata=plugin.get_metadata()
)
elif args.stream_url:
try:
console.msg(stream.to_url())
except TypeError:
console.exit("The stream specified cannot be translated to a URL")
# Output the stream
else:
# Find any streams with a '_alt' suffix and attempt
# to use these in case the main stream is not usable.
alt_streams = list(filter(lambda k: stream_name + "_alt" in k,
sorted(streams.keys())))
file_output = args.output or args.stdout
formatter = get_formatter(plugin)
for stream_name in [stream_name] + alt_streams:
stream = streams[stream_name]
stream_type = type(stream).shortname()
if stream_type in args.player_passthrough and not file_output:
log.info(f"Opening stream: {stream_name} ({stream_type})")
success = output_stream_passthrough(stream, formatter)
elif args.player_external_http:
return output_stream_http(plugin, streams, formatter, external=True,
port=args.player_external_http_port)
elif args.player_continuous_http and not file_output:
return output_stream_http(plugin, streams, formatter)
else:
log.info(f"Opening stream: {stream_name} ({stream_type})")
success = output_stream(stream, formatter)
if success:
break
def fetch_streams(plugin):
"""Fetches streams using correct parameters."""
return plugin.streams(stream_types=args.stream_types,
sorting_excludes=args.stream_sorting_excludes)
def fetch_streams_with_retry(plugin, interval, count):
"""Attempts to fetch streams repeatedly
until some are returned or limit hit."""
try:
streams = fetch_streams(plugin)
except PluginError as err:
log.error(err)
streams = None
if not streams:
log.info(f"Waiting for streams, retrying every {interval} second(s)")
attempts = 0
while not streams:
sleep(interval)
try:
streams = fetch_streams(plugin)
except FatalPluginError:
raise
except PluginError as err:
log.error(err)
if count > 0:
attempts += 1
if attempts >= count:
break
return streams
def resolve_stream_name(streams, stream_name):
"""Returns the real stream name of a synonym."""
if stream_name in STREAM_SYNONYMS and stream_name in streams:
for name, stream in streams.items():
if stream is streams[stream_name] and name not in STREAM_SYNONYMS:
return name
return stream_name
def format_valid_streams(plugin, streams):
"""Formats a dict of streams.
Filters out synonyms and displays them next to
the stream they point to.
Streams are sorted according to their quality
(based on plugin.stream_weight).
"""
delimiter = ", "
validstreams = []
for name, stream in sorted(streams.items(),
key=lambda stream: plugin.stream_weight(stream[0])):
if name in STREAM_SYNONYMS:
continue
def synonymfilter(n):
return stream is streams[n] and n is not name
synonyms = list(filter(synonymfilter, streams.keys()))
if len(synonyms) > 0:
joined = delimiter.join(synonyms)
name = f"{name} ({joined})"
validstreams.append(name)
return delimiter.join(validstreams)
def handle_url():
"""The URL handler.
Attempts to resolve the URL to a plugin and then attempts
to fetch a list of available streams.
Proceeds to handle stream if user specified a valid one,
otherwise output list of valid streams.
"""
try:
plugin = streamlink.resolve_url(args.url)
setup_plugin_options(streamlink, plugin)
log.info(f"Found matching plugin {plugin.module} for URL {args.url}")
if args.retry_max or args.retry_streams:
retry_streams = 1
retry_max = 0
if args.retry_streams:
retry_streams = args.retry_streams
if args.retry_max:
retry_max = args.retry_max
streams = fetch_streams_with_retry(plugin, retry_streams,
retry_max)
else:
streams = fetch_streams(plugin)
except NoPluginError:
console.exit(f"No plugin can handle URL: {args.url}")
except PluginError as err:
console.exit(err)
if not streams:
console.exit(f"No playable streams found on this URL: {args.url}")
if args.default_stream and not args.stream and not args.json:
args.stream = args.default_stream
if args.stream:
validstreams = format_valid_streams(plugin, streams)
for stream_name in args.stream:
if stream_name in streams:
log.info(f"Available streams: {validstreams}")
handle_stream(plugin, streams, stream_name)
return
err = f"The specified stream(s) '{', '.join(args.stream)}' could not be found"
if args.json:
console.msg_json(
plugin=plugin.module,
metadata=plugin.get_metadata(),
streams=streams,
error=err
)
else:
console.exit(f"{err}.\n Available streams: {validstreams}")
elif args.json:
console.msg_json(
plugin=plugin.module,
metadata=plugin.get_metadata(),
streams=streams
)
elif args.stream_url:
try:
console.msg(streams[list(streams)[-1]].to_manifest_url())
except TypeError:
console.exit("The stream specified cannot be translated to a URL")
else:
validstreams = format_valid_streams(plugin, streams)
console.msg(f"Available streams: {validstreams}")
def print_plugins():
"""Outputs a list of all plugins Streamlink has loaded."""
pluginlist = list(streamlink.get_plugins().keys())
pluginlist_formatted = ", ".join(sorted(pluginlist))
if args.json:
console.msg_json(pluginlist)
else:
console.msg(f"Loaded plugins: {pluginlist_formatted}")
def load_plugins(dirs: List[Path], showwarning: bool = True):
"""Attempts to load plugins from a list of directories."""
for directory in dirs:
if directory.is_dir():
success = streamlink.load_plugins(str(directory))
if success and type(directory) is DeprecatedPath:
log.info(f"Loaded plugins from deprecated path, see CLI docs for how to migrate: {directory}")
elif showwarning:
log.warning(f"Plugin path {directory} does not exist or is not a directory!")
def setup_args(parser: argparse.ArgumentParser, config_files: List[Path] = None, ignore_unknown: bool = False):
"""Parses arguments."""
global args
arglist = sys.argv[1:]
# Load arguments from config files
configs = [f"@{config_file}" for config_file in config_files or []]
args, unknown = parser.parse_known_args(configs + arglist)
if unknown and not ignore_unknown:
msg = gettext("unrecognized arguments: %s")
parser.error(msg % " ".join(unknown))
# Force lowercase to allow case-insensitive lookup
if args.stream:
args.stream = [stream.lower() for stream in args.stream]
if not args.url and args.url_param:
args.url = args.url_param
def setup_config_args(parser, ignore_unknown=False):
config_files = []
if args.config:
# We want the config specified last to get highest priority
for config_file in map(lambda path: Path(path).expanduser(), reversed(args.config)):
if config_file.is_file():
config_files.append(config_file)
else:
# Only load first available default config
for config_file in filter(lambda path: path.is_file(), CONFIG_FILES):
if type(config_file) is DeprecatedPath:
log.info(f"Loaded config from deprecated path, see CLI docs for how to migrate: {config_file}")
config_files.append(config_file)
break
if streamlink and args.url:
# Only load first available plugin config
with ignored(NoPluginError):
plugin = streamlink.resolve_url(args.url)
for config_file in CONFIG_FILES:
config_file = config_file.with_name(f"{config_file.name}.{plugin.module}")
if not config_file.is_file():
continue
if type(config_file) is DeprecatedPath:
log.info(f"Loaded plugin config from deprecated path, see CLI docs for how to migrate: {config_file}")
config_files.append(config_file)
break
if config_files:
setup_args(parser, config_files, ignore_unknown=ignore_unknown)
def setup_signals():
# Handle SIGTERM just like SIGINT
signal.signal(signal.SIGTERM, signal.default_int_handler)
def setup_http_session():
"""Sets the global HTTP settings, such as proxy and headers."""
if args.http_proxy:
streamlink.set_option("http-proxy", args.http_proxy)
if args.https_proxy:
streamlink.set_option("https-proxy", args.https_proxy)
if args.http_cookie:
streamlink.set_option("http-cookies", dict(args.http_cookie))
if args.http_header:
streamlink.set_option("http-headers", dict(args.http_header))
if args.http_query_param:
streamlink.set_option("http-query-params", dict(args.http_query_param))
if args.http_ignore_env:
streamlink.set_option("http-trust-env", False)
if args.http_no_ssl_verify:
streamlink.set_option("http-ssl-verify", False)
if args.http_disable_dh:
streamlink.set_option("http-disable-dh", True)
if args.http_ssl_cert:
streamlink.set_option("http-ssl-cert", args.http_ssl_cert)
if args.http_ssl_cert_crt_key:
streamlink.set_option("http-ssl-cert", tuple(args.http_ssl_cert_crt_key))
if args.http_timeout:
streamlink.set_option("http-timeout", args.http_timeout)
def setup_plugins(extra_plugin_dir=None):
"""Loads any additional plugins."""
load_plugins(PLUGIN_DIRS, showwarning=False)
if extra_plugin_dir:
load_plugins([Path(path).expanduser() for path in extra_plugin_dir])
def setup_streamlink():
"""Creates the Streamlink session."""
global streamlink
streamlink = Streamlink({"user-input-requester": ConsoleUserInputRequester(console)})
def setup_options():
"""Sets Streamlink options."""
if args.interface:
streamlink.set_option("interface", args.interface)
if args.ipv4:
streamlink.set_option("ipv4", args.ipv4)
if args.ipv6:
streamlink.set_option("ipv6", args.ipv6)
if args.ringbuffer_size:
streamlink.set_option("ringbuffer-size", args.ringbuffer_size)
if args.mux_subtitles:
streamlink.set_option("mux-subtitles", args.mux_subtitles)
if args.hds_live_edge:
streamlink.set_option("hds-live-edge", args.hds_live_edge)
if args.hls_live_edge:
streamlink.set_option("hls-live-edge", args.hls_live_edge)
if args.hls_playlist_reload_attempts:
streamlink.set_option("hls-playlist-reload-attempts", args.hls_playlist_reload_attempts)
if args.hls_playlist_reload_time:
streamlink.set_option("hls-playlist-reload-time", args.hls_playlist_reload_time)
if args.hls_segment_ignore_names:
streamlink.set_option("hls-segment-ignore-names", args.hls_segment_ignore_names)
if args.hls_segment_key_uri:
streamlink.set_option("hls-segment-key-uri", args.hls_segment_key_uri)
if args.hls_audio_select:
streamlink.set_option("hls-audio-select", args.hls_audio_select)
if args.hls_start_offset:
streamlink.set_option("hls-start-offset", args.hls_start_offset)
if args.hls_duration:
streamlink.set_option("hls-duration", args.hls_duration)
if args.hls_live_restart:
streamlink.set_option("hls-live-restart", args.hls_live_restart)
if args.rtmp_rtmpdump:
streamlink.set_option("rtmp-rtmpdump", args.rtmp_rtmpdump)
elif args.rtmpdump:
streamlink.set_option("rtmp-rtmpdump", args.rtmpdump)
if args.rtmp_proxy:
streamlink.set_option("rtmp-proxy", args.rtmp_proxy)
# deprecated
if args.hds_segment_attempts:
streamlink.set_option("hds-segment-attempts", args.hds_segment_attempts)
if args.hds_segment_threads:
streamlink.set_option("hds-segment-threads", args.hds_segment_threads)
if args.hds_segment_timeout:
streamlink.set_option("hds-segment-timeout", args.hds_segment_timeout)
if args.hds_timeout:
streamlink.set_option("hds-timeout", args.hds_timeout)
if args.hls_segment_attempts:
streamlink.set_option("hls-segment-attempts", args.hls_segment_attempts)
if args.hls_segment_threads:
streamlink.set_option("hls-segment-threads", args.hls_segment_threads)
if args.hls_segment_timeout:
streamlink.set_option("hls-segment-timeout", args.hls_segment_timeout)
if args.hls_timeout:
streamlink.set_option("hls-timeout", args.hls_timeout)
if args.http_stream_timeout:
streamlink.set_option("http-stream-timeout", args.http_stream_timeout)
if args.rtmp_timeout:
streamlink.set_option("rtmp-timeout", args.rtmp_timeout)
# generic stream- arguments take precedence over deprecated stream-type arguments
if args.stream_segment_attempts:
streamlink.set_option("stream-segment-attempts", args.stream_segment_attempts)
if args.stream_segment_threads:
streamlink.set_option("stream-segment-threads", args.stream_segment_threads)
if args.stream_segment_timeout:
streamlink.set_option("stream-segment-timeout", args.stream_segment_timeout)
if args.stream_timeout:
streamlink.set_option("stream-timeout", args.stream_timeout)
if args.ffmpeg_ffmpeg:
streamlink.set_option("ffmpeg-ffmpeg", args.ffmpeg_ffmpeg)
if args.ffmpeg_verbose:
streamlink.set_option("ffmpeg-verbose", args.ffmpeg_verbose)
if args.ffmpeg_verbose_path:
streamlink.set_option("ffmpeg-verbose-path", args.ffmpeg_verbose_path)
if args.ffmpeg_fout:
streamlink.set_option("ffmpeg-fout", args.ffmpeg_fout)
if args.ffmpeg_video_transcode:
streamlink.set_option("ffmpeg-video-transcode", args.ffmpeg_video_transcode)
if args.ffmpeg_audio_transcode:
streamlink.set_option("ffmpeg-audio-transcode", args.ffmpeg_audio_transcode)
if args.ffmpeg_copyts:
streamlink.set_option("ffmpeg-copyts", args.ffmpeg_copyts)
if args.ffmpeg_start_at_zero:
streamlink.set_option("ffmpeg-start-at-zero", args.ffmpeg_start_at_zero)
streamlink.set_option("subprocess-errorlog", args.subprocess_errorlog)
streamlink.set_option("subprocess-errorlog-path", args.subprocess_errorlog_path)
streamlink.set_option("locale", args.locale)
def setup_plugin_args(session, parser):
"""Sets Streamlink plugin options."""
plugin_args = parser.add_argument_group("Plugin options")
for pname, plugin in session.plugins.items():
defaults = {}
group = plugin_args.add_argument_group(pname.capitalize())
for parg in plugin.arguments:
if not parg.is_global:
group.add_argument(parg.argument_name(pname), **parg.options)
defaults[parg.dest] = parg.default
else:
pargdest = parg.dest
for action in parser._actions:
# find matching global argument
if pargdest != action.dest:
continue
defaults[pargdest] = action.default
# add plugin to global argument
plugins = getattr(action, "plugins", [])
plugins.append(pname)
setattr(action, "plugins", plugins)
plugin.options = PluginOptions(defaults)
def setup_plugin_options(session, plugin):
"""Sets Streamlink plugin options."""
pname = plugin.module
required = OrderedDict({})
for parg in plugin.arguments:
if parg.options.get("help") == argparse.SUPPRESS:
continue
value = getattr(args, parg.dest if parg.is_global else parg.namespace_dest(pname))
session.set_plugin_option(pname, parg.dest, value)
if not parg.is_global:
if parg.required:
required[parg.name] = parg
# if the value is set, check to see if any of the required arguments are not set
if parg.required or value:
try:
for rparg in plugin.arguments.requires(parg.name):
required[rparg.name] = rparg
except RuntimeError:
log.error(f"{pname} plugin has a configuration error and the arguments cannot be parsed")
break
if required:
for req in required.values():
if not session.get_plugin_option(pname, req.dest):
prompt = f"{req.prompt or f'Enter {pname} {req.name}'}: "
session.set_plugin_option(
pname,
req.dest,
console.askpass(prompt) if req.sensitive else console.ask(prompt)
)
def log_root_warning():
if hasattr(os, "getuid"):
if os.geteuid() == 0:
log.info("streamlink is running as root! Be careful!")
def log_current_versions():
"""Show current installed versions"""
if not logger.root.isEnabledFor(logging.DEBUG):
return
# macOS
if sys.platform == "darwin":
os_version = f"macOS {platform.mac_ver()[0]}"
# Windows
elif sys.platform == "win32":
os_version = f"{platform.system()} {platform.release()}"
# Linux / other
else:
os_version = platform.platform()
log.debug(f"OS: {os_version}")
log.debug(f"Python: {platform.python_version()}")
log.debug(f"Streamlink: {streamlink_version}")
log.debug(f"Requests({requests.__version__}), "
f"Socks({socks_version}), "
f"Websocket({websocket_version})")
def log_current_arguments(session, parser):
global args
if not logger.root.isEnabledFor(logging.DEBUG):
return
sensitive = set()
for pname, plugin in session.plugins.items():
for parg in plugin.arguments:
if parg.sensitive:
sensitive.add(parg.argument_name(pname))
log.debug("Arguments:")
for action in parser._actions:
if not hasattr(args, action.dest):
continue
value = getattr(args, action.dest)
if action.default != value:
name = next( # pragma: no branch
(option for option in action.option_strings if option.startswith("--")),
action.option_strings[0]
) if action.option_strings else action.dest
log.debug(f" {name}={value if name not in sensitive else '*' * 8}")
def check_version(force=False):
cache = Cache(filename="cli.json")
latest_version = cache.get("latest_version")
if force or not latest_version:
res = requests.get("https://pypi.python.org/pypi/streamlink/json")
data = res.json()
latest_version = data.get("info").get("version")
cache.set("latest_version", latest_version, (60 * 60 * 24))
version_info_printed = cache.get("version_info_printed")
if not force and version_info_printed:
return
installed_version = StrictVersion(streamlink.version)
latest_version = StrictVersion(latest_version)
if latest_version > installed_version:
log.info(f"A new version of Streamlink ({latest_version}) is available!")
cache.set("version_info_printed", True, (60 * 60 * 6))
elif force:
log.info(f"Your Streamlink version ({installed_version}) is up to date!")
if force:
sys.exit()
def setup_logger_and_console(stream=sys.stdout, filename=None, level="info", json=False):
global console
if filename == "-":
filename = LOG_DIR / f"{datetime.now()}.log"
elif filename:
filename = Path(filename).expanduser().resolve()
if filename:
filename.parent.mkdir(parents=True, exist_ok=True)
streamhandler = logger.basicConfig(
stream=stream,
filename=filename,
level=level,
style="{",
format=("[{asctime}]" if level == "trace" else "") + "[{name}][{levelname}] {message}",
datefmt="%H:%M:%S" + (".%f" if level == "trace" else "")
)
console = ConsoleOutput(streamhandler.stream, json)
def main():
error_code = 0
parser = build_parser()
setup_args(parser, ignore_unknown=True)
# call argument set up as early as possible to load args from config files
setup_config_args(parser, ignore_unknown=True)
# Console output should be on stderr if we are outputting
# a stream to stdout.
if args.stdout or args.output == "-" or args.record_and_pipe:
console_out = sys.stderr
else:
console_out = sys.stdout
# We don't want log output when we are printing JSON or a command-line.
silent_log = any(getattr(args, attr) for attr in QUIET_OPTIONS)
log_level = args.loglevel if not silent_log else "none"
log_file = args.logfile if log_level != "none" else None
setup_logger_and_console(console_out, log_file, log_level, args.json)
setup_signals()
setup_streamlink()
# load additional plugins
setup_plugins(args.plugin_dirs)
setup_plugin_args(streamlink, parser)
# call setup args again once the plugin specific args have been added
setup_args(parser)
setup_config_args(parser)
# update the logging level if changed by a plugin specific config
log_level = args.loglevel if not silent_log else "none"
logger.root.setLevel(log_level)
setup_http_session()
log_root_warning()
log_current_versions()
log_current_arguments(streamlink, parser)
if args.version_check or args.auto_version_check:
with ignored(Exception):
check_version(force=args.version_check)
if args.plugins:
print_plugins()
elif args.can_handle_url:
try:
streamlink.resolve_url(args.can_handle_url)
except NoPluginError:
error_code = 1
except KeyboardInterrupt:
error_code = 130
elif args.can_handle_url_no_redirect:
try:
streamlink.resolve_url_no_redirect(args.can_handle_url_no_redirect)
except NoPluginError:
error_code = 1
except KeyboardInterrupt:
error_code = 130
elif args.url:
try:
setup_options()
handle_url()
except KeyboardInterrupt:
# Close output
if output:
output.close()
console.msg("Interrupted! Exiting...")
error_code = 130
finally:
if stream_fd:
try:
log.info("Closing currently open stream...")
stream_fd.close()
except KeyboardInterrupt:
error_code = 130
elif args.help:
parser.print_help()
else:
usage = parser.format_usage()
console.msg(
f"{usage}\n"
f"Use -h/--help to see the available options or read the manual at https://streamlink.github.io"
)
sys.exit(error_code)
def parser_helper():
session = Streamlink()
parser = build_parser()
setup_plugin_args(session, parser)
return parser
| {
"content_hash": "4ac346482a2892721c6bd4f66681e1c4",
"timestamp": "",
"source": "github",
"line_count": 1112,
"max_line_length": 122,
"avg_line_length": 34.02967625899281,
"alnum_prop": 0.621283792711609,
"repo_name": "melmorabity/streamlink",
"id": "07b88bc36babff3a11858ef34a69a78ca7bd4caf",
"size": "37841",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/streamlink_cli/main.py",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Batchfile",
"bytes": "838"
},
{
"name": "Python",
"bytes": "1537432"
},
{
"name": "Shell",
"bytes": "18707"
}
],
"symlink_target": ""
} |
import os
import json
import random
import string
import logging
PROJ_DIR = os.path.join(os.path.dirname(__file__), "..", "..")
PROJ_DIR = os.path.normpath(PROJ_DIR)
CONFIG_DIR = os.path.join(PROJ_DIR, "etc")
BIN_DIR = os.path.join(PROJ_DIR, "bin")
TESTFILE_DIR = os.path.join(PROJ_DIR, "tmp", "test_files")
SUPPORTED_SETUPS = ["swift_small_setup"]
# file in the ./etc/ direcotry
MAIN_CONFIG_FILE = os.environ.get("MAIN_CONFIG_FILE", "config.json")
LOG = logging.getLogger(__name__)
class ConfigException(Exception):
pass
def get_config(filename=MAIN_CONFIG_FILE):
"""Load dict from a JSON configuration file in CONF_DIR."""
with open(os.path.join(CONFIG_DIR, filename)) as f:
config = json.load(f)
return config
CONFIG = get_config()
def get_timeout():
"""Get the timeout configuration from etc/config.json."""
return CONFIG["timeout"]
def get_keystone_auth():
"""Get the keystone authentication info from the configuration file.
The auth_url for keystone will be found out from the servers (it will
search for a server that has the 'keystone' role). If the keystone username
is not provided, it will be 'admin'. If the tenant is not provided, it will
be the same as the user name. The password is required in the
configuration.
:returns: (auth_url, user, tenant, password)
"""
user = CONFIG['keystone'].get('user', 'admin')
tenant = CONFIG['keystone'].get('tenant', user)
password = CONFIG['keystone']['password']
# find out the auth_url
keystone_server = None
for server in CONFIG['servers']:
if 'roles' in server and 'keystone' in server['roles']:
keystone_server = server
if not keystone_server:
raise Exception("No server with 'keystone' role found")
host = keystone_server.get('hostname', None)
if not host:
host = keystone_server['ip']
auth_url = 'http://%s:5000/v2.0/' % host
return (auth_url, user, tenant, password)
def upload_files(swift, container, filename_list):
"""Upload files from the TESTFILE_DIR.
Creates the container if it doesn't exist.
"""
swift.put_container(container)
for filename in filename_list:
f = open(os.path.join(TESTFILE_DIR, filename))
swift.put_object(container, filename, f)
def populate_swift_with_random_files(swift, prefix='',
container_count=5, files_per_container=5):
"""Create random files in test_files dir and upload them to Swift.
:param prefix: prefix before container and file names
:param container_count: how many containers to create
:param files_per_container: how many files to upload per container
"""
LOG.info("Uploading random files to Swift")
containers = [prefix + "container" + str(i)
for i in range(0, container_count)]
files = [prefix + "file" + str(i) + ".txt"
for i in range(0, container_count * files_per_container)]
if not os.path.exists(TESTFILE_DIR):
os.makedirs(TESTFILE_DIR)
for filename in files:
f = open(os.path.join(TESTFILE_DIR, filename), 'w')
f.write(random_string() + '\n')
f.close()
start = 0
for container in containers:
upload_files(swift, container,
files[start:start + files_per_container])
start += files_per_container
LOG.info("Finished uploading random files to Swift")
def delete_testfiles(prefix=''):
"""Delete all *.txt file in test_files directory
:param prefix: only delete files starting with prefix
"""
os.chdir(TESTFILE_DIR)
for f in os.listdir("."):
if f.endswith(".txt") and f.startswith(prefix):
os.remove(f)
def random_string(min_lenght=1, max_length=20):
"""Generate random string made out of alphanumeric characters."""
length = random.randint(min_lenght, max_length)
chars = string.ascii_letters + string.digits
return ''.join([random.choice(chars) for _ in range(length)])
def represents_int(s):
try:
int(s)
return True
except ValueError:
return False
| {
"content_hash": "34e912f6199ab4b9f66d896f226d8b8e",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 79,
"avg_line_length": 32.10077519379845,
"alnum_prop": 0.6496015455204057,
"repo_name": "mkollaro/destroystack",
"id": "aec384aadb1a3f6b063f054afda8b5db0df44c6e",
"size": "4729",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "destroystack/tools/common.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "82190"
}
],
"symlink_target": ""
} |
import os
cw = os.getcwd()
os.chdir("./returned_exams")
import re, sys, string, codecs, zipfile
import stat
import md5
import hashlib
from pyparsing import Word, alphanums, Literal, LineEnd, LineStart, SkipTo, Optional
filesBySize = {}
def walker(arg, dirname, fnames):
d = os.getcwd()
os.chdir(dirname)
try:
fnames.remove('Thumbs')
except ValueError:
pass
for f in fnames:
if not os.path.isfile(f):
continue
size = os.stat(f)[stat.ST_SIZE]
if size < 100:
continue
if filesBySize.has_key(size):
a = filesBySize[size]
else:
a = []
filesBySize[size] = a
a.append(os.path.join(dirname, f))
os.chdir(d)
os.path.walk(".", walker, filesBySize)
print 'Finding potential dupes...'
potentialDupes = []
potentialCount = 0
trueType = type(True)
sizes = filesBySize.keys()
sizes.sort()
for k in sizes:
inFiles = filesBySize[k]
outFiles = []
hashes = {}
if len(inFiles) is 1: continue
print 'Testing %d files of size %d...' % (len(inFiles), k)
for fileName in inFiles:
if not os.path.isfile(fileName):
continue
aFile = file(fileName, 'r')
hasher = md5.new(aFile.read(1024))
hashValue = hasher.digest()
if hashes.has_key(hashValue):
x = hashes[hashValue]
if type(x) is not trueType:
outFiles.append(hashes[hashValue])
hashes[hashValue] = True
outFiles.append(fileName)
else:
hashes[hashValue] = fileName
aFile.close()
if len(outFiles):
potentialDupes.append(outFiles)
potentialCount = potentialCount + len(outFiles)
del filesBySize
print 'Found %d sets of potential duplicate files...' % potentialCount
print 'Scanning for real duplicate files...'
dupes = []
for aSet in potentialDupes:
outFiles = []
hashes = {}
for fileName in aSet:
print 'Scanning file "%s"...' % fileName
aFile = file(fileName, 'r')
hasher = md5.new()
while True:
r = aFile.read(4096)
if not len(r):
break
hasher.update(r)
aFile.close()
hashValue = hasher.digest()
if hashes.has_key(hashValue):
if not len(outFiles):
outFiles.append(hashes[hashValue])
outFiles.append(fileName)
else:
hashes[hashValue] = fileName
if len(outFiles):
dupes.append(outFiles)
i = 0
for d in dupes:
print 'Original is %s' % d[0]
for f in d[1:]:
i = i + 1
print 'Deleting %s' % f
os.remove(f)
print
lst =[]
for filename in sorted(os.listdir(".")):
f, e = os.path.splitext(filename)
if e.lower()!=".txt":
continue
handle = codecs.open(filename,"rb","latin_1")
exam = handle.read()
handle.close()
md5 = hashlib.md5(exam.encode("latin_1")).hexdigest()
name = (Literal(u"Nome") +
SkipTo(LineEnd()).setResultsName("name"))
id = (Literal("(mec)") +
SkipTo(LineEnd()).setResultsName("mec"))
for data,dataStart,dataEnd in name.scanString(exam):
parsed_student_name = data["name"].strip()
for data,dataStart,dataEnd in id.scanString(exam):
parsed_mec = data["mec"].strip().lower()
mec_in_filename = re.search("[\d|A|a|e|E]\d{4,5}",filename)
if mec_in_filename:
mec_in_filename = mec_in_filename.group()
if parsed_mec.upper().startswith("NA"):
parsed_mec=mec_in_filename.lower()
new_name = parsed_student_name.replace(" ","_")+"_"+parsed_mec+"_"+md5+".txt"
#if unicode(filename,"utf-8") != new_name:
if not re.search("_([a-fA-F\d]{32})\.(txt|TXT)", filename):
print "rename",filename,
print "to", new_name
lst.append((filename, new_name))
assert len(lst) == len(set([b for a,b in lst]))
if raw_input("rename {} files (y/n)?".format(len(lst)))=="y":
for filename, newname in lst:
os.rename(filename, newname)
else:
print "files not renamed"
os.chdir(cw) | {
"content_hash": "533de65bde5d415cb7dabfd2d528923a",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 84,
"avg_line_length": 25.820987654320987,
"alnum_prop": 0.5723165192445613,
"repo_name": "BjornFJohansson/molbio-test-generator",
"id": "feeb28b865af50961a993e743ef9854efc67e8d6",
"size": "4229",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "remove_duplicates_rename_exams_to_student_name_mec_md5.py",
"mode": "33261",
"license": "bsd-2-clause",
"language": [
{
"name": "Python",
"bytes": "18936"
}
],
"symlink_target": ""
} |
import warnings
from webob.compat import (
escape,
string_types,
text_,
text_type,
)
from webob.headers import _trans_key
def html_escape(s):
"""HTML-escape a string or object
This converts any non-string objects passed into it to strings
(actually, using ``unicode()``). All values returned are
non-unicode strings (using ``&#num;`` entities for all non-ASCII
characters).
None is treated specially, and returns the empty string.
"""
if s is None:
return ''
__html__ = getattr(s, '__html__', None)
if __html__ is not None and callable(__html__):
return s.__html__()
if not isinstance(s, string_types):
__unicode__ = getattr(s, '__unicode__', None)
if __unicode__ is not None and callable(__unicode__):
s = s.__unicode__()
else:
s = str(s)
s = escape(s, True)
if isinstance(s, text_type):
s = s.encode('ascii', 'xmlcharrefreplace')
return text_(s)
def header_docstring(header, rfc_section):
if header.isupper():
header = _trans_key(header)
major_section = rfc_section.split('.')[0]
link = 'http://www.w3.org/Protocols/rfc2616/rfc2616-sec%s.html#sec%s' % (
major_section, rfc_section)
return "Gets and sets the ``%s`` header (`HTTP spec section %s <%s>`_)." % (
header, rfc_section, link)
def warn_deprecation(text, version, stacklevel):
# version specifies when to start raising exceptions instead of warnings
if version in ('1.2', '1.3', '1.4', '1.5', '1.6', '1.7'):
raise DeprecationWarning(text)
else:
cls = DeprecationWarning
warnings.warn(text, cls, stacklevel=stacklevel + 1)
status_reasons = {
# Status Codes
# Informational
100: 'Continue',
101: 'Switching Protocols',
102: 'Processing',
# Successful
200: 'OK',
201: 'Created',
202: 'Accepted',
203: 'Non-Authoritative Information',
204: 'No Content',
205: 'Reset Content',
206: 'Partial Content',
207: 'Multi Status',
226: 'IM Used',
# Redirection
300: 'Multiple Choices',
301: 'Moved Permanently',
302: 'Found',
303: 'See Other',
304: 'Not Modified',
305: 'Use Proxy',
307: 'Temporary Redirect',
308: 'Permanent Redirect',
# Client Error
400: 'Bad Request',
401: 'Unauthorized',
402: 'Payment Required',
403: 'Forbidden',
404: 'Not Found',
405: 'Method Not Allowed',
406: 'Not Acceptable',
407: 'Proxy Authentication Required',
408: 'Request Timeout',
409: 'Conflict',
410: 'Gone',
411: 'Length Required',
412: 'Precondition Failed',
413: 'Request Entity Too Large',
414: 'Request URI Too Long',
415: 'Unsupported Media Type',
416: 'Requested Range Not Satisfiable',
417: 'Expectation Failed',
418: "I'm a teapot",
422: 'Unprocessable Entity',
423: 'Locked',
424: 'Failed Dependency',
426: 'Upgrade Required',
428: 'Precondition Required',
429: 'Too Many Requests',
451: 'Unavailable for Legal Reasons',
431: 'Request Header Fields Too Large',
# Server Error
500: 'Internal Server Error',
501: 'Not Implemented',
502: 'Bad Gateway',
503: 'Service Unavailable',
504: 'Gateway Timeout',
505: 'HTTP Version Not Supported',
507: 'Insufficient Storage',
510: 'Not Extended',
511: 'Network Authentication Required',
}
# generic class responses as per RFC2616
status_generic_reasons = {
1: 'Continue',
2: 'Success',
3: 'Multiple Choices',
4: 'Unknown Client Error',
5: 'Unknown Server Error',
}
try:
# py3.3+ have native comparison support
from hmac import compare_digest
except ImportError: # pragma: nocover (Python 2.7.7 backported this)
compare_digest = None
def strings_differ(string1, string2, compare_digest=compare_digest):
"""Check whether two strings differ while avoiding timing attacks.
This function returns True if the given strings differ and False
if they are equal. It's careful not to leak information about *where*
they differ as a result of its running time, which can be very important
to avoid certain timing-related crypto attacks:
http://seb.dbzteam.org/crypto/python-oauth-timing-hmac.pdf
.. versionchanged:: 1.5
Support :func:`hmac.compare_digest` if it is available (Python 2.7.7+
and Python 3.3+).
"""
len_eq = len(string1) == len(string2)
if len_eq:
invalid_bits = 0
left = string1
else:
invalid_bits = 1
left = string2
right = string2
if compare_digest is not None:
invalid_bits += not compare_digest(left, right)
else:
for a, b in zip(left, right):
invalid_bits += a != b
return invalid_bits != 0
| {
"content_hash": "80510061fd855cac77d97b92b11a6004",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 80,
"avg_line_length": 28.488235294117647,
"alnum_prop": 0.6188313029114185,
"repo_name": "stefanv/aandete",
"id": "b7db88c5bb5768176b1733c2be1eb7dc4878a0e5",
"size": "4843",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "app/lib/webob/util.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "JavaScript",
"bytes": "248684"
},
{
"name": "Python",
"bytes": "6478502"
}
],
"symlink_target": ""
} |
import sys
from lxml import etree
sys.path.append('./lib')
from pypeer.ConfigDictionary import ConfigDictionary
from pypeer.RouteData import RouteData
from pypeer.BgpData import BgpData
from pypeer.Exchange import Exchange
from pypeer.PeeringDBClient import PeeringDBClient
import unittest
# Can run with -a '!internet' when offline to skip peeringdb shit tests.
class OfflineTests(unittest.TestCase):
def test_username(self):
config = ConfigDictionary('./etc/example.ini')
thisusername = config.username()
self.assertTrue(thisusername == 'exampleuser')
def test_can_find_rtr1_ipaddr(self):
config = ConfigDictionary('./etc/example.ini')
self.assertTrue(config.get_router_ip('rtr1') == '91.194.69.4')
def test_can_see_rtr2_in_list_of_routers(self):
config = ConfigDictionary('./etc/example.ini')
self.assertTrue("rtr2" in config.get_list_of_router_names())
def test_can_read_prefix_from_route_object(self):
resultxml = etree.fromstring(open('./tests/test_data/bgp_route.xml').read())
route = RouteData(resultxml.find('.//rt'))
self.assertTrue(route.prefix() == '199.87.242.0/24')
def test_can_get_localpref_for_active_prefix(self):
resultxml = etree.fromstring(open('./tests/test_data/bgp_route.xml').read())
route = RouteData(resultxml.find('.//rt'))
self.assertTrue(route.activelocalpref() == 1000)
def test_can_obtain_clean_aspath_for_route(self):
resultxml = etree.fromstring(open('./tests/test_data/bgp_route.xml').read())
route = RouteData(resultxml.find('.//rt'))
self.assertTrue(route.aspath() == '6939 6461 12536')
def test_can_parse_peering_localpref_range(self):
config = ConfigDictionary('./etc/example.ini')
self.assertTrue(config.get_type_from_localpref(2500) == "peer")
def test_can_get_ipaddr_of_peer(self):
resultxml = etree.fromstring(open('./tests/test_data/bgp_summary.xml').read())
bgpsum = BgpData(resultxml)
self.assertTrue(bgpsum.get_list_ipaddr_from_asn(6939)[0] == '5.57.80.128')
def test_can_detect_exchange_of_peer(self):
resultxml = etree.fromstring(open('./tests/test_data/bgp_summary.xml').read())
bgpsum = BgpData(resultxml)
exchange = Exchange()
self.assertTrue(exchange.get_exchange_from_peerip(bgpsum.get_list_ipaddr_from_asn(6939)[0])['name'] == 'LONAP')
# @unittest.skip("Offline!")
def test_can_obtain_list_of_connected_exchanges_from_peeringdb(self):
peeringdb = PeeringDBClient()
self.assertTrue(53 in peeringdb.get_list_connected_ixp(12536))
# @unittest.skip("Offline!")
def test_can_get_name_of_IXP(self):
peeringdb = PeeringDBClient()
self.assertTrue("LINX Juniper LAN (London Internet Exchange Ltd.)" == peeringdb.get_name_of_ixp_from_pdbid(18))
if __name__ == "__main__":
unittest.main()
| {
"content_hash": "56d3133a5c442a8e20d26c3966465e3f",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 119,
"avg_line_length": 40.75,
"alnum_prop": 0.6768916155419223,
"repo_name": "job/pypeer",
"id": "9b47bba17bed06c8d0dcf126feb5157e0ec8a624",
"size": "2957",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/test_offline.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "99018"
}
],
"symlink_target": ""
} |
"""Sensor for Last.fm account status."""
import logging
import re
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_API_KEY, ATTR_ATTRIBUTION
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__name__)
ATTR_LAST_PLAYED = "last_played"
ATTR_PLAY_COUNT = "play_count"
ATTR_TOP_PLAYED = "top_played"
ATTRIBUTION = "Data provided by Last.fm"
CONF_USERS = "users"
ICON = "mdi:lastfm"
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
{
vol.Required(CONF_API_KEY): cv.string,
vol.Required(CONF_USERS, default=[]): vol.All(cv.ensure_list, [cv.string]),
}
)
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Last.fm sensor platform."""
import pylast as lastfm
from pylast import WSError
api_key = config[CONF_API_KEY]
users = config.get(CONF_USERS)
lastfm_api = lastfm.LastFMNetwork(api_key=api_key)
entities = []
for username in users:
try:
lastfm_api.get_user(username).get_image()
entities.append(LastfmSensor(username, lastfm_api))
except WSError as error:
_LOGGER.error(error)
return
add_entities(entities, True)
class LastfmSensor(Entity):
"""A class for the Last.fm account."""
def __init__(self, user, lastfm):
"""Initialize the sensor."""
self._user = lastfm.get_user(user)
self._name = user
self._lastfm = lastfm
self._state = "Not Scrobbling"
self._playcount = None
self._lastplayed = None
self._topplayed = None
self._cover = None
@property
def name(self):
"""Return the name of the sensor."""
return self._name
@property
def entity_id(self):
"""Return the entity ID."""
return f"sensor.lastfm_{self._name}"
@property
def state(self):
"""Return the state of the sensor."""
return self._state
def update(self):
"""Update device state."""
self._cover = self._user.get_image()
self._playcount = self._user.get_playcount()
last = self._user.get_recent_tracks(limit=2)[0]
self._lastplayed = f"{last.track.artist} - {last.track.title}"
top = self._user.get_top_tracks(limit=1)[0]
toptitle = re.search("', '(.+?)',", str(top))
topartist = re.search("'(.+?)',", str(top))
self._topplayed = "{} - {}".format(topartist.group(1), toptitle.group(1))
if self._user.get_now_playing() is None:
self._state = "Not Scrobbling"
return
now = self._user.get_now_playing()
self._state = f"{now.artist} - {now.title}"
@property
def device_state_attributes(self):
"""Return the state attributes."""
return {
ATTR_ATTRIBUTION: ATTRIBUTION,
ATTR_LAST_PLAYED: self._lastplayed,
ATTR_PLAY_COUNT: self._playcount,
ATTR_TOP_PLAYED: self._topplayed,
}
@property
def entity_picture(self):
"""Avatar of the user."""
return self._cover
@property
def icon(self):
"""Return the icon to use in the frontend."""
return ICON
| {
"content_hash": "80b09c5093d1ad6ce63709a6f9ad4f2b",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 83,
"avg_line_length": 28.603448275862068,
"alnum_prop": 0.6057866184448463,
"repo_name": "Cinntax/home-assistant",
"id": "736792aefd8123c568983bd4d356a6e8242cac28",
"size": "3318",
"binary": false,
"copies": "1",
"ref": "refs/heads/dev",
"path": "homeassistant/components/lastfm/sensor.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "17374056"
},
{
"name": "Shell",
"bytes": "6792"
}
],
"symlink_target": ""
} |
"""Utilities for AFF4 imaging.
These are mostly high level utilities used by the command line imager.
"""
| {
"content_hash": "154c2ab4bcff2275cd5a880eeaeb3097",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 70,
"avg_line_length": 26.75,
"alnum_prop": 0.7570093457943925,
"repo_name": "blschatz/aff4",
"id": "79b04200163c8b1ebfcf30dbea084e60d7b2e597",
"size": "702",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pyaff4/pyaff4/aff4_imager_utils.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "5779"
},
{
"name": "C++",
"bytes": "309947"
},
{
"name": "M4",
"bytes": "14480"
},
{
"name": "Makefile",
"bytes": "4356"
},
{
"name": "Python",
"bytes": "231621"
},
{
"name": "Shell",
"bytes": "402"
}
],
"symlink_target": ""
} |
import os
from datetime import datetime
import time
import tempfile
from stratuslab.CloudConnectorFactory import CloudConnectorFactory
from stratuslab.Util import sshCmd
from stratuslab.Util import sshCmdWithOutput
from stratuslab.Util import waitUntilPingOrTimeout
from stratuslab.Util import getHostnameFromUri
import stratuslab.Util as Util
from Exceptions import ValidationException
from Exceptions import ExecutionException
from Authn import AuthnFactory
from stratuslab.system.ubuntu import installCmd as aptInstallCmd
from stratuslab.system.ubuntu import updateCmd as aptUpdateCmd
from stratuslab.system.ubuntu import cleanPackageCacheCmd as aptCleanPackageCacheCmd
from stratuslab.system.centos import installCmd as yumInstallCmd
from stratuslab.system.centos import updateCmd as yumUpdateCmd
from stratuslab.system.centos import cleanPackageCacheCmd as yumCleanPackageCacheCmd
from stratuslab.image.Image import Image
from stratuslab.system import Systems
from stratuslab import Defaults
from stratuslab.marketplace.ManifestDownloader import ManifestDownloader
from stratuslab.Monitor import Monitor
from stratuslab.vm_manager.vm_manager import VmManager
from stratuslab.vm_manager.vm_manager_factory import VmManagerFactory
class Creator(object):
VM_START_TIMEOUT = 60 * 10
VM_PING_TIMEOUT = 60 * 5
excludeFromCreatedImageDefault = ['/tmp/*',
'/etc/ssh/ssh_host_*',
'/root/.ssh/{authorized_keys,known_hosts}']
def __init__(self, image, configHolder):
self.image = image
self.configHolder = configHolder
self.newImageGroupName = ''
self.newInstalledSoftwareName = ''
self.newInstalledSoftwareVersion = ''
self.newImageGroupVersion = ''
self.newImageGroupVersionWithManifestId = False
self.author = ''
self.title = ''
self.comment = ''
self.os = ''
self.authorEmail = ''
self.marketplaceEndpointNewimage = ''
self.endpoint = ''
self.extraOsReposUrls = ''
self.packages = ''
self.scripts = ''
self.prerecipe = ''
self.recipe = ''
self.verboseLevel = ''
self.shutdownVm = True
self.signManifest = True
self.vmStartTimeout = self.VM_START_TIMEOUT
self.vmPingTimeout = self.VM_PING_TIMEOUT
self.options = VmManager.defaultRunOptions()
self.options.update(configHolder.options)
self.configHolder.options.update(self.options)
configHolder.assign(self)
self._set_stdouterr()
credentials = AuthnFactory.getCredentials(self)
self.cloud = CloudConnectorFactory.getCloud(credentials)
self.cloud.setEndpoint(self.endpoint)
self.runner = None
self.vmAddress = None
self.vmId = None
self.vmIp = None
self.vmName = 'creator'
self.userPublicKeyFile = self.options.get('userPublicKeyFile',
Defaults.sshPublicKeyLocation)
self.userPrivateKeyFile = self.userPublicKeyFile.strip('.pub')
self.mainDisk = ''
self.extraDisk = ''
self.mountPointExtraDisk = '/media'
self.imageFile = ''
self.imageFileBundled = ''
self.excludeFromCreatedImage = \
self.excludeFromCreatedImageDefault + \
self.options.get('excludeFromCreatedImage', '').split(',')
self.installer = self.options.get('installer')
self.targetImageUri = ''
self.targetManifestUri = ''
self.manifest = ''
self.manifestObject = None
self.newManifestFileName = None
self.manifestLocalFileName = ''
self.__listener = CreatorBaseListener()
def _set_stdouterr(self):
Util.set_stdouterr(self)
def printDetail(self, msg):
return Util.printDetail(msg, self.verboseLevel, Util.VERBOSE_LEVEL_NORMAL)
def create(self):
self._printAction('Starting image creation')
self.startNode()
try:
self.buildNodeIncrement()
self._printAction('Finished building image increment.')
self._printAction('Please check %s for new image ID and instruction.' %
self.authorEmail)
finally:
self._shutdownNode()
self._localCleanUp()
def startNode(self):
self._imageExists()
self._retrieveManifest()
self.__setAttributesFromManifest()
self.__createRunner()
self._startMachine()
self._waitMachineNetworkUpOrAbort()
self._checkIfCanConnectToMachine()
def buildNodeIncrement(self):
self._executePrerecipe()
self._installPackages()
self._executeRecipe()
self._executeScripts()
def _printAction(self, msg):
Util.printAction(msg)
self._notifyOnAction(msg)
def _printStep(self, msg):
Util.printStep(msg)
self._notifyOnStep(msg)
def _printError(self, msg):
self._notifyOnError(msg)
Util.printError(msg)
def setListener(self, listener):
if listener:
self.__listener = listener
def _notifyOnAction(self, note):
self._notify('Action', note)
def _notifyOnStep(self, note):
self._notify('Step', note)
def _notifyOnError(self, note):
self._notify('Error', note)
def _notify(self, operation, note):
def callListener():
notifyFunction = getattr(self.__listener, onOperation)
notifyFunction(note)
onOperation = 'on%s' % operation
if hasattr(self.__listener, onOperation):
pass
elif hasattr(self.__listener, 'onAny'):
onOperation = 'onAny'
callListener()
def _checkIfCanConnectToMachine(self):
self._printStep('Check if we can connect to the machine')
cmd = 'true'
try:
self._sshCmdWithOutputVerb(cmd)
except ExecutionException:
sleepTime = 6
maxCount = 40
counter = 0
while True:
try:
self.printDetail('Sleeping %i sec. Retry %i out of %i.' % (sleepTime, counter + 1, maxCount))
time.sleep(sleepTime)
self._sshCmdWithOutputVerb(cmd)
break
except ExecutionException, e:
if counter >= maxCount:
raise ExecutionException(e)
counter += 1
def _imageExists(self):
self._printStep('Checking that base image exists')
self._checkImageExists()
def _checkImageExists(self):
image = Image(self.configHolder)
image.checkImageExists(self.image)
def _getCreateImageTemplateDict(self):
return {VmManager.CREATE_IMAGE_KEY_CREATOR_EMAIL: self.authorEmail,
VmManager.CREATE_IMAGE_KEY_CREATOR_NAME: self.author,
VmManager.CREATE_IMAGE_KEY_NEWIMAGE_TITLE: self.title,
VmManager.CREATE_IMAGE_KEY_NEWIMAGE_COMMENT: self.comment,
VmManager.CREATE_IMAGE_KEY_NEWIMAGE_VERSION: self.newImageGroupVersion,
VmManager.CREATE_IMAGE_KEY_NEWIMAGE_MARKETPLACE: self.marketplaceEndpointNewimage}
def createRunner(self):
self.__createRunner()
def __createRunner(self):
self.configHolder.set('vmName',
'%s: %s' % (self.vmName, Util.getTimeInIso8601()))
self.configHolder.set('noCheckImageUrl', True)
self.configHolder.set('saveDisk', True)
self.runner = VmManagerFactory.create(self.image, self.configHolder)
self.runner.updateCreateImageTemplateData(
self._getCreateImageTemplateDict())
def _startMachine(self):
self._printStep('Starting base image')
try:
self.vmId = self.runner.runInstance()[0]
except Exception, msg:
self._printError('An error occurred while starting machine: \n\t%s' % msg)
try:
_, self.vmIp = self.runner.getNetworkDetail(self.vmId)
self.vmAddress = self.vmIp
except Exception, e:
self._printError('An error occurred while getting machine network details: \n\t%s' % str(e))
self._printStep('Waiting for machine to boot')
vmStarted = self.runner.waitUntilVmRunningOrTimeout(self.vmId,
self.vmStartTimeout,
failOn='Failed')
if not vmStarted:
if self.runner.getVmState(self.vmId) == 'Failed':
msg = 'Failed to start VM (id=%s, ip=%s): %s' % \
(self.vmId, self.vmAddress,
self._getVmFailureMessage(self.vmId))
else:
msg = 'Failed to start VM within %i seconds (id=%s, ip=%s)' % \
(self.vmStartTimeout, self.vmId, self.vmAddress)
self.printDetail(msg)
self._killMachine()
self._printError(msg)
def _stopMachine(self):
self._printStep('Shutting down machine')
if self.getVmState() != 'Failed':
self.cloud.vmStop(self.vmId)
def _killMachine(self):
self._printStep('Killing machine')
if self.vmId:
self.cloud.vmKill(self.vmId)
else:
Util.printWarning('Undefined VM ID, when trying to kill machine.')
def _getVmFailureMessage(self, vmId):
return getattr(Monitor(self.configHolder)._vmDetail(vmId),
'template_error_message', '')
def _shutdownNode(self):
if self.shutdownVm:
self._stopMachine()
else:
self._printStep('Machine ready for use')
msg = '\n\tMachine IP: %s\tRemember to stop the machine when finished' % self.vmIp
Util.printInfo(msg)
def _waitMachineNetworkUpOrAbort(self):
self._printStep('Waiting for machine network to start')
if not waitUntilPingOrTimeout(self.vmAddress, self.vmPingTimeout):
msg = 'Unable to ping VM in %i seconds (id=%s, ip=%s)' % \
(self.vmPingTimeout, self.vmId, self.vmAddress)
self._printError(msg)
self._stopMachine()
def _getPublicAddress(self):
return self.vmIp
def _retrieveManifest(self):
self._printStep('Retrieving image manifest')
configHolder = self.configHolder.copy()
downloader = ManifestDownloader(configHolder)
self.manifestObject = downloader.getManifestInfo(self.image)
self.manifest = self.manifestObject.tostring()
def __setAttributesFromManifest(self):
self._setOsFromManifest()
self._setInstallerBasedOnOs()
def _setOsFromManifest(self):
if not self.os:
self.os = self._getAttrFromManifest('os').lower()
def _setInstallerBasedOnOs(self):
if not self.installer:
self.installer = Systems.getInstallerBasedOnOs(self.os)
def _getAttrFromManifest(self, attr):
return getattr(self.manifestObject, attr)
def _installPackages(self):
self._printStep('Installing user packages')
if len(self.packages) == 0:
self.printDetail('No packages to install')
return
self._setUpExtraRepositories()
self.printDetail('Updating installer')
ret = self._doInstallerUpdate()
self.printDetail('Installing packages: %s' % self.packages)
ret = self._doInstallPackagesRemotly(self.packages)
if ret != 0:
self._printError('An error occurred while installing packages')
def _setUpExtraRepositories(self):
if not self.extraOsReposUrls:
return
self.printDetail('Adding extra repositories')
if self.installer not in Systems.INSTALLERS:
ValidationException('Unknown installer %s. Bailing out.' %
self.installer)
extraReposList = self.extraOsReposUrls.split(',')
if self.installer == 'yum':
for i, repoUrl in enumerate(extraReposList):
repoName = getHostnameFromUri(repoUrl)
cmd = """cat >> /etc/yum.repos.d/%(name)s.repo << EOF
[%(name)s]
name=%(name)s
baseurl=%(url)s
gpgcheck=0
enabled=1
EOF
""" % {'name': '%s-%i' % (repoName, i), 'id': i, 'url': repoUrl}
elif self.installer == 'apt':
for repoUrl in extraReposList:
repoName = getHostnameFromUri(repoUrl)
cmd = """cat >> /etc/apt/sources.list.d/%(reponame)s.list << EOF
deb %(repourl)s
EOF
""" % {'reponame': repoName, 'repourl': repoUrl}
self._sshCmdWithOutput(cmd)
def _doInstallPackagesRemotly(self, packages):
cmd = self._buildInstallerCommand() + ' '
cmd += ' '.join(packages.split(','))
return self._sshCmd(cmd, stderr=self.stderr, stdout=self.stdout)
def _doInstallerUpdate(self):
cmd = self._buildUpdaterCommand()
return self._sshCmd(cmd, stderr=self.stderr, stdout=self.stdout)
def _buildInstallerCommand(self):
if self.installer == 'yum':
return yumInstallCmd
elif self.installer == 'apt':
return aptInstallCmd
def _buildUpdaterCommand(self):
if self.installer == 'yum':
return yumUpdateCmd
elif self.installer == 'apt':
return aptUpdateCmd
def _buildPackageCacheCleanerCommand(self):
if self.installer == 'yum':
return yumCleanPackageCacheCmd
elif self.installer == 'apt':
return aptCleanPackageCacheCmd
def _executeScripts(self):
self._printStep('Executing user scripts')
if len(self.scripts) == 0:
self.printDetail('No scripts to execute')
return
self.printDetail('Executing scripts: %s' % self.scripts)
for script in self.scripts.split(','):
self._uploadAndExecuteRemoteScript(script)
def _uploadAndExecuteRemoteScript(self, script):
def __tellScriptNameAndArgs(script):
scriptNameAndArgs = os.path.basename(script)
scriptNameAndArgsList = scriptNameAndArgs.split(' ', 1)
if len(scriptNameAndArgsList) == 1: # no arguments given
scriptNameAndArgsList = scriptNameAndArgsList + ['']
return scriptNameAndArgsList
def _uploadScript(script):
scriptName, args = __tellScriptNameAndArgs(script)
scriptDirectory = Util.sanitizePath(os.path.dirname(script))
scriptPathLocal = os.path.abspath(os.path.join(scriptDirectory, scriptName))
scriptPathRemote = '/tmp/%s' % scriptName
rc, output = self._scpWithOutput(scriptPathLocal, 'root@%s:%s' % (self.vmAddress, scriptPathRemote))
if rc != 0:
self._printError('An error occurred while uploading script %s\n%s' % (script, output))
self._sshCmdWithOutput('chmod 0755 %s' % scriptPathRemote)
return scriptPathRemote, args
def _executeRemoteScript(scriptPathRemote, args=''):
rc = self._sshCmd('%s %s' % (scriptPathRemote, args), throwOnError=False,
pseudoTTY=True)
if rc != 0:
self._printError('An error occurred while executing script %s' % script)
scriptPathRemote, args = _uploadScript(script)
_executeRemoteScript(scriptPathRemote, args)
def _executePrerecipe(self):
self._printStep('Executing user prerecipe')
if len(self.prerecipe) == 0:
self.printDetail('No prerecipe to execute')
return
self._uploadAndExecuteRemoteRecipe(self.prerecipe)
def _executeRecipe(self):
self._printStep('Executing user recipe')
if len(self.recipe) == 0:
self.printDetail('No recipe to execute')
return
self._uploadAndExecuteRemoteRecipe(self.recipe)
def _uploadAndExecuteRemoteRecipe(self, script):
fd, recipeFile = tempfile.mkstemp()
try:
os.write(fd, script)
os.close(fd)
os.chmod(recipeFile, 0755)
scriptPath = '/tmp/%s' % os.path.basename(recipeFile)
rc = self._scp(recipeFile, 'root@%s:%s' % (self.vmAddress, scriptPath))
if rc != 0:
self._printError('An error occurred while uploading recipe')
self._sshCmdWithOutput('chmod 0755 %s' % scriptPath)
rc = self._sshCmd(scriptPath, throwOnError=False, pseudoTTY=True)
if rc != 0:
self._printError('An error occurred while executing user recipe.')
finally:
try:
os.unlink(recipeFile)
except:
pass
def _localCleanUp(self):
Util.execute(['rm', '-rf', self.manifestLocalFileName])
def _scp(self, src, dst, **kwargs):
return Util.scp(src, dst, self.userPrivateKeyFile,
verboseLevel=self.verboseLevel, verboseThreshold=Util.VERBOSE_LEVEL_DETAILED,
stderr=self.stderr, stdout=self.stdout, **kwargs)
def _scpWithOutput(self, src, dst):
return self._scp(src, dst, withOutput=True)
def _sshCmd(self, cmd, throwOnError=True, **kwargs):
ret = sshCmd(cmd, self.vmAddress,
sshKey=self.userPrivateKeyFile,
verboseLevel=self.verboseLevel,
verboseThreshold=Util.VERBOSE_LEVEL_DETAILED,
**kwargs)
if ret and throwOnError:
raise ExecutionException('Error executing command: %s' % cmd)
return ret
def _sshCmdWithOutput(self, cmd, throwOnError=True, **kwargs):
rc, output = sshCmdWithOutput(cmd, self.vmAddress,
sshKey=self.userPrivateKeyFile,
verboseLevel=self.verboseLevel,
verboseThreshold=Util.VERBOSE_LEVEL_DETAILED,
**kwargs)
if rc and throwOnError:
raise ExecutionException('Error executing command: %s\n%s' % (cmd, output))
return rc, output
def _sshCmdWithOutputVerb(self, cmd, **kwargs):
return self._sshCmdWithOutput(cmd, sshVerb=True, **kwargs)
def _sshCmdWithOutputQuiet(self, cmd, **kwargs):
return self._sshCmdWithOutput(cmd, sshQuiet=True, **kwargs)
def getNewImageId(self):
return self.manifestObject.identifier
def getVmId(self):
return self.vmId
def getVmState(self):
return self.runner.getVmState(self.vmId)
# FIXME: This should be treated as a log handler rather than an ad hoc class.
class CreatorBaseListener(object):
def __init__(self, verbose=False):
if verbose:
self.write = self.__beVerbose
def write(self, msg):
pass
def __beVerbose(self, msg):
print msg
def onAction(self, msg):
self.write('action: %s' % msg)
def onStep(self, msg):
self.write('step: %s' % msg)
def onError(self, msg):
self.write('error: %s' % msg)
| {
"content_hash": "76754d472a14c211ac6a4743162337a7",
"timestamp": "",
"source": "github",
"line_count": 570,
"max_line_length": 113,
"avg_line_length": 33.96666666666667,
"alnum_prop": 0.6086978978358556,
"repo_name": "StratusLab/client",
"id": "d23f35157243a6841260edcdc84af12f66fa7a66",
"size": "20097",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "api/code/src/main/python/stratuslab/Creator.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "30262"
},
{
"name": "HTML",
"bytes": "399451"
},
{
"name": "JavaScript",
"bytes": "26512"
},
{
"name": "Python",
"bytes": "2417913"
},
{
"name": "Shell",
"bytes": "5806"
},
{
"name": "Smarty",
"bytes": "34040"
}
],
"symlink_target": ""
} |
from pystruct.datasets import load_scene, load_letters, load_snakes
def test_dataset_loading():
# test that we can read the datasets.
load_scene()
load_letters()
load_snakes()
| {
"content_hash": "f80f5c4349607a56384de81861689d63",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 67,
"avg_line_length": 24.25,
"alnum_prop": 0.6958762886597938,
"repo_name": "massmutual/pystruct",
"id": "b6f054c5707a854326c3c94b8ba32da3e4f35c15",
"size": "194",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "pystruct/tests/test_datasets.py",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Makefile",
"bytes": "307"
},
{
"name": "Python",
"bytes": "375450"
},
{
"name": "Shell",
"bytes": "3960"
}
],
"symlink_target": ""
} |
import unittest
from cStringIO import StringIO
from rdflib.graph import Graph
from rdflib.store import Store
from rdflib import plugin, Namespace, RDF, URIRef
from FuXi.Rete.Network import ReteNetwork
from FuXi.Rete.RuleStore import N3RuleStore, SetupRuleStore
from FuXi.Rete.Util import (
# renderNetwork,
generateTokenSet
)
# from FuXi.Horn.PositiveConditions import Uniterm, BuildUnitermFromTuple
from FuXi.Horn.HornRules import HornFromN3
N3_PROGRAM = \
"""
@prefix m: <http://example.com/#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
{ ?det a m:Detection.
?det has m:name ?infName.
} => {
?det has m:inference [ a m:Inference; m:inference_name ?infName ].
}.
"""
N3_FACTS = \
"""
@prefix : <#> .
@prefix m: <http://example.com/#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
m:Detection a rdfs:Class .
m:Inference a rdfs:Class .
:det1 a m:Detection .
:det1 m:name "Inference1" .
:det2 a m:Detection .
:det2 m:name "Inference2" .
"""
class ExistentialInHeadTest(unittest.TestCase):
def testExistentials(self):
store = plugin.get('IOMemory', Store)()
store.open('')
ruleStore = N3RuleStore()
ruleGraph = Graph(ruleStore)
ruleGraph.parse(StringIO(N3_PROGRAM), format='n3')
factGraph = Graph(store)
factGraph.parse(StringIO(N3_FACTS), format='n3')
deltaGraph = Graph(store)
network = ReteNetwork(ruleStore,
initialWorkingMemory=generateTokenSet(factGraph),
inferredTarget=deltaGraph)
inferenceCount = 0
for inferredFact in network.inferredFacts.subjects(
predicate=RDF.type,
object=URIRef('http://example.com/#Inference')):
inferenceCount = inferenceCount + 1
print(network.inferredFacts.serialize(format='n3'))
self.failUnless(inferenceCount > 1,
'Each rule firing should introduce a new BNode!')
# cg = network.closureGraph(factGraph, store=ruleStore)
# print(cg.serialize(format="n3"))
SKOLEM_MACHINE_RULES = \
"""
@prefix ex: <http://example.com/#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
{?X ex:b ?Y} => {_:Z ex:p ?Y}.
{?X ex:e ?Y} => {_:Z ex:p ?Y}.
"""
SKOLEM_MACHINE_FACTS = \
"""
@prefix ex: <http://example.com/#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
ex:a ex:b ex:c.
ex:d ex:e ex:c.
"""
#{?x ?p ?y} => {[] ?p []} . :a :b :c .
EX_NS = Namespace('http://example.com/#')
class SkolemMachine(unittest.TestCase):
def setUp(self):
ruleStore, ruleGraph, network = SetupRuleStore(makeNetwork=True)
self.network = network
self.factGraph = Graph().parse(
StringIO(SKOLEM_MACHINE_FACTS), format='n3')
for rule in HornFromN3(StringIO(SKOLEM_MACHINE_RULES)):
self.network.buildNetworkFromClause(rule)
self.network.feedFactsToAdd(generateTokenSet(self.factGraph))
def testSkolemMachine(self):
print("\n**** Why was this expected to produce only one inferred fact?")
self.assertEquals(len(list(self.network.inferredFacts.triples(
(None, EX_NS.p, None)))),
2)
if __name__ == "__main__":
unittest.main()
| {
"content_hash": "865add0912efef2cc7a883bb74ba6877",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 80,
"avg_line_length": 33.2803738317757,
"alnum_prop": 0.6273518674529627,
"repo_name": "mpetyx/pyrif",
"id": "dbbd0b6c7dd762060e52107b00c9423605cb0381",
"size": "3600",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "3rdPartyLibraries/FuXi-master/test/testExistentialInHead.py",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "AGS Script",
"bytes": "260965"
},
{
"name": "CSS",
"bytes": "16242"
},
{
"name": "JavaScript",
"bytes": "26014"
},
{
"name": "Perl",
"bytes": "1339"
},
{
"name": "Prolog",
"bytes": "5556"
},
{
"name": "Python",
"bytes": "788856"
},
{
"name": "Shell",
"bytes": "3156"
},
{
"name": "XSLT",
"bytes": "26298"
}
],
"symlink_target": ""
} |
"""PnP Window Mixing.
Plug and Play nottifications are sent only to Window devices
(devices that have a window handle.
So regardless of the GUI toolkit used, the Mixin' classes
expose here can be used.
"""
from __future__ import absolute_import
from __future__ import print_function
import ctypes
from ctypes.wintypes import DWORD
from . import wnd_hook_mixin
from . import core
from . import winapi
WndProcHookMixin = wnd_hook_mixin.WndProcHookMixin
#for PNP notifications
class DevBroadcastDevInterface(ctypes.Structure):
"""DEV_BROADCAST_DEVICEINTERFACE ctypes structure wrapper"""
_fields_ = [
# size of the members plus the actual length of the dbcc_name string
("dbcc_size", DWORD),
("dbcc_devicetype", DWORD),
("dbcc_reserved", DWORD),
("dbcc_classguid", winapi.GUID),
("dbcc_name", ctypes.c_wchar),
]
def __init__(self):
"""Initialize the fields for device interface registration"""
ctypes.Structure.__init__(self)
self.dbcc_size = ctypes.sizeof(self)
self.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE
self.dbcc_classguid = winapi.GetHidGuid()
#***********************************
# PnP definitions
WM_DEVICECHANGE = 0x0219
# PC docked or undocked
DBT_CONFIGCHANGED = 0x0018
# Device or piece of media has been inserted and is now available.
DBT_DEVICEARRIVAL = 0x8000
# Device or piece of media has been removed.
DBT_DEVICEREMOVECOMPLETE = 0x8004
RegisterDeviceNotification = ctypes.windll.user32.RegisterDeviceNotificationW
RegisterDeviceNotification.restype = ctypes.wintypes.HANDLE
RegisterDeviceNotification.argtypes = [
ctypes.wintypes.HANDLE,
ctypes.wintypes.LPVOID,
DWORD
]
UnregisterDeviceNotification = ctypes.windll.user32.UnregisterDeviceNotification
UnregisterDeviceNotification.restype = ctypes.wintypes.BOOL
UnregisterDeviceNotification.argtypes = [
ctypes.wintypes.HANDLE,
]
#dbcc_devicetype, device interface only used
DBT_DEVTYP_DEVICEINTERFACE = 0x00000005
DBT_DEVTYP_HANDLE = 0x00000006
DEVICE_NOTIFY_WINDOW_HANDLE = 0x00000000
DEVICE_NOTIFY_SERVICE_HANDLE = 0x00000001
class HidPnPWindowMixin(WndProcHookMixin):
"""Base for receiving PnP notifications.
Just call HidPnPWindowMixin.__init__(my_hwnd) being
my_hwnd the OS window handle (most GUI toolkits
allow to get the system window handle).
"""
def __init__(self, wnd_handle):
"""HidPnPWindowMixin initializer"""
WndProcHookMixin.__init__(self, wnd_handle)
self.__hid_hwnd = wnd_handle
self.current_status = "unknown"
#register hid notification msg handler
self.__h_notify = self._register_hid_notification()
if not self.__h_notify:
raise core.HIDError("PnP notification setup failed!")
else:
WndProcHookMixin.add_msg_handler(self, WM_DEVICECHANGE,
self._on_hid_pnp)
# add capability to filter out windows messages
WndProcHookMixin.hook_wnd_proc(self)
def unhook_wnd_proc(self):
"This function must be called to clean up system resources"
WndProcHookMixin.unhook_wnd_proc(self)
if self.__h_notify:
self._unregister_hid_notification() #ignore result
def _on_hid_pnp(self, w_param, l_param):
"Process WM_DEVICECHANGE system messages"
new_status = "unknown"
if w_param == DBT_DEVICEARRIVAL:
# hid device attached
notify_obj = None
if int(l_param):
# Disable this error since pylint doesn't reconize
# that from_address actually exists
# pylint: disable=no-member
notify_obj = DevBroadcastDevInterface.from_address(l_param)
#confirm if the right message received
if notify_obj and \
notify_obj.dbcc_devicetype == DBT_DEVTYP_DEVICEINTERFACE:
#only connect if already disconnected
new_status = "connected"
elif w_param == DBT_DEVICEREMOVECOMPLETE:
# hid device removed
notify_obj = None
if int(l_param):
# Disable this error since pylint doesn't reconize
# that from_address actually exists
# pylint: disable=no-member
notify_obj = DevBroadcastDevInterface.from_address(l_param)
if notify_obj and \
notify_obj.dbcc_devicetype == DBT_DEVTYP_DEVICEINTERFACE:
#only connect if already disconnected
new_status = "disconnected"
#verify if need to call event handler
if new_status != "unknown" and new_status != self.current_status:
self.current_status = new_status
self.on_hid_pnp(self.current_status)
#
return True
def _register_hid_notification(self):
"""Register HID notification events on any window (passed by window
handler), returns a notification handler"""
# create structure, self initialized
notify_obj = DevBroadcastDevInterface()
h_notify = RegisterDeviceNotification(self.__hid_hwnd,
ctypes.byref(notify_obj), DEVICE_NOTIFY_WINDOW_HANDLE)
#
return int(h_notify)
def _unregister_hid_notification(self):
"Remove PnP notification handler"
if not int(self.__h_notify):
return #invalid
result = UnregisterDeviceNotification(self.__h_notify)
self.__h_notify = None
return int(result)
def on_hid_pnp(self, new_status):
"'Virtual' like function to refresh update for connection status"
print("HID:", new_status)
return True
| {
"content_hash": "f329c78000f3e160e5368fc66eb02a17",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 80,
"avg_line_length": 38.790849673202615,
"alnum_prop": 0.630497051390059,
"repo_name": "rene-aguirre/pywinusb",
"id": "89bb45017d11c7f97046621c2bedc9eeb935b98c",
"size": "5960",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pywinusb/hid/hid_pnp_mixin.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Python",
"bytes": "149947"
}
],
"symlink_target": ""
} |
import os
from nose.plugins.attrib import attr
from indra.sources import reach
from indra.sources.reach.processor import ReachProcessor
from indra.util import unicode_strs
from indra.statements import IncreaseAmount, DecreaseAmount, \
Dephosphorylation, Complex, Phosphorylation, Translocation
# Change this list to control what modes of
# reading are enabled in tests
offline_modes = [True]
def test_parse_site_text():
text = ['threonine 185', 'thr 185', 'thr-185',
'threonine residue 185', 'T185']
assert unicode_strs(text)
for t in text:
sites = ReachProcessor._parse_site_text(t)
assert len(sites) == 1
residue, site = sites[0]
assert residue == 'T'
assert site == '185'
assert unicode_strs((residue, site))
def test_parse_site_text_number():
t = '135'
sites = ReachProcessor._parse_site_text(t)
assert len(sites) == 1
residue, site = sites[0]
assert residue is None
assert site == '135'
assert unicode_strs(site)
def test_parse_site_text_number_first():
t = '293T'
sites = ReachProcessor._parse_site_text(t)
assert len(sites) == 1
residue, site = sites[0]
assert residue == 'T'
assert site == '293'
assert unicode_strs((residue, site))
def test_parse_site_text_number_first_space():
t = '293 T'
sites = ReachProcessor._parse_site_text(t)
assert len(sites) == 1
residue, site = sites[0]
assert residue == 'T'
assert site == '293'
assert unicode_strs((residue, site))
def test_parse_site_text_other_aa():
t = 'A431'
sites = ReachProcessor._parse_site_text(t)
assert len(sites) == 1
residue, site = sites[0]
assert residue == 'A'
assert site == '431'
assert unicode_strs((residue, site))
def test_parse_site_residue_only():
text = ['serine residue', 'serine', 'a serine site', 's', 'ser']
assert unicode_strs(text)
for t in text:
sites = ReachProcessor._parse_site_text(t)
assert len(sites) == 1
residue, site = sites[0]
assert unicode_strs((residue, site))
assert residue == 'S'
assert site is None
def test_parse_site_multiple():
sites = ReachProcessor._parse_site_text('638/641')
assert len(sites) == 2
assert sites[0][0] is None
assert sites[0][1] == '638'
assert sites[1][0] is None
assert sites[1][1] == '641'
sites = ReachProcessor._parse_site_text('992,1068')
assert len(sites) == 2
assert sites[0][0] is None
assert sites[0][1] == '992'
assert sites[1][0] is None
assert sites[1][1] == '1068'
sites = ReachProcessor._parse_site_text('Y1221/1222')
assert len(sites) == 2
assert sites[0][0] == 'Y'
assert sites[0][1] == '1221'
assert sites[1][0] == 'Y'
assert sites[1][1] == '1222'
sites = ReachProcessor._parse_site_text('Tyr-577/576')
assert len(sites) == 2
assert sites[0][0] == 'Y'
assert sites[0][1] == '577'
assert sites[1][0] == 'Y'
assert sites[1][1] == '576'
sites = ReachProcessor._parse_site_text('S199/S202/T205')
assert len(sites) == 3
assert sites[0][0] == 'S'
assert sites[0][1] == '199'
assert sites[1][0] == 'S'
assert sites[1][1] == '202'
assert sites[2][0] == 'T'
assert sites[2][1] == '205'
sites = ReachProcessor._parse_site_text('S199/202/T205')
assert len(sites) == 3
assert sites[0][0] == 'S'
assert sites[0][1] == '199'
assert sites[1][0] is None
assert sites[1][1] == '202'
assert sites[2][0] == 'T'
assert sites[2][1] == '205'
sites = ReachProcessor._parse_site_text('S199/202/205')
assert len(sites) == 3
assert sites[0][0] == 'S'
assert sites[0][1] == '199'
assert sites[1][0] == 'S'
assert sites[1][1] == '202'
assert sites[2][0] == 'S'
assert sites[2][1] == '205'
def test_phosphorylate():
for offline in offline_modes:
rp = reach.process_text('MEK1 phosphorylates ERK2.', offline=offline)
assert rp is not None
assert len(rp.statements) == 1
s = rp.statements[0]
assert (s.enz.name == 'MAP2K1')
assert (s.sub.name == 'MAPK1')
assert unicode_strs(rp.statements)
def test_indirect_phosphorylate():
txt = 'DUSP decreases the phosphorylation of ERK.'
for offline in offline_modes:
rp = reach.process_text(txt, offline=offline)
assert rp is not None
assert len(rp.statements) == 1
s = rp.statements[0]
assert isinstance(s, Dephosphorylation)
assert s.enz.name == 'DUSP'
assert s.sub.name == 'ERK'
assert s.evidence[0].epistemics.get('direct') is False
def test_regulate_amount():
for offline in offline_modes:
rp = reach.process_text('ERK increases the transcription of DUSP.',
offline=offline)
assert rp is not None
assert len(rp.statements) == 1
s = rp.statements[0]
assert isinstance(s, IncreaseAmount)
assert (s.subj.name == 'ERK')
assert (s.obj.name == 'DUSP')
assert unicode_strs(rp.statements)
rp = reach.process_text('ERK decreases the amount of DUSP.',
offline=offline)
assert len(rp.statements) == 1
s = rp.statements[0]
assert isinstance(s, DecreaseAmount)
assert (s.subj.name == 'ERK')
assert (s.obj.name == 'DUSP')
assert unicode_strs(rp.statements)
def test_multiple_enzymes():
for offline in offline_modes:
rp = reach.process_text('MEK1 and MEK2 phosphorylate ERK1.',
offline=offline)
assert rp is not None
assert len(rp.statements) == 2
stmts = sorted(rp.statements, key=lambda x: x.enz.name)
assert stmts[0].enz.name == 'MAP2K1', stmts
assert stmts[1].enz.name == 'MAP2K2', stmts
assert stmts[0].sub.name == 'MAPK3', stmts
assert stmts[1].sub.name == 'MAPK3', stmts
def test_activate():
for offline in offline_modes:
rp = reach.process_text('HRAS activates BRAF.', offline=offline)
assert rp is not None
assert len(rp.statements) == 1
s = rp.statements[0]
assert (s.subj.name == 'HRAS')
assert (s.obj.name == 'BRAF')
assert unicode_strs(rp.statements)
def test_reg_amount_complex_controller():
txt = 'The FOS-JUN complex increases the amount of ZEB2.'
for offline in offline_modes:
rp = reach.process_text(txt, offline=offline)
assert rp is not None
assert len(rp.statements) == 2
cplx = [s for s in rp.statements if isinstance(s, Complex)][0]
regam = [s for s in rp.statements if isinstance(s, IncreaseAmount)][0]
assert {a.name for a in cplx.members} < {'FOS_family',
# Old version: JUN, new:
# JUN_family
'JUN_family', 'JUN'}, cplx
assert len(regam.subj.bound_conditions) == 1
assert unicode_strs(rp.statements)
def test_bind():
for offline in offline_modes:
rp = reach.process_text('MEK1 binds ERK2.', offline=offline)
assert rp is not None
assert len(rp.statements) == 1
assert unicode_strs(rp.statements)
def test_fplx_grounding():
for offline in offline_modes:
rp = reach.process_text('MEK activates ERK.', offline=offline)
assert rp is not None
assert len(rp.statements) == 1
assert unicode_strs(rp.statements)
if offline is True:
st = rp.statements[0]
assert st.subj.db_refs.get('FPLX') == 'MEK'
assert st.obj.db_refs.get('FPLX') == 'ERK'
def test_conversions():
here = os.path.dirname(os.path.abspath(__file__))
test_file = os.path.join(here, 'reach_conversion.json')
rp = reach.process_json_file(test_file)
assert rp is not None
assert len(rp.statements) == 1
stmt = rp.statements[0]
assert stmt.subj.name == 'ACE'
assert len(stmt.obj_from) == 1
assert stmt.obj_from[0].name == 'angiotensin-I'
assert stmt.obj_to[0].name == 'angiotensin-II'
def test_activity():
for offline in offline_modes:
rp = reach.process_text('MEK1 activates ERK2.', offline=offline)
assert rp is not None
assert len(rp.statements) == 1
assert unicode_strs(rp.statements)
def test_mutation():
for offline in offline_modes:
rp = reach.process_text('BRAF(V600E) phosphorylates MEK.',
offline=offline)
assert rp is not None
assert len(rp.statements) == 1
braf = rp.statements[0].enz
assert braf.name == 'BRAF'
assert len(braf.mutations) == 1
assert braf.mutations[0].position == '600'
assert braf.mutations[0].residue_from == 'V'
assert braf.mutations[0].residue_to == 'E'
assert unicode_strs(rp.statements)
def test_parse_mutation():
mut = ReachProcessor._parse_mutation('V600E')
assert mut.residue_from == 'V'
assert mut.position == '600'
assert mut.residue_to == 'E'
mut = ReachProcessor._parse_mutation('Leu174Arg')
assert mut.residue_from == 'L'
assert mut.position == '174'
assert mut.residue_to == 'R'
mut = ReachProcessor._parse_mutation('val34leu')
assert mut.residue_from == 'V'
assert mut.position == '34'
assert mut.residue_to == 'L'
def test_process_unicode():
for offline in offline_modes:
rp = reach.process_text('MEK1 binds ERK2\U0001F4A9.', offline=offline)
assert rp is not None
assert unicode_strs(rp.statements)
@attr('slow')
def test_process_pmc():
for offline in offline_modes:
rp = reach.process_pmc('PMC4338247', offline=offline)
assert rp is not None
for stmt in rp.statements:
assert_pmid(stmt)
assert unicode_strs(rp.statements)
def test_process_unicode_abstract():
for offline in offline_modes:
rp = reach.process_pubmed_abstract('27749056', offline=offline)
assert rp is not None
assert unicode_strs(rp.statements)
def test_hgnc_from_up():
for offline in offline_modes:
rp = reach.process_text('MEK1 phosphorylates ERK2.',
offline=offline)
assert rp is not None
assert len(rp.statements) == 1
st = rp.statements[0]
(map2k1, mapk1) = st.agent_list()
assert map2k1.name == 'MAP2K1'
assert map2k1.db_refs['HGNC'] == '6840'
assert map2k1.db_refs['UP'] == 'Q02750'
assert mapk1.name == 'MAPK1'
assert mapk1.db_refs['HGNC'] == '6871'
assert mapk1.db_refs['UP'] == 'P28482'
assert unicode_strs(rp.statements)
def assert_pmid(stmt):
for ev in stmt.evidence:
assert ev.pmid is not None
assert not ev.pmid.startswith('api')
assert not ev.pmid.startswith('PMID')
def test_process_mod_condition1():
test_cases = [
('phosphorylated MEK1 activates ERK1.',
'phosphorylation', None, None, True),
('MEK1 that is phosphorylated on serine activates ERK1.',
'phosphorylation', 'S', None, True),
('MEK1 that is phosphorylated on S222 activates ERK1.',
'phosphorylation', 'S', '222', True),
]
for offline in offline_modes:
for sentence, mod_type, residue, position, is_modified in test_cases:
rp = reach.process_text(sentence, offline=offline)
assert rp is not None
assert len(rp.statements) == 1
mcs = rp.statements[0].subj.mods
assert len(mcs) == 1, 'No mods for %s' % sentence
assert mcs[0].mod_type == mod_type, mcs
assert mcs[0].residue == residue, mcs
assert mcs[0].position == position, mcs
assert mcs[0].is_modified == is_modified, mcs
def test_get_db_refs_up_human():
entity_term = {
'text': 'Ikaros',
'xrefs': [{'namespace': 'uniprot', 'id': 'Q13422',
'object-type': 'db-reference'}]
}
db_refs = ReachProcessor._get_db_refs(entity_term)
assert db_refs == {'UP': 'Q13422', 'HGNC': '13176',
'TEXT': 'Ikaros', 'EGID': '10320'}, db_refs
def test_get_db_refs_up_non_human():
entity_term = {
'text': 'MYC',
'xrefs': [{'namespace': 'uniprot', 'id': 'Q9MZT7',
'object-type': 'db-reference'}]
}
db_refs = ReachProcessor._get_db_refs(entity_term)
assert db_refs == {'UP': 'Q9MZT7', 'TEXT': 'MYC'}, db_refs
def test_get_agent_coordinates_phosphorylation():
test_case = ('This sentence is filler. '
'Two filler sentences will work. '
'MEK that is phosphorylated phosphorylates ERK.')
for offline in offline_modes:
rp = reach.process_text(test_case, offline=offline)
assert rp is not None
stmt = rp.statements[0]
annotations = stmt.evidence[0].annotations
coords = [(0, 3), (42, 45)]
assert annotations['agents']['coords'] == coords
def test_get_agent_coordinates_activation():
test_case = 'MEK1 activates ERK2'
for offline in offline_modes:
rp = reach.process_text(test_case, offline=offline)
assert rp is not None
stmt = rp.statements[0]
annotations = stmt.evidence[0].annotations
coords = [(0, 4), (15, 19)]
assert annotations['agents']['coords'] == coords
def test_get_agent_coordinates_regulate_amount():
test_case = 'ERK increases the transcription of DUSP'
for offline in offline_modes:
rp = reach.process_text(test_case, offline=offline)
assert rp is not None
stmt = rp.statements[0]
annotations = stmt.evidence[0].annotations
coords = [(0, 3), (35, 39)]
assert annotations['agents']['coords'] == coords
def test_get_agent_coordinates_binding():
test_case = 'Everyone has observed that MEK1 binds ERK2'
for offline in offline_modes:
rp = reach.process_text(test_case, offline=offline)
assert rp is not None
stmt = rp.statements[0]
annotations = stmt.evidence[0].annotations
coords = [(27, 31), (38, 42)]
assert annotations['agents']['coords'] == coords
def test_get_agent_coordinates_translocation():
test_case = ('The length of time that ERK phosphorylation '
'is sustained may determine whether active ERK '
'translocates to the nucleus promotes cell growth.')
for offline in offline_modes:
rp = reach.process_text(test_case, offline=offline)
assert rp is not None
stmt = [stmt for stmt in rp.statements if
isinstance(stmt, Translocation)][0]
annotations = stmt.evidence[0].annotations
coords = [(86, 89)]
assert annotations['agents']['coords'] == coords
def test_get_agent_coordinates_phosphorylation_missing_controller():
test_case = ('The ability of uPA and PAI-1 complex to induce '
'sustained ERK phosphorylation in MCF-7 cells '
'requires the recruitment of uPAR and VLDLr, which '
'function cooperatively')
for offline in offline_modes:
rp = reach.process_text(test_case, offline=offline)
assert rp is not None
phos_stmts = [stmt for stmt in rp.statements if
isinstance(stmt, Phosphorylation)]
assert phos_stmts, rp.statements
stmt = phos_stmts[0]
annotations = stmt.evidence[0].annotations
coords = [None, (57, 60)]
assert annotations['agents']['coords'] == coords
def test_amount_embedded_in_activation():
here = os.path.dirname(os.path.abspath(__file__))
test_file = os.path.join(here, 'reach_act_amt.json')
rp = reach.process_json_file(test_file)
assert rp is not None
assert len(rp.statements) == 1
assert isinstance(rp.statements[0], IncreaseAmount)
assert rp.statements[0].subj is not None
assert rp.statements[0].obj is not None
def test_phosphorylation_regulation():
here = os.path.dirname(os.path.abspath(__file__))
test_file = os.path.join(here, 'reach_reg_phos.json')
rp = reach.process_json_file(test_file)
assert rp is not None
assert len(rp.statements) == 1
stmt = rp.statements[0]
assert isinstance(stmt, Phosphorylation), stmt
assert not stmt.sub.mods
def test_organism_prioritization():
here = os.path.dirname(os.path.abspath(__file__))
test_file = os.path.join(here, 'reach_reg_phos.json')
def process(organism_priority, expected_up_id):
rp = reach.process_json_file(test_file,
organism_priority=organism_priority)
assert rp.statements[0].enz.db_refs['UP'] == expected_up_id, \
rp.statements[0].enz.db_refs['UP']
# These should all default to the Human protein being prioritized
process(None, 'P05019')
process(['9606'], 'P05019')
# Here we prioritize xenopus
process(['8355'], 'P16501')
# We now use a list of priorities
process(['8355', '9606'], 'P16501')
process(['9606', '8355'], 'P05019')
# Here Arctic fox amdovirus (1513314) is not an available organism
# in the list of groundings so we expect prioritization to fall back
# correctly to the first match or another organism in the list
process(['1513314'], 'P05019')
process(['1513314', '9606'], 'P05019')
process(['1513314', '8355'], 'P16501')
def test_organism_prioritization_uppro():
here = os.path.dirname(os.path.abspath(__file__))
test_file = os.path.join(here, 'reach_uppro_organisms.json')
def process(organism_priority, expected_up_id):
rp = reach.process_json_file(test_file,
organism_priority=organism_priority)
assert rp.statements[0].subj.db_refs['UPPRO'] == expected_up_id, \
rp.statements[0].subj.db_refs['UPPRO']
# This is the human protein chain
process(None, 'PRO_0000006688')
process(['9606'], 'PRO_0000006688')
process(['9606', '161274'], 'PRO_0000006688')
# Let's try the giant fire-bellied toad next
process(['161274'], 'PRO_0000003427')
process(['161274', '9606'], 'PRO_0000003427')
# Now someting non-existent in the groundings to test correct
# fallback behavior
process(['1513314'], 'PRO_0000006688')
process(['1513314', '9606'], 'PRO_0000006688')
process(['1513314', '161274'], 'PRO_0000003427')
| {
"content_hash": "630fdcd669ced88b6414391fb146cbf1",
"timestamp": "",
"source": "github",
"line_count": 532,
"max_line_length": 78,
"avg_line_length": 35.05263157894737,
"alnum_prop": 0.6063384813384813,
"repo_name": "bgyori/indra",
"id": "05e6d3f8b0788e5283bf470195c478e09615a54f",
"size": "18648",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "indra/tests/test_reach.py",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "CSS",
"bytes": "169"
},
{
"name": "Dockerfile",
"bytes": "1710"
},
{
"name": "HTML",
"bytes": "28917"
},
{
"name": "JavaScript",
"bytes": "13276"
},
{
"name": "Python",
"bytes": "3519860"
}
],
"symlink_target": ""
} |
from __future__ import division
import numpy as np
import warnings
from warnings import warn
from sklearn.utils.fixes import euler_gamma
from scipy.sparse import issparse
import numbers
from ..externals import six
from ..tree import ExtraTreeRegressor
from ..utils import check_random_state, check_array
from ..utils.validation import check_is_fitted
from ..base import OutlierMixin
from .bagging import BaseBagging
__all__ = ["IsolationForest"]
INTEGER_TYPES = (numbers.Integral, np.integer)
class IsolationForest(BaseBagging, OutlierMixin):
"""Isolation Forest Algorithm
Return the anomaly score of each sample using the IsolationForest algorithm
The IsolationForest 'isolates' observations by randomly selecting a feature
and then randomly selecting a split value between the maximum and minimum
values of the selected feature.
Since recursive partitioning can be represented by a tree structure, the
number of splittings required to isolate a sample is equivalent to the path
length from the root node to the terminating node.
This path length, averaged over a forest of such random trees, is a
measure of normality and our decision function.
Random partitioning produces noticeably shorter paths for anomalies.
Hence, when a forest of random trees collectively produce shorter path
lengths for particular samples, they are highly likely to be anomalies.
Read more in the :ref:`User Guide <isolation_forest>`.
.. versionadded:: 0.18
Parameters
----------
n_estimators : int, optional (default=100)
The number of base estimators in the ensemble.
max_samples : int or float, optional (default="auto")
The number of samples to draw from X to train each base estimator.
- If int, then draw `max_samples` samples.
- If float, then draw `max_samples * X.shape[0]` samples.
- If "auto", then `max_samples=min(256, n_samples)`.
If max_samples is larger than the number of samples provided,
all samples will be used for all trees (no sampling).
contamination : float in (0., 0.5), optional (default=0.1)
The amount of contamination of the data set, i.e. the proportion
of outliers in the data set. Used when fitting to define the threshold
on the decision function. If 'auto', the decision function threshold is
determined as in the original paper.
.. versionchanged:: 0.20
The default value of ``contamination`` will change from 0.1 in 0.20
to ``'auto'`` in 0.22.
max_features : int or float, optional (default=1.0)
The number of features to draw from X to train each base estimator.
- If int, then draw `max_features` features.
- If float, then draw `max_features * X.shape[1]` features.
bootstrap : boolean, optional (default=False)
If True, individual trees are fit on random subsets of the training
data sampled with replacement. If False, sampling without replacement
is performed.
n_jobs : int or None, optional (default=None)
The number of jobs to run in parallel for both `fit` and `predict`.
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
``-1`` means using all processors. See :term:`Glossary <n_jobs>`
for more details.
behaviour : str, default='old'
Behaviour of the ``decision_function`` which can be either 'old' or
'new'. Passing ``behaviour='new'`` makes the ``decision_function``
change to match other anomaly detection algorithm API which will be
the default behaviour in the future. As explained in details in the
``offset_`` attribute documentation, the ``decision_function`` becomes
dependent on the contamination parameter, in such a way that 0 becomes
its natural threshold to detect outliers.
.. versionadded:: 0.20
``behaviour`` is added in 0.20 for back-compatibility purpose.
.. deprecated:: 0.20
``behaviour='old'`` is deprecated in 0.20 and will not be possible
in 0.22.
.. deprecated:: 0.22
``behaviour`` parameter will be deprecated in 0.22 and removed in
0.24.
random_state : int, RandomState instance or None, optional (default=None)
If int, random_state is the seed used by the random number generator;
If RandomState instance, random_state is the random number generator;
If None, the random number generator is the RandomState instance used
by `np.random`.
verbose : int, optional (default=0)
Controls the verbosity of the tree building process.
Attributes
----------
estimators_ : list of DecisionTreeClassifier
The collection of fitted sub-estimators.
estimators_samples_ : list of arrays
The subset of drawn samples (i.e., the in-bag samples) for each base
estimator.
max_samples_ : integer
The actual number of samples
offset_ : float
Offset used to define the decision function from the raw scores.
We have the relation: ``decision_function = score_samples - offset_``.
Assuming behaviour == 'new', ``offset_`` is defined as follows.
When the contamination parameter is set to "auto", the offset is equal
to -0.5 as the scores of inliers are close to 0 and the scores of
outliers are close to -1. When a contamination parameter different
than "auto" is provided, the offset is defined in such a way we obtain
the expected number of outliers (samples with decision function < 0)
in training.
Assuming the behaviour parameter is set to 'old', we always have
``offset_ = -0.5``, making the decision function independent from the
contamination parameter.
References
----------
.. [1] Liu, Fei Tony, Ting, Kai Ming and Zhou, Zhi-Hua. "Isolation forest."
Data Mining, 2008. ICDM'08. Eighth IEEE International Conference on.
.. [2] Liu, Fei Tony, Ting, Kai Ming and Zhou, Zhi-Hua. "Isolation-based
anomaly detection." ACM Transactions on Knowledge Discovery from
Data (TKDD) 6.1 (2012): 3.
"""
def __init__(self,
n_estimators=100,
max_samples="auto",
contamination="legacy",
max_features=1.,
bootstrap=False,
n_jobs=None,
behaviour='old',
random_state=None,
verbose=0):
super(IsolationForest, self).__init__(
base_estimator=ExtraTreeRegressor(
max_features=1,
splitter='random',
random_state=random_state),
# here above max_features has no links with self.max_features
bootstrap=bootstrap,
bootstrap_features=False,
n_estimators=n_estimators,
max_samples=max_samples,
max_features=max_features,
n_jobs=n_jobs,
random_state=random_state,
verbose=verbose)
self.behaviour = behaviour
self.contamination = contamination
def _set_oob_score(self, X, y):
raise NotImplementedError("OOB score not supported by iforest")
def fit(self, X, y=None, sample_weight=None):
"""Fit estimator.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Use ``dtype=np.float32`` for maximum
efficiency. Sparse matrices are also supported, use sparse
``csc_matrix`` for maximum efficiency.
sample_weight : array-like, shape = [n_samples] or None
Sample weights. If None, then samples are equally weighted.
y : Ignored
not used, present for API consistency by convention.
Returns
-------
self : object
"""
if self.contamination == "legacy":
warnings.warn('default contamination parameter 0.1 will change '
'in version 0.22 to "auto". This will change the '
'predict method behavior.',
FutureWarning)
self._contamination = 0.1
else:
self._contamination = self.contamination
if self.behaviour == 'old':
warnings.warn('behaviour="old" is deprecated and will be removed '
'in version 0.22. Please use behaviour="new", which '
'makes the decision_function change to match '
'other anomaly detection algorithm API.',
FutureWarning)
X = check_array(X, accept_sparse=['csc'])
if issparse(X):
# Pre-sort indices to avoid that each individual tree of the
# ensemble sorts the indices.
X.sort_indices()
rnd = check_random_state(self.random_state)
y = rnd.uniform(size=X.shape[0])
# ensure that max_sample is in [1, n_samples]:
n_samples = X.shape[0]
if isinstance(self.max_samples, six.string_types):
if self.max_samples == 'auto':
max_samples = min(256, n_samples)
else:
raise ValueError('max_samples (%s) is not supported.'
'Valid choices are: "auto", int or'
'float' % self.max_samples)
elif isinstance(self.max_samples, INTEGER_TYPES):
if self.max_samples > n_samples:
warn("max_samples (%s) is greater than the "
"total number of samples (%s). max_samples "
"will be set to n_samples for estimation."
% (self.max_samples, n_samples))
max_samples = n_samples
else:
max_samples = self.max_samples
else: # float
if not (0. < self.max_samples <= 1.):
raise ValueError("max_samples must be in (0, 1], got %r"
% self.max_samples)
max_samples = int(self.max_samples * X.shape[0])
self.max_samples_ = max_samples
max_depth = int(np.ceil(np.log2(max(max_samples, 2))))
super(IsolationForest, self)._fit(X, y, max_samples,
max_depth=max_depth,
sample_weight=sample_weight)
if self.behaviour == 'old':
# in this case, decision_function = 0.5 + self.score_samples(X):
if self._contamination == "auto":
raise ValueError("contamination parameter cannot be set to "
"'auto' when behaviour == 'old'.")
self.offset_ = -0.5
self._threshold_ = np.percentile(self.decision_function(X),
100. * self._contamination)
return self
# else, self.behaviour == 'new':
if self._contamination == "auto":
# 0.5 plays a special role as described in the original paper.
# we take the opposite as we consider the opposite of their score.
self.offset_ = -0.5
return self
# else, define offset_ wrt contamination parameter, so that the
# threshold_ attribute is implicitly 0 and is not needed anymore:
self.offset_ = np.percentile(self.score_samples(X),
100. * self._contamination)
return self
def predict(self, X):
"""Predict if a particular sample is an outlier or not.
Parameters
----------
X : array-like or sparse matrix, shape (n_samples, n_features)
The input samples. Internally, it will be converted to
``dtype=np.float32`` and if a sparse matrix is provided
to a sparse ``csr_matrix``.
Returns
-------
is_inlier : array, shape (n_samples,)
For each observation, tells whether or not (+1 or -1) it should
be considered as an inlier according to the fitted model.
"""
check_is_fitted(self, ["offset_"])
X = check_array(X, accept_sparse='csr')
is_inlier = np.ones(X.shape[0], dtype=int)
threshold = self.threshold_ if self.behaviour == 'old' else 0
is_inlier[self.decision_function(X) < threshold] = -1
return is_inlier
def decision_function(self, X):
"""Average anomaly score of X of the base classifiers.
The anomaly score of an input sample is computed as
the mean anomaly score of the trees in the forest.
The measure of normality of an observation given a tree is the depth
of the leaf containing this observation, which is equivalent to
the number of splittings required to isolate this point. In case of
several observations n_left in the leaf, the average path length of
a n_left samples isolation tree is added.
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
The training input samples. Sparse matrices are accepted only if
they are supported by the base estimator.
Returns
-------
scores : array, shape (n_samples,)
The anomaly score of the input samples.
The lower, the more abnormal. Negative scores represent outliers,
positive scores represent inliers.
"""
# We subtract self.offset_ to make 0 be the threshold value for being
# an outlier:
return self.score_samples(X) - self.offset_
def score_samples(self, X):
"""Opposite of the anomaly score defined in the original paper.
The anomaly score of an input sample is computed as
the mean anomaly score of the trees in the forest.
The measure of normality of an observation given a tree is the depth
of the leaf containing this observation, which is equivalent to
the number of splittings required to isolate this point. In case of
several observations n_left in the leaf, the average path length of
a n_left samples isolation tree is added.
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
The training input samples. Sparse matrices are accepted only if
they are supported by the base estimator.
Returns
-------
scores : array, shape (n_samples,)
The anomaly score of the input samples.
The lower, the more abnormal.
"""
# code structure from ForestClassifier/predict_proba
check_is_fitted(self, ["estimators_"])
# Check data
X = check_array(X, accept_sparse='csr')
if self.n_features_ != X.shape[1]:
raise ValueError("Number of features of the model must "
"match the input. Model n_features is {0} and "
"input n_features is {1}."
"".format(self.n_features_, X.shape[1]))
n_samples = X.shape[0]
n_samples_leaf = np.zeros((n_samples, self.n_estimators), order="f")
depths = np.zeros((n_samples, self.n_estimators), order="f")
if self._max_features == X.shape[1]:
subsample_features = False
else:
subsample_features = True
for i, (tree, features) in enumerate(zip(self.estimators_,
self.estimators_features_)):
if subsample_features:
X_subset = X[:, features]
else:
X_subset = X
leaves_index = tree.apply(X_subset)
node_indicator = tree.decision_path(X_subset)
n_samples_leaf[:, i] = tree.tree_.n_node_samples[leaves_index]
depths[:, i] = np.ravel(node_indicator.sum(axis=1))
depths[:, i] -= 1
depths += _average_path_length(n_samples_leaf)
scores = 2 ** (-depths.mean(axis=1) / _average_path_length(
self.max_samples_))
# Take the opposite of the scores as bigger is better (here less
# abnormal)
return -scores
@property
def threshold_(self):
if self.behaviour != 'old':
raise AttributeError("threshold_ attribute does not exist when "
"behaviour != 'old'")
warnings.warn("threshold_ attribute is deprecated in 0.20 and will"
" be removed in 0.22.", DeprecationWarning)
return self._threshold_
def _average_path_length(n_samples_leaf):
""" The average path length in a n_samples iTree, which is equal to
the average path length of an unsuccessful BST search since the
latter has the same structure as an isolation tree.
Parameters
----------
n_samples_leaf : array-like, shape (n_samples, n_estimators), or int.
The number of training samples in each test sample leaf, for
each estimators.
Returns
-------
average_path_length : array, same shape as n_samples_leaf
"""
if isinstance(n_samples_leaf, INTEGER_TYPES):
if n_samples_leaf <= 1:
return 1.
else:
return 2. * (np.log(n_samples_leaf - 1.) + euler_gamma) - 2. * (
n_samples_leaf - 1.) / n_samples_leaf
else:
n_samples_leaf_shape = n_samples_leaf.shape
n_samples_leaf = n_samples_leaf.reshape((1, -1))
average_path_length = np.zeros(n_samples_leaf.shape)
mask = (n_samples_leaf <= 1)
not_mask = np.logical_not(mask)
average_path_length[mask] = 1.
average_path_length[not_mask] = 2. * (
np.log(n_samples_leaf[not_mask] - 1.) + euler_gamma) - 2. * (
n_samples_leaf[not_mask] - 1.) / n_samples_leaf[not_mask]
return average_path_length.reshape(n_samples_leaf_shape)
| {
"content_hash": "2c137e82d9d346007cfe6fd718f2abc0",
"timestamp": "",
"source": "github",
"line_count": 454,
"max_line_length": 79,
"avg_line_length": 40.05726872246696,
"alnum_prop": 0.5961728802375453,
"repo_name": "vortex-ape/scikit-learn",
"id": "72d1d206f478bac24f1fe13910951ced6a210905",
"size": "18343",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "sklearn/ensemble/iforest.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "3366"
},
{
"name": "C",
"bytes": "394787"
},
{
"name": "C++",
"bytes": "140225"
},
{
"name": "Makefile",
"bytes": "1588"
},
{
"name": "PowerShell",
"bytes": "17312"
},
{
"name": "Python",
"bytes": "6351428"
},
{
"name": "Shell",
"bytes": "8687"
}
],
"symlink_target": ""
} |
"""Support for stiebel_eltron climate platform."""
import logging
from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
STATE_AUTO, STATE_ECO, STATE_MANUAL, SUPPORT_OPERATION_MODE,
SUPPORT_TARGET_TEMPERATURE)
from homeassistant.const import (
ATTR_TEMPERATURE, STATE_OFF, STATE_ON, TEMP_CELSIUS)
from . import DOMAIN as STE_DOMAIN
DEPENDENCIES = ['stiebel_eltron']
_LOGGER = logging.getLogger(__name__)
SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_OPERATION_MODE
OPERATION_MODES = [STATE_AUTO, STATE_MANUAL, STATE_ECO, STATE_OFF]
# Mapping STIEBEL ELTRON states to homeassistant states.
STE_TO_HA_STATE = {'AUTOMATIC': STATE_AUTO,
'MANUAL MODE': STATE_MANUAL,
'STANDBY': STATE_ECO,
'DAY MODE': STATE_ON,
'SETBACK MODE': STATE_ON,
'DHW': STATE_OFF,
'EMERGENCY OPERATION': STATE_ON}
# Mapping homeassistant states to STIEBEL ELTRON states.
HA_TO_STE_STATE = {value: key for key, value in STE_TO_HA_STATE.items()}
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the StiebelEltron platform."""
name = hass.data[STE_DOMAIN]['name']
ste_data = hass.data[STE_DOMAIN]['ste_data']
add_entities([StiebelEltron(name, ste_data)], True)
class StiebelEltron(ClimateDevice):
"""Representation of a STIEBEL ELTRON heat pump."""
def __init__(self, name, ste_data):
"""Initialize the unit."""
self._name = name
self._target_temperature = None
self._current_temperature = None
self._current_humidity = None
self._operation_modes = OPERATION_MODES
self._current_operation = None
self._filter_alarm = None
self._force_update = False
self._ste_data = ste_data
@property
def supported_features(self):
"""Return the list of supported features."""
return SUPPORT_FLAGS
def update(self):
"""Update unit attributes."""
self._ste_data.update(no_throttle=self._force_update)
self._force_update = False
self._target_temperature = self._ste_data.api.get_target_temp()
self._current_temperature = self._ste_data.api.get_current_temp()
self._current_humidity = self._ste_data.api.get_current_humidity()
self._filter_alarm = self._ste_data.api.get_filter_alarm_status()
self._current_operation = self._ste_data.api.get_operation()
_LOGGER.debug("Update %s, current temp: %s", self._name,
self._current_temperature)
@property
def device_state_attributes(self):
"""Return device specific state attributes."""
return {
'filter_alarm': self._filter_alarm
}
@property
def name(self):
"""Return the name of the climate device."""
return self._name
# Handle SUPPORT_TARGET_TEMPERATURE
@property
def temperature_unit(self):
"""Return the unit of measurement."""
return TEMP_CELSIUS
@property
def current_temperature(self):
"""Return the current temperature."""
return self._current_temperature
@property
def target_temperature(self):
"""Return the temperature we try to reach."""
return self._target_temperature
@property
def target_temperature_step(self):
"""Return the supported step of target temperature."""
return 0.1
@property
def min_temp(self):
"""Return the minimum temperature."""
return 10.0
@property
def max_temp(self):
"""Return the maximum temperature."""
return 30.0
def set_temperature(self, **kwargs):
"""Set new target temperature."""
target_temperature = kwargs.get(ATTR_TEMPERATURE)
if target_temperature is not None:
_LOGGER.debug("set_temperature: %s", target_temperature)
self._ste_data.api.set_target_temp(target_temperature)
self._force_update = True
@property
def current_humidity(self):
"""Return the current humidity."""
return float("{0:.1f}".format(self._current_humidity))
# Handle SUPPORT_OPERATION_MODE
@property
def operation_list(self):
"""List of the operation modes."""
return self._operation_modes
@property
def current_operation(self):
"""Return current operation ie. heat, cool, idle."""
return STE_TO_HA_STATE.get(self._current_operation)
def set_operation_mode(self, operation_mode):
"""Set new operation mode."""
new_mode = HA_TO_STE_STATE.get(operation_mode)
_LOGGER.debug("set_operation_mode: %s -> %s", self._current_operation,
new_mode)
self._ste_data.api.set_operation(new_mode)
self._force_update = True
| {
"content_hash": "6658587ca4fe957e0b40e19f7a9af0e6",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 78,
"avg_line_length": 32.97986577181208,
"alnum_prop": 0.6294261294261294,
"repo_name": "aequitas/home-assistant",
"id": "fc6038d95ad6ca1462d9aba790d5f15132e80986",
"size": "4914",
"binary": false,
"copies": "6",
"ref": "refs/heads/dev",
"path": "homeassistant/components/stiebel_eltron/climate.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1175"
},
{
"name": "Dockerfile",
"bytes": "1081"
},
{
"name": "Python",
"bytes": "15601734"
},
{
"name": "Ruby",
"bytes": "745"
},
{
"name": "Shell",
"bytes": "17609"
}
],
"symlink_target": ""
} |
from PySide import QtCore, QtGui
class Ui_SimulationEditorWidget(object):
def setupUi(self, SimulationEditorWidget):
SimulationEditorWidget.setObjectName("SimulationEditorWidget")
SimulationEditorWidget.resize(400, 300)
self.formLayout = QtGui.QFormLayout(SimulationEditorWidget)
self.formLayout.setObjectName("formLayout")
self.pushButtonVisualise = QtGui.QPushButton(SimulationEditorWidget)
self.pushButtonVisualise.setObjectName("pushButtonVisualise")
self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.pushButtonVisualise)
self.retranslateUi(SimulationEditorWidget)
QtCore.QMetaObject.connectSlotsByName(SimulationEditorWidget)
def retranslateUi(self, SimulationEditorWidget):
SimulationEditorWidget.setWindowTitle(QtGui.QApplication.translate("SimulationEditorWidget", "Simulation Editor", None, QtGui.QApplication.UnicodeUTF8))
self.pushButtonVisualise.setText(QtGui.QApplication.translate("SimulationEditorWidget", "Visualise", None, QtGui.QApplication.UnicodeUTF8))
| {
"content_hash": "a342d952af3052c9fb32bd4e4ecbcf98",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 160,
"avg_line_length": 57.1578947368421,
"alnum_prop": 0.787292817679558,
"repo_name": "alan-wu/neon",
"id": "ef19884796a03b2e5af264f36d1ab03ee79be863",
"size": "1362",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/opencmiss/neon/ui/editors/ui_simulationeditorwidget.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "NSIS",
"bytes": "29534"
},
{
"name": "Python",
"bytes": "1449198"
}
],
"symlink_target": ""
} |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
short_description: NetApp ONTAP Create/Delete portset
author: NetApp Ansible Team (@carchi8py) <[email protected]>
description:
- Create/Delete ONTAP portset, modify ports in a portset.
extends_documentation_fragment:
- netapp.na_ontap
module: na_ontap_portset
options:
state:
description:
- If you want to create a portset.
default: present
vserver:
required: true
description:
- Name of the SVM.
name:
required: true
description:
- Name of the port set to create.
type:
description:
- Required for create.
- Protocols accepted for this portset.
choices: ['fcp', 'iscsi', 'mixed']
force:
description:
- If 'false' or not specified, the request will fail if there are any igroups bound to this portset.
- If 'true', forcibly destroy the portset, even if there are existing igroup bindings.
type: bool
default: False
ports:
description:
- Specify the ports associated with this portset. Should be comma separated.
- It represents the expected state of a list of ports at any time, and replaces the current value of ports.
- Adds a port if it is specified in expected state but not in current state.
- Deletes a port if it is in current state but not in expected state.
version_added: "2.8"
'''
EXAMPLES = """
- name: Create Portset
na_ontap_portset:
state: present
vserver: vserver_name
name: portset_name
ports: a1
type: "{{ protocol type }}"
username: "{{ netapp username }}"
password: "{{ netapp password }}"
hostname: "{{ netapp hostname }}"
- name: Modify ports in portset
na_ontap_portset:
state: present
vserver: vserver_name
name: portset_name
ports: a1,a2
username: "{{ netapp username }}"
password: "{{ netapp password }}"
hostname: "{{ netapp hostname }}"
- name: Delete Portset
na_ontap_portset:
state: absent
vserver: vserver_name
name: portset_name
force: True
type: "{{ protocol type }}"
username: "{{ netapp username }}"
password: "{{ netapp password }}"
hostname: "{{ netapp hostname }}"
"""
RETURN = """
"""
import traceback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._text import to_native
import ansible.module_utils.netapp as netapp_utils
from ansible.module_utils.netapp_module import NetAppModule
HAS_NETAPP_LIB = netapp_utils.has_netapp_lib()
class NetAppONTAPPortset(object):
"""
Methods to create or delete portset
"""
def __init__(self):
self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
self.argument_spec.update(dict(
state=dict(required=False, default='present'),
vserver=dict(required=True, type='str'),
name=dict(required=True, type='str'),
type=dict(required=False, type='str', choices=[
'fcp', 'iscsi', 'mixed']),
force=dict(required=False, type='bool', default=False),
ports=dict(required=False, type='list')
))
self.module = AnsibleModule(
argument_spec=self.argument_spec,
supports_check_mode=True
)
self.na_helper = NetAppModule()
self.parameters = self.na_helper.set_parameters(self.module.params)
if HAS_NETAPP_LIB is False:
self.module.fail_json(
msg="the python NetApp-Lib module is required")
else:
self.server = netapp_utils.setup_na_ontap_zapi(
module=self.module, vserver=self.parameters['vserver'])
def portset_get_iter(self):
"""
Compose NaElement object to query current portset using vserver, portset-name and portset-type parameters
:return: NaElement object for portset-get-iter with query
"""
portset_get = netapp_utils.zapi.NaElement('portset-get-iter')
query = netapp_utils.zapi.NaElement('query')
portset_info = netapp_utils.zapi.NaElement('portset-info')
portset_info.add_new_child('vserver', self.parameters['vserver'])
portset_info.add_new_child('portset-name', self.parameters['name'])
if self.parameters.get('type'):
portset_info.add_new_child('portset-type', self.parameters['type'])
query.add_child_elem(portset_info)
portset_get.add_child_elem(query)
return portset_get
def portset_get(self):
"""
Get current portset info
:return: Dictionary of current portset details if query successful, else return None
"""
portset_get_iter = self.portset_get_iter()
result, portset_info = None, dict()
try:
result = self.server.invoke_successfully(portset_get_iter, enable_tunneling=True)
except netapp_utils.zapi.NaApiError as error:
self.module.fail_json(msg='Error fetching portset %s: %s'
% (self.parameters['name'], to_native(error)),
exception=traceback.format_exc())
# return portset details
if result.get_child_by_name('num-records') and int(result.get_child_content('num-records')) > 0:
portset_get_info = result.get_child_by_name('attributes-list').get_child_by_name('portset-info')
if int(portset_get_info.get_child_content('portset-port-total')) > 0:
ports = portset_get_info.get_child_by_name('portset-port-info')
portset_info['ports'] = [port.get_content() for port in ports.get_children()]
else:
portset_info['ports'] = []
return portset_info
return None
def create_portset(self):
"""
Create a portset
"""
if self.parameters.get('type') is None:
self.module.fail_json(msg='Error: Missing required parameter for create (type)')
portset_info = netapp_utils.zapi.NaElement("portset-create")
portset_info.add_new_child("portset-name", self.parameters['name'])
portset_info.add_new_child("portset-type", self.parameters['type'])
try:
self.server.invoke_successfully(
portset_info, enable_tunneling=True)
except netapp_utils.zapi.NaApiError as error:
self.module.fail_json(msg="Error creating portset %s: %s" %
(self.parameters['name'], to_native(error)),
exception=traceback.format_exc())
def delete_portset(self):
"""
Delete a portset
"""
portset_info = netapp_utils.zapi.NaElement("portset-destroy")
portset_info.add_new_child("portset-name", self.parameters['name'])
if self.parameters.get('force'):
portset_info.add_new_child("force", str(self.parameters['force']))
try:
self.server.invoke_successfully(
portset_info, enable_tunneling=True)
except netapp_utils.zapi.NaApiError as error:
self.module.fail_json(msg="Error deleting portset %s: %s" %
(self.parameters['name'], to_native(error)),
exception=traceback.format_exc())
def remove_ports(self, ports):
"""
Removes all existing ports from portset
:return: None
"""
for port in ports:
self.modify_port(port, 'portset-remove')
def add_ports(self):
"""
Add the list of ports to portset
:return: None
"""
# don't add if ports is empty string
if self.parameters.get('ports') == [''] or self.parameters.get('ports') is None:
return
for port in self.parameters['ports']:
self.modify_port(port, 'portset-add')
def modify_port(self, port, zapi):
"""
Add or remove an port to/from a portset
"""
port.strip() # remove leading spaces if any (eg: if user types a space after comma in initiators list)
options = {'portset-name': self.parameters['name'],
'portset-port-name': port}
portset_modify = netapp_utils.zapi.NaElement.create_node_with_children(zapi, **options)
try:
self.server.invoke_successfully(portset_modify, enable_tunneling=True)
except netapp_utils.zapi.NaApiError as error:
self.module.fail_json(msg='Error modifying port in portset %s: %s' % (self.parameters['name'],
to_native(error)),
exception=traceback.format_exc())
def apply(self):
"""
Applies action from playbook
"""
netapp_utils.ems_log_event("na_ontap_autosupport", self.server)
current, modify = self.portset_get(), None
cd_action = self.na_helper.get_cd_action(current, self.parameters)
if cd_action is None and self.parameters['state'] == 'present':
modify = self.na_helper.get_modified_attributes(current, self.parameters)
if self.na_helper.changed:
if self.module.check_mode:
pass
else:
if cd_action == 'create':
self.create_portset()
elif cd_action == 'delete':
self.delete_portset()
elif modify:
self.remove_ports(current['ports'])
self.add_ports()
self.module.exit_json(changed=self.na_helper.changed)
def main():
"""
Execute action from playbook
"""
portset_obj = NetAppONTAPPortset()
portset_obj.apply()
if __name__ == '__main__':
main()
| {
"content_hash": "1003471d18ddb57328f606c7e786a2a7",
"timestamp": "",
"source": "github",
"line_count": 272,
"max_line_length": 113,
"avg_line_length": 37.13970588235294,
"alnum_prop": 0.5911700653335973,
"repo_name": "SergeyCherepanov/ansible",
"id": "42b35cac27e07bce38feac2fd3f0d78d80ab1c14",
"size": "10244",
"binary": false,
"copies": "12",
"ref": "refs/heads/master",
"path": "ansible/ansible/modules/storage/netapp/na_ontap_portset.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Shell",
"bytes": "824"
}
],
"symlink_target": ""
} |
import logging
import logging.handlers
import os
import six
import subprocess
import sys
import yaml
log = logging.getLogger('fuel_notify')
log_handler = logging.handlers.SysLogHandler(address='/dev/log')
log_handler.setFormatter(logging.Formatter('%(name)s: %(message)s'))
log.addHandler(log_handler)
log.setLevel(logging.INFO)
CONFIG_FILE = '/etc/fuel/free_disk_check.yaml'
STATE_FILE = '/var/run/free_disk_check_state.yaml'
def read_state():
try:
with open(STATE_FILE) as f:
return yaml.load(f)
except IOError:
return {}
def get_credentials():
with open(CONFIG_FILE) as f:
config = yaml.load(f)
if not config:
log.error('Config empty, exiting')
sys.exit(1)
# NOTE(pkaminski): 'monitord' user is for sending notifications only
# We cannot use admin -- in case the end user changes admin's password
# we wouldn't be able to send notifications.
return (
config['monitord_user'],
config['monitord_password'],
config['monitord_tenant']
)
def save_notify_state(mount_point, state):
state_dict = read_state()
state_dict[mount_point] = state
with open(STATE_FILE, 'w') as f:
f.write(yaml.dump(state_dict, default_flow_style=False))
def was_notified(mount_point, state):
"""Checks if user was notified of mount_point being in given state."""
return read_state().get(mount_point, 'SUCCESS') == state
def notify(message, topic=None):
user, password, tenant = get_credentials()
try:
command = [
'fuel', '--user', user, '--password', password, '--tenant', tenant,
'notify', '-m', message
]
if topic:
command.extend(['--topic', topic])
subprocess.Popen(command)
except OSError:
sys.exit(1)
def get_error(state='SUCCESS', mount_point='/'):
s = os.statvfs(mount_point)
# Convert to GB
free_gb = s.f_bavail * s.f_frsize / (1024.0 ** 3)
if state == 'ERROR':
return ('Your disk space on {0} is running low ({1:.2f} GB '
'currently available).').format(mount_point, free_gb)
return ('Your free disk space on {0} is back to normal ({1:.2f} GB '
'currently available).').format(mount_point, free_gb)
if __name__ == '__main__':
if len(sys.argv) != 3 or sys.argv[1] not in ['ERROR', 'SUCCESS']:
six.print_(
'Syntax: {0} [ERROR|SUCCESS] <mount-point>'.format(sys.argv[0])
)
sys.exit(1)
state = sys.argv[1]
mount_point = sys.argv[2]
message = get_error(state=state, mount_point=mount_point)
if state == 'SUCCESS' and not was_notified(mount_point, state):
# Notify about disk space back to normal
log.info('Notifying about SUCCESS state for {0}'.format(mount_point))
notify(message, topic='done')
save_notify_state(mount_point, state)
if state == 'ERROR' and not was_notified(mount_point, state):
# Notify about disk space error
log.info('Notifying about ERROR state for {0}'.format(mount_point))
notify(message, topic='error')
save_notify_state(mount_point, state)
| {
"content_hash": "cde700439199e1811ff8272dbadc7b28",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 79,
"avg_line_length": 29.40740740740741,
"alnum_prop": 0.6205919395465995,
"repo_name": "eayunstack/fuel-library",
"id": "bce01472736f975d78843e186f54be5e20553198",
"size": "3199",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "files/fuel-notify/fuel_notify.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "276977"
},
{
"name": "Pascal",
"bytes": "181"
},
{
"name": "Perl",
"bytes": "41847"
},
{
"name": "Puppet",
"bytes": "1001463"
},
{
"name": "Python",
"bytes": "116031"
},
{
"name": "Ruby",
"bytes": "1782193"
},
{
"name": "Shell",
"bytes": "488992"
}
],
"symlink_target": ""
} |
import copy
import mock
import uuid
from oslo_config import cfg
from st2tests.api import FunctionalTest
from st2common.constants.keyvalue import ALL_SCOPE, FULL_SYSTEM_SCOPE, FULL_USER_SCOPE
from st2common.persistence.auth import User
from st2common.models.db.auth import UserDB
from st2common.rbac.backends.noop import NoOpRBACUtils
from six.moves import http_client
__all__ = [
"KeyValuePairControllerTestCase",
"KeyValuePairControllerBaseTestCase",
"KeyValuePairControllerRBACTestCase",
]
KVP = {"name": "keystone_endpoint", "value": "http://127.0.0.1:5000/v3"}
KVP_2 = {"name": "keystone_version", "value": "v3"}
KVP_2_USER = {"name": "keystone_version", "value": "user_v3", "scope": "st2kv.user"}
KVP_2_USER_LEGACY = {"name": "keystone_version", "value": "user_v3", "scope": "user"}
KVP_3_USER = {
"name": "keystone_endpoint",
"value": "http://127.0.1.1:5000/v3",
"scope": "st2kv.user",
}
KVP_4_USER = {
"name": "customer_ssn",
"value": "123-456-7890",
"secret": True,
"scope": "st2kv.user",
}
KVP_WITH_TTL = {
"name": "keystone_endpoint",
"value": "http://127.0.0.1:5000/v3",
"ttl": 10,
}
SECRET_KVP = {"name": "secret_key1", "value": "secret_value1", "secret": True}
# value = S3cret!Value
# encrypted with st2tests/conf/st2_kvstore_tests.crypto.key.json
ENCRYPTED_KVP = {
"name": "secret_key1",
"value": (
"3030303030298D848B45A24EDCD1A82FAB4E831E3FCE6E60956817A48A180E4C040801E"
"B30170DACF79498F30520236A629912C3584847098D"
),
"encrypted": True,
}
ENCRYPTED_KVP_SECRET_FALSE = {
"name": "secret_key2",
"value": (
"3030303030298D848B45A24EDCD1A82FAB4E831E3FCE6E60956817A48A180E4C040801E"
"B30170DACF79498F30520236A629912C3584847098D"
),
"secret": True,
"encrypted": True,
}
class KeyValuePairControllerBaseTestCase(FunctionalTest):
@staticmethod
def _get_kvp_id(resp):
return resp.json["name"]
def _do_get_one(self, kvp_id, expect_errors=False):
return self.app.get("/v1/keys/%s" % kvp_id, expect_errors=expect_errors)
def _do_put(self, kvp_id, kvp, expect_errors=False):
return self.app.put_json(
"/v1/keys/%s" % kvp_id, kvp, expect_errors=expect_errors
)
def _do_delete(self, kvp_id, expect_errors=False):
return self.app.delete("/v1/keys/%s" % kvp_id, expect_errors=expect_errors)
class KeyValuePairControllerTestCase(KeyValuePairControllerBaseTestCase):
def test_get_all(self):
resp = self.app.get("/v1/keys")
self.assertEqual(resp.status_int, 200)
def test_get_one(self):
put_resp = self._do_put("key1", KVP)
kvp_id = self._get_kvp_id(put_resp)
get_resp = self._do_get_one(kvp_id)
self.assertEqual(get_resp.status_int, 200)
self.assertEqual(self._get_kvp_id(get_resp), kvp_id)
self._do_delete(kvp_id)
def test_get_all_all_scope(self):
# Test which cases various scenarios which ensure non-admin users can't read / view keys
# from other users
user_db_1 = UserDB(name="user1")
user_db_2 = UserDB(name="user2")
user_db_3 = UserDB(name="user3")
# Insert some mock data
# System scoped keys
put_resp = self._do_put(
"system1", {"name": "system1", "value": "val1", "scope": "st2kv.system"}
)
self.assertEqual(put_resp.status_int, 200)
self.assertEqual(put_resp.json["name"], "system1")
self.assertEqual(put_resp.json["scope"], "st2kv.system")
put_resp = self._do_put(
"system2", {"name": "system2", "value": "val2", "scope": "st2kv.system"}
)
self.assertEqual(put_resp.status_int, 200)
self.assertEqual(put_resp.json["name"], "system2")
self.assertEqual(put_resp.json["scope"], "st2kv.system")
# user1 scoped keys
self.use_user(user_db_1)
put_resp = self._do_put(
"user1", {"name": "user1", "value": "user1", "scope": "st2kv.user"}
)
self.assertEqual(put_resp.status_int, 200)
self.assertEqual(put_resp.json["name"], "user1")
self.assertEqual(put_resp.json["scope"], "st2kv.user")
self.assertEqual(put_resp.json["value"], "user1")
put_resp = self._do_put(
"userkey", {"name": "userkey", "value": "user1", "scope": "st2kv.user"}
)
self.assertEqual(put_resp.status_int, 200)
self.assertEqual(put_resp.json["name"], "userkey")
self.assertEqual(put_resp.json["scope"], "st2kv.user")
self.assertEqual(put_resp.json["value"], "user1")
# user2 scoped keys
self.use_user(user_db_2)
put_resp = self._do_put(
"user2", {"name": "user2", "value": "user2", "scope": "st2kv.user"}
)
self.assertEqual(put_resp.status_int, 200)
self.assertEqual(put_resp.json["name"], "user2")
self.assertEqual(put_resp.json["scope"], "st2kv.user")
self.assertEqual(put_resp.json["value"], "user2")
put_resp = self._do_put(
"userkey", {"name": "userkey", "value": "user2", "scope": "st2kv.user"}
)
self.assertEqual(put_resp.status_int, 200)
self.assertEqual(put_resp.json["name"], "userkey")
self.assertEqual(put_resp.json["scope"], "st2kv.user")
self.assertEqual(put_resp.json["value"], "user2")
# user3 scoped keys
self.use_user(user_db_3)
put_resp = self._do_put(
"user3", {"name": "user3", "value": "user3", "scope": "st2kv.user"}
)
self.assertEqual(put_resp.status_int, 200)
self.assertEqual(put_resp.json["name"], "user3")
self.assertEqual(put_resp.json["scope"], "st2kv.user")
self.assertEqual(put_resp.json["value"], "user3")
put_resp = self._do_put(
"userkey", {"name": "userkey", "value": "user3", "scope": "st2kv.user"}
)
self.assertEqual(put_resp.status_int, 200)
self.assertEqual(put_resp.json["name"], "userkey")
self.assertEqual(put_resp.json["scope"], "st2kv.user")
self.assertEqual(put_resp.json["value"], "user3")
# 1. "all" scope as user1 - should only be able to view system + current user items
self.use_user(user_db_1)
resp = self.app.get("/v1/keys?scope=all")
self.assertEqual(len(resp.json), 2 + 2) # 2 system, 2 user
self.assertEqual(resp.json[0]["name"], "system1")
self.assertEqual(resp.json[0]["scope"], "st2kv.system")
self.assertEqual(resp.json[1]["name"], "system2")
self.assertEqual(resp.json[1]["scope"], "st2kv.system")
self.assertEqual(resp.json[2]["name"], "user1")
self.assertEqual(resp.json[2]["scope"], "st2kv.user")
self.assertEqual(resp.json[2]["user"], "user1")
self.assertEqual(resp.json[3]["name"], "userkey")
self.assertEqual(resp.json[3]["scope"], "st2kv.user")
self.assertEqual(resp.json[3]["user"], "user1")
# Verify user can't retrieve values for other users by manipulating "prefix"
resp = self.app.get("/v1/keys?scope=all&prefix=user2:")
self.assertEqual(resp.json, [])
resp = self.app.get("/v1/keys?scope=all&prefix=user")
self.assertEqual(len(resp.json), 2) # 2 user
self.assertEqual(resp.json[0]["name"], "user1")
self.assertEqual(resp.json[0]["scope"], "st2kv.user")
self.assertEqual(resp.json[0]["user"], "user1")
self.assertEqual(resp.json[1]["name"], "userkey")
self.assertEqual(resp.json[1]["scope"], "st2kv.user")
self.assertEqual(resp.json[1]["user"], "user1")
# 2. "all" scope user user2 - should only be able to view system + current user items
self.use_user(user_db_2)
resp = self.app.get("/v1/keys?scope=all")
self.assertEqual(len(resp.json), 2 + 2) # 2 system, 2 user
self.assertEqual(resp.json[0]["name"], "system1")
self.assertEqual(resp.json[0]["scope"], "st2kv.system")
self.assertEqual(resp.json[1]["name"], "system2")
self.assertEqual(resp.json[1]["scope"], "st2kv.system")
self.assertEqual(resp.json[2]["name"], "user2")
self.assertEqual(resp.json[2]["scope"], "st2kv.user")
self.assertEqual(resp.json[2]["user"], "user2")
self.assertEqual(resp.json[3]["name"], "userkey")
self.assertEqual(resp.json[3]["scope"], "st2kv.user")
self.assertEqual(resp.json[3]["user"], "user2")
# Verify user can't retrieve values for other users by manipulating "prefix"
resp = self.app.get("/v1/keys?scope=all&prefix=user1:")
self.assertEqual(resp.json, [])
resp = self.app.get("/v1/keys?scope=all&prefix=user")
self.assertEqual(len(resp.json), 2) # 2 user
self.assertEqual(resp.json[0]["name"], "user2")
self.assertEqual(resp.json[0]["scope"], "st2kv.user")
self.assertEqual(resp.json[0]["user"], "user2")
self.assertEqual(resp.json[1]["name"], "userkey")
self.assertEqual(resp.json[1]["scope"], "st2kv.user")
self.assertEqual(resp.json[1]["user"], "user2")
# Verify non-admon user can't retrieve key for an arbitrary users
resp = self.app.get("/v1/keys?scope=user&user=user1", expect_errors=True)
expected_error = (
'"user" attribute can only be provided by admins when RBAC is enabled'
)
self.assertEqual(resp.status_int, http_client.FORBIDDEN)
self.assertEqual(resp.json["faultstring"], expected_error)
# 3. "all" scope user user3 - should only be able to view system + current user items
self.use_user(user_db_3)
resp = self.app.get("/v1/keys?scope=all")
self.assertEqual(len(resp.json), 2 + 2) # 2 system, 2 user
self.assertEqual(resp.json[0]["name"], "system1")
self.assertEqual(resp.json[0]["scope"], "st2kv.system")
self.assertEqual(resp.json[1]["name"], "system2")
self.assertEqual(resp.json[1]["scope"], "st2kv.system")
self.assertEqual(resp.json[2]["name"], "user3")
self.assertEqual(resp.json[2]["scope"], "st2kv.user")
self.assertEqual(resp.json[2]["user"], "user3")
self.assertEqual(resp.json[3]["name"], "userkey")
self.assertEqual(resp.json[3]["scope"], "st2kv.user")
self.assertEqual(resp.json[3]["user"], "user3")
# Verify user can't retrieve values for other users by manipulating "prefix"
resp = self.app.get("/v1/keys?scope=all&prefix=user1:")
self.assertEqual(resp.json, [])
resp = self.app.get("/v1/keys?scope=all&prefix=user")
self.assertEqual(len(resp.json), 2) # 2 user
self.assertEqual(resp.json[0]["name"], "user3")
self.assertEqual(resp.json[0]["scope"], "st2kv.user")
self.assertEqual(resp.json[0]["user"], "user3")
self.assertEqual(resp.json[1]["name"], "userkey")
self.assertEqual(resp.json[1]["scope"], "st2kv.user")
self.assertEqual(resp.json[1]["user"], "user3")
# Clean up
self._do_delete("system1")
self._do_delete("system2")
self.use_user(user_db_1)
self._do_delete("user1?scope=user")
self._do_delete("userkey?scope=user")
self.use_user(user_db_2)
self._do_delete("user2?scope=user")
self._do_delete("userkey?scope=user")
self.use_user(user_db_3)
self._do_delete("user3?scope=user")
self._do_delete("userkey?scope=user")
def test_get_all_user_query_param_can_only_be_used_with_rbac(self):
resp = self.app.get("/v1/keys?user=foousera", expect_errors=True)
expected_error = (
'"user" attribute can only be provided by admins when RBAC is enabled'
)
self.assertEqual(resp.status_int, http_client.FORBIDDEN)
self.assertEqual(resp.json["faultstring"], expected_error)
def test_get_one_user_query_param_can_only_be_used_with_rbac(self):
resp = self.app.get(
"/v1/keys/keystone_endpoint?user=foousera", expect_errors=True
)
expected_error = (
'"user" attribute can only be provided by admins when RBAC is enabled'
)
self.assertEqual(resp.status_int, http_client.FORBIDDEN)
self.assertEqual(resp.json["faultstring"], expected_error)
def test_get_all_prefix_filtering(self):
put_resp1 = self._do_put(KVP["name"], KVP)
put_resp2 = self._do_put(KVP_2["name"], KVP_2)
self.assertEqual(put_resp1.status_int, 200)
self.assertEqual(put_resp2.status_int, 200)
# No keys with that prefix
resp = self.app.get("/v1/keys?prefix=something")
self.assertEqual(resp.json, [])
# Two keys with the provided prefix
resp = self.app.get("/v1/keys?prefix=keystone")
self.assertEqual(len(resp.json), 2)
# One key with the provided prefix
resp = self.app.get("/v1/keys?prefix=keystone_endpoint")
self.assertEqual(len(resp.json), 1)
self._do_delete(self._get_kvp_id(put_resp1))
self._do_delete(self._get_kvp_id(put_resp2))
def test_get_one_fail(self):
resp = self.app.get("/v1/keys/1", expect_errors=True)
self.assertEqual(resp.status_int, 404)
def test_put(self):
put_resp = self._do_put("key1", KVP)
update_input = put_resp.json
update_input["value"] = "http://127.0.0.1:35357/v3"
put_resp = self._do_put(self._get_kvp_id(put_resp), update_input)
self.assertEqual(put_resp.status_int, 200)
self._do_delete(self._get_kvp_id(put_resp))
def test_put_with_scope(self):
self.app.put_json("/v1/keys/%s" % "keystone_endpoint", KVP, expect_errors=False)
self.app.put_json(
"/v1/keys/%s?scope=st2kv.system" % "keystone_version",
KVP_2,
expect_errors=False,
)
get_resp_1 = self.app.get("/v1/keys/keystone_endpoint")
self.assertTrue(get_resp_1.status_int, 200)
self.assertEqual(self._get_kvp_id(get_resp_1), "keystone_endpoint")
get_resp_2 = self.app.get("/v1/keys/keystone_version?scope=st2kv.system")
self.assertTrue(get_resp_2.status_int, 200)
self.assertEqual(self._get_kvp_id(get_resp_2), "keystone_version")
get_resp_3 = self.app.get("/v1/keys/keystone_version")
self.assertTrue(get_resp_3.status_int, 200)
self.assertEqual(self._get_kvp_id(get_resp_3), "keystone_version")
self.app.delete("/v1/keys/keystone_endpoint?scope=st2kv.system")
self.app.delete("/v1/keys/keystone_version?scope=st2kv.system")
def test_put_user_scope_and_system_scope_dont_overlap(self):
self.app.put_json(
"/v1/keys/%s?scope=st2kv.system" % "keystone_version",
KVP_2,
expect_errors=False,
)
self.app.put_json(
"/v1/keys/%s?scope=st2kv.user" % "keystone_version",
KVP_2_USER,
expect_errors=False,
)
get_resp = self.app.get("/v1/keys/keystone_version?scope=st2kv.system")
self.assertEqual(get_resp.json["value"], KVP_2["value"])
get_resp = self.app.get("/v1/keys/keystone_version?scope=st2kv.user")
self.assertEqual(get_resp.json["value"], KVP_2_USER["value"])
self.app.delete("/v1/keys/keystone_version?scope=st2kv.system")
self.app.delete("/v1/keys/keystone_version?scope=st2kv.user")
def test_put_invalid_scope(self):
put_resp = self.app.put_json(
"/v1/keys/keystone_version?scope=st2", KVP_2, expect_errors=True
)
self.assertTrue(put_resp.status_int, 400)
def test_get_all_with_scope(self):
self.app.put_json(
"/v1/keys/%s?scope=st2kv.system" % "keystone_version",
KVP_2,
expect_errors=False,
)
self.app.put_json(
"/v1/keys/%s?scope=st2kv.user" % "keystone_version",
KVP_2_USER,
expect_errors=False,
)
# Note that the following two calls overwrite st2sytem and st2kv.user scoped variables with
# same name.
self.app.put_json(
"/v1/keys/%s?scope=system" % "keystone_version", KVP_2, expect_errors=False
)
self.app.put_json(
"/v1/keys/%s?scope=user" % "keystone_version",
KVP_2_USER_LEGACY,
expect_errors=False,
)
get_resp_all = self.app.get("/v1/keys?scope=all")
self.assertTrue(len(get_resp_all.json), 2)
get_resp_sys = self.app.get("/v1/keys?scope=st2kv.system")
self.assertTrue(len(get_resp_sys.json), 1)
self.assertEqual(get_resp_sys.json[0]["value"], KVP_2["value"])
get_resp_sys = self.app.get("/v1/keys?scope=system")
self.assertTrue(len(get_resp_sys.json), 1)
self.assertEqual(get_resp_sys.json[0]["value"], KVP_2["value"])
get_resp_sys = self.app.get("/v1/keys?scope=st2kv.user")
self.assertTrue(len(get_resp_sys.json), 1)
self.assertEqual(get_resp_sys.json[0]["value"], KVP_2_USER["value"])
get_resp_sys = self.app.get("/v1/keys?scope=user")
self.assertTrue(len(get_resp_sys.json), 1)
self.assertEqual(get_resp_sys.json[0]["value"], KVP_2_USER["value"])
self.app.delete("/v1/keys/keystone_version?scope=st2kv.system")
self.app.delete("/v1/keys/keystone_version?scope=st2kv.user")
def test_get_all_with_scope_and_prefix_filtering(self):
self.app.put_json(
"/v1/keys/%s?scope=st2kv.user" % "keystone_version",
KVP_2_USER,
expect_errors=False,
)
self.app.put_json(
"/v1/keys/%s?scope=st2kv.user" % "keystone_endpoint",
KVP_3_USER,
expect_errors=False,
)
self.app.put_json(
"/v1/keys/%s?scope=st2kv.user" % "customer_ssn",
KVP_4_USER,
expect_errors=False,
)
get_prefix = self.app.get("/v1/keys?scope=st2kv.user&prefix=keystone")
self.assertEqual(len(get_prefix.json), 2)
self.app.delete("/v1/keys/keystone_version?scope=st2kv.user")
self.app.delete("/v1/keys/keystone_endpoint?scope=st2kv.user")
self.app.delete("/v1/keys/customer_ssn?scope=st2kv.user")
def test_put_with_ttl(self):
put_resp = self._do_put("key_with_ttl", KVP_WITH_TTL)
self.assertEqual(put_resp.status_int, 200)
get_resp = self.app.get("/v1/keys")
self.assertTrue(get_resp.json[0]["expire_timestamp"])
self._do_delete(self._get_kvp_id(put_resp))
def test_put_secret(self):
put_resp = self._do_put("secret_key1", SECRET_KVP)
kvp_id = self._get_kvp_id(put_resp)
get_resp = self._do_get_one(kvp_id)
self.assertTrue(get_resp.json["encrypted"])
crypto_val = get_resp.json["value"]
self.assertNotEqual(SECRET_KVP["value"], crypto_val)
self._do_delete(self._get_kvp_id(put_resp))
def test_get_one_secret_no_decrypt(self):
put_resp = self._do_put("secret_key1", SECRET_KVP)
kvp_id = self._get_kvp_id(put_resp)
get_resp = self.app.get("/v1/keys/secret_key1")
self.assertEqual(get_resp.status_int, 200)
self.assertEqual(self._get_kvp_id(get_resp), kvp_id)
self.assertTrue(get_resp.json["secret"])
self.assertTrue(get_resp.json["encrypted"])
self._do_delete(kvp_id)
def test_get_one_secret_decrypt(self):
put_resp = self._do_put("secret_key1", SECRET_KVP)
kvp_id = self._get_kvp_id(put_resp)
get_resp = self.app.get("/v1/keys/secret_key1?decrypt=true")
self.assertEqual(get_resp.status_int, 200)
self.assertEqual(self._get_kvp_id(get_resp), kvp_id)
self.assertTrue(get_resp.json["secret"])
self.assertFalse(get_resp.json["encrypted"])
self.assertEqual(get_resp.json["value"], SECRET_KVP["value"])
self._do_delete(kvp_id)
def test_get_all_decrypt(self):
put_resp = self._do_put("secret_key1", SECRET_KVP)
kvp_id_1 = self._get_kvp_id(put_resp)
put_resp = self._do_put("key1", KVP)
kvp_id_2 = self._get_kvp_id(put_resp)
kvps = {"key1": KVP, "secret_key1": SECRET_KVP}
stored_kvps = self.app.get("/v1/keys?decrypt=true").json
self.assertTrue(len(stored_kvps), 2)
for stored_kvp in stored_kvps:
self.assertFalse(stored_kvp["encrypted"])
exp_kvp = kvps.get(stored_kvp["name"])
self.assertIsNotNone(exp_kvp)
self.assertEqual(exp_kvp["value"], stored_kvp["value"])
self._do_delete(kvp_id_1)
self._do_delete(kvp_id_2)
def test_put_encrypted_value(self):
# 1. encrypted=True, secret=True
put_resp = self._do_put("secret_key1", ENCRYPTED_KVP)
kvp_id = self._get_kvp_id(put_resp)
# Verify there is no secrets leakage
self.assertEqual(put_resp.status_code, 200)
self.assertEqual(put_resp.json["name"], "secret_key1")
self.assertEqual(put_resp.json["scope"], "st2kv.system")
self.assertEqual(put_resp.json["encrypted"], True)
self.assertEqual(put_resp.json["secret"], True)
self.assertEqual(put_resp.json["value"], ENCRYPTED_KVP["value"])
self.assertTrue(put_resp.json["value"] != "S3cret!Value")
self.assertTrue(len(put_resp.json["value"]) > len("S3cret!Value") * 2)
get_resp = self._do_get_one(kvp_id + "?decrypt=True")
self.assertEqual(put_resp.json["name"], "secret_key1")
self.assertEqual(put_resp.json["scope"], "st2kv.system")
self.assertEqual(put_resp.json["encrypted"], True)
self.assertEqual(put_resp.json["secret"], True)
self.assertEqual(put_resp.json["value"], ENCRYPTED_KVP["value"])
# Verify data integrity post decryption
get_resp = self._do_get_one(kvp_id + "?decrypt=True")
self.assertFalse(get_resp.json["encrypted"])
self.assertEqual(get_resp.json["value"], "S3cret!Value")
self._do_delete(self._get_kvp_id(put_resp))
# 2. encrypted=True, secret=False
# encrypted should always imply secret=True
put_resp = self._do_put("secret_key2", ENCRYPTED_KVP_SECRET_FALSE)
kvp_id = self._get_kvp_id(put_resp)
# Verify there is no secrets leakage
self.assertEqual(put_resp.status_code, 200)
self.assertEqual(put_resp.json["name"], "secret_key2")
self.assertEqual(put_resp.json["scope"], "st2kv.system")
self.assertEqual(put_resp.json["encrypted"], True)
self.assertEqual(put_resp.json["secret"], True)
self.assertEqual(put_resp.json["value"], ENCRYPTED_KVP["value"])
self.assertTrue(put_resp.json["value"] != "S3cret!Value")
self.assertTrue(len(put_resp.json["value"]) > len("S3cret!Value") * 2)
get_resp = self._do_get_one(kvp_id + "?decrypt=True")
self.assertEqual(put_resp.json["name"], "secret_key2")
self.assertEqual(put_resp.json["scope"], "st2kv.system")
self.assertEqual(put_resp.json["encrypted"], True)
self.assertEqual(put_resp.json["secret"], True)
self.assertEqual(put_resp.json["value"], ENCRYPTED_KVP["value"])
# Verify data integrity post decryption
get_resp = self._do_get_one(kvp_id + "?decrypt=True")
self.assertFalse(get_resp.json["encrypted"])
self.assertEqual(get_resp.json["value"], "S3cret!Value")
self._do_delete(self._get_kvp_id(put_resp))
def test_put_encrypted_value_integrity_check_failed(self):
data = copy.deepcopy(ENCRYPTED_KVP)
data["value"] = "corrupted"
put_resp = self._do_put("secret_key1", data, expect_errors=True)
self.assertEqual(put_resp.status_code, 400)
expected_error = (
"Failed to verify the integrity of the provided value for key "
'"secret_key1".'
)
self.assertIn(expected_error, put_resp.json["faultstring"])
data = copy.deepcopy(ENCRYPTED_KVP)
data["value"] = str(data["value"][:-2])
put_resp = self._do_put("secret_key1", data, expect_errors=True)
self.assertEqual(put_resp.status_code, 400)
expected_error = (
"Failed to verify the integrity of the provided value for key "
'"secret_key1".'
)
self.assertIn(expected_error, put_resp.json["faultstring"])
def test_put_delete(self):
put_resp = self._do_put("key1", KVP)
self.assertEqual(put_resp.status_int, 200)
self._do_delete(self._get_kvp_id(put_resp))
def test_delete(self):
put_resp = self._do_put("key1", KVP)
del_resp = self._do_delete(self._get_kvp_id(put_resp))
self.assertEqual(del_resp.status_int, 204)
def test_delete_fail(self):
resp = self._do_delete("inexistentkey", expect_errors=True)
self.assertEqual(resp.status_int, 404)
@staticmethod
def _get_kvp_id(resp):
return resp.json["name"]
def _do_get_one(self, kvp_id, expect_errors=False):
return self.app.get("/v1/keys/%s" % kvp_id, expect_errors=expect_errors)
def _do_put(self, kvp_id, kvp, expect_errors=False):
return self.app.put_json(
"/v1/keys/%s" % kvp_id, kvp, expect_errors=expect_errors
)
def _do_delete(self, kvp_id, expect_errors=False):
return self.app.delete("/v1/keys/%s" % kvp_id, expect_errors=expect_errors)
class KeyValuePairControllerRBACTestCase(KeyValuePairControllerBaseTestCase):
@classmethod
def setUpClass(cls):
super(KeyValuePairControllerRBACTestCase, cls).setUpClass()
cfg.CONF.set_override(group="rbac", name="enable", override=True)
@classmethod
def tearDownClass(cls):
cfg.CONF.set_override(group="rbac", name="enable", override=False)
super(KeyValuePairControllerRBACTestCase, cls).tearDownClass()
@mock.patch.object(
NoOpRBACUtils, "user_has_system_role", mock.MagicMock(return_value=True)
)
@mock.patch("st2api.controllers.v1.keyvalue.get_all_system_kvp_names_for_user")
def test_get_all_all_scope_admin(self, mock_get_system_kvp_names):
# Define users
user_1_db = UserDB(name="user-" + uuid.uuid4().hex)
user_1_db = User.add_or_update(user_1_db)
user_2_db = UserDB(name="user-" + uuid.uuid4().hex)
user_2_db = User.add_or_update(user_2_db)
# Insert system scoped kvps
for i in range(1, 3):
k, v = "s11" + str(i), "v11" + str(i)
put_resp = self._do_put(
k, {"name": k, "value": v, "scope": FULL_SYSTEM_SCOPE}
)
self.assertEqual(put_resp.status_int, 200)
# Insert user scoped kvps
self.use_user(user_1_db)
k, v = "a111", "v12345"
put_resp = self._do_put(k, {"name": k, "value": v, "scope": FULL_USER_SCOPE})
self.assertEqual(put_resp.status_int, 200)
self.use_user(user_2_db)
k, v = "u111", "v23456"
put_resp = self._do_put(k, {"name": k, "value": v, "scope": FULL_USER_SCOPE})
self.assertEqual(put_resp.status_int, 200)
# Assert user1 permissions
self.use_user(user_1_db)
resp = self.app.get("/v1/keys", {"scope": ALL_SCOPE})
self.assertEqual(len(resp.json), 3)
self.assertListEqual(
sorted([i["name"] for i in resp.json]), ["a111", "s111", "s112"]
)
self.assertFalse(mock_get_system_kvp_names.called)
resp = self.app.get("/v1/keys", {"scope": FULL_SYSTEM_SCOPE})
self.assertEqual(len(resp.json), 2)
self.assertListEqual(sorted([i["name"] for i in resp.json]), ["s111", "s112"])
self.assertFalse(mock_get_system_kvp_names.called)
resp = self.app.get("/v1/keys", {"scope": FULL_USER_SCOPE})
self.assertEqual(len(resp.json), 1)
self.assertListEqual(sorted([i["name"] for i in resp.json]), ["a111"])
self.assertFalse(mock_get_system_kvp_names.called)
resp = self.app.get("/v1/keys", {"user": user_2_db.name})
self.assertEqual(len(resp.json), 1)
self.assertListEqual(sorted([i["name"] for i in resp.json]), ["u111"])
self.assertFalse(mock_get_system_kvp_names.called)
@mock.patch.object(
NoOpRBACUtils, "user_has_system_role", mock.MagicMock(return_value=False)
)
@mock.patch("st2api.controllers.v1.keyvalue.get_all_system_kvp_names_for_user")
def test_get_all_all_scope_nonadmin(self, mock_get_system_kvp_names):
# Define users
user_1_db = UserDB(name="user-" + uuid.uuid4().hex)
user_1_db = User.add_or_update(user_1_db)
user_2_db = UserDB(name="user-" + uuid.uuid4().hex)
user_2_db = User.add_or_update(user_2_db)
# Insert system scoped kvps
# s121-s122 assigned to user1
# s123-s124 assigned to user2
# s125-s126 not explicitly assigned
for i in range(1, 7):
k, v = "s12" + str(i), "v12" + str(i)
put_resp = self._do_put(
k, {"name": k, "value": v, "scope": FULL_SYSTEM_SCOPE}
)
self.assertEqual(put_resp.status_int, 200)
# Insert user scoped kvps
self.use_user(user_1_db)
k, v = "u121", "v12345"
put_resp = self._do_put(k, {"name": k, "value": v, "scope": FULL_USER_SCOPE})
self.assertEqual(put_resp.status_int, 200)
self.use_user(user_2_db)
k, v = "u122", "v23456"
put_resp = self._do_put(k, {"name": k, "value": v, "scope": FULL_USER_SCOPE})
self.assertEqual(put_resp.status_int, 200)
# Assert user1 permissions
self.use_user(user_1_db)
mock_get_system_kvp_names.return_value = ["s121", "s122"]
resp = self.app.get("/v1/keys", {"scope": ALL_SCOPE})
self.assertEqual(len(resp.json), 3)
self.assertListEqual(
sorted([i["name"] for i in resp.json]), ["s121", "s122", "u121"]
)
self.assertTrue(mock_get_system_kvp_names.called)
mock_get_system_kvp_names.reset_mock()
resp = self.app.get("/v1/keys", {"scope": FULL_SYSTEM_SCOPE})
self.assertEqual(len(resp.json), 2)
self.assertListEqual(sorted([i["name"] for i in resp.json]), ["s121", "s122"])
self.assertTrue(mock_get_system_kvp_names.called)
mock_get_system_kvp_names.reset_mock()
resp = self.app.get("/v1/keys", {"scope": FULL_USER_SCOPE})
self.assertEqual(len(resp.json), 1)
self.assertListEqual(sorted([i["name"] for i in resp.json]), ["u121"])
self.assertFalse(mock_get_system_kvp_names.called)
mock_get_system_kvp_names.reset_mock()
# Assert user2 permissions
self.use_user(user_2_db)
mock_get_system_kvp_names.return_value = ["s123", "s124"]
resp = self.app.get("/v1/keys", {"scope": ALL_SCOPE})
self.assertEqual(len(resp.json), 3)
self.assertListEqual(
sorted([i["name"] for i in resp.json]), ["s123", "s124", "u122"]
)
self.assertTrue(mock_get_system_kvp_names.called)
mock_get_system_kvp_names.reset_mock()
resp = self.app.get("/v1/keys", {"scope": FULL_SYSTEM_SCOPE})
self.assertEqual(len(resp.json), 2)
self.assertListEqual(sorted([i["name"] for i in resp.json]), ["s123", "s124"])
self.assertTrue(mock_get_system_kvp_names.called)
mock_get_system_kvp_names.reset_mock()
resp = self.app.get("/v1/keys", {"scope": FULL_USER_SCOPE})
self.assertEqual(len(resp.json), 1)
self.assertListEqual(sorted([i["name"] for i in resp.json]), ["u122"])
self.assertFalse(mock_get_system_kvp_names.called)
mock_get_system_kvp_names.reset_mock()
| {
"content_hash": "4323d9249d2e451b1d910458af9d8a8f",
"timestamp": "",
"source": "github",
"line_count": 781,
"max_line_length": 99,
"avg_line_length": 40.820742637644045,
"alnum_prop": 0.6060349424422069,
"repo_name": "StackStorm/st2",
"id": "5eec7e081e206c5dab272f9bf2f2b26173835a4b",
"size": "32509",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "st2api/tests/unit/controllers/v1/test_kvps.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "198"
},
{
"name": "JavaScript",
"bytes": "444"
},
{
"name": "Jinja",
"bytes": "174532"
},
{
"name": "Makefile",
"bytes": "75242"
},
{
"name": "PowerShell",
"bytes": "856"
},
{
"name": "Python",
"bytes": "6453910"
},
{
"name": "Shell",
"bytes": "93607"
},
{
"name": "Starlark",
"bytes": "7236"
}
],
"symlink_target": ""
} |
import numpy as np
import pysam
import random
import gzip
import pdb
from keras.utils.np_utils import to_categorical
DNA_COMPLEMENT = dict([('A','T'),('T','A'),('G','C'),('C','G'),('N','N')])
ONE_HOT = dict([('A',0),('C',1),('G',2),('T',3)])
#make_complement = lambda seq: ''.join([DNA_COMPLEMENT[s] for s in seq])
#make_reverse_complement = lambda seq: ''.join([DNA_COMPLEMENT[s] for s in seq][::-1])
def partition_sites(options):
"""load sites and partition them into training,
test and validation sets
"""
train = []
test = []
valid = []
with gzip.open(options.peak_file,'r') as handle:
header = handle.next().strip().split()
cellnames = header[3:]
for line in handle:
row = line.strip().split()
mid = (int(row[1])+int(row[2]))/2
entry = [row[0], mid-options.window_size/2, mid+options.window_size/2]
entry.extend([int(r) for r in row[3:]])
if row[0]==options.test_chromosome:
test.append(entry)
else:
if np.random.rand()>0.01:
train.append(entry)
else:
valid.append(entry)
return train, valid, test, cellnames
def onehot(seq):
"""construct a one-hot encoding of a DNA sequence
"""
N = len(seq)
arr = np.zeros((1,4,N), dtype='float32')
[arr[0,ONE_HOT[s]].__setitem__(i,1)
for i,s in enumerate(seq) if ONE_HOT.has_key(s)]
arr[0,:,~np.any(arr[0]==1,0)] = 0.25
return arr
def map_cellgroup_to_category(filename):
cellgroup_counts = dict()
handle = gzip.open(filename,'r')
header = handle.next()
for line in handle:
loc = line.strip().split()
try:
cellgroup_counts[tuple(loc[3:])] += 1
except KeyError:
cellgroup_counts[tuple(loc[3:])] = 1
handle.close()
#keys = cellgroup_counts.keys()
#for key in keys:
# if cellgroup_counts[key]<1000:
# del cellgroup_counts[key]
keys = cellgroup_counts.keys()
cellgroup_mapping = dict([(key,k) for k,key in enumerate(keys)])
cellgroup_map_array = np.array([map(int,list(key)) for key in keys])
return cellgroup_mapping, cellgroup_map_array
class DataGenerator():
def __init__(self, locations, genome_track):
self._genome_track = genome_track
self.locations = locations
self.N = len(self.locations)
self.batch_index = 0
self.total_batches_seen = 0
def _flow_index(self, batch_size):
self.batch_index = 0
while True:
if self.batch_index == 0:
random.shuffle(self.locations)
current_index = (self.batch_index * batch_size) % self.N
if self.N >= current_index + batch_size:
current_batch_size = batch_size
self.batch_index += 1
else:
current_batch_size = self.N - current_index
self.batch_index = 0
self.total_batches_seen += 1
yield (self.locations[current_index : current_index + current_batch_size],
current_index, current_batch_size)
def flow(self, batch_size):
self.flow_generator = self._flow_index(batch_size)
return self
def __iter__(self):
return self
def __next__(self):
return self.next()
def next(self):
locations, current_index, current_batch_size = next(self.flow_generator)
X, Y = self._genome_track.encode_sequences(locations)
return X, Y
class Genome():
def __init__(self, fasta_filename, prediction_type, cellgroup_mapping=None):
self._genome_handle = pysam.FastaFile(fasta_filename)
self.prediction_type = prediction_type
if cellgroup_mapping is not None:
self.cellgroup_mapping = cellgroup_mapping
self.C = len(self.cellgroup_mapping)
def _get_dna_sequence(self, location):
return self._genome_handle.fetch(location[0], location[1], location[2]).upper()
def encode_sequences(self, locations, batch_size=1000):
X = np.array([onehot(self._get_dna_sequence(loc))
for loc in locations]).astype('float32')
if self.prediction_type=='cellgroup':
Y = to_categorical(np.array([self.cellgroup_mapping[tuple(map(str,loc[3:]))]
for loc in locations]), self.C)
elif self.prediction_type=='celltype':
Y = np.array([loc[3:] for loc in locations])
return X, Y
def close(self):
self._genome_handle.close()
def selex_pwms(background={'A':0.25, 'T':0.25, 'G':0.25, 'C':0.25}):
motifs = dict()
handle = open("pwms/HTSELEX/selexIDs.txt",'r')
for pline in handle:
prow = pline.strip().split()
if 'ENSG' not in prow[0]:
continue
sid = prow[2]
filename = 'pwms/HTSELEX/%s.dat'%sid
motifs[sid] = []
counts = {'A':[], 'T':[], 'G':[], 'C':[]}
motifhandle = open(filename,'r')
for line in motifhandle:
row = line.strip().split(':')
if row[0] in ['A','T','G','C']:
counts[row[0]] = map(float,row[1].split())
else:
continue
motifhandle.close()
motifs[sid] = np.array([counts[nuc] for nuc in ['A','C','G','T']])
motifs[sid] = motifs[sid]/motifs[sid].sum(0)
handle.close()
return motifs
def transfac_pwms(background={'A':0.25, 'T':0.25, 'G':0.25, 'C':0.25}):
motifs = dict()
handle = open("pwms/TRANSFAC/transfacIDs.txt", 'r')
handle.next()
for pline in handle:
prow = pline.strip().split('\t')
if 'ENSG' not in prow[0]:
continue
sid = prow[2]
filename = 'pwms/TRANSFAC/%s.dat'%sid
motifs[sid] = []
counts = {'A':[], 'T':[], 'G':[], 'C':[]}
motifhandle = open(filename,'r')
for line in motifhandle:
if line[0]=='#':
continue
elif line[0] in ['A','T','G','C']:
order = line.strip().split()
else:
[counts[order[i]].append(c) for i,c in enumerate(map(float,line.strip().split()))]
motifhandle.close()
motifs[sid] = np.array([counts[nuc] for nuc in ['A','C','G','T']])
motifs[sid] = motifs[sid]/motifs[sid].sum(0)
handle.close()
return motifs
| {
"content_hash": "e429e8f68a11f2b7f095c223a8675c0b",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 98,
"avg_line_length": 29.639269406392692,
"alnum_prop": 0.5467570482206131,
"repo_name": "rajanil/OrbWeaver",
"id": "0a4117f3325c100ff1f323c50ce77d20a5d0d4b1",
"size": "6491",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "load.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "20543"
}
],
"symlink_target": ""
} |
import typing
class Hasher(typing.Protocol):
"""A hashing algorithm, e.g. :func:`hashlib.sha256`."""
def update(self, blob: bytes):
...
def digest(self) -> bytes:
...
Generic = typing.TypeVar("Generic")
class HasherGeneric(typing.Protocol[Generic]):
"""A hashing algorithm, e.g. :func:`hashlib.sha256`."""
def update(self, blob: bytes):
...
def digest(self) -> bytes:
...
class Protocol: #pylint:disable=too-few-public-methods
pass
class HasherFake(Protocol):
"""A hashing algorithm, e.g. :func:`hashlib.sha256`."""
def update(self, blob: bytes): # [no-self-use, unused-argument]
...
def digest(self) -> bytes: # [no-self-use]
...
| {
"content_hash": "f43a2f71ca5e3ca71f00920e1b9cdbe3",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 67,
"avg_line_length": 22.151515151515152,
"alnum_prop": 0.5950752393980848,
"repo_name": "ruchee/vimrc",
"id": "784da609875008dbe462d5d7784b373936a47790",
"size": "768",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vimfiles/bundle/vim-python/submodules/pylint/tests/functional/p/protocol_classes.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "22028"
},
{
"name": "Blade",
"bytes": "3314"
},
{
"name": "C#",
"bytes": "1734"
},
{
"name": "CSS",
"bytes": "31547"
},
{
"name": "Clojure",
"bytes": "47036"
},
{
"name": "CoffeeScript",
"bytes": "9274"
},
{
"name": "Common Lisp",
"bytes": "54314"
},
{
"name": "D",
"bytes": "11562"
},
{
"name": "Dockerfile",
"bytes": "7620"
},
{
"name": "Elixir",
"bytes": "41696"
},
{
"name": "Emacs Lisp",
"bytes": "10489"
},
{
"name": "Erlang",
"bytes": "137788"
},
{
"name": "F#",
"bytes": "2230"
},
{
"name": "Go",
"bytes": "54655"
},
{
"name": "HTML",
"bytes": "178954"
},
{
"name": "Haml",
"bytes": "39"
},
{
"name": "Haskell",
"bytes": "2031"
},
{
"name": "JavaScript",
"bytes": "9086"
},
{
"name": "Julia",
"bytes": "9540"
},
{
"name": "Kotlin",
"bytes": "8669"
},
{
"name": "Less",
"bytes": "327"
},
{
"name": "Makefile",
"bytes": "87500"
},
{
"name": "Mustache",
"bytes": "3375"
},
{
"name": "Nix",
"bytes": "1860"
},
{
"name": "PHP",
"bytes": "9238"
},
{
"name": "PLpgSQL",
"bytes": "33747"
},
{
"name": "Perl",
"bytes": "84200"
},
{
"name": "PostScript",
"bytes": "3891"
},
{
"name": "Python",
"bytes": "7366233"
},
{
"name": "Racket",
"bytes": "1150"
},
{
"name": "Raku",
"bytes": "21146"
},
{
"name": "Ruby",
"bytes": "133344"
},
{
"name": "SCSS",
"bytes": "327"
},
{
"name": "Sass",
"bytes": "308"
},
{
"name": "Scala",
"bytes": "13125"
},
{
"name": "Shell",
"bytes": "52916"
},
{
"name": "Smarty",
"bytes": "300"
},
{
"name": "Swift",
"bytes": "11436"
},
{
"name": "TypeScript",
"bytes": "4663"
},
{
"name": "Vim Script",
"bytes": "10545492"
},
{
"name": "Vim Snippet",
"bytes": "559139"
}
],
"symlink_target": ""
} |
from datetime import datetime, timedelta
import urlparse
from openid import oidutil
from flask import g, current_app, redirect, request, flash, render_template, url_for, Markup, escape, abort
from flask.ext.openid import OpenID
from coaster.utils import getbool
from coaster.views import get_next_url, load_model
from baseframe import _, __
from baseframe.forms import render_form, render_message, render_redirect
from lastuser_core import login_registry
from .. import lastuser_oauth
from ..mailclient import send_email_verify_link, send_password_reset_link
from lastuser_core.models import db, User, UserEmailClaim, PasswordResetRequest, ClientCredential, UserSession
from ..forms import LoginForm, RegisterForm, PasswordResetForm, PasswordResetRequestForm, LoginPasswordResetException
from .helpers import login_internal, logout_internal, register_internal, set_loginmethod_cookie
oid = OpenID()
def openid_log(message, level=0):
if current_app.debug:
import sys
print >> sys.stderr, message
oidutil.log = openid_log
@lastuser_oauth.route('/login', methods=['GET', 'POST'])
@oid.loginhandler
def login():
# If user is already logged in, send them back
if g.user:
return redirect(get_next_url(referrer=True), code=303)
loginform = LoginForm()
service_forms = {}
for service, provider in login_registry.items():
if provider.at_login and provider.form is not None:
service_forms[service] = provider.get_form()
loginmethod = None
if request.method == 'GET':
loginmethod = request.cookies.get('login')
formid = request.form.get('form.id')
if request.method == 'POST' and formid == 'passwordlogin':
try:
if loginform.validate():
user = loginform.user
login_internal(user)
db.session.commit()
flash(_("You are now logged in"), category='success')
return set_loginmethod_cookie(render_redirect(get_next_url(session=True), code=303),
'password')
except LoginPasswordResetException:
return render_redirect(url_for('.reset', expired=1, username=loginform.username.data))
elif request.method == 'POST' and formid in service_forms:
form = service_forms[formid]['form']
if form.validate():
return set_loginmethod_cookie(login_registry[formid].do(form=form), formid)
elif request.method == 'POST':
abort(500)
iframe_block = {'X-Frame-Options': 'SAMEORIGIN'}
if request.is_xhr and formid == 'passwordlogin':
return render_template('loginform.html', loginform=loginform, Markup=Markup), 200, iframe_block
else:
return render_template('login.html', loginform=loginform, lastused=loginmethod,
service_forms=service_forms, Markup=Markup, login_registry=login_registry), 200, iframe_block
logout_errormsg = __("We detected a possibly unauthorized attempt to log you out. "
"If you really did intend to logout, please click on the logout link again")
def logout_user():
"""
User-initiated logout
"""
if not request.referrer or (urlparse.urlsplit(request.referrer).netloc != urlparse.urlsplit(request.url).netloc):
# TODO: present a logout form
flash(current_app.config.get('LOGOUT_UNAUTHORIZED_MESSAGE') or logout_errormsg, 'danger')
return redirect(url_for('index'))
else:
logout_internal()
db.session.commit()
flash(_("You are now logged out"), category='info')
return redirect(get_next_url())
def logout_client():
"""
Client-initiated logout
"""
cred = ClientCredential.get(request.args['client_id'])
client = cred.client if cred else None
if client is None or not request.referrer or not client.host_matches(request.referrer):
# No referrer or such client, or request didn't come from the client website.
# Possible CSRF. Don't logout and don't send them back
flash(current_app.config.get('LOGOUT_UNAUTHORIZED_MESSAGE') or logout_errormsg, 'danger')
return redirect(url_for('index'))
# If there is a next destination, is it in the same domain as the client?
if 'next' in request.args:
if not client.host_matches(request.args['next']):
# Host doesn't match. Assume CSRF and redirect to index without logout
flash(current_app.config.get('LOGOUT_UNAUTHORIZED_MESSAGE') or logout_errormsg, 'danger')
return redirect(url_for('index'))
# All good. Log them out and send them back
logout_internal()
db.session.commit()
return redirect(get_next_url(external=True))
@lastuser_oauth.route('/logout')
def logout():
# Logout, but protect from CSRF attempts
if 'client_id' in request.args:
return logout_client()
else:
# If this is not a logout request from a client, check if all is good.
return logout_user()
@lastuser_oauth.route('/logout/<session>')
@load_model(UserSession, {'buid': 'session'}, 'session')
def logout_session(session):
if not request.referrer or (urlparse.urlsplit(request.referrer).netloc != urlparse.urlsplit(request.url).netloc) or (session.user != g.user):
flash(current_app.config.get('LOGOUT_UNAUTHORIZED_MESSAGE') or logout_errormsg, 'danger')
return redirect(url_for('index'))
session.revoke()
db.session.commit()
return redirect(get_next_url(referrer=True), code=303)
@lastuser_oauth.route('/register', methods=['GET', 'POST'])
def register():
if g.user:
return redirect(url_for('index'))
form = RegisterForm()
# Make Recaptcha optional
if not (current_app.config.get('RECAPTCHA_PUBLIC_KEY') and current_app.config.get('RECAPTCHA_PRIVATE_KEY')):
del form.recaptcha
form.fullname.description = current_app.config.get('FULLNAME_REASON')
form.email.description = current_app.config.get('EMAIL_REASON')
form.username.description = current_app.config.get('USERNAME_REASON')
if form.validate_on_submit():
user = register_internal(form.username.data, form.fullname.data, form.password.data)
useremail = UserEmailClaim(user=user, email=form.email.data)
db.session.add(useremail)
send_email_verify_link(useremail)
login_internal(user)
db.session.commit()
flash(_("You are now one of us. Welcome aboard!"), category='success')
return redirect(get_next_url(session=True), code=303)
return render_form(form=form, title=_("Create an account"), formid='register', submit=_("Register"),
message=current_app.config.get('CREATE_ACCOUNT_MESSAGE'))
@lastuser_oauth.route('/reset', methods=['GET', 'POST'])
def reset():
# User wants to reset password
# Ask for username or email, verify it, and send a reset code
form = PasswordResetRequestForm()
if getbool(request.args.get('expired')):
message = _(u"Your password has expired. Please enter your username "
"or email address to request a reset code and set a new password")
else:
message = None
if request.method == 'GET':
form.username.data = request.args.get('username')
if form.validate_on_submit():
username = form.username.data
user = form.user
if '@' in username and not username.startswith('@'):
# They provided an email address. Send reset email to that address
email = username
else:
# Send to their existing address
# User.email is a UserEmail object
email = unicode(user.email)
if not email and user.emailclaims:
email = user.emailclaims[0].email
if not email:
# They don't have an email address. Maybe they logged in via Twitter
# and set a local username and password, but no email. Could happen.
if len(user.externalids) > 0:
extid = user.externalids[0]
return render_message(title=_("Cannot reset password"), message=Markup(_(u"""
We do not have an email address for your account. However, your account
is linked to <strong>{service}</strong> with the id <strong>{username}</strong>.
You can use that to login.
""").format(service=login_registry[extid.service].title, username=extid.username or extid.userid)))
else:
return render_message(title=_("Cannot reset password"), message=Markup(_(
u"""
We do not have an email address for your account and therefore cannot
email you a reset link. Please contact
<a href="mailto:{email}">{email}</a> for assistance.
""").format(email=escape(current_app.config['SITE_SUPPORT_EMAIL']))))
resetreq = PasswordResetRequest(user=user)
db.session.add(resetreq)
send_password_reset_link(email=email, user=user, secret=resetreq.reset_code)
db.session.commit()
return render_message(title=_("Reset password"), message=_(u"""
We sent you an email with a link to reset your password.
Please check your email. If it doesn’t arrive in a few minutes,
it may have landed in your spam or junk folder.
The reset link is valid for 24 hours.
"""))
return render_form(form=form, title=_("Reset password"), message=message, submit=_("Send reset code"), ajax=False)
@lastuser_oauth.route('/reset/<userid>/<secret>', methods=['GET', 'POST'])
@load_model(User, {'userid': 'userid'}, 'user', kwargs=True)
def reset_email(user, kwargs):
resetreq = PasswordResetRequest.query.filter_by(user=user, reset_code=kwargs['secret']).first()
if not resetreq:
return render_message(title=_("Invalid reset link"),
message=_(u"The reset link you clicked on is invalid"))
if resetreq.created_at < datetime.utcnow() - timedelta(days=1):
# Reset code has expired (> 24 hours). Delete it
db.session.delete(resetreq)
db.session.commit()
return render_message(title=_("Expired reset link"),
message=_(u"The reset link you clicked on has expired"))
# Logout *after* validating the reset request to prevent DoS attacks on the user
logout_internal()
db.session.commit()
# Reset code is valid. Now ask user to choose a new password
form = PasswordResetForm()
form.edit_user = user
if form.validate_on_submit():
user.password = form.password.data
db.session.delete(resetreq)
db.session.commit()
return render_message(title=_("Password reset complete"), message=Markup(
_(u"Your password has been reset. You may now <a href=\"{loginurl}\">login</a> with your new password.").format(
loginurl=escape(url_for('.login')))))
return render_form(form=form, title=_("Reset password"), formid='reset', submit=_("Reset password"),
message=Markup(_(u"Hello, <strong>{fullname}</strong>. You may now choose a new password.").format(
fullname=escape(user.fullname))),
ajax=False)
| {
"content_hash": "e4e11161b2e2a9b0a14a893dc4fd2c05",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 145,
"avg_line_length": 44.852,
"alnum_prop": 0.6561134397574244,
"repo_name": "sindhus/lastuser",
"id": "cb6a9612c81b975a7e87ee0ee35a23f32d219f37",
"size": "11240",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lastuser_oauth/views/login.py",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "CSS",
"bytes": "3623"
},
{
"name": "HTML",
"bytes": "35810"
},
{
"name": "JavaScript",
"bytes": "145"
},
{
"name": "Mako",
"bytes": "412"
},
{
"name": "Python",
"bytes": "349287"
},
{
"name": "Ruby",
"bytes": "404"
},
{
"name": "Shell",
"bytes": "40"
}
],
"symlink_target": ""
} |
from typing import Dict
from reggen.lib import check_keys, check_str, check_int
REQUIRED_FIELDS = {
'name': ['s', "name of the member of the enum"],
'desc': ['t', "description when field has this value"],
'value': ['d', "value of this member of the enum"]
}
class EnumEntry:
def __init__(self, where: str, max_val: int, raw: object):
rd = check_keys(raw, where,
list(REQUIRED_FIELDS.keys()),
[])
self.name = check_str(rd['name'], 'name field of {}'.format(where))
self.desc = check_str(rd['desc'], 'desc field of {}'.format(where))
self.value = check_int(rd['value'], 'value field of {}'.format(where))
if not (0 <= self.value <= max_val):
raise ValueError("value for {} is {}, which isn't representable "
"in the field (representable range: 0 .. {})."
.format(where, self.value, max_val))
def _asdict(self) -> Dict[str, object]:
return {
'name': self.name,
'desc': self.desc,
'value': str(self.value)
}
| {
"content_hash": "4d9359909ca7999730d3dd99359cd54f",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 78,
"avg_line_length": 36.774193548387096,
"alnum_prop": 0.525438596491228,
"repo_name": "lowRISC/opentitan",
"id": "2eb2636f84320042cc0980135a13a693a1821b38",
"size": "1288",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "util/reggen/enum_entry.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "516881"
},
{
"name": "C",
"bytes": "4864968"
},
{
"name": "C++",
"bytes": "1629214"
},
{
"name": "CSS",
"bytes": "3281"
},
{
"name": "Dockerfile",
"bytes": "6732"
},
{
"name": "Emacs Lisp",
"bytes": "411542"
},
{
"name": "HTML",
"bytes": "149270"
},
{
"name": "Makefile",
"bytes": "20646"
},
{
"name": "Python",
"bytes": "2576872"
},
{
"name": "Rust",
"bytes": "856480"
},
{
"name": "SCSS",
"bytes": "54700"
},
{
"name": "Shell",
"bytes": "119163"
},
{
"name": "Smarty",
"bytes": "771102"
},
{
"name": "Starlark",
"bytes": "688003"
},
{
"name": "Stata",
"bytes": "3676"
},
{
"name": "SystemVerilog",
"bytes": "14853322"
},
{
"name": "Tcl",
"bytes": "361936"
},
{
"name": "Verilog",
"bytes": "3296"
}
],
"symlink_target": ""
} |
"""
chemdataextractor.text.normalize
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tools for normalizing text.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from abc import ABCMeta, abstractmethod
import re
import unicodedata
import six
from . import CONTROLS, HYPHENS, QUOTES, DOUBLE_QUOTES, ACCENTS, SINGLE_QUOTES, APOSTROPHES, SLASHES, TILDES, MINUSES
from .processors import BaseProcessor
class BaseNormalizer(six.with_metaclass(ABCMeta, BaseProcessor)):
"""Abstract normalizer class from which all normalizers inherit.
Subclasses must implement a ``normalize()`` method.
"""
@abstractmethod
def normalize(self, text):
"""Normalize the text.
:param string text: The text to normalize.
:returns: Normalized text.
:rtype: string
"""
return text
def __call__(self, text):
"""Calling a normalizer instance like a function just calls the normalize method."""
return self.normalize(text)
class Normalizer(BaseNormalizer):
"""Main Normalizer class for generic English text.
Normalize unicode, hyphens, quotes, whitespace.
By default, the normal form NFKC is used for unicode normalization. This applies a compatibility decomposition,
under which equivalent characters are unified, followed by a canonical composition. See Python docs for information
on normal forms: http://docs.python.org/2/library/unicodedata.html#unicodedata.normalize
"""
def __init__(self, form='NFKC', strip=True, collapse=True, hyphens=False, quotes=False, ellipsis=False,
slashes=False, tildes=False):
"""
:param string form: Normal form for unicode normalization.
:param bool strip: Whether to strip whitespace from start and end.
:param bool collapse: Whether to collapse all whitespace (tabs, newlines) down to single spaces.
:param bool hyphens: Whether to normalize all hyphens, minuses and dashes to the ASCII hyphen-minus character.
:param bool quotes: Whether to normalize all apostrophes, quotes and primes to the ASCII quote character.
:param bool ellipsis: Whether to normalize ellipses to three full stops.
:param bool slashes: Whether to normalize slash characters to the ASCII slash character.
:param bool tildes: Whether to normalize tilde characters to the ASCII tilde character.
"""
self.form = form
self.strip = strip
self.collapse = collapse
self.hyphens = hyphens
self.quotes = quotes
self.ellipsis = ellipsis
self.slashes = slashes
self.tildes = tildes
def normalize(self, text):
"""Run the Normalizer on a string.
:param text: The string to normalize.
"""
# Normalize to canonical unicode (using NFKC by default)
if self.form is not None:
text = unicodedata.normalize(self.form, text)
# Strip out any control characters (they occasionally creep in somehow)
for control in CONTROLS:
text = text.replace(control, '')
# Normalize unusual whitespace not caught by unicodedata
text = text.replace('\u000b', ' ').replace('\u000c', ' ').replace(u'\u0085', ' ')
text = text.replace('\u2028', '\n').replace('\u2029', '\n').replace('\r\n', '\n').replace('\r', '\n')
# Normalize all hyphens, minuses and dashes to ascii hyphen-minus and remove soft hyphen entirely
if self.hyphens:
# TODO: Better normalization of em/en dashes to '--' if surrounded by spaces or start/end?
for hyphen in HYPHENS | MINUSES:
text = text.replace(hyphen, '-')
text = text.replace('\u00ad', '')
# Normalize all quotes and primes to ascii apostrophe and quotation mark
if self.quotes:
for double_quote in DOUBLE_QUOTES:
text = text.replace(double_quote, '"') # \u0022
for single_quote in (SINGLE_QUOTES | APOSTROPHES | ACCENTS):
text = text.replace(single_quote, "'") # \u0027
text = text.replace('′', "'") # \u2032 prime
text = text.replace('‵', "'") # \u2035 reversed prime
text = text.replace('″', "''") # \u2033 double prime
text = text.replace('‶', "''") # \u2036 reversed double prime
text = text.replace('‴', "'''") # \u2034 triple prime
text = text.replace('‷', "'''") # \u2037 reversed triple prime
text = text.replace('⁗', "''''") # \u2057 quadruple prime
if self.ellipsis:
text = text.replace('…', '...').replace(' . . . ', ' ... ') # \u2026
if self.slashes:
for slash in SLASHES:
text = text.replace(slash, '/')
if self.tildes:
for tilde in TILDES:
text = text.replace(tilde, '~')
if self.strip:
text = text.strip()
# Collapse all whitespace down to a single space
if self.collapse:
text = ' '.join(text.split())
return text
#: Default normalize that canonicalizes unicode and fixes whitespace.
normalize = Normalizer(strip=True, collapse=True, hyphens=False, quotes=False, ellipsis=False)
#: More aggressive normalize that also standardizes hyphens, and quotes.
strict_normalize = Normalizer(strip=True, collapse=True, hyphens=True, quotes=True, ellipsis=True, tildes=True)
class ExcessNormalizer(Normalizer):
"""Excessive string normalization.
This is useful when doing fuzzy string comparisons. A common use case is to run this before calculating the
Levenshtein distance between two strings, so that only "important" differences are counted.
"""
def __init__(self, form='NFKC', strip=True, collapse=True, hyphens=True, quotes=True, ellipsis=True, tildes=True):
""""""
super(ExcessNormalizer, self).__init__(form, strip=strip, collapse=collapse, hyphens=hyphens, quotes=quotes,
ellipsis=ellipsis, tildes=tildes)
def normalize(self, text):
# Lowercase and normalize unicode
text = super(ExcessNormalizer, self).normalize(text.lower())
# Remove all whitespace
text = ''.join(text.split())
# Convert all apostrophes, quotes, accents, primes to single ascii apostrophe
for quote in QUOTES:
text = text.replace(quote, "'")
# Convert all brackets to regular parentheses
for ob in {'(', '<', '[', '{', '<'}:
text = text.replace(ob, '(')
for cb in {')', '>', ']', '}', '>'}:
text = text.replace(cb, '(')
return text
excess_normalize = ExcessNormalizer(strip=True, collapse=True, hyphens=True, quotes=True, ellipsis=True, tildes=True)
class ChemNormalizer(Normalizer):
"""Normalizer that also unifies chemical spelling."""
def __init__(self, form='NFKC', strip=True, collapse=True, hyphens=True, quotes=True, ellipsis=True, tildes=True,
chem_spell=True):
""""""
super(ChemNormalizer, self).__init__(form, strip=strip, collapse=collapse, hyphens=hyphens, quotes=quotes,
ellipsis=ellipsis, tildes=tildes)
self.chem_spell = chem_spell
def normalize(self, text):
"""Normalize unicode, hyphens, whitespace, and some chemistry terms and formatting."""
text = super(ChemNormalizer, self).normalize(text)
# Normalize element spelling
if self.chem_spell:
text = re.sub(r'sulph', r'sulf', text, flags=re.I)
text = re.sub(r'aluminum', r'aluminium', text, flags=re.I)
text = re.sub(r'cesium', r'caesium', text, flags=re.I)
return text
chem_normalize = ChemNormalizer(strip=True, collapse=True, hyphens=True, quotes=True, ellipsis=True, tildes=True,
chem_spell=True)
| {
"content_hash": "581fd92b686a93103f5df8c4d2378cc5",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 119,
"avg_line_length": 41.927083333333336,
"alnum_prop": 0.626335403726708,
"repo_name": "mcs07/ChemDataExtractor",
"id": "1d3131144bff4d48a30ba08276e27b25ec7640a6",
"size": "8090",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "chemdataextractor/text/normalize.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "540374"
},
{
"name": "Python",
"bytes": "833941"
},
{
"name": "Shell",
"bytes": "6106"
}
],
"symlink_target": ""
} |
class UnsafeSubstitutionError(Exception):
pass
| {
"content_hash": "29f5e2534e735990d36bc6231ef37a3c",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 41,
"avg_line_length": 25.5,
"alnum_prop": 0.803921568627451,
"repo_name": "darrenpmeyer/logging-formatter-anticrlf",
"id": "ca1e27823ebf3ebb14369bc1807cf426259d13a1",
"size": "51",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "anticrlf/exception.py",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Python",
"bytes": "8927"
}
],
"symlink_target": ""
} |
"""
Stratified permutation tests.
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from .utils import get_prng, permute_within_groups
def corrcoef(x, y, group):
"""
Calculates sum of Spearman correlations between x and y,
computed separately in each group.
Parameters
----------
x : array-like
y : array-like
group : array-like
Returns
-------
float
The sum of Spearman correlations
"""
tst = 0.0
for g in np.unique(group):
gg = group == g
tst += np.corrcoef(x[gg], y[gg])[0, 1]
return tst
def sim_corr(x, y, group, reps=10**4, seed=None):
"""
Simulate permutation p-value of stratified Spearman correlation test.
Parameters
----------
x : array-like
y : array-like
group : array-like
reps : int
seed : RandomState instance or {None, int, RandomState instance}
If None, the pseudorandom number generator is the RandomState
instance used by `np.random`;
If int, seed is the seed used by the random number generator;
If RandomState instance, seed is the pseudorandom number generator.
Returns
-------
tuple
Returns test statistic, left-sided p-value,
right-sided p-value, two-sided p-value, simulated distribution
"""
prng = get_prng(seed)
tst = corrcoef(x, y, group)
sims = [corrcoef(permute_within_groups(x, group, prng), y, group)
for i in range(reps)]
left_pv = np.sum(sims <= tst)/reps
right_pv = np.sum(sims >= tst)/reps
two_sided_pv = np.sum(np.abs(sims) >= np.abs(tst))/reps
return tst, left_pv, right_pv, two_sided_pv, sims
def stratified_permutationtest_mean(group, condition, response,
groups, conditions):
"""
Calculates variability in sample means between treatment conditions,
within groups.
If there are two treatment conditions, the test statistic is the
difference in means, aggregated across groups.
If there are more than two treatment conditions, the test statistic
is the standard deviation of the means, aggregated across groups.
Parameters
----------
group : int
The
Returns
-------
tst : float
The
"""
tst = 0.0
if len(groups) < 2:
raise ValueError('Number of groups must be at least 2.')
elif len(groups) == 2:
stat = lambda u: u[0] - u[1]
elif len(groups) > 2:
stat = np.std
for g in groups:
gg = group == g
x = [gg & (condition == c) for c in conditions]
tst += stat([response[x[j]].mean() for j in range(len(x))])
return tst
def stratified_permutationtest(group, condition, response, iterations=1.0e4,
testStatistic=stratified_permutationtest_mean,
seed=None):
"""
Stratified permutation test using the sum of the differences in means
between two or more conditions in each group (stratum) as the test
statistic.
The test statistic is
.. math:: \sum_{g \in \\text{groups}} [
f(mean(\\text{response for cases in group $g$
assigned to each condition}))].
The function f is the difference if there are two conditions, and
the standard deviation if there are more than two conditions.
There should be at least one group and at least two conditions.
Under the null hypothesis, all assignments to the two conditions that
preserve the number of cases assigned to the conditions are equally
likely.
Groups in which all cases are assigned to the same condition are
skipped; they do not contribute to the p-value since all randomizations
give the same contribution to the difference in means.
Parameters
----------
group : int
The
seed : RandomState instance or {None, int, RandomState instance}
If None, the pseudorandom number generator is the RandomState
instance used by `np.random`;
If int, seed is the seed used by the random number generator;
If RandomState instance, seed is the pseudorandom number generator
Returns
-------
permuted : int
The
"""
prng = get_prng(seed)
groups = np.unique(group)
conditions = np.unique(condition)
if len(conditions) < 2:
return 1.0, 1.0, 1.0, np.nan, None
else:
tst = testStatistic(group, condition, response, groups, conditions)
dist = np.zeros(iterations)
for i in range(int(iterations)):
dist[i] = testStatistic(group,
permute_within_groups(
condition, group, prng),
response, groups, conditions)
conds = [dist <= tst, dist >= tst, abs(dist) >= abs(tst)]
left_pv, right_pv, two_sided_pv = [np.count_nonzero(c)/iterations for c in conds]
return left_pv, right_pv, two_sided_pv, tst, dist
| {
"content_hash": "6907cd00e219334085bf44b856ab180b",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 89,
"avg_line_length": 31.61875,
"alnum_prop": 0.610990314291362,
"repo_name": "pbstark/permute",
"id": "5173fa452a015cb1acfec76ea80fe57359dbcc87",
"size": "5084",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "permute/stratified.py",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Makefile",
"bytes": "547"
},
{
"name": "Python",
"bytes": "68491"
}
],
"symlink_target": ""
} |
"""Utility functions that support testing.
All functions that can be commonly used by various tests.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import flatbuffers
from tensorflow.lite.python import schema_py_generated as schema_fb
TFLITE_SCHEMA_VERSION = 3
def build_mock_flatbuffer_model():
"""Creates a flatbuffer containing an example model."""
builder = flatbuffers.Builder(1024)
schema_fb.BufferStart(builder)
buffer0_offset = schema_fb.BufferEnd(builder)
schema_fb.BufferStartDataVector(builder, 10)
builder.PrependUint8(9)
builder.PrependUint8(8)
builder.PrependUint8(7)
builder.PrependUint8(6)
builder.PrependUint8(5)
builder.PrependUint8(4)
builder.PrependUint8(3)
builder.PrependUint8(2)
builder.PrependUint8(1)
builder.PrependUint8(0)
buffer1_data_offset = builder.EndVector(10)
schema_fb.BufferStart(builder)
schema_fb.BufferAddData(builder, buffer1_data_offset)
buffer1_offset = schema_fb.BufferEnd(builder)
schema_fb.BufferStart(builder)
buffer2_offset = schema_fb.BufferEnd(builder)
schema_fb.ModelStartBuffersVector(builder, 3)
builder.PrependUOffsetTRelative(buffer2_offset)
builder.PrependUOffsetTRelative(buffer1_offset)
builder.PrependUOffsetTRelative(buffer0_offset)
buffers_offset = builder.EndVector(3)
string0_offset = builder.CreateString('input_tensor')
schema_fb.TensorStartShapeVector(builder, 3)
builder.PrependInt32(1)
builder.PrependInt32(2)
builder.PrependInt32(5)
shape0_offset = builder.EndVector(3)
schema_fb.TensorStart(builder)
schema_fb.TensorAddName(builder, string0_offset)
schema_fb.TensorAddShape(builder, shape0_offset)
schema_fb.TensorAddType(builder, 0)
schema_fb.TensorAddBuffer(builder, 0)
tensor0_offset = schema_fb.TensorEnd(builder)
schema_fb.QuantizationParametersStartMinVector(builder, 5)
builder.PrependFloat32(0.5)
builder.PrependFloat32(2.0)
builder.PrependFloat32(5.0)
builder.PrependFloat32(10.0)
builder.PrependFloat32(20.0)
quant1_min_offset = builder.EndVector(5)
schema_fb.QuantizationParametersStartMaxVector(builder, 5)
builder.PrependFloat32(10.0)
builder.PrependFloat32(20.0)
builder.PrependFloat32(-50.0)
builder.PrependFloat32(1.0)
builder.PrependFloat32(2.0)
quant1_max_offset = builder.EndVector(5)
schema_fb.QuantizationParametersStartScaleVector(builder, 5)
builder.PrependFloat32(3.0)
builder.PrependFloat32(4.0)
builder.PrependFloat32(5.0)
builder.PrependFloat32(6.0)
builder.PrependFloat32(7.0)
quant1_scale_offset = builder.EndVector(5)
schema_fb.QuantizationParametersStartZeroPointVector(builder, 5)
builder.PrependInt64(1)
builder.PrependInt64(2)
builder.PrependInt64(3)
builder.PrependInt64(-1)
builder.PrependInt64(-2)
quant1_zero_point_offset = builder.EndVector(5)
schema_fb.QuantizationParametersStart(builder)
schema_fb.QuantizationParametersAddMin(builder, quant1_min_offset)
schema_fb.QuantizationParametersAddMax(builder, quant1_max_offset)
schema_fb.QuantizationParametersAddScale(builder, quant1_scale_offset)
schema_fb.QuantizationParametersAddZeroPoint(builder,
quant1_zero_point_offset)
quantization1_offset = schema_fb.QuantizationParametersEnd(builder)
string1_offset = builder.CreateString('constant_tensor')
schema_fb.TensorStartShapeVector(builder, 3)
builder.PrependInt32(1)
builder.PrependInt32(2)
builder.PrependInt32(5)
shape1_offset = builder.EndVector(3)
schema_fb.TensorStart(builder)
schema_fb.TensorAddName(builder, string1_offset)
schema_fb.TensorAddShape(builder, shape1_offset)
schema_fb.TensorAddType(builder, 0)
schema_fb.TensorAddBuffer(builder, 1)
schema_fb.TensorAddQuantization(builder, quantization1_offset)
tensor1_offset = schema_fb.TensorEnd(builder)
string2_offset = builder.CreateString('output_tensor')
schema_fb.TensorStartShapeVector(builder, 3)
builder.PrependInt32(1)
builder.PrependInt32(2)
builder.PrependInt32(5)
shape2_offset = builder.EndVector(3)
schema_fb.TensorStart(builder)
schema_fb.TensorAddName(builder, string2_offset)
schema_fb.TensorAddShape(builder, shape2_offset)
schema_fb.TensorAddType(builder, 0)
schema_fb.TensorAddBuffer(builder, 2)
tensor2_offset = schema_fb.TensorEnd(builder)
schema_fb.SubGraphStartTensorsVector(builder, 3)
builder.PrependUOffsetTRelative(tensor2_offset)
builder.PrependUOffsetTRelative(tensor1_offset)
builder.PrependUOffsetTRelative(tensor0_offset)
tensors_offset = builder.EndVector(3)
schema_fb.SubGraphStartInputsVector(builder, 1)
builder.PrependInt32(0)
inputs_offset = builder.EndVector(1)
schema_fb.SubGraphStartOutputsVector(builder, 1)
builder.PrependInt32(2)
outputs_offset = builder.EndVector(1)
schema_fb.OperatorCodeStart(builder)
schema_fb.OperatorCodeAddBuiltinCode(builder, schema_fb.BuiltinOperator.ADD)
schema_fb.OperatorCodeAddDeprecatedBuiltinCode(builder,
schema_fb.BuiltinOperator.ADD)
schema_fb.OperatorCodeAddVersion(builder, 1)
code_offset = schema_fb.OperatorCodeEnd(builder)
schema_fb.ModelStartOperatorCodesVector(builder, 1)
builder.PrependUOffsetTRelative(code_offset)
codes_offset = builder.EndVector(1)
schema_fb.OperatorStartInputsVector(builder, 2)
builder.PrependInt32(0)
builder.PrependInt32(1)
op_inputs_offset = builder.EndVector(2)
schema_fb.OperatorStartOutputsVector(builder, 1)
builder.PrependInt32(2)
op_outputs_offset = builder.EndVector(1)
schema_fb.OperatorStart(builder)
schema_fb.OperatorAddOpcodeIndex(builder, 0)
schema_fb.OperatorAddInputs(builder, op_inputs_offset)
schema_fb.OperatorAddOutputs(builder, op_outputs_offset)
op_offset = schema_fb.OperatorEnd(builder)
schema_fb.SubGraphStartOperatorsVector(builder, 1)
builder.PrependUOffsetTRelative(op_offset)
ops_offset = builder.EndVector(1)
string3_offset = builder.CreateString('subgraph_name')
schema_fb.SubGraphStart(builder)
schema_fb.SubGraphAddName(builder, string3_offset)
schema_fb.SubGraphAddTensors(builder, tensors_offset)
schema_fb.SubGraphAddInputs(builder, inputs_offset)
schema_fb.SubGraphAddOutputs(builder, outputs_offset)
schema_fb.SubGraphAddOperators(builder, ops_offset)
subgraph_offset = schema_fb.SubGraphEnd(builder)
schema_fb.ModelStartSubgraphsVector(builder, 1)
builder.PrependUOffsetTRelative(subgraph_offset)
subgraphs_offset = builder.EndVector(1)
signature_method = builder.CreateString('my_method')
signature_key = builder.CreateString('my_key')
input_tensor_string = builder.CreateString('input_tensor')
output_tensor_string = builder.CreateString('output_tensor')
# Signature Inputs
schema_fb.TensorMapStart(builder)
schema_fb.TensorMapAddName(builder, input_tensor_string)
schema_fb.TensorMapAddTensorIndex(builder, 1)
input_tensor = schema_fb.TensorMapEnd(builder)
# Signature Outputs
schema_fb.TensorMapStart(builder)
schema_fb.TensorMapAddName(builder, output_tensor_string)
schema_fb.TensorMapAddTensorIndex(builder, 2)
output_tensor = schema_fb.TensorMapEnd(builder)
schema_fb.SignatureDefStartInputsVector(builder, 1)
builder.PrependUOffsetTRelative(input_tensor)
signature_inputs_offset = builder.EndVector(1)
schema_fb.SignatureDefStartOutputsVector(builder, 1)
builder.PrependUOffsetTRelative(output_tensor)
signature_outputs_offset = builder.EndVector(1)
schema_fb.SignatureDefStart(builder)
schema_fb.SignatureDefAddKey(builder, signature_key)
schema_fb.SignatureDefAddMethodName(builder, signature_method)
schema_fb.SignatureDefAddInputs(builder, signature_inputs_offset)
schema_fb.SignatureDefAddOutputs(builder, signature_outputs_offset)
signature_offset = schema_fb.SignatureDefEnd(builder)
schema_fb.ModelStartSignatureDefsVector(builder, 1)
builder.PrependUOffsetTRelative(signature_offset)
signature_defs_offset = builder.EndVector(1)
string4_offset = builder.CreateString('model_description')
schema_fb.ModelStart(builder)
schema_fb.ModelAddVersion(builder, TFLITE_SCHEMA_VERSION)
schema_fb.ModelAddOperatorCodes(builder, codes_offset)
schema_fb.ModelAddSubgraphs(builder, subgraphs_offset)
schema_fb.ModelAddDescription(builder, string4_offset)
schema_fb.ModelAddBuffers(builder, buffers_offset)
schema_fb.ModelAddSignatureDefs(builder, signature_defs_offset)
model_offset = schema_fb.ModelEnd(builder)
builder.Finish(model_offset)
model = builder.Output()
return model
def load_model_from_flatbuffer(flatbuffer_model):
"""Loads a model as a python object from a flatbuffer model."""
model = schema_fb.Model.GetRootAsModel(flatbuffer_model, 0)
model = schema_fb.ModelT.InitFromObj(model)
return model
def build_mock_model():
"""Creates an object containing an example model."""
model = build_mock_flatbuffer_model()
return load_model_from_flatbuffer(model)
| {
"content_hash": "860c863ea04dc77d2f3b89ba5b30d018",
"timestamp": "",
"source": "github",
"line_count": 244,
"max_line_length": 79,
"avg_line_length": 36.78688524590164,
"alnum_prop": 0.7842023172905526,
"repo_name": "petewarden/tensorflow",
"id": "f2d0e29f6700420cd23a069de9b59745e34f726e",
"size": "9665",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "tensorflow/lite/tools/test_utils.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "31796"
},
{
"name": "Batchfile",
"bytes": "55269"
},
{
"name": "C",
"bytes": "895451"
},
{
"name": "C#",
"bytes": "8562"
},
{
"name": "C++",
"bytes": "82100676"
},
{
"name": "CMake",
"bytes": "6500"
},
{
"name": "Dockerfile",
"bytes": "112853"
},
{
"name": "Go",
"bytes": "1867248"
},
{
"name": "HTML",
"bytes": "4686483"
},
{
"name": "Java",
"bytes": "984477"
},
{
"name": "Jupyter Notebook",
"bytes": "550862"
},
{
"name": "LLVM",
"bytes": "6536"
},
{
"name": "MLIR",
"bytes": "1982867"
},
{
"name": "Makefile",
"bytes": "66496"
},
{
"name": "Objective-C",
"bytes": "116558"
},
{
"name": "Objective-C++",
"bytes": "317461"
},
{
"name": "PHP",
"bytes": "4236"
},
{
"name": "Pascal",
"bytes": "318"
},
{
"name": "Pawn",
"bytes": "20422"
},
{
"name": "Perl",
"bytes": "7536"
},
{
"name": "Python",
"bytes": "37425809"
},
{
"name": "RobotFramework",
"bytes": "1779"
},
{
"name": "Roff",
"bytes": "2705"
},
{
"name": "Ruby",
"bytes": "7464"
},
{
"name": "SWIG",
"bytes": "8992"
},
{
"name": "Shell",
"bytes": "700106"
},
{
"name": "Smarty",
"bytes": "35725"
},
{
"name": "Starlark",
"bytes": "3613406"
},
{
"name": "Swift",
"bytes": "62814"
},
{
"name": "Vim Snippet",
"bytes": "58"
}
],
"symlink_target": ""
} |
'''
Command line option definitions
'''
def add_params(subparsers):
# list
list_parser = subparsers.add_parser(
'list',
help='List VMware objects on your VMware server'
)
list_parser.add_argument(
'--type',
required=True,
help='Object type, e.g. Network, VirtualMachine.'
)
# clone
clone_parser = subparsers.add_parser(
'clone',
help='Clone a VM template to a new VM'
)
clone_parser.add_argument(
'--server',
type=str,
help='vCenter server',
)
clone_parser.add_argument(
'--port',
type=str,
help='vCenter server port',
)
clone_parser.add_argument(
'--username',
type=str,
help='vCenter username',
)
clone_parser.add_argument(
'--password',
type=str,
help='vCenter password',
)
clone_parser.add_argument(
'--template',
type=str,
help='VM template name to clone from'
)
clone_parser.add_argument(
'--hostname',
required=True,
type=str,
help='New host name',
)
clone_parser.add_argument(
'--ips',
type=str,
help='Static IPs of new host, separated by a space. '
'List primary IP first.',
nargs='+',
)
clone_parser.add_argument(
'--cpus',
type=int,
help='Number of CPUs'
)
clone_parser.add_argument(
'--mem',
type=int,
help='Memory in GB'
)
clone_parser.add_argument(
'--domain',
type=str,
help='Domain, e.g. "example.com"'
)
# destroy
destroy_parser = subparsers.add_parser(
'destroy',
help='Destroy/delete a Virtual Machine'
)
destroy_parser.add_argument(
'--name',
required=True,
help='VM name (case-sensitive)'
)
| {
"content_hash": "fa30b52caafba9c2da3506f181015845",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 61,
"avg_line_length": 22,
"alnum_prop": 0.5240334378265413,
"repo_name": "mvk/ezmomi",
"id": "dfd2edc04b811f503897414817829aab96acdc94",
"size": "1914",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "ezmomi/params.py",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
"""Basic sanity tests for the GTalk extension.
This module contains the basic set of sanity tests run on the
GTalk extension.
"""
import logging
import sys
import time
import traceback
import urllib2
import os
import gtalk_base_test
import pyauto_gtalk # must preceed pyauto
import pyauto
class BasicTest(gtalk_base_test.GTalkBaseTest):
"""Test for Google Talk Chrome Extension."""
def _OpenRoster(self, gtalk_version):
"""Download Talk extension and open the roster."""
self.InstallGTalkExtension(gtalk_version)
# Wait for the background view to load.
extension = self.GetGTalkExtensionInfo()
background_view = self.WaitUntilExtensionViewLoaded(
extension_id=extension['id'],
view_type='EXTENSION_BACKGROUND_PAGE')
self.assertTrue(background_view,
msg='Failed to get background view: views = %s.' %
self.GetBrowserInfo()['extension_views'])
# Click browser action icon
self.TriggerBrowserActionById(extension['id'])
# Wait for viewer window to open.
self.assertTrue(
self.WaitUntil(self.GetViewerInfo),
msg='Timed out waiting for viewer.html to open.')
# Wait for all iframes to load.
self.WaitUntilResult(True,
lambda: self.RunInViewer(
'window.document.getElementsByTagName("iframe") != null && '
'window.document.getElementsByTagName("iframe").length > 0'),
msg='Timed out waiting for iframes to load.')
# Wait for viewer window to load the sign-in page.
self.WaitUntilCondition(
lambda: self.RunInViewer('window.location.href',
'//iframe[1]'),
lambda url: url and '/qsignin' in url,
msg='Timed out waiting for /qsignin page.')
def _SignIn(self, gtalk_version):
"""Download the extension, open the roster, and sign in"""
# Open the roster.
self._OpenRoster(gtalk_version)
# Wait for /qsignin's BODY.
self.WaitUntilResult(True,
lambda: self.RunInViewer(
'Boolean($BODY())', '//iframe[1]'),
msg='Timed out waiting for document.body in /qsignin page.')
# Wait for the "Sign In" link.
self.WaitUntilResult(True,
lambda: self.RunInViewer(
'Boolean($FindByText($BODY(), "Sign In"))', '//iframe[1]'),
msg='Timed out waiting for "Sign In" link in DOM.')
# Click the "Sign In" link.
self.assertTrue(self.RunInViewer(
'$Click($FindByText($BODY(), "Sign In"))', '//iframe[1]'))
# Wait for the login page to open.
self.assertTrue(self.WaitUntil(self.GetLoginPageInfo),
msg='Timed out waiting for login page to open.')
# Wait for the login page's form element.
self.WaitUntilResult(True,
lambda: self.RunInLoginPage('Boolean(document.forms[0])'),
msg='Timed out waiting for document.forms[0].')
# Fill and submit the login form.
credentials = self.GetPrivateInfo()['test_google_account']
self.RunInLoginPage(
'document.forms[0].Email.value="' + credentials['username'] + '"')
self.RunInLoginPage(
'document.forms[0].Passwd.value="' + credentials['password'] + '"')
self.RunInLoginPage('document.forms[0].submit() || true')
def RunBasicFunctionalityTest(self, gtalk_version):
"""Run tests for basic functionality in GTalk."""
# Install the extension, open the viewer, and sign in.
self._SignIn(gtalk_version)
# Wait for the roster container iframe.
self.WaitUntilResult(True,
lambda: self.RunInViewer(
'window.document.getElementById("popoutRoster") != null'),
msg='Timed out waiting for roster container iframe.')
self.WaitUntilResult(True,
lambda: self.RunInViewer('Boolean(window.frames[0])', '//iframe[1]'),
msg='Timed out waiting for roster iframe.')
# Wait for the roster iframe to load.
self.WaitUntilCondition(
lambda: self.RunInRoster('window.location.href'),
lambda url: url and 'prop=aChromeExtension#p' in url,
msg='Timed out waiting for prop=aChromeExtension#p in url.')
self.WaitUntilResult(True,
lambda: self.RunInRoster(
'Boolean($FindByText($BODY(), "Send a message to..."))'),
msg='Timed out waiting for "Send a message to..." label in roster DOM.')
# Wait for "[email protected]" to appear in the roster.
self.WaitUntilResult(True,
lambda: self.RunInRoster(
'Boolean($FindByText($BODY(), "[email protected]"))'),
msg='Timed out waiting for [email protected] in roster DOM.')
# Works around for issue where mole doesn't open when clicked too quickly.
time.sleep(1)
# Click "[email protected]" to open a chat mole.
self.RunInRoster('$Click($FindByText($BODY(), "[email protected]"))')
# Wait until ready to check whether mole is open(temporary work around).
time.sleep(1)
# Wait for chat mole to open.
self.assertTrue(self.WaitUntil(self.GetMoleInfo),
msg='Timed out waiting for mole window to open.')
self.WaitUntilResult(True,
lambda: self.RunInViewer(
'window.document.getElementsByTagName("iframe") != null'),
msg='Timed out waiting for iframes to load.')
# Wait for chat mole to load.
self.WaitUntilResult(True,
lambda: self.RunInMole('Boolean(window.location.href)'),
msg='Timed out waiting for mole window location.')
# Wait for the chat mole's input textarea to load.
self.WaitUntilResult(True,
lambda: self.RunInMole(
'Boolean($FindByTagName($BODY(), "textarea", 0))'),
msg='Timed out waiting for mole textarea.')
# Type /ping in the mole's input widget.
self.assertTrue(self.RunInMole(
'$Type($FindByTagName($BODY(), "textarea", 0), "/ping")'),
msg='Error typing in mole textarea.')
# Type ENTER in the mole's input widget.
self.assertTrue(self.RunInMole(
'$Press($FindByTagName($BODY(),"textarea",0), $KEYS.ENTER)'),
msg='Error sending ENTER in mole textarea.')
# Wait for chat input to clear.
self.WaitUntilResult(True,
lambda: self.RunInMole(
'Boolean($FindByTagName($BODY(),"textarea",0).value=="")'),
msg='Timed out waiting for textarea to clear after ENTER.')
# Wait for /ping to appear in the chat history.
self.WaitUntilCondition(
lambda: self.RunInMole('window.document.body.innerHTML'),
lambda html: html and '/ping' in html,
msg='Timed out waiting for /ping to appear in mole DOM.')
# Wait for the echo "Ping!" to appear in the chat history.
self.WaitUntilCondition(
lambda: self.RunInMole('window.document.body.innerHTML'),
lambda html: html and 'Ping!' in html,
msg='Timed out waiting for "Ping!" reply to appear in mole DOM.')
# Request a ping in 7 seconds.
self.assertTrue(self.RunInMole(
'$Type($FindByTagName($BODY(),"textarea",0), "/ping 7")'),
msg='Error typing "ping /7" in mole textarea.')
# Press Enter in chat input.
self.assertTrue(self.RunInMole(
'$Press($FindByTagName($BODY(),"textarea",0), $KEYS.ENTER)'),
msg='Error sending ENTER after "ping /7" in mole textarea.')
# Briefly show mole for visual examination.
# Also works around issue where extension may show the first
# Ping! notification before closing the mole.
time.sleep(2)
# Press escape to close the mole.
self.assertTrue(self.RunInMole(
'$Press($FindByTagName($BODY(),"textarea",0), $KEYS.ESC)'),
msg='Error sending ESC after "ping /7" in mole textarea.')
# Wait for the mole to close.
self.assertTrue(self.WaitUntil(
lambda: not(bool(self.GetMoleInfo()))),
msg='Timed out waiting for chatpinger mole to close.')
# Ensure "[email protected]" is in the roster.
self.WaitUntilResult(True,
lambda: self.RunInRoster(
'Boolean($FindByText($BODY(), "[email protected]"))'),
msg='Timed out waiting for [email protected] in roster DOM.')
# Click "[email protected]" in the roster.
self.RunInRoster('$Click($FindByText($BODY(), "[email protected]"))')
self.WaitUntilResult(True,
lambda: self.RunInViewer(
'window.document.getElementsByTagName("iframe") != null'),
msg='Timed out waiting for iframes to load.')
# Wait for a second chat mole to open.
time.sleep(1)
self.assertTrue(self.WaitUntil(lambda: bool(self.GetMoleInfo(1))),
msg='Timed out waiting for second mole window to open.')
# Wait for mole content to load
self.WaitUntilCondition(
lambda: self.RunInMole('window.document.body.innerHTML', 1),
lambda html: html and 'Ping!' in html,
msg='Timed out waiting for Ping! to appear in mole DOM.')
# Disable the extension.
extension = self.GetGTalkExtensionInfo()
self.SetExtensionStateById(extension['id'], enable=False,
allow_in_incognito=False)
extension = self.GetGTalkExtensionInfo()
self.assertFalse(extension['is_enabled'])
# Verify all moles + windows are closed.
self.assertTrue(self.WaitUntil(lambda: not(bool(self.GetViewerInfo()))),
msg='Timed out waiting for viewer.html to close after disabling.')
self.assertTrue(self.WaitUntil(lambda: not(bool(self.GetMoleInfo()))),
msg='Timed out waiting for first mole to close after disabling.')
self.assertTrue(self.WaitUntil(lambda: not(bool(self.GetMoleInfo(1)))),
msg='Timed out waiting for second mole to close after disabling.')
def _GetCurrentGtalkVersion(self):
"""Read current gtalk extension version from file."""
return self._GetGtalkVersion('current_version')
def _GetRCGtalkVersion(self):
"""Read RC gtalk extension version from file"""
return self._GetGtalkVersion('rc_version')
def _GetGtalkVersion(self, version_type):
"""Read gtalk version from file"""
version_path = os.path.abspath(
os.path.join(self.DataDir(), 'extensions',
'gtalk', version_type))
self.assertTrue(
os.path.exists(version_path),
msg='Failed to find version ' + version_path)
with open(version_path) as version_file:
return version_file.read()
def _TestBasicFunctionality(self, version):
"""Run tests for basic functionality in GTalk with retries."""
# Since this test goes against prod servers, we'll retry to mitigate
# flakiness due to network issues.
RETRIES = 5
for tries in range(RETRIES):
logging.info('Calling RunBasicFunctionalityTest on %s. Try #%s/%s'
% (version, tries + 1, RETRIES))
try:
self.RunBasicFunctionalityTest(version)
logging.info('RunBasicFunctionalityTest on %s succeeded. Tries: %s'
% (version, tries + 1))
break
except Exception as e:
logging.info("\n*** ERROR in RunBasicFunctionalityTest ***")
exc_type, exc_value, exc_traceback = sys.exc_info()
traceback.print_exception(exc_type, exc_value, exc_traceback)
logging.info("\n")
if tries < RETRIES - 1:
self.NavigateToURL('http://accounts.google.com/Logout')
logging.info('Retrying...')
else:
raise
def testCurrentVersion(self):
"""Run basic functionality test on current version of gtalk extension"""
version = self._GetCurrentGtalkVersion()
self._TestBasicFunctionality(version)
def testRCVersion(self):
"""Run basic functionality test on RC version of gtalk extension"""
version = self._GetRCGtalkVersion()
self._TestBasicFunctionality(version)
if __name__ == '__main__':
pyauto_gtalk.Main()
| {
"content_hash": "aa1c5fa978848c423b09ac8f9769e5f6",
"timestamp": "",
"source": "github",
"line_count": 307,
"max_line_length": 80,
"avg_line_length": 38.237785016286644,
"alnum_prop": 0.6585739841553795,
"repo_name": "junmin-zhu/chromium-rivertrail",
"id": "4dc1f71b9efa8f245c0d03c3d79f6c13d96c8cce",
"size": "11928",
"binary": false,
"copies": "3",
"ref": "refs/heads/v8-binding",
"path": "chrome/test/functional/gtalk/test_basic.py",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "853"
},
{
"name": "AppleScript",
"bytes": "6973"
},
{
"name": "Arduino",
"bytes": "464"
},
{
"name": "Assembly",
"bytes": "1172794"
},
{
"name": "Awk",
"bytes": "9519"
},
{
"name": "C",
"bytes": "75806807"
},
{
"name": "C#",
"bytes": "1132"
},
{
"name": "C++",
"bytes": "145161929"
},
{
"name": "DOT",
"bytes": "1559"
},
{
"name": "F#",
"bytes": "381"
},
{
"name": "Java",
"bytes": "1546515"
},
{
"name": "JavaScript",
"bytes": "18675242"
},
{
"name": "Logos",
"bytes": "4517"
},
{
"name": "Matlab",
"bytes": "5234"
},
{
"name": "Objective-C",
"bytes": "6981387"
},
{
"name": "PHP",
"bytes": "97817"
},
{
"name": "Perl",
"bytes": "926245"
},
{
"name": "Python",
"bytes": "8088373"
},
{
"name": "R",
"bytes": "262"
},
{
"name": "Ragel in Ruby Host",
"bytes": "3239"
},
{
"name": "Shell",
"bytes": "1513486"
},
{
"name": "Tcl",
"bytes": "277077"
},
{
"name": "XML",
"bytes": "13493"
}
],
"symlink_target": ""
} |
"""
Example "Arcade" library code.
This example shows the drawing primitives and how they are used.
It does not assume the programmer knows how to define functions or classes
yet.
API documentation for the draw commands can be found here:
https://pythonhosted.org/arcade/arcade.html#module-arcade.draw_commands
A video explaining this example can be found here:
https://vimeo.com/167158158
"""
# Import the Arcade library. If this fails, then try following the instructions
# for how to install arcade:
# https://pythonhosted.org/arcade/installation.html
import arcade
# Open the window. Set the window title and dimensions (width and height)
arcade.open_window("Drawing Example", 600, 600)
# Set the background color to white
# For a list of named colors see
# https://pythonhosted.org/arcade/arcade.color.html
# Colors can also be specified in (red, green, blue) format and
# (red, green, blue, alpha) format.
arcade.set_background_color(arcade.color.WHITE)
# Start the render process. This must be done before any drawing commands.
arcade.start_render()
# Draw a grid
# Draw vertical lines every 120 pixels
for x in range(0, 601, 120):
arcade.draw_line(x, 0, x, 600, arcade.color.BLACK, 2)
# Draw horizontal lines every 200 pixels
for y in range(0, 601, 200):
arcade.draw_line(0, y, 800, y, arcade.color.BLACK, 2)
# Draw a point
arcade.draw_text("draw_point", 3, 405, arcade.color.BLACK, 12)
arcade.draw_point(60, 495, arcade.color.RED, 10)
# Draw a set of points
arcade.draw_text("draw_points", 123, 405, arcade.color.BLACK, 12)
point_list = ((165, 495),
(165, 480),
(165, 465),
(195, 495),
(195, 480),
(195, 465))
arcade.draw_points(point_list, arcade.color.ZAFFRE, 10)
# Draw a line
arcade.draw_text("draw_line", 243, 405, arcade.color.BLACK, 12)
arcade.draw_line(270, 495, 300, 450, arcade.color.WOOD_BROWN, 3)
# Draw a set of lines
arcade.draw_text("draw_lines", 363, 405, arcade.color.BLACK, 12)
point_list = ((390, 450),
(450, 450),
(390, 480),
(450, 480),
(390, 510),
(450, 510)
)
arcade.draw_lines(point_list, arcade.color.BLUE, 3)
# Draw a line strip
arcade.draw_text("draw_line_strip", 483, 405, arcade.color.BLACK, 12)
point_list = ((510, 450),
(570, 450),
(510, 480),
(570, 480),
(510, 510),
(570, 510)
)
arcade.draw_line_strip(point_list, arcade.color.TROPICAL_RAIN_FOREST, 3)
# Draw a polygon
arcade.draw_text("draw_polygon_outline", 3, 207, arcade.color.BLACK, 9)
point_list = ((30, 240),
(45, 240),
(60, 255),
(60, 285),
(45, 300),
(30, 300))
arcade.draw_polygon_outline(point_list, arcade.color.SPANISH_VIOLET, 3)
# Draw a filled in polygon
arcade.draw_text("draw_polygon_filled", 123, 207, arcade.color.BLACK, 9)
point_list = ((150, 240),
(165, 240),
(180, 255),
(180, 285),
(165, 300),
(150, 300))
arcade.draw_polygon_filled(point_list, arcade.color.SPANISH_VIOLET)
# Draw an outline of a circle
arcade.draw_text("draw_circle_outline", 243, 207, arcade.color.BLACK, 10)
arcade.draw_circle_outline(300, 285, 18, arcade.color.WISTERIA, 3)
# Draw a filled in circle
arcade.draw_text("draw_circle_filled", 363, 207, arcade.color.BLACK, 10)
arcade.draw_circle_filled(420, 285, 18, arcade.color.GREEN)
# Draw an ellipse outline, and another one rotated
arcade.draw_text("draw_ellipse_outline", 483, 207, arcade.color.BLACK, 10)
arcade.draw_ellipse_outline(540, 273, 15, 36, arcade.color.AMBER, 3)
arcade.draw_ellipse_outline(540, 336, 15, 36,
arcade.color.BLACK_BEAN, 3, 45)
# Draw a filled ellipse, and another one rotated
arcade.draw_text("draw_ellipse_filled", 3, 3, arcade.color.BLACK, 10)
arcade.draw_ellipse_filled(60, 81, 15, 36, arcade.color.AMBER)
arcade.draw_ellipse_filled(60, 144, 15, 36,
arcade.color.BLACK_BEAN, 45)
# Draw an arc, and another one rotated
arcade.draw_text("draw_arc/filled_arc", 123, 3, arcade.color.BLACK, 10)
arcade.draw_arc_outline(150, 81, 15, 36,
arcade.color.BRIGHT_MAROON, 90, 360)
arcade.draw_arc_filled(150, 144, 15, 36,
arcade.color.BOTTLE_GREEN, 90, 360, 45)
# Draw an rectangle outline
arcade.draw_text("draw_rect", 243, 3, arcade.color.BLACK, 10)
arcade.draw_rectangle_outline(295, 100, 45, 65,
arcade.color.BRITISH_RACING_GREEN)
arcade.draw_rectangle_outline(295, 160, 20, 45,
arcade.color.BRITISH_RACING_GREEN, 3, 45)
# Draw a filled in rectangle
arcade.draw_text("draw_filled_rect", 363, 3, arcade.color.BLACK, 10)
arcade.draw_rectangle_filled(420, 100, 45, 65, arcade.color.BLUSH)
arcade.draw_rectangle_filled(420, 160, 20, 40, arcade.color.BLUSH, 45)
# Load and draw an image to the screen
# Image from kenney.nl asset pack #1
arcade.draw_text("draw_bitmap", 483, 3, arcade.color.BLACK, 12)
texture = arcade.load_texture("images/playerShip1_orange.png")
scale = .6
arcade.draw_texture_rectangle(540, 120, scale * texture.width,
scale * texture.height, texture, 0)
arcade.draw_texture_rectangle(540, 60, scale * texture.width,
scale * texture.height, texture, 45)
# Finish the render.
# Nothing will be drawn without this.
# Must happen after all draw commands
arcade.finish_render()
# Keep the window up until someone closes it.
arcade.run()
| {
"content_hash": "b6897e3c6f919f2c596cc493704e7f22",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 79,
"avg_line_length": 35.92993630573248,
"alnum_prop": 0.6489984045382025,
"repo_name": "mikemhenry/arcade",
"id": "be2f6061924fe07513efb8e943cf446e4b49d97c",
"size": "5641",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "examples/drawing_primitives.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "640"
},
{
"name": "Python",
"bytes": "166157"
},
{
"name": "Shell",
"bytes": "593"
}
],
"symlink_target": ""
} |
"""This module contains constants used by cbuildbot and related code."""
import os
def _FindSourceRoot():
"""Try and find the root check out of the chromiumos tree"""
source_root = path = os.path.realpath(os.path.join(
os.path.abspath(__file__), '..', '..', '..'))
while True:
if os.path.isdir(os.path.join(path, '.repo')):
return path
elif path == '/':
break
path = os.path.dirname(path)
return source_root
SOURCE_ROOT = _FindSourceRoot()
CHROOT_SOURCE_ROOT = '/mnt/host/source'
CROSUTILS_DIR = os.path.join(SOURCE_ROOT, 'src/scripts')
CHROMITE_DIR = os.path.join(SOURCE_ROOT, 'chromite')
CHROMITE_BIN_SUBDIR = 'chromite/bin'
CHROMITE_BIN_DIR = os.path.join(SOURCE_ROOT, CHROMITE_BIN_SUBDIR)
PATH_TO_CBUILDBOT = os.path.join(CHROMITE_BIN_SUBDIR, 'cbuildbot')
DEFAULT_CHROOT_DIR = 'chroot'
SDK_TOOLCHAINS_OUTPUT = 'tmp/toolchain-pkgs'
AUTOTEST_BUILD_PATH = 'usr/local/build/autotest'
# TODO: Eliminate these or merge with manifest_version.py:STATUS_PASSED
# crbug.com/318930
FINAL_STATUS_PASSED = 'passed'
FINAL_STATUS_FAILED = 'failed'
# Re-execution API constants.
# Used by --resume and --bootstrap to decipher which options they
# can pass to the target cbuildbot (since it may not have that
# option).
# Format is Major:Minor. Minor is used for tracking new options added
# that aren't critical to the older version if it's not ran.
# Major is used for tracking heavy API breakage- for example, no longer
# supporting the --resume option.
REEXEC_API_MAJOR = 0
REEXEC_API_MINOR = 2
REEXEC_API_VERSION = '%i.%i' % (REEXEC_API_MAJOR, REEXEC_API_MINOR)
ISOLATESERVER = 'https://isolateserver.appspot.com'
GOOGLE_EMAIL = '@google.com'
CHROMIUM_EMAIL = '@chromium.org'
CORP_DOMAIN = 'corp.google.com'
GOLO_DOMAIN = 'golo.chromium.org'
GOB_HOST = '%s.googlesource.com'
EXTERNAL_GOB_INSTANCE = 'chromium'
EXTERNAL_GERRIT_INSTANCE = 'chromium-review'
EXTERNAL_GOB_HOST = GOB_HOST % EXTERNAL_GOB_INSTANCE
EXTERNAL_GERRIT_HOST = GOB_HOST % EXTERNAL_GERRIT_INSTANCE
EXTERNAL_GOB_URL = 'https://%s' % EXTERNAL_GOB_HOST
EXTERNAL_GERRIT_URL = 'https://%s' % EXTERNAL_GERRIT_HOST
INTERNAL_GOB_INSTANCE = 'chrome-internal'
INTERNAL_GERRIT_INSTANCE = 'chrome-internal-review'
INTERNAL_GOB_HOST = GOB_HOST % INTERNAL_GOB_INSTANCE
INTERNAL_GERRIT_HOST = GOB_HOST % INTERNAL_GERRIT_INSTANCE
INTERNAL_GOB_URL = 'https://%s' % INTERNAL_GOB_HOST
INTERNAL_GERRIT_URL = 'https://%s' % INTERNAL_GERRIT_HOST
REPO_PROJECT = 'external/repo'
REPO_URL = '%s/%s' % (EXTERNAL_GOB_URL, REPO_PROJECT)
CHROMITE_PROJECT = 'chromiumos/chromite'
CHROMITE_URL = '%s/%s' % (EXTERNAL_GOB_URL, CHROMITE_PROJECT)
CHROMIUM_SRC_PROJECT = 'chromium/src'
CHROMIUM_GOB_URL = '%s/%s.git' % (EXTERNAL_GOB_URL, CHROMIUM_SRC_PROJECT)
MANIFEST_PROJECT = 'chromiumos/manifest'
MANIFEST_INT_PROJECT = 'chromeos/manifest-internal'
MANIFEST_PROJECTS = (MANIFEST_PROJECT, MANIFEST_INT_PROJECT)
MANIFEST_URL = '%s/%s' % (EXTERNAL_GOB_URL, MANIFEST_PROJECT)
MANIFEST_INT_URL = '%s/%s' % (INTERNAL_GERRIT_URL, MANIFEST_INT_PROJECT)
DEFAULT_MANIFEST = 'default.xml'
OFFICIAL_MANIFEST = 'official.xml'
SHARED_CACHE_ENVVAR = 'CROS_CACHEDIR'
# CrOS remotes specified in the manifests.
EXTERNAL_REMOTE = 'cros'
INTERNAL_REMOTE = 'cros-internal'
CHROMIUM_REMOTE = 'chromium'
CHROME_REMOTE = 'chrome'
GERRIT_HOSTS = {
EXTERNAL_REMOTE: EXTERNAL_GERRIT_HOST,
INTERNAL_REMOTE: INTERNAL_GERRIT_HOST,
}
CROS_REMOTES = {
EXTERNAL_REMOTE: EXTERNAL_GOB_URL,
INTERNAL_REMOTE: INTERNAL_GOB_URL,
}
GIT_REMOTES = {
CHROMIUM_REMOTE: EXTERNAL_GOB_URL,
CHROME_REMOTE: INTERNAL_GOB_URL,
}
GIT_REMOTES.update(CROS_REMOTES)
# Prefix to distinguish internal and external changes. This is used
# when user specifies a patch with "-g", when generating a key for
# a patch to used in our PatchCache, and when display a custom string
# for the patch.
INTERNAL_CHANGE_PREFIX = '*'
EXTERNAL_CHANGE_PREFIX = ''
CHANGE_PREFIX = {
INTERNAL_REMOTE: INTERNAL_CHANGE_PREFIX,
EXTERNAL_REMOTE: EXTERNAL_CHANGE_PREFIX,
}
# List of remotes that are ok to include in the external manifest.
EXTERNAL_REMOTES = (EXTERNAL_REMOTE, CHROMIUM_REMOTE)
# Mapping 'remote name' -> regexp that matches names of repositories on that
# remote that can be branched when creating CrOS branch. Branching script will
# actually create a new git ref when branching these projects. It won't attempt
# to create a git ref for other projects that may be mentioned in a manifest.
BRANCHABLE_PROJECTS = {
EXTERNAL_REMOTE: r'chromiumos/(.+)',
INTERNAL_REMOTE: r'chromeos/(.+)',
}
# TODO(sosa): Move to manifest-versions-external once its created
MANIFEST_VERSIONS_SUFFIX = '/chromiumos/manifest-versions'
MANIFEST_VERSIONS_INT_SUFFIX = '/chromeos/manifest-versions'
MANIFEST_VERSIONS_GS_URL = 'gs://chromeos-manifest-versions'
TRASH_BUCKET = 'gs://chromeos-throw-away-bucket'
STREAK_COUNTERS = 'streak_counters'
PATCH_BRANCH = 'patch_branch'
STABLE_EBUILD_BRANCH = 'stabilizing_branch'
MERGE_BRANCH = 'merge_branch'
# These branches are deleted at the beginning of every buildbot run.
CREATED_BRANCHES = [
PATCH_BRANCH,
STABLE_EBUILD_BRANCH,
MERGE_BRANCH
]
# Constants for uprevving Chrome
# Portage category and package name for Chrome.
CHROME_PN = 'chromeos-chrome'
CHROME_CP = 'chromeos-base/%s' % CHROME_PN
# Chrome use flags
USE_CHROME_INTERNAL = 'chrome_internal'
USE_AFDO_USE = 'afdo_use'
# Builds and validates _alpha ebuilds. These builds sync to the latest
# revsion of the Chromium src tree and build with that checkout.
CHROME_REV_TOT = 'tot'
# Builds and validates chrome at a given revision through cbuildbot
# --chrome_version
CHROME_REV_SPEC = 'spec'
# Builds and validates the latest Chromium release as defined by
# ~/trunk/releases in the Chrome src tree. These ebuilds are suffixed with rc.
CHROME_REV_LATEST = 'latest_release'
# Builds and validates the latest Chromium release for a specific Chromium
# branch that we want to watch. These ebuilds are suffixed with rc.
CHROME_REV_STICKY = 'stable_release'
# Builds and validates Chromium for a pre-populated directory.
# Also uses _alpha, since portage doesn't have anything lower.
CHROME_REV_LOCAL = 'local'
VALID_CHROME_REVISIONS = [CHROME_REV_TOT, CHROME_REV_LATEST,
CHROME_REV_STICKY, CHROME_REV_LOCAL, CHROME_REV_SPEC]
# Build types supported.
# TODO(sosa): Deprecate PFQ type.
# Incremental builds that are built using binary packages when available.
# These builds have less validation than other build types.
INCREMENTAL_TYPE = 'binary'
# These builds serve as PFQ builders. This is being deprecated.
PFQ_TYPE = 'pfq'
# Hybrid Commit and PFQ type. Ultimate protection. Commonly referred to
# as simply "commit queue" now.
PALADIN_TYPE = 'paladin'
# A builder that kicks off Pre-CQ builders that bless the purest CLs.
PRE_CQ_LAUNCHER_TYPE = 'priest'
# A builder that cuts and prunes branches.
CREATE_BRANCH_TYPE = 'gardener'
# Chrome PFQ type. Incremental build type that builds and validates new
# versions of Chrome. Only valid if set with CHROME_REV. See
# VALID_CHROME_REVISIONS for more information.
CHROME_PFQ_TYPE = 'chrome'
# Builds from source and non-incremental. This builds fully wipe their
# chroot before the start of every build and no not use a BINHOST.
BUILD_FROM_SOURCE_TYPE = 'full'
# Full but with versioned logic.
CANARY_TYPE = 'canary'
# Generate payloads for an already built build/version.
PAYLOADS_TYPE = 'payloads'
BRANCH_UTIL_CONFIG = 'branch-util'
# Special build type for Chroot builders. These builds focus on building
# toolchains and validate that they work.
CHROOT_BUILDER_TYPE = 'chroot'
CHROOT_BUILDER_BOARD = 'amd64-host'
# Build that refreshes the online Portage package status spreadsheet.
REFRESH_PACKAGES_TYPE = 'refresh_packages'
VALID_BUILD_TYPES = (
PALADIN_TYPE,
INCREMENTAL_TYPE,
BUILD_FROM_SOURCE_TYPE,
CANARY_TYPE,
CHROOT_BUILDER_TYPE,
CHROOT_BUILDER_BOARD,
CHROME_PFQ_TYPE,
PFQ_TYPE,
PRE_CQ_LAUNCHER_TYPE,
REFRESH_PACKAGES_TYPE,
CREATE_BRANCH_TYPE,
PAYLOADS_TYPE,
)
# The name of the builder used to launch the pre-CQ.
PRE_CQ_BUILDER_NAME = 'pre-cq-group'
# The name of the Pre-CQ launcher on the waterfall.
PRE_CQ_LAUNCHER_NAME = 'Pre-CQ Launcher'
# Define pool of machines for Hardware tests.
HWTEST_DEFAULT_NUM = 6
HWTEST_TRYBOT_NUM = 3
HWTEST_MACH_POOL = 'bvt'
HWTEST_PALADIN_POOL = 'cq'
HWTEST_TOT_PALADIN_POOL = 'tot-cq'
HWTEST_PFQ_POOL = 'pfq'
HWTEST_SUITES_POOL = 'suites'
HWTEST_CHROME_PERF_POOL = 'chromeperf'
HWTEST_TRYBOT_POOL = 'try-bot'
# Defines for special purpose Hardware tests suites.
HWTEST_AU_SUITE = 'au'
HWTEST_QAV_SUITE = 'qav'
HWTEST_AFDO_SUITE = 'AFDO_record'
# Additional timeout to wait for autotest to abort a suite if the test takes
# too long to run. This is meant to be overly conservative as a timeout may
# indicate that autotest is at capacity.
HWTEST_TIMEOUT_EXTENSION = 10 * 60
HWTEST_DEFAULT_PRIORITY = 'DEFAULT'
HWTEST_CQ_PRIORITY = 'CQ'
HWTEST_BUILD_PRIORITY = 'Build'
HWTEST_PFQ_PRIORITY = 'PFQ'
# Ordered by priority (first item being lowest).
HWTEST_VALID_PRIORITIES = ['Weekly',
'Daily',
'PostBuild',
HWTEST_DEFAULT_PRIORITY,
HWTEST_BUILD_PRIORITY,
HWTEST_PFQ_PRIORITY,
HWTEST_CQ_PRIORITY]
# Creates a mapping of priorities to make easy comparsions.
HWTEST_PRIORITIES_MAP = dict(zip(HWTEST_VALID_PRIORITIES,
range(len(HWTEST_VALID_PRIORITIES))))
# Defines VM Test types.
FULL_AU_TEST_TYPE = 'full_suite'
SIMPLE_AU_TEST_TYPE = 'pfq_suite'
SMOKE_SUITE_TEST_TYPE = 'smoke_suite'
TELEMETRY_SUITE_TEST_TYPE = 'telemetry_suite'
CROS_VM_TEST_TYPE = 'cros_vm_test'
DEV_MODE_TEST_TYPE = 'dev_mode_test'
VALID_VM_TEST_TYPES = [FULL_AU_TEST_TYPE, SIMPLE_AU_TEST_TYPE,
SMOKE_SUITE_TEST_TYPE, TELEMETRY_SUITE_TEST_TYPE,
CROS_VM_TEST_TYPE, DEV_MODE_TEST_TYPE]
CHROMIUMOS_OVERLAY_DIR = 'src/third_party/chromiumos-overlay'
VERSION_FILE = os.path.join(CHROMIUMOS_OVERLAY_DIR,
'chromeos/config/chromeos_version.sh')
SDK_VERSION_FILE = os.path.join(CHROMIUMOS_OVERLAY_DIR,
'chromeos/binhost/host/sdk_version.conf')
SDK_GS_BUCKET = 'chromiumos-sdk'
PUBLIC = 'public'
PRIVATE = 'private'
BOTH_OVERLAYS = 'both'
PUBLIC_OVERLAYS = PUBLIC
PRIVATE_OVERLAYS = PRIVATE
VALID_OVERLAYS = [BOTH_OVERLAYS, PUBLIC_OVERLAYS, PRIVATE_OVERLAYS, None]
# Common default logging settings for use with the logging module.
LOGGER_FMT = '%(asctime)s: %(levelname)s: %(message)s'
LOGGER_DATE_FMT = '%H:%M:%S'
# Used by remote patch serialization/deserialzation.
INTERNAL_PATCH_TAG = 'i'
EXTERNAL_PATCH_TAG = 'e'
PATCH_TAGS = (INTERNAL_PATCH_TAG, EXTERNAL_PATCH_TAG)
# Tree status strings
TREE_OPEN = 'open'
TREE_THROTTLED = 'throttled'
TREE_CLOSED = 'closed'
VALID_TREE_STATUSES = (TREE_OPEN, TREE_THROTTLED, TREE_CLOSED)
_GERRIT_QUERY_TEMPLATE = ('status:open AND '
'label:Code-Review=+2 AND '
'label:Verified=+1 AND '
'label:Commit-Queue>=%+i AND '
'NOT ( label:CodeReview=-2 OR label:Verified=-1 OR '
'is:draft )')
# Default gerrit query used to find changes for CQ.
# Permits CQ+1 or CQ+2 changes.
DEFAULT_CQ_READY_QUERY = _GERRIT_QUERY_TEMPLATE % 1
# Gerrit query used to find changes for CQ when tree is throttled.
# Permits only CQ+2 changes.
THROTTLED_CQ_READY_QUERY = _GERRIT_QUERY_TEMPLATE % 2
# Default filter rules for verifying that Gerrit returned results that matched
# our query. This used for working around Gerrit bugs.
DEFAULT_CQ_READY_FIELDS = {
'CRVW': '2',
'VRIF': '1',
'COMR': ('1', '2'),
}
DEFAULT_CQ_SHOULD_REJECT_FIELDS = {
'CRVW': '-2',
'VRIF': '-1',
}
GERRIT_ON_BORG_LABELS = {
'Code-Review': 'CRVW',
'Commit-Queue': 'COMR',
'Verified': 'VRIF',
'Trybot-Verified': 'TBVF',
}
# Actions that a CQ run can take on a CL
CL_ACTION_PICKED_UP = 'picked_up' # CL picked up in CommitQueueSync
CL_ACTION_SUBMITTED = 'submitted' # CL submitted successfully
CL_ACTION_KICKED_OUT = 'kicked_out' # CL CQ-Ready value set to zero
CL_ACTION_SUBMIT_FAILED = 'submit_failed' # CL submitted but submit failed
CL_ACTIONS = [CL_ACTION_PICKED_UP,
CL_ACTION_SUBMITTED,
CL_ACTION_KICKED_OUT,
CL_ACTION_SUBMIT_FAILED]
# CQ types.
CQ = 'cq'
PRE_CQ = 'pre-cq'
# Environment variables that should be exposed to all children processes
# invoked via cros_build_lib.RunCommand.
ENV_PASSTHRU = ('CROS_SUDO_KEEP_ALIVE', SHARED_CACHE_ENVVAR)
# List of variables to proxy into the chroot from the host, and to
# have sudo export if existent. Anytime this list is modified, a new
# chroot_version_hooks.d upgrade script that symlinks to 45_rewrite_sudoers.d
# should be created.
CHROOT_ENVIRONMENT_WHITELIST = (
'CHROMEOS_OFFICIAL',
'CHROMEOS_VERSION_AUSERVER',
'CHROMEOS_VERSION_DEVSERVER',
'CHROMEOS_VERSION_TRACK',
'GCC_GITHASH',
'GIT_AUTHOR_EMAIL',
'GIT_AUTHOR_NAME',
'GIT_COMMITTER_EMAIL',
'GIT_COMMITTER_NAME',
'GIT_PROXY_COMMAND',
'GIT_SSH',
'RSYNC_PROXY',
'SSH_AGENT_PID',
'SSH_AUTH_SOCK',
'USE',
'all_proxy',
'ftp_proxy',
'http_proxy',
'https_proxy',
'no_proxy',
)
# Paths for Chrome LKGM which are relative to the Chromium base url.
CHROME_LKGM_FILE = 'CHROMEOS_LKGM'
PATH_TO_CHROME_LKGM = 'chromeos/%s' % CHROME_LKGM_FILE
SVN_CHROME_LKGM = 'trunk/src/%s' % PATH_TO_CHROME_LKGM
# Cache constants.
COMMON_CACHE = 'common'
# Artifact constants.
def _SlashToUnderscore(string):
return string.replace('/', '_')
DEFAULT_ARCHIVE_BUCKET = 'gs://chromeos-image-archive'
RELEASE_BUCKET = 'gs://chromeos-releases'
TRASH_BUCKET = 'gs://chromeos-throw-away-bucket'
CHROME_SYSROOT_TAR = 'sysroot_%s.tar.xz' % _SlashToUnderscore(CHROME_CP)
CHROME_ENV_TAR = 'environment_%s.tar.xz' % _SlashToUnderscore(CHROME_CP)
CHROME_ENV_FILE = 'environment'
BASE_IMAGE_NAME = 'chromiumos_base_image'
BASE_IMAGE_TAR = '%s.tar.xz' % BASE_IMAGE_NAME
BASE_IMAGE_BIN = '%s.bin' % BASE_IMAGE_NAME
IMAGE_SCRIPTS_NAME = 'image_scripts'
IMAGE_SCRIPTS_TAR = '%s.tar.xz' % IMAGE_SCRIPTS_NAME
VM_IMAGE_NAME = 'chromiumos_qemu_image'
VM_IMAGE_BIN = '%s.bin' % VM_IMAGE_NAME
VM_DISK_PREFIX = 'chromiumos_qemu_disk.bin'
VM_MEM_PREFIX = 'chromiumos_qemu_mem.bin'
VM_TEST_RESULTS = 'vm_test_results_%(attempt)s'
METADATA_JSON = 'metadata.json'
PARTIAL_METADATA_JSON = 'partial-metadata.json'
DELTA_SYSROOT_TAR = 'delta_sysroot.tar.xz'
DELTA_SYSROOT_BATCH = 'batch'
# Global configuration constants.
CHROMITE_CONFIG_DIR = os.path.expanduser('~/.chromite')
CHROME_SDK_BASHRC = os.path.join(CHROMITE_CONFIG_DIR, 'chrome_sdk.bashrc')
SYNC_RETRIES = 2
SLEEP_TIMEOUT = 30
# Lab status url.
LAB_STATUS_URL = 'http://chromiumos-lab.appspot.com/current?format=json'
GOLO_SMTP_SERVER = 'mail.golo.chromium.org'
# URLs to the various waterfalls.
BUILD_DASHBOARD = 'http://build.chromium.org/p/chromiumos'
BUILD_INT_DASHBOARD = 'https://uberchromegw.corp.google.com/i/chromeos'
TRYBOT_DASHBOARD = 'https://uberchromegw.corp.google.com/i/chromiumos.tryserver'
# Useful config targets.
CQ_MASTER = 'master-paladin'
PRE_CQ_GROUP = 'trybot-pre-cq-group'
# Email validation regex. Not quite fully compliant with RFC 2822, but good
# approximation.
EMAIL_REGEX = r'[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}'
# Blacklist of files not allowed to be uploaded into the Partner Project Google
# Storage Buckets:
# debug.tgz contains debug symbols.
# manifest.xml exposes all of our repo names.
# vm_test_results can contain symbolicated crash dumps.
EXTRA_BUCKETS_FILES_BLACKLIST = [
'debug.tgz',
'manifest.xml',
'vm_test_results_*'
]
# AFDO common constants.
# How long does the AFDO_record autotest have to generate the AFDO perf data.
AFDO_GENERATE_TIMEOUT = 90 * 60
| {
"content_hash": "9232bb33630d4742f3eb4a20632e0d72",
"timestamp": "",
"source": "github",
"line_count": 487,
"max_line_length": 80,
"avg_line_length": 32.993839835728956,
"alnum_prop": 0.7074309185959672,
"repo_name": "chadversary/chromiumos.chromite",
"id": "a08cb0b6ea3d5453ad88ab2332785be6a55d3813",
"size": "16238",
"binary": false,
"copies": "1",
"ref": "refs/heads/fix-repo-mirror",
"path": "cbuildbot/constants.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "85"
},
{
"name": "Python",
"bytes": "3652882"
},
{
"name": "Shell",
"bytes": "24031"
}
],
"symlink_target": ""
} |
"""
Records
=======
"""
# pylint:disable=too-many-arguments,too-many-instance-attributes,too-many-locals
import ipaddress
# pylint:disable=R0903
from abc import ABCMeta
from typing import Dict, List, Optional, Type, Union
from geoip2.mixins import SimpleEquality
class Record(SimpleEquality, metaclass=ABCMeta):
"""All records are subclasses of the abstract class ``Record``."""
def __repr__(self) -> str:
args = ", ".join(f"{k}={v!r}" for k, v in self.__dict__.items())
return f"{self.__module__}.{self.__class__.__name__}({args})"
class PlaceRecord(Record, metaclass=ABCMeta):
"""All records with :py:attr:`names` subclass :py:class:`PlaceRecord`."""
names: Dict[str, str]
_locales: List[str]
def __init__(
self,
locales: Optional[List[str]] = None,
names: Optional[Dict[str, str]] = None,
) -> None:
if locales is None:
locales = ["en"]
self._locales = locales
if names is None:
names = {}
self.names = names
@property
def name(self) -> Optional[str]:
"""Dict with locale codes as keys and localized name as value."""
# pylint:disable=E1101
return next((self.names.get(x) for x in self._locales if x in self.names), None)
class City(PlaceRecord):
"""Contains data for the city record associated with an IP address.
This class contains the city-level data associated with an IP address.
This record is returned by ``city``, ``enterprise``, and ``insights``.
Attributes:
.. attribute:: confidence
A value from 0-100 indicating MaxMind's
confidence that the city is correct. This attribute is only available
from the Insights end point and the Enterprise database.
:type: int
.. attribute:: geoname_id
The GeoName ID for the city.
:type: int
.. attribute:: name
The name of the city based on the locales list passed to the
constructor.
:type: str
.. attribute:: names
A dictionary where the keys are locale codes
and the values are names.
:type: dict
"""
confidence: Optional[int]
geoname_id: Optional[int]
def __init__(
self,
locales: Optional[List[str]] = None,
confidence: Optional[int] = None,
geoname_id: Optional[int] = None,
names: Optional[Dict[str, str]] = None,
**_,
) -> None:
self.confidence = confidence
self.geoname_id = geoname_id
super().__init__(locales, names)
class Continent(PlaceRecord):
"""Contains data for the continent record associated with an IP address.
This class contains the continent-level data associated with an IP
address.
Attributes:
.. attribute:: code
A two character continent code like "NA" (North America)
or "OC" (Oceania).
:type: str
.. attribute:: geoname_id
The GeoName ID for the continent.
:type: int
.. attribute:: name
Returns the name of the continent based on the locales list passed to
the constructor.
:type: str
.. attribute:: names
A dictionary where the keys are locale codes
and the values are names.
:type: dict
"""
code: Optional[str]
geoname_id: Optional[int]
def __init__(
self,
locales: Optional[List[str]] = None,
code: Optional[str] = None,
geoname_id: Optional[int] = None,
names: Optional[Dict[str, str]] = None,
**_,
) -> None:
self.code = code
self.geoname_id = geoname_id
super().__init__(locales, names)
class Country(PlaceRecord):
"""Contains data for the country record associated with an IP address.
This class contains the country-level data associated with an IP address.
Attributes:
.. attribute:: confidence
A value from 0-100 indicating MaxMind's confidence that
the country is correct. This attribute is only available from the
Insights end point and the Enterprise database.
:type: int
.. attribute:: geoname_id
The GeoName ID for the country.
:type: int
.. attribute:: is_in_european_union
This is true if the country is a member state of the European Union.
:type: bool
.. attribute:: iso_code
The two-character `ISO 3166-1
<http://en.wikipedia.org/wiki/ISO_3166-1>`_ alpha code for the
country.
:type: str
.. attribute:: name
The name of the country based on the locales list passed to the
constructor.
:type: str
.. attribute:: names
A dictionary where the keys are locale codes and the values
are names.
:type: dict
"""
confidence: Optional[int]
geoname_id: Optional[int]
is_in_european_union: bool
iso_code: Optional[str]
def __init__(
self,
locales: Optional[List[str]] = None,
confidence: Optional[int] = None,
geoname_id: Optional[int] = None,
is_in_european_union: bool = False,
iso_code: Optional[str] = None,
names: Optional[Dict[str, str]] = None,
**_,
) -> None:
self.confidence = confidence
self.geoname_id = geoname_id
self.is_in_european_union = is_in_european_union
self.iso_code = iso_code
super().__init__(locales, names)
class RepresentedCountry(Country):
"""Contains data for the represented country associated with an IP address.
This class contains the country-level data associated with an IP address
for the IP's represented country. The represented country is the country
represented by something like a military base.
Attributes:
.. attribute:: confidence
A value from 0-100 indicating MaxMind's confidence that
the country is correct. This attribute is only available from the
Insights end point and the Enterprise database.
:type: int
.. attribute:: geoname_id
The GeoName ID for the country.
:type: int
.. attribute:: is_in_european_union
This is true if the country is a member state of the European Union.
:type: bool
.. attribute:: iso_code
The two-character `ISO 3166-1
<http://en.wikipedia.org/wiki/ISO_3166-1>`_ alpha code for the country.
:type: str
.. attribute:: name
The name of the country based on the locales list passed to the
constructor.
:type: str
.. attribute:: names
A dictionary where the keys are locale codes and the values
are names.
:type: dict
.. attribute:: type
A string indicating the type of entity that is representing the
country. Currently we only return ``military`` but this could expand to
include other types in the future.
:type: str
"""
type: Optional[str]
def __init__(
self,
locales: Optional[List[str]] = None,
confidence: Optional[int] = None,
geoname_id: Optional[int] = None,
is_in_european_union: bool = False,
iso_code: Optional[str] = None,
names: Optional[Dict[str, str]] = None,
# pylint:disable=redefined-builtin
type: Optional[str] = None,
**_,
) -> None:
self.type = type
super().__init__(
locales, confidence, geoname_id, is_in_european_union, iso_code, names
)
class Location(Record):
"""Contains data for the location record associated with an IP address.
This class contains the location data associated with an IP address.
This record is returned by ``city``, ``enterprise``, and ``insights``.
Attributes:
.. attribute:: average_income
The average income in US dollars associated with the requested IP
address. This attribute is only available from the Insights end point.
:type: int
.. attribute:: accuracy_radius
The approximate accuracy radius in kilometers around the latitude and
longitude for the IP address. This is the radius where we have a 67%
confidence that the device using the IP address resides within the
circle centered at the latitude and longitude with the provided radius.
:type: int
.. attribute:: latitude
The approximate latitude of the location associated with the IP
address. This value is not precise and should not be used to identify a
particular address or household.
:type: float
.. attribute:: longitude
The approximate longitude of the location associated with the IP
address. This value is not precise and should not be used to identify a
particular address or household.
:type: float
.. attribute:: metro_code
The metro code of the location if the
location is in the US. MaxMind returns the same metro codes as the
`Google AdWords API
<https://developers.google.com/adwords/api/docs/appendix/cities-DMAregions>`_.
:type: int
.. attribute:: population_density
The estimated population per square kilometer associated with the IP
address. This attribute is only available from the Insights end point.
:type: int
.. attribute:: time_zone
The time zone associated with location, as specified by the `IANA Time
Zone Database <http://www.iana.org/time-zones>`_, e.g.,
"America/New_York".
:type: str
"""
average_income: Optional[int]
accuracy_radius: Optional[int]
latitude: Optional[float]
longitude: Optional[float]
metro_code: Optional[int]
population_density: Optional[int]
time_zone: Optional[str]
def __init__(
self,
average_income: Optional[int] = None,
accuracy_radius: Optional[int] = None,
latitude: Optional[float] = None,
longitude: Optional[float] = None,
metro_code: Optional[int] = None,
population_density: Optional[int] = None,
time_zone: Optional[str] = None,
**_,
) -> None:
self.average_income = average_income
self.accuracy_radius = accuracy_radius
self.latitude = latitude
self.longitude = longitude
self.metro_code = metro_code
self.population_density = population_density
self.time_zone = time_zone
class MaxMind(Record):
"""Contains data related to your MaxMind account.
Attributes:
.. attribute:: queries_remaining
The number of remaining queries you have
for the end point you are calling.
:type: int
"""
queries_remaining: Optional[int]
def __init__(self, queries_remaining: Optional[int] = None, **_) -> None:
self.queries_remaining = queries_remaining
class Postal(Record):
"""Contains data for the postal record associated with an IP address.
This class contains the postal data associated with an IP address.
This attribute is returned by ``city``, ``enterprise``, and ``insights``.
Attributes:
.. attribute:: code
The postal code of the location. Postal
codes are not available for all countries. In some countries, this will
only contain part of the postal code.
:type: str
.. attribute:: confidence
A value from 0-100 indicating
MaxMind's confidence that the postal code is correct. This attribute is
only available from the Insights end point and the Enterprise database.
:type: int
"""
code: Optional[str]
confidence: Optional[int]
def __init__(
self, code: Optional[str] = None, confidence: Optional[int] = None, **_
) -> None:
self.code = code
self.confidence = confidence
class Subdivision(PlaceRecord):
"""Contains data for the subdivisions associated with an IP address.
This class contains the subdivision data associated with an IP address.
This attribute is returned by ``city``, ``enterprise``, and ``insights``.
Attributes:
.. attribute:: confidence
This is a value from 0-100 indicating MaxMind's
confidence that the subdivision is correct. This attribute is only
available from the Insights end point and the Enterprise database.
:type: int
.. attribute:: geoname_id
This is a GeoName ID for the subdivision.
:type: int
.. attribute:: iso_code
This is a string up to three characters long
contain the subdivision portion of the `ISO 3166-2 code
<http://en.wikipedia.org/wiki/ISO_3166-2>`_.
:type: str
.. attribute:: name
The name of the subdivision based on the locales list passed to the
constructor.
:type: str
.. attribute:: names
A dictionary where the keys are locale codes and the
values are names
:type: dict
"""
confidence: Optional[int]
geoname_id: Optional[int]
iso_code: Optional[str]
def __init__(
self,
locales: Optional[List[str]] = None,
confidence: Optional[int] = None,
geoname_id: Optional[int] = None,
iso_code: Optional[str] = None,
names: Optional[Dict[str, str]] = None,
**_,
) -> None:
self.confidence = confidence
self.geoname_id = geoname_id
self.iso_code = iso_code
super().__init__(locales, names)
class Subdivisions(tuple):
"""A tuple-like collection of subdivisions associated with an IP address.
This class contains the subdivisions of the country associated with the
IP address from largest to smallest.
For instance, the response for Oxford in the United Kingdom would have
England as the first element and Oxfordshire as the second element.
This attribute is returned by ``city``, ``enterprise``, and ``insights``.
"""
def __new__(
cls: Type["Subdivisions"], locales: Optional[List[str]], *subdivisions
) -> "Subdivisions":
subobjs = tuple(Subdivision(locales, **x) for x in subdivisions)
obj = super().__new__(cls, subobjs) # type: ignore
return obj
def __init__(
self, locales: Optional[List[str]], *subdivisions # pylint:disable=W0613
) -> None:
self._locales = locales
super().__init__()
@property
def most_specific(self) -> Subdivision:
"""The most specific (smallest) subdivision available.
If there are no :py:class:`Subdivision` objects for the response,
this returns an empty :py:class:`Subdivision`.
:type: :py:class:`Subdivision`
"""
try:
return self[-1]
except IndexError:
return Subdivision(self._locales)
class Traits(Record):
"""Contains data for the traits record associated with an IP address.
This class contains the traits data associated with an IP address.
This class has the following attributes:
.. attribute:: autonomous_system_number
The `autonomous system
number <http://en.wikipedia.org/wiki/Autonomous_system_(Internet)>`_
associated with the IP address. This attribute is only available from
the City Plus and Insights web services and the Enterprise database.
:type: int
.. attribute:: autonomous_system_organization
The organization associated with the registered `autonomous system
number <http://en.wikipedia.org/wiki/Autonomous_system_(Internet)>`_ for
the IP address. This attribute is only available from the City Plus and
Insights web service end points and the Enterprise database.
:type: str
.. attribute:: connection_type
The connection type may take the following values:
- Dialup
- Cable/DSL
- Corporate
- Cellular
Additional values may be added in the future.
This attribute is only available in the Enterprise database.
:type: str
.. attribute:: domain
The second level domain associated with the
IP address. This will be something like "example.com" or
"example.co.uk", not "foo.example.com". This attribute is only available
from the City Plus and Insights web service end points and the
Enterprise database.
:type: str
.. attribute:: ip_address
The IP address that the data in the model
is for. If you performed a "me" lookup against the web service, this
will be the externally routable IP address for the system the code is
running on. If the system is behind a NAT, this may differ from the IP
address locally assigned to it.
:type: str
.. attribute:: is_anonymous
This is true if the IP address belongs to any sort of anonymous network.
This attribute is only available from Insights.
:type: bool
.. attribute:: is_anonymous_proxy
This is true if the IP is an anonymous proxy.
:type: bool
.. deprecated:: 2.2.0
Use our our `GeoIP2 Anonymous IP database
<https://www.maxmind.com/en/geoip2-anonymous-ip-database GeoIP2>`_
instead.
.. attribute:: is_anonymous_vpn
This is true if the IP address is registered to an anonymous VPN
provider.
If a VPN provider does not register subnets under names associated with
them, we will likely only flag their IP ranges using the
``is_hosting_provider`` attribute.
This attribute is only available from Insights.
:type: bool
.. attribute:: is_hosting_provider
This is true if the IP address belongs to a hosting or VPN provider
(see description of ``is_anonymous_vpn`` attribute).
This attribute is only available from Insights.
:type: bool
.. attribute:: is_legitimate_proxy
This attribute is true if MaxMind believes this IP address to be a
legitimate proxy, such as an internal VPN used by a corporation. This
attribute is only available in the Enterprise database.
:type: bool
.. attribute:: is_public_proxy
This is true if the IP address belongs to a public proxy. This attribute
is only available from Insights.
:type: bool
.. attribute:: is_residential_proxy
This is true if the IP address is on a suspected anonymizing network
and belongs to a residential ISP. This attribute is only available from
Insights.
:type: bool
.. attribute:: is_satellite_provider
This is true if the IP address is from a satellite provider that
provides service to multiple countries.
:type: bool
.. deprecated:: 2.2.0
Due to the increased coverage by mobile carriers, very few
satellite providers now serve multiple countries. As a result, the
output does not provide sufficiently relevant data for us to maintain
it.
.. attribute:: is_tor_exit_node
This is true if the IP address is a Tor exit node. This attribute is
only available from Insights.
:type: bool
.. attribute:: isp
The name of the ISP associated with the IP address. This attribute is
only available from the City Plus and Insights web services and the
Enterprise database.
:type: str
.. attribute: mobile_country_code
The `mobile country code (MCC)
<https://en.wikipedia.org/wiki/Mobile_country_code>`_ associated with the
IP address and ISP. This attribute is available from the City Plus and
Insights web services and the Enterprise database.
:type: str
.. attribute: mobile_network_code
The `mobile network code (MNC)
<https://en.wikipedia.org/wiki/Mobile_country_code>`_ associated with the
IP address and ISP. This attribute is available from the City Plus and
Insights web services and the Enterprise database.
:type: str
.. attribute:: network
The network associated with the record. In particular, this is the
largest network where all of the fields besides ip_address have the same
value.
:type: ipaddress.IPv4Network or ipaddress.IPv6Network
.. attribute:: organization
The name of the organization associated with the IP address. This
attribute is only available from the City Plus and Insights web services
and the Enterprise database.
:type: str
.. attribute:: static_ip_score
An indicator of how static or dynamic an IP address is. The value ranges
from 0 to 99.99 with higher values meaning a greater static association.
For example, many IP addresses with a user_type of cellular have a
lifetime under one. Static Cable/DSL IPs typically have a lifetime above
thirty.
This indicator can be useful for deciding whether an IP address represents
the same user over time. This attribute is only available from
Insights.
:type: float
.. attribute:: user_count
The estimated number of users sharing the IP/network during the past 24
hours. For IPv4, the count is for the individual IP. For IPv6, the count
is for the /64 network. This attribute is only available from
Insights.
:type: int
.. attribute:: user_type
The user type associated with the IP
address. This can be one of the following values:
* business
* cafe
* cellular
* college
* consumer_privacy_network
* content_delivery_network
* dialup
* government
* hosting
* library
* military
* residential
* router
* school
* search_engine_spider
* traveler
This attribute is only available from the Insights end point and the
Enterprise database.
:type: str
"""
autonomous_system_number: Optional[int]
autonomous_system_organization: Optional[str]
connection_type: Optional[str]
domain: Optional[str]
is_anonymous: bool
is_anonymous_proxy: bool
is_anonymous_vpn: bool
is_hosting_provider: bool
is_legitimate_proxy: bool
is_public_proxy: bool
is_residential_proxy: bool
is_satellite_provider: bool
is_tor_exit_node: bool
isp: Optional[str]
ip_address: Optional[str]
mobile_country_code: Optional[str]
mobile_network_code: Optional[str]
organization: Optional[str]
static_ip_score: Optional[float]
user_count: Optional[int]
user_type: Optional[str]
_network: Optional[Union[ipaddress.IPv4Network, ipaddress.IPv6Network]]
_prefix_len: Optional[int]
def __init__(
self,
autonomous_system_number: Optional[int] = None,
autonomous_system_organization: Optional[str] = None,
connection_type: Optional[str] = None,
domain: Optional[str] = None,
is_anonymous: bool = False,
is_anonymous_proxy: bool = False,
is_anonymous_vpn: bool = False,
is_hosting_provider: bool = False,
is_legitimate_proxy: bool = False,
is_public_proxy: bool = False,
is_residential_proxy: bool = False,
is_satellite_provider: bool = False,
is_tor_exit_node: bool = False,
isp: Optional[str] = None,
ip_address: Optional[str] = None,
network: Optional[str] = None,
organization: Optional[str] = None,
prefix_len: Optional[int] = None,
static_ip_score: Optional[float] = None,
user_count: Optional[int] = None,
user_type: Optional[str] = None,
mobile_country_code: Optional[str] = None,
mobile_network_code: Optional[str] = None,
**_,
) -> None:
self.autonomous_system_number = autonomous_system_number
self.autonomous_system_organization = autonomous_system_organization
self.connection_type = connection_type
self.domain = domain
self.is_anonymous = is_anonymous
self.is_anonymous_proxy = is_anonymous_proxy
self.is_anonymous_vpn = is_anonymous_vpn
self.is_hosting_provider = is_hosting_provider
self.is_legitimate_proxy = is_legitimate_proxy
self.is_public_proxy = is_public_proxy
self.is_residential_proxy = is_residential_proxy
self.is_satellite_provider = is_satellite_provider
self.is_tor_exit_node = is_tor_exit_node
self.isp = isp
self.mobile_country_code = mobile_country_code
self.mobile_network_code = mobile_network_code
self.organization = organization
self.static_ip_score = static_ip_score
self.user_type = user_type
self.user_count = user_count
self.ip_address = ip_address
if network is None:
self._network = None
else:
self._network = ipaddress.ip_network(network, False)
# We don't construct the network using prefix_len here as that is
# for database lookups. Customers using the database tend to be
# much more performance sensitive than web service users.
self._prefix_len = prefix_len
@property
def network(self) -> Optional[Union[ipaddress.IPv4Network, ipaddress.IPv6Network]]:
"""The network for the record"""
# This code is duplicated for performance reasons
network = self._network
if network is not None:
return network
ip_address = self.ip_address
prefix_len = self._prefix_len
if ip_address is None or prefix_len is None:
return None
network = ipaddress.ip_network(f"{ip_address}/{prefix_len}", False)
self._network = network
return network
| {
"content_hash": "9050f93927373577034bfcf6210f938d",
"timestamp": "",
"source": "github",
"line_count": 907,
"max_line_length": 88,
"avg_line_length": 28.167585446527013,
"alnum_prop": 0.6445514325974636,
"repo_name": "maxmind/GeoIP2-python",
"id": "6ab8e30181bbf3490eb085b4a145a5063646990c",
"size": "25548",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "geoip2/records.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "114115"
},
{
"name": "Shell",
"bytes": "1244"
}
],
"symlink_target": ""
} |
import inspect
import json
import re
import sys
import xml.dom.minidom
import tornado
import tornado.ioloop
import tornado.web
import tornado.wsgi
from pyconvert.pyconv import (convert2JSON, convert2XML, convertJSON2OBJ,
convertXML2OBJ)
from QUANTAXIS.QAWebServer.util import (APPLICATION_JSON, APPLICATION_XML,
TEXT_XML, convert)
from tornado.web import RequestHandler
from tornado.websocket import WebSocketHandler
"""
基础类
"""
class QABaseHandler(RequestHandler):
@property
def db(self):
return self.application.db
@property
def redis(self):
return self.application.redis
def set_default_headers(self):
self.set_header("Access-Control-Allow-Headers", "x-requested-with")
self.set_header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
self.set_header("Access-Control-Allow-Origin", "*") # 这个地方可以写域名
#self.set_header("Access-Control-Allow-Headers", "x-requested-with")
self.set_header('Access-Control-Allow-Methods',
'POST, GET, OPTIONS, DELETE, PUT, PATCH')
self.set_header('Access-Control-Allow-Headers',
"Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With, XMLHttpRequest,HTTP2-Settings")
self.set_header(
'Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8')
self.set_header('Server', 'QUANTAXISBACKEND')
#headers.set('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
# self.Content-Type: text/html; charset=utf-8
def post(self):
self.write('some post')
def get(self):
self.write('some get')
def options(self):
# no body
self.set_status(204)
self.finish()
def wirte_error(self, status_code, **kwargs):
pass
def initialize(self):
pass
def on_finish(self):
pass
class QAWebSocketHandler(WebSocketHandler):
def check_origin(self, origin):
return True
def set_default_headers(self):
self.set_header('Access-Control-Allow-Origin', '*')
self.set_header('Access-Control-Allow-Methods',
'POST, GET, OPTIONS, DELETE, PUT, PATCH')
self.set_header('Access-Control-Max-Age',
999999999999999999999999999999999)
self.set_header('Access-Control-Allow-Headers',
"Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With,HTTP2-Settings")
self.set_header('Server', 'QUANTAXISBACKEND')
def open(self, *args, **kwargs):
self.write_message('x')
| {
"content_hash": "8aaebdd283802123b79afacc3486c81f",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 133,
"avg_line_length": 31.476744186046513,
"alnum_prop": 0.6346509050609531,
"repo_name": "yutiansut/QUANTAXIS",
"id": "d37d726751b02add9d0479a7a5894f3762f71dab",
"size": "3879",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "QUANTAXIS/QAWebServer/basehandles.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "172"
},
{
"name": "Cython",
"bytes": "13284"
},
{
"name": "Dockerfile",
"bytes": "39129"
},
{
"name": "Python",
"bytes": "1967828"
},
{
"name": "Rust",
"bytes": "588524"
},
{
"name": "Shell",
"bytes": "58705"
},
{
"name": "TeX",
"bytes": "82015"
}
],
"symlink_target": ""
} |
from __future__ import absolute_import
from datetime import timedelta
from django.utils import timezone
from django.test import RequestFactory
from exam import fixture
from sentry.middleware.user import UserActiveMiddleware
from sentry.testutils import TestCase
class UserActiveMiddlewareTest(TestCase):
middleware = fixture(UserActiveMiddleware)
factory = fixture(RequestFactory)
def test_simple(self):
self.view = lambda x: None
user = self.user
req = self.factory.get("/")
req.user = user
resp = self.middleware.process_view(req, self.view, [], {})
assert resp is None
assert timezone.now() - user.last_active < timedelta(minutes=1)
user.last_active = None
resp = self.middleware.process_view(req, self.view, [], {})
assert resp is None
assert timezone.now() - user.last_active < timedelta(minutes=1)
| {
"content_hash": "eefbfaf7e6943814ba4fe19fe3998a11",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 71,
"avg_line_length": 30.4,
"alnum_prop": 0.6885964912280702,
"repo_name": "beeftornado/sentry",
"id": "12bc55397ea74c225e7557640c7d9d7b2ff45e45",
"size": "912",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "tests/sentry/middleware/test_useractive.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "157195"
},
{
"name": "HTML",
"bytes": "197026"
},
{
"name": "JavaScript",
"bytes": "380379"
},
{
"name": "Makefile",
"bytes": "2832"
},
{
"name": "Python",
"bytes": "6473603"
}
],
"symlink_target": ""
} |
from trakt.mapper.core.base import Mapper
class SummaryMapper(Mapper):
@classmethod
def movies(cls, client, items, **kwargs):
if not items:
return None
return [cls.movie(client, item, **kwargs) for item in items]
@classmethod
def movie(cls, client, item, **kwargs):
if not item:
return None
if 'movie' in item:
i_movie = item['movie']
else:
i_movie = item
# Retrieve item keys
pk, keys = cls.get_ids('movie', i_movie)
if pk is None:
return None
# Create object
movie = cls.construct(client, 'movie', i_movie, keys, **kwargs)
# Update with root info
if 'movie' in item:
movie._update(item)
return movie
@classmethod
def shows(cls, client, items, **kwargs):
if not items:
return None
return [cls.show(client, item, **kwargs) for item in items]
@classmethod
def show(cls, client, item, **kwargs):
if not item:
return None
if 'show' in item:
i_show = item['show']
else:
i_show = item
# Retrieve item keys
pk, keys = cls.get_ids('show', i_show)
if pk is None:
return None
# Create object
show = cls.construct(client, 'show', i_show, keys, **kwargs)
# Update with root info
if 'show' in item:
show._update(item)
return show
@classmethod
def seasons(cls, client, items, **kwargs):
if not items:
return None
return [cls.season(client, item, **kwargs) for item in items]
@classmethod
def season(cls, client, item, **kwargs):
if not item:
return None
if 'season' in item:
i_season = item['season']
else:
i_season = item
# Retrieve item keys
pk, keys = cls.get_ids('season', i_season)
if pk is None:
return None
# Create object
season = cls.construct(client, 'season', i_season, keys, **kwargs)
# Update with root info
if 'season' in item:
season._update(item)
return season
@classmethod
def episodes(cls, client, items, **kwargs):
if not items:
return None
return [cls.episode(client, item, **kwargs) for item in items]
@classmethod
def episode(cls, client, item, **kwargs):
if not item:
return None
if 'episode' in item:
i_episode = item['episode']
else:
i_episode = item
# Retrieve item keys
pk, keys = cls.get_ids('episode', i_episode)
if pk is None:
return None
# Create object
episode = cls.construct(client, 'episode', i_episode, keys, **kwargs)
# Update with root info
if 'episode' in item:
episode._update(item)
return episode
| {
"content_hash": "043d632f44bb22ef5167af78ae5f55bc",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 77,
"avg_line_length": 23.129770992366414,
"alnum_prop": 0.5283828382838284,
"repo_name": "shad7/trakt.py",
"id": "131b77439b89d039015ad02ddb91645f0c85c526",
"size": "3030",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "trakt/mapper/summary.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "148887"
}
],
"symlink_target": ""
} |
"""
stackoverflow.com/questions/3173320/text-progress-bar-in-the-console
"""
import sys
# Print iterations progress
def print_progress(iteration, total, prefix='', suffix='', decimals=1, bar_length=100):
"""
Call in a loop to create terminal progress bar
@params:
iteration - Required : current iteration (Int)
total - Required : total iterations (Int)
prefix - Optional : prefix string (Str)
suffix - Optional : suffix string (Str)
decimals - Optional : positive number of decimals in percent complete (Int)
bar_length - Optional : character length of bar (Int)
"""
str_format = "{0:." + str(decimals) + "f}"
percents = str_format.format(100 * (iteration / float(total)))
filled_length = int(round(bar_length * iteration / float(total)))
bar = '█' * filled_length + '-' * (bar_length - filled_length)
sys.stdout.write('\x1b[2K\r%s |%s| %s%s %s' % (prefix, bar, percents, '%', suffix))
if iteration == total:
sys.stdout.write('\n')
sys.stdout.flush() | {
"content_hash": "e1b602d91c028b3ac7a7580eed0534cb",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 87,
"avg_line_length": 40.03703703703704,
"alnum_prop": 0.6170212765957447,
"repo_name": "indiependente/send_mail",
"id": "1a13cb8c2c1ee89d9d6159cac44b21bedfee71fb",
"size": "1107",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "utils.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "6831"
}
],
"symlink_target": ""
} |
"""Kraken - objects.Constraints.OrientationConstraint module.
Classes:
OrientationConstraint - Orientation Constraint.
"""
from constraint import Constraint
from kraken.core.maths.vec3 import Vec3
from kraken.core.maths.quat import Quat
class OrientationConstraint(Constraint):
"""Orientation Constraint."""
def __init__(self, name):
super(OrientationConstraint, self).__init__(name)
| {
"content_hash": "2b5750527895c2879904e646ece6032f",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 61,
"avg_line_length": 23.88235294117647,
"alnum_prop": 0.7536945812807881,
"repo_name": "goshow-jp/Kraken",
"id": "9c02ecb99e7d7daad79b980572bac6ab6d3ae833",
"size": "406",
"binary": false,
"copies": "1",
"ref": "refs/heads/feature/monolithicCanvas",
"path": "Python/kraken/core/objects/constraints/orientation_constraint.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "AMPL",
"bytes": "136"
},
{
"name": "Batchfile",
"bytes": "1767"
},
{
"name": "C++",
"bytes": "99351"
},
{
"name": "CSS",
"bytes": "21093"
},
{
"name": "Mathematica",
"bytes": "4339320"
},
{
"name": "Python",
"bytes": "2187727"
},
{
"name": "Shell",
"bytes": "3361"
}
],
"symlink_target": ""
} |
from django.test import TestCase, Client
from django.test.utils import override_settings
# APP Models
from seshdash.models import Sesh_User, Sesh_Alert, Alert_Rule, Sesh_Site,VRM_Account, BoM_Data_Point as Data_Point, Daily_Data_Point
# django Time related
from django.utils import timezone
from django.contrib.auth.models import User
from time import sleep
import pytz
#Helper Functions
from django.forms.models import model_to_dict
from django.core import mail
#Security
from guardian.shortcuts import assign_perm
from geoposition import Geoposition
#Data generations
from data_generation import get_random_int, get_random_binary, get_random_interval, generate_date_array, get_random_float
# Debug
from django.forms.models import model_to_dict
# To Test
from seshdash.utils.time_utils import get_time_interval_array
from seshdash.data.db.influx import Influx
from django.conf import settings
from seshdash.tasks import get_aggregate_daily_data, send_reports
from seshdash.tests.data_generation import create_test_data
# This test case written to test alerting module.
# It aims to test if the system sends an email and creates an Sesh_Alert object when an alert is triggered.
class AggregateTestCase(TestCase):
def setUp(self):
self.VRM = VRM_Account.objects.create(vrm_user_id='[email protected]',vrm_password="asd")
# Setup Influx
self.i = Influx()
self.i.create_database('test_db')
self._influx_db_name = 'test_db'
self.i = Influx(database=self._influx_db_name)
self.no_points = 288
self.location = Geoposition(52.5,24.3)
self.site = Sesh_Site.objects.create(site_name=u"Test_aggregate",
comission_date=timezone.datetime(2015, 12, 11, 22, 0),
location_city=u"kigali",
location_country=u"rwanda",
vrm_account = self.VRM,
installed_kw=123.0,
position=self.location,
system_voltage=12,
number_of_panels=12,
vrm_site_id=213,
battery_bank_capacity=12321,
has_genset=True,
has_grid=True)
self.test_user = Sesh_User.objects.create_user("john doe","[email protected]","asdasd12345")
#assign a user to the sites
try:
self.i.create_database(self._influx_db_name)
#Generate random data points for 24h
self.no_points = create_test_data(self.site)
except Exception,e:
self.i.delete_database(self._influx_db_name)
sleep(1)
self.i.create_database(self._influx_db_name)
print e
pass
assign_perm("view_Sesh_Site",self.test_user,self.site)
def tearDown(self):
self.i.delete_database(self._influx_db_name)
pass
def test_grid_outage(self):
# TODO
#aggregate_data_grid_data = get_aggregate_data (site, 'AC_Voltage_in',bucket_size='10m', toSum=False, start=date_to_fetch)
#logging.debug("aggregate date for grid %s "%aggregate_data_grid_data)
#aggregate_data_grid_outage_stats = get_grid_stats(aggregate_data_grid_data, 0, 'min', 10)
pass
@override_settings(INFLUX_DB='test_db')
def test_data_point_creation(self):
"""
Test all the DP were created in MYSQL and INFLUX
"""
dps = Data_Point.objects.filter(site=self.site)
self.assertNotEqual(dps.count(), 0)
sleep(2)
num_point = len(self.i.query("pv_production"))
self.assertNotEqual(num_point,0)
#get aggregate daily data
get_aggregate_daily_data()
@override_settings(INFLUX_DB='test_db')
def test_data_aggregation(self):
"""
Test data aggregation and daily_data_point creations
"""
get_aggregate_daily_data()
ddp = Daily_Data_Point.objects.all()
self.assertEqual(ddp.count(),1)
ddp = ddp.first()
self.assertNotEqual(ddp.daily_pv_yield,0)
self.assertNotEqual(ddp.daily_power_consumption_total,0)
self.assertNotEqual(ddp.daily_grid_usage,0)
@override_settings(INFLUX_DB='test_db')
def test_reporting(self):
"""
Test email reporting for sites
"""
settings.INFLUX_DB = self._influx_db_name
get_aggregate_daily_data()
send_reports("day")
self.assertEqual(len(mail.outbox),1)
def test_historical_data_display(self):
c = Client()
c.login(username='john doe', password='asdasd12345')
data_dict = Daily_Data_Point.UNITS_DICTIONARY
data_keys = data_dict.keys()
for key in data_keys:
response = c.post('/historical_data', {"sort_value": key})
self.assertEqual(response.status_code, 200)
| {
"content_hash": "f831847bc70c84c0e0237e241681ed1b",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 132,
"avg_line_length": 36.75714285714286,
"alnum_prop": 0.6000777302759425,
"repo_name": "GreatLakesEnergy/sesh-dash-beta",
"id": "5b7e26d98496b6ae23142c581bc962f6a84bf07f",
"size": "5156",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "seshdash/tests/deprecated_test_aggreaget.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "119593"
},
{
"name": "HTML",
"bytes": "78888"
},
{
"name": "JavaScript",
"bytes": "125120"
},
{
"name": "PLpgSQL",
"bytes": "133"
},
{
"name": "Python",
"bytes": "407393"
},
{
"name": "Shell",
"bytes": "1549"
}
],
"symlink_target": ""
} |
import re
"""
Guidelines for writing new hacking checks
- Use only for Heat specific tests. OpenStack general tests
should be submitted to the common 'hacking' module.
- Pick numbers in the range H3xx. Find the current test with
the highest allocated number and then pick the next value.
- Keep the test method code in the source file ordered based
on the Heat3xx value.
- List the new rule in the top level HACKING.rst file
- Add test cases for each new rule to heat/tests/test_hacking.py
"""
def no_log_warn(logical_line):
"""Disallow 'LOG.warn('
https://bugs.launchpad.net/tempest/+bug/1508442
Heat301
"""
if logical_line.startswith('LOG.warn('):
yield(0, 'Heat301 Use LOG.warning() rather than LOG.warn()')
def check_python3_no_iteritems(logical_line):
msg = ("Heat302: Use dict.items() instead of dict.iteritems().")
if re.search(r".*\.iteritems\(\)", logical_line):
yield(0, msg)
def check_python3_no_iterkeys(logical_line):
msg = ("Heat303: Use dict.keys() instead of dict.iterkeys().")
if re.search(r".*\.iterkeys\(\)", logical_line):
yield(0, msg)
def check_python3_no_itervalues(logical_line):
msg = ("Heat304: Use dict.values() instead of dict.itervalues().")
if re.search(r".*\.itervalues\(\)", logical_line):
yield(0, msg)
def factory(register):
register(no_log_warn)
register(check_python3_no_iteritems)
register(check_python3_no_iterkeys)
register(check_python3_no_itervalues)
| {
"content_hash": "42b20496bdcf1b152f829fe6e7bddcfe",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 70,
"avg_line_length": 27.436363636363637,
"alnum_prop": 0.6832339297548045,
"repo_name": "steveb/heat",
"id": "dade30bb25a44e1bebac2349d253b7118b3201f3",
"size": "2122",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "heat/hacking/checks.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "1226938"
},
{
"name": "Shell",
"bytes": "17870"
}
],
"symlink_target": ""
} |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
from past.utils import old_div
from future.moves.urllib.parse import urlencode
import logging
from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
import feedparser
__author__ = 'deksan'
log = logging.getLogger('newznab')
class Newznab(object):
"""
Newznab search plugin
Provide a url or your website + apikey and a category
Config example::
newznab:
url: "http://website/api?apikey=xxxxxxxxxxxxxxxxxxxxxxxxxx&t=movie&extended=1"
website: https://website
apikey: xxxxxxxxxxxxxxxxxxxxxxxxxx
category: movie
Category is any of: movie, tvsearch, music, book
"""
schema = {
'type': 'object',
'properties': {
'category': {'type': 'string', 'enum': ['movie', 'tvsearch', 'tv', 'music', 'book']},
'url': {'type': 'string', 'format': 'url'},
'website': {'type': 'string', 'format': 'url'},
'apikey': {'type': 'string'}
},
'required': ['category'],
'additionalProperties': False
}
def build_config(self, config):
log.debug(type(config))
if config['category'] == 'tv':
config['category'] = 'tvsearch'
if 'url' not in config:
if 'apikey' in config and 'website' in config:
params = {
't': config['category'],
'apikey': config['apikey'],
'extended': 1
}
config['url'] = config['website'] + '/api?' + urlencode(params)
return config
def fill_entries_for_url(self, url, task):
entries = []
log.verbose('Fetching %s' % url)
try:
r = task.requests.get(url)
except task.requests.RequestException as e:
log.error("Failed fetching '%s': %s" % (url, e))
rss = feedparser.parse(r.content)
log.debug("Raw RSS: %s" % rss)
if not len(rss.entries):
log.info('No results returned')
for rss_entry in rss.entries:
new_entry = Entry()
for key in list(rss_entry.keys()):
new_entry[key] = rss_entry[key]
new_entry['url'] = new_entry['link']
if rss_entry.enclosures:
size = int(rss_entry.enclosures[0]['length']) # B
new_entry['content_size'] = old_div(size, 2**20) # MB
entries.append(new_entry)
return entries
def search(self, task, entry, config=None):
config = self.build_config(config)
if config['category'] == 'movie':
return self.do_search_movie(entry, task, config)
elif config['category'] == 'tvsearch':
return self.do_search_tvsearch(entry, task, config)
else:
entries = []
log.warning("Not done yet...")
return entries
def do_search_tvsearch(self, arg_entry, task, config=None):
log.info('Searching for %s' % (arg_entry['title']))
# normally this should be used with emit_series who has provided season and episodenumber
if 'series_name' not in arg_entry or 'series_season' not in arg_entry or 'series_episode' not in arg_entry:
return []
if 'tvrage_id' not in arg_entry:
# TODO: Is newznab replacing tvrage with something else? Update this.
log.warning('tvrage lookup support is gone, someone needs to update this plugin!')
return []
url = (config['url'] + '&rid=%s&season=%s&ep=%s' %
(arg_entry['tvrage_id'], arg_entry['series_season'], arg_entry['series_episode']))
return self.fill_entries_for_url(url, task)
def do_search_movie(self, arg_entry, task, config=None):
entries = []
log.info('Searching for %s (imdbid:%s)' % (arg_entry['title'], arg_entry['imdb_id']))
# normally this should be used with emit_movie_queue who has imdbid (i guess)
if 'imdb_id' not in arg_entry:
return entries
imdb_id = arg_entry['imdb_id'].replace('tt', '')
url = config['url'] + '&imdbid=' + imdb_id
return self.fill_entries_for_url(url, task)
@event('plugin.register')
def register_plugin():
plugin.register(Newznab, 'newznab', api_ver=2, groups=['search'])
| {
"content_hash": "6b405d8c878cabb10efb56159c0c81ee",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 115,
"avg_line_length": 35.0859375,
"alnum_prop": 0.5686929414384324,
"repo_name": "qvazzler/Flexget",
"id": "ef644b7654bfeca4587c113f27302a382a1b8885",
"size": "4491",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "flexget/plugins/search/newznab.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "5275"
},
{
"name": "HTML",
"bytes": "33930"
},
{
"name": "JavaScript",
"bytes": "58811"
},
{
"name": "Python",
"bytes": "2428468"
}
],
"symlink_target": ""
} |
from __future__ import absolute_import
import os
import shutil
import nox
LOCAL_DEPS = (os.path.join("..", "api_core"), os.path.join("..", "core"))
@nox.session(python="3.7")
def lint(session):
"""Run linters.
Returns a failure if the linters find linting errors or sufficiently
serious code quality issues.
"""
session.install("flake8", "black", *LOCAL_DEPS)
session.run(
"black",
"--check",
"google",
"tests",
"docs",
)
session.run("flake8", "google", "tests")
@nox.session(python="3.6")
def blacken(session):
"""Run black.
Format code to uniform standard.
This currently uses Python 3.6 due to the automated Kokoro run of synthtool.
That run uses an image that doesn't have 3.6 installed. Before updating this
check the state of the `gcp_ubuntu_config` we use for that Kokoro run.
"""
session.install("black")
session.run(
"black",
"google",
"tests",
"docs",
)
@nox.session(python="3.7")
def lint_setup_py(session):
"""Verify that setup.py is valid (including RST check)."""
session.install("docutils", "pygments")
session.run("python", "setup.py", "check", "--restructuredtext", "--strict")
def default(session):
# Install all test dependencies, then install this package in-place.
session.install("mock", "pytest", "pytest-cov")
for local_dep in LOCAL_DEPS:
session.install("-e", local_dep)
session.install("-e", ".")
# Run py.test against the unit tests.
session.run(
"py.test",
"--quiet",
"--cov=google.cloud",
"--cov=tests.unit",
"--cov-append",
"--cov-config=.coveragerc",
"--cov-report=",
"--cov-fail-under=97",
os.path.join("tests", "unit"),
*session.posargs,
)
@nox.session(python=["2.7", "3.5", "3.6", "3.7"])
def unit(session):
"""Run the unit test suite."""
default(session)
@nox.session(python=["2.7", "3.7"])
def system(session):
"""Run the system test suite."""
system_test_path = os.path.join("tests", "system.py")
system_test_folder_path = os.path.join("tests", "system")
# Sanity check: Only run tests if the environment variable is set.
if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""):
session.skip("Credentials must be set via environment variable")
system_test_exists = os.path.exists(system_test_path)
system_test_folder_exists = os.path.exists(system_test_folder_path)
# Sanity check: only run tests if found.
if not system_test_exists and not system_test_folder_exists:
session.skip("System tests were not found")
# Use pre-release gRPC for system tests.
session.install("--pre", "grpcio")
# Install all test dependencies, then install this package into the
# virtualenv's dist-packages.
session.install("mock", "pytest")
for local_dep in LOCAL_DEPS:
session.install("-e", local_dep)
session.install("-e", "../test_utils/")
session.install("-e", ".")
# Run py.test against the system tests.
if system_test_exists:
session.run("py.test", "--quiet", system_test_path, *session.posargs)
if system_test_folder_exists:
session.run("py.test", "--quiet", system_test_folder_path, *session.posargs)
@nox.session(python="3.7")
def cover(session):
"""Run the final coverage report.
This outputs the coverage report aggregating coverage from the unit
test runs (not system test runs), and then erases coverage data.
"""
session.install("coverage", "pytest-cov")
session.run("coverage", "report", "--show-missing", "--fail-under=97")
session.run("coverage", "erase")
@nox.session(python="3.7")
def docs(session):
"""Build the docs for this library."""
session.install('-e', '.')
session.install('sphinx', 'alabaster', 'recommonmark')
shutil.rmtree(os.path.join('docs', '_build'), ignore_errors=True)
session.run(
'sphinx-build',
'-W', # warnings as errors
'-T', # show full traceback on exception
'-N', # no colors
'-b', 'html',
'-d', os.path.join('docs', '_build', 'doctrees', ''),
os.path.join('docs', ''),
os.path.join('docs', '_build', 'html', ''),
)
| {
"content_hash": "cbe5696db6d5ee1675d1e6c9fd195c6e",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 84,
"avg_line_length": 30.069444444444443,
"alnum_prop": 0.6127020785219399,
"repo_name": "tswast/google-cloud-python",
"id": "95fd3d91a09533db09ecfd11cba00f3c32f9b6ad",
"size": "4932",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "monitoring/noxfile.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "1094"
},
{
"name": "Python",
"bytes": "33785371"
},
{
"name": "Shell",
"bytes": "9148"
}
],
"symlink_target": ""
} |
import ShtikerPage
from direct.gui.DirectGui import *
from pandac.PandaModules import *
from toontown.toon import NPCFriendPanel
from toontown.toonbase import TTLocalizer
class NPCFriendPage(ShtikerPage.ShtikerPage):
def __init__(self):
ShtikerPage.ShtikerPage.__init__(self)
def load(self):
self.title = DirectLabel(parent=self, relief=None, text=TTLocalizer.NPCFriendPageTitle, text_scale=0.12, textMayChange=0, pos=(0, 0, 0.6))
self.friendPanel = NPCFriendPanel.NPCFriendPanel(parent=self)
self.friendPanel.setScale(0.1225)
self.friendPanel.setZ(-0.03)
return
def unload(self):
ShtikerPage.ShtikerPage.unload(self)
del self.title
del self.friendPanel
def updatePage(self):
self.friendPanel.update(base.localAvatar.NPCFriendsDict, fCallable=0)
def enter(self):
self.updatePage()
ShtikerPage.ShtikerPage.enter(self)
def exit(self):
ShtikerPage.ShtikerPage.exit(self) | {
"content_hash": "8d618a82c612d7895ca0deb84c687c35",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 146,
"avg_line_length": 31.3125,
"alnum_prop": 0.7015968063872255,
"repo_name": "Spiderlover/Toontown",
"id": "f48db77f2306294d6ea136fc5574b0984c4d1f36",
"size": "1002",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "toontown/shtiker/NPCFriendPage.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "7774"
},
{
"name": "Python",
"bytes": "17241353"
},
{
"name": "Shell",
"bytes": "7699"
}
],
"symlink_target": ""
} |
import os
import unittest
import random
from test import test_support
thread = test_support.import_module('thread')
import time
import sys
import weakref
from test import lock_tests
NUMTASKS = 10
NUMTRIPS = 3
_print_mutex = thread.allocate_lock()
def verbose_print(arg):
"""Helper function for printing out debugging output."""
if test_support.verbose:
with _print_mutex:
print arg
class BasicThreadTest(unittest.TestCase):
def setUp(self):
self.done_mutex = thread.allocate_lock()
self.done_mutex.acquire()
self.running_mutex = thread.allocate_lock()
self.random_mutex = thread.allocate_lock()
self.created = 0
self.running = 0
self.next_ident = 0
class ThreadRunningTests(BasicThreadTest):
def newtask(self):
with self.running_mutex:
self.next_ident += 1
verbose_print("creating task %s" % self.next_ident)
thread.start_new_thread(self.task, (self.next_ident,))
self.created += 1
self.running += 1
def task(self, ident):
with self.random_mutex:
delay = random.random() / 10000.0
verbose_print("task %s will run for %sus" % (ident, round(delay*1e6)))
time.sleep(delay)
verbose_print("task %s done" % ident)
with self.running_mutex:
self.running -= 1
if self.created == NUMTASKS and self.running == 0:
self.done_mutex.release()
def test_starting_threads(self):
# Basic test for thread creation.
for i in range(NUMTASKS):
self.newtask()
verbose_print("waiting for tasks to complete...")
self.done_mutex.acquire()
verbose_print("all tasks done")
def test_stack_size(self):
# Various stack size tests.
self.assertEqual(thread.stack_size(), 0, "initial stack size is not 0")
thread.stack_size(0)
self.assertEqual(thread.stack_size(), 0, "stack_size not reset to default")
if os.name not in ("nt", "os2", "posix"):
return
tss_supported = True
try:
thread.stack_size(4096)
except ValueError:
verbose_print("caught expected ValueError setting "
"stack_size(4096)")
except thread.error:
tss_supported = False
verbose_print("platform does not support changing thread stack "
"size")
if tss_supported:
fail_msg = "stack_size(%d) failed - should succeed"
for tss in (262144, 0x100000, 0):
thread.stack_size(tss)
self.assertEqual(thread.stack_size(), tss, fail_msg % tss)
verbose_print("successfully set stack_size(%d)" % tss)
for tss in (262144, 0x100000):
verbose_print("trying stack_size = (%d)" % tss)
self.next_ident = 0
self.created = 0
for i in range(NUMTASKS):
self.newtask()
verbose_print("waiting for all tasks to complete")
self.done_mutex.acquire()
verbose_print("all tasks done")
thread.stack_size(0)
def test__count(self):
# Test the _count() function.
orig = thread._count()
mut = thread.allocate_lock()
mut.acquire()
started = []
def task():
started.append(None)
mut.acquire()
mut.release()
thread.start_new_thread(task, ())
while not started:
time.sleep(0.01)
self.assertEqual(thread._count(), orig + 1)
# Allow the task to finish.
mut.release()
# The only reliable way to be sure that the thread ended from the
# interpreter's point of view is to wait for the function object to be
# destroyed.
done = []
wr = weakref.ref(task, lambda _: done.append(None))
del task
while not done:
time.sleep(0.01)
self.assertEqual(thread._count(), orig)
class Barrier:
def __init__(self, num_threads):
self.num_threads = num_threads
self.waiting = 0
self.checkin_mutex = thread.allocate_lock()
self.checkout_mutex = thread.allocate_lock()
self.checkout_mutex.acquire()
def enter(self):
self.checkin_mutex.acquire()
self.waiting = self.waiting + 1
if self.waiting == self.num_threads:
self.waiting = self.num_threads - 1
self.checkout_mutex.release()
return
self.checkin_mutex.release()
self.checkout_mutex.acquire()
self.waiting = self.waiting - 1
if self.waiting == 0:
self.checkin_mutex.release()
return
self.checkout_mutex.release()
class BarrierTest(BasicThreadTest):
def test_barrier(self):
self.bar = Barrier(NUMTASKS)
self.running = NUMTASKS
for i in range(NUMTASKS):
thread.start_new_thread(self.task2, (i,))
verbose_print("waiting for tasks to end")
self.done_mutex.acquire()
verbose_print("tasks done")
def task2(self, ident):
for i in range(NUMTRIPS):
if ident == 0:
# give it a good chance to enter the next
# barrier before the others are all out
# of the current one
delay = 0
else:
with self.random_mutex:
delay = random.random() / 10000.0
verbose_print("task %s will run for %sus" %
(ident, round(delay * 1e6)))
time.sleep(delay)
verbose_print("task %s entering %s" % (ident, i))
self.bar.enter()
verbose_print("task %s leaving barrier" % ident)
with self.running_mutex:
self.running -= 1
# Must release mutex before releasing done, else the main thread can
# exit and set mutex to None as part of global teardown; then
# mutex.release() raises AttributeError.
finished = self.running == 0
if finished:
self.done_mutex.release()
class LockTests(lock_tests.LockTests):
locktype = thread.allocate_lock
class TestForkInThread(unittest.TestCase):
def setUp(self):
self.read_fd, self.write_fd = os.pipe()
@unittest.skipIf(sys.platform.startswith('win'),
"This test is only appropriate for POSIX-like systems.")
@test_support.reap_threads
def test_forkinthread(self):
def thread1():
try:
pid = os.fork() # fork in a thread
except RuntimeError:
sys.exit(0) # exit the child
if pid == 0: # child
os.close(self.read_fd)
os.write(self.write_fd, "OK")
sys.exit(0)
else: # parent
os.close(self.write_fd)
thread.start_new_thread(thread1, ())
self.assertEqual(os.read(self.read_fd, 2), "OK",
"Unable to fork() in thread")
def tearDown(self):
try:
os.close(self.read_fd)
except OSError:
pass
try:
os.close(self.write_fd)
except OSError:
pass
def test_main():
test_support.run_unittest(ThreadRunningTests, BarrierTest, LockTests,
TestForkInThread)
if __name__ == "__main__":
test_main()
| {
"content_hash": "5857ecd7e62b215681b731f389457a27",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 83,
"avg_line_length": 31.35123966942149,
"alnum_prop": 0.5545011203374193,
"repo_name": "fkolacek/FIT-VUT",
"id": "544e70d2fdf7ab3a599def978979628c01c8530f",
"size": "7587",
"binary": false,
"copies": "35",
"ref": "refs/heads/master",
"path": "bp-revok/python/lib/python2.7/test/test_thread.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "455326"
},
{
"name": "Awk",
"bytes": "8724"
},
{
"name": "Batchfile",
"bytes": "201"
},
{
"name": "Brainfuck",
"bytes": "83"
},
{
"name": "C",
"bytes": "5006938"
},
{
"name": "C++",
"bytes": "1835332"
},
{
"name": "CSS",
"bytes": "301045"
},
{
"name": "CoffeeScript",
"bytes": "46327"
},
{
"name": "Groff",
"bytes": "46766"
},
{
"name": "HTML",
"bytes": "937735"
},
{
"name": "Java",
"bytes": "552132"
},
{
"name": "JavaScript",
"bytes": "1742225"
},
{
"name": "Lua",
"bytes": "39700"
},
{
"name": "Makefile",
"bytes": "381793"
},
{
"name": "Objective-C",
"bytes": "4618"
},
{
"name": "PHP",
"bytes": "108701"
},
{
"name": "PLSQL",
"bytes": "22886"
},
{
"name": "Perl",
"bytes": "60353"
},
{
"name": "Python",
"bytes": "22084026"
},
{
"name": "QMake",
"bytes": "2660"
},
{
"name": "R",
"bytes": "1370"
},
{
"name": "Ragel in Ruby Host",
"bytes": "17993"
},
{
"name": "Ruby",
"bytes": "21607145"
},
{
"name": "Shell",
"bytes": "611321"
},
{
"name": "Tcl",
"bytes": "4920"
},
{
"name": "TeX",
"bytes": "561423"
},
{
"name": "VHDL",
"bytes": "49180"
},
{
"name": "Visual Basic",
"bytes": "481"
},
{
"name": "XSLT",
"bytes": "154638"
},
{
"name": "Yacc",
"bytes": "32788"
}
],
"symlink_target": ""
} |
from django.core.exceptions import PermissionDenied
from django.core.paginator import Paginator
from django.shortcuts import get_object_or_404, redirect
from django.template.response import TemplateResponse
from django.urls import reverse
from django.utils.translation import gettext as _
from wagtail.admin import messages
from wagtail.core import hooks
from wagtail.core.actions.move_page import MovePageAction
from wagtail.core.models import Page
def move_choose_destination(request, page_to_move_id, viewed_page_id=None):
page_to_move = get_object_or_404(Page, id=page_to_move_id)
page_perms = page_to_move.permissions_for_user(request.user)
if not page_perms.can_move():
raise PermissionDenied
if viewed_page_id:
viewed_page = get_object_or_404(Page, id=viewed_page_id)
else:
viewed_page = page_to_move.get_parent()
viewed_page.can_choose = page_perms.can_move_to(viewed_page)
child_pages = []
for target in viewed_page.get_children():
# can't move the page into itself or its descendants
target.can_choose = page_perms.can_move_to(target)
target.can_descend = (
not(target == page_to_move
or target.is_child_of(page_to_move))
and target.get_children_count()
)
child_pages.append(target)
# Pagination
paginator = Paginator(child_pages, per_page=50)
child_pages = paginator.get_page(request.GET.get('p'))
return TemplateResponse(request, 'wagtailadmin/pages/move_choose_destination.html', {
'page_to_move': page_to_move,
'viewed_page': viewed_page,
'child_pages': child_pages,
})
def move_confirm(request, page_to_move_id, destination_id):
page_to_move = get_object_or_404(Page, id=page_to_move_id).specific
# Needs .specific_deferred because the .get_admin_display_title method is called in template
destination = get_object_or_404(Page, id=destination_id).specific_deferred
if not Page._slug_is_available(page_to_move.slug, destination, page=page_to_move):
messages.error(
request,
_("The slug '{0}' is already in use at the selected parent page. Make sure the slug is unique and try again").format(page_to_move.slug)
)
return redirect('wagtailadmin_pages:move_choose_destination', page_to_move.id, destination.id)
for fn in hooks.get_hooks('before_move_page'):
result = fn(request, page_to_move, destination)
if hasattr(result, 'status_code'):
return result
if request.method == 'POST':
# any invalid moves *should* be caught by the permission check in the action class,
# so don't bother to catch InvalidMoveToDescendant
action = MovePageAction(page_to_move, destination, pos='last-child', user=request.user)
action.execute()
messages.success(request, _("Page '{0}' moved.").format(page_to_move.get_admin_display_title()), buttons=[
messages.button(reverse('wagtailadmin_pages:edit', args=(page_to_move.id,)), _('Edit'))
])
for fn in hooks.get_hooks('after_move_page'):
result = fn(request, page_to_move)
if hasattr(result, 'status_code'):
return result
return redirect('wagtailadmin_explore', destination.id)
return TemplateResponse(request, 'wagtailadmin/pages/confirm_move.html', {
'page_to_move': page_to_move,
'destination': destination,
})
| {
"content_hash": "59ec0ca48ab4bad57074985fb67b061e",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 147,
"avg_line_length": 39.69318181818182,
"alnum_prop": 0.6713426853707415,
"repo_name": "mixxorz/wagtail",
"id": "05d40fa80b3d482d2237da7646b3feb6cfd9d922",
"size": "3493",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "wagtail/admin/views/pages/move.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "3390"
},
{
"name": "Dockerfile",
"bytes": "2041"
},
{
"name": "HTML",
"bytes": "560244"
},
{
"name": "JavaScript",
"bytes": "508189"
},
{
"name": "Makefile",
"bytes": "1014"
},
{
"name": "Python",
"bytes": "5487927"
},
{
"name": "SCSS",
"bytes": "246385"
},
{
"name": "Shell",
"bytes": "6688"
},
{
"name": "TypeScript",
"bytes": "237634"
}
],
"symlink_target": ""
} |
"""OnticProperty unit tests."""
from copy import copy, deepcopy
from ontic import OnticProperty
from ontic.property import perfect_property, validate_property
from ontic.validation_exception import ValidationException
from test.utils import BaseTestCase
class OnticPropertyTest(BaseTestCase):
"""OnticProperty test cases."""
def test_ontic_property_instantiation(self):
"""OnticProperty instantiation testing to confirm dict behaviour."""
ontic_property1 = OnticProperty(name='dude')
self.assertIsNotNone(ontic_property1)
# Test dictionary initialization.
ontic_property2 = OnticProperty(
{
'name': 'dudette',
'type': int,
'default': 1,
'required': True
}
)
self.assertIsNotNone(ontic_property2)
self.assertEqual('dudette', ontic_property2.name)
self.assertEqual(int, ontic_property2['type'])
self.assertEqual(1, ontic_property2.default)
self.assertEqual(True, ontic_property2['required'])
# Test initialization by property.
ontic_property3 = OnticProperty(
name='hal',
type=int,
default=1,
required=True)
self.assertIsNotNone(ontic_property3)
self.assertEqual('hal', ontic_property3['name'])
self.assertEqual(int, ontic_property3.type)
self.assertEqual(1, ontic_property3['default'])
self.assertEqual(True, ontic_property3.required)
# Test initialization by list.
ontic_property4 = OnticProperty(
[['name', 'fin'], ['type', int], ['default', 1],
['required', True]])
self.assertIsNotNone(ontic_property4)
self.assertEqual('fin', ontic_property4.name)
self.assertEqual(int, ontic_property4['type'])
self.assertEqual(1, ontic_property4.default)
self.assertEqual(True, ontic_property4['required'])
def test_validate_value_wo_validation_exception(self):
"""Ensure OnticProperty property validate_value function returns a list of validation errors."""
ontic_property = OnticProperty(
{
'name': 'dudete',
'type': int,
'default': 1,
'required': True
}
)
result = ontic_property.validate_value('some string',
raise_validation_exception=False)
self.assertIsNotNone(result)
expected_list = [
'The value for "dudete" is not of type "<class \'int\'>": some string']
self.assertListEqual(expected_list, result)
def test_validate_value_w_validation_exception(self):
"""Ensure OnticProperty property validate_value function raises exception on validation errors."""
ontic_property = OnticProperty(
{
'name': 'dudete',
'type': int,
'default': 1,
'required': True
}
)
self.assertRaisesRegex(
ValidationException,
r'The value for "dudete" is not of type "<class \'int\'>": some string',
ontic_property.validate_value,
'some string',
raise_validation_exception=True)
def test_dynamic_access(self):
"""Ensure OnticProperty property access as dict and attribute."""
the_property = OnticProperty(name='bill')
self.assert_dynamic_accessing(the_property)
def test_copy(self):
"""Ensure that OnticProperty supports copy operations."""
# Create the test data.
ontic_property = OnticProperty(
name='phil',
type=str,
required=False,
enum={'dog', 'cat'},
)
# Execute the test.
property_copy = copy(ontic_property)
# Validate the test results.
self.assertIsNot(ontic_property, property_copy)
self.assertIs(ontic_property.type, property_copy.type)
self.assertIs(ontic_property.required, property_copy.required)
self.assertSetEqual(ontic_property.enum, property_copy.enum)
def test_deepcopy(self):
"""Ensure that Meta supports deepcopy operation."""
# Create the test data.
ontic_property = OnticProperty(
name='susan',
type=str,
required=False,
enum={'dog', 'cat'},
)
# Execute the test.
property_copy = deepcopy(ontic_property)
# Validate the test results.
self.assertIsNot(ontic_property, property_copy)
self.assertIs(ontic_property.type, property_copy.type)
self.assertIs(ontic_property.required, property_copy.required)
self.assertSetEqual(ontic_property.enum, property_copy.enum)
def test_property_type_instantiation_failure(self):
"""Validate error reporting for bad OnticProperty definition."""
bad_schema_test_case = {'type': 'UNDEFINED'}
self.assertRaisesRegex(
ValueError,
r"""Illegal type declaration: UNDEFINED""",
OnticProperty, bad_schema_test_case)
class UNDEFINED(object):
pass
bad_schema_test_case = {'type': UNDEFINED}
self.assertRaisesRegex(
ValueError,
r"""Illegal type declaration: %s""" % UNDEFINED,
OnticProperty, bad_schema_test_case)
def test_property_type_validate(self):
"""Test OnticProperty.validate method."""
property_schema = OnticProperty(name='duh_prop')
self.assertIsNotNone(property_schema)
property_schema.type = int
self.assertEqual([], property_schema.validate())
property_schema.type = '__WRONG__'
self.assertRaises(ValidationException, property_schema.validate)
def test_property_schema_perfect(self):
"""Test OnticProperty.perfect method."""
candidate_schema_property = OnticProperty(name='frog')
self.assertEqual(11, len(candidate_schema_property))
self.assertDictEqual(
{
'name': 'frog',
'default': None,
'enum': None,
'member_max': None,
'member_min': None,
'member_type': None,
'max': None,
'min': None,
'regex': None,
'required': False,
'type': None
},
candidate_schema_property)
# Remove a property and ensure perfect returns it.
delattr(candidate_schema_property, 'type')
self.assertEqual(10, len(candidate_schema_property))
candidate_schema_property.perfect()
self.assertEqual(11, len(candidate_schema_property))
self.assertDictEqual(
{
'name': 'frog',
'regex': None,
'member_max': None,
'enum': None,
'min': None,
'default': None,
'max': None,
'required': False,
'member_min': None,
'member_type': None,
'type': None
}, candidate_schema_property)
def test_perfect_partial_schema_property(self):
"""Validate the perfection of a partial schema definition."""
candidate_schema_property = OnticProperty(
{
'name': 'goat',
'type': 'int',
'required': True,
'UNRECOGNIZED': 'irrelevant',
})
self.assertEqual(11, len(candidate_schema_property))
self.assertDictEqual(
{
'name': 'goat',
'regex': None,
'member_max': None,
'enum': None,
'min': None,
'default': None,
'max': None,
'required': True,
'member_min': None,
'member_type': None,
'type': int
},
candidate_schema_property)
# Remove a property and ensure perfect returns it.
delattr(candidate_schema_property, 'enum')
self.assertEqual(10, len(candidate_schema_property))
candidate_schema_property.perfect()
self.assertEqual(11, len(candidate_schema_property))
self.assertDictEqual(
{
'name': 'goat',
'regex': None,
'member_max': None,
'enum': None,
'min': None,
'default': None,
'max': None,
'required': True,
'member_min': None,
'member_type': None,
'type': int
}, candidate_schema_property)
class PerfectSchemaPropertyTestCase(BaseTestCase):
"""Test cases for the perfect_property method."""
def test_perfect_empty_schema_property(self):
"""Validate the perfection of an empty schema property."""
candidate_schema_property = OnticProperty(name='b_bop')
self.assertEqual(11, len(candidate_schema_property))
self.assertDictEqual(
{
'name': 'b_bop',
'default': None,
'enum': None,
'member_max': None,
'member_min': None,
'member_type': None,
'max': None,
'min': None,
'regex': None,
'required': False,
'type': None
},
candidate_schema_property)
# Remove a property and ensure perfect returns it.
delattr(candidate_schema_property, 'type')
self.assertEqual(10, len(candidate_schema_property))
perfect_property(candidate_schema_property)
self.assertEqual(11, len(candidate_schema_property))
self.assertDictEqual(
{
'name': 'b_bop',
'regex': None,
'member_max': None,
'enum': None,
'min': None,
'default': None,
'max': None,
'required': False,
'member_min': None,
'member_type': None,
'type': None
}, candidate_schema_property)
def test_perfect_partial_schema_property(self):
"""Validate the perfection of a partial schema definition."""
candidate_schema_property = OnticProperty(
{
'name': 'the_prop',
'type': 'int',
'required': True,
'UNRECOGNIZED': 'irrelevant',
})
self.assertEqual(11, len(candidate_schema_property))
self.assertDictEqual(
{
'name': 'the_prop',
'regex': None,
'member_max': None,
'enum': None,
'min': None,
'default': None,
'max': None,
'required': True,
'member_min': None,
'member_type': None,
'type': int
},
candidate_schema_property)
# Remove a property and ensure perfect returns it.
delattr(candidate_schema_property, 'min')
self.assertEqual(10, len(candidate_schema_property))
perfect_property(candidate_schema_property)
self.assertEqual(11, len(candidate_schema_property))
self.assertDictEqual(
{
'name': 'the_prop',
'regex': None,
'member_max': None,
'enum': None,
'min': None,
'default': None,
'max': None,
'required': True,
'member_min': None,
'member_type': None,
'type': int
}, candidate_schema_property)
def test_bad_perfect_schema_property(self):
"""Validate error handling for bad schemas passed to
perfect_property."""
self.assertRaisesRegex(
ValueError,
'"ontic_property" must be provided.',
perfect_property, None)
self.assertRaisesRegex(
ValueError,
'"ontic_property" must be OnticProperty type.',
perfect_property, {})
class ValidateSchemaProperty(BaseTestCase):
"""Various tests of the 'validate_property_type' method."""
def test_bad_validate_schema_property_call(self):
"""Test bad use cases of validate_property_type function call."""
self.assertRaisesRegex(
ValueError,
'"ontic_property" must be provided.',
validate_property, None, list())
self.assertRaisesRegex(
ValueError,
'"ontic_property" must be OnticProperty type.',
validate_property, dict(), list())
def test_validate_schema_property_exception(self):
"""Test validate_schema validation exception handling."""
invalid_property_schema = OnticProperty(name='my_prop')
invalid_property_schema.type = 'UNKNOWN'
self.maxDiff = None
self.assertRaisesRegex(
ValidationException,
r"""The value "UNKNOWN" for "type" not in enumeration \[.*\].""",
validate_property, invalid_property_schema)
value_errors = validate_property(
invalid_property_schema,
raise_validation_exception=False)
self.assertEqual(1, len(value_errors))
self.assertTrue(value_errors[0].startswith(
'The value "UNKNOWN" for "type" not in enumeration'))
def test_validate_schema_bad_member_type(self):
"""Test validate for bad member type."""
invalid_property_schema = OnticProperty(name='a_prop')
invalid_property_schema.type = list
invalid_property_schema.member_type = 'UNKNOWN'
self.maxDiff = None
self.assertRaisesRegex(
ValidationException,
r"""The value "UNKNOWN" for "member_type" not in enumeration \[<class 'bool'>, <class 'complex'>, """
r"""<class 'datetime.date'>, <class 'datetime.datetime'>, <class 'datetime.time'>, <class 'dict'>"""
r""", <class 'float'>, <class 'int'>, <class 'list'>, <class 'set'>, <class 'str'>, <class 'tuple'>, None\].""",
validate_property, invalid_property_schema)
value_errors = validate_property(
invalid_property_schema,
raise_validation_exception=False)
self.assertEqual(1, len(value_errors))
self.assertEqual(
"""The value "UNKNOWN" for "member_type" not in enumeration [<class 'bool'>, <class 'complex'>, """
"""<class 'datetime.date'>, <class 'datetime.datetime'>, <class 'datetime.time'>, <class 'dict'>, """
"""<class 'float'>, <class 'int'>, <class 'list'>, <class 'set'>, <class 'str'>, <class 'tuple'>, None].""",
value_errors[0])
| {
"content_hash": "0d04eeeb7de14abd6956893dbcc263b3",
"timestamp": "",
"source": "github",
"line_count": 421,
"max_line_length": 124,
"avg_line_length": 35.7624703087886,
"alnum_prop": 0.5454968119022316,
"repo_name": "neoinsanity/ontic",
"id": "8b3270088feef054f521b5e8f5eaf087d437605a",
"size": "15056",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "test/ontic_property_test.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "139706"
},
{
"name": "Shell",
"bytes": "3856"
}
],
"symlink_target": ""
} |
from .. import factory
from flask import Blueprint, render_template
bp = Blueprint('bp', __name__)
from .extensions import assets, babel
from . import dashboard
def create_app(name=None, settings=None):
app = factory.create_app(name or __name__, settings=settings)
babel.init_app(app)
app.register_blueprint(bp)
return app
| {
"content_hash": "36948258519fa8205d4c9bd8203b9bca",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 66,
"avg_line_length": 21.6875,
"alnum_prop": 0.7060518731988472,
"repo_name": "buddha314/pathfinder-game-manager",
"id": "b89273e146ef942fcc8d72b556ddbb83343a5dcd",
"size": "347",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/views/__init__.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "116886"
}
],
"symlink_target": ""
} |
import warnings
from .util import configobj_walker as new_configobj_walker
if False: # MYPY
from typing import Any # NOQA
def configobj_walker(cfg):
# type: (Any) -> Any
warnings.warn('configobj_walker has moved to ruamel.yaml.util, please update your code')
return new_configobj_walker(cfg)
| {
"content_hash": "55f515c77a54852e06cbf3c99fb204cf",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 92,
"avg_line_length": 26.166666666666668,
"alnum_prop": 0.7197452229299363,
"repo_name": "rochacbruno/dynaconf",
"id": "711efbc2dc16ce60fefe437df57dba8719b3502f",
"size": "331",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "dynaconf/vendor_src/ruamel/yaml/configobjwalker.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2867"
},
{
"name": "Makefile",
"bytes": "11505"
},
{
"name": "Python",
"bytes": "1438471"
},
{
"name": "Shell",
"bytes": "14740"
}
],
"symlink_target": ""
} |
from api import database
from api.database.table import Table, TableTypes
def message_count_get(server_id):
'''Get the current message count.'''
database.init()
table_message_count = Table('user_messages_{}'.format(server_id), TableTypes.pGlobal)
return table_message_count.getLatestID()
# Log messages to database.
def message_log(msg, server_id):
'''Log a message into the database.'''
database.init()
table_log = Table('user_messages_{}'.format(server_id), TableTypes.pGlobal)
Table.insert(table_log, dict(userid=msg.author.id, username=msg.author.name,
message=msg.content, serverid=msg.server.id,
servername=msg.server.name))
| {
"content_hash": "b5378d76a3eb80d42709d472d4c16f82",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 89,
"avg_line_length": 38.578947368421055,
"alnum_prop": 0.6589358799454298,
"repo_name": "dhinakg/BitSTAR",
"id": "24379a48a8357c2073b6ed754a6153fa478a243a",
"size": "1379",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "api/logging.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "189"
},
{
"name": "Python",
"bytes": "130334"
},
{
"name": "Shell",
"bytes": "52"
}
],
"symlink_target": ""
} |
class DownloadimagePipeline(object):
def process_item(self, item, spider):
return item
| {
"content_hash": "bf37f848832d37f77b67d8b103078cf8",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 41,
"avg_line_length": 33,
"alnum_prop": 0.7070707070707071,
"repo_name": "knarfeh/DoubanPhotoAlbumCrawl",
"id": "fe5eacf8425f0bb42b605d6f5ee682728e179212",
"size": "257",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "DownloadImage/DownloadImage/pipelines.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "4036"
}
],
"symlink_target": ""
} |
from model.group import Group
class GroupHelper:
def __init__(self,app):
self.app = app
def open_groups_page(self):
wd = self.app.wd
if not (wd.current_url.endswith("/groups.php") and len(wd.find_elements_by_name("new")) > 0):
wd.find_element_by_link_text("groups").click()
def create(self, group):
wd = self.app.wd
self.open_groups_page()
# init group creation
wd.find_element_by_name("new").click()
self.fill_group_form(group)
# submit group creation
wd.find_element_by_name("submit").click()
self.return_to_groups_page()
def fill_group_form(self, group):
# fill group form
wd = self.app.wd
self.change_field_value("group_name", group.name)
self.change_field_value("group_header", group.header)
self.change_field_value("group_footer", group.footer)
def change_field_value(self, field_name, text):
wd = self.app.wd
if text is not None:
wd.find_element_by_name(field_name).click()
wd.find_element_by_name(field_name).clear()
wd.find_element_by_name(field_name).send_keys(text)
def edit_first_group(self):
wd = self.app.wd
self.open_groups_page()
# select first group
wd.find_element_by_name("selected[]").click()
wd.find_element_by_xpath("//div[@id='content']/form/input[6]").click()
# fill group form
wd.find_element_by_name("group_name").click()
wd.find_element_by_name("group_name").clear()
wd.find_element_by_name("group_name").send_keys("coaches")
# submit editing
wd.find_element_by_name("update").click()
self.return_to_groups_page()
def delete_first_group(self):
wd = self.app.wd
self.open_groups_page()
self.select_first_group()
# submit deletion
wd.find_element_by_name("delete").click()
self.return_to_groups_page()
def select_first_group(self):
wd = self.app.wd
wd.find_element_by_name("selected[]").click()
def return_to_groups_page(self):
wd = self.app.wd
wd.find_element_by_link_text("group page").click()
def modify_first_group(self, new_group_data):
wd = self.app.wd
self.open_groups_page()
self.select_first_group()
#open vodification form
wd.find_element_by_name("edit").click()
#fill group form
self.fill_group_form(new_group_data)
#submit modification
wd.find_element_by_name("update").click()
self.return_to_groups_page()
def count(self):
wd = self.app.wd
self.open_groups_page()
return len(wd.find_elements_by_name("selected[]"))
| {
"content_hash": "5819b4ebc1e35ce1bb0b85877e1e5de5",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 101,
"avg_line_length": 33.6219512195122,
"alnum_prop": 0.598113891911498,
"repo_name": "Manolaru/Python_train",
"id": "8e3afc7f0be18d6b43b9b0e0090b6f09d9f34a15",
"size": "2757",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Les_3/Task_10/fixture/group.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "290326"
}
],
"symlink_target": ""
} |
from django.test import TestCase
from django.core.exceptions import ObjectDoesNotExist
from contacts.models import Office365Connection
import contacts.o365service
# Create your tests here.
api_endpoint = 'https://outlook.office365.com/api/v1.0'
# TODO: Copy a valid, non-expired access token here. You can get this from
# an Office365Connection in the /admin/ page once you've successfully connected
# an account to view contacts in the app. Remember these expire every hour, so
# if you start getting 401's you need to get a new token.
access_token = ''
class MailApiTests(TestCase):
def test_create_message(self):
self.assertEqual(access_token, '', 'You must copy a valid access token into the access_token variable.')
new_message_payload = '{ "Subject": "Did you see last night\'s game?", "Importance": "Low", "Body": { "ContentType": "HTML", "Content": "They were <b>awesome</b>!" }, "ToRecipients": [ { "EmailAddress": { "Address": "[email protected]" } } ] }'
r = contacts.o365service.create_message(api_endpoint,
access_token,
new_message_payload)
self.assertEqual(r, 201, 'Create message returned {0}'.format(r))
def test_get_message_by_id(self):
self.assertEqual(access_token, '', 'You must copy a valid access token into the access_token variable.')
get_messages_params = '?$top=5&$select=Subject'
r = contacts.o365service.get_messages(api_endpoint,
access_token,
get_messages_params)
self.assertIsNotNone(r, 'Get messages returned None.')
first_message = r['value'][0]
first_message_id = first_message['Id']
r = contacts.o365service.get_message_by_id(api_endpoint,
access_token,
first_message_id)
self.assertIsNotNone(r, 'Get message by id returned None.')
def test_update_message(self):
self.assertEqual(access_token, '', 'You must copy a valid access token into the access_token variable.')
get_messages_params = '?$top=5&$select=Subject'
r = contacts.o365service.get_messages(api_endpoint,
access_token,
get_messages_params)
self.assertIsNotNone(r, 'Get messages returned None.')
first_message = r['value'][0]
first_message_id = first_message['Id']
update_payload = '{ "Subject" : "UPDATED" }'
r = contacts.o365service.update_message(api_endpoint,
access_token,
first_message_id,
update_payload)
self.assertEqual(r, 200, 'Update message returned {0}.'.format(r))
def test_delete_message(self):
self.assertEqual(access_token, '', 'You must copy a valid access token into the access_token variable.')
get_messages_params = '?$top=5&$select=Subject'
r = contacts.o365service.get_messages(api_endpoint,
access_token,
get_messages_params)
self.assertIsNotNone(r, 'Get messages returned None.')
first_message = r['value'][0]
first_message_id = first_message['Id']
r = contacts.o365service.delete_message(api_endpoint,
access_token,
first_message_id)
self.assertEqual(r, 204, 'Delete message returned {0}.'.format(r))
def test_send_draft_message(self):
self.assertEqual(access_token, '', 'You must copy a valid access token into the access_token variable.')
# Get drafts
get_drafts = '{0}/Me/Folders/Drafts/Messages?$select=Subject'.format(api_endpoint)
r = contacts.o365service.make_api_call('GET', get_drafts, access_token)
response = r.json()
first_message = response['value'][0]
first_message_id = first_message['Id']
send_response = contacts.o365service.send_draft_message(api_endpoint,
access_token,
first_message_id)
self.assertEqual(r, 200, 'Send draft returned {0}.'.format(r))
def test_send_new_mail(self):
self.assertEqual(access_token, '', 'You must copy a valid access token into the access_token variable.')
new_message_payload = '{ "Subject": "Sent from test_send_new_mail", "Importance": "Low", "Body": { "ContentType": "HTML", "Content": "They were <b>awesome</b>!" }, "ToRecipients": [ { "EmailAddress": { "Address": "[email protected]" } } ] }'
r = contacts.o365service.send_new_message(api_endpoint,
access_token,
new_message_payload,
True)
self.assertEqual(r, 202, 'Send new message returned {0}.'.format(r))
class CalendarApiTests(TestCase):
def test_create_event(self):
self.assertEqual(access_token, '', 'You must copy a valid access token into the access_token variable.')
new_event_payload = '{ "Subject": "Discuss the Calendar REST API", "Body": { "ContentType": "HTML", "Content": "I think it will meet our requirements!" }, "Start": "2015-01-15T18:00:00Z", "End": "2015-01-15T19:00:00Z", "Attendees": [ { "EmailAddress": { "Address": "[email protected]", "Name": "Alex Darrow" }, "Type": "Required" } ] }'
r = contacts.o365service.create_event(api_endpoint,
access_token,
new_event_payload)
self.assertEqual(r, 201, 'Create event returned {0}'.format(r))
def test_get_event_by_id(self):
self.assertEqual(access_token, '', 'You must copy a valid access token into the access_token variable.')
get_events_params = '?$top=5&$select=Subject,Start,End'
r = contacts.o365service.get_events(api_endpoint,
access_token,
get_events_params)
self.assertIsNotNone(r, 'Get events returned None.')
first_event = r['value'][0]
first_event_id = first_event['Id']
r = contacts.o365service.get_event_by_id(api_endpoint,
access_token,
first_event_id)
self.assertIsNotNone(r, 'Get event by id returned None.')
def test_update_event(self):
self.assertEqual(access_token, '', 'You must copy a valid access token into the access_token variable.')
get_events_params = '?$top=5&$select=Subject,Start,End'
r = contacts.o365service.get_events(api_endpoint,
access_token,
get_events_params)
self.assertIsNotNone(r, 'Get events returned None.')
first_event = r['value'][0]
first_event_id = first_event['Id']
update_payload = '{ "Subject" : "UPDATED" }'
r = contacts.o365service.update_event(api_endpoint,
access_token,
first_event_id,
update_payload)
self.assertEqual(r, 200, 'Update event returned {0}.'.format(r))
def test_delete_event(self):
self.assertEqual(access_token, '', 'You must copy a valid access token into the access_token variable.')
get_events_params = '?$top=5&$select=Subject,Start,End'
r = contacts.o365service.get_events(api_endpoint,
access_token,
get_events_params)
self.assertIsNotNone(r, 'Get events returned None.')
first_event = r['value'][0]
first_event_id = first_event['Id']
r = contacts.o365service.delete_event(api_endpoint,
access_token,
first_event_id)
self.assertEqual(r, 204, 'Delete event returned {0}.'.format(r))
class ContactsApiTests(TestCase):
def test_create_contact(self):
self.assertEqual(access_token, '', 'You must copy a valid access token into the access_token variable.')
new_contact_payload = '{ "GivenName": "Pavel", "Surname": "Bansky", "EmailAddresses": [ { "Address": "[email protected]", "Name": "Pavel Bansky" } ], "BusinessPhones": [ "+1 732 555 0102" ] }'
r = contacts.o365service.create_contact(api_endpoint,
access_token,
new_contact_payload)
self.assertEqual(r, 201, 'Create contact returned {0}'.format(r))
def test_get_contact_by_id(self):
self.assertEqual(access_token, '', 'You must copy a valid access token into the access_token variable.')
get_contacts_params = '?$top=5&$select=DisplayName'
r = contacts.o365service.get_contacts(api_endpoint,
access_token,
get_contacts_params)
self.assertIsNotNone(r, 'Get contacts returned None.')
first_contact = r['value'][0]
first_contact_id = first_contact['Id']
r = contacts.o365service.get_contact_by_id(api_endpoint,
access_token,
first_contact_id)
self.assertIsNotNone(r, 'Get contact by id returned None.')
def test_update_contact(self):
self.assertEqual(access_token, '', 'You must copy a valid access token into the access_token variable.')
get_contacts_params = '?$top=5&$select=DisplayName'
r = contacts.o365service.get_contacts(api_endpoint,
access_token,
get_contacts_params)
self.assertIsNotNone(r, 'Get contacts returned None.')
first_contact = r['value'][0]
first_contact_id = first_contact['Id']
update_payload = '{ "Surname" : "UPDATED" }'
r = contacts.o365service.update_contact(api_endpoint,
access_token,
first_contact_id,
update_payload)
self.assertEqual(r, 200, 'Update contact returned {0}.'.format(r))
def test_delete_contact(self):
self.assertEqual(access_token, '', 'You must copy a valid access token into the access_token variable.')
get_contacts_params = '?$top=5&$select=DisplayName'
r = contacts.o365service.get_contacts(api_endpoint,
access_token,
get_contacts_params)
self.assertIsNotNone(r, 'Get contacts returned None.')
first_contact = r['value'][0]
first_contact_id = first_contact['Id']
r = contacts.o365service.delete_contact(api_endpoint,
access_token,
first_contact_id)
self.assertEqual(r, 204, 'Delete contact returned {0}.'.format(r))
# MIT License:
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# ""Software""), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | {
"content_hash": "9b2172cdca719e8bd0b2bbd8bb562cad",
"timestamp": "",
"source": "github",
"line_count": 303,
"max_line_length": 351,
"avg_line_length": 48.64356435643565,
"alnum_prop": 0.4868037180270032,
"repo_name": "jasonjoh/pythoncontacts",
"id": "bbba3bd349a601f8a507848a4c054e16fd197841",
"size": "14864",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "contacts/tests.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1616"
},
{
"name": "HTML",
"bytes": "12281"
},
{
"name": "Python",
"bytes": "75476"
},
{
"name": "Shell",
"bytes": "98"
}
],
"symlink_target": ""
} |
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| {
"content_hash": "b3d14a531fd13b09ce55ced83e8e902f",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 42,
"avg_line_length": 26.5,
"alnum_prop": 0.6792452830188679,
"repo_name": "camilonova/django",
"id": "53c32d65737162febe4cc1bf09b29e2acbda0c06",
"size": "129",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "django/bin/django-admin.py",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "55935"
},
{
"name": "HTML",
"bytes": "182943"
},
{
"name": "JavaScript",
"bytes": "252645"
},
{
"name": "Makefile",
"bytes": "125"
},
{
"name": "Python",
"bytes": "11830666"
},
{
"name": "Shell",
"bytes": "809"
},
{
"name": "Smarty",
"bytes": "130"
}
],
"symlink_target": ""
} |
class Message(object):
def __init__(self, mdict):
self.mdict = mdict
def getDatetime(self):
return self.mdict['datetime']
def getId(self):
return self.mdict['id']
def getData(self):
return self.mdict['data']
def toDict(self):
return self.mdict
def resourcify(self, parent):
self.__parent__ = parent
self.__name__ = self.getId()
| {
"content_hash": "c059e3f4ab85c981b8929812ae618410",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 37,
"avg_line_length": 20.7,
"alnum_prop": 0.5676328502415459,
"repo_name": "ilogue/scrolls",
"id": "50b850a0483b1f566e9578f4d0bd041a50e3d011",
"size": "416",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "scrolls/models/message.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1497"
},
{
"name": "Python",
"bytes": "81915"
}
],
"symlink_target": ""
} |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
from agents import ReportingAgent
from models import get_model
from methods import get_batch_schedule
from utils.torch_types import TorchTypes
class EpisodicRDQNAgent(ReportingAgent):
def __init__(self, name, action_space, cfg, shared_objects={}):
super(EpisodicRDQNAgent, self).__init__()
self.name = name
self.actions_no = len(action_space)
self.batch_size = batch_size = cfg.general.batch_size
self.cuda = cfg.general.use_cuda
self.dtype = TorchTypes(self.cuda)
if "model" in shared_objects:
self.net = net = shared_objects["model"]
self.print_info("Training some shared model.")
else:
self.net = net = get_model(cfg.model.name)(cfg.model)
if self.cuda:
net.cuda()
Optimizer = getattr(optim, cfg.training.algorithm)
optim_args = vars(cfg.training.algorithm_args)
self.optimizer = Optimizer(net.parameters(), **optim_args)
self.losses = []
self.exploration_strategy = get_batch_schedule(cfg.agent.exploration,
batch_size)
self.last_q = None
self.last_a = None
self.last_aux = None
self.live_idx = torch.linspace(0, batch_size-1, batch_size) \
.type(self.dtype.LongTensor)
self.prev_state = {}
self.crt_step = -1
self.loss_coeff = {k: v for [k,v] in cfg.model.auxiliary_tasks}
def get_model(self):
return self.net
def predict(self, obs, done):
if done.all():
self.prev_state = {}
else:
not_done = (1 - done)
not_done_idx = not_done.nonzero().view(-1)
not_done_idx_var = Variable(not_done_idx)
prev_state = self.prev_state
prev_state = {
task: [s.index_select(0, not_done_idx_var) for s in ss] \
for task, ss in prev_state.items()
}
def act(self, obs, reward, done, is_training):
long_type = self.dtype.LongTensor
batch_size = self.batch_size
not_done = (1 - done)
not_all_done = not_done.byte().any()
not_done_idx = not_done.nonzero().view(-1)
not_done_idx_var = Variable(not_done_idx)
# -- Prepare previous state
prev_state = self.prev_state
if prev_state is not None and not_all_done:
prev_state = \
{task: [s.index_select(0, not_done_idx_var) for s in ss]
for task, ss in prev_state.items()}
else:
prev_state = {}
live_obs = obs.index_select(0, not_done_idx) if not_all_done else None
if not_all_done:
self.live_idx = live_idx = \
self.live_idx.index_select(0, not_done_idx)
self.crt_step += 1
# TODO: de scos float-ul daca se trimite direct din mediu asa
qs, aux, h = self.net(Variable(live_obs.float()), prev_state)
self.prev_state = h
_, actions = qs.data.max(1)
actions.squeeze_(1)
epsilon = next(self.exploration_strategy)
rand_idx = torch.bernoulli(torch.FloatTensor(epsilon)) \
.type(self.dtype.LongTensor) \
.index_select(0, live_idx) \
.nonzero() \
.squeeze(1)
n = rand_idx.nelement()
if n > 0 and is_training:
rand_actions = torch.LongTensor(n).random_(0, self.actions_no)
rand_idx = rand_idx.type(long_type)
rand_actions = rand_actions.type(long_type)
actions.index_fill_(0, rand_idx, 0)
actions.index_add_(0, rand_idx, rand_actions)
actions = actions.type(long_type)
else:
qs = None
actions = None
aux = None
self.crt_step = -1
self.live_idx = torch.linspace(0, batch_size-1, batch_size) \
.type(long_type)
self.prev_state = {}
if self.last_q is not None and is_training:
reward = reward.clone()
last_q, last_a, last_aux = self.last_q, self.last_a, self.last_aux
self._improve_policy(last_q, last_aux,
last_a, reward,
qs, aux,
not_done_idx, done)
self.last_q = qs if not_all_done else None
self.last_aux = aux if not_all_done else None
self.last_a = actions
full_size_actions = torch.LongTensor(reward.size(0)).type(long_type)
full_size_actions.fill_(3) # TODO: some variable
if actions is not None:
full_size_actions.scatter_(0, not_done_idx, actions)
return full_size_actions
def _improve_policy(self, q, aux, a, r, next_q, next_aux,
not_done_idx, done):
optimizer = self.optimizer
losses = self.losses
reward = Variable(r.float(), requires_grad=False)
if not_done_idx.nelement() > 0:
q_target, _ = next_q.max(1)
q_target = q_target.squeeze(1)
q_target.detach_()
target = reward.index_add(0, Variable(not_done_idx), q_target)
else:
target = reward
target.detach_()
_q = q.gather(1, Variable(a.unsqueeze(1)))
losses.append(F.smooth_l1_loss(_q, target))
loss_coeff = self.loss_coeff
if aux is not None and "time_step" in aux and self.crt_step >= 0:
pred_crt_step = aux["time_step"]
alive_no = pred_crt_step.size(0)
losses.append(nn.CrossEntropyLoss()(
pred_crt_step,
Variable(torch.LongTensor(alive_no).fill_(self.crt_step-1) \
.type(self.dtype.LongTensor))
) * loss_coeff["time_step"])
if aux is not None and "game_ends" in aux:
losses.append(nn.CrossEntropyLoss()(
aux["game_ends"],
Variable(done)
) * loss_coeff["game_ends"])
if not_done_idx.nelement() == 0:
# Backward
total_loss = sum(losses)
total_loss.data.clamp_(-1.0, 1.0)
print("losss=", total_loss.data[0])
total_loss.backward()
#for param in self.net.parameters():
# param.grad.data.clamp_(-1, 1)
self.get_model_stats()
# Step in optimizer
optimizer.step()
# Reset losses
optimizer.zero_grad()
losses.clear()
def get_model_stats(self):
param_abs_mean = 0
grad_abs_mean = 0
grad_abs_max = None
n_params = 0
for p in self.net.parameters():
param_abs_mean += p.data.abs().sum()
if p.grad:
grad_abs_mean += p.grad.data.abs().sum()
if grad_abs_max is None:
grad_abs_max = p.grad.data.abs().max()
grad_abs_max = max(grad_abs_max, p.grad.data.abs().max())
n_params += p.data.nelement()
self.print_info("W_avg: %.9f | G_avg: %.9f | G_max: %.9f" % (
param_abs_mean / n_params,
grad_abs_mean / n_params,
grad_abs_max)
)
| {
"content_hash": "ea669060579a29ca8303c8cabc0b1476",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 78,
"avg_line_length": 34.77064220183486,
"alnum_prop": 0.5201846965699208,
"repo_name": "village-people/flying-pig",
"id": "2c12a6c105b01cf38d0d76867876fcb051a3deab",
"size": "7665",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ai_challenge/agents/episodic_rdqn_agent.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "370890"
},
{
"name": "Shell",
"bytes": "67"
},
{
"name": "XSLT",
"bytes": "372375"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.