cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
projects_api.py
Go to the documentation of this file.
1 # coding: utf-8
2 
3 """
4  cloudFPGA Resource Manager API
5 
6  No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
7 
8  OpenAPI spec version: 0.8
9 
10  Generated by: https://github.com/swagger-api/swagger-codegen.git
11 """
12 
13 from __future__ import absolute_import
14 
15 import re # noqa: F401
16 
17 # python 2 and python 3 compatibility library
18 import six
19 
20 from swagger_client.api_client import ApiClient
21 
22 
23 class ProjectsApi(object):
24  """NOTE: This class is auto generated by the swagger code generator program.
25 
26  Do not edit the class manually.
27  Ref: https://github.com/swagger-api/swagger-codegen
28  """
29 
30  def __init__(self, api_client=None):
31  if api_client is None:
32  api_client = ApiClient()
33  self.api_clientapi_client = api_client
34 
35  def cf_manager_rest_api_get_project_quota(self, username, password, project_name, **kwargs): # noqa: E501
36  """Get the current quota of a project # noqa: E501
37 
38  With this call a user can check how many FPGAs of his project are available for usage. # noqa: E501
39  This method makes a synchronous HTTP request by default. To make an
40  asynchronous HTTP request, please pass async_req=True
41  >>> thread = api.cf_manager_rest_api_get_project_quota(username, password, project_name, async_req=True)
42  >>> result = thread.get()
43 
44  :param async_req bool
45  :param str username: OpenStack username (required)
46  :param str password: OpenStack password (required)
47  :param str project_name: Name of a OpenStack project (required)
48  :return: Quota
49  If the method is called asynchronously,
50  returns the request thread.
51  """
52  kwargs['_return_http_data_only'] = True
53  if kwargs.get('async_req'):
54  return self.cf_manager_rest_api_get_project_quota_with_http_infocf_manager_rest_api_get_project_quota_with_http_info(username, password, project_name, **kwargs) # noqa: E501
55  else:
56  (data) = self.cf_manager_rest_api_get_project_quota_with_http_infocf_manager_rest_api_get_project_quota_with_http_info(username, password, project_name, **kwargs) # noqa: E501
57  return data
58 
59  def cf_manager_rest_api_get_project_quota_with_http_info(self, username, password, project_name, **kwargs): # noqa: E501
60  """Get the current quota of a project # noqa: E501
61 
62  With this call a user can check how many FPGAs of his project are available for usage. # noqa: E501
63  This method makes a synchronous HTTP request by default. To make an
64  asynchronous HTTP request, please pass async_req=True
65  >>> thread = api.cf_manager_rest_api_get_project_quota_with_http_info(username, password, project_name, async_req=True)
66  >>> result = thread.get()
67 
68  :param async_req bool
69  :param str username: OpenStack username (required)
70  :param str password: OpenStack password (required)
71  :param str project_name: Name of a OpenStack project (required)
72  :return: Quota
73  If the method is called asynchronously,
74  returns the request thread.
75  """
76 
77  all_params = ['username', 'password', 'project_name'] # noqa: E501
78  all_params.append('async_req')
79  all_params.append('_return_http_data_only')
80  all_params.append('_preload_content')
81  all_params.append('_request_timeout')
82 
83  params = locals()
84  for key, val in six.iteritems(params['kwargs']):
85  if key not in all_params:
86  raise TypeError(
87  "Got an unexpected keyword argument '%s'"
88  " to method cf_manager_rest_api_get_project_quota" % key
89  )
90  params[key] = val
91  del params['kwargs']
92  # verify the required parameter 'username' is set
93  if ('username' not in params or
94  params['username'] is None):
95  raise ValueError("Missing the required parameter `username` when calling `cf_manager_rest_api_get_project_quota`") # noqa: E501
96  # verify the required parameter 'password' is set
97  if ('password' not in params or
98  params['password'] is None):
99  raise ValueError("Missing the required parameter `password` when calling `cf_manager_rest_api_get_project_quota`") # noqa: E501
100  # verify the required parameter 'project_name' is set
101  if ('project_name' not in params or
102  params['project_name'] is None):
103  raise ValueError("Missing the required parameter `project_name` when calling `cf_manager_rest_api_get_project_quota`") # noqa: E501
104 
105  collection_formats = {}
106 
107  path_params = {}
108  if 'project_name' in params:
109  path_params['project_name'] = params['project_name'] # noqa: E501
110 
111  query_params = []
112  if 'username' in params:
113  query_params.append(('username', params['username'])) # noqa: E501
114  if 'password' in params:
115  query_params.append(('password', params['password'])) # noqa: E501
116 
117  header_params = {}
118 
119  form_params = []
120  local_var_files = {}
121 
122  body_params = None
123  # HTTP header `Accept`
124  header_params['Accept'] = self.api_clientapi_client.select_header_accept(
125  ['application/json']) # noqa: E501
126 
127  # Authentication setting
128  auth_settings = [] # noqa: E501
129 
130  return self.api_clientapi_client.call_api(
131  '/projects/{project_name}/quota/', 'GET',
132  path_params,
133  query_params,
134  header_params,
135  body=body_params,
136  post_params=form_params,
137  files=local_var_files,
138  response_type='Quota', # noqa: E501
139  auth_settings=auth_settings,
140  async_req=params.get('async_req'),
141  _return_http_data_only=params.get('_return_http_data_only'),
142  _preload_content=params.get('_preload_content', True),
143  _request_timeout=params.get('_request_timeout'),
144  collection_formats=collection_formats)
145 
146  def cf_manager_rest_api_list_projects(self, username, password, **kwargs): # noqa: E501
147  """List the projects the user belongs to # noqa: E501
148 
149  This method makes a synchronous HTTP request by default. To make an
150  asynchronous HTTP request, please pass async_req=True
151  >>> thread = api.cf_manager_rest_api_list_projects(username, password, async_req=True)
152  >>> result = thread.get()
153 
154  :param async_req bool
155  :param str username: OpenStack username (required)
156  :param str password: OpenStack password (required)
157  :return: list[str]
158  If the method is called asynchronously,
159  returns the request thread.
160  """
161  kwargs['_return_http_data_only'] = True
162  if kwargs.get('async_req'):
163  return self.cf_manager_rest_api_list_projects_with_http_infocf_manager_rest_api_list_projects_with_http_info(username, password, **kwargs) # noqa: E501
164  else:
165  (data) = self.cf_manager_rest_api_list_projects_with_http_infocf_manager_rest_api_list_projects_with_http_info(username, password, **kwargs) # noqa: E501
166  return data
167 
168  def cf_manager_rest_api_list_projects_with_http_info(self, username, password, **kwargs): # noqa: E501
169  """List the projects the user belongs to # noqa: E501
170 
171  This method makes a synchronous HTTP request by default. To make an
172  asynchronous HTTP request, please pass async_req=True
173  >>> thread = api.cf_manager_rest_api_list_projects_with_http_info(username, password, async_req=True)
174  >>> result = thread.get()
175 
176  :param async_req bool
177  :param str username: OpenStack username (required)
178  :param str password: OpenStack password (required)
179  :return: list[str]
180  If the method is called asynchronously,
181  returns the request thread.
182  """
183 
184  all_params = ['username', 'password'] # noqa: E501
185  all_params.append('async_req')
186  all_params.append('_return_http_data_only')
187  all_params.append('_preload_content')
188  all_params.append('_request_timeout')
189 
190  params = locals()
191  for key, val in six.iteritems(params['kwargs']):
192  if key not in all_params:
193  raise TypeError(
194  "Got an unexpected keyword argument '%s'"
195  " to method cf_manager_rest_api_list_projects" % key
196  )
197  params[key] = val
198  del params['kwargs']
199  # verify the required parameter 'username' is set
200  if ('username' not in params or
201  params['username'] is None):
202  raise ValueError("Missing the required parameter `username` when calling `cf_manager_rest_api_list_projects`") # noqa: E501
203  # verify the required parameter 'password' is set
204  if ('password' not in params or
205  params['password'] is None):
206  raise ValueError("Missing the required parameter `password` when calling `cf_manager_rest_api_list_projects`") # noqa: E501
207 
208  collection_formats = {}
209 
210  path_params = {}
211 
212  query_params = []
213  if 'username' in params:
214  query_params.append(('username', params['username'])) # noqa: E501
215  if 'password' in params:
216  query_params.append(('password', params['password'])) # noqa: E501
217 
218  header_params = {}
219 
220  form_params = []
221  local_var_files = {}
222 
223  body_params = None
224  # HTTP header `Accept`
225  header_params['Accept'] = self.api_clientapi_client.select_header_accept(
226  ['application/json']) # noqa: E501
227 
228  # Authentication setting
229  auth_settings = [] # noqa: E501
230 
231  return self.api_clientapi_client.call_api(
232  '/projects/', 'GET',
233  path_params,
234  query_params,
235  header_params,
236  body=body_params,
237  post_params=form_params,
238  files=local_var_files,
239  response_type='list[str]', # noqa: E501
240  auth_settings=auth_settings,
241  async_req=params.get('async_req'),
242  _return_http_data_only=params.get('_return_http_data_only'),
243  _preload_content=params.get('_preload_content', True),
244  _request_timeout=params.get('_request_timeout'),
245  collection_formats=collection_formats)
246 
247  def cf_manager_rest_api_post_project_quota(self, username, password, project_name, **kwargs): # noqa: E501
248  """Post a new (or update existent) quota of a project (admin only) # noqa: E501
249 
250  This method makes a synchronous HTTP request by default. To make an
251  asynchronous HTTP request, please pass async_req=True
252  >>> thread = api.cf_manager_rest_api_post_project_quota(username, password, project_name, async_req=True)
253  >>> result = thread.get()
254 
255  :param async_req bool
256  :param str username: OpenStack username (required)
257  :param str password: OpenStack password (required)
258  :param str project_name: Name of a OpenStack project (required)
259  :param Quota body:
260  :return: None
261  If the method is called asynchronously,
262  returns the request thread.
263  """
264  kwargs['_return_http_data_only'] = True
265  if kwargs.get('async_req'):
266  return self.cf_manager_rest_api_post_project_quota_with_http_infocf_manager_rest_api_post_project_quota_with_http_info(username, password, project_name, **kwargs) # noqa: E501
267  else:
268  (data) = self.cf_manager_rest_api_post_project_quota_with_http_infocf_manager_rest_api_post_project_quota_with_http_info(username, password, project_name, **kwargs) # noqa: E501
269  return data
270 
271  def cf_manager_rest_api_post_project_quota_with_http_info(self, username, password, project_name, **kwargs): # noqa: E501
272  """Post a new (or update existent) quota of a project (admin only) # noqa: E501
273 
274  This method makes a synchronous HTTP request by default. To make an
275  asynchronous HTTP request, please pass async_req=True
276  >>> thread = api.cf_manager_rest_api_post_project_quota_with_http_info(username, password, project_name, async_req=True)
277  >>> result = thread.get()
278 
279  :param async_req bool
280  :param str username: OpenStack username (required)
281  :param str password: OpenStack password (required)
282  :param str project_name: Name of a OpenStack project (required)
283  :param Quota body:
284  :return: None
285  If the method is called asynchronously,
286  returns the request thread.
287  """
288 
289  all_params = ['username', 'password', 'project_name', 'body'] # noqa: E501
290  all_params.append('async_req')
291  all_params.append('_return_http_data_only')
292  all_params.append('_preload_content')
293  all_params.append('_request_timeout')
294 
295  params = locals()
296  for key, val in six.iteritems(params['kwargs']):
297  if key not in all_params:
298  raise TypeError(
299  "Got an unexpected keyword argument '%s'"
300  " to method cf_manager_rest_api_post_project_quota" % key
301  )
302  params[key] = val
303  del params['kwargs']
304  # verify the required parameter 'username' is set
305  if ('username' not in params or
306  params['username'] is None):
307  raise ValueError("Missing the required parameter `username` when calling `cf_manager_rest_api_post_project_quota`") # noqa: E501
308  # verify the required parameter 'password' is set
309  if ('password' not in params or
310  params['password'] is None):
311  raise ValueError("Missing the required parameter `password` when calling `cf_manager_rest_api_post_project_quota`") # noqa: E501
312  # verify the required parameter 'project_name' is set
313  if ('project_name' not in params or
314  params['project_name'] is None):
315  raise ValueError("Missing the required parameter `project_name` when calling `cf_manager_rest_api_post_project_quota`") # noqa: E501
316 
317  collection_formats = {}
318 
319  path_params = {}
320  if 'project_name' in params:
321  path_params['project_name'] = params['project_name'] # noqa: E501
322 
323  query_params = []
324  if 'username' in params:
325  query_params.append(('username', params['username'])) # noqa: E501
326  if 'password' in params:
327  query_params.append(('password', params['password'])) # noqa: E501
328 
329  header_params = {}
330 
331  form_params = []
332  local_var_files = {}
333 
334  body_params = None
335  if 'body' in params:
336  body_params = params['body']
337  # HTTP header `Content-Type`
338  header_params['Content-Type'] = self.api_clientapi_client.select_header_content_type( # noqa: E501
339  ['application/json']) # noqa: E501
340 
341  # Authentication setting
342  auth_settings = [] # noqa: E501
343 
344  return self.api_clientapi_client.call_api(
345  '/projects/{project_name}/quota/', 'POST',
346  path_params,
347  query_params,
348  header_params,
349  body=body_params,
350  post_params=form_params,
351  files=local_var_files,
352  response_type=None, # noqa: E501
353  auth_settings=auth_settings,
354  async_req=params.get('async_req'),
355  _return_http_data_only=params.get('_return_http_data_only'),
356  _preload_content=params.get('_preload_content', True),
357  _request_timeout=params.get('_request_timeout'),
358  collection_formats=collection_formats)
def cf_manager_rest_api_get_project_quota_with_http_info(self, username, password, project_name, **kwargs)
Definition: projects_api.py:59
def cf_manager_rest_api_post_project_quota(self, username, password, project_name, **kwargs)
def cf_manager_rest_api_post_project_quota_with_http_info(self, username, password, project_name, **kwargs)
def cf_manager_rest_api_get_project_quota(self, username, password, project_name, **kwargs)
Definition: projects_api.py:35
def cf_manager_rest_api_list_projects_with_http_info(self, username, password, **kwargs)
def cf_manager_rest_api_list_projects(self, username, password, **kwargs)