generated from forest-extension/plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
forest-extension-admin
committed
May 23, 2024
1 parent
65eaa70
commit 95982cf
Showing
2 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
from spaceone.inventory.plugin.collector.lib.server import CollectorPluginServer | ||
|
||
app = CollectorPluginServer() | ||
|
||
|
||
@app.route('Collector.init') | ||
def collector_init(params: dict) -> dict: | ||
""" init plugin by options | ||
Args: | ||
params (CollectorInitRequest): { | ||
'options': 'dict', # Required | ||
'domain_id': 'str' | ||
} | ||
Returns: | ||
PluginResponse: { | ||
'metadata': 'dict' | ||
} | ||
""" | ||
pass | ||
|
||
|
||
@app.route('Collector.verify') | ||
def collector_verify(params: dict) -> None: | ||
""" Verifying collector plugin | ||
Args: | ||
params (CollectorVerifyRequest): { | ||
'options': 'dict', # Required | ||
'secret_data': 'dict', # Required | ||
'schema': 'str', | ||
'domain_id': 'str' | ||
} | ||
Returns: | ||
None | ||
""" | ||
pass | ||
|
||
|
||
@app.route('Collector.collect') | ||
def collector_collect(params: dict) -> dict: | ||
""" Collect external data | ||
Args: | ||
params (CollectorCollectRequest): { | ||
'options': 'dict', # Required | ||
'secret_data': 'dict', # Required | ||
'schema': 'str', | ||
'task_options': 'dict', | ||
'domain_id': 'str' | ||
} | ||
Returns: | ||
Generator[ResourceResponse, None, None] | ||
{ | ||
'state': 'SUCCESS | FAILURE', | ||
'resource_type': 'inventory.CloudService | inventory.CloudServiceType | inventory.Region', | ||
'cloud_service_type': CloudServiceType, | ||
'cloud_service': CloudService, | ||
'region': Region, | ||
'match_keys': 'list', | ||
'error_message': 'str' | ||
'metadata': 'dict' | ||
} | ||
CloudServiceType | ||
{ | ||
'name': 'str', # Required | ||
'group': 'str', # Required | ||
'provider': 'str', # Required | ||
'is_primary': 'bool', | ||
'is_major': 'bool', | ||
'metadata': 'dict', # Required | ||
'service_code': 'str', | ||
'tags': 'dict' | ||
'labels': 'list' | ||
} | ||
CloudService | ||
{ | ||
'name': 'str', | ||
'cloud_service_type': 'str', # Required | ||
'cloud_service_group': 'str', # Required | ||
'provider': 'str', # Required | ||
'ip_addresses' : 'list', | ||
'account' : 'str', | ||
'instance_type': 'str', | ||
'instance_size': 'float', | ||
'region_code': 'str', | ||
'data': 'dict' # Required | ||
'metadata': 'dict' # Required | ||
'reference': 'dict' | ||
'tags' : 'dict' | ||
} | ||
Region | ||
{ | ||
'name': 'str', | ||
'region_code': 'str', # Required | ||
'provider': 'str', # Required | ||
'tags': 'dict' | ||
} | ||
Only one of the cloud_service_type, cloud_service and region fields is required. | ||
""" | ||
pass | ||
|
||
|
||
@app.route('Job.get_tasks') | ||
def job_get_tasks(params: dict) -> dict: | ||
""" Get job tasks | ||
Args: | ||
params (JobGetTaskRequest): { | ||
'options': 'dict', # Required | ||
'secret_data': 'dict', # Required | ||
'domain_id': 'str' | ||
} | ||
Returns: | ||
TasksResponse: { | ||
'tasks': 'list' | ||
} | ||
""" | ||
pass |