Skip to content

Commit

Permalink
update to v2.8.0 schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Sczlog committed May 4, 2023
1 parent 34e4dd5 commit d4a2e47
Show file tree
Hide file tree
Showing 15 changed files with 69 additions and 33 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ Python 环境下的 Cloudtower SDK,适用于 2.7 与 3.4 以上版本。
- ### whl

```shell
pip install cloudtower_sdk-2.7.0-py2.py3-none-any.whl
pip install cloudtower_sdk-2.8.0-py2.py3-none-any.whl
```

- ### tar.gz

```shell
tar xvzf cloudtower-sdk-2.7.0.tar.gz
cd cloudtower-sdk-2.7.0
tar xvzf cloudtower-sdk-2.8.0.tar.gz
cd cloudtower-sdk-2.8.0
python setup.py install
```

Expand Down
6 changes: 6 additions & 0 deletions RELEASENOTE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# RELEASE NOTE

## release 日期 2022-05-04

v2.8.0 release

- optimize: VlanApi: [vm_vlan_creation_params], [vm_vlan_updation_params_data], [management_vlan_updation_params_data] 限制 `VlanId` 范围为 0~4095

## release 日期 2022-03-22

v2.7.0 release
Expand Down
2 changes: 1 addition & 1 deletion cloudtower/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# flake8: noqa
from __future__ import absolute_import

__version__ = "2.7.0"
__version__ = "2.8.0"

# import apis into sdk package
from cloudtower.api.alert_api import AlertApi
Expand Down
4 changes: 2 additions & 2 deletions cloudtower/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
cloudtower operation API and SDK # noqa: E501
The version of the OpenAPI document: 2.7.0
The version of the OpenAPI document: 2.8.0
Contact: info@smartx.com
Generated by: https://openapi-generator.tech
"""
Expand Down Expand Up @@ -79,7 +79,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'OpenAPI-Generator/2.7.0/python'
self.user_agent = 'OpenAPI-Generator/2.8.0/python'
self.client_side_validation = configuration.client_side_validation

def __enter__(self):
Expand Down
4 changes: 2 additions & 2 deletions cloudtower/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,8 @@ def to_debug_report(self):
return "Python SDK Debug Report:\n"\
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: 2.7.0\n"\
"SDK Package Version: 2.7.0".\
"Version of the API: 2.8.0\n"\
"SDK Package Version: 2.8.0".\
format(env=sys.platform, pyversion=sys.version)

def get_host_settings(self):
Expand Down
6 changes: 6 additions & 0 deletions cloudtower/models/management_vlan_updation_params_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ def vlan_id(self, vlan_id):
:param vlan_id: The vlan_id of this ManagementVlanUpdationParamsData. # noqa: E501
:type vlan_id: int
"""
if (self.local_vars_configuration.client_side_validation and
vlan_id is not None and vlan_id > 4095): # noqa: E501
raise ValueError("Invalid value for `vlan_id`, must be a value less than or equal to `4095`") # noqa: E501
if (self.local_vars_configuration.client_side_validation and
vlan_id is not None and vlan_id < 0): # noqa: E501
raise ValueError("Invalid value for `vlan_id`, must be a value greater than or equal to `0`") # noqa: E501

self._vlan_id = vlan_id

Expand Down
6 changes: 6 additions & 0 deletions cloudtower/models/vm_vlan_creation_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ def vlan_id(self, vlan_id):
"""
if self.local_vars_configuration.client_side_validation and vlan_id is None: # noqa: E501
raise ValueError("Invalid value for `vlan_id`, must not be `None`") # noqa: E501
if (self.local_vars_configuration.client_side_validation and
vlan_id is not None and vlan_id > 4095): # noqa: E501
raise ValueError("Invalid value for `vlan_id`, must be a value less than or equal to `4095`") # noqa: E501
if (self.local_vars_configuration.client_side_validation and
vlan_id is not None and vlan_id < 0): # noqa: E501
raise ValueError("Invalid value for `vlan_id`, must be a value greater than or equal to `0`") # noqa: E501

self._vlan_id = vlan_id

Expand Down
6 changes: 6 additions & 0 deletions cloudtower/models/vm_vlan_updation_params_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ def vlan_id(self, vlan_id):
:param vlan_id: The vlan_id of this VmVlanUpdationParamsData. # noqa: E501
:type vlan_id: int
"""
if (self.local_vars_configuration.client_side_validation and
vlan_id is not None and vlan_id > 4095): # noqa: E501
raise ValueError("Invalid value for `vlan_id`, must be a value less than or equal to `4095`") # noqa: E501
if (self.local_vars_configuration.client_side_validation and
vlan_id is not None and vlan_id < 0): # noqa: E501
raise ValueError("Invalid value for `vlan_id`, must be a value greater than or equal to `0`") # noqa: E501

self._vlan_id = vlan_id

Expand Down
20 changes: 10 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# coding: utf-8

"""
CloudTower APIs
cloudtower operation API and SDK # noqa: E501
The version of the OpenAPI document: 2.7.0
Contact: info@smartx.com
Generated by: https://openapi-generator.tech
"""
"""
CloudTower APIs
cloudtower operation API and SDK # noqa: E501
The version of the OpenAPI document: 2.8.0
Contact: info@smartx.com
Generated by: https://openapi-generator.tech
"""


import pathlib
from setuptools import setup, find_packages # noqa: H301

NAME = "cloudtower-sdk"
VERSION = "2.7.0"
VERSION = "2.8.0"
# To install the library, run the following
#
# python setup.py install
Expand Down
9 changes: 9 additions & 0 deletions test/fixture/api/iscsi_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import pytest

import test.fixture.client
from cloudtower.api.iscsi_connection_api import IscsiConnectionApi


@pytest.fixture(scope="session")
def iscsi_connection_api(client):
return IscsiConnectionApi(client)
7 changes: 4 additions & 3 deletions test/fixture/resource/fixture_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
VmFirmware,
VmWhereInput,
GetVmsRequestBody,
VmOperateParams
VmOperateParams,
VmDeleteParams
)


Expand Down Expand Up @@ -61,7 +62,7 @@ def stopped_vm(default_cluster, default_vlan, vm_api, wait_task, wait_entity_asy
where=vm_where_input
))[0].task_id
wait_task(id=task_id)
delete_result = vm_api.delete_vm(vm_operate_params=VmOperateParams(
delete_result = vm_api.delete_vm(vm_delete_params=VmDeleteParams(
where=vm_where_input
))
wait_task(delete_result[0].task_id)
Expand Down Expand Up @@ -116,7 +117,7 @@ def running_vm(default_cluster, default_vlan, vm_api, wait_task, wait_entity_asy
where=vm_where_input
))[0].task_id
wait_task(id=task_id)
delete_result = vm_api.delete_vm(vm_operate_params=VmOperateParams(
delete_result = vm_api.delete_vm(vm_delete_params=VmDeleteParams(
where=vm_where_input
))
wait_task(delete_result[0].task_id)
4 changes: 2 additions & 2 deletions test/test_iscsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@


class TestIscsi:
def test_get_iscsi_connections_connection_call(self, iscsi_api):
iscsi_api.get_iscsi_connections_connection(
def test_get_iscsi_connections_connection_call(self, iscsi_connection_api):
iscsi_connection_api.get_iscsi_connections_connection(
get_iscsi_connections_connection_request_body=GetIscsiConnectionsConnectionRequestBody()
)
assert 0 is 0
9 changes: 5 additions & 4 deletions test/test_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
VmUpdateNicParams,
VmUpdateNicParamsData,
VmRemoveNicParams,
VmRemoveNicParamsData
VmRemoveNicParamsData,
VmDeleteParams
)


Expand Down Expand Up @@ -96,7 +97,7 @@ def test_create_and_delete_vm(self, vm_api, default_cluster, default_vlan, wait_
id=create_vm.id
)
)
delete_result = vm_api.delete_vm(vm_operate_params=deletion_params)
delete_result = vm_api.delete_vm(vm_delete_params=deletion_params)
delete_task_id = delete_result[0].task_id
wait_task(id=delete_task_id)
assert 0 is 0
Expand All @@ -111,7 +112,7 @@ def test_clone_vm(self, vm_api, stopped_vm, default_cluster, wait_task):
wait_task(clone_result[0].task_id)
wait_task(
vm_api.delete_vm(
vm_operate_params=VmOperateParams(
vm_delete_params=VmDeleteParams(
where=VmWhereInput(
id=clone_result[0].data.id
)
Expand Down Expand Up @@ -150,7 +151,7 @@ def test_migrate_vm(self, host_api, vm_api, default_cluster, stopped_vm, wait_ta
assert migrate_result is not None
wait_task(migrate_result[0].task_id)
wait_task(
vm_api.delete_vm(vm_operate_params=VmOperateParams(
vm_api.delete_vm(vm_delete_params=VmOperateParams(
where=VmWhereInput(
id=migrate_result[0].data.id
)
Expand Down
4 changes: 2 additions & 2 deletions test/test_vm_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
VmSnapshotDeletionParams,
VmSnapshotWhereInput,
VmRebuildParams,
VmOperateParams,
VmDeleteParams,
VmWhereInput,
VmRollbackParams,
VmRollbackParamsData
Expand Down Expand Up @@ -72,7 +72,7 @@ def test_rebuild_vm(self, vm_api, vm_snapshot, default_cluster, wait_task):
wait_task(rebuild_result[0].task_id)
wait_task(
vm_api.delete_vm(
vm_operate_params=VmOperateParams(
vm_delete_params=VmDeleteParams(
where=VmWhereInput(
id=rebuild_result[0].data.id
)
Expand Down
9 changes: 5 additions & 4 deletions test/test_vm_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
ConvertVmTemplateToVmParams,
VmCreateVmFromTemplateParams,
VmOperateParams,
VmDeleteParams,
VmWhereInput,
)

Expand Down Expand Up @@ -115,13 +116,13 @@ def test_convert_vm_template_to_vm(self, vm_api, vm_template_api, vm_template, w
assert convert_result is not None
wait_task(convert_result[0].task_id)

delete_param = VmOperateParams(
delete_param = VmDeleteParams(
where=VmWhereInput(
id=convert_result[0].data.id
)
)
delete_result = vm_api.delete_vm(
vm_operate_params=delete_param
vm_delete_params=delete_param
)
wait_task(delete_result[0].task_id)

Expand All @@ -140,12 +141,12 @@ def test_create_vm_from_template(self, vm_api, vm_template_api, vm_template, wai
assert create_result is not None
wait_task(create_result[0].task_id)

delete_param = VmOperateParams(
delete_param = VmDeleteParams(
where=VmWhereInput(
id=create_result[0].data.id
)
)
delete_result = vm_api.delete_vm(
vm_operate_params=delete_param
vm_delete_params=delete_param
)
wait_task(delete_result[0].task_id)

0 comments on commit d4a2e47

Please sign in to comment.