or cfg.cipd.default_server) properties.cipd_input.client_package = ( properties.cipd_input.client_package or task_request.CipdPackage()) properties.cipd_input.client_package.package_name = ( properties.cipd_input.client_package.package_name or cfg.cipd.default_client_package.package_name) properties.cipd_input.client_package.version = ( properties.cipd_input.client_package.version or cfg.cipd.default_client_package.version) ### API swarming_api = auth.endpoints_api( name='swarming', version='v1', description='API to interact with the Swarming service. Permits to create, ' 'view and cancel tasks, query tasks and bots') @swarming_api.api_class(resource_name='server', path='server') class SwarmingServerService(remote.Service): @gae_ts_mon.instrument_endpoint() @auth.endpoints_method(message_types.VoidMessage, swarming_rpcs.ServerDetails, http_method='GET') @auth.require(acl.can_access) def details(self, _request): """Returns information about the server.""" host = 'https://' + os.environ['HTTP_HOST']
raise endpoints.NotFoundException('%s not found.' % key.id()) return result def get_result_entity(task_id): """Returns the entity (TaskResultSummary or TaskRunResult) for a given ID.""" key, _ = get_result_key(task_id) return get_or_raise(key) ### API swarming_api = auth.endpoints_api( name='swarming', version='v1', description= 'API to interact with the Swarming service. Permits to create, ' 'view and cancel tasks, query tasks and bots') VersionRequest = endpoints.ResourceContainer( message_types.VoidMessage, version=messages.IntegerField(1)) @swarming_api.api_class(resource_name='server', path='server') class SwarmingServerService(remote.Service): @auth.endpoints_method( message_types.VoidMessage, swarming_rpcs.ServerDetails, http_method='GET') @auth.require(acl.is_bot_or_user)
data = request_dict['properties'].pop('data', None) if data is not None: request_dict['properties']['data'] = [[pair['key'], pair['value']] for pair in data] for key in ['dimensions', 'env']: old_list = request_dict['properties'].get(key, []) request_dict['properties'][key] = { pair['key']: pair['value'] for pair in old_list } request_dict['properties'].setdefault('data', []) ### API swarming_api = auth.endpoints_api(name='swarming', version='v1') @swarming_api.api_class(resource_name='tasks', path='tasks') class SwarmingTaskService(remote.Service): """Swarming's task-related API.""" ### API Methods @auth.endpoints_method(message_types.VoidMessage, swarming_rpcs.ServerDetails) @auth.require(acl.is_bot_or_user) def server_details(self, _request): """Returns information about the server.""" return swarming_rpcs.ServerDetails( server_version=utils.get_app_version())
request_dict['properties'][key] = { pair['key']: pair['value'] for pair in old_list} request_dict['properties'].setdefault('data', []) request_dict['tags'] = request_dict.pop('tag', []) def _get_range(request): """Get (start, end) as keys from request types that specify date ranges.""" end = request.end or utils.utcnow() return (request.start or end - datetime.timedelta(days=1), end) ### API swarming_api = auth.endpoints_api(name='swarming', version='v1') @swarming_api.api_class(resource_name='tasks', path='tasks') class SwarmingTaskService(remote.Service): """Swarming's task-related API.""" ### API Methods @auth.endpoints_method(message_types.VoidMessage, swarming_rpcs.ServerDetails) @auth.require(acl.is_bot_or_user) def server_details(self, _request): """Returns information about the server.""" return swarming_rpcs.ServerDetails(server_version=utils.get_app_version()) @auth.endpoints_method(swarming_rpcs.TaskId, swarming_rpcs.TaskResultSummary)