Implement functionality of the API method cloudapi/account/listVins in decort_account_info module
This commit is contained in:
@@ -34,6 +34,7 @@ class DecortAccountInfo(DecortController):
|
||||
computes_params=self.mapped_computes_params,
|
||||
resource_consumption=amodule.params['resource_consumption'],
|
||||
resource_groups_params=self.mapped_rg_params,
|
||||
vinses_params=self.mapped_vinses_params,
|
||||
fail_if_not_found=True
|
||||
)
|
||||
|
||||
@@ -199,6 +200,56 @@ class DecortAccountInfo(DecortController):
|
||||
type='bool',
|
||||
default=True
|
||||
),
|
||||
vinses=dict(
|
||||
type='dict',
|
||||
options=dict(
|
||||
filter=dict(
|
||||
type='dict',
|
||||
options=dict(
|
||||
ext_ip=dict(
|
||||
type='int',
|
||||
),
|
||||
id=dict(
|
||||
type='int',
|
||||
),
|
||||
name=dict(
|
||||
type='str'
|
||||
),
|
||||
rg_id=dict(
|
||||
type='int',
|
||||
),
|
||||
),
|
||||
),
|
||||
pagination=dict(
|
||||
type='dict',
|
||||
options=dict(
|
||||
number=dict(
|
||||
type='int',
|
||||
default=1,
|
||||
),
|
||||
size=dict(
|
||||
type='int',
|
||||
required=True,
|
||||
),
|
||||
),
|
||||
),
|
||||
sorting=dict(
|
||||
type='dict',
|
||||
options=dict(
|
||||
asc=dict(
|
||||
type='bool',
|
||||
default=True,
|
||||
),
|
||||
field=dict(
|
||||
type='str',
|
||||
choices=\
|
||||
self.FIELDS_FOR_SORTING_ACCOUNT_VINS_LIST,
|
||||
required=True,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
mutually_exclusive=[
|
||||
('id', 'name')
|
||||
@@ -275,6 +326,31 @@ class DecortAccountInfo(DecortController):
|
||||
|
||||
return mapped_params
|
||||
|
||||
@property
|
||||
def mapped_vinses_params(self) -> None | dict:
|
||||
input_params = self.amodule.params['vinses']
|
||||
if not input_params:
|
||||
return input_params
|
||||
|
||||
mapped_params = {}
|
||||
if input_params['filter']:
|
||||
mapped_params['vins_id'] = input_params['filter']['id']
|
||||
mapped_params['vins_name'] = input_params['filter']['name']
|
||||
mapped_params['ext_ip'] = input_params['filter']['ext_ip']
|
||||
mapped_params['rg_id'] = input_params['filter']['rg_id']
|
||||
if input_params['pagination']:
|
||||
mapped_params['page_number'] =\
|
||||
input_params['pagination']['number']
|
||||
mapped_params['page_size'] =\
|
||||
input_params['pagination']['size']
|
||||
if input_params['sorting']:
|
||||
mapped_params['sort_by_asc'] =\
|
||||
input_params['sorting']['asc']
|
||||
mapped_params['sort_by_field'] =\
|
||||
input_params['sorting']['field']
|
||||
|
||||
return mapped_params
|
||||
|
||||
def exit(self):
|
||||
self.result['facts'] = self.facts
|
||||
self.amodule.exit_json(**self.result)
|
||||
|
||||
Reference in New Issue
Block a user