huaweicloudsdkmas 3.1.160__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
@@ -0,0 +1,15 @@
1
+ # coding: utf-8
2
+
3
+ from __future__ import absolute_import
4
+
5
+ from huaweicloudsdkmas.v1.mas_client import MasClient
6
+ from huaweicloudsdkmas.v1.mas_async_client import MasAsyncClient
7
+
8
+ from huaweicloudsdkmas.v1.model.base_multi_active_zone_spec import BaseMultiActiveZoneSpec
9
+ from huaweicloudsdkmas.v1.model.data_sync_statistics import DataSyncStatistics
10
+ from huaweicloudsdkmas.v1.model.datasource_statistics import DatasourceStatistics
11
+ from huaweicloudsdkmas.v1.model.multi_active_zone_vo import MultiActiveZoneVo
12
+ from huaweicloudsdkmas.v1.model.namespace_vo import NamespaceVo
13
+ from huaweicloudsdkmas.v1.model.show_name_space_list_request import ShowNameSpaceListRequest
14
+ from huaweicloudsdkmas.v1.model.show_name_space_list_response import ShowNameSpaceListResponse
15
+
@@ -0,0 +1,157 @@
1
+ # coding: utf-8
2
+
3
+ from __future__ import absolute_import
4
+
5
+ import importlib
6
+ import warnings
7
+
8
+ from huaweicloudsdkcore.client import Client, ClientBuilder
9
+ from huaweicloudsdkcore.utils import http_utils
10
+ from huaweicloudsdkcore.sdk_stream_request import SdkStreamRequest
11
+
12
+ try:
13
+ from huaweicloudsdkcore.invoker.invoker import AsyncInvoker
14
+ except ImportError as e:
15
+ warnings.warn(str(e) + ", please check if you are using the same versions of 'huaweicloudsdkcore' and 'huaweicloudsdkmas'")
16
+
17
+
18
+ class MasAsyncClient(Client):
19
+ def __init__(self):
20
+ super(MasAsyncClient, self).__init__()
21
+ self.model_package = importlib.import_module("huaweicloudsdkmas.v1.model")
22
+
23
+ @classmethod
24
+ def new_builder(cls, clazz=None):
25
+ if not clazz:
26
+ client_builder = ClientBuilder(cls)
27
+ else:
28
+ if clazz.__name__ != "MasAsyncClient":
29
+ raise TypeError("client type error, support client type is MasAsyncClient")
30
+ client_builder = ClientBuilder(clazz)
31
+
32
+
33
+
34
+ return client_builder
35
+
36
+ def show_name_space_list_async(self, request):
37
+ r"""查询命名空间列表
38
+
39
+
40
+ Please refer to HUAWEI cloud API Explorer for details.
41
+
42
+
43
+ :param request: Request instance for ShowNameSpaceList
44
+ :type request: :class:`huaweicloudsdkmas.v1.ShowNameSpaceListRequest`
45
+ :rtype: :class:`huaweicloudsdkmas.v1.ShowNameSpaceListResponse`
46
+ """
47
+ http_info = self._show_name_space_list_http_info(request)
48
+ return self._call_api(**http_info)
49
+
50
+ def show_name_space_list_async_invoker(self, request):
51
+ http_info = self._show_name_space_list_http_info(request)
52
+ return AsyncInvoker(self, http_info)
53
+
54
+ def _show_name_space_list_http_info(self, request):
55
+ http_info = {
56
+ "method": "GET",
57
+ "resource_path": "/v1/{project_id}/namespaces",
58
+ "request_type": request.__class__.__name__,
59
+ "response_type": "ShowNameSpaceListResponse"
60
+ }
61
+
62
+ local_var_params = {attr: getattr(request, attr) for attr in request.attribute_map if hasattr(request, attr)}
63
+
64
+ cname = None
65
+
66
+ collection_formats = {}
67
+
68
+ path_params = {}
69
+
70
+ query_params = []
71
+ if 'offset' in local_var_params:
72
+ query_params.append(('offset', local_var_params['offset']))
73
+ if 'limit' in local_var_params:
74
+ query_params.append(('limit', local_var_params['limit']))
75
+ if 'name' in local_var_params:
76
+ query_params.append(('name', local_var_params['name']))
77
+ if 'type' in local_var_params:
78
+ query_params.append(('type', local_var_params['type']))
79
+ if 'is_used' in local_var_params:
80
+ query_params.append(('is_used', local_var_params['is_used']))
81
+ if 'enterprise_project_id' in local_var_params:
82
+ query_params.append(('enterprise_project_id', local_var_params['enterprise_project_id']))
83
+
84
+ header_params = {}
85
+
86
+ form_params = {}
87
+
88
+ body = None
89
+ if isinstance(request, SdkStreamRequest):
90
+ body = request.get_file_stream()
91
+
92
+ response_headers = []
93
+
94
+ header_params['Content-Type'] = http_utils.select_header_content_type(
95
+ ['application/json'])
96
+
97
+ auth_settings = []
98
+
99
+ http_info["cname"] = cname
100
+ http_info["collection_formats"] = collection_formats
101
+ http_info["path_params"] = path_params
102
+ http_info["query_params"] = query_params
103
+ http_info["header_params"] = header_params
104
+ http_info["post_params"] = form_params
105
+ http_info["body"] = body
106
+ http_info["response_headers"] = response_headers
107
+
108
+ return http_info
109
+
110
+ def _call_api(self, **kwargs):
111
+ try:
112
+ kwargs["async_request"] = True
113
+ return self.do_http_request(**kwargs)
114
+ except TypeError:
115
+ import inspect
116
+ params = inspect.signature(self.do_http_request).parameters
117
+ http_info = {param_name: kwargs.get(param_name) for param_name in params if param_name in kwargs}
118
+ return self.do_http_request(**http_info)
119
+
120
+ def call_api(self, resource_path, method, path_params=None, query_params=None, header_params=None, body=None,
121
+ post_params=None, cname=None, response_type=None, response_headers=None, auth_settings=None,
122
+ collection_formats=None, request_type=None):
123
+ """Makes the HTTP request and returns deserialized data.
124
+
125
+ :param resource_path: Path to method endpoint.
126
+ :param method: Method to call.
127
+ :param path_params: Path parameters in the url.
128
+ :param query_params: Query parameters in the url.
129
+ :param header_params: Header parameters to be
130
+ placed in the request header.
131
+ :param body: Request body.
132
+ :param post_params: Request post form parameters,
133
+ for `application/x-www-form-urlencoded`, `multipart/form-data`.
134
+ :param cname: Used for obs endpoint.
135
+ :param auth_settings: Auth Settings names for the request.
136
+ :param response_type: Response data type.
137
+ :param response_headers: Header should be added to response data.
138
+ :param collection_formats: dict of collection formats for path, query,
139
+ header, and post parameters.
140
+ :param request_type: Request data type.
141
+ :return:
142
+ Return the response directly.
143
+ """
144
+ return self.do_http_request(
145
+ method=method,
146
+ resource_path=resource_path,
147
+ path_params=path_params,
148
+ query_params=query_params,
149
+ header_params=header_params,
150
+ body=body,
151
+ post_params=post_params,
152
+ cname=cname,
153
+ response_type=response_type,
154
+ response_headers=response_headers,
155
+ collection_formats=collection_formats,
156
+ request_type=request_type,
157
+ async_request=True)
@@ -0,0 +1,154 @@
1
+ # coding: utf-8
2
+
3
+ from __future__ import absolute_import
4
+
5
+ import importlib
6
+ import warnings
7
+
8
+ from huaweicloudsdkcore.client import Client, ClientBuilder
9
+ from huaweicloudsdkcore.utils import http_utils
10
+ from huaweicloudsdkcore.sdk_stream_request import SdkStreamRequest
11
+
12
+ try:
13
+ from huaweicloudsdkcore.invoker.invoker import SyncInvoker
14
+ except ImportError as e:
15
+ warnings.warn(str(e) + ", please check if you are using the same versions of 'huaweicloudsdkcore' and 'huaweicloudsdkmas'")
16
+
17
+
18
+ class MasClient(Client):
19
+ def __init__(self):
20
+ super(MasClient, self).__init__()
21
+ self.model_package = importlib.import_module("huaweicloudsdkmas.v1.model")
22
+
23
+ @classmethod
24
+ def new_builder(cls, clazz=None):
25
+ if not clazz:
26
+ client_builder = ClientBuilder(cls)
27
+ else:
28
+ if clazz.__name__ != "MasClient":
29
+ raise TypeError("client type error, support client type is MasClient")
30
+ client_builder = ClientBuilder(clazz)
31
+
32
+
33
+
34
+ return client_builder
35
+
36
+ def show_name_space_list(self, request):
37
+ r"""查询命名空间列表
38
+
39
+
40
+ Please refer to HUAWEI cloud API Explorer for details.
41
+
42
+ :param request: Request instance for ShowNameSpaceList
43
+ :type request: :class:`huaweicloudsdkmas.v1.ShowNameSpaceListRequest`
44
+ :rtype: :class:`huaweicloudsdkmas.v1.ShowNameSpaceListResponse`
45
+ """
46
+ http_info = self._show_name_space_list_http_info(request)
47
+ return self._call_api(**http_info)
48
+
49
+ def show_name_space_list_invoker(self, request):
50
+ http_info = self._show_name_space_list_http_info(request)
51
+ return SyncInvoker(self, http_info)
52
+
53
+ @classmethod
54
+ def _show_name_space_list_http_info(cls, request):
55
+ http_info = {
56
+ "method": "GET",
57
+ "resource_path": "/v1/{project_id}/namespaces",
58
+ "request_type": request.__class__.__name__,
59
+ "response_type": "ShowNameSpaceListResponse"
60
+ }
61
+
62
+ local_var_params = {attr: getattr(request, attr) for attr in request.attribute_map if hasattr(request, attr)}
63
+
64
+ cname = None
65
+
66
+ collection_formats = {}
67
+
68
+ path_params = {}
69
+
70
+ query_params = []
71
+ if 'offset' in local_var_params:
72
+ query_params.append(('offset', local_var_params['offset']))
73
+ if 'limit' in local_var_params:
74
+ query_params.append(('limit', local_var_params['limit']))
75
+ if 'name' in local_var_params:
76
+ query_params.append(('name', local_var_params['name']))
77
+ if 'type' in local_var_params:
78
+ query_params.append(('type', local_var_params['type']))
79
+ if 'is_used' in local_var_params:
80
+ query_params.append(('is_used', local_var_params['is_used']))
81
+ if 'enterprise_project_id' in local_var_params:
82
+ query_params.append(('enterprise_project_id', local_var_params['enterprise_project_id']))
83
+
84
+ header_params = {}
85
+
86
+ form_params = {}
87
+
88
+ body = None
89
+ if isinstance(request, SdkStreamRequest):
90
+ body = request.get_file_stream()
91
+
92
+ response_headers = []
93
+
94
+ header_params['Content-Type'] = http_utils.select_header_content_type(
95
+ ['application/json'])
96
+
97
+ auth_settings = []
98
+
99
+ http_info["cname"] = cname
100
+ http_info["collection_formats"] = collection_formats
101
+ http_info["path_params"] = path_params
102
+ http_info["query_params"] = query_params
103
+ http_info["header_params"] = header_params
104
+ http_info["post_params"] = form_params
105
+ http_info["body"] = body
106
+ http_info["response_headers"] = response_headers
107
+
108
+ return http_info
109
+
110
+ def _call_api(self, **kwargs):
111
+ try:
112
+ return self.do_http_request(**kwargs)
113
+ except TypeError:
114
+ import inspect
115
+ params = inspect.signature(self.do_http_request).parameters
116
+ http_info = {param_name: kwargs.get(param_name) for param_name in params if param_name in kwargs}
117
+ return self.do_http_request(**http_info)
118
+
119
+ def call_api(self, resource_path, method, path_params=None, query_params=None, header_params=None, body=None,
120
+ post_params=None, cname=None, response_type=None, response_headers=None, auth_settings=None,
121
+ collection_formats=None, request_type=None):
122
+ """Makes the HTTP request and returns deserialized data.
123
+
124
+ :param resource_path: Path to method endpoint.
125
+ :param method: Method to call.
126
+ :param path_params: Path parameters in the url.
127
+ :param query_params: Query parameters in the url.
128
+ :param header_params: Header parameters to be placed in the request header.
129
+ :param body: Request body.
130
+ :param post_params: Request post form parameters,
131
+ for `application/x-www-form-urlencoded`, `multipart/form-data`.
132
+ :param cname: Used for obs endpoint.
133
+ :param auth_settings: Auth Settings names for the request.
134
+ :param response_type: Response data type.
135
+ :param response_headers: Header should be added to response data.
136
+ :param collection_formats: dict of collection formats for path, query,
137
+ header, and post parameters.
138
+ :param request_type: Request data type.
139
+ :return:
140
+ Return the response directly.
141
+ """
142
+ return self.do_http_request(
143
+ method=method,
144
+ resource_path=resource_path,
145
+ path_params=path_params,
146
+ query_params=query_params,
147
+ header_params=header_params,
148
+ body=body,
149
+ post_params=post_params,
150
+ cname=cname,
151
+ response_type=response_type,
152
+ response_headers=response_headers,
153
+ collection_formats=collection_formats,
154
+ request_type=request_type)
@@ -0,0 +1,12 @@
1
+ # coding: utf-8
2
+
3
+ from __future__ import absolute_import
4
+
5
+ # import models into model package
6
+ from huaweicloudsdkmas.v1.model.base_multi_active_zone_spec import BaseMultiActiveZoneSpec
7
+ from huaweicloudsdkmas.v1.model.data_sync_statistics import DataSyncStatistics
8
+ from huaweicloudsdkmas.v1.model.datasource_statistics import DatasourceStatistics
9
+ from huaweicloudsdkmas.v1.model.multi_active_zone_vo import MultiActiveZoneVo
10
+ from huaweicloudsdkmas.v1.model.namespace_vo import NamespaceVo
11
+ from huaweicloudsdkmas.v1.model.show_name_space_list_request import ShowNameSpaceListRequest
12
+ from huaweicloudsdkmas.v1.model.show_name_space_list_response import ShowNameSpaceListResponse
@@ -0,0 +1,84 @@
1
+ # coding: utf-8
2
+
3
+ import six
4
+
5
+ from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
6
+
7
+
8
+ class BaseMultiActiveZoneSpec:
9
+
10
+ """
11
+ Attributes:
12
+ openapi_types (dict): The key is attribute name
13
+ and the value is attribute type.
14
+ attribute_map (dict): The key is attribute name
15
+ and the value is json key in definition.
16
+ """
17
+ sensitive_list = []
18
+
19
+ openapi_types = {
20
+ }
21
+
22
+ attribute_map = {
23
+ }
24
+
25
+ def __init__(self):
26
+ r"""BaseMultiActiveZoneSpec
27
+
28
+ The model defined in huaweicloud sdk
29
+
30
+ """
31
+
32
+
33
+ self.discriminator = None
34
+
35
+ def to_dict(self):
36
+ """Returns the model properties as a dict"""
37
+ result = {}
38
+
39
+ for attr, _ in six.iteritems(self.openapi_types):
40
+ value = getattr(self, attr)
41
+ if isinstance(value, list):
42
+ result[attr] = list(map(
43
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
44
+ value
45
+ ))
46
+ elif hasattr(value, "to_dict"):
47
+ result[attr] = value.to_dict()
48
+ elif isinstance(value, dict):
49
+ result[attr] = dict(map(
50
+ lambda item: (item[0], item[1].to_dict())
51
+ if hasattr(item[1], "to_dict") else item,
52
+ value.items()
53
+ ))
54
+ else:
55
+ if attr in self.sensitive_list:
56
+ result[attr] = "****"
57
+ else:
58
+ result[attr] = value
59
+
60
+ return result
61
+
62
+ def to_str(self):
63
+ """Returns the string representation of the model"""
64
+ import simplejson as json
65
+ if six.PY2:
66
+ import sys
67
+ reload(sys)
68
+ sys.setdefaultencoding("utf-8")
69
+ return json.dumps(sanitize_for_serialization(self), ensure_ascii=False)
70
+
71
+ def __repr__(self):
72
+ """For `print`"""
73
+ return self.to_str()
74
+
75
+ def __eq__(self, other):
76
+ """Returns true if both objects are equal"""
77
+ if not isinstance(other, BaseMultiActiveZoneSpec):
78
+ return False
79
+
80
+ return self.__dict__ == other.__dict__
81
+
82
+ def __ne__(self, other):
83
+ """Returns true if both objects are not equal"""
84
+ return not self == other
@@ -0,0 +1,186 @@
1
+ # coding: utf-8
2
+
3
+ import six
4
+
5
+ from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
6
+
7
+
8
+ class DataSyncStatistics:
9
+
10
+ """
11
+ Attributes:
12
+ openapi_types (dict): The key is attribute name
13
+ and the value is attribute type.
14
+ attribute_map (dict): The key is attribute name
15
+ and the value is json key in definition.
16
+ """
17
+ sensitive_list = []
18
+
19
+ openapi_types = {
20
+ 'abnormal_count': 'int',
21
+ 'running_count': 'int',
22
+ 'type_two_way_count': 'int',
23
+ 'type_unidirectional_count': 'int'
24
+ }
25
+
26
+ attribute_map = {
27
+ 'abnormal_count': 'abnormal_count',
28
+ 'running_count': 'running_count',
29
+ 'type_two_way_count': 'type_two_way_count',
30
+ 'type_unidirectional_count': 'type_unidirectional_count'
31
+ }
32
+
33
+ def __init__(self, abnormal_count=None, running_count=None, type_two_way_count=None, type_unidirectional_count=None):
34
+ r"""DataSyncStatistics
35
+
36
+ The model defined in huaweicloud sdk
37
+
38
+ :param abnormal_count:
39
+ :type abnormal_count: int
40
+ :param running_count:
41
+ :type running_count: int
42
+ :param type_two_way_count:
43
+ :type type_two_way_count: int
44
+ :param type_unidirectional_count:
45
+ :type type_unidirectional_count: int
46
+ """
47
+
48
+
49
+
50
+ self._abnormal_count = None
51
+ self._running_count = None
52
+ self._type_two_way_count = None
53
+ self._type_unidirectional_count = None
54
+ self.discriminator = None
55
+
56
+ if abnormal_count is not None:
57
+ self.abnormal_count = abnormal_count
58
+ if running_count is not None:
59
+ self.running_count = running_count
60
+ if type_two_way_count is not None:
61
+ self.type_two_way_count = type_two_way_count
62
+ if type_unidirectional_count is not None:
63
+ self.type_unidirectional_count = type_unidirectional_count
64
+
65
+ @property
66
+ def abnormal_count(self):
67
+ r"""Gets the abnormal_count of this DataSyncStatistics.
68
+
69
+ :return: The abnormal_count of this DataSyncStatistics.
70
+ :rtype: int
71
+ """
72
+ return self._abnormal_count
73
+
74
+ @abnormal_count.setter
75
+ def abnormal_count(self, abnormal_count):
76
+ r"""Sets the abnormal_count of this DataSyncStatistics.
77
+
78
+ :param abnormal_count: The abnormal_count of this DataSyncStatistics.
79
+ :type abnormal_count: int
80
+ """
81
+ self._abnormal_count = abnormal_count
82
+
83
+ @property
84
+ def running_count(self):
85
+ r"""Gets the running_count of this DataSyncStatistics.
86
+
87
+ :return: The running_count of this DataSyncStatistics.
88
+ :rtype: int
89
+ """
90
+ return self._running_count
91
+
92
+ @running_count.setter
93
+ def running_count(self, running_count):
94
+ r"""Sets the running_count of this DataSyncStatistics.
95
+
96
+ :param running_count: The running_count of this DataSyncStatistics.
97
+ :type running_count: int
98
+ """
99
+ self._running_count = running_count
100
+
101
+ @property
102
+ def type_two_way_count(self):
103
+ r"""Gets the type_two_way_count of this DataSyncStatistics.
104
+
105
+ :return: The type_two_way_count of this DataSyncStatistics.
106
+ :rtype: int
107
+ """
108
+ return self._type_two_way_count
109
+
110
+ @type_two_way_count.setter
111
+ def type_two_way_count(self, type_two_way_count):
112
+ r"""Sets the type_two_way_count of this DataSyncStatistics.
113
+
114
+ :param type_two_way_count: The type_two_way_count of this DataSyncStatistics.
115
+ :type type_two_way_count: int
116
+ """
117
+ self._type_two_way_count = type_two_way_count
118
+
119
+ @property
120
+ def type_unidirectional_count(self):
121
+ r"""Gets the type_unidirectional_count of this DataSyncStatistics.
122
+
123
+ :return: The type_unidirectional_count of this DataSyncStatistics.
124
+ :rtype: int
125
+ """
126
+ return self._type_unidirectional_count
127
+
128
+ @type_unidirectional_count.setter
129
+ def type_unidirectional_count(self, type_unidirectional_count):
130
+ r"""Sets the type_unidirectional_count of this DataSyncStatistics.
131
+
132
+ :param type_unidirectional_count: The type_unidirectional_count of this DataSyncStatistics.
133
+ :type type_unidirectional_count: int
134
+ """
135
+ self._type_unidirectional_count = type_unidirectional_count
136
+
137
+ def to_dict(self):
138
+ """Returns the model properties as a dict"""
139
+ result = {}
140
+
141
+ for attr, _ in six.iteritems(self.openapi_types):
142
+ value = getattr(self, attr)
143
+ if isinstance(value, list):
144
+ result[attr] = list(map(
145
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
146
+ value
147
+ ))
148
+ elif hasattr(value, "to_dict"):
149
+ result[attr] = value.to_dict()
150
+ elif isinstance(value, dict):
151
+ result[attr] = dict(map(
152
+ lambda item: (item[0], item[1].to_dict())
153
+ if hasattr(item[1], "to_dict") else item,
154
+ value.items()
155
+ ))
156
+ else:
157
+ if attr in self.sensitive_list:
158
+ result[attr] = "****"
159
+ else:
160
+ result[attr] = value
161
+
162
+ return result
163
+
164
+ def to_str(self):
165
+ """Returns the string representation of the model"""
166
+ import simplejson as json
167
+ if six.PY2:
168
+ import sys
169
+ reload(sys)
170
+ sys.setdefaultencoding("utf-8")
171
+ return json.dumps(sanitize_for_serialization(self), ensure_ascii=False)
172
+
173
+ def __repr__(self):
174
+ """For `print`"""
175
+ return self.to_str()
176
+
177
+ def __eq__(self, other):
178
+ """Returns true if both objects are equal"""
179
+ if not isinstance(other, DataSyncStatistics):
180
+ return False
181
+
182
+ return self.__dict__ == other.__dict__
183
+
184
+ def __ne__(self, other):
185
+ """Returns true if both objects are not equal"""
186
+ return not self == other