mirror of
https://github.com/clearml/clearml
synced 2025-05-17 10:53:17 +00:00
Add new API version support
This commit is contained in:
parent
f2829e1162
commit
2f3ff16e67
19
trains/backend_api/api_proxy.py
Normal file
19
trains/backend_api/api_proxy.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
from .session import Session
|
||||||
|
import importlib
|
||||||
|
|
||||||
|
|
||||||
|
class ApiServiceProxy(object):
|
||||||
|
def __init__(self, module):
|
||||||
|
self.__wrapped_name__ = module
|
||||||
|
self.__wrapped_version__ = Session.api_version
|
||||||
|
|
||||||
|
def __getattr__(self, attr):
|
||||||
|
if attr in ['__wrapped_name__', '__wrapped__', '__wrapped_version__']:
|
||||||
|
return self.__dict__.get(attr)
|
||||||
|
|
||||||
|
if not self.__dict__.get('__wrapped__') or self.__dict__.get('__wrapped_version__') != Session.api_version:
|
||||||
|
self.__dict__['__wrapped_version__'] = Session.api_version
|
||||||
|
self.__dict__['__wrapped__'] = importlib.import_module('.v'+str(Session.api_version).replace('.', '_') +
|
||||||
|
'.' + self.__dict__.get('__wrapped_name__'),
|
||||||
|
package='trains.backend_api.services')
|
||||||
|
return getattr(self.__dict__['__wrapped__'], attr)
|
@ -1,22 +1,19 @@
|
|||||||
from .v2_1 import async_request
|
from ..api_proxy import ApiServiceProxy
|
||||||
from .v2_1 import auth
|
|
||||||
from .v2_1 import debug
|
|
||||||
from .v2_1 import events
|
|
||||||
from .v2_1 import models
|
|
||||||
from .v2_1 import news
|
|
||||||
from .v2_1 import projects
|
|
||||||
from .v2_1 import storage
|
|
||||||
from .v2_1 import tasks
|
|
||||||
|
|
||||||
|
|
||||||
|
# allow us to replace the api version after we have completed the authentication process,
|
||||||
|
# and we know the backend server api version.
|
||||||
|
# ApiServiceProxy will dynamically load the correct api object based on the session api_version
|
||||||
|
auth = ApiServiceProxy('auth')
|
||||||
|
events = ApiServiceProxy('events')
|
||||||
|
models = ApiServiceProxy('models')
|
||||||
|
projects = ApiServiceProxy('projects')
|
||||||
|
tasks = ApiServiceProxy('tasks')
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'async_request',
|
|
||||||
'auth',
|
'auth',
|
||||||
'debug',
|
|
||||||
'events',
|
'events',
|
||||||
'models',
|
'models',
|
||||||
'news',
|
|
||||||
'projects',
|
'projects',
|
||||||
'storage',
|
|
||||||
'tasks',
|
'tasks',
|
||||||
]
|
]
|
||||||
|
@ -1,414 +0,0 @@
|
|||||||
"""
|
|
||||||
async service
|
|
||||||
|
|
||||||
This service provides support for asynchronous API calls.
|
|
||||||
"""
|
|
||||||
import six
|
|
||||||
import types
|
|
||||||
from datetime import datetime
|
|
||||||
import enum
|
|
||||||
|
|
||||||
from dateutil.parser import parse as parse_datetime
|
|
||||||
|
|
||||||
from ....backend_api.session import Request, BatchRequest, Response, DataModel, NonStrictDataModel, CompoundRequest, schema_property, StringEnum
|
|
||||||
|
|
||||||
|
|
||||||
class Call(NonStrictDataModel):
|
|
||||||
"""
|
|
||||||
:param id: The job ID associated with this call.
|
|
||||||
:type id: str
|
|
||||||
:param status: The job's status.
|
|
||||||
:type status: str
|
|
||||||
:param created: Job creation time.
|
|
||||||
:type created: str
|
|
||||||
:param ended: Job end time.
|
|
||||||
:type ended: str
|
|
||||||
:param enqueued: Job enqueue time.
|
|
||||||
:type enqueued: str
|
|
||||||
:param meta: Metadata for this job, includes endpoint and additional relevant
|
|
||||||
call data.
|
|
||||||
:type meta: dict
|
|
||||||
:param company: The Company this job belongs to.
|
|
||||||
:type company: str
|
|
||||||
:param exec_info: Job execution information.
|
|
||||||
:type exec_info: str
|
|
||||||
"""
|
|
||||||
_schema = {
|
|
||||||
'properties': {
|
|
||||||
'company': {
|
|
||||||
'description': 'The Company this job belongs to.',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
'created': {
|
|
||||||
'description': 'Job creation time.',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
'ended': {'description': 'Job end time.', 'type': ['string', 'null']},
|
|
||||||
'enqueued': {
|
|
||||||
'description': 'Job enqueue time.',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
'exec_info': {
|
|
||||||
'description': 'Job execution information.',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
'id': {
|
|
||||||
'description': 'The job ID associated with this call.',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
'meta': {
|
|
||||||
'additionalProperties': True,
|
|
||||||
'description': 'Metadata for this job, includes endpoint and additional relevant call data.',
|
|
||||||
'type': ['object', 'null'],
|
|
||||||
},
|
|
||||||
'status': {
|
|
||||||
'description': "The job's status.",
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'type': 'object',
|
|
||||||
}
|
|
||||||
def __init__(
|
|
||||||
self, id=None, status=None, created=None, ended=None, enqueued=None, meta=None, company=None, exec_info=None, **kwargs):
|
|
||||||
super(Call, self).__init__(**kwargs)
|
|
||||||
self.id = id
|
|
||||||
self.status = status
|
|
||||||
self.created = created
|
|
||||||
self.ended = ended
|
|
||||||
self.enqueued = enqueued
|
|
||||||
self.meta = meta
|
|
||||||
self.company = company
|
|
||||||
self.exec_info = exec_info
|
|
||||||
|
|
||||||
@schema_property('id')
|
|
||||||
def id(self):
|
|
||||||
return self._property_id
|
|
||||||
|
|
||||||
@id.setter
|
|
||||||
def id(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_id = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "id", six.string_types)
|
|
||||||
self._property_id = value
|
|
||||||
|
|
||||||
@schema_property('status')
|
|
||||||
def status(self):
|
|
||||||
return self._property_status
|
|
||||||
|
|
||||||
@status.setter
|
|
||||||
def status(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_status = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "status", six.string_types)
|
|
||||||
self._property_status = value
|
|
||||||
|
|
||||||
@schema_property('created')
|
|
||||||
def created(self):
|
|
||||||
return self._property_created
|
|
||||||
|
|
||||||
@created.setter
|
|
||||||
def created(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_created = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "created", six.string_types)
|
|
||||||
self._property_created = value
|
|
||||||
|
|
||||||
@schema_property('ended')
|
|
||||||
def ended(self):
|
|
||||||
return self._property_ended
|
|
||||||
|
|
||||||
@ended.setter
|
|
||||||
def ended(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_ended = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "ended", six.string_types)
|
|
||||||
self._property_ended = value
|
|
||||||
|
|
||||||
@schema_property('enqueued')
|
|
||||||
def enqueued(self):
|
|
||||||
return self._property_enqueued
|
|
||||||
|
|
||||||
@enqueued.setter
|
|
||||||
def enqueued(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_enqueued = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "enqueued", six.string_types)
|
|
||||||
self._property_enqueued = value
|
|
||||||
|
|
||||||
@schema_property('meta')
|
|
||||||
def meta(self):
|
|
||||||
return self._property_meta
|
|
||||||
|
|
||||||
@meta.setter
|
|
||||||
def meta(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_meta = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "meta", (dict,))
|
|
||||||
self._property_meta = value
|
|
||||||
|
|
||||||
@schema_property('company')
|
|
||||||
def company(self):
|
|
||||||
return self._property_company
|
|
||||||
|
|
||||||
@company.setter
|
|
||||||
def company(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_company = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "company", six.string_types)
|
|
||||||
self._property_company = value
|
|
||||||
|
|
||||||
@schema_property('exec_info')
|
|
||||||
def exec_info(self):
|
|
||||||
return self._property_exec_info
|
|
||||||
|
|
||||||
@exec_info.setter
|
|
||||||
def exec_info(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_exec_info = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "exec_info", six.string_types)
|
|
||||||
self._property_exec_info = value
|
|
||||||
|
|
||||||
|
|
||||||
class CallsRequest(Request):
|
|
||||||
"""
|
|
||||||
Get a list of all asynchronous API calls handled by the system.
|
|
||||||
This includes both previously handled calls, calls being executed and calls waiting in queue.
|
|
||||||
|
|
||||||
:param status: Return only calls who's status is in this list.
|
|
||||||
:type status: Sequence[str]
|
|
||||||
:param endpoint: Return only calls handling this endpoint. Supports wildcards.
|
|
||||||
:type endpoint: str
|
|
||||||
:param task: Return only calls associated with this task ID. Supports
|
|
||||||
wildcards.
|
|
||||||
:type task: str
|
|
||||||
"""
|
|
||||||
|
|
||||||
_service = "async"
|
|
||||||
_action = "calls"
|
|
||||||
_version = "1.5"
|
|
||||||
_schema = {
|
|
||||||
'definitions': {},
|
|
||||||
'properties': {
|
|
||||||
'endpoint': {
|
|
||||||
'description': 'Return only calls handling this endpoint. Supports wildcards.',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
'status': {
|
|
||||||
'description': "Return only calls who's status is in this list.",
|
|
||||||
'items': {'enum': ['queued', 'in_progress', 'completed'], 'type': 'string'},
|
|
||||||
'type': ['array', 'null'],
|
|
||||||
},
|
|
||||||
'task': {
|
|
||||||
'description': 'Return only calls associated with this task ID. Supports wildcards.',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'type': 'object',
|
|
||||||
}
|
|
||||||
def __init__(
|
|
||||||
self, status=None, endpoint=None, task=None, **kwargs):
|
|
||||||
super(CallsRequest, self).__init__(**kwargs)
|
|
||||||
self.status = status
|
|
||||||
self.endpoint = endpoint
|
|
||||||
self.task = task
|
|
||||||
|
|
||||||
@schema_property('status')
|
|
||||||
def status(self):
|
|
||||||
return self._property_status
|
|
||||||
|
|
||||||
@status.setter
|
|
||||||
def status(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_status = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "status", (list, tuple))
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "status", six.string_types, is_array=True)
|
|
||||||
self._property_status = value
|
|
||||||
|
|
||||||
@schema_property('endpoint')
|
|
||||||
def endpoint(self):
|
|
||||||
return self._property_endpoint
|
|
||||||
|
|
||||||
@endpoint.setter
|
|
||||||
def endpoint(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_endpoint = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "endpoint", six.string_types)
|
|
||||||
self._property_endpoint = value
|
|
||||||
|
|
||||||
@schema_property('task')
|
|
||||||
def task(self):
|
|
||||||
return self._property_task
|
|
||||||
|
|
||||||
@task.setter
|
|
||||||
def task(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_task = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "task", six.string_types)
|
|
||||||
self._property_task = value
|
|
||||||
|
|
||||||
|
|
||||||
class CallsResponse(Response):
|
|
||||||
"""
|
|
||||||
Response of async.calls endpoint.
|
|
||||||
|
|
||||||
:param calls: A list of the current asynchronous calls handled by the system.
|
|
||||||
:type calls: Sequence[Call]
|
|
||||||
"""
|
|
||||||
_service = "async"
|
|
||||||
_action = "calls"
|
|
||||||
_version = "1.5"
|
|
||||||
|
|
||||||
_schema = {
|
|
||||||
'definitions': {
|
|
||||||
'call': {
|
|
||||||
'properties': {
|
|
||||||
'company': {
|
|
||||||
'description': 'The Company this job belongs to.',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
'created': {
|
|
||||||
'description': 'Job creation time.',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
'ended': {
|
|
||||||
'description': 'Job end time.',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
'enqueued': {
|
|
||||||
'description': 'Job enqueue time.',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
'exec_info': {
|
|
||||||
'description': 'Job execution information.',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
'id': {
|
|
||||||
'description': 'The job ID associated with this call.',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
'meta': {
|
|
||||||
'additionalProperties': True,
|
|
||||||
'description': 'Metadata for this job, includes endpoint and additional relevant call data.',
|
|
||||||
'type': ['object', 'null'],
|
|
||||||
},
|
|
||||||
'status': {
|
|
||||||
'description': "The job's status.",
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'type': 'object',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'properties': {
|
|
||||||
'calls': {
|
|
||||||
'description': 'A list of the current asynchronous calls handled by the system.',
|
|
||||||
'items': {'$ref': '#/definitions/call'},
|
|
||||||
'type': ['array', 'null'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'type': 'object',
|
|
||||||
}
|
|
||||||
def __init__(
|
|
||||||
self, calls=None, **kwargs):
|
|
||||||
super(CallsResponse, self).__init__(**kwargs)
|
|
||||||
self.calls = calls
|
|
||||||
|
|
||||||
@schema_property('calls')
|
|
||||||
def calls(self):
|
|
||||||
return self._property_calls
|
|
||||||
|
|
||||||
@calls.setter
|
|
||||||
def calls(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_calls = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "calls", (list, tuple))
|
|
||||||
if any(isinstance(v, dict) for v in value):
|
|
||||||
value = [Call.from_dict(v) if isinstance(v, dict) else v for v in value]
|
|
||||||
else:
|
|
||||||
self.assert_isinstance(value, "calls", Call, is_array=True)
|
|
||||||
self._property_calls = value
|
|
||||||
|
|
||||||
|
|
||||||
class ResultRequest(Request):
|
|
||||||
"""
|
|
||||||
Try getting the result of a previously accepted asynchronous API call.
|
|
||||||
If execution for the asynchronous call has completed, the complete call response data will be returned.
|
|
||||||
Otherwise, a 202 code will be returned with no data
|
|
||||||
|
|
||||||
:param id: The id returned by the accepted asynchronous API call.
|
|
||||||
:type id: str
|
|
||||||
"""
|
|
||||||
|
|
||||||
_service = "async"
|
|
||||||
_action = "result"
|
|
||||||
_version = "1.5"
|
|
||||||
_schema = {
|
|
||||||
'definitions': {},
|
|
||||||
'properties': {
|
|
||||||
'id': {
|
|
||||||
'description': 'The id returned by the accepted asynchronous API call.',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'type': 'object',
|
|
||||||
}
|
|
||||||
def __init__(
|
|
||||||
self, id=None, **kwargs):
|
|
||||||
super(ResultRequest, self).__init__(**kwargs)
|
|
||||||
self.id = id
|
|
||||||
|
|
||||||
@schema_property('id')
|
|
||||||
def id(self):
|
|
||||||
return self._property_id
|
|
||||||
|
|
||||||
@id.setter
|
|
||||||
def id(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_id = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "id", six.string_types)
|
|
||||||
self._property_id = value
|
|
||||||
|
|
||||||
|
|
||||||
class ResultResponse(Response):
|
|
||||||
"""
|
|
||||||
Response of async.result endpoint.
|
|
||||||
|
|
||||||
"""
|
|
||||||
_service = "async"
|
|
||||||
_action = "result"
|
|
||||||
_version = "1.5"
|
|
||||||
|
|
||||||
_schema = {'additionalProperties': True, 'definitions': {}, 'type': 'object'}
|
|
||||||
|
|
||||||
|
|
||||||
response_mapping = {
|
|
||||||
ResultRequest: ResultResponse,
|
|
||||||
CallsRequest: CallsResponse,
|
|
||||||
}
|
|
@ -92,275 +92,6 @@ class CredentialKey(NonStrictDataModel):
|
|||||||
self._property_access_key = value
|
self._property_access_key = value
|
||||||
|
|
||||||
|
|
||||||
class AddUserRequest(Request):
|
|
||||||
"""
|
|
||||||
Add a new user manually. Only supported in on-premises deployments
|
|
||||||
|
|
||||||
:param secret_key: A secret key (used as the user's password)
|
|
||||||
:type secret_key: str
|
|
||||||
:param name: User name (makes the auth entry more readable)
|
|
||||||
:type name: str
|
|
||||||
:param company: Associated company ID. If not provided, the caller's company ID
|
|
||||||
will be used
|
|
||||||
:type company: str
|
|
||||||
:param email: Email address uniquely identifying the user
|
|
||||||
:type email: str
|
|
||||||
:param provider: Provider ID indicating the external provider used to
|
|
||||||
authenticate the user
|
|
||||||
:type provider: str
|
|
||||||
:param provider_user_id: Unique user ID assigned by the external provider
|
|
||||||
:type provider_user_id: str
|
|
||||||
:param provider_token: Provider-issued token for this user
|
|
||||||
:type provider_token: str
|
|
||||||
:param given_name: Given name
|
|
||||||
:type given_name: str
|
|
||||||
:param family_name: Family name
|
|
||||||
:type family_name: str
|
|
||||||
:param avatar: Avatar URL
|
|
||||||
:type avatar: str
|
|
||||||
"""
|
|
||||||
|
|
||||||
_service = "auth"
|
|
||||||
_action = "add_user"
|
|
||||||
_version = "1.5"
|
|
||||||
_schema = {
|
|
||||||
'definitions': {},
|
|
||||||
'properties': {
|
|
||||||
'avatar': {'description': 'Avatar URL', 'type': 'string'},
|
|
||||||
'company': {
|
|
||||||
'description': "Associated company ID. If not provided, the caller's company ID will be used",
|
|
||||||
'type': 'string',
|
|
||||||
},
|
|
||||||
'email': {
|
|
||||||
'description': 'Email address uniquely identifying the user',
|
|
||||||
'type': 'string',
|
|
||||||
},
|
|
||||||
'family_name': {'description': 'Family name', 'type': 'string'},
|
|
||||||
'given_name': {'description': 'Given name', 'type': 'string'},
|
|
||||||
'name': {
|
|
||||||
'description': 'User name (makes the auth entry more readable)',
|
|
||||||
'type': 'string',
|
|
||||||
},
|
|
||||||
'provider': {
|
|
||||||
'description': 'Provider ID indicating the external provider used to authenticate the user',
|
|
||||||
'type': 'string',
|
|
||||||
},
|
|
||||||
'provider_token': {
|
|
||||||
'description': 'Provider-issued token for this user',
|
|
||||||
'type': 'string',
|
|
||||||
},
|
|
||||||
'provider_user_id': {
|
|
||||||
'description': 'Unique user ID assigned by the external provider',
|
|
||||||
'type': 'string',
|
|
||||||
},
|
|
||||||
'secret_key': {
|
|
||||||
'description': "A secret key (used as the user's password)",
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'required': ['name', 'email'],
|
|
||||||
'type': 'object',
|
|
||||||
}
|
|
||||||
def __init__(
|
|
||||||
self, name, email, secret_key=None, company=None, provider=None, provider_user_id=None, provider_token=None, given_name=None, family_name=None, avatar=None, **kwargs):
|
|
||||||
super(AddUserRequest, self).__init__(**kwargs)
|
|
||||||
self.secret_key = secret_key
|
|
||||||
self.name = name
|
|
||||||
self.company = company
|
|
||||||
self.email = email
|
|
||||||
self.provider = provider
|
|
||||||
self.provider_user_id = provider_user_id
|
|
||||||
self.provider_token = provider_token
|
|
||||||
self.given_name = given_name
|
|
||||||
self.family_name = family_name
|
|
||||||
self.avatar = avatar
|
|
||||||
|
|
||||||
@schema_property('secret_key')
|
|
||||||
def secret_key(self):
|
|
||||||
return self._property_secret_key
|
|
||||||
|
|
||||||
@secret_key.setter
|
|
||||||
def secret_key(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_secret_key = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "secret_key", six.string_types)
|
|
||||||
self._property_secret_key = value
|
|
||||||
|
|
||||||
@schema_property('name')
|
|
||||||
def name(self):
|
|
||||||
return self._property_name
|
|
||||||
|
|
||||||
@name.setter
|
|
||||||
def name(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_name = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "name", six.string_types)
|
|
||||||
self._property_name = value
|
|
||||||
|
|
||||||
@schema_property('company')
|
|
||||||
def company(self):
|
|
||||||
return self._property_company
|
|
||||||
|
|
||||||
@company.setter
|
|
||||||
def company(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_company = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "company", six.string_types)
|
|
||||||
self._property_company = value
|
|
||||||
|
|
||||||
@schema_property('email')
|
|
||||||
def email(self):
|
|
||||||
return self._property_email
|
|
||||||
|
|
||||||
@email.setter
|
|
||||||
def email(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_email = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "email", six.string_types)
|
|
||||||
self._property_email = value
|
|
||||||
|
|
||||||
@schema_property('provider')
|
|
||||||
def provider(self):
|
|
||||||
return self._property_provider
|
|
||||||
|
|
||||||
@provider.setter
|
|
||||||
def provider(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_provider = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "provider", six.string_types)
|
|
||||||
self._property_provider = value
|
|
||||||
|
|
||||||
@schema_property('provider_user_id')
|
|
||||||
def provider_user_id(self):
|
|
||||||
return self._property_provider_user_id
|
|
||||||
|
|
||||||
@provider_user_id.setter
|
|
||||||
def provider_user_id(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_provider_user_id = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "provider_user_id", six.string_types)
|
|
||||||
self._property_provider_user_id = value
|
|
||||||
|
|
||||||
@schema_property('provider_token')
|
|
||||||
def provider_token(self):
|
|
||||||
return self._property_provider_token
|
|
||||||
|
|
||||||
@provider_token.setter
|
|
||||||
def provider_token(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_provider_token = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "provider_token", six.string_types)
|
|
||||||
self._property_provider_token = value
|
|
||||||
|
|
||||||
@schema_property('given_name')
|
|
||||||
def given_name(self):
|
|
||||||
return self._property_given_name
|
|
||||||
|
|
||||||
@given_name.setter
|
|
||||||
def given_name(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_given_name = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "given_name", six.string_types)
|
|
||||||
self._property_given_name = value
|
|
||||||
|
|
||||||
@schema_property('family_name')
|
|
||||||
def family_name(self):
|
|
||||||
return self._property_family_name
|
|
||||||
|
|
||||||
@family_name.setter
|
|
||||||
def family_name(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_family_name = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "family_name", six.string_types)
|
|
||||||
self._property_family_name = value
|
|
||||||
|
|
||||||
@schema_property('avatar')
|
|
||||||
def avatar(self):
|
|
||||||
return self._property_avatar
|
|
||||||
|
|
||||||
@avatar.setter
|
|
||||||
def avatar(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_avatar = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "avatar", six.string_types)
|
|
||||||
self._property_avatar = value
|
|
||||||
|
|
||||||
|
|
||||||
class AddUserResponse(Response):
|
|
||||||
"""
|
|
||||||
Response of auth.add_user endpoint.
|
|
||||||
|
|
||||||
:param id: New user ID
|
|
||||||
:type id: str
|
|
||||||
:param secret: The secret key used as the user's password
|
|
||||||
:type secret: str
|
|
||||||
"""
|
|
||||||
_service = "auth"
|
|
||||||
_action = "add_user"
|
|
||||||
_version = "1.5"
|
|
||||||
|
|
||||||
_schema = {
|
|
||||||
'definitions': {},
|
|
||||||
'properties': {
|
|
||||||
'id': {'description': 'New user ID', 'type': ['string', 'null']},
|
|
||||||
'secret': {
|
|
||||||
'description': "The secret key used as the user's password",
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'type': 'object',
|
|
||||||
}
|
|
||||||
def __init__(
|
|
||||||
self, id=None, secret=None, **kwargs):
|
|
||||||
super(AddUserResponse, self).__init__(**kwargs)
|
|
||||||
self.id = id
|
|
||||||
self.secret = secret
|
|
||||||
|
|
||||||
@schema_property('id')
|
|
||||||
def id(self):
|
|
||||||
return self._property_id
|
|
||||||
|
|
||||||
@id.setter
|
|
||||||
def id(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_id = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "id", six.string_types)
|
|
||||||
self._property_id = value
|
|
||||||
|
|
||||||
@schema_property('secret')
|
|
||||||
def secret(self):
|
|
||||||
return self._property_secret
|
|
||||||
|
|
||||||
@secret.setter
|
|
||||||
def secret(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_secret = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "secret", six.string_types)
|
|
||||||
self._property_secret = value
|
|
||||||
|
|
||||||
|
|
||||||
class CreateCredentialsRequest(Request):
|
class CreateCredentialsRequest(Request):
|
||||||
@ -706,105 +437,6 @@ class GetCredentialsResponse(Response):
|
|||||||
self._property_credentials = value
|
self._property_credentials = value
|
||||||
|
|
||||||
|
|
||||||
class GetTaskTokenRequest(Request):
|
|
||||||
"""
|
|
||||||
Get a task-limited token based on supplied credentials (token or key/secret).
|
|
||||||
Intended for use by users who wish to run a task under limited credentials.
|
|
||||||
Returned token will be limited so that all operations can only be performed on the
|
|
||||||
specified task.
|
|
||||||
|
|
||||||
:param task: Task ID
|
|
||||||
:type task: str
|
|
||||||
:param expiration_sec: Requested token expiration time in seconds. Not
|
|
||||||
guaranteed, might be overridden by the service
|
|
||||||
:type expiration_sec: int
|
|
||||||
"""
|
|
||||||
|
|
||||||
_service = "auth"
|
|
||||||
_action = "get_task_token"
|
|
||||||
_version = "1.5"
|
|
||||||
_schema = {
|
|
||||||
'definitions': {},
|
|
||||||
'properties': {
|
|
||||||
'expiration_sec': {
|
|
||||||
'description': 'Requested token expiration time in seconds.\n Not guaranteed, might be overridden by the service',
|
|
||||||
'type': 'integer',
|
|
||||||
},
|
|
||||||
'task': {'description': 'Task ID', 'type': 'string'},
|
|
||||||
},
|
|
||||||
'required': ['task'],
|
|
||||||
'type': 'object',
|
|
||||||
}
|
|
||||||
def __init__(
|
|
||||||
self, task, expiration_sec=None, **kwargs):
|
|
||||||
super(GetTaskTokenRequest, self).__init__(**kwargs)
|
|
||||||
self.task = task
|
|
||||||
self.expiration_sec = expiration_sec
|
|
||||||
|
|
||||||
@schema_property('task')
|
|
||||||
def task(self):
|
|
||||||
return self._property_task
|
|
||||||
|
|
||||||
@task.setter
|
|
||||||
def task(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_task = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "task", six.string_types)
|
|
||||||
self._property_task = value
|
|
||||||
|
|
||||||
@schema_property('expiration_sec')
|
|
||||||
def expiration_sec(self):
|
|
||||||
return self._property_expiration_sec
|
|
||||||
|
|
||||||
@expiration_sec.setter
|
|
||||||
def expiration_sec(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_expiration_sec = None
|
|
||||||
return
|
|
||||||
if isinstance(value, float) and value.is_integer():
|
|
||||||
value = int(value)
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "expiration_sec", six.integer_types)
|
|
||||||
self._property_expiration_sec = value
|
|
||||||
|
|
||||||
|
|
||||||
class GetTaskTokenResponse(Response):
|
|
||||||
"""
|
|
||||||
Response of auth.get_task_token endpoint.
|
|
||||||
|
|
||||||
:param token: Token string
|
|
||||||
:type token: str
|
|
||||||
"""
|
|
||||||
_service = "auth"
|
|
||||||
_action = "get_task_token"
|
|
||||||
_version = "1.5"
|
|
||||||
|
|
||||||
_schema = {
|
|
||||||
'definitions': {},
|
|
||||||
'properties': {
|
|
||||||
'token': {'description': 'Token string', 'type': ['string', 'null']},
|
|
||||||
},
|
|
||||||
'type': 'object',
|
|
||||||
}
|
|
||||||
def __init__(
|
|
||||||
self, token=None, **kwargs):
|
|
||||||
super(GetTaskTokenResponse, self).__init__(**kwargs)
|
|
||||||
self.token = token
|
|
||||||
|
|
||||||
@schema_property('token')
|
|
||||||
def token(self):
|
|
||||||
return self._property_token
|
|
||||||
|
|
||||||
@token.setter
|
|
||||||
def token(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_token = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "token", six.string_types)
|
|
||||||
self._property_token = value
|
|
||||||
|
|
||||||
|
|
||||||
class LoginRequest(Request):
|
class LoginRequest(Request):
|
||||||
@ -890,28 +522,6 @@ class LoginResponse(Response):
|
|||||||
self._property_token = value
|
self._property_token = value
|
||||||
|
|
||||||
|
|
||||||
class ReloadConfigRequest(Request):
|
|
||||||
"""
|
|
||||||
Reload auth configuration (currently supports blocking tokens). For user roles associated with a company (Admin, Superuser) this call will only affect company-related configuration.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
_service = "auth"
|
|
||||||
_action = "reload_config"
|
|
||||||
_version = "1.5"
|
|
||||||
_schema = {'definitions': {}, 'properties': {}, 'type': 'object'}
|
|
||||||
|
|
||||||
|
|
||||||
class ReloadConfigResponse(Response):
|
|
||||||
"""
|
|
||||||
Response of auth.reload_config endpoint.
|
|
||||||
|
|
||||||
"""
|
|
||||||
_service = "auth"
|
|
||||||
_action = "reload_config"
|
|
||||||
_version = "1.5"
|
|
||||||
|
|
||||||
_schema = {'definitions': {}, 'properties': {}, 'type': 'object'}
|
|
||||||
|
|
||||||
|
|
||||||
class RevokeCredentialsRequest(Request):
|
class RevokeCredentialsRequest(Request):
|
||||||
@ -999,114 +609,13 @@ class RevokeCredentialsResponse(Response):
|
|||||||
self._property_revoked = value
|
self._property_revoked = value
|
||||||
|
|
||||||
|
|
||||||
class SetCredentialsRequest(Request):
|
|
||||||
"""
|
|
||||||
Set a secret_key for a given access_key. Only supported in on-premises deployments
|
|
||||||
|
|
||||||
:param access_key: Credentials key. Must be identical to the user's ID (this is
|
|
||||||
the only value supported in on-premises deployments)
|
|
||||||
:type access_key: str
|
|
||||||
:param secret_key: New secret key
|
|
||||||
:type secret_key: str
|
|
||||||
"""
|
|
||||||
|
|
||||||
_service = "auth"
|
|
||||||
_action = "set_credentials"
|
|
||||||
_version = "1.5"
|
|
||||||
_schema = {
|
|
||||||
'definitions': {},
|
|
||||||
'properties': {
|
|
||||||
'access_key': {
|
|
||||||
'description': "Credentials key. Must be identical to the user's ID (this is the only value supported in on-premises deployments)",
|
|
||||||
'type': 'string',
|
|
||||||
},
|
|
||||||
'secret_key': {'description': 'New secret key', 'type': 'string'},
|
|
||||||
},
|
|
||||||
'required': ['access_key', 'secret_key'],
|
|
||||||
'type': 'object',
|
|
||||||
}
|
|
||||||
def __init__(
|
|
||||||
self, access_key, secret_key, **kwargs):
|
|
||||||
super(SetCredentialsRequest, self).__init__(**kwargs)
|
|
||||||
self.access_key = access_key
|
|
||||||
self.secret_key = secret_key
|
|
||||||
|
|
||||||
@schema_property('access_key')
|
|
||||||
def access_key(self):
|
|
||||||
return self._property_access_key
|
|
||||||
|
|
||||||
@access_key.setter
|
|
||||||
def access_key(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_access_key = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "access_key", six.string_types)
|
|
||||||
self._property_access_key = value
|
|
||||||
|
|
||||||
@schema_property('secret_key')
|
|
||||||
def secret_key(self):
|
|
||||||
return self._property_secret_key
|
|
||||||
|
|
||||||
@secret_key.setter
|
|
||||||
def secret_key(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_secret_key = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "secret_key", six.string_types)
|
|
||||||
self._property_secret_key = value
|
|
||||||
|
|
||||||
|
|
||||||
class SetCredentialsResponse(Response):
|
|
||||||
"""
|
|
||||||
Response of auth.set_credentials endpoint.
|
|
||||||
|
|
||||||
:param set: True if secret was successfully set, False otherwise
|
|
||||||
:type set: bool
|
|
||||||
"""
|
|
||||||
_service = "auth"
|
|
||||||
_action = "set_credentials"
|
|
||||||
_version = "1.5"
|
|
||||||
|
|
||||||
_schema = {
|
|
||||||
'definitions': {},
|
|
||||||
'properties': {
|
|
||||||
'set': {
|
|
||||||
'description': 'True if secret was successfully set, False otherwise',
|
|
||||||
'type': ['boolean', 'null'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'type': 'object',
|
|
||||||
}
|
|
||||||
def __init__(
|
|
||||||
self, set=None, **kwargs):
|
|
||||||
super(SetCredentialsResponse, self).__init__(**kwargs)
|
|
||||||
self.set = set
|
|
||||||
|
|
||||||
@schema_property('set')
|
|
||||||
def set(self):
|
|
||||||
return self._property_set
|
|
||||||
|
|
||||||
@set.setter
|
|
||||||
def set(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_set = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "set", (bool,))
|
|
||||||
self._property_set = value
|
|
||||||
|
|
||||||
|
|
||||||
response_mapping = {
|
response_mapping = {
|
||||||
LoginRequest: LoginResponse,
|
LoginRequest: LoginResponse,
|
||||||
GetTaskTokenRequest: GetTaskTokenResponse,
|
|
||||||
CreateCredentialsRequest: CreateCredentialsResponse,
|
CreateCredentialsRequest: CreateCredentialsResponse,
|
||||||
GetCredentialsRequest: GetCredentialsResponse,
|
GetCredentialsRequest: GetCredentialsResponse,
|
||||||
RevokeCredentialsRequest: RevokeCredentialsResponse,
|
RevokeCredentialsRequest: RevokeCredentialsResponse,
|
||||||
SetCredentialsRequest: SetCredentialsResponse,
|
|
||||||
AddUserRequest: AddUserResponse,
|
|
||||||
DeleteUserRequest: DeleteUserResponse,
|
DeleteUserRequest: DeleteUserResponse,
|
||||||
ReloadConfigRequest: ReloadConfigResponse,
|
|
||||||
EditUserRequest: EditUserResponse,
|
EditUserRequest: EditUserResponse,
|
||||||
}
|
}
|
||||||
|
@ -1,194 +0,0 @@
|
|||||||
"""
|
|
||||||
debug service
|
|
||||||
|
|
||||||
Debugging utilities
|
|
||||||
"""
|
|
||||||
import six
|
|
||||||
import types
|
|
||||||
from datetime import datetime
|
|
||||||
import enum
|
|
||||||
|
|
||||||
from dateutil.parser import parse as parse_datetime
|
|
||||||
|
|
||||||
from ....backend_api.session import Request, BatchRequest, Response, DataModel, NonStrictDataModel, CompoundRequest, schema_property, StringEnum
|
|
||||||
|
|
||||||
|
|
||||||
class ApiexRequest(Request):
|
|
||||||
"""
|
|
||||||
"""
|
|
||||||
|
|
||||||
_service = "debug"
|
|
||||||
_action = "apiex"
|
|
||||||
_version = "1.5"
|
|
||||||
_schema = {'definitions': {}, 'properties': {}, 'required': [], 'type': 'object'}
|
|
||||||
|
|
||||||
|
|
||||||
class ApiexResponse(Response):
|
|
||||||
"""
|
|
||||||
Response of debug.apiex endpoint.
|
|
||||||
|
|
||||||
"""
|
|
||||||
_service = "debug"
|
|
||||||
_action = "apiex"
|
|
||||||
_version = "1.5"
|
|
||||||
|
|
||||||
_schema = {'definitions': {}, 'properties': {}, 'type': 'object'}
|
|
||||||
|
|
||||||
|
|
||||||
class EchoRequest(Request):
|
|
||||||
"""
|
|
||||||
Return request data
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
_service = "debug"
|
|
||||||
_action = "echo"
|
|
||||||
_version = "1.5"
|
|
||||||
_schema = {'definitions': {}, 'properties': {}, 'type': 'object'}
|
|
||||||
|
|
||||||
|
|
||||||
class EchoResponse(Response):
|
|
||||||
"""
|
|
||||||
Response of debug.echo endpoint.
|
|
||||||
|
|
||||||
"""
|
|
||||||
_service = "debug"
|
|
||||||
_action = "echo"
|
|
||||||
_version = "1.5"
|
|
||||||
|
|
||||||
_schema = {'definitions': {}, 'properties': {}, 'type': 'object'}
|
|
||||||
|
|
||||||
|
|
||||||
class ExRequest(Request):
|
|
||||||
"""
|
|
||||||
"""
|
|
||||||
|
|
||||||
_service = "debug"
|
|
||||||
_action = "ex"
|
|
||||||
_version = "1.5"
|
|
||||||
_schema = {'definitions': {}, 'properties': {}, 'required': [], 'type': 'object'}
|
|
||||||
|
|
||||||
|
|
||||||
class ExResponse(Response):
|
|
||||||
"""
|
|
||||||
Response of debug.ex endpoint.
|
|
||||||
|
|
||||||
"""
|
|
||||||
_service = "debug"
|
|
||||||
_action = "ex"
|
|
||||||
_version = "1.5"
|
|
||||||
|
|
||||||
_schema = {'definitions': {}, 'properties': {}, 'type': 'object'}
|
|
||||||
|
|
||||||
|
|
||||||
class PingRequest(Request):
|
|
||||||
"""
|
|
||||||
Return a message. Does not require authorization.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
_service = "debug"
|
|
||||||
_action = "ping"
|
|
||||||
_version = "1.5"
|
|
||||||
_schema = {'definitions': {}, 'properties': {}, 'type': 'object'}
|
|
||||||
|
|
||||||
|
|
||||||
class PingResponse(Response):
|
|
||||||
"""
|
|
||||||
Response of debug.ping endpoint.
|
|
||||||
|
|
||||||
:param msg: A friendly message
|
|
||||||
:type msg: str
|
|
||||||
"""
|
|
||||||
_service = "debug"
|
|
||||||
_action = "ping"
|
|
||||||
_version = "1.5"
|
|
||||||
|
|
||||||
_schema = {
|
|
||||||
'definitions': {},
|
|
||||||
'properties': {
|
|
||||||
'msg': {
|
|
||||||
'description': 'A friendly message',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'type': 'object',
|
|
||||||
}
|
|
||||||
def __init__(
|
|
||||||
self, msg=None, **kwargs):
|
|
||||||
super(PingResponse, self).__init__(**kwargs)
|
|
||||||
self.msg = msg
|
|
||||||
|
|
||||||
@schema_property('msg')
|
|
||||||
def msg(self):
|
|
||||||
return self._property_msg
|
|
||||||
|
|
||||||
@msg.setter
|
|
||||||
def msg(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_msg = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "msg", six.string_types)
|
|
||||||
self._property_msg = value
|
|
||||||
|
|
||||||
|
|
||||||
class PingAuthRequest(Request):
|
|
||||||
"""
|
|
||||||
Return a message. Requires authorization.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
_service = "debug"
|
|
||||||
_action = "ping_auth"
|
|
||||||
_version = "1.5"
|
|
||||||
_schema = {'definitions': {}, 'properties': {}, 'type': 'object'}
|
|
||||||
|
|
||||||
|
|
||||||
class PingAuthResponse(Response):
|
|
||||||
"""
|
|
||||||
Response of debug.ping_auth endpoint.
|
|
||||||
|
|
||||||
:param msg: A friendly message
|
|
||||||
:type msg: str
|
|
||||||
"""
|
|
||||||
_service = "debug"
|
|
||||||
_action = "ping_auth"
|
|
||||||
_version = "1.5"
|
|
||||||
|
|
||||||
_schema = {
|
|
||||||
'definitions': {},
|
|
||||||
'properties': {
|
|
||||||
'msg': {
|
|
||||||
'description': 'A friendly message',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'type': 'object',
|
|
||||||
}
|
|
||||||
def __init__(
|
|
||||||
self, msg=None, **kwargs):
|
|
||||||
super(PingAuthResponse, self).__init__(**kwargs)
|
|
||||||
self.msg = msg
|
|
||||||
|
|
||||||
@schema_property('msg')
|
|
||||||
def msg(self):
|
|
||||||
return self._property_msg
|
|
||||||
|
|
||||||
@msg.setter
|
|
||||||
def msg(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_msg = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "msg", six.string_types)
|
|
||||||
self._property_msg = value
|
|
||||||
|
|
||||||
|
|
||||||
response_mapping = {
|
|
||||||
EchoRequest: EchoResponse,
|
|
||||||
PingRequest: PingResponse,
|
|
||||||
PingAuthRequest: PingAuthResponse,
|
|
||||||
ApiexRequest: ApiexResponse,
|
|
||||||
ExRequest: ExResponse,
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
"""
|
|
||||||
news service
|
|
||||||
|
|
||||||
This service provides platform news.
|
|
||||||
"""
|
|
||||||
import six
|
|
||||||
import types
|
|
||||||
from datetime import datetime
|
|
||||||
import enum
|
|
||||||
|
|
||||||
from dateutil.parser import parse as parse_datetime
|
|
||||||
|
|
||||||
from ....backend_api.session import Request, BatchRequest, Response, DataModel, NonStrictDataModel, CompoundRequest, schema_property, StringEnum
|
|
||||||
|
|
||||||
|
|
||||||
class GetRequest(Request):
|
|
||||||
"""
|
|
||||||
Gets latest news link
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
_service = "news"
|
|
||||||
_action = "get"
|
|
||||||
_version = "1.5"
|
|
||||||
_schema = {'definitions': {}, 'properties': {}, 'type': 'object'}
|
|
||||||
|
|
||||||
|
|
||||||
class GetResponse(Response):
|
|
||||||
"""
|
|
||||||
Response of news.get endpoint.
|
|
||||||
|
|
||||||
:param url: URL to news html file
|
|
||||||
:type url: str
|
|
||||||
"""
|
|
||||||
_service = "news"
|
|
||||||
_action = "get"
|
|
||||||
_version = "1.5"
|
|
||||||
|
|
||||||
_schema = {
|
|
||||||
'definitions': {},
|
|
||||||
'properties': {
|
|
||||||
'url': {
|
|
||||||
'description': 'URL to news html file',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'type': 'object',
|
|
||||||
}
|
|
||||||
def __init__(
|
|
||||||
self, url=None, **kwargs):
|
|
||||||
super(GetResponse, self).__init__(**kwargs)
|
|
||||||
self.url = url
|
|
||||||
|
|
||||||
@schema_property('url')
|
|
||||||
def url(self):
|
|
||||||
return self._property_url
|
|
||||||
|
|
||||||
@url.setter
|
|
||||||
def url(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_url = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "url", six.string_types)
|
|
||||||
self._property_url = value
|
|
||||||
|
|
||||||
|
|
||||||
response_mapping = {
|
|
||||||
GetRequest: GetResponse,
|
|
||||||
}
|
|
@ -1,681 +0,0 @@
|
|||||||
"""
|
|
||||||
storage service
|
|
||||||
|
|
||||||
Provides a management API for customer-associated storage locations
|
|
||||||
"""
|
|
||||||
import six
|
|
||||||
import types
|
|
||||||
from datetime import datetime
|
|
||||||
import enum
|
|
||||||
|
|
||||||
from dateutil.parser import parse as parse_datetime
|
|
||||||
|
|
||||||
from ....backend_api.session import Request, BatchRequest, Response, DataModel, NonStrictDataModel, CompoundRequest, schema_property, StringEnum
|
|
||||||
|
|
||||||
|
|
||||||
class Credentials(NonStrictDataModel):
|
|
||||||
"""
|
|
||||||
:param access_key: Credentials access key
|
|
||||||
:type access_key: str
|
|
||||||
:param secret_key: Credentials secret key
|
|
||||||
:type secret_key: str
|
|
||||||
"""
|
|
||||||
_schema = {
|
|
||||||
'properties': {
|
|
||||||
'access_key': {
|
|
||||||
'description': 'Credentials access key',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
'secret_key': {
|
|
||||||
'description': 'Credentials secret key',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'type': 'object',
|
|
||||||
}
|
|
||||||
def __init__(
|
|
||||||
self, access_key=None, secret_key=None, **kwargs):
|
|
||||||
super(Credentials, self).__init__(**kwargs)
|
|
||||||
self.access_key = access_key
|
|
||||||
self.secret_key = secret_key
|
|
||||||
|
|
||||||
@schema_property('access_key')
|
|
||||||
def access_key(self):
|
|
||||||
return self._property_access_key
|
|
||||||
|
|
||||||
@access_key.setter
|
|
||||||
def access_key(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_access_key = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "access_key", six.string_types)
|
|
||||||
self._property_access_key = value
|
|
||||||
|
|
||||||
@schema_property('secret_key')
|
|
||||||
def secret_key(self):
|
|
||||||
return self._property_secret_key
|
|
||||||
|
|
||||||
@secret_key.setter
|
|
||||||
def secret_key(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_secret_key = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "secret_key", six.string_types)
|
|
||||||
self._property_secret_key = value
|
|
||||||
|
|
||||||
|
|
||||||
class Storage(NonStrictDataModel):
|
|
||||||
"""
|
|
||||||
:param id: Entry ID
|
|
||||||
:type id: str
|
|
||||||
:param name: Entry name
|
|
||||||
:type name: str
|
|
||||||
:param company: Company ID
|
|
||||||
:type company: str
|
|
||||||
:param created: Entry creation time
|
|
||||||
:type created: datetime.datetime
|
|
||||||
:param uri: Storage URI
|
|
||||||
:type uri: str
|
|
||||||
:param credentials: Credentials required for accessing the storage
|
|
||||||
:type credentials: Credentials
|
|
||||||
"""
|
|
||||||
_schema = {
|
|
||||||
'properties': {
|
|
||||||
'company': {'description': 'Company ID', 'type': ['string', 'null']},
|
|
||||||
'created': {
|
|
||||||
'description': 'Entry creation time',
|
|
||||||
'format': 'date-time',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
'credentials': {
|
|
||||||
'description': 'Credentials required for accessing the storage',
|
|
||||||
'oneOf': [{'$ref': '#/definitions/credentials'}, {'type': 'null'}],
|
|
||||||
},
|
|
||||||
'id': {'description': 'Entry ID', 'type': ['string', 'null']},
|
|
||||||
'name': {'description': 'Entry name', 'type': ['string', 'null']},
|
|
||||||
'uri': {'description': 'Storage URI', 'type': ['string', 'null']},
|
|
||||||
},
|
|
||||||
'type': 'object',
|
|
||||||
}
|
|
||||||
def __init__(
|
|
||||||
self, id=None, name=None, company=None, created=None, uri=None, credentials=None, **kwargs):
|
|
||||||
super(Storage, self).__init__(**kwargs)
|
|
||||||
self.id = id
|
|
||||||
self.name = name
|
|
||||||
self.company = company
|
|
||||||
self.created = created
|
|
||||||
self.uri = uri
|
|
||||||
self.credentials = credentials
|
|
||||||
|
|
||||||
@schema_property('id')
|
|
||||||
def id(self):
|
|
||||||
return self._property_id
|
|
||||||
|
|
||||||
@id.setter
|
|
||||||
def id(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_id = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "id", six.string_types)
|
|
||||||
self._property_id = value
|
|
||||||
|
|
||||||
@schema_property('name')
|
|
||||||
def name(self):
|
|
||||||
return self._property_name
|
|
||||||
|
|
||||||
@name.setter
|
|
||||||
def name(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_name = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "name", six.string_types)
|
|
||||||
self._property_name = value
|
|
||||||
|
|
||||||
@schema_property('company')
|
|
||||||
def company(self):
|
|
||||||
return self._property_company
|
|
||||||
|
|
||||||
@company.setter
|
|
||||||
def company(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_company = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "company", six.string_types)
|
|
||||||
self._property_company = value
|
|
||||||
|
|
||||||
@schema_property('created')
|
|
||||||
def created(self):
|
|
||||||
return self._property_created
|
|
||||||
|
|
||||||
@created.setter
|
|
||||||
def created(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_created = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "created", six.string_types + (datetime,))
|
|
||||||
if not isinstance(value, datetime):
|
|
||||||
value = parse_datetime(value)
|
|
||||||
self._property_created = value
|
|
||||||
|
|
||||||
@schema_property('uri')
|
|
||||||
def uri(self):
|
|
||||||
return self._property_uri
|
|
||||||
|
|
||||||
@uri.setter
|
|
||||||
def uri(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_uri = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "uri", six.string_types)
|
|
||||||
self._property_uri = value
|
|
||||||
|
|
||||||
@schema_property('credentials')
|
|
||||||
def credentials(self):
|
|
||||||
return self._property_credentials
|
|
||||||
|
|
||||||
@credentials.setter
|
|
||||||
def credentials(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_credentials = None
|
|
||||||
return
|
|
||||||
if isinstance(value, dict):
|
|
||||||
value = Credentials.from_dict(value)
|
|
||||||
else:
|
|
||||||
self.assert_isinstance(value, "credentials", Credentials)
|
|
||||||
self._property_credentials = value
|
|
||||||
|
|
||||||
|
|
||||||
class CreateRequest(Request):
|
|
||||||
"""
|
|
||||||
Create a new storage entry
|
|
||||||
|
|
||||||
:param name: Storage name
|
|
||||||
:type name: str
|
|
||||||
:param uri: Storage URI
|
|
||||||
:type uri: str
|
|
||||||
:param credentials: Credentials required for accessing the storage
|
|
||||||
:type credentials: Credentials
|
|
||||||
:param company: Company under which to add this storage. Only valid for users
|
|
||||||
with the root or system role, otherwise the calling user's company will be
|
|
||||||
used.
|
|
||||||
:type company: str
|
|
||||||
"""
|
|
||||||
|
|
||||||
_service = "storage"
|
|
||||||
_action = "create"
|
|
||||||
_version = "1.5"
|
|
||||||
_schema = {
|
|
||||||
'definitions': {
|
|
||||||
'credentials': {
|
|
||||||
'properties': {
|
|
||||||
'access_key': {
|
|
||||||
'description': 'Credentials access key',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
'secret_key': {
|
|
||||||
'description': 'Credentials secret key',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'type': 'object',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'properties': {
|
|
||||||
'company': {
|
|
||||||
'description': "Company under which to add this storage. Only valid for users with the root or system role, otherwise the calling user's company will be used.",
|
|
||||||
'type': 'string',
|
|
||||||
},
|
|
||||||
'credentials': {
|
|
||||||
'$ref': '#/definitions/credentials',
|
|
||||||
'description': 'Credentials required for accessing the storage',
|
|
||||||
},
|
|
||||||
'name': {'description': 'Storage name', 'type': ['string', 'null']},
|
|
||||||
'uri': {'description': 'Storage URI', 'type': 'string'},
|
|
||||||
},
|
|
||||||
'required': ['uri'],
|
|
||||||
'type': 'object',
|
|
||||||
}
|
|
||||||
def __init__(
|
|
||||||
self, uri, name=None, credentials=None, company=None, **kwargs):
|
|
||||||
super(CreateRequest, self).__init__(**kwargs)
|
|
||||||
self.name = name
|
|
||||||
self.uri = uri
|
|
||||||
self.credentials = credentials
|
|
||||||
self.company = company
|
|
||||||
|
|
||||||
@schema_property('name')
|
|
||||||
def name(self):
|
|
||||||
return self._property_name
|
|
||||||
|
|
||||||
@name.setter
|
|
||||||
def name(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_name = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "name", six.string_types)
|
|
||||||
self._property_name = value
|
|
||||||
|
|
||||||
@schema_property('uri')
|
|
||||||
def uri(self):
|
|
||||||
return self._property_uri
|
|
||||||
|
|
||||||
@uri.setter
|
|
||||||
def uri(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_uri = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "uri", six.string_types)
|
|
||||||
self._property_uri = value
|
|
||||||
|
|
||||||
@schema_property('credentials')
|
|
||||||
def credentials(self):
|
|
||||||
return self._property_credentials
|
|
||||||
|
|
||||||
@credentials.setter
|
|
||||||
def credentials(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_credentials = None
|
|
||||||
return
|
|
||||||
if isinstance(value, dict):
|
|
||||||
value = Credentials.from_dict(value)
|
|
||||||
else:
|
|
||||||
self.assert_isinstance(value, "credentials", Credentials)
|
|
||||||
self._property_credentials = value
|
|
||||||
|
|
||||||
@schema_property('company')
|
|
||||||
def company(self):
|
|
||||||
return self._property_company
|
|
||||||
|
|
||||||
@company.setter
|
|
||||||
def company(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_company = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "company", six.string_types)
|
|
||||||
self._property_company = value
|
|
||||||
|
|
||||||
|
|
||||||
class CreateResponse(Response):
|
|
||||||
"""
|
|
||||||
Response of storage.create endpoint.
|
|
||||||
|
|
||||||
:param id: New storage ID
|
|
||||||
:type id: str
|
|
||||||
"""
|
|
||||||
_service = "storage"
|
|
||||||
_action = "create"
|
|
||||||
_version = "1.5"
|
|
||||||
|
|
||||||
_schema = {
|
|
||||||
'definitions': {},
|
|
||||||
'properties': {
|
|
||||||
'id': {'description': 'New storage ID', 'type': ['string', 'null']},
|
|
||||||
},
|
|
||||||
'type': 'object',
|
|
||||||
}
|
|
||||||
def __init__(
|
|
||||||
self, id=None, **kwargs):
|
|
||||||
super(CreateResponse, self).__init__(**kwargs)
|
|
||||||
self.id = id
|
|
||||||
|
|
||||||
@schema_property('id')
|
|
||||||
def id(self):
|
|
||||||
return self._property_id
|
|
||||||
|
|
||||||
@id.setter
|
|
||||||
def id(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_id = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "id", six.string_types)
|
|
||||||
self._property_id = value
|
|
||||||
|
|
||||||
|
|
||||||
class DeleteRequest(Request):
|
|
||||||
"""
|
|
||||||
Deletes a storage entry
|
|
||||||
|
|
||||||
:param storage: Storage entry ID
|
|
||||||
:type storage: str
|
|
||||||
"""
|
|
||||||
|
|
||||||
_service = "storage"
|
|
||||||
_action = "delete"
|
|
||||||
_version = "1.5"
|
|
||||||
_schema = {
|
|
||||||
'definitions': {},
|
|
||||||
'properties': {
|
|
||||||
'storage': {'description': 'Storage entry ID', 'type': 'string'},
|
|
||||||
},
|
|
||||||
'required': ['storage'],
|
|
||||||
'type': 'object',
|
|
||||||
}
|
|
||||||
def __init__(
|
|
||||||
self, storage, **kwargs):
|
|
||||||
super(DeleteRequest, self).__init__(**kwargs)
|
|
||||||
self.storage = storage
|
|
||||||
|
|
||||||
@schema_property('storage')
|
|
||||||
def storage(self):
|
|
||||||
return self._property_storage
|
|
||||||
|
|
||||||
@storage.setter
|
|
||||||
def storage(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_storage = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "storage", six.string_types)
|
|
||||||
self._property_storage = value
|
|
||||||
|
|
||||||
|
|
||||||
class DeleteResponse(Response):
|
|
||||||
"""
|
|
||||||
Response of storage.delete endpoint.
|
|
||||||
|
|
||||||
:param deleted: Number of storage entries deleted (0 or 1)
|
|
||||||
:type deleted: int
|
|
||||||
"""
|
|
||||||
_service = "storage"
|
|
||||||
_action = "delete"
|
|
||||||
_version = "1.5"
|
|
||||||
|
|
||||||
_schema = {
|
|
||||||
'definitions': {},
|
|
||||||
'properties': {
|
|
||||||
'deleted': {
|
|
||||||
'description': 'Number of storage entries deleted (0 or 1)',
|
|
||||||
'type': ['integer', 'null'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'type': 'object',
|
|
||||||
}
|
|
||||||
def __init__(
|
|
||||||
self, deleted=None, **kwargs):
|
|
||||||
super(DeleteResponse, self).__init__(**kwargs)
|
|
||||||
self.deleted = deleted
|
|
||||||
|
|
||||||
@schema_property('deleted')
|
|
||||||
def deleted(self):
|
|
||||||
return self._property_deleted
|
|
||||||
|
|
||||||
@deleted.setter
|
|
||||||
def deleted(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_deleted = None
|
|
||||||
return
|
|
||||||
if isinstance(value, float) and value.is_integer():
|
|
||||||
value = int(value)
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "deleted", six.integer_types)
|
|
||||||
self._property_deleted = value
|
|
||||||
|
|
||||||
|
|
||||||
class GetAllRequest(Request):
|
|
||||||
"""
|
|
||||||
Get all storage entries
|
|
||||||
|
|
||||||
:param name: Get only storage entries whose name matches this pattern (python
|
|
||||||
regular expression syntax)
|
|
||||||
:type name: str
|
|
||||||
:param id: List of Storage IDs used to filter results
|
|
||||||
:type id: Sequence[str]
|
|
||||||
:param page: Page number, returns a specific page out of the result list of
|
|
||||||
results.
|
|
||||||
:type page: int
|
|
||||||
:param page_size: Page size, specifies the number of results returned in each
|
|
||||||
page (last page may contain fewer results)
|
|
||||||
:type page_size: int
|
|
||||||
:param order_by: List of field names to order by. When search_text is used,
|
|
||||||
'@text_score' can be used as a field representing the text score of returned
|
|
||||||
documents. Use '-' prefix to specify descending order. Optional, recommended
|
|
||||||
when using page
|
|
||||||
:type order_by: Sequence[str]
|
|
||||||
:param only_fields: List of document field names (nesting is supported using
|
|
||||||
'.', e.g. execution.model_labels). If provided, this list defines the query's
|
|
||||||
projection (only these fields will be returned for each result entry)
|
|
||||||
:type only_fields: Sequence[str]
|
|
||||||
"""
|
|
||||||
|
|
||||||
_service = "storage"
|
|
||||||
_action = "get_all"
|
|
||||||
_version = "1.5"
|
|
||||||
_schema = {
|
|
||||||
'definitions': {},
|
|
||||||
'properties': {
|
|
||||||
'id': {
|
|
||||||
'description': 'List of Storage IDs used to filter results',
|
|
||||||
'items': {'type': 'string'},
|
|
||||||
'type': ['array', 'null'],
|
|
||||||
},
|
|
||||||
'name': {
|
|
||||||
'description': 'Get only storage entries whose name matches this pattern (python regular expression syntax)',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
'only_fields': {
|
|
||||||
'description': "List of document field names (nesting is supported using '.', e.g. execution.model_labels). If provided, this list defines the query's projection (only these fields will be returned for each result entry)",
|
|
||||||
'items': {'type': 'string'},
|
|
||||||
'type': ['array', 'null'],
|
|
||||||
},
|
|
||||||
'order_by': {
|
|
||||||
'description': "List of field names to order by. When search_text is used, '@text_score' can be used as a field representing the text score of returned documents. Use '-' prefix to specify descending order. Optional, recommended when using page",
|
|
||||||
'items': {'type': 'string'},
|
|
||||||
'type': ['array', 'null'],
|
|
||||||
},
|
|
||||||
'page': {
|
|
||||||
'description': 'Page number, returns a specific page out of the result list of results.',
|
|
||||||
'minimum': 0,
|
|
||||||
'type': ['integer', 'null'],
|
|
||||||
},
|
|
||||||
'page_size': {
|
|
||||||
'description': 'Page size, specifies the number of results returned in each page (last page may contain fewer results)',
|
|
||||||
'minimum': 1,
|
|
||||||
'type': ['integer', 'null'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'type': 'object',
|
|
||||||
}
|
|
||||||
def __init__(
|
|
||||||
self, name=None, id=None, page=None, page_size=None, order_by=None, only_fields=None, **kwargs):
|
|
||||||
super(GetAllRequest, self).__init__(**kwargs)
|
|
||||||
self.name = name
|
|
||||||
self.id = id
|
|
||||||
self.page = page
|
|
||||||
self.page_size = page_size
|
|
||||||
self.order_by = order_by
|
|
||||||
self.only_fields = only_fields
|
|
||||||
|
|
||||||
@schema_property('name')
|
|
||||||
def name(self):
|
|
||||||
return self._property_name
|
|
||||||
|
|
||||||
@name.setter
|
|
||||||
def name(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_name = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "name", six.string_types)
|
|
||||||
self._property_name = value
|
|
||||||
|
|
||||||
@schema_property('id')
|
|
||||||
def id(self):
|
|
||||||
return self._property_id
|
|
||||||
|
|
||||||
@id.setter
|
|
||||||
def id(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_id = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "id", (list, tuple))
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "id", six.string_types, is_array=True)
|
|
||||||
self._property_id = value
|
|
||||||
|
|
||||||
@schema_property('page')
|
|
||||||
def page(self):
|
|
||||||
return self._property_page
|
|
||||||
|
|
||||||
@page.setter
|
|
||||||
def page(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_page = None
|
|
||||||
return
|
|
||||||
if isinstance(value, float) and value.is_integer():
|
|
||||||
value = int(value)
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "page", six.integer_types)
|
|
||||||
self._property_page = value
|
|
||||||
|
|
||||||
@schema_property('page_size')
|
|
||||||
def page_size(self):
|
|
||||||
return self._property_page_size
|
|
||||||
|
|
||||||
@page_size.setter
|
|
||||||
def page_size(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_page_size = None
|
|
||||||
return
|
|
||||||
if isinstance(value, float) and value.is_integer():
|
|
||||||
value = int(value)
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "page_size", six.integer_types)
|
|
||||||
self._property_page_size = value
|
|
||||||
|
|
||||||
@schema_property('order_by')
|
|
||||||
def order_by(self):
|
|
||||||
return self._property_order_by
|
|
||||||
|
|
||||||
@order_by.setter
|
|
||||||
def order_by(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_order_by = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "order_by", (list, tuple))
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "order_by", six.string_types, is_array=True)
|
|
||||||
self._property_order_by = value
|
|
||||||
|
|
||||||
@schema_property('only_fields')
|
|
||||||
def only_fields(self):
|
|
||||||
return self._property_only_fields
|
|
||||||
|
|
||||||
@only_fields.setter
|
|
||||||
def only_fields(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_only_fields = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "only_fields", (list, tuple))
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "only_fields", six.string_types, is_array=True)
|
|
||||||
self._property_only_fields = value
|
|
||||||
|
|
||||||
|
|
||||||
class GetAllResponse(Response):
|
|
||||||
"""
|
|
||||||
Response of storage.get_all endpoint.
|
|
||||||
|
|
||||||
:param results: Storage entries list
|
|
||||||
:type results: Sequence[Storage]
|
|
||||||
"""
|
|
||||||
_service = "storage"
|
|
||||||
_action = "get_all"
|
|
||||||
_version = "1.5"
|
|
||||||
|
|
||||||
_schema = {
|
|
||||||
'definitions': {
|
|
||||||
'credentials': {
|
|
||||||
'properties': {
|
|
||||||
'access_key': {
|
|
||||||
'description': 'Credentials access key',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
'secret_key': {
|
|
||||||
'description': 'Credentials secret key',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'type': 'object',
|
|
||||||
},
|
|
||||||
'storage': {
|
|
||||||
'properties': {
|
|
||||||
'company': {
|
|
||||||
'description': 'Company ID',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
'created': {
|
|
||||||
'description': 'Entry creation time',
|
|
||||||
'format': 'date-time',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
'credentials': {
|
|
||||||
'description': 'Credentials required for accessing the storage',
|
|
||||||
'oneOf': [
|
|
||||||
{'$ref': '#/definitions/credentials'},
|
|
||||||
{'type': 'null'},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
'id': {'description': 'Entry ID', 'type': ['string', 'null']},
|
|
||||||
'name': {
|
|
||||||
'description': 'Entry name',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
'uri': {
|
|
||||||
'description': 'Storage URI',
|
|
||||||
'type': ['string', 'null'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'type': 'object',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'properties': {
|
|
||||||
'results': {
|
|
||||||
'description': 'Storage entries list',
|
|
||||||
'items': {'$ref': '#/definitions/storage'},
|
|
||||||
'type': ['array', 'null'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'type': 'object',
|
|
||||||
}
|
|
||||||
def __init__(
|
|
||||||
self, results=None, **kwargs):
|
|
||||||
super(GetAllResponse, self).__init__(**kwargs)
|
|
||||||
self.results = results
|
|
||||||
|
|
||||||
@schema_property('results')
|
|
||||||
def results(self):
|
|
||||||
return self._property_results
|
|
||||||
|
|
||||||
@results.setter
|
|
||||||
def results(self, value):
|
|
||||||
if value is None:
|
|
||||||
self._property_results = None
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assert_isinstance(value, "results", (list, tuple))
|
|
||||||
if any(isinstance(v, dict) for v in value):
|
|
||||||
value = [Storage.from_dict(v) if isinstance(v, dict) else v for v in value]
|
|
||||||
else:
|
|
||||||
self.assert_isinstance(value, "results", Storage, is_array=True)
|
|
||||||
self._property_results = value
|
|
||||||
|
|
||||||
|
|
||||||
response_mapping = {
|
|
||||||
GetAllRequest: GetAllResponse,
|
|
||||||
CreateRequest: CreateResponse,
|
|
||||||
DeleteRequest: DeleteResponse,
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
0
trains/backend_api/services/v2_2/__init__.py
Normal file
0
trains/backend_api/services/v2_2/__init__.py
Normal file
621
trains/backend_api/services/v2_2/auth.py
Normal file
621
trains/backend_api/services/v2_2/auth.py
Normal file
@ -0,0 +1,621 @@
|
|||||||
|
"""
|
||||||
|
auth service
|
||||||
|
|
||||||
|
This service provides authentication management and authorization
|
||||||
|
validation for the entire system.
|
||||||
|
"""
|
||||||
|
import six
|
||||||
|
import types
|
||||||
|
from datetime import datetime
|
||||||
|
import enum
|
||||||
|
|
||||||
|
from dateutil.parser import parse as parse_datetime
|
||||||
|
|
||||||
|
from ....backend_api.session import Request, BatchRequest, Response, DataModel, NonStrictDataModel, CompoundRequest, schema_property, StringEnum
|
||||||
|
|
||||||
|
|
||||||
|
class Credentials(NonStrictDataModel):
|
||||||
|
"""
|
||||||
|
:param access_key: Credentials access key
|
||||||
|
:type access_key: str
|
||||||
|
:param secret_key: Credentials secret key
|
||||||
|
:type secret_key: str
|
||||||
|
"""
|
||||||
|
_schema = {
|
||||||
|
'properties': {
|
||||||
|
'access_key': {
|
||||||
|
'description': 'Credentials access key',
|
||||||
|
'type': ['string', 'null'],
|
||||||
|
},
|
||||||
|
'secret_key': {
|
||||||
|
'description': 'Credentials secret key',
|
||||||
|
'type': ['string', 'null'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'type': 'object',
|
||||||
|
}
|
||||||
|
def __init__(
|
||||||
|
self, access_key=None, secret_key=None, **kwargs):
|
||||||
|
super(Credentials, self).__init__(**kwargs)
|
||||||
|
self.access_key = access_key
|
||||||
|
self.secret_key = secret_key
|
||||||
|
|
||||||
|
@schema_property('access_key')
|
||||||
|
def access_key(self):
|
||||||
|
return self._property_access_key
|
||||||
|
|
||||||
|
@access_key.setter
|
||||||
|
def access_key(self, value):
|
||||||
|
if value is None:
|
||||||
|
self._property_access_key = None
|
||||||
|
return
|
||||||
|
|
||||||
|
self.assert_isinstance(value, "access_key", six.string_types)
|
||||||
|
self._property_access_key = value
|
||||||
|
|
||||||
|
@schema_property('secret_key')
|
||||||
|
def secret_key(self):
|
||||||
|
return self._property_secret_key
|
||||||
|
|
||||||
|
@secret_key.setter
|
||||||
|
def secret_key(self, value):
|
||||||
|
if value is None:
|
||||||
|
self._property_secret_key = None
|
||||||
|
return
|
||||||
|
|
||||||
|
self.assert_isinstance(value, "secret_key", six.string_types)
|
||||||
|
self._property_secret_key = value
|
||||||
|
|
||||||
|
|
||||||
|
class CredentialKey(NonStrictDataModel):
|
||||||
|
"""
|
||||||
|
:param access_key:
|
||||||
|
:type access_key: str
|
||||||
|
"""
|
||||||
|
_schema = {'properties': {'access_key': {'description': '', 'type': ['string', 'null']}}, 'type': 'object'}
|
||||||
|
def __init__(
|
||||||
|
self, access_key=None, **kwargs):
|
||||||
|
super(CredentialKey, self).__init__(**kwargs)
|
||||||
|
self.access_key = access_key
|
||||||
|
|
||||||
|
@schema_property('access_key')
|
||||||
|
def access_key(self):
|
||||||
|
return self._property_access_key
|
||||||
|
|
||||||
|
@access_key.setter
|
||||||
|
def access_key(self, value):
|
||||||
|
if value is None:
|
||||||
|
self._property_access_key = None
|
||||||
|
return
|
||||||
|
|
||||||
|
self.assert_isinstance(value, "access_key", six.string_types)
|
||||||
|
self._property_access_key = value
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class CreateCredentialsRequest(Request):
|
||||||
|
"""
|
||||||
|
Creates a new set of credentials for the authenticated user.
|
||||||
|
New key/secret is returned.
|
||||||
|
Note: Secret will never be returned in any other API call.
|
||||||
|
If a secret is lost or compromised, the key should be revoked
|
||||||
|
and a new set of credentials can be created.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
_service = "auth"
|
||||||
|
_action = "create_credentials"
|
||||||
|
_version = "1.5"
|
||||||
|
_schema = {
|
||||||
|
'additionalProperties': False,
|
||||||
|
'definitions': {},
|
||||||
|
'properties': {},
|
||||||
|
'type': 'object',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class CreateCredentialsResponse(Response):
|
||||||
|
"""
|
||||||
|
Response of auth.create_credentials endpoint.
|
||||||
|
|
||||||
|
:param credentials: Created credentials
|
||||||
|
:type credentials: Credentials
|
||||||
|
"""
|
||||||
|
_service = "auth"
|
||||||
|
_action = "create_credentials"
|
||||||
|
_version = "1.5"
|
||||||
|
|
||||||
|
_schema = {
|
||||||
|
'definitions': {
|
||||||
|
'credentials': {
|
||||||
|
'properties': {
|
||||||
|
'access_key': {
|
||||||
|
'description': 'Credentials access key',
|
||||||
|
'type': ['string', 'null'],
|
||||||
|
},
|
||||||
|
'secret_key': {
|
||||||
|
'description': 'Credentials secret key',
|
||||||
|
'type': ['string', 'null'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'type': 'object',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'properties': {
|
||||||
|
'credentials': {
|
||||||
|
'description': 'Created credentials',
|
||||||
|
'oneOf': [{'$ref': '#/definitions/credentials'}, {'type': 'null'}],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'type': 'object',
|
||||||
|
}
|
||||||
|
def __init__(
|
||||||
|
self, credentials=None, **kwargs):
|
||||||
|
super(CreateCredentialsResponse, self).__init__(**kwargs)
|
||||||
|
self.credentials = credentials
|
||||||
|
|
||||||
|
@schema_property('credentials')
|
||||||
|
def credentials(self):
|
||||||
|
return self._property_credentials
|
||||||
|
|
||||||
|
@credentials.setter
|
||||||
|
def credentials(self, value):
|
||||||
|
if value is None:
|
||||||
|
self._property_credentials = None
|
||||||
|
return
|
||||||
|
if isinstance(value, dict):
|
||||||
|
value = Credentials.from_dict(value)
|
||||||
|
else:
|
||||||
|
self.assert_isinstance(value, "credentials", Credentials)
|
||||||
|
self._property_credentials = value
|
||||||
|
|
||||||
|
|
||||||
|
class DeleteUserRequest(Request):
|
||||||
|
"""
|
||||||
|
Delete a new user manually. Only supported in on-premises deployments. This only removes the user's auth entry so that any references to the deleted user's ID will still have valid user information
|
||||||
|
|
||||||
|
:param user: User ID
|
||||||
|
:type user: str
|
||||||
|
"""
|
||||||
|
|
||||||
|
_service = "auth"
|
||||||
|
_action = "delete_user"
|
||||||
|
_version = "1.5"
|
||||||
|
_schema = {
|
||||||
|
'definitions': {},
|
||||||
|
'properties': {'user': {'description': 'User ID', 'type': 'string'}},
|
||||||
|
'required': ['user'],
|
||||||
|
'type': 'object',
|
||||||
|
}
|
||||||
|
def __init__(
|
||||||
|
self, user, **kwargs):
|
||||||
|
super(DeleteUserRequest, self).__init__(**kwargs)
|
||||||
|
self.user = user
|
||||||
|
|
||||||
|
@schema_property('user')
|
||||||
|
def user(self):
|
||||||
|
return self._property_user
|
||||||
|
|
||||||
|
@user.setter
|
||||||
|
def user(self, value):
|
||||||
|
if value is None:
|
||||||
|
self._property_user = None
|
||||||
|
return
|
||||||
|
|
||||||
|
self.assert_isinstance(value, "user", six.string_types)
|
||||||
|
self._property_user = value
|
||||||
|
|
||||||
|
|
||||||
|
class DeleteUserResponse(Response):
|
||||||
|
"""
|
||||||
|
Response of auth.delete_user endpoint.
|
||||||
|
|
||||||
|
:param deleted: True if user was successfully deleted, False otherwise
|
||||||
|
:type deleted: bool
|
||||||
|
"""
|
||||||
|
_service = "auth"
|
||||||
|
_action = "delete_user"
|
||||||
|
_version = "1.5"
|
||||||
|
|
||||||
|
_schema = {
|
||||||
|
'definitions': {},
|
||||||
|
'properties': {
|
||||||
|
'deleted': {
|
||||||
|
'description': 'True if user was successfully deleted, False otherwise',
|
||||||
|
'type': ['boolean', 'null'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'type': 'object',
|
||||||
|
}
|
||||||
|
def __init__(
|
||||||
|
self, deleted=None, **kwargs):
|
||||||
|
super(DeleteUserResponse, self).__init__(**kwargs)
|
||||||
|
self.deleted = deleted
|
||||||
|
|
||||||
|
@schema_property('deleted')
|
||||||
|
def deleted(self):
|
||||||
|
return self._property_deleted
|
||||||
|
|
||||||
|
@deleted.setter
|
||||||
|
def deleted(self, value):
|
||||||
|
if value is None:
|
||||||
|
self._property_deleted = None
|
||||||
|
return
|
||||||
|
|
||||||
|
self.assert_isinstance(value, "deleted", (bool,))
|
||||||
|
self._property_deleted = value
|
||||||
|
|
||||||
|
|
||||||
|
class EditUserRequest(Request):
|
||||||
|
"""
|
||||||
|
Edit a users' auth data properties
|
||||||
|
|
||||||
|
:param user: User ID
|
||||||
|
:type user: str
|
||||||
|
:param role: The new user's role within the company
|
||||||
|
:type role: str
|
||||||
|
"""
|
||||||
|
|
||||||
|
_service = "auth"
|
||||||
|
_action = "edit_user"
|
||||||
|
_version = "1.9"
|
||||||
|
_schema = {
|
||||||
|
'definitions': {},
|
||||||
|
'properties': {
|
||||||
|
'role': {
|
||||||
|
'description': "The new user's role within the company",
|
||||||
|
'enum': ['admin', 'superuser', 'user', 'annotator'],
|
||||||
|
'type': ['string', 'null'],
|
||||||
|
},
|
||||||
|
'user': {'description': 'User ID', 'type': ['string', 'null']},
|
||||||
|
},
|
||||||
|
'type': 'object',
|
||||||
|
}
|
||||||
|
def __init__(
|
||||||
|
self, user=None, role=None, **kwargs):
|
||||||
|
super(EditUserRequest, self).__init__(**kwargs)
|
||||||
|
self.user = user
|
||||||
|
self.role = role
|
||||||
|
|
||||||
|
@schema_property('user')
|
||||||
|
def user(self):
|
||||||
|
return self._property_user
|
||||||
|
|
||||||
|
@user.setter
|
||||||
|
def user(self, value):
|
||||||
|
if value is None:
|
||||||
|
self._property_user = None
|
||||||
|
return
|
||||||
|
|
||||||
|
self.assert_isinstance(value, "user", six.string_types)
|
||||||
|
self._property_user = value
|
||||||
|
|
||||||
|
@schema_property('role')
|
||||||
|
def role(self):
|
||||||
|
return self._property_role
|
||||||
|
|
||||||
|
@role.setter
|
||||||
|
def role(self, value):
|
||||||
|
if value is None:
|
||||||
|
self._property_role = None
|
||||||
|
return
|
||||||
|
|
||||||
|
self.assert_isinstance(value, "role", six.string_types)
|
||||||
|
self._property_role = value
|
||||||
|
|
||||||
|
|
||||||
|
class EditUserResponse(Response):
|
||||||
|
"""
|
||||||
|
Response of auth.edit_user endpoint.
|
||||||
|
|
||||||
|
:param updated: Number of users updated (0 or 1)
|
||||||
|
:type updated: float
|
||||||
|
:param fields: Updated fields names and values
|
||||||
|
:type fields: dict
|
||||||
|
"""
|
||||||
|
_service = "auth"
|
||||||
|
_action = "edit_user"
|
||||||
|
_version = "1.9"
|
||||||
|
|
||||||
|
_schema = {
|
||||||
|
'definitions': {},
|
||||||
|
'properties': {
|
||||||
|
'fields': {
|
||||||
|
'additionalProperties': True,
|
||||||
|
'description': 'Updated fields names and values',
|
||||||
|
'type': ['object', 'null'],
|
||||||
|
},
|
||||||
|
'updated': {
|
||||||
|
'description': 'Number of users updated (0 or 1)',
|
||||||
|
'enum': [0, 1],
|
||||||
|
'type': ['number', 'null'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'type': 'object',
|
||||||
|
}
|
||||||
|
def __init__(
|
||||||
|
self, updated=None, fields=None, **kwargs):
|
||||||
|
super(EditUserResponse, self).__init__(**kwargs)
|
||||||
|
self.updated = updated
|
||||||
|
self.fields = fields
|
||||||
|
|
||||||
|
@schema_property('updated')
|
||||||
|
def updated(self):
|
||||||
|
return self._property_updated
|
||||||
|
|
||||||
|
@updated.setter
|
||||||
|
def updated(self, value):
|
||||||
|
if value is None:
|
||||||
|
self._property_updated = None
|
||||||
|
return
|
||||||
|
|
||||||
|
self.assert_isinstance(value, "updated", six.integer_types + (float,))
|
||||||
|
self._property_updated = value
|
||||||
|
|
||||||
|
@schema_property('fields')
|
||||||
|
def fields(self):
|
||||||
|
return self._property_fields
|
||||||
|
|
||||||
|
@fields.setter
|
||||||
|
def fields(self, value):
|
||||||
|
if value is None:
|
||||||
|
self._property_fields = None
|
||||||
|
return
|
||||||
|
|
||||||
|
self.assert_isinstance(value, "fields", (dict,))
|
||||||
|
self._property_fields = value
|
||||||
|
|
||||||
|
|
||||||
|
class GetCredentialsRequest(Request):
|
||||||
|
"""
|
||||||
|
Returns all existing credential keys for the authenticated user.
|
||||||
|
Note: Only credential keys are returned.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
_service = "auth"
|
||||||
|
_action = "get_credentials"
|
||||||
|
_version = "1.5"
|
||||||
|
_schema = {
|
||||||
|
'additionalProperties': False,
|
||||||
|
'definitions': {},
|
||||||
|
'properties': {},
|
||||||
|
'type': 'object',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class GetCredentialsResponse(Response):
|
||||||
|
"""
|
||||||
|
Response of auth.get_credentials endpoint.
|
||||||
|
|
||||||
|
:param credentials: List of credentials, each with an empty secret field.
|
||||||
|
:type credentials: Sequence[CredentialKey]
|
||||||
|
"""
|
||||||
|
_service = "auth"
|
||||||
|
_action = "get_credentials"
|
||||||
|
_version = "1.5"
|
||||||
|
|
||||||
|
_schema = {
|
||||||
|
'definitions': {
|
||||||
|
'credential_key': {
|
||||||
|
'properties': {
|
||||||
|
'access_key': {'description': '', 'type': ['string', 'null']},
|
||||||
|
},
|
||||||
|
'type': 'object',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'properties': {
|
||||||
|
'credentials': {
|
||||||
|
'description': 'List of credentials, each with an empty secret field.',
|
||||||
|
'items': {'$ref': '#/definitions/credential_key'},
|
||||||
|
'type': ['array', 'null'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'type': 'object',
|
||||||
|
}
|
||||||
|
def __init__(
|
||||||
|
self, credentials=None, **kwargs):
|
||||||
|
super(GetCredentialsResponse, self).__init__(**kwargs)
|
||||||
|
self.credentials = credentials
|
||||||
|
|
||||||
|
@schema_property('credentials')
|
||||||
|
def credentials(self):
|
||||||
|
return self._property_credentials
|
||||||
|
|
||||||
|
@credentials.setter
|
||||||
|
def credentials(self, value):
|
||||||
|
if value is None:
|
||||||
|
self._property_credentials = None
|
||||||
|
return
|
||||||
|
|
||||||
|
self.assert_isinstance(value, "credentials", (list, tuple))
|
||||||
|
if any(isinstance(v, dict) for v in value):
|
||||||
|
value = [CredentialKey.from_dict(v) if isinstance(v, dict) else v for v in value]
|
||||||
|
else:
|
||||||
|
self.assert_isinstance(value, "credentials", CredentialKey, is_array=True)
|
||||||
|
self._property_credentials = value
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class LoginRequest(Request):
|
||||||
|
"""
|
||||||
|
Get a token based on supplied credentials (key/secret).
|
||||||
|
Intended for use by users with key/secret credentials that wish to obtain a token
|
||||||
|
for use with other services. Token will be limited by the same permissions that
|
||||||
|
exist for the credentials used in this call.
|
||||||
|
|
||||||
|
:param expiration_sec: Requested token expiration time in seconds. Not
|
||||||
|
guaranteed, might be overridden by the service
|
||||||
|
:type expiration_sec: int
|
||||||
|
"""
|
||||||
|
|
||||||
|
_service = "auth"
|
||||||
|
_action = "login"
|
||||||
|
_version = "1.5"
|
||||||
|
_schema = {
|
||||||
|
'definitions': {},
|
||||||
|
'properties': {
|
||||||
|
'expiration_sec': {
|
||||||
|
'description': 'Requested token expiration time in seconds. \n Not guaranteed, might be overridden by the service',
|
||||||
|
'type': ['integer', 'null'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'type': 'object',
|
||||||
|
}
|
||||||
|
def __init__(
|
||||||
|
self, expiration_sec=None, **kwargs):
|
||||||
|
super(LoginRequest, self).__init__(**kwargs)
|
||||||
|
self.expiration_sec = expiration_sec
|
||||||
|
|
||||||
|
@schema_property('expiration_sec')
|
||||||
|
def expiration_sec(self):
|
||||||
|
return self._property_expiration_sec
|
||||||
|
|
||||||
|
@expiration_sec.setter
|
||||||
|
def expiration_sec(self, value):
|
||||||
|
if value is None:
|
||||||
|
self._property_expiration_sec = None
|
||||||
|
return
|
||||||
|
if isinstance(value, float) and value.is_integer():
|
||||||
|
value = int(value)
|
||||||
|
|
||||||
|
self.assert_isinstance(value, "expiration_sec", six.integer_types)
|
||||||
|
self._property_expiration_sec = value
|
||||||
|
|
||||||
|
|
||||||
|
class LoginResponse(Response):
|
||||||
|
"""
|
||||||
|
Response of auth.login endpoint.
|
||||||
|
|
||||||
|
:param token: Token string
|
||||||
|
:type token: str
|
||||||
|
"""
|
||||||
|
_service = "auth"
|
||||||
|
_action = "login"
|
||||||
|
_version = "1.5"
|
||||||
|
|
||||||
|
_schema = {
|
||||||
|
'definitions': {},
|
||||||
|
'properties': {
|
||||||
|
'token': {'description': 'Token string', 'type': ['string', 'null']},
|
||||||
|
},
|
||||||
|
'type': 'object',
|
||||||
|
}
|
||||||
|
def __init__(
|
||||||
|
self, token=None, **kwargs):
|
||||||
|
super(LoginResponse, self).__init__(**kwargs)
|
||||||
|
self.token = token
|
||||||
|
|
||||||
|
@schema_property('token')
|
||||||
|
def token(self):
|
||||||
|
return self._property_token
|
||||||
|
|
||||||
|
@token.setter
|
||||||
|
def token(self, value):
|
||||||
|
if value is None:
|
||||||
|
self._property_token = None
|
||||||
|
return
|
||||||
|
|
||||||
|
self.assert_isinstance(value, "token", six.string_types)
|
||||||
|
self._property_token = value
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class RevokeCredentialsRequest(Request):
|
||||||
|
"""
|
||||||
|
Revokes (and deletes) a set (key, secret) of credentials for
|
||||||
|
the authenticated user.
|
||||||
|
|
||||||
|
:param access_key: Credentials key
|
||||||
|
:type access_key: str
|
||||||
|
"""
|
||||||
|
|
||||||
|
_service = "auth"
|
||||||
|
_action = "revoke_credentials"
|
||||||
|
_version = "1.5"
|
||||||
|
_schema = {
|
||||||
|
'definitions': {},
|
||||||
|
'properties': {
|
||||||
|
'access_key': {
|
||||||
|
'description': 'Credentials key',
|
||||||
|
'type': ['string', 'null'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'required': ['key_id'],
|
||||||
|
'type': 'object',
|
||||||
|
}
|
||||||
|
def __init__(
|
||||||
|
self, access_key=None, **kwargs):
|
||||||
|
super(RevokeCredentialsRequest, self).__init__(**kwargs)
|
||||||
|
self.access_key = access_key
|
||||||
|
|
||||||
|
@schema_property('access_key')
|
||||||
|
def access_key(self):
|
||||||
|
return self._property_access_key
|
||||||
|
|
||||||
|
@access_key.setter
|
||||||
|
def access_key(self, value):
|
||||||
|
if value is None:
|
||||||
|
self._property_access_key = None
|
||||||
|
return
|
||||||
|
|
||||||
|
self.assert_isinstance(value, "access_key", six.string_types)
|
||||||
|
self._property_access_key = value
|
||||||
|
|
||||||
|
|
||||||
|
class RevokeCredentialsResponse(Response):
|
||||||
|
"""
|
||||||
|
Response of auth.revoke_credentials endpoint.
|
||||||
|
|
||||||
|
:param revoked: Number of credentials revoked
|
||||||
|
:type revoked: int
|
||||||
|
"""
|
||||||
|
_service = "auth"
|
||||||
|
_action = "revoke_credentials"
|
||||||
|
_version = "1.5"
|
||||||
|
|
||||||
|
_schema = {
|
||||||
|
'definitions': {},
|
||||||
|
'properties': {
|
||||||
|
'revoked': {
|
||||||
|
'description': 'Number of credentials revoked',
|
||||||
|
'enum': [0, 1],
|
||||||
|
'type': ['integer', 'null'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'type': 'object',
|
||||||
|
}
|
||||||
|
def __init__(
|
||||||
|
self, revoked=None, **kwargs):
|
||||||
|
super(RevokeCredentialsResponse, self).__init__(**kwargs)
|
||||||
|
self.revoked = revoked
|
||||||
|
|
||||||
|
@schema_property('revoked')
|
||||||
|
def revoked(self):
|
||||||
|
return self._property_revoked
|
||||||
|
|
||||||
|
@revoked.setter
|
||||||
|
def revoked(self, value):
|
||||||
|
if value is None:
|
||||||
|
self._property_revoked = None
|
||||||
|
return
|
||||||
|
if isinstance(value, float) and value.is_integer():
|
||||||
|
value = int(value)
|
||||||
|
|
||||||
|
self.assert_isinstance(value, "revoked", six.integer_types)
|
||||||
|
self._property_revoked = value
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
response_mapping = {
|
||||||
|
LoginRequest: LoginResponse,
|
||||||
|
CreateCredentialsRequest: CreateCredentialsResponse,
|
||||||
|
GetCredentialsRequest: GetCredentialsResponse,
|
||||||
|
RevokeCredentialsRequest: RevokeCredentialsResponse,
|
||||||
|
DeleteUserRequest: DeleteUserResponse,
|
||||||
|
EditUserRequest: EditUserResponse,
|
||||||
|
}
|
2846
trains/backend_api/services/v2_2/events.py
Normal file
2846
trains/backend_api/services/v2_2/events.py
Normal file
File diff suppressed because it is too large
Load Diff
2675
trains/backend_api/services/v2_2/models.py
Normal file
2675
trains/backend_api/services/v2_2/models.py
Normal file
File diff suppressed because it is too large
Load Diff
1845
trains/backend_api/services/v2_2/projects.py
Normal file
1845
trains/backend_api/services/v2_2/projects.py
Normal file
File diff suppressed because it is too large
Load Diff
5410
trains/backend_api/services/v2_2/tasks.py
Normal file
5410
trains/backend_api/services/v2_2/tasks.py
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user