huaweicloud-sdk-python-v3/huaweicloud-sdk-cgs/huaweicloudsdkcgs/v5/cgs_client.py

125 lines
4.6 KiB
Python
Raw Normal View History

2021-12-10 10:12:27 +00:00
# coding: utf-8
from __future__ import absolute_import
import importlib
from huaweicloudsdkcore.client import Client, ClientBuilder
from huaweicloudsdkcore.utils import http_utils
from huaweicloudsdkcore.sdk_stream_request import SdkStreamRequest
class CgsClient(Client):
def __init__(self):
super(CgsClient, self).__init__()
self.model_package = importlib.import_module("huaweicloudsdkcgs.v5.model")
@classmethod
def new_builder(cls, clazz=None):
if clazz is None:
return ClientBuilder(cls)
if clazz.__name__ != "CgsClient":
raise TypeError("client type error, support client type is CgsClient")
return ClientBuilder(clazz)
def list_container_nodes(self, request):
"""查询容器节点列表
2021-12-25 10:51:01 +00:00
查询容器节点列表仅新版本容器安全支持即将上线敬请期待
2022-04-21 12:03:46 +00:00
2022-11-30 08:59:35 +00:00
Please refer to HUAWEI cloud API Explorer for details.
2021-12-10 10:12:27 +00:00
2022-04-21 12:03:46 +00:00
:param request: Request instance for ListContainerNodes
:type request: :class:`huaweicloudsdkcgs.v5.ListContainerNodesRequest`
:rtype: :class:`huaweicloudsdkcgs.v5.ListContainerNodesResponse`
2021-12-10 10:12:27 +00:00
"""
2023-05-11 09:07:48 +00:00
return self._list_container_nodes_with_http_info(request)
def _list_container_nodes_with_http_info(self, request):
local_var_params = {attr: getattr(request, attr) for attr in request.attribute_map if hasattr(request, attr)}
2021-12-10 10:12:27 +00:00
2022-11-17 12:13:53 +00:00
cname = None
2021-12-10 10:12:27 +00:00
collection_formats = {}
path_params = {}
query_params = []
if 'host_name' in local_var_params:
query_params.append(('host_name', local_var_params['host_name']))
if 'agent_status' in local_var_params:
query_params.append(('agent_status', local_var_params['agent_status']))
if 'limit' in local_var_params:
query_params.append(('limit', local_var_params['limit']))
if 'offset' in local_var_params:
query_params.append(('offset', local_var_params['offset']))
header_params = {}
form_params = {}
body_params = None
if isinstance(request, SdkStreamRequest):
body_params = request.get_file_stream()
response_headers = []
header_params['Content-Type'] = http_utils.select_header_content_type(
['application/json'])
auth_settings = []
return self.call_api(
resource_path='/v5/{project_id}/container/nodes',
method='GET',
path_params=path_params,
query_params=query_params,
header_params=header_params,
body=body_params,
post_params=form_params,
2022-11-17 12:13:53 +00:00
cname=cname,
2021-12-10 10:12:27 +00:00
response_type='ListContainerNodesResponse',
response_headers=response_headers,
auth_settings=auth_settings,
collection_formats=collection_formats,
request_type=request.__class__.__name__)
def call_api(self, resource_path, method, path_params=None, query_params=None, header_params=None, body=None,
2022-11-17 12:13:53 +00:00
post_params=None, cname=None, response_type=None, response_headers=None, auth_settings=None,
2021-12-10 10:12:27 +00:00
collection_formats=None, request_type=None):
"""Makes the HTTP request and returns deserialized data.
:param resource_path: Path to method endpoint.
:param method: Method to call.
:param path_params: Path parameters in the url.
:param query_params: Query parameters in the url.
:param header_params: Header parameters to be placed in the request header.
:param body: Request body.
2022-11-17 12:13:53 +00:00
:param post_params: Request post form parameters,
2021-12-10 10:12:27 +00:00
for `application/x-www-form-urlencoded`, `multipart/form-data`.
2022-11-17 12:13:53 +00:00
:param cname: Used for obs endpoint.
:param auth_settings: Auth Settings names for the request.
2021-12-10 10:12:27 +00:00
:param response_type: Response data type.
:param response_headers: Header should be added to response data.
:param collection_formats: dict of collection formats for path, query,
header, and post parameters.
:param request_type: Request data type.
:return:
Return the response directly.
"""
return self.do_http_request(
method=method,
resource_path=resource_path,
path_params=path_params,
query_params=query_params,
header_params=header_params,
body=body,
post_params=post_params,
2022-11-17 12:13:53 +00:00
cname=cname,
2021-12-10 10:12:27 +00:00
response_type=response_type,
response_headers=response_headers,
collection_formats=collection_formats,
request_type=request_type)