Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release 3.0.45 source code for python #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions huaweicloud-sdk-codehub/LICENSE
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions huaweicloud-sdk-codehub/README_PYPI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See detailed information in [huaweicloud-sdk-python-v3](https://github.com/huaweicloud/huaweicloud-sdk-python-v3).
12 changes: 12 additions & 0 deletions huaweicloud-sdk-codehub/huaweicloudsdkcodehub/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: JeffreyDin
@license:
@contact: [email protected]
@software:
@file: __init__.py
@ide: PyCharm
@time: 2021/5/18 18:41
@desc:
"""
28 changes: 28 additions & 0 deletions huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: JeffreyDin
@license:
@contact: [email protected]
@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
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: JeffreyDin
@license:
@contact: [email protected]
@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
209 changes: 209 additions & 0 deletions huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/codehub_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: JeffreyDin
@license:
@contact: [email protected]
@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)
22 changes: 22 additions & 0 deletions huaweicloud-sdk-codehub/huaweicloudsdkcodehub/v2/model/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: JeffreyDin
@license:
@contact: [email protected]
@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
Loading