From 5a52828777594a3cc4acb3fd481c0e324a9fa3ab Mon Sep 17 00:00:00 2001 From: Jeffrey Date: Thu, 3 Jun 2021 11:54:41 +0800 Subject: [PATCH] release 3.0.45 source code for python --- huaweicloud-sdk-codehub/LICENSE | 13 ++ huaweicloud-sdk-codehub/README_PYPI.md | 1 + .../huaweicloudsdkcodehub/__init__.py | 12 + .../huaweicloudsdkcodehub/v2/__init__.py | 28 +++ .../v2/codehub_async_client.py | 30 +++ .../v2/codehub_client.py | 209 +++++++++++++++++ .../v2/model/__init__.py | 22 ++ .../v2/model/codehub_repositories.py | 212 +++++++++++++++++ .../v2/model/codehub_result.py | 113 +++++++++ .../v2/model/create_repository_request.py | 104 +++++++++ .../model/create_repository_request_body.py | 214 ++++++++++++++++++ .../v2/model/create_repository_response.py | 110 +++++++++ ...get_all_repository_by_projectid_request.py | 129 +++++++++++ ...et_all_repository_by_projectid_response.py | 109 +++++++++ .../v2/region/__init__.py | 0 .../v2/region/codehub_region.py | 42 ++++ huaweicloud-sdk-codehub/requirements.txt | 1 + huaweicloud-sdk-codehub/setup.py | 67 ++++++ huaweicloud-sdk-codehub/test-requirements.txt | 5 + 19 files changed, 1421 insertions(+) create mode 100644 huaweicloud-sdk-codehub/LICENSE create mode 100644 huaweicloud-sdk-codehub/README_PYPI.md create mode 100644 huaweicloud-sdk-codehub/huaweicloudsdkcodehub/__init__.py create mode 100644 huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/__init__.py create mode 100644 huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/codehub_async_client.py create mode 100644 huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/codehub_client.py create mode 100644 huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/__init__.py create mode 100644 huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/codehub_repositories.py create mode 100644 huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/codehub_result.py create mode 100644 huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/create_repository_request.py create mode 100644 huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/create_repository_request_body.py create mode 100644 huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/create_repository_response.py create mode 100644 huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/get_all_repository_by_projectid_request.py create mode 100644 huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/get_all_repository_by_projectid_response.py create mode 100644 huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/region/__init__.py create mode 100644 huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/region/codehub_region.py create mode 100644 huaweicloud-sdk-codehub/requirements.txt create mode 100644 huaweicloud-sdk-codehub/setup.py create mode 100644 huaweicloud-sdk-codehub/test-requirements.txt diff --git a/huaweicloud-sdk-codehub/LICENSE b/huaweicloud-sdk-codehub/LICENSE new file mode 100644 index 0000000000..808e3296c0 --- /dev/null +++ b/huaweicloud-sdk-codehub/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) Huawei Technologies Co., Ltd. 2020-present. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/huaweicloud-sdk-codehub/README_PYPI.md b/huaweicloud-sdk-codehub/README_PYPI.md new file mode 100644 index 0000000000..9711543c73 --- /dev/null +++ b/huaweicloud-sdk-codehub/README_PYPI.md @@ -0,0 +1 @@ +See detailed information in [huaweicloud-sdk-python-v3](https://github.com/huaweicloud/huaweicloud-sdk-python-v3). \ No newline at end of file diff --git a/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/__init__.py b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/__init__.py new file mode 100644 index 0000000000..6a526fc395 --- /dev/null +++ b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/__init__.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +@author: JeffreyDin +@license: +@contact: dingjianfeng15@gmail.com +@software: +@file: __init__.py +@ide: PyCharm +@time: 2021/5/18 18:41 +@desc: +""" diff --git a/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/__init__.py b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/__init__.py new file mode 100644 index 0000000000..39da8912ed --- /dev/null +++ b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/__init__.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +@author: JeffreyDin +@license: +@contact: dingjianfeng15@gmail.com +@software: +@file: __init__.py.py +@ide: PyCharm +@time: 2021/5/18 18:44 +@desc: +""" +# coding: utf-8 + +from __future__ import absolute_import + +# import CloudPipelineClient +from huaweicloudsdkcodehub.v2.codehub_client import CodeHubClient +from huaweicloudsdkcodehub.v2.codehub_async_client import CodeHubAsyncClient + +# import models into sdk package +from huaweicloudsdkcodehub.v2.model.create_repository_request import CreateRepositoryRequest +from huaweicloudsdkcodehub.v2.model.create_repository_request_body import CreateRepositoryRequestBody +from huaweicloudsdkcodehub.v2.model.create_repository_response import CreateRepositoryResponse +from huaweicloudsdkcodehub.v2.model.get_all_repository_by_projectid_request import GetAllRepositoryByProjectId2Request +from huaweicloudsdkcodehub.v2.model.get_all_repository_by_projectid_response import GetAllRepositoryByProjectId2Response +from huaweicloudsdkcodehub.v2.model.codehub_result import CodeHubResult +from huaweicloudsdkcodehub.v2.model.codehub_repositories import CodeHubRepositories \ No newline at end of file diff --git a/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/codehub_async_client.py b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/codehub_async_client.py new file mode 100644 index 0000000000..c502536244 --- /dev/null +++ b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/codehub_async_client.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +@author: JeffreyDin +@license: +@contact: dingjianfeng15@gmail.com +@software: +@file: codehub_async_client.py +@ide: PyCharm +@time: 2021/5/18 18:48 +@desc: +""" +from __future__ import absolute_import + +import datetime +import re +import importlib + +import six + +from huaweicloudsdkcore.client import Client, ClientBuilder +from huaweicloudsdkcore.exceptions import exceptions +from huaweicloudsdkcore.utils import http_utils +from huaweicloudsdkcore.sdk_stream_request import SdkStreamRequest + + +class CodeHubAsyncClient(Client): + + # TODO: 后续处理 + pass diff --git a/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/codehub_client.py b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/codehub_client.py new file mode 100644 index 0000000000..b879b0875f --- /dev/null +++ b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/codehub_client.py @@ -0,0 +1,209 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +@author: JeffreyDin +@license: +@contact: dingjianfeng15@gmail.com +@software: +@file: codehub_client.py +@ide: PyCharm +@time: 2021/5/18 18:47 +@desc: +""" +from __future__ import absolute_import + +import datetime +import re +import importlib + +import six + +from huaweicloudsdkcore.client import Client, ClientBuilder +from huaweicloudsdkcore.exceptions import exceptions +from huaweicloudsdkcore.utils import http_utils +from huaweicloudsdkcore.sdk_stream_request import SdkStreamRequest + + +class CodeHubClient(Client): + PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int if six.PY3 else long, + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'object': object, + } + + def __init__(self): + super(CodeHubClient, self).__init__() + self.model_package = importlib.import_module("huaweicloudsdkcodehub.v2.model") + self.preset_headers = {'User-Agent': 'HuaweiCloud-SDK-Python'} + + @classmethod + def new_builder(cls, clazz=None): + if clazz is None: + return ClientBuilder(cls) + + if clazz.__name__ != "CodeHubClient": + raise TypeError("client type error, support client type is CodeHubClient") + + return ClientBuilder(clazz) + + def create_repository(self, request): + """创建仓库 + + :param request: CreateRepositoryRequest + :return: CreateRepositoryResponse + """ + return self.create_repository_with_http_info(request) + + def create_repository_with_http_info(self, request): + """创建仓库 + + :param request: CreateRepositoryRequest + :return: CreateRepositoryResponse + """ + + all_params = ['create_repository_request_body'] + local_var_params = {} + for attr in request.attribute_map: + if hasattr(request, attr): + local_var_params[attr] = getattr(request, attr) + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = {} + + body_params = None + if 'body' in local_var_params: + body_params = local_var_params['body'] + 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 = ['apig-auth-iam'] + + return self.call_api( + resource_path='/v1/repositories', + method='POST', + path_params=path_params, + query_params=query_params, + header_params=header_params, + body=body_params, + post_params=form_params, + response_type='CreateRepositoryResponse', + response_headers=response_headers, + auth_settings=auth_settings, + collection_formats=collection_formats, + request_type=request.__class__.__name__) + + def get_all_repository_by_projectid(self, request): + """查询项目下的所有仓库 + + :param request: GetAllRepositoryByProjectId2Request + :return: GetAllRepositoryByProjectId2Response + """ + return self.get_all_repository_by_projectid_with_http_info(request) + + def get_all_repository_by_projectid_with_http_info(self, request): + """查询项目下的所有仓库 + + :param request: GetAllRepositoryByProjectId2Request + :return: GetAllRepositoryByProjectId2Response + """ + all_params = ['project_uuid', 'page_index', 'page_size', 'search'] + local_var_params = {} + for attr in request.attribute_map: + if hasattr(request, attr): + local_var_params[attr] = getattr(request, attr) + + collection_formats = {} + + path_params = {} + if 'project_uuid' in local_var_params: + path_params['project_uuid'] = local_var_params['project_uuid'] + if 'page_index' in local_var_params: + path_params['page_index'] = local_var_params['page_index'] + if 'page_size' in local_var_params: + path_params['page_size'] = local_var_params['page_size'] + if 'search' in local_var_params: + path_params['search'] = local_var_params['search'] + + query_params = [] + + 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='/v2/projects/{project_uuid}/repositories', + method='GET', + path_params=path_params, + query_params=query_params, + header_params=header_params, + body=body_params, + post_params=form_params, + response_type='GetAllRepositoryByProjectId2Response', + 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, + post_params=None, response_type=None, response_headers=None, auth_settings=None, + 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. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :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, + response_type=response_type, + response_headers=response_headers, + collection_formats=collection_formats, + request_type=request_type) diff --git a/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/__init__.py b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/__init__.py new file mode 100644 index 0000000000..d92ec22396 --- /dev/null +++ b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/__init__.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +@author: JeffreyDin +@license: +@contact: dingjianfeng15@gmail.com +@software: +@file: __init__.py.py +@ide: PyCharm +@time: 2021/5/18 18:44 +@desc: +""" +from __future__ import absolute_import + +# import models into model package +from huaweicloudsdkcodehub.v2.model.create_repository_request import CreateRepositoryRequest +from huaweicloudsdkcodehub.v2.model.create_repository_request_body import CreateRepositoryRequestBody +from huaweicloudsdkcodehub.v2.model.create_repository_response import CreateRepositoryResponse +from huaweicloudsdkcodehub.v2.model.get_all_repository_by_projectid_request import GetAllRepositoryByProjectId2Request +from huaweicloudsdkcodehub.v2.model.get_all_repository_by_projectid_response import GetAllRepositoryByProjectId2Response +from huaweicloudsdkcodehub.v2.model.codehub_result import CodeHubResult +from huaweicloudsdkcodehub.v2.model.codehub_repositories import CodeHubRepositories diff --git a/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/codehub_repositories.py b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/codehub_repositories.py new file mode 100644 index 0000000000..4e76dda0cd --- /dev/null +++ b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/codehub_repositories.py @@ -0,0 +1,212 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +@author: JeffreyDin +@license: +@contact: dingjianfeng15@gmail.com +@software: +@file: codehub_repositories.py +@ide: PyCharm +@time: 2021/6/2 18:49 +@desc: +""" +import pprint +import re +from typing import Any + +import six + + +class CodeHubRepositories: + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + + sensitive_list = [] + + openapi_types = { + 'created_at': 'str', + 'creator_name': 'str', + 'domain_name': 'str', + 'group_name': 'str', + 'https_url': 'str', + 'iam_user_uuid': 'str', + 'is_owner': 'int', + 'lfs_size': 'str', + 'project_is_deleted': 'str', + 'project_uuid': 'str', + 'repository_id': 'int', + 'repository_name': 'str', + 'repository_size': 'str', + 'repository_uuid': 'str', + 'ssh_url': 'str', + 'star': 'bool', + 'status': 'int', + 'updated_at': 'str', + 'userRole': 'int', + 'visibility_level': 'int', + 'web_url': 'str' + } + + attribute_map = { + 'created_at': 'created_at', + 'creator_name': 'creator_name', + 'domain_name': 'domain_name', + 'group_name': 'group_name', + 'https_url': 'https_url', + 'iam_user_uuid': 'iam_user_uuid', + 'is_owner': 'is_owner', + 'lfs_size': 'lfs_size', + 'project_is_deleted': 'project_is_deleted', + 'project_uuid': 'project_uuid', + 'repository_id': 'repository_id', + 'repository_name': 'repository_name', + 'repository_size': 'repository_size', + 'repository_uuid': 'repository_uuid', + 'ssh_url': 'ssh_url', + 'star': 'star', + 'status': 'status', + 'updated_at': 'updated_at', + 'userRole': 'userRole', + 'visibility_level': 'visibility_level', + 'web_url': 'web_url' + } + + def __init__(self, created_at=None, creator_name=None, domain_name=None, group_name=None, https_url=None, + iam_user_uuid=None, is_owner=None, lfs_size=None, project_is_deleted=None, project_uuid=None, + repository_id=None, repository_name=None, repository_size=None, repository_uuid=None, ssh_url=None, + star=None, status=None, updated_at=None, userRole=None, visibility_level=None, web_url=None): + """CodeHubRepositories - a model defined in huaweicloud sdk""" + + self._created_at = None + self._creator_name = None + self._domain_name = None + self._group_name = None + self._https_url = None + + self._iam_user_uuid = None + self._is_owner = None + self._lfs_size = None + self._project_is_deleted = None + self._project_uuid = None + + self._repository_id = None + self._repository_name = None + self._repository_size = None + self._repository_uuid = None + self._ssh_url = None + + self._star = None + self._status = None + self._updated_at = None + self._userRole = None + self._visibility_level = None + self._web_url = None + + + self.discriminator = None + + if created_at is not None: + self.created_at = created_at + if creator_name is not None: + self.creator_name = creator_name + if domain_name is not None: + self.domain_name = domain_name + if group_name is not None: + self.group_name = group_name + if https_url is not None: + self.https_url = https_url + + if iam_user_uuid is not None: + self.iam_user_uuid = iam_user_uuid + if is_owner is not None: + self.is_owner = is_owner + if lfs_size is not None: + self.lfs_size = lfs_size + if project_is_deleted is not None: + self.project_is_deleted = project_is_deleted + if project_uuid is not None: + self.project_uuid = project_uuid + + if repository_id is not None: + self.repository_id = repository_id + if repository_name is not None: + self.repository_name = repository_name + if repository_size is not None: + self.repository_size = repository_size + if repository_uuid is not None: + self.repository_uuid = repository_uuid + if ssh_url is not None: + self.ssh_url = ssh_url + + if star is not None: + self.star = star + if status is not None: + self.status = status + if updated_at is not None: + self.updated_at = updated_at + if userRole is not None: + self.userRole = userRole + if visibility_level is not None: + self.visibility_level = visibility_level + if web_url is not None: + self.web_url = web_url + + @property + def userRole(self): + return self._userRole + + @userRole.setter + def userRole(self, userRole): + self._userRole = userRole + + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + if attr in self.sensitive_list: + result[attr] = "****" + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CodeHubRepositories): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other \ No newline at end of file diff --git a/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/codehub_result.py b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/codehub_result.py new file mode 100644 index 0000000000..77c8179527 --- /dev/null +++ b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/codehub_result.py @@ -0,0 +1,113 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +@author: JeffreyDin +@license: +@contact: dingjianfeng15@gmail.com +@software: +@file: codehub_result.py +@ide: PyCharm +@time: 2021/6/2 18:48 +@desc: +""" + +import pprint +import re + +import six + + +class CodeHubResult: + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + + sensitive_list = [] + + openapi_types = { + 'total': 'int', + 'repositories': 'list[CodeHubRepositories]' + } + + attribute_map = { + 'total': 'total', + 'repositories': 'repositories', + } + + def __init__(self, total=None, repositories=None): + """CodeHubResult - a model defined in huaweicloud sdk""" + + self._total = None + self._repositories = None + self.discriminator = None + + if total is not None: + self.total = total + if repositories is not None: + self.repositories = repositories + + @property + def total(self): + return self._total + + @total.setter + def total(self, total): + self._total = total + + @property + def repositories(self): + return self._repositories + + @repositories.setter + def repositories(self, repositories): + self._repositories = repositories + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + if attr in self.sensitive_list: + result[attr] = "****" + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CodeHubResult): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other \ No newline at end of file diff --git a/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/create_repository_request.py b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/create_repository_request.py new file mode 100644 index 0000000000..958df130c5 --- /dev/null +++ b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/create_repository_request.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +@author: JeffreyDin +@license: +@contact: dingjianfeng15@gmail.com +@software: +@file: create_repository_request.py +@ide: PyCharm +@time: 2021/5/26 15:17 +@desc: +""" + +import pprint +import re + +import six + + +class CreateRepositoryRequest: + sensitive_list = [] + + openapi_types = { + + 'body': 'CreateRepositoryRequestBody' + } + + attribute_map = { + + 'body': 'body' + } + + def __init(self, body=None): + """CreateRepositoryRequest - a model defined in huaweicloud sdk""" + + self._body = None + self.discriminator = None + + if body is not None: + self.body = body + + @property + def body(self): + """ + + :return: + :rtype: CreateRepositoryRequestBody + """ + return self._body + + @body.setter + def body(self, body): + """ + + :param body: + :type: CreateRepositoryRequestBody + """ + self._body = body + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + if attr in self.sensitive_list: + result[attr] = "****" + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CreateRepositoryRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/create_repository_request_body.py b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/create_repository_request_body.py new file mode 100644 index 0000000000..d824b35abe --- /dev/null +++ b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/create_repository_request_body.py @@ -0,0 +1,214 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +@author: JeffreyDin +@license: +@contact: dingjianfeng15@gmail.com +@software: +@file: create_repository_request_body.py +@ide: PyCharm +@time: 2021/5/26 15:17 +@desc: +""" + +import pprint +import re + +import six + + +class CreateRepositoryRequestBody: + + sensitive_list = [] + + openapi_types = { + 'description': 'str', + 'enable_readme': 'int', + 'gitignore_id': 'str', + 'import_members': 'int', + 'import_url': 'str', + 'license_id': 'int', + 'name': 'str', + 'project_uuid': 'str', + 'template_id': 'str', + 'visibility_level': 'int' + } + + attribute_map = { + 'description': 'description', + 'enable_readme': 'enable_readme', + 'gitignore_id': 'gitignore_id', + 'import_members': 'import_members', + 'import_url': 'import_url', + 'license_id': 'license_id', + 'name': 'name', + 'project_uuid': 'project_uuid', + 'template_id': 'template_id', + 'visibility_level': 'visibility_level' + } + + def __init__(self, name=None, project_uuid=None, description=None, + enable_readme=None, gitignore_id=None, import_members=None, + import_url=None, license_id=None, template_id=None, + visibility_level=None + ): + """CreateRepositoryOption - a model defined in huaweicloud sdk""" + + self._name = None + self._project_uuid = None + self._description = None + self._enable_readme = None + self._gitignore_id = None + self._import_members = None + self._import_url = None + self._license_id = None + self._template_id = None + self._visibility_level = None + self.discriminator = None + + self.name = name + self.project_uuid = project_uuid + + if description is not None: + self.description = description + if enable_readme is not None: + self.enable_readme = enable_readme + if gitignore_id is not None: + self.gitignore_id = gitignore_id + if import_members is not None: + self.import_members = import_members + if import_url is not None: + self.import_url = import_url + if license_id is not None: + self.license_id = license_id + if template_id is not None: + self.template_id = template_id + if visibility_level is not None: + self.visibility_level = visibility_level + + @property + def name(self): + return self._name + + @name.setter + def name(self, name): + self._name = name + + @property + def project_uuid(self): + return self._project_uuid + + @project_uuid.setter + def project_uuid(self, project_uuid): + self._project_uuid = project_uuid + + @property + def description(self): + return self._description + + @description.setter + def description(self, description): + self._description = description + + @property + def enable_readme(self): + return self._enable_readme + + @enable_readme.setter + def enable_readme(self, enable_readme): + self._enable_readme = enable_readme + + @property + def gitignore_id(self): + return self._gitignore_id + + @gitignore_id.setter + def gitignore_id(self, gitignore_id): + self._gitignore_id = gitignore_id + + + @property + def import_members(self): + return self._import_members + + @import_members.setter + def import_members(self, import_members): + self._import_members = import_members + + @property + def import_url(self): + return self._import_url + + @import_url.setter + def import_url(self, import_url): + self._import_url = import_url + + @property + def license_id(self): + return self._license_id + + @license_id.setter + def license_id(self, license_id): + self._license_id = license_id + + @property + def template_id(self): + return self._template_id + + @template_id.setter + def template_id(self, template_id): + self._template_id = template_id + + @property + def visibility_level(self): + return self._visibility_level + + @visibility_level.setter + def visibility_level(self, visibility_level): + self._visibility_level = visibility_level + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + if attr in self.sensitive_list: + result[attr] = "****" + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CreateRepositoryRequestBody): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/create_repository_response.py b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/create_repository_response.py new file mode 100644 index 0000000000..3745043af2 --- /dev/null +++ b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/create_repository_response.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +@author: JeffreyDin +@license: +@contact: dingjianfeng15@gmail.com +@software: +@file: create_repository_response.py +@ide: PyCharm +@time: 2021/5/26 15:17 +@desc: +""" + +import pprint +import re + +import six + +from huaweicloudsdkcore.sdk_response import SdkResponse + + +class CreateRepositoryResponse(SdkResponse): + sensitive_list = [] + + openapi_types = { + 'result': 'object', + 'status': 'str' + } + + attribute_map = { + 'result': 'result', + 'status': 'status' + } + + def __init__(self, result=None, status=None): + """ListPipleineBuildResultResponse - a model defined in huaweicloud sdk""" + + super(CreateRepositoryResponse, self).__init__() + + self._result = None + self._status = None + self.discriminator = None + + if result is not None: + self.result = result + if status is not None: + self.total = status + + @property + def result(self): + return self._result + + @result.setter + def result(self, result): + self._result = result + + @property + def status(self): + + return self._status + + @status.setter + def status(self, status): + self._status = status + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + if attr in self.sensitive_list: + result[attr] = "****" + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CreateRepositoryResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/get_all_repository_by_projectid_request.py b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/get_all_repository_by_projectid_request.py new file mode 100644 index 0000000000..67a5a71675 --- /dev/null +++ b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/get_all_repository_by_projectid_request.py @@ -0,0 +1,129 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +@author: JeffreyDin +@license: +@contact: dingjianfeng15@gmail.com +@software: +@file: get_all_repository_by_projectid_request.py +@ide: PyCharm +@time: 2021/6/2 16:44 +@desc: +""" +import pprint +import re + +import six + + +class GetAllRepositoryByProjectId2Request: + sensitive_list = [] + + openapi_types = { + 'project_uuid': 'str', + 'page_index': 'int', + 'page_size': 'int', + 'search': 'str', + } + + attribute_map = { + 'project_uuid': 'project_uuid', + 'page_index': 'page_index', + 'page_size': 'page_size', + 'search': 'search' + } + + def __init(self, project_uuid=None, page_index=None, page_size=None, search=None): + """GetAllRepositoryByProjectId2Request - a model defined in huaweicloud sdk""" + + self._project_uuid = None + self._page_index = None + self._page_size = None + self._search = None + self.discriminator = None + + if page_index is not None: + self.page_index = page_index + if page_size is not None: + self.page_size = page_size + if search is not None: + self.search = search + self.project_uuid = project_uuid + + @property + def project_uuid(self): + return self._project_uuid + + @project_uuid.setter + def project_uuid(self, project_uuid): + self._project_uuid = project_uuid + + @property + def page_index(self): + return self._page_index + + @page_index.setter + def page_index(self, page_index): + self._page_index = page_index + + @property + def page_size(self): + return self._page_size + + @page_size.setter + def page_size(self, page_size): + self._page_size = page_size + + @property + def search(self): + return self._search + + @search.setter + def search(self, search): + self._search = search + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + if attr in self.sensitive_list: + result[attr] = "****" + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, GetAllRepositoryByProjectId2Request): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/get_all_repository_by_projectid_response.py b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/get_all_repository_by_projectid_response.py new file mode 100644 index 0000000000..697a60708c --- /dev/null +++ b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/get_all_repository_by_projectid_response.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +@author: JeffreyDin +@license: +@contact: dingjianfeng15@gmail.com +@software: +@file: get_all_repository_by_projectid_response.py +@ide: PyCharm +@time: 2021/6/2 16:44 +@desc: +""" +import pprint +import re + +import six + +from huaweicloudsdkcore.sdk_response import SdkResponse + + +class GetAllRepositoryByProjectId2Response(SdkResponse): + sensitive_list = [] + + openapi_types = { + 'result': 'CodeHubResult', + 'status': 'str' + } + + attribute_map = { + 'result': 'result', + 'status': 'status' + } + + def __init__(self, result=None, status=None): + """ListPipleineBuildResultResponse - a model defined in huaweicloud sdk""" + + super(GetAllRepositoryByProjectId2Response, self).__init__() + + self._result = None + self._status = None + self.discriminator = None + + if result is not None: + self.result = result + if status is not None: + self.total = status + + @property + def result(self): + return self._result + + @result.setter + def result(self, result): + self._result = result + + @property + def status(self): + + return self._status + + @status.setter + def status(self, status): + self._status = status + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + if attr in self.sensitive_list: + result[attr] = "****" + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, GetAllRepositoryByProjectId2Response): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other \ No newline at end of file diff --git a/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/region/__init__.py b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/region/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/region/codehub_region.py b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/region/codehub_region.py new file mode 100644 index 0000000000..8bed902ab6 --- /dev/null +++ b/huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/region/codehub_region.py @@ -0,0 +1,42 @@ +# coding: utf-8 + +import types +import six + +from huaweicloudsdkcore.region.region import Region + + +class CodehubRegion: + def __init__(self): + pass + + CN_NORTH_1 = Region(id="cn-north-1", endpoint="https://codehub-ext.cn-north-1.myhuaweicloud.com") + + CN_NORTH_4 = Region(id="cn-north-4", endpoint="https://codehub-ext.cn-north-4.myhuaweicloud.com") + + CN_SOUTH_1 = Region(id="cn-south-1", endpoint="https://codehub-ext.cn-south-1.myhuaweicloud.com") + + CN_SOUTH_2 = Region(id="cn-south-2", endpoint="https://codehub-ext.cn-south-2.myhuaweicloud.com") + + CN_EAST_3 = Region(id="cn-east-3", endpoint="https://codehub-ext.cn-east-3.myhuaweicloud.com") + + CN_EAST_2 = Region(id="cn-east-2", endpoint="https://codehub-ext.cn-east-2.myhuaweicloud.com") + + static_fields = { + "cn-north-1": CN_NORTH_1, + "cn-north-4": CN_NORTH_4, + "cn-south-1": CN_SOUTH_1, + "cn-south-2": CN_SOUTH_2, + "cn-east-3": CN_EAST_3, + "cn-east-2": CN_EAST_2, + } + + @staticmethod + def value_of(region_id, static_fields=types.MappingProxyType(static_fields) if six.PY3 else static_fields): + if region_id is None or len(region_id) == 0: + raise KeyError("Unexpected empty parameter: region_id.") + if not static_fields.get(region_id): + raise KeyError("Unexpected region_id: " + region_id) + return static_fields.get(region_id) + + diff --git a/huaweicloud-sdk-codehub/requirements.txt b/huaweicloud-sdk-codehub/requirements.txt new file mode 100644 index 0000000000..bf54e8e3d8 --- /dev/null +++ b/huaweicloud-sdk-codehub/requirements.txt @@ -0,0 +1 @@ +huaweicloud-sdk-python-core diff --git a/huaweicloud-sdk-codehub/setup.py b/huaweicloud-sdk-codehub/setup.py new file mode 100644 index 0000000000..43ecb9dd3c --- /dev/null +++ b/huaweicloud-sdk-codehub/setup.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +@author: JeffreyDin +@license: +@contact: dingjianfeng15@gmail.com +@software: +@file: setup.py +@ide: PyCharm +@time: 2021/6/3 11:48 +@desc: +""" +from os import path + +from setuptools import setup, find_packages + +NAME = "huaweicloudsdkcodehub" +VERSION = "3.0.45" +AUTHOR = "HuaweiCloud SDK" +AUTHOR_EMAIL = "hwcloudsdk@huawei.com" +URL = "https://github.com/huaweicloud/huaweicloud-sdk-python-v3" + +DESCRIPTION = "CodeHub" +this_directory = path.abspath(path.dirname(__file__)) +with open(path.join(this_directory, 'README_PYPI.md'), encoding='utf-8') as f: + LONG_DESCRIPTION = f.read() + +REQUIRES = ["huaweicloudsdkcore"] + +OPTIONS = { + 'bdist_wheel': { + 'universal': True + } +} + +setup( + name=NAME, + version=VERSION, + options=OPTIONS, + description=DESCRIPTION, + long_description=LONG_DESCRIPTION, + long_description_content_type='text/markdown', + author=AUTHOR, + author_email=AUTHOR_EMAIL, + license="Apache LICENSE 2.0", + url=URL, + keywords=["huaweicloud", "sdk", "CodeHub"], + packages=find_packages(exclude=["tests*"]), + install_requires=REQUIRES, + python_requires=">=2.7", + include_package_data=True, + classifiers=[ + 'Development Status :: 5 - Production/Stable', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: Apache Software License', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Topic :: Software Development' + ] +) diff --git a/huaweicloud-sdk-codehub/test-requirements.txt b/huaweicloud-sdk-codehub/test-requirements.txt new file mode 100644 index 0000000000..2702246c0e --- /dev/null +++ b/huaweicloud-sdk-codehub/test-requirements.txt @@ -0,0 +1,5 @@ +coverage>=4.0.3 +nose>=1.3.7 +pluggy>=0.3.1 +py>=1.4.31 +randomize>=0.13